@ai-matrx/design-system 0.21.13 → 0.22.0
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/CHANGELOG.md +51 -0
- package/dist/content-transfer.cjs +1 -0
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +1 -0
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.cjs.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +2 -1
- package/dist/data-table/copy-helpers.d.ts +2 -1
- package/dist/data-table/copy-helpers.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +1 -0
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +1 -0
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +1 -0
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +1 -0
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.cjs +6 -2
- package/dist/data-table/filter-engine.cjs.map +1 -1
- package/dist/data-table/filter-engine.d.cts +2 -1
- package/dist/data-table/filter-engine.d.ts +2 -1
- package/dist/data-table/filter-engine.js +6 -2
- package/dist/data-table/filter-engine.js.map +1 -1
- package/dist/data-table/host.d.cts +2 -1
- package/dist/data-table/host.d.ts +2 -1
- package/dist/data-table/index.cjs +1547 -425
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +91 -3
- package/dist/data-table/index.d.ts +91 -3
- package/dist/data-table/index.js +1549 -423
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.cjs.map +1 -1
- package/dist/data-table/infer-filter.d.cts +2 -1
- package/dist/data-table/infer-filter.d.ts +2 -1
- package/dist/data-table/infer-filter.js.map +1 -1
- package/dist/data-table/layered-filters.d.cts +2 -1
- package/dist/data-table/layered-filters.d.ts +2 -1
- package/dist/data-table/query-control.cjs.map +1 -1
- package/dist/data-table/query-control.d.cts +2 -1
- package/dist/data-table/query-control.d.ts +2 -1
- package/dist/data-table/query-control.js.map +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +2 -1
- package/dist/data-table/types.d.ts +2 -1
- package/dist/data-table/url-state.d.cts +2 -1
- package/dist/data-table/url-state.d.ts +2 -1
- package/dist/data-table/xlsx.cjs.map +1 -1
- package/dist/data-table/xlsx.d.cts +2 -1
- package/dist/data-table/xlsx.d.ts +2 -1
- package/dist/data-table/xlsx.js.map +1 -1
- package/dist/field-formats/index.cjs +741 -0
- package/dist/field-formats/index.cjs.map +1 -0
- package/dist/field-formats/index.d.cts +45 -0
- package/dist/field-formats/index.d.ts +45 -0
- package/dist/field-formats/index.js +723 -0
- package/dist/field-formats/index.js.map +1 -0
- package/dist/types-BdbvlF9-.d.cts +204 -0
- package/dist/types-BdbvlF9-.d.ts +204 -0
- package/dist/{types-D9b_LfTB.d.ts → types-D-flTpK0.d.ts} +241 -1
- package/dist/{types-DaKPLM6T.d.cts → types-Sn249eoy.d.cts} +241 -1
- package/package.json +11 -1
|
@@ -31,30 +31,61 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/data-table/index.ts
|
|
32
32
|
var data_table_exports = {};
|
|
33
33
|
__export(data_table_exports, {
|
|
34
|
+
BOOLEAN_TRUE_COLOR: () => BOOLEAN_TRUE_COLOR,
|
|
35
|
+
CELL_TINT_CLASS: () => CELL_TINT_CLASS,
|
|
36
|
+
COLOR_RULE_OPS: () => COLOR_RULE_OPS,
|
|
37
|
+
COLOR_RULE_OP_LABELS: () => COLOR_RULE_OP_LABELS,
|
|
34
38
|
DataRowInspector: () => DataRowInspector,
|
|
35
39
|
DataRowWindow: () => DataRowWindow,
|
|
40
|
+
EMPTY_TABLE_STYLE: () => EMPTY_TABLE_STYLE,
|
|
41
|
+
FORMAT_MISMATCH_CLASS: () => FORMAT_MISMATCH_CLASS,
|
|
42
|
+
FormattedCell: () => FormattedCell,
|
|
36
43
|
GenericTablePagination: () => GenericTablePagination,
|
|
37
44
|
MatrxDataTable: () => MatrxDataTable,
|
|
38
45
|
MatrxDataTableProvider: () => MatrxDataTableProvider,
|
|
39
46
|
MatrxTableRowAlchemyProvider: () => MatrxTableRowAlchemyProvider,
|
|
40
47
|
MatrxUuidCell: () => MatrxUuidCell,
|
|
48
|
+
NO_FROZEN_COLUMNS: () => NO_FROZEN_COLUMNS,
|
|
49
|
+
OPS_WITH_VALUE: () => OPS_WITH_VALUE,
|
|
50
|
+
ROW_TINT_CLASS: () => ROW_TINT_CLASS,
|
|
51
|
+
STYLE_COLORS: () => STYLE_COLORS,
|
|
52
|
+
STYLE_COLOR_LABELS: () => STYLE_COLOR_LABELS,
|
|
53
|
+
SWATCH_CLASS: () => SWATCH_CLASS,
|
|
41
54
|
SavedViewsControl: () => SavedViewsControl,
|
|
55
|
+
TABLE_STYLE_METADATA_KEY: () => TABLE_STYLE_METADATA_KEY,
|
|
56
|
+
TABLE_STYLE_VERSION: () => TABLE_STYLE_VERSION,
|
|
42
57
|
TableTitleRow: () => TableTitleRow,
|
|
43
58
|
TableViewTabs: () => TableViewTabs,
|
|
59
|
+
alignForFormat: () => alignForFormat,
|
|
60
|
+
applyStylePath: () => applyStylePath,
|
|
44
61
|
buildRowAgentInput: () => buildRowAgentInput,
|
|
45
62
|
buildViewAgentInput: () => buildViewAgentInput,
|
|
46
63
|
buildViewHuman: () => buildViewHuman,
|
|
47
64
|
collectSelectOptions: () => collectSelectOptions,
|
|
65
|
+
colorForChoice: () => colorForChoice,
|
|
48
66
|
downloadTableAsXlsx: () => downloadTableAsXlsx,
|
|
67
|
+
evaluateRule: () => evaluateRule,
|
|
49
68
|
filterKindLabel: () => filterKindLabel,
|
|
69
|
+
formatColumnValue: () => formatColumnValue,
|
|
70
|
+
inferTableSearchRole: () => inferTableSearchRole,
|
|
71
|
+
isStyleColor: () => isStyleColor,
|
|
72
|
+
parseTableStyle: () => parseTableStyle,
|
|
50
73
|
parseTableViewSnapshot: () => parseTableViewSnapshot,
|
|
74
|
+
pixelWidth: () => pixelWidth,
|
|
51
75
|
rankTableSearchRows: () => rankTableSearchRows,
|
|
76
|
+
resolveCellColor: () => resolveCellColor,
|
|
52
77
|
resolveColumnMarker: () => resolveColumnMarker,
|
|
53
78
|
resolveFilterKind: () => resolveFilterKind,
|
|
79
|
+
resolveFrozenColumns: () => resolveFrozenColumns,
|
|
80
|
+
resolveRowColor: () => resolveRowColor,
|
|
81
|
+
resolveTableSearchScopes: () => resolveTableSearchScopes,
|
|
54
82
|
rowsToCsvFromColumns: () => rowsToCsvFromColumns,
|
|
55
83
|
rowsToMarkdownTable: () => rowsToMarkdownTable,
|
|
56
84
|
rowsToRecordsFromColumns: () => rowsToRecordsFromColumns,
|
|
57
85
|
shortUuid: () => shortUuid,
|
|
86
|
+
stylePath: () => stylePath,
|
|
87
|
+
tableStyleFromMetadata: () => tableStyleFromMetadata,
|
|
88
|
+
tableStyleIsEmpty: () => tableStyleIsEmpty,
|
|
58
89
|
tableUrlParamPrefix: () => tableUrlParamPrefix,
|
|
59
90
|
useMatrxDataTableHost: () => useMatrxDataTableHost,
|
|
60
91
|
useMatrxTableRowAlchemy: () => useMatrxTableRowAlchemy,
|
|
@@ -282,7 +313,7 @@ function useColumnReorderAnimation(tableRef, order, dragging) {
|
|
|
282
313
|
}
|
|
283
314
|
|
|
284
315
|
// src/data-table/MatrxDataTable.tsx
|
|
285
|
-
var
|
|
316
|
+
var import_format5 = require("@ai-matrx/kit/format");
|
|
286
317
|
|
|
287
318
|
// src/checkbox.tsx
|
|
288
319
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
@@ -3179,6 +3210,7 @@ var outcomeMessage = (result) => {
|
|
|
3179
3210
|
const success = result;
|
|
3180
3211
|
return success.delivered === "action" ? success.message ?? "Action completed" : success.delivered === "download-started" ? "Download started" : success.message ?? "Copied";
|
|
3181
3212
|
}
|
|
3213
|
+
if (result.status === "queued") return `${result.message} ${result.remedy}`;
|
|
3182
3214
|
return result.status === "degraded" ? `Copied as plain text: ${result.reason}` : result.status === "cancelled" ? "Cancelled" : result.message;
|
|
3183
3215
|
};
|
|
3184
3216
|
var materialIds = /* @__PURE__ */ new WeakMap();
|
|
@@ -5139,8 +5171,12 @@ function passesColumnFilter(value, filter) {
|
|
|
5139
5171
|
return Boolean(value) === filter.value;
|
|
5140
5172
|
}
|
|
5141
5173
|
case "number": {
|
|
5142
|
-
const
|
|
5143
|
-
if (
|
|
5174
|
+
const raw = stringifyCellValue(value).trim();
|
|
5175
|
+
if (raw === "") return false;
|
|
5176
|
+
const normalized = raw.replace(/[^0-9.-]/g, "");
|
|
5177
|
+
if (normalized === "") return false;
|
|
5178
|
+
const n = typeof value === "number" ? value : Number(normalized);
|
|
5179
|
+
if (!Number.isFinite(n)) return false;
|
|
5144
5180
|
if (filter.min !== void 0 && n < filter.min) return false;
|
|
5145
5181
|
if (filter.max !== void 0 && n > filter.max) return false;
|
|
5146
5182
|
return true;
|
|
@@ -7010,6 +7046,295 @@ function ColumnManagerDragHandle({ id, label }) {
|
|
|
7010
7046
|
|
|
7011
7047
|
// src/data-table/saved-view-snapshot.ts
|
|
7012
7048
|
var import_zod2 = require("zod");
|
|
7049
|
+
|
|
7050
|
+
// src/data-table/table-style.ts
|
|
7051
|
+
var TABLE_STYLE_VERSION = 1;
|
|
7052
|
+
var STYLE_COLORS = [
|
|
7053
|
+
"slate",
|
|
7054
|
+
"green",
|
|
7055
|
+
"amber",
|
|
7056
|
+
"red",
|
|
7057
|
+
"blue",
|
|
7058
|
+
"violet",
|
|
7059
|
+
"teal"
|
|
7060
|
+
];
|
|
7061
|
+
function isStyleColor(v) {
|
|
7062
|
+
return typeof v === "string" && STYLE_COLORS.includes(v);
|
|
7063
|
+
}
|
|
7064
|
+
var COLOR_RULE_OPS = [
|
|
7065
|
+
"is",
|
|
7066
|
+
"is_not",
|
|
7067
|
+
"contains",
|
|
7068
|
+
"is_empty",
|
|
7069
|
+
"not_empty",
|
|
7070
|
+
"is_true",
|
|
7071
|
+
"is_false",
|
|
7072
|
+
"gt",
|
|
7073
|
+
"gte",
|
|
7074
|
+
"lt",
|
|
7075
|
+
"lte"
|
|
7076
|
+
];
|
|
7077
|
+
var OPS_WITH_VALUE = [
|
|
7078
|
+
"is",
|
|
7079
|
+
"is_not",
|
|
7080
|
+
"contains",
|
|
7081
|
+
"gt",
|
|
7082
|
+
"gte",
|
|
7083
|
+
"lt",
|
|
7084
|
+
"lte"
|
|
7085
|
+
];
|
|
7086
|
+
var COLOR_RULE_OP_LABELS = {
|
|
7087
|
+
is: "is",
|
|
7088
|
+
is_not: "is not",
|
|
7089
|
+
contains: "contains",
|
|
7090
|
+
is_empty: "is empty",
|
|
7091
|
+
not_empty: "is not empty",
|
|
7092
|
+
is_true: "is checked",
|
|
7093
|
+
is_false: "is unchecked",
|
|
7094
|
+
gt: "is greater than",
|
|
7095
|
+
gte: "is at least",
|
|
7096
|
+
lt: "is less than",
|
|
7097
|
+
lte: "is at most"
|
|
7098
|
+
};
|
|
7099
|
+
var EMPTY_TABLE_STYLE = { version: TABLE_STYLE_VERSION };
|
|
7100
|
+
var TABLE_STYLE_METADATA_KEY = "style";
|
|
7101
|
+
function tableStyleIsEmpty(style) {
|
|
7102
|
+
return !style.colorBy && (style.rules?.length ?? 0) === 0 && Object.keys(style.rows ?? {}).length === 0 && Object.keys(style.cells ?? {}).length === 0 && Object.keys(style.columns ?? {}).length === 0;
|
|
7103
|
+
}
|
|
7104
|
+
function isRecord(v) {
|
|
7105
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
7106
|
+
}
|
|
7107
|
+
function parseColorMap(raw) {
|
|
7108
|
+
const out = {};
|
|
7109
|
+
if (!isRecord(raw)) return out;
|
|
7110
|
+
for (const [k, v] of Object.entries(raw)) if (isStyleColor(v)) out[k] = v;
|
|
7111
|
+
return out;
|
|
7112
|
+
}
|
|
7113
|
+
function parseRule(raw) {
|
|
7114
|
+
if (!isRecord(raw)) return null;
|
|
7115
|
+
const { id, field, op, value, color, target } = raw;
|
|
7116
|
+
if (typeof id !== "string" || typeof field !== "string") return null;
|
|
7117
|
+
if (typeof op !== "string" || !COLOR_RULE_OPS.includes(op)) return null;
|
|
7118
|
+
if (!isStyleColor(color)) return null;
|
|
7119
|
+
if (target !== "row" && target !== "cell") return null;
|
|
7120
|
+
return {
|
|
7121
|
+
id,
|
|
7122
|
+
field,
|
|
7123
|
+
op,
|
|
7124
|
+
color,
|
|
7125
|
+
target,
|
|
7126
|
+
...typeof value === "string" || typeof value === "number" ? { value: String(value) } : {}
|
|
7127
|
+
};
|
|
7128
|
+
}
|
|
7129
|
+
function parseTableStyle(raw) {
|
|
7130
|
+
if (!isRecord(raw)) return { ...EMPTY_TABLE_STYLE };
|
|
7131
|
+
const style = { version: TABLE_STYLE_VERSION };
|
|
7132
|
+
const colorBy = raw.colorBy;
|
|
7133
|
+
if (isRecord(colorBy) && typeof colorBy.field === "string" && (colorBy.target === "row" || colorBy.target === "cell")) {
|
|
7134
|
+
style.colorBy = { field: colorBy.field, target: colorBy.target };
|
|
7135
|
+
}
|
|
7136
|
+
if (Array.isArray(raw.rules)) {
|
|
7137
|
+
const rules = raw.rules.map(parseRule).filter((r) => r !== null);
|
|
7138
|
+
if (rules.length > 0) style.rules = rules;
|
|
7139
|
+
}
|
|
7140
|
+
const rows = parseColorMap(raw.rows);
|
|
7141
|
+
if (Object.keys(rows).length > 0) style.rows = rows;
|
|
7142
|
+
const columns = parseColorMap(raw.columns);
|
|
7143
|
+
if (Object.keys(columns).length > 0) style.columns = columns;
|
|
7144
|
+
if (isRecord(raw.cells)) {
|
|
7145
|
+
const cells = {};
|
|
7146
|
+
for (const [rowId, byField] of Object.entries(raw.cells)) {
|
|
7147
|
+
const parsed = parseColorMap(byField);
|
|
7148
|
+
if (Object.keys(parsed).length > 0) cells[rowId] = parsed;
|
|
7149
|
+
}
|
|
7150
|
+
if (Object.keys(cells).length > 0) style.cells = cells;
|
|
7151
|
+
}
|
|
7152
|
+
return style;
|
|
7153
|
+
}
|
|
7154
|
+
function tableStyleFromMetadata(metadata) {
|
|
7155
|
+
return parseTableStyle(isRecord(metadata) ? metadata[TABLE_STYLE_METADATA_KEY] : null);
|
|
7156
|
+
}
|
|
7157
|
+
function cellText(value) {
|
|
7158
|
+
if (value === null || value === void 0) return "";
|
|
7159
|
+
if (Array.isArray(value)) return value.map((v) => String(v)).join(", ");
|
|
7160
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
7161
|
+
return String(value);
|
|
7162
|
+
}
|
|
7163
|
+
function isEmptyValue(value) {
|
|
7164
|
+
if (value === null || value === void 0) return true;
|
|
7165
|
+
if (typeof value === "string") return value.trim() === "";
|
|
7166
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
7167
|
+
return false;
|
|
7168
|
+
}
|
|
7169
|
+
function evaluateRule(rule, value) {
|
|
7170
|
+
switch (rule.op) {
|
|
7171
|
+
case "is_empty":
|
|
7172
|
+
return isEmptyValue(value);
|
|
7173
|
+
case "not_empty":
|
|
7174
|
+
return !isEmptyValue(value);
|
|
7175
|
+
case "is_true":
|
|
7176
|
+
return value === true;
|
|
7177
|
+
case "is_false":
|
|
7178
|
+
return value === false;
|
|
7179
|
+
case "is": {
|
|
7180
|
+
const want = (rule.value ?? "").trim().toLowerCase();
|
|
7181
|
+
if (Array.isArray(value)) {
|
|
7182
|
+
return value.some((v) => cellText(v).trim().toLowerCase() === want);
|
|
7183
|
+
}
|
|
7184
|
+
return cellText(value).trim().toLowerCase() === want;
|
|
7185
|
+
}
|
|
7186
|
+
case "is_not": {
|
|
7187
|
+
const want = (rule.value ?? "").trim().toLowerCase();
|
|
7188
|
+
if (Array.isArray(value)) {
|
|
7189
|
+
return !value.some((v) => cellText(v).trim().toLowerCase() === want);
|
|
7190
|
+
}
|
|
7191
|
+
return cellText(value).trim().toLowerCase() !== want;
|
|
7192
|
+
}
|
|
7193
|
+
case "contains": {
|
|
7194
|
+
const want = (rule.value ?? "").trim().toLowerCase();
|
|
7195
|
+
if (!want) return false;
|
|
7196
|
+
return cellText(value).toLowerCase().includes(want);
|
|
7197
|
+
}
|
|
7198
|
+
case "gt":
|
|
7199
|
+
case "gte":
|
|
7200
|
+
case "lt":
|
|
7201
|
+
case "lte": {
|
|
7202
|
+
const left = typeof value === "number" ? value : Number(cellText(value));
|
|
7203
|
+
const right = Number(rule.value);
|
|
7204
|
+
if (!Number.isFinite(left) || !Number.isFinite(right)) return false;
|
|
7205
|
+
if (rule.op === "gt") return left > right;
|
|
7206
|
+
if (rule.op === "gte") return left >= right;
|
|
7207
|
+
if (rule.op === "lt") return left < right;
|
|
7208
|
+
return left <= right;
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
function colorForChoice(choices, value) {
|
|
7213
|
+
if (!choices || choices.length === 0) return void 0;
|
|
7214
|
+
const wanted = String(value);
|
|
7215
|
+
const index = choices.findIndex((c) => c.value === wanted);
|
|
7216
|
+
if (index === -1) return void 0;
|
|
7217
|
+
const declared = choices[index]?.color;
|
|
7218
|
+
if (isStyleColor(declared)) return declared;
|
|
7219
|
+
return STYLE_COLORS[index % STYLE_COLORS.length];
|
|
7220
|
+
}
|
|
7221
|
+
var BOOLEAN_TRUE_COLOR = "green";
|
|
7222
|
+
function colorByFor(style, target, data, choiceColorFor) {
|
|
7223
|
+
const cb = style.colorBy;
|
|
7224
|
+
if (!cb || cb.target !== target) return null;
|
|
7225
|
+
const value = data[cb.field];
|
|
7226
|
+
if (value === true) return BOOLEAN_TRUE_COLOR;
|
|
7227
|
+
if (value === false || isEmptyValue(value)) return null;
|
|
7228
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
7229
|
+
return choiceColorFor(cb.field, first) ?? null;
|
|
7230
|
+
}
|
|
7231
|
+
function ruleColorFor(style, target, data, fieldName) {
|
|
7232
|
+
for (const rule of style.rules ?? []) {
|
|
7233
|
+
if (rule.target !== target) continue;
|
|
7234
|
+
if (target === "cell" && rule.field !== fieldName) continue;
|
|
7235
|
+
if (evaluateRule(rule, data[rule.field])) return rule.color;
|
|
7236
|
+
}
|
|
7237
|
+
return null;
|
|
7238
|
+
}
|
|
7239
|
+
function resolveRowColor(style, row, choiceColorFor) {
|
|
7240
|
+
return style.rows?.[row.id] ?? ruleColorFor(style, "row", row.data) ?? colorByFor(style, "row", row.data, choiceColorFor);
|
|
7241
|
+
}
|
|
7242
|
+
function resolveCellColor(style, row, fieldName, choiceColorFor) {
|
|
7243
|
+
const manual = style.cells?.[row.id]?.[fieldName];
|
|
7244
|
+
if (manual) return manual;
|
|
7245
|
+
const rule = ruleColorFor(style, "cell", row.data, fieldName);
|
|
7246
|
+
if (rule) return rule;
|
|
7247
|
+
if (style.colorBy?.target === "cell" && style.colorBy.field === fieldName) {
|
|
7248
|
+
const cb = colorByFor(style, "cell", row.data, choiceColorFor);
|
|
7249
|
+
if (cb) return cb;
|
|
7250
|
+
}
|
|
7251
|
+
return style.columns?.[fieldName] ?? null;
|
|
7252
|
+
}
|
|
7253
|
+
var ROW_TINT_CLASS = {
|
|
7254
|
+
slate: "bg-slate-100/70 dark:bg-slate-800/40",
|
|
7255
|
+
green: "bg-green-50 dark:bg-green-950/40",
|
|
7256
|
+
amber: "bg-amber-50 dark:bg-amber-950/40",
|
|
7257
|
+
red: "bg-red-50 dark:bg-red-950/40",
|
|
7258
|
+
blue: "bg-blue-50 dark:bg-blue-950/40",
|
|
7259
|
+
violet: "bg-violet-50 dark:bg-violet-950/40",
|
|
7260
|
+
teal: "bg-teal-50 dark:bg-teal-950/40"
|
|
7261
|
+
};
|
|
7262
|
+
var CELL_TINT_CLASS = {
|
|
7263
|
+
slate: "bg-slate-200/70 dark:bg-slate-700/50",
|
|
7264
|
+
green: "bg-green-100 dark:bg-green-900/50",
|
|
7265
|
+
amber: "bg-amber-100 dark:bg-amber-900/50",
|
|
7266
|
+
red: "bg-red-100 dark:bg-red-900/50",
|
|
7267
|
+
blue: "bg-blue-100 dark:bg-blue-900/50",
|
|
7268
|
+
violet: "bg-violet-100 dark:bg-violet-900/50",
|
|
7269
|
+
teal: "bg-teal-100 dark:bg-teal-900/50"
|
|
7270
|
+
};
|
|
7271
|
+
var SWATCH_CLASS = {
|
|
7272
|
+
slate: "bg-slate-400",
|
|
7273
|
+
green: "bg-green-500",
|
|
7274
|
+
amber: "bg-amber-400",
|
|
7275
|
+
red: "bg-red-500",
|
|
7276
|
+
blue: "bg-blue-500",
|
|
7277
|
+
violet: "bg-violet-500",
|
|
7278
|
+
teal: "bg-teal-500"
|
|
7279
|
+
};
|
|
7280
|
+
var STYLE_COLOR_LABELS = {
|
|
7281
|
+
slate: "Gray",
|
|
7282
|
+
green: "Green",
|
|
7283
|
+
amber: "Amber",
|
|
7284
|
+
red: "Red",
|
|
7285
|
+
blue: "Blue",
|
|
7286
|
+
violet: "Violet",
|
|
7287
|
+
teal: "Teal"
|
|
7288
|
+
};
|
|
7289
|
+
var stylePath = {
|
|
7290
|
+
colorBy: () => ["colorBy"],
|
|
7291
|
+
rules: () => ["rules"],
|
|
7292
|
+
row: (rowId) => ["rows", rowId],
|
|
7293
|
+
cell: (rowId, fieldName) => ["cells", rowId, fieldName],
|
|
7294
|
+
column: (fieldName) => ["columns", fieldName]
|
|
7295
|
+
};
|
|
7296
|
+
function applyStylePath(style, path2, value) {
|
|
7297
|
+
const next = { ...style };
|
|
7298
|
+
const [head, a, b] = path2;
|
|
7299
|
+
switch (head) {
|
|
7300
|
+
case "colorBy":
|
|
7301
|
+
next.colorBy = value === null ? null : parseTableStyle({ colorBy: value }).colorBy ?? null;
|
|
7302
|
+
break;
|
|
7303
|
+
case "rules":
|
|
7304
|
+
next.rules = value === null ? [] : parseTableStyle({ rules: value }).rules ?? [];
|
|
7305
|
+
break;
|
|
7306
|
+
case "rows": {
|
|
7307
|
+
const rows = { ...style.rows ?? {} };
|
|
7308
|
+
if (a === void 0) break;
|
|
7309
|
+
if (isStyleColor(value)) rows[a] = value;
|
|
7310
|
+
else delete rows[a];
|
|
7311
|
+
next.rows = rows;
|
|
7312
|
+
break;
|
|
7313
|
+
}
|
|
7314
|
+
case "columns": {
|
|
7315
|
+
const columns = { ...style.columns ?? {} };
|
|
7316
|
+
if (a === void 0) break;
|
|
7317
|
+
if (isStyleColor(value)) columns[a] = value;
|
|
7318
|
+
else delete columns[a];
|
|
7319
|
+
next.columns = columns;
|
|
7320
|
+
break;
|
|
7321
|
+
}
|
|
7322
|
+
case "cells": {
|
|
7323
|
+
if (a === void 0 || b === void 0) break;
|
|
7324
|
+
const cells = { ...style.cells ?? {} };
|
|
7325
|
+
const byField = { ...cells[a] ?? {} };
|
|
7326
|
+
if (isStyleColor(value)) byField[b] = value;
|
|
7327
|
+
else delete byField[b];
|
|
7328
|
+
if (Object.keys(byField).length === 0) delete cells[a];
|
|
7329
|
+
else cells[a] = byField;
|
|
7330
|
+
next.cells = cells;
|
|
7331
|
+
break;
|
|
7332
|
+
}
|
|
7333
|
+
}
|
|
7334
|
+
return next;
|
|
7335
|
+
}
|
|
7336
|
+
|
|
7337
|
+
// src/data-table/saved-view-snapshot.ts
|
|
7013
7338
|
var filterSchema = import_zod2.z.union([
|
|
7014
7339
|
import_zod2.z.object({ kind: import_zod2.z.literal("text"), value: import_zod2.z.string(), mode: import_zod2.z.enum(["contains", "empty", "not_empty", "null", "not_null"]).optional(), negated: import_zod2.z.boolean().optional() }),
|
|
7015
7340
|
import_zod2.z.object({ kind: import_zod2.z.literal("select"), value: import_zod2.z.string(), values: import_zod2.z.array(import_zod2.z.string()).optional(), negated: import_zod2.z.boolean().optional() }),
|
|
@@ -7027,7 +7352,13 @@ var snapshotSchema = import_zod2.z.object({
|
|
|
7027
7352
|
}),
|
|
7028
7353
|
hidden: import_zod2.z.array(import_zod2.z.string().min(1)),
|
|
7029
7354
|
widths: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.number().finite().positive()).optional()
|
|
7030
|
-
})
|
|
7355
|
+
}),
|
|
7356
|
+
// The style is read by `parseTableStyle`, not described again here. That
|
|
7357
|
+
// reader is tolerant BY DESIGN — an unknown key, a retired color name or a
|
|
7358
|
+
// malformed rule is dropped, never thrown — and a Zod mirror of it would
|
|
7359
|
+
// reject a whole saved view over one stale rule, which is the opposite of
|
|
7360
|
+
// what a table must do when its colors go out of date.
|
|
7361
|
+
style: import_zod2.z.unknown().optional()
|
|
7031
7362
|
});
|
|
7032
7363
|
function normalizeFilters(raw) {
|
|
7033
7364
|
const filters = {};
|
|
@@ -7044,6 +7375,7 @@ function parseTableViewSnapshot(raw) {
|
|
|
7044
7375
|
const parsed = snapshotSchema.safeParse(raw);
|
|
7045
7376
|
if (!parsed.success) return null;
|
|
7046
7377
|
const { query, columns } = parsed.data;
|
|
7378
|
+
const style = parsed.data.style === void 0 ? null : parseTableStyle(parsed.data.style);
|
|
7047
7379
|
return {
|
|
7048
7380
|
__kind: "matrx-table-view",
|
|
7049
7381
|
version: 1,
|
|
@@ -7061,7 +7393,8 @@ function parseTableViewSnapshot(raw) {
|
|
|
7061
7393
|
order: columns.order,
|
|
7062
7394
|
hidden: columns.hidden,
|
|
7063
7395
|
...columns.widths === void 0 ? {} : { widths: columns.widths }
|
|
7064
|
-
}
|
|
7396
|
+
},
|
|
7397
|
+
...style === null || tableStyleIsEmpty(style) ? {} : { style }
|
|
7065
7398
|
};
|
|
7066
7399
|
}
|
|
7067
7400
|
|
|
@@ -7520,8 +7853,736 @@ function defaultRowTitle(row, columns) {
|
|
|
7520
7853
|
return value ? isUuidValue(value) ? value.slice(0, 8) : value : "Details";
|
|
7521
7854
|
}
|
|
7522
7855
|
|
|
7523
|
-
// src/data-table/
|
|
7856
|
+
// src/data-table/frozen-columns.ts
|
|
7857
|
+
var NO_FROZEN_COLUMNS = {
|
|
7858
|
+
offsets: {},
|
|
7859
|
+
active: false,
|
|
7860
|
+
selectionOffset: null
|
|
7861
|
+
};
|
|
7862
|
+
function resolveFrozenColumns(ids, isFrozen, widthOf, leadingWidth) {
|
|
7863
|
+
const run = [];
|
|
7864
|
+
for (const id of ids) {
|
|
7865
|
+
if (!isFrozen(id)) break;
|
|
7866
|
+
run.push(id);
|
|
7867
|
+
}
|
|
7868
|
+
if (run.length === 0) return NO_FROZEN_COLUMNS;
|
|
7869
|
+
if (leadingWidth === void 0) return NO_FROZEN_COLUMNS;
|
|
7870
|
+
const base = leadingWidth ?? 0;
|
|
7871
|
+
const offsets = {};
|
|
7872
|
+
let cursor = base;
|
|
7873
|
+
for (let i = 0; i < run.length; i += 1) {
|
|
7874
|
+
const id = run[i];
|
|
7875
|
+
offsets[id] = cursor;
|
|
7876
|
+
if (i === run.length - 1) break;
|
|
7877
|
+
const w = widthOf(id);
|
|
7878
|
+
if (w === void 0 || !Number.isFinite(w) || w <= 0) return NO_FROZEN_COLUMNS;
|
|
7879
|
+
cursor += w;
|
|
7880
|
+
}
|
|
7881
|
+
return {
|
|
7882
|
+
offsets,
|
|
7883
|
+
active: true,
|
|
7884
|
+
selectionOffset: leadingWidth === null ? null : 0
|
|
7885
|
+
};
|
|
7886
|
+
}
|
|
7887
|
+
function pixelWidth(width) {
|
|
7888
|
+
if (typeof width === "number") return Number.isFinite(width) ? width : void 0;
|
|
7889
|
+
if (typeof width === "string") {
|
|
7890
|
+
const m = /^(\d+(?:\.\d+)?)px$/.exec(width.trim());
|
|
7891
|
+
if (m) return Number(m[1]);
|
|
7892
|
+
}
|
|
7893
|
+
return void 0;
|
|
7894
|
+
}
|
|
7895
|
+
var FROZEN_CELL_CLASS = "sm:sticky sm:left-[var(--matrx-frozen-left)] sm:z-20 sm:bg-inherit";
|
|
7896
|
+
var FROZEN_HEADER_CLASS = "sm:sticky sm:left-[var(--matrx-frozen-left)] sm:z-30";
|
|
7897
|
+
var FROZEN_EDGE_CLASS = "sm:shadow-[inset_-1px_0_0_var(--border)]";
|
|
7898
|
+
|
|
7899
|
+
// src/field-formats/registry.ts
|
|
7900
|
+
var import_format3 = require("@ai-matrx/kit/format");
|
|
7901
|
+
function formatSignedDuration(totalSeconds) {
|
|
7902
|
+
return (0, import_format3.formatDurationSeconds)(totalSeconds, { signed: true });
|
|
7903
|
+
}
|
|
7904
|
+
function toNumber(value) {
|
|
7905
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
7906
|
+
if (typeof value === "string") {
|
|
7907
|
+
const cleaned = value.replace(/[,\s$€£¥%]/g, "");
|
|
7908
|
+
if (cleaned === "") return null;
|
|
7909
|
+
const n = Number(cleaned);
|
|
7910
|
+
return Number.isFinite(n) ? n : null;
|
|
7911
|
+
}
|
|
7912
|
+
return null;
|
|
7913
|
+
}
|
|
7914
|
+
function toText(value) {
|
|
7915
|
+
if (typeof value === "string") return value;
|
|
7916
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
7917
|
+
return String(value);
|
|
7918
|
+
return null;
|
|
7919
|
+
}
|
|
7920
|
+
function toDate(value) {
|
|
7921
|
+
if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;
|
|
7922
|
+
if (typeof value === "number") {
|
|
7923
|
+
const d = new Date(value);
|
|
7924
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
7925
|
+
}
|
|
7926
|
+
if (typeof value === "string" && value.trim()) {
|
|
7927
|
+
const d = new Date(value);
|
|
7928
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
7929
|
+
}
|
|
7930
|
+
return null;
|
|
7931
|
+
}
|
|
7932
|
+
function toList(value) {
|
|
7933
|
+
if (Array.isArray(value)) return value;
|
|
7934
|
+
if (typeof value === "string") {
|
|
7935
|
+
const trimmed = value.trim();
|
|
7936
|
+
if (trimmed.startsWith("[")) {
|
|
7937
|
+
try {
|
|
7938
|
+
const parsed = JSON.parse(trimmed);
|
|
7939
|
+
if (Array.isArray(parsed)) return parsed;
|
|
7940
|
+
} catch {
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
if (trimmed === "") return [];
|
|
7944
|
+
return trimmed.split(",").map((s) => s.trim());
|
|
7945
|
+
}
|
|
7946
|
+
return null;
|
|
7947
|
+
}
|
|
7948
|
+
function groupedNumber(n, options) {
|
|
7949
|
+
return new Intl.NumberFormat(void 0, {
|
|
7950
|
+
useGrouping: options.useGrouping !== false,
|
|
7951
|
+
...options.precision != null ? {
|
|
7952
|
+
minimumFractionDigits: options.precision,
|
|
7953
|
+
maximumFractionDigits: options.precision
|
|
7954
|
+
} : { maximumFractionDigits: 10 }
|
|
7955
|
+
}).format(n);
|
|
7956
|
+
}
|
|
7957
|
+
function affix(text, options) {
|
|
7958
|
+
return `${options.prefix ?? ""}${text}${options.suffix ?? ""}`;
|
|
7959
|
+
}
|
|
7960
|
+
var DURATION_TO_SECONDS = { milliseconds: 1e-3, seconds: 1, minutes: 60, hours: 3600 };
|
|
7961
|
+
function findChoice(choices, value) {
|
|
7962
|
+
if (!choices || choices.length === 0) return void 0;
|
|
7963
|
+
const exact = choices.find((c) => c.value === value);
|
|
7964
|
+
if (exact) return exact;
|
|
7965
|
+
const lowered = value.toLowerCase();
|
|
7966
|
+
return choices.find((c) => c.value.toLowerCase() === lowered);
|
|
7967
|
+
}
|
|
7968
|
+
var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
7969
|
+
var URL_RE = /^(?:[a-z][a-z0-9+.-]*:\/\/\S+|(?:[a-z0-9-]+\.)+[a-z]{2,}(?:[:/?#]\S*)?)$/i;
|
|
7970
|
+
var HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
7971
|
+
var DEFS = [
|
|
7972
|
+
// ── Text ──────────────────────────────────────────────────────────────────
|
|
7973
|
+
{
|
|
7974
|
+
id: "text",
|
|
7975
|
+
label: "Text",
|
|
7976
|
+
description: "Plain single-line text",
|
|
7977
|
+
group: "Text",
|
|
7978
|
+
base: "string",
|
|
7979
|
+
editor: "text",
|
|
7980
|
+
// Deliberately no optionKeys — plain text is the default for every string
|
|
7981
|
+
// column, and giving it prefix/suffix controls puts an options row under
|
|
7982
|
+
// every column in the settings dialog for a setting almost nobody wants.
|
|
7983
|
+
format: (v, o) => {
|
|
7984
|
+
const t = toText(v);
|
|
7985
|
+
return t === null ? null : affix(t, o);
|
|
7986
|
+
},
|
|
7987
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
7988
|
+
},
|
|
7989
|
+
{
|
|
7990
|
+
id: "long_text",
|
|
7991
|
+
label: "Long text",
|
|
7992
|
+
description: "Multi-line text, edited in a larger box",
|
|
7993
|
+
group: "Text",
|
|
7994
|
+
base: "string",
|
|
7995
|
+
editor: "textarea",
|
|
7996
|
+
format: (v) => toText(v),
|
|
7997
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
7998
|
+
},
|
|
7999
|
+
{
|
|
8000
|
+
id: "markdown",
|
|
8001
|
+
label: "Markdown",
|
|
8002
|
+
description: "Rich text written as Markdown",
|
|
8003
|
+
group: "Text",
|
|
8004
|
+
base: "string",
|
|
8005
|
+
editor: "textarea",
|
|
8006
|
+
rich: true,
|
|
8007
|
+
format: (v) => toText(v),
|
|
8008
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
8009
|
+
},
|
|
8010
|
+
{
|
|
8011
|
+
id: "email",
|
|
8012
|
+
label: "Email",
|
|
8013
|
+
description: "Email address \u2014 click to compose",
|
|
8014
|
+
group: "Text",
|
|
8015
|
+
base: "string",
|
|
8016
|
+
editor: "email",
|
|
8017
|
+
rich: true,
|
|
8018
|
+
format: (v) => {
|
|
8019
|
+
const t = toText(v)?.trim();
|
|
8020
|
+
if (!t) return null;
|
|
8021
|
+
return EMAIL_RE.test(t) ? t : null;
|
|
8022
|
+
},
|
|
8023
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
|
|
8024
|
+
},
|
|
8025
|
+
{
|
|
8026
|
+
id: "url",
|
|
8027
|
+
label: "Link",
|
|
8028
|
+
description: "Web address \u2014 click to open",
|
|
8029
|
+
group: "Text",
|
|
8030
|
+
base: "string",
|
|
8031
|
+
editor: "url",
|
|
8032
|
+
rich: true,
|
|
8033
|
+
format: (v) => {
|
|
8034
|
+
const t = toText(v)?.trim();
|
|
8035
|
+
if (!t) return null;
|
|
8036
|
+
if (/\s/.test(t)) return null;
|
|
8037
|
+
if (!URL_RE.test(t)) return null;
|
|
8038
|
+
try {
|
|
8039
|
+
new URL(t.includes("://") ? t : `https://${t}`);
|
|
8040
|
+
return t;
|
|
8041
|
+
} catch {
|
|
8042
|
+
return null;
|
|
8043
|
+
}
|
|
8044
|
+
},
|
|
8045
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
|
|
8046
|
+
},
|
|
8047
|
+
{
|
|
8048
|
+
id: "phone",
|
|
8049
|
+
label: "Phone",
|
|
8050
|
+
description: "Phone number \u2014 click to call",
|
|
8051
|
+
group: "Text",
|
|
8052
|
+
base: "string",
|
|
8053
|
+
editor: "tel",
|
|
8054
|
+
rich: true,
|
|
8055
|
+
format: (v) => {
|
|
8056
|
+
const t = toText(v)?.trim();
|
|
8057
|
+
if (!t) return null;
|
|
8058
|
+
return (t.match(/\d/g) ?? []).length >= 7 ? t : null;
|
|
8059
|
+
},
|
|
8060
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
|
|
8061
|
+
},
|
|
8062
|
+
{
|
|
8063
|
+
id: "color",
|
|
8064
|
+
label: "Color",
|
|
8065
|
+
description: "Hex color with a swatch",
|
|
8066
|
+
group: "Text",
|
|
8067
|
+
base: "string",
|
|
8068
|
+
editor: "color",
|
|
8069
|
+
rich: true,
|
|
8070
|
+
format: (v) => {
|
|
8071
|
+
const t = toText(v)?.trim();
|
|
8072
|
+
if (!t) return null;
|
|
8073
|
+
return HEX_RE.test(t) ? t.toLowerCase() : null;
|
|
8074
|
+
},
|
|
8075
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
|
|
8076
|
+
},
|
|
8077
|
+
// ── Numbers ───────────────────────────────────────────────────────────────
|
|
8078
|
+
{
|
|
8079
|
+
id: "number",
|
|
8080
|
+
label: "Number",
|
|
8081
|
+
description: "Plain number",
|
|
8082
|
+
group: "Numbers",
|
|
8083
|
+
base: "number",
|
|
8084
|
+
alsoAccepts: ["integer"],
|
|
8085
|
+
editor: "number",
|
|
8086
|
+
numericAlign: true,
|
|
8087
|
+
optionKeys: ["useGrouping", "precision", "prefix", "suffix"],
|
|
8088
|
+
format: (v, o) => {
|
|
8089
|
+
const n = toNumber(v);
|
|
8090
|
+
return n === null ? null : affix(groupedNumber(n, o), o);
|
|
8091
|
+
},
|
|
8092
|
+
parse: (raw) => toNumber(raw)
|
|
8093
|
+
},
|
|
8094
|
+
{
|
|
8095
|
+
id: "decimal",
|
|
8096
|
+
label: "Decimal",
|
|
8097
|
+
description: "Number with fixed decimal places",
|
|
8098
|
+
group: "Numbers",
|
|
8099
|
+
base: "number",
|
|
8100
|
+
alsoAccepts: ["integer"],
|
|
8101
|
+
editor: "number",
|
|
8102
|
+
numericAlign: true,
|
|
8103
|
+
optionKeys: ["precision", "useGrouping", "prefix", "suffix"],
|
|
8104
|
+
format: (v, o) => {
|
|
8105
|
+
const n = toNumber(v);
|
|
8106
|
+
if (n === null) return null;
|
|
8107
|
+
return affix(groupedNumber(n, { ...o, precision: o.precision ?? 2 }), o);
|
|
8108
|
+
},
|
|
8109
|
+
parse: (raw) => toNumber(raw)
|
|
8110
|
+
},
|
|
8111
|
+
{
|
|
8112
|
+
id: "currency",
|
|
8113
|
+
label: "Currency",
|
|
8114
|
+
description: "Money \u2014 stored as a plain number, shown with a symbol",
|
|
8115
|
+
group: "Numbers",
|
|
8116
|
+
base: "number",
|
|
8117
|
+
alsoAccepts: ["integer"],
|
|
8118
|
+
editor: "number",
|
|
8119
|
+
numericAlign: true,
|
|
8120
|
+
optionKeys: ["currency", "precision"],
|
|
8121
|
+
format: (v, o) => {
|
|
8122
|
+
const n = toNumber(v);
|
|
8123
|
+
if (n === null) return null;
|
|
8124
|
+
const currency = (o.currency || "USD").toUpperCase();
|
|
8125
|
+
try {
|
|
8126
|
+
return new Intl.NumberFormat(void 0, {
|
|
8127
|
+
style: "currency",
|
|
8128
|
+
currency,
|
|
8129
|
+
...o.precision != null ? {
|
|
8130
|
+
minimumFractionDigits: o.precision,
|
|
8131
|
+
maximumFractionDigits: o.precision
|
|
8132
|
+
} : {}
|
|
8133
|
+
}).format(n);
|
|
8134
|
+
} catch {
|
|
8135
|
+
return `${groupedNumber(n, { precision: o.precision ?? 2 })} ${currency}`;
|
|
8136
|
+
}
|
|
8137
|
+
},
|
|
8138
|
+
parse: (raw) => toNumber(raw)
|
|
8139
|
+
},
|
|
8140
|
+
{
|
|
8141
|
+
id: "percent",
|
|
8142
|
+
label: "Percent",
|
|
8143
|
+
description: "Percentage \u2014 stored as a plain number",
|
|
8144
|
+
group: "Numbers",
|
|
8145
|
+
base: "number",
|
|
8146
|
+
alsoAccepts: ["integer"],
|
|
8147
|
+
editor: "number",
|
|
8148
|
+
numericAlign: true,
|
|
8149
|
+
optionKeys: ["percentScale", "precision"],
|
|
8150
|
+
format: (v, o) => {
|
|
8151
|
+
const n = toNumber(v);
|
|
8152
|
+
if (n === null) return null;
|
|
8153
|
+
const shown = o.percentScale === "fraction" ? n * 100 : n;
|
|
8154
|
+
return `${groupedNumber(shown, o.precision === void 0 ? {} : { precision: o.precision })}%`;
|
|
8155
|
+
},
|
|
8156
|
+
parse: (raw) => toNumber(raw)
|
|
8157
|
+
},
|
|
8158
|
+
{
|
|
8159
|
+
id: "duration",
|
|
8160
|
+
label: "Duration",
|
|
8161
|
+
description: "Length of time, shown as h:mm:ss",
|
|
8162
|
+
group: "Numbers",
|
|
8163
|
+
base: "number",
|
|
8164
|
+
alsoAccepts: ["integer"],
|
|
8165
|
+
editor: "number",
|
|
8166
|
+
numericAlign: true,
|
|
8167
|
+
optionKeys: ["durationUnit"],
|
|
8168
|
+
format: (v, o) => {
|
|
8169
|
+
const n = toNumber(v);
|
|
8170
|
+
if (n === null) return null;
|
|
8171
|
+
return formatSignedDuration(n * DURATION_TO_SECONDS[o.durationUnit ?? "seconds"]);
|
|
8172
|
+
},
|
|
8173
|
+
parse: (raw) => toNumber(raw)
|
|
8174
|
+
},
|
|
8175
|
+
{
|
|
8176
|
+
id: "integer",
|
|
8177
|
+
label: "Whole number",
|
|
8178
|
+
description: "Integer with no decimal part",
|
|
8179
|
+
group: "Numbers",
|
|
8180
|
+
base: "integer",
|
|
8181
|
+
alsoAccepts: ["number"],
|
|
8182
|
+
editor: "number",
|
|
8183
|
+
numericAlign: true,
|
|
8184
|
+
optionKeys: ["useGrouping", "prefix", "suffix"],
|
|
8185
|
+
format: (v, o) => {
|
|
8186
|
+
const n = toNumber(v);
|
|
8187
|
+
if (n === null) return null;
|
|
8188
|
+
return affix(groupedNumber(Math.trunc(n), { ...o, precision: 0 }), o);
|
|
8189
|
+
},
|
|
8190
|
+
parse: (raw) => {
|
|
8191
|
+
const n = toNumber(raw);
|
|
8192
|
+
return n === null ? null : Math.trunc(n);
|
|
8193
|
+
}
|
|
8194
|
+
},
|
|
8195
|
+
{
|
|
8196
|
+
id: "rating",
|
|
8197
|
+
label: "Rating",
|
|
8198
|
+
description: "Score out of a maximum, shown as stars",
|
|
8199
|
+
group: "Numbers",
|
|
8200
|
+
base: "integer",
|
|
8201
|
+
alsoAccepts: ["number"],
|
|
8202
|
+
editor: "rating",
|
|
8203
|
+
rich: true,
|
|
8204
|
+
optionKeys: ["ratingMax"],
|
|
8205
|
+
format: (v, o) => {
|
|
8206
|
+
const n = toNumber(v);
|
|
8207
|
+
if (n === null) return null;
|
|
8208
|
+
const max = o.ratingMax ?? 5;
|
|
8209
|
+
if (n < 0 || n > max) return null;
|
|
8210
|
+
return `${n} / ${max}`;
|
|
8211
|
+
},
|
|
8212
|
+
parse: (raw) => {
|
|
8213
|
+
const n = toNumber(raw);
|
|
8214
|
+
return n === null ? null : Math.round(n);
|
|
8215
|
+
}
|
|
8216
|
+
},
|
|
8217
|
+
{
|
|
8218
|
+
id: "file_size",
|
|
8219
|
+
label: "File size",
|
|
8220
|
+
description: "Byte count shown as KB / MB / GB",
|
|
8221
|
+
group: "Numbers",
|
|
8222
|
+
base: "integer",
|
|
8223
|
+
alsoAccepts: ["number"],
|
|
8224
|
+
editor: "number",
|
|
8225
|
+
numericAlign: true,
|
|
8226
|
+
format: (v) => {
|
|
8227
|
+
const n = toNumber(v);
|
|
8228
|
+
return n === null ? null : (0, import_format3.formatFileSize)(n);
|
|
8229
|
+
},
|
|
8230
|
+
parse: (raw) => {
|
|
8231
|
+
const n = toNumber(raw);
|
|
8232
|
+
return n === null ? null : Math.trunc(n);
|
|
8233
|
+
}
|
|
8234
|
+
},
|
|
8235
|
+
// ── Choice ────────────────────────────────────────────────────────────────
|
|
8236
|
+
{
|
|
8237
|
+
id: "boolean",
|
|
8238
|
+
label: "Yes / No",
|
|
8239
|
+
description: "True or false",
|
|
8240
|
+
group: "Choice",
|
|
8241
|
+
base: "boolean",
|
|
8242
|
+
editor: "checkbox",
|
|
8243
|
+
format: (v) => {
|
|
8244
|
+
if (typeof v === "boolean") return v ? "Yes" : "No";
|
|
8245
|
+
if (v === "true" || v === 1) return "Yes";
|
|
8246
|
+
if (v === "false" || v === 0) return "No";
|
|
8247
|
+
return null;
|
|
8248
|
+
},
|
|
8249
|
+
parse: (raw) => {
|
|
8250
|
+
if (typeof raw === "boolean") return raw;
|
|
8251
|
+
if (raw == null || raw === "") return null;
|
|
8252
|
+
return String(raw).toLowerCase() === "true" || raw === 1;
|
|
8253
|
+
}
|
|
8254
|
+
},
|
|
8255
|
+
// ── Dates ─────────────────────────────────────────────────────────────────
|
|
8256
|
+
{
|
|
8257
|
+
id: "date",
|
|
8258
|
+
label: "Date",
|
|
8259
|
+
description: "Calendar date",
|
|
8260
|
+
group: "Dates",
|
|
8261
|
+
base: "date",
|
|
8262
|
+
alsoAccepts: ["datetime", "string"],
|
|
8263
|
+
editor: "date",
|
|
8264
|
+
optionKeys: ["dateStyle"],
|
|
8265
|
+
format: (v, o) => {
|
|
8266
|
+
const d = toDate(v);
|
|
8267
|
+
if (!d) return null;
|
|
8268
|
+
return d.toLocaleDateString(void 0, {
|
|
8269
|
+
dateStyle: o.dateStyle ?? "medium"
|
|
8270
|
+
});
|
|
8271
|
+
},
|
|
8272
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
8273
|
+
},
|
|
8274
|
+
{
|
|
8275
|
+
id: "datetime",
|
|
8276
|
+
label: "Date & time",
|
|
8277
|
+
description: "Calendar date with a time of day",
|
|
8278
|
+
group: "Dates",
|
|
8279
|
+
base: "datetime",
|
|
8280
|
+
alsoAccepts: ["date", "string"],
|
|
8281
|
+
editor: "datetime",
|
|
8282
|
+
optionKeys: ["dateStyle"],
|
|
8283
|
+
format: (v, o) => {
|
|
8284
|
+
const d = toDate(v);
|
|
8285
|
+
if (!d) return null;
|
|
8286
|
+
return d.toLocaleString(void 0, {
|
|
8287
|
+
dateStyle: o.dateStyle ?? "medium",
|
|
8288
|
+
timeStyle: "short"
|
|
8289
|
+
});
|
|
8290
|
+
},
|
|
8291
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
8292
|
+
},
|
|
8293
|
+
{
|
|
8294
|
+
id: "relative_time",
|
|
8295
|
+
label: "Relative time",
|
|
8296
|
+
description: 'Shown as "3 days ago"',
|
|
8297
|
+
group: "Dates",
|
|
8298
|
+
base: "datetime",
|
|
8299
|
+
alsoAccepts: ["date", "string"],
|
|
8300
|
+
editor: "datetime",
|
|
8301
|
+
format: (v) => {
|
|
8302
|
+
const d = toDate(v);
|
|
8303
|
+
return d ? (0, import_format3.formatRelativeTime)(d, { style: "intl" }) : null;
|
|
8304
|
+
},
|
|
8305
|
+
parse: (raw) => raw === "" || raw == null ? null : String(raw)
|
|
8306
|
+
},
|
|
8307
|
+
// ── Structured ────────────────────────────────────────────────────────────
|
|
8308
|
+
{
|
|
8309
|
+
id: "json",
|
|
8310
|
+
label: "JSON",
|
|
8311
|
+
description: "Structured object",
|
|
8312
|
+
group: "Structured",
|
|
8313
|
+
base: "json",
|
|
8314
|
+
alsoAccepts: ["array"],
|
|
8315
|
+
editor: "json",
|
|
8316
|
+
format: (v) => {
|
|
8317
|
+
if (v === null || v === void 0) return null;
|
|
8318
|
+
if (typeof v === "object") return JSON.stringify(v);
|
|
8319
|
+
return toText(v);
|
|
8320
|
+
},
|
|
8321
|
+
parse: (raw) => {
|
|
8322
|
+
if (raw == null || raw === "") return null;
|
|
8323
|
+
if (typeof raw !== "string") return raw;
|
|
8324
|
+
try {
|
|
8325
|
+
return JSON.parse(raw);
|
|
8326
|
+
} catch {
|
|
8327
|
+
return raw;
|
|
8328
|
+
}
|
|
8329
|
+
}
|
|
8330
|
+
},
|
|
8331
|
+
{
|
|
8332
|
+
id: "array",
|
|
8333
|
+
label: "List",
|
|
8334
|
+
description: "List of values",
|
|
8335
|
+
group: "Structured",
|
|
8336
|
+
base: "array",
|
|
8337
|
+
alsoAccepts: ["json"],
|
|
8338
|
+
editor: "json",
|
|
8339
|
+
format: (v) => {
|
|
8340
|
+
const list = toList(v);
|
|
8341
|
+
return list === null ? null : list.map((i) => String(i)).join(", ");
|
|
8342
|
+
},
|
|
8343
|
+
parse: (raw) => {
|
|
8344
|
+
if (raw == null || raw === "") return null;
|
|
8345
|
+
if (Array.isArray(raw)) return raw;
|
|
8346
|
+
return toList(raw) ?? raw;
|
|
8347
|
+
}
|
|
8348
|
+
},
|
|
8349
|
+
{
|
|
8350
|
+
id: "tags",
|
|
8351
|
+
label: "Tags",
|
|
8352
|
+
description: "List of values shown as chips",
|
|
8353
|
+
group: "Structured",
|
|
8354
|
+
base: "array",
|
|
8355
|
+
alsoAccepts: ["json", "string"],
|
|
8356
|
+
editor: "json",
|
|
8357
|
+
rich: true,
|
|
8358
|
+
format: (v) => {
|
|
8359
|
+
const list = toList(v);
|
|
8360
|
+
return list === null ? null : list.map((i) => String(i)).join(", ");
|
|
8361
|
+
},
|
|
8362
|
+
parse: (raw) => {
|
|
8363
|
+
if (raw == null || raw === "") return null;
|
|
8364
|
+
if (Array.isArray(raw)) return raw;
|
|
8365
|
+
return toList(raw) ?? raw;
|
|
8366
|
+
}
|
|
8367
|
+
},
|
|
8368
|
+
// ─── Choice ────────────────────────────────────────────────────────────────
|
|
8369
|
+
//
|
|
8370
|
+
// An enum WITHOUT a database enum. The column stays `string` (or `array` for
|
|
8371
|
+
// multi), the database enforces nothing, and stripping the format leaves
|
|
8372
|
+
// every stored value exactly as it was. Options are a UI layer — the same
|
|
8373
|
+
// trick `percent` plays on a number.
|
|
8374
|
+
//
|
|
8375
|
+
// The fallback law is the whole reason this is safe to switch on over live
|
|
8376
|
+
// data: a value not in the option list is NOT an error and is NEVER blanked.
|
|
8377
|
+
// `format()` returns null for it, `<FormattedFieldValue>` renders it in amber
|
|
8378
|
+
// with the reason, and the user can fix it or adopt it. Declaring the options
|
|
8379
|
+
// is therefore how you FIND your stray values, not how you lose them.
|
|
8380
|
+
//
|
|
8381
|
+
// Options resolve through `choices.ts` — inline `options.choices`, or a
|
|
8382
|
+
// structured list via `options.structuredList`. This def only ever sees
|
|
8383
|
+
// whatever the caller resolved into `options.choices`, so it stays pure and
|
|
8384
|
+
// synchronous like every other format.
|
|
8385
|
+
{
|
|
8386
|
+
id: "choice",
|
|
8387
|
+
label: "Choice",
|
|
8388
|
+
description: "One value from a list of options",
|
|
8389
|
+
group: "Choice",
|
|
8390
|
+
base: "string",
|
|
8391
|
+
alsoAccepts: ["number", "integer", "boolean"],
|
|
8392
|
+
editor: "select",
|
|
8393
|
+
rich: true,
|
|
8394
|
+
optionKeys: ["choices", "structuredList", "allowOther"],
|
|
8395
|
+
format: (v, options) => {
|
|
8396
|
+
const text = toText(v);
|
|
8397
|
+
if (text === null) return null;
|
|
8398
|
+
const trimmed = text.trim();
|
|
8399
|
+
if (trimmed === "") return "";
|
|
8400
|
+
const match = findChoice(options.choices, trimmed);
|
|
8401
|
+
if (!options.choices || options.choices.length === 0) return trimmed;
|
|
8402
|
+
return match ? match.label ?? match.value : null;
|
|
8403
|
+
},
|
|
8404
|
+
parse: (raw) => {
|
|
8405
|
+
if (raw == null) return null;
|
|
8406
|
+
const text = toText(raw);
|
|
8407
|
+
if (text === null) return raw;
|
|
8408
|
+
const trimmed = text.trim();
|
|
8409
|
+
return trimmed === "" ? null : trimmed;
|
|
8410
|
+
}
|
|
8411
|
+
},
|
|
8412
|
+
{
|
|
8413
|
+
id: "multi_choice",
|
|
8414
|
+
label: "Multi-choice",
|
|
8415
|
+
description: "Any number of values from a list of options",
|
|
8416
|
+
group: "Choice",
|
|
8417
|
+
base: "array",
|
|
8418
|
+
alsoAccepts: ["string", "json"],
|
|
8419
|
+
editor: "multiselect",
|
|
8420
|
+
rich: true,
|
|
8421
|
+
optionKeys: ["choices", "structuredList", "allowOther"],
|
|
8422
|
+
format: (v, options) => {
|
|
8423
|
+
const list = toList(v);
|
|
8424
|
+
if (list === null) return null;
|
|
8425
|
+
if (list.length === 0) return "";
|
|
8426
|
+
const labels = [];
|
|
8427
|
+
let anyOffList = false;
|
|
8428
|
+
for (const entry of list) {
|
|
8429
|
+
const text = toText(entry);
|
|
8430
|
+
if (text === null) {
|
|
8431
|
+
anyOffList = true;
|
|
8432
|
+
continue;
|
|
8433
|
+
}
|
|
8434
|
+
const match = findChoice(options.choices, text.trim());
|
|
8435
|
+
if (match) labels.push(match.label ?? match.value);
|
|
8436
|
+
else {
|
|
8437
|
+
labels.push(text.trim());
|
|
8438
|
+
anyOffList = true;
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
const haveOptions = !!options.choices && options.choices.length > 0;
|
|
8442
|
+
if (haveOptions && anyOffList) return null;
|
|
8443
|
+
return labels.join(", ");
|
|
8444
|
+
},
|
|
8445
|
+
parse: (raw) => {
|
|
8446
|
+
if (raw == null || raw === "") return null;
|
|
8447
|
+
if (Array.isArray(raw)) return raw;
|
|
8448
|
+
return toList(raw) ?? raw;
|
|
8449
|
+
}
|
|
8450
|
+
},
|
|
8451
|
+
// ─── Computed ──────────────────────────────────────────────────────────────
|
|
8452
|
+
//
|
|
8453
|
+
// A formula column stores NOTHING. `metadata.format.options.formula` holds
|
|
8454
|
+
// the expression; the stored cell is always null; the value is computed on
|
|
8455
|
+
// read from the other columns of the same row
|
|
8456
|
+
// (`features/data-tables/formulas.ts`). Grouped under Structured on purpose
|
|
8457
|
+
// — the picker's groups are a fixed vocabulary, and a formula is structure
|
|
8458
|
+
// over a plain string column, not a sixth family.
|
|
8459
|
+
//
|
|
8460
|
+
// `format()` here is handed the COMPUTED value, never a stored one, and its
|
|
8461
|
+
// only job is to render it: through `resultFormat`'s own `format()` when the
|
|
8462
|
+
// column declares one (a computed total shown as Currency, a computed date
|
|
8463
|
+
// shown as a Date), and plainly otherwise. It never returns null for an
|
|
8464
|
+
// empty value, because a formula legitimately produces BLANK.
|
|
8465
|
+
//
|
|
8466
|
+
// No `optionKeys`: the expression is authored in its own editor, not in the
|
|
8467
|
+
// generic option rail, and listing a key the picker has no control for would
|
|
8468
|
+
// open an empty options section under every formula column.
|
|
8469
|
+
{
|
|
8470
|
+
id: "formula",
|
|
8471
|
+
label: "Formula",
|
|
8472
|
+
description: "Computed from the other columns in the row \u2014 never typed in",
|
|
8473
|
+
group: "Structured",
|
|
8474
|
+
base: "string",
|
|
8475
|
+
editor: "computed",
|
|
8476
|
+
format: (v, o) => {
|
|
8477
|
+
const target = o.formula?.resultFormat;
|
|
8478
|
+
if (target && target !== "formula") {
|
|
8479
|
+
const delegate = FIELD_FORMATS[target];
|
|
8480
|
+
if (delegate) {
|
|
8481
|
+
const rendered = delegate.format(v, o);
|
|
8482
|
+
if (rendered !== null) return rendered;
|
|
8483
|
+
}
|
|
8484
|
+
}
|
|
8485
|
+
if (v === null || v === void 0) return "";
|
|
8486
|
+
if (typeof v === "boolean") return v ? "Yes" : "No";
|
|
8487
|
+
if (typeof v === "number") return groupedNumber(v, o);
|
|
8488
|
+
return toText(v);
|
|
8489
|
+
},
|
|
8490
|
+
// Nothing is ever stored in a formula column. Returning the raw input here
|
|
8491
|
+
// would be the one way a computed cell could acquire a value of its own.
|
|
8492
|
+
parse: () => null
|
|
8493
|
+
}
|
|
8494
|
+
];
|
|
8495
|
+
var FIELD_FORMATS = Object.freeze(
|
|
8496
|
+
Object.fromEntries(DEFS.map((d) => [d.id, d]))
|
|
8497
|
+
);
|
|
8498
|
+
var FIELD_FORMAT_LIST = Object.freeze(DEFS);
|
|
8499
|
+
var FIELD_FORMAT_IDS = DEFS.map((d) => d.id);
|
|
8500
|
+
function getFieldFormat(id) {
|
|
8501
|
+
if (!id) return null;
|
|
8502
|
+
return FIELD_FORMATS[id] ?? null;
|
|
8503
|
+
}
|
|
8504
|
+
function defaultFormatForBase(base) {
|
|
8505
|
+
switch (base) {
|
|
8506
|
+
case "number":
|
|
8507
|
+
return "number";
|
|
8508
|
+
case "integer":
|
|
8509
|
+
return "integer";
|
|
8510
|
+
case "boolean":
|
|
8511
|
+
return "boolean";
|
|
8512
|
+
case "date":
|
|
8513
|
+
return "date";
|
|
8514
|
+
case "datetime":
|
|
8515
|
+
return "datetime";
|
|
8516
|
+
case "json":
|
|
8517
|
+
return "json";
|
|
8518
|
+
case "array":
|
|
8519
|
+
return "array";
|
|
8520
|
+
default:
|
|
8521
|
+
return "text";
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8524
|
+
|
|
8525
|
+
// src/field-formats/format.ts
|
|
8526
|
+
function isEmpty(value) {
|
|
8527
|
+
return value === null || value === void 0 || value === "";
|
|
8528
|
+
}
|
|
8529
|
+
function baseText(value) {
|
|
8530
|
+
if (isEmpty(value)) return "";
|
|
8531
|
+
if (typeof value === "object") {
|
|
8532
|
+
try {
|
|
8533
|
+
return JSON.stringify(value);
|
|
8534
|
+
} catch {
|
|
8535
|
+
return String(value);
|
|
8536
|
+
}
|
|
8537
|
+
}
|
|
8538
|
+
return String(value);
|
|
8539
|
+
}
|
|
8540
|
+
function formatFieldValue(value, config, dataType) {
|
|
8541
|
+
if (isEmpty(value)) return { ok: true, text: "", empty: true };
|
|
8542
|
+
const def = config ? getFieldFormat(config.id) : null;
|
|
8543
|
+
const effective = def ?? FIELD_FORMATS[defaultFormatForBase(dataType ?? "string")];
|
|
8544
|
+
let formatted;
|
|
8545
|
+
try {
|
|
8546
|
+
formatted = effective.format(value, config?.options ?? {});
|
|
8547
|
+
} catch {
|
|
8548
|
+
formatted = null;
|
|
8549
|
+
}
|
|
8550
|
+
if (formatted !== null) return { ok: true, text: formatted, empty: false };
|
|
8551
|
+
return {
|
|
8552
|
+
ok: false,
|
|
8553
|
+
text: baseText(value),
|
|
8554
|
+
empty: false,
|
|
8555
|
+
reason: `This value is not a valid ${effective.label.toLowerCase()} \u2014 showing the stored value instead.`
|
|
8556
|
+
};
|
|
8557
|
+
}
|
|
8558
|
+
|
|
8559
|
+
// src/data-table/column-format.tsx
|
|
7524
8560
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8561
|
+
function formatColumnValue(col, value) {
|
|
8562
|
+
if (!col.format) return null;
|
|
8563
|
+
return formatFieldValue(value, col.format);
|
|
8564
|
+
}
|
|
8565
|
+
function alignForFormat(col) {
|
|
8566
|
+
if (col.align) return col.align;
|
|
8567
|
+
if (!col.format) return void 0;
|
|
8568
|
+
const def = getFieldFormat(col.format.id);
|
|
8569
|
+
if (!def) return void 0;
|
|
8570
|
+
return def.numericAlign ? "right" : void 0;
|
|
8571
|
+
}
|
|
8572
|
+
var FORMAT_MISMATCH_CLASS = "text-amber-600 underline decoration-dotted underline-offset-2 dark:text-amber-400";
|
|
8573
|
+
function FormattedCell({ result }) {
|
|
8574
|
+
if (result.empty) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
8575
|
+
if (result.ok) {
|
|
8576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "block truncate text-sm text-foreground", children: result.text });
|
|
8577
|
+
}
|
|
8578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
|
|
8579
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cn("block truncate text-sm", FORMAT_MISMATCH_CLASS), children: result.text }) }),
|
|
8580
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words", children: result.reason ?? "This value does not fit the format this column declares." })
|
|
8581
|
+
] });
|
|
8582
|
+
}
|
|
8583
|
+
|
|
8584
|
+
// src/data-table/DirtySavePill.tsx
|
|
8585
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7525
8586
|
function DirtySavePill({
|
|
7526
8587
|
changeCount,
|
|
7527
8588
|
saving,
|
|
@@ -7530,20 +8591,20 @@ function DirtySavePill({
|
|
|
7530
8591
|
className
|
|
7531
8592
|
}) {
|
|
7532
8593
|
if (changeCount <= 0) return null;
|
|
7533
|
-
return /* @__PURE__ */ (0,
|
|
8594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
7534
8595
|
"div",
|
|
7535
8596
|
{
|
|
7536
8597
|
className: cn(
|
|
7537
8598
|
"pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center pb-safe",
|
|
7538
8599
|
className
|
|
7539
8600
|
),
|
|
7540
|
-
children: /* @__PURE__ */ (0,
|
|
7541
|
-
/* @__PURE__ */ (0,
|
|
8601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
|
|
8602
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
|
|
7542
8603
|
changeCount,
|
|
7543
8604
|
" unsaved change",
|
|
7544
8605
|
changeCount === 1 ? "" : "s"
|
|
7545
8606
|
] }),
|
|
7546
|
-
/* @__PURE__ */ (0,
|
|
8607
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7547
8608
|
Button,
|
|
7548
8609
|
{
|
|
7549
8610
|
type: "button",
|
|
@@ -7553,12 +8614,12 @@ function DirtySavePill({
|
|
|
7553
8614
|
disabled: saving,
|
|
7554
8615
|
onClick: onCancel,
|
|
7555
8616
|
children: [
|
|
7556
|
-
/* @__PURE__ */ (0,
|
|
8617
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
7557
8618
|
"Cancel"
|
|
7558
8619
|
]
|
|
7559
8620
|
}
|
|
7560
8621
|
),
|
|
7561
|
-
/* @__PURE__ */ (0,
|
|
8622
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
7562
8623
|
Button,
|
|
7563
8624
|
{
|
|
7564
8625
|
type: "button",
|
|
@@ -7567,7 +8628,7 @@ function DirtySavePill({
|
|
|
7567
8628
|
disabled: saving,
|
|
7568
8629
|
onClick: onSave,
|
|
7569
8630
|
children: [
|
|
7570
|
-
saving ? /* @__PURE__ */ (0,
|
|
8631
|
+
saving ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Save, { className: "h-3.5 w-3.5" }),
|
|
7571
8632
|
"Save"
|
|
7572
8633
|
]
|
|
7573
8634
|
}
|
|
@@ -7579,7 +8640,7 @@ function DirtySavePill({
|
|
|
7579
8640
|
|
|
7580
8641
|
// src/data-table/EditableTableCell.tsx
|
|
7581
8642
|
var import_react18 = require("react");
|
|
7582
|
-
var
|
|
8643
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7583
8644
|
function CellEditShell({
|
|
7584
8645
|
href,
|
|
7585
8646
|
display,
|
|
@@ -7588,8 +8649,8 @@ function CellEditShell({
|
|
|
7588
8649
|
editButton
|
|
7589
8650
|
}) {
|
|
7590
8651
|
const { Link: HostLink } = useMatrxDataTableHost();
|
|
7591
|
-
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0,
|
|
7592
|
-
return /* @__PURE__ */ (0,
|
|
8652
|
+
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("a", { ...props }));
|
|
8653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7593
8654
|
"span",
|
|
7594
8655
|
{
|
|
7595
8656
|
className: cn(
|
|
@@ -7601,7 +8662,7 @@ function CellEditShell({
|
|
|
7601
8662
|
className
|
|
7602
8663
|
),
|
|
7603
8664
|
children: [
|
|
7604
|
-
href ? /* @__PURE__ */ (0,
|
|
8665
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7605
8666
|
Link,
|
|
7606
8667
|
{
|
|
7607
8668
|
href,
|
|
@@ -7609,7 +8670,7 @@ function CellEditShell({
|
|
|
7609
8670
|
className: "min-w-0 flex-1 overflow-hidden truncate rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
7610
8671
|
children: display
|
|
7611
8672
|
}
|
|
7612
|
-
) : /* @__PURE__ */ (0,
|
|
8673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
|
|
7613
8674
|
editButton
|
|
7614
8675
|
]
|
|
7615
8676
|
}
|
|
@@ -7634,7 +8695,7 @@ function EditableTableCell({
|
|
|
7634
8695
|
}, [editRequest]);
|
|
7635
8696
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
7636
8697
|
if (editType === "string") {
|
|
7637
|
-
return /* @__PURE__ */ (0,
|
|
8698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7638
8699
|
InlineStringEditor,
|
|
7639
8700
|
{
|
|
7640
8701
|
value: stringifyCellValue(value),
|
|
@@ -7648,30 +8709,30 @@ function EditableTableCell({
|
|
|
7648
8709
|
}
|
|
7649
8710
|
);
|
|
7650
8711
|
}
|
|
7651
|
-
return /* @__PURE__ */ (0,
|
|
7652
|
-
usePencil ? /* @__PURE__ */ (0,
|
|
8712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
8713
|
+
usePencil ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7653
8714
|
CellEditShell,
|
|
7654
8715
|
{
|
|
7655
8716
|
...href === void 0 ? {} : { href },
|
|
7656
8717
|
display,
|
|
7657
8718
|
...dirty === void 0 ? {} : { dirty },
|
|
7658
8719
|
...className === void 0 ? {} : { className },
|
|
7659
|
-
editButton: /* @__PURE__ */ (0,
|
|
7660
|
-
/* @__PURE__ */ (0,
|
|
8720
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8721
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7661
8722
|
"button",
|
|
7662
8723
|
{
|
|
7663
8724
|
type: "button",
|
|
7664
8725
|
"aria-label": "Edit",
|
|
7665
8726
|
onClick: (e) => e.stopPropagation(),
|
|
7666
8727
|
className: CELL_PENCIL_CLASS,
|
|
7667
|
-
children: /* @__PURE__ */ (0,
|
|
8728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Pencil, { className: "h-3 w-3" })
|
|
7668
8729
|
}
|
|
7669
8730
|
) }) }),
|
|
7670
|
-
/* @__PURE__ */ (0,
|
|
8731
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit" })
|
|
7671
8732
|
] })
|
|
7672
8733
|
}
|
|
7673
|
-
) : /* @__PURE__ */ (0,
|
|
7674
|
-
/* @__PURE__ */ (0,
|
|
8734
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8735
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7675
8736
|
"button",
|
|
7676
8737
|
{
|
|
7677
8738
|
type: "button",
|
|
@@ -7682,20 +8743,20 @@ function EditableTableCell({
|
|
|
7682
8743
|
className
|
|
7683
8744
|
),
|
|
7684
8745
|
children: [
|
|
7685
|
-
/* @__PURE__ */ (0,
|
|
7686
|
-
editType === "select" ? /* @__PURE__ */ (0,
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
|
|
8747
|
+
editType === "select" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
|
|
7687
8748
|
]
|
|
7688
8749
|
}
|
|
7689
8750
|
) }) }),
|
|
7690
|
-
/* @__PURE__ */ (0,
|
|
8751
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit value" })
|
|
7691
8752
|
] }),
|
|
7692
|
-
/* @__PURE__ */ (0,
|
|
8753
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7693
8754
|
PopoverContent,
|
|
7694
8755
|
{
|
|
7695
8756
|
align: "start",
|
|
7696
8757
|
className: "w-56 p-2",
|
|
7697
8758
|
onClick: (e) => e.stopPropagation(),
|
|
7698
|
-
children: /* @__PURE__ */ (0,
|
|
8759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7699
8760
|
TypedEditor,
|
|
7700
8761
|
{
|
|
7701
8762
|
editType,
|
|
@@ -7733,15 +8794,15 @@ function InlineStringEditor({
|
|
|
7733
8794
|
}, [editRequest, value]);
|
|
7734
8795
|
if (!editing) {
|
|
7735
8796
|
if (usePencil) {
|
|
7736
|
-
return /* @__PURE__ */ (0,
|
|
8797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7737
8798
|
CellEditShell,
|
|
7738
8799
|
{
|
|
7739
8800
|
...href === void 0 ? {} : { href },
|
|
7740
8801
|
display,
|
|
7741
8802
|
...dirty === void 0 ? {} : { dirty },
|
|
7742
8803
|
...className === void 0 ? {} : { className },
|
|
7743
|
-
editButton: /* @__PURE__ */ (0,
|
|
7744
|
-
/* @__PURE__ */ (0,
|
|
8804
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8805
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7745
8806
|
"button",
|
|
7746
8807
|
{
|
|
7747
8808
|
type: "button",
|
|
@@ -7752,16 +8813,16 @@ function InlineStringEditor({
|
|
|
7752
8813
|
setEditing(true);
|
|
7753
8814
|
},
|
|
7754
8815
|
className: CELL_PENCIL_CLASS,
|
|
7755
|
-
children: /* @__PURE__ */ (0,
|
|
8816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Pencil, { className: "h-3 w-3" })
|
|
7756
8817
|
}
|
|
7757
8818
|
) }),
|
|
7758
|
-
/* @__PURE__ */ (0,
|
|
8819
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit" })
|
|
7759
8820
|
] })
|
|
7760
8821
|
}
|
|
7761
8822
|
);
|
|
7762
8823
|
}
|
|
7763
|
-
return /* @__PURE__ */ (0,
|
|
7764
|
-
/* @__PURE__ */ (0,
|
|
8824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8825
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7765
8826
|
"button",
|
|
7766
8827
|
{
|
|
7767
8828
|
type: "button",
|
|
@@ -7778,10 +8839,10 @@ function InlineStringEditor({
|
|
|
7778
8839
|
children: display
|
|
7779
8840
|
}
|
|
7780
8841
|
) }),
|
|
7781
|
-
/* @__PURE__ */ (0,
|
|
8842
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Click to edit" })
|
|
7782
8843
|
] });
|
|
7783
8844
|
}
|
|
7784
|
-
return /* @__PURE__ */ (0,
|
|
8845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7785
8846
|
Input,
|
|
7786
8847
|
{
|
|
7787
8848
|
autoFocus: true,
|
|
@@ -7817,9 +8878,9 @@ function TypedEditor({
|
|
|
7817
8878
|
}) {
|
|
7818
8879
|
if (editType === "boolean") {
|
|
7819
8880
|
const checked = Boolean(value);
|
|
7820
|
-
return /* @__PURE__ */ (0,
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
8881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8882
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-xs font-medium", children: "Value" }),
|
|
8883
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7823
8884
|
Checkbox,
|
|
7824
8885
|
{
|
|
7825
8886
|
checked,
|
|
@@ -7829,7 +8890,7 @@ function TypedEditor({
|
|
|
7829
8890
|
] });
|
|
7830
8891
|
}
|
|
7831
8892
|
if (editType === "number") {
|
|
7832
|
-
return /* @__PURE__ */ (0,
|
|
8893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7833
8894
|
NumberEditor,
|
|
7834
8895
|
{
|
|
7835
8896
|
value: typeof value === "number" ? value : Number(value) || 0,
|
|
@@ -7839,7 +8900,7 @@ function TypedEditor({
|
|
|
7839
8900
|
);
|
|
7840
8901
|
}
|
|
7841
8902
|
if (editType === "tags") {
|
|
7842
|
-
return /* @__PURE__ */ (0,
|
|
8903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7843
8904
|
TagsEditor,
|
|
7844
8905
|
{
|
|
7845
8906
|
value: Array.isArray(value) ? value.map(String) : [],
|
|
@@ -7850,19 +8911,19 @@ function TypedEditor({
|
|
|
7850
8911
|
);
|
|
7851
8912
|
}
|
|
7852
8913
|
if (editType === "select") {
|
|
7853
|
-
return /* @__PURE__ */ (0,
|
|
8914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7854
8915
|
Select,
|
|
7855
8916
|
{
|
|
7856
8917
|
value: stringifyCellValue(value),
|
|
7857
8918
|
onValueChange: (v) => onCommit(v),
|
|
7858
8919
|
children: [
|
|
7859
|
-
/* @__PURE__ */ (0,
|
|
7860
|
-
/* @__PURE__ */ (0,
|
|
8920
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectValue, {}) }),
|
|
8921
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
7861
8922
|
]
|
|
7862
8923
|
}
|
|
7863
8924
|
);
|
|
7864
8925
|
}
|
|
7865
|
-
return /* @__PURE__ */ (0,
|
|
8926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7866
8927
|
Input,
|
|
7867
8928
|
{
|
|
7868
8929
|
type: "date",
|
|
@@ -7892,11 +8953,11 @@ function TagsEditor({
|
|
|
7892
8953
|
const matches = suggestions.filter(
|
|
7893
8954
|
(s) => !tags.includes(s.value) && s.value !== "__none__" && (!draft || s.label.toLowerCase().includes(draft.trim().toLowerCase()))
|
|
7894
8955
|
).slice(0, 6);
|
|
7895
|
-
return /* @__PURE__ */ (0,
|
|
7896
|
-
/* @__PURE__ */ (0,
|
|
7897
|
-
tags.length === 0 && /* @__PURE__ */ (0,
|
|
7898
|
-
tags.map((tag) => /* @__PURE__ */ (0,
|
|
7899
|
-
/* @__PURE__ */ (0,
|
|
8956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
|
|
8957
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
8958
|
+
tags.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
|
|
8959
|
+
tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8960
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7900
8961
|
"button",
|
|
7901
8962
|
{
|
|
7902
8963
|
type: "button",
|
|
@@ -7905,17 +8966,17 @@ function TagsEditor({
|
|
|
7905
8966
|
className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] hover:border-destructive hover:text-destructive",
|
|
7906
8967
|
children: [
|
|
7907
8968
|
tag,
|
|
7908
|
-
/* @__PURE__ */ (0,
|
|
8969
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-2.5 w-2.5" })
|
|
7909
8970
|
]
|
|
7910
8971
|
}
|
|
7911
8972
|
) }),
|
|
7912
|
-
/* @__PURE__ */ (0,
|
|
8973
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(TooltipContent, { children: [
|
|
7913
8974
|
"Remove ",
|
|
7914
8975
|
tag
|
|
7915
8976
|
] })
|
|
7916
8977
|
] }, tag))
|
|
7917
8978
|
] }),
|
|
7918
|
-
/* @__PURE__ */ (0,
|
|
8979
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7919
8980
|
Input,
|
|
7920
8981
|
{
|
|
7921
8982
|
autoFocus: true,
|
|
@@ -7936,7 +8997,7 @@ function TagsEditor({
|
|
|
7936
8997
|
className: "h-8 text-xs"
|
|
7937
8998
|
}
|
|
7938
8999
|
),
|
|
7939
|
-
matches.length > 0 && /* @__PURE__ */ (0,
|
|
9000
|
+
matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7940
9001
|
"button",
|
|
7941
9002
|
{
|
|
7942
9003
|
type: "button",
|
|
@@ -7949,8 +9010,8 @@ function TagsEditor({
|
|
|
7949
9010
|
},
|
|
7950
9011
|
s.value
|
|
7951
9012
|
)) }),
|
|
7952
|
-
/* @__PURE__ */ (0,
|
|
7953
|
-
/* @__PURE__ */ (0,
|
|
9013
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-1 pt-1", children: [
|
|
9014
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7954
9015
|
Button,
|
|
7955
9016
|
{
|
|
7956
9017
|
size: "sm",
|
|
@@ -7958,17 +9019,17 @@ function TagsEditor({
|
|
|
7958
9019
|
className: "h-7 px-2",
|
|
7959
9020
|
"aria-label": "Cancel edit",
|
|
7960
9021
|
onClick: onCancel,
|
|
7961
|
-
children: /* @__PURE__ */ (0,
|
|
9022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
7962
9023
|
}
|
|
7963
9024
|
),
|
|
7964
|
-
/* @__PURE__ */ (0,
|
|
9025
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7965
9026
|
Button,
|
|
7966
9027
|
{
|
|
7967
9028
|
size: "sm",
|
|
7968
9029
|
className: "h-7 px-2",
|
|
7969
9030
|
"aria-label": "Apply tags",
|
|
7970
9031
|
onClick: () => onCommit(tags),
|
|
7971
|
-
children: /* @__PURE__ */ (0,
|
|
9032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
7972
9033
|
}
|
|
7973
9034
|
)
|
|
7974
9035
|
] })
|
|
@@ -7980,8 +9041,8 @@ function NumberEditor({
|
|
|
7980
9041
|
onCancel
|
|
7981
9042
|
}) {
|
|
7982
9043
|
const [draft, setDraft] = (0, import_react18.useState)(String(value));
|
|
7983
|
-
return /* @__PURE__ */ (0,
|
|
7984
|
-
/* @__PURE__ */ (0,
|
|
9044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
9045
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7985
9046
|
Input,
|
|
7986
9047
|
{
|
|
7987
9048
|
autoFocus: true,
|
|
@@ -7998,8 +9059,8 @@ function NumberEditor({
|
|
|
7998
9059
|
}
|
|
7999
9060
|
}
|
|
8000
9061
|
),
|
|
8001
|
-
/* @__PURE__ */ (0,
|
|
8002
|
-
/* @__PURE__ */ (0,
|
|
9062
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-1", children: [
|
|
9063
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8003
9064
|
Button,
|
|
8004
9065
|
{
|
|
8005
9066
|
type: "button",
|
|
@@ -8008,10 +9069,10 @@ function NumberEditor({
|
|
|
8008
9069
|
className: "h-7",
|
|
8009
9070
|
"aria-label": "Cancel edit",
|
|
8010
9071
|
onClick: onCancel,
|
|
8011
|
-
children: /* @__PURE__ */ (0,
|
|
9072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
8012
9073
|
}
|
|
8013
9074
|
),
|
|
8014
|
-
/* @__PURE__ */ (0,
|
|
9075
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8015
9076
|
Button,
|
|
8016
9077
|
{
|
|
8017
9078
|
type: "button",
|
|
@@ -8022,7 +9083,7 @@ function NumberEditor({
|
|
|
8022
9083
|
const n = Number(draft);
|
|
8023
9084
|
if (Number.isFinite(n)) onCommit(n);
|
|
8024
9085
|
},
|
|
8025
|
-
children: /* @__PURE__ */ (0,
|
|
9086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
8026
9087
|
}
|
|
8027
9088
|
)
|
|
8028
9089
|
] })
|
|
@@ -8030,24 +9091,24 @@ function NumberEditor({
|
|
|
8030
9091
|
}
|
|
8031
9092
|
|
|
8032
9093
|
// src/data-table/ToolbarFacets.tsx
|
|
8033
|
-
var
|
|
9094
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8034
9095
|
function ToolbarFacets({ facets }) {
|
|
8035
9096
|
if (facets.length === 0) return null;
|
|
8036
|
-
return /* @__PURE__ */ (0,
|
|
9097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
|
|
8037
9098
|
if (facet.type === "custom") {
|
|
8038
|
-
return /* @__PURE__ */ (0,
|
|
9099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: facet.render() }, facet.id);
|
|
8039
9100
|
}
|
|
8040
9101
|
const defaultValue = facet.defaultValue ?? facet.options[0]?.value ?? "";
|
|
8041
9102
|
const isNonDefault = facet.value !== defaultValue;
|
|
8042
|
-
return /* @__PURE__ */ (0,
|
|
9103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
8043
9104
|
"div",
|
|
8044
9105
|
{
|
|
8045
9106
|
className: "flex flex-wrap items-center gap-1.5 max-sm:grid max-sm:w-full max-sm:grid-cols-3",
|
|
8046
9107
|
children: [
|
|
8047
|
-
facet.label ? /* @__PURE__ */ (0,
|
|
9108
|
+
facet.label ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
|
|
8048
9109
|
facet.options.map((opt) => {
|
|
8049
9110
|
const active = facet.value === opt.value;
|
|
8050
|
-
return /* @__PURE__ */ (0,
|
|
9111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
8051
9112
|
Button,
|
|
8052
9113
|
{
|
|
8053
9114
|
type: "button",
|
|
@@ -8061,8 +9122,8 @@ function ToolbarFacets({ facets }) {
|
|
|
8061
9122
|
children: [
|
|
8062
9123
|
opt.icon,
|
|
8063
9124
|
opt.label,
|
|
8064
|
-
active && isNonDefault ? /* @__PURE__ */ (0,
|
|
8065
|
-
/* @__PURE__ */ (0,
|
|
9125
|
+
active && isNonDefault ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Tooltip, { children: [
|
|
9126
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8066
9127
|
"span",
|
|
8067
9128
|
{
|
|
8068
9129
|
role: "button",
|
|
@@ -8080,10 +9141,10 @@ function ToolbarFacets({ facets }) {
|
|
|
8080
9141
|
facet.onChange(defaultValue);
|
|
8081
9142
|
}
|
|
8082
9143
|
},
|
|
8083
|
-
children: /* @__PURE__ */ (0,
|
|
9144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(X, { className: "h-3 w-3" })
|
|
8084
9145
|
}
|
|
8085
9146
|
) }),
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
9147
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipContent, { side: "top", children: "Clear this filter" })
|
|
8087
9148
|
] }) }) : null
|
|
8088
9149
|
]
|
|
8089
9150
|
},
|
|
@@ -8110,7 +9171,7 @@ function resetToolbarFacets(facets) {
|
|
|
8110
9171
|
|
|
8111
9172
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
8112
9173
|
var import_react19 = require("react");
|
|
8113
|
-
var
|
|
9174
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8114
9175
|
function moveRule(rules, from, to) {
|
|
8115
9176
|
if (from === to || to < 0 || to >= rules.length) return [...rules];
|
|
8116
9177
|
const next = [...rules];
|
|
@@ -8156,8 +9217,8 @@ function LayeredFilterBuilder({
|
|
|
8156
9217
|
const reorder = (from, to) => {
|
|
8157
9218
|
onChange(moveRule(rules, from, to));
|
|
8158
9219
|
};
|
|
8159
|
-
return /* @__PURE__ */ (0,
|
|
8160
|
-
/* @__PURE__ */ (0,
|
|
9220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
|
|
9221
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8161
9222
|
Popover,
|
|
8162
9223
|
{
|
|
8163
9224
|
open,
|
|
@@ -8169,7 +9230,7 @@ function LayeredFilterBuilder({
|
|
|
8169
9230
|
}
|
|
8170
9231
|
},
|
|
8171
9232
|
children: [
|
|
8172
|
-
/* @__PURE__ */ (0,
|
|
9233
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8173
9234
|
Button,
|
|
8174
9235
|
{
|
|
8175
9236
|
type: "button",
|
|
@@ -8178,25 +9239,25 @@ function LayeredFilterBuilder({
|
|
|
8178
9239
|
className: "h-8 gap-1.5 px-2 text-xs",
|
|
8179
9240
|
"aria-label": label,
|
|
8180
9241
|
children: [
|
|
8181
|
-
/* @__PURE__ */ (0,
|
|
8182
|
-
/* @__PURE__ */ (0,
|
|
8183
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
9242
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
|
|
9243
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
|
|
9244
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sm:hidden", children: rules.length }) : null
|
|
8184
9245
|
]
|
|
8185
9246
|
}
|
|
8186
9247
|
) }),
|
|
8187
|
-
/* @__PURE__ */ (0,
|
|
9248
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8188
9249
|
PopoverContent,
|
|
8189
9250
|
{
|
|
8190
9251
|
align: "start",
|
|
8191
9252
|
sideOffset: 6,
|
|
8192
9253
|
className: "w-[min(46rem,calc(100vw-1rem))] p-0",
|
|
8193
9254
|
children: [
|
|
8194
|
-
/* @__PURE__ */ (0,
|
|
8195
|
-
/* @__PURE__ */ (0,
|
|
8196
|
-
/* @__PURE__ */ (0,
|
|
8197
|
-
/* @__PURE__ */ (0,
|
|
9255
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
|
|
9256
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
9257
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
|
|
9258
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
|
|
8198
9259
|
] }),
|
|
8199
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
9260
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8200
9261
|
Button,
|
|
8201
9262
|
{
|
|
8202
9263
|
type: "button",
|
|
@@ -8208,10 +9269,10 @@ function LayeredFilterBuilder({
|
|
|
8208
9269
|
}
|
|
8209
9270
|
) : null
|
|
8210
9271
|
] }),
|
|
8211
|
-
/* @__PURE__ */ (0,
|
|
8212
|
-
/* @__PURE__ */ (0,
|
|
8213
|
-
/* @__PURE__ */ (0,
|
|
8214
|
-
] }) : rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
9272
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
|
|
9273
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
|
|
9274
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
|
|
9275
|
+
] }) : rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8215
9276
|
LayeredRuleRow,
|
|
8216
9277
|
{
|
|
8217
9278
|
index,
|
|
@@ -8231,9 +9292,9 @@ function LayeredFilterBuilder({
|
|
|
8231
9292
|
},
|
|
8232
9293
|
rule.id
|
|
8233
9294
|
)) }),
|
|
8234
|
-
/* @__PURE__ */ (0,
|
|
8235
|
-
/* @__PURE__ */ (0,
|
|
8236
|
-
/* @__PURE__ */ (0,
|
|
9295
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
|
|
9296
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
|
|
9297
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8237
9298
|
Button,
|
|
8238
9299
|
{
|
|
8239
9300
|
type: "button",
|
|
@@ -8243,7 +9304,7 @@ function LayeredFilterBuilder({
|
|
|
8243
9304
|
disabled: rules.length >= maxRules,
|
|
8244
9305
|
onClick: addRule,
|
|
8245
9306
|
children: [
|
|
8246
|
-
/* @__PURE__ */ (0,
|
|
9307
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Plus, { className: "h-3.5 w-3.5" }),
|
|
8247
9308
|
" Add layer"
|
|
8248
9309
|
]
|
|
8249
9310
|
}
|
|
@@ -8255,7 +9316,7 @@ function LayeredFilterBuilder({
|
|
|
8255
9316
|
]
|
|
8256
9317
|
}
|
|
8257
9318
|
),
|
|
8258
|
-
rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
9319
|
+
rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8259
9320
|
"span",
|
|
8260
9321
|
{
|
|
8261
9322
|
className: cn(
|
|
@@ -8263,7 +9324,7 @@ function LayeredFilterBuilder({
|
|
|
8263
9324
|
isCompleteLayeredFilterRule(rule) ? "border-border bg-muted/50 text-foreground" : "border-dashed border-warning/50 bg-warning/10 text-warning"
|
|
8264
9325
|
),
|
|
8265
9326
|
children: [
|
|
8266
|
-
/* @__PURE__ */ (0,
|
|
9327
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8267
9328
|
"button",
|
|
8268
9329
|
{
|
|
8269
9330
|
type: "button",
|
|
@@ -8271,19 +9332,19 @@ function LayeredFilterBuilder({
|
|
|
8271
9332
|
onClick: () => setOpen(true),
|
|
8272
9333
|
title: isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : `Layer ${index + 1} needs a value`,
|
|
8273
9334
|
children: [
|
|
8274
|
-
/* @__PURE__ */ (0,
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
|
|
8275
9336
|
isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : "Choose a value"
|
|
8276
9337
|
]
|
|
8277
9338
|
}
|
|
8278
9339
|
),
|
|
8279
|
-
/* @__PURE__ */ (0,
|
|
9340
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8280
9341
|
"button",
|
|
8281
9342
|
{
|
|
8282
9343
|
type: "button",
|
|
8283
9344
|
className: "shrink-0 rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
8284
9345
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
8285
9346
|
onClick: () => removeRule(index),
|
|
8286
|
-
children: /* @__PURE__ */ (0,
|
|
9347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(X, { className: "h-3 w-3" })
|
|
8287
9348
|
}
|
|
8288
9349
|
)
|
|
8289
9350
|
]
|
|
@@ -8313,7 +9374,7 @@ function LayeredRuleRow({
|
|
|
8313
9374
|
event.preventDefault();
|
|
8314
9375
|
onKeyboardMove(event.key === "ArrowUp" ? -1 : 1);
|
|
8315
9376
|
};
|
|
8316
|
-
return /* @__PURE__ */ (0,
|
|
9377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8317
9378
|
"div",
|
|
8318
9379
|
{
|
|
8319
9380
|
className: cn(
|
|
@@ -8326,7 +9387,7 @@ function LayeredRuleRow({
|
|
|
8326
9387
|
onDrop(index);
|
|
8327
9388
|
},
|
|
8328
9389
|
children: [
|
|
8329
|
-
/* @__PURE__ */ (0,
|
|
9390
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8330
9391
|
"button",
|
|
8331
9392
|
{
|
|
8332
9393
|
type: "button",
|
|
@@ -8340,10 +9401,10 @@ function LayeredRuleRow({
|
|
|
8340
9401
|
},
|
|
8341
9402
|
onDragEnd,
|
|
8342
9403
|
onKeyDown: handleMoveKey,
|
|
8343
|
-
children: /* @__PURE__ */ (0,
|
|
9404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
8344
9405
|
}
|
|
8345
9406
|
),
|
|
8346
|
-
/* @__PURE__ */ (0,
|
|
9407
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8347
9408
|
Select,
|
|
8348
9409
|
{
|
|
8349
9410
|
value: field.id,
|
|
@@ -8361,16 +9422,16 @@ function LayeredRuleRow({
|
|
|
8361
9422
|
});
|
|
8362
9423
|
},
|
|
8363
9424
|
children: [
|
|
8364
|
-
/* @__PURE__ */ (0,
|
|
9425
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8365
9426
|
SelectTrigger,
|
|
8366
9427
|
{
|
|
8367
9428
|
size: "sm",
|
|
8368
9429
|
className: "h-7 w-full text-xs max-sm:col-span-1",
|
|
8369
9430
|
"aria-label": `Filter layer ${index + 1} field`,
|
|
8370
|
-
children: /* @__PURE__ */ (0,
|
|
9431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
|
|
8371
9432
|
}
|
|
8372
9433
|
),
|
|
8373
|
-
/* @__PURE__ */ (0,
|
|
9434
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8374
9435
|
SelectItem,
|
|
8375
9436
|
{
|
|
8376
9437
|
value: candidate.id,
|
|
@@ -8382,7 +9443,7 @@ function LayeredRuleRow({
|
|
|
8382
9443
|
]
|
|
8383
9444
|
}
|
|
8384
9445
|
),
|
|
8385
|
-
/* @__PURE__ */ (0,
|
|
9446
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8386
9447
|
Select,
|
|
8387
9448
|
{
|
|
8388
9449
|
value: rule.operator,
|
|
@@ -8394,35 +9455,35 @@ function LayeredRuleRow({
|
|
|
8394
9455
|
});
|
|
8395
9456
|
},
|
|
8396
9457
|
children: [
|
|
8397
|
-
/* @__PURE__ */ (0,
|
|
9458
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8398
9459
|
SelectTrigger,
|
|
8399
9460
|
{
|
|
8400
9461
|
size: "sm",
|
|
8401
9462
|
className: "h-7 w-full text-xs max-sm:col-start-2",
|
|
8402
9463
|
"aria-label": `Filter layer ${index + 1} operator`,
|
|
8403
|
-
children: /* @__PURE__ */ (0,
|
|
9464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
|
|
8404
9465
|
}
|
|
8405
9466
|
),
|
|
8406
|
-
/* @__PURE__ */ (0,
|
|
9467
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
|
|
8407
9468
|
]
|
|
8408
9469
|
}
|
|
8409
9470
|
),
|
|
8410
|
-
/* @__PURE__ */ (0,
|
|
9471
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8411
9472
|
Select,
|
|
8412
9473
|
{
|
|
8413
9474
|
value: rule.value,
|
|
8414
9475
|
onValueChange: (value) => onChange({ value }),
|
|
8415
9476
|
children: [
|
|
8416
|
-
/* @__PURE__ */ (0,
|
|
9477
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8417
9478
|
SelectTrigger,
|
|
8418
9479
|
{
|
|
8419
9480
|
size: "sm",
|
|
8420
9481
|
className: "h-7 w-full text-xs",
|
|
8421
9482
|
"aria-label": `Filter layer ${index + 1} value`,
|
|
8422
|
-
children: /* @__PURE__ */ (0,
|
|
9483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
|
|
8423
9484
|
}
|
|
8424
9485
|
),
|
|
8425
|
-
/* @__PURE__ */ (0,
|
|
9486
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8426
9487
|
SelectItem,
|
|
8427
9488
|
{
|
|
8428
9489
|
value: option.value,
|
|
@@ -8433,8 +9494,8 @@ function LayeredRuleRow({
|
|
|
8433
9494
|
)) })
|
|
8434
9495
|
]
|
|
8435
9496
|
}
|
|
8436
|
-
) : /* @__PURE__ */ (0,
|
|
8437
|
-
/* @__PURE__ */ (0,
|
|
9497
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
9498
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8438
9499
|
Input,
|
|
8439
9500
|
{
|
|
8440
9501
|
value: rule.value,
|
|
@@ -8445,9 +9506,9 @@ function LayeredRuleRow({
|
|
|
8445
9506
|
"aria-label": `Filter layer ${index + 1} value`
|
|
8446
9507
|
}
|
|
8447
9508
|
),
|
|
8448
|
-
rule.operator === "between" ? /* @__PURE__ */ (0,
|
|
8449
|
-
/* @__PURE__ */ (0,
|
|
8450
|
-
/* @__PURE__ */ (0,
|
|
9509
|
+
rule.operator === "between" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
9510
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
|
|
9511
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8451
9512
|
Input,
|
|
8452
9513
|
{
|
|
8453
9514
|
value: rule.valueTo ?? "",
|
|
@@ -8460,7 +9521,7 @@ function LayeredRuleRow({
|
|
|
8460
9521
|
)
|
|
8461
9522
|
] }) : null
|
|
8462
9523
|
] }) }),
|
|
8463
|
-
/* @__PURE__ */ (0,
|
|
9524
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8464
9525
|
Button,
|
|
8465
9526
|
{
|
|
8466
9527
|
type: "button",
|
|
@@ -8469,7 +9530,7 @@ function LayeredRuleRow({
|
|
|
8469
9530
|
className: "h-7 w-7 p-0 text-muted-foreground hover:text-destructive max-sm:col-start-3 max-sm:row-start-1",
|
|
8470
9531
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
8471
9532
|
onClick: onRemove,
|
|
8472
|
-
children: /* @__PURE__ */ (0,
|
|
9533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Trash2, { className: "h-3.5 w-3.5" })
|
|
8473
9534
|
}
|
|
8474
9535
|
)
|
|
8475
9536
|
]
|
|
@@ -8582,7 +9643,7 @@ function safeQueryPage(requestedPage, totalItems, pageSize) {
|
|
|
8582
9643
|
}
|
|
8583
9644
|
|
|
8584
9645
|
// src/data-table/MatrxDataTable.tsx
|
|
8585
|
-
var
|
|
9646
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8586
9647
|
function TableToolbarAction({
|
|
8587
9648
|
HostAction,
|
|
8588
9649
|
ariaLabel,
|
|
@@ -8593,10 +9654,10 @@ function TableToolbarAction({
|
|
|
8593
9654
|
children
|
|
8594
9655
|
}) {
|
|
8595
9656
|
if (HostAction) {
|
|
8596
|
-
return /* @__PURE__ */ (0,
|
|
9657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-toolbar-action": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HostAction, { ariaLabel, tooltip, disabled, busy, onClick, children }) });
|
|
8597
9658
|
}
|
|
8598
|
-
return /* @__PURE__ */ (0,
|
|
8599
|
-
/* @__PURE__ */ (0,
|
|
9659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8600
9661
|
Button,
|
|
8601
9662
|
{
|
|
8602
9663
|
type: "button",
|
|
@@ -8611,7 +9672,7 @@ function TableToolbarAction({
|
|
|
8611
9672
|
children: (0, import_react20.isValidElement)(children) ? (0, import_react20.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children
|
|
8612
9673
|
}
|
|
8613
9674
|
) }) }),
|
|
8614
|
-
/* @__PURE__ */ (0,
|
|
9675
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
|
|
8615
9676
|
] });
|
|
8616
9677
|
}
|
|
8617
9678
|
function hasSameRowReferences(previous, next) {
|
|
@@ -8628,7 +9689,7 @@ function TableRowCopyControl({
|
|
|
8628
9689
|
sourceId,
|
|
8629
9690
|
defaultColumns
|
|
8630
9691
|
}) {
|
|
8631
|
-
return /* @__PURE__ */ (0,
|
|
9692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CopyButtons, { size, ...tableRowCopyProps(copy, row, sourceId, defaultColumns) });
|
|
8632
9693
|
}
|
|
8633
9694
|
function tableRowCopyProps(copy, row, sourceId, defaultColumns) {
|
|
8634
9695
|
const aiVariants = copy.rowAiVariants?.(row);
|
|
@@ -8652,8 +9713,8 @@ function isStringArray(value) {
|
|
|
8652
9713
|
}
|
|
8653
9714
|
var activeUrlTableIds = /* @__PURE__ */ new Set();
|
|
8654
9715
|
function MatrxDataTable(props) {
|
|
8655
|
-
if (!props.urlState) return /* @__PURE__ */ (0,
|
|
8656
|
-
return /* @__PURE__ */ (0,
|
|
9716
|
+
if (!props.urlState) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxDataTableCore, { ...props });
|
|
9717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
|
|
8657
9718
|
}
|
|
8658
9719
|
function MatrxDataTableWithUrlState({
|
|
8659
9720
|
urlState,
|
|
@@ -8708,7 +9769,7 @@ function MatrxDataTableWithUrlState({
|
|
|
8708
9769
|
props.selection?.onSelectedIdsChange(ids);
|
|
8709
9770
|
}
|
|
8710
9771
|
} : props.selection;
|
|
8711
|
-
return /* @__PURE__ */ (0,
|
|
9772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8712
9773
|
MatrxDataTableCore,
|
|
8713
9774
|
{
|
|
8714
9775
|
...props,
|
|
@@ -8760,7 +9821,7 @@ function opensRowHref(event) {
|
|
|
8760
9821
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1;
|
|
8761
9822
|
}
|
|
8762
9823
|
function TableContextPassthrough({ children }) {
|
|
8763
|
-
return /* @__PURE__ */ (0,
|
|
9824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children });
|
|
8764
9825
|
}
|
|
8765
9826
|
function MatrxDataTableCore({
|
|
8766
9827
|
data: suppliedData,
|
|
@@ -8801,6 +9862,8 @@ function MatrxDataTableCore({
|
|
|
8801
9862
|
rowActions,
|
|
8802
9863
|
footerRows = [],
|
|
8803
9864
|
rowClassName,
|
|
9865
|
+
cellClassName,
|
|
9866
|
+
tableStyle,
|
|
8804
9867
|
highlightedIndex,
|
|
8805
9868
|
onViewChange,
|
|
8806
9869
|
rowWrapper,
|
|
@@ -8946,7 +10009,7 @@ function MatrxDataTableCore({
|
|
|
8946
10009
|
setInternalPage(next);
|
|
8947
10010
|
};
|
|
8948
10011
|
const [internalPageSize, setInternalPageSize] = (0, import_react20.useState)(
|
|
8949
|
-
defaultPageSize
|
|
10012
|
+
defaultPageSize
|
|
8950
10013
|
);
|
|
8951
10014
|
const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
|
|
8952
10015
|
const setPageSize = (next) => {
|
|
@@ -9398,6 +10461,48 @@ function MatrxDataTableCore({
|
|
|
9398
10461
|
setFixedTableGeometry(geometry);
|
|
9399
10462
|
}, [resolvedDensity, measureFixedTableGeometry, usesMeasuredFixedLayout]);
|
|
9400
10463
|
const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
|
|
10464
|
+
const frozenColumns = (0, import_react20.useMemo)(() => {
|
|
10465
|
+
if (!visibleColumns.some((column) => column.frozen)) return NO_FROZEN_COLUMNS;
|
|
10466
|
+
const ids = visibleColumns.map(columnId);
|
|
10467
|
+
const byId = new Map(visibleColumns.map((column) => [columnId(column), column]));
|
|
10468
|
+
return resolveFrozenColumns(
|
|
10469
|
+
ids,
|
|
10470
|
+
(id) => byId.get(id)?.frozen === true,
|
|
10471
|
+
(id) => effectiveColumnWidths[id] ?? pixelWidth(byId.get(id)?.width),
|
|
10472
|
+
selection ? fixedTableGeometry?.selectionWidth : null
|
|
10473
|
+
);
|
|
10474
|
+
}, [visibleColumns, effectiveColumnWidths, selection, fixedTableGeometry]);
|
|
10475
|
+
const frozenStyle = (id) => {
|
|
10476
|
+
const left = frozenColumns.offsets[id];
|
|
10477
|
+
if (left === void 0) return void 0;
|
|
10478
|
+
return { "--matrx-frozen-left": `${left}px` };
|
|
10479
|
+
};
|
|
10480
|
+
const frozenEdgeId = (() => {
|
|
10481
|
+
const ids = Object.keys(frozenColumns.offsets);
|
|
10482
|
+
return ids.length === 0 ? null : ids[ids.length - 1];
|
|
10483
|
+
})();
|
|
10484
|
+
const styleFieldOf = tableStyle?.fieldOf ?? ((id) => id);
|
|
10485
|
+
const styleDocumentOf = tableStyle?.documentOf ?? ((row) => row);
|
|
10486
|
+
const noChoiceColor = () => void 0;
|
|
10487
|
+
const rowTintClass = (row, id) => {
|
|
10488
|
+
if (!tableStyle) return void 0;
|
|
10489
|
+
const color = resolveRowColor(
|
|
10490
|
+
tableStyle.style,
|
|
10491
|
+
{ id, data: styleDocumentOf(row) },
|
|
10492
|
+
tableStyle.choiceColorFor ?? noChoiceColor
|
|
10493
|
+
);
|
|
10494
|
+
return color ? ROW_TINT_CLASS[color] : void 0;
|
|
10495
|
+
};
|
|
10496
|
+
const cellTintClass = (row, id, colId) => {
|
|
10497
|
+
if (!tableStyle) return void 0;
|
|
10498
|
+
const color = resolveCellColor(
|
|
10499
|
+
tableStyle.style,
|
|
10500
|
+
{ id, data: styleDocumentOf(row) },
|
|
10501
|
+
styleFieldOf(colId),
|
|
10502
|
+
tableStyle.choiceColorFor ?? noChoiceColor
|
|
10503
|
+
);
|
|
10504
|
+
return color ? CELL_TINT_CLASS[color] : void 0;
|
|
10505
|
+
};
|
|
9401
10506
|
const declaredVisibleCopyColumns = (0, import_react20.useMemo)(
|
|
9402
10507
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
9403
10508
|
[visibleColumns]
|
|
@@ -9605,9 +10710,9 @@ function MatrxDataTableCore({
|
|
|
9605
10710
|
const showToolbarCopy = effectiveCopy !== void 0 && effectiveCopy.showToolbar !== false;
|
|
9606
10711
|
const renderRowActions = (row, controls) => {
|
|
9607
10712
|
const actions = rowActions?.(row, controls);
|
|
9608
|
-
const scopedActions = /* @__PURE__ */ (0,
|
|
10713
|
+
const scopedActions = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxTableRowControlsScope, { value: controls, children: actions });
|
|
9609
10714
|
if (!effectiveCopy || !showRowCopy) return scopedActions;
|
|
9610
|
-
return /* @__PURE__ */ (0,
|
|
10715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
9611
10716
|
MatrxTableRowAlchemyProvider,
|
|
9612
10717
|
{
|
|
9613
10718
|
copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ? declaredVisibleCopyColumns : void 0),
|
|
@@ -9704,7 +10809,7 @@ function MatrxDataTableCore({
|
|
|
9704
10809
|
const renderedEmptyState = remoteQuery === null && data.length > 0 && hasActiveFilters ? {
|
|
9705
10810
|
title: "No matching rows",
|
|
9706
10811
|
description: "No rows match the current search or filters.",
|
|
9707
|
-
action: /* @__PURE__ */ (0,
|
|
10812
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", variant: "outline", size: "sm", onClick: clearAllFilters, children: "Clear filters" }),
|
|
9708
10813
|
icon: void 0
|
|
9709
10814
|
} : emptyState;
|
|
9710
10815
|
const commitCell = (rowId, field, next) => {
|
|
@@ -10076,7 +11181,7 @@ function MatrxDataTableCore({
|
|
|
10076
11181
|
const display = renderCell(applyRowEdits(row, rowEdits), col, index);
|
|
10077
11182
|
const href = col.href?.(row) ?? void 0;
|
|
10078
11183
|
if (editEnabled && col.editable && (col.editableIf?.(row) ?? true)) {
|
|
10079
|
-
return /* @__PURE__ */ (0,
|
|
11184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10080
11185
|
EditableTableCell,
|
|
10081
11186
|
{
|
|
10082
11187
|
value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
|
|
@@ -10091,7 +11196,7 @@ function MatrxDataTableCore({
|
|
|
10091
11196
|
}
|
|
10092
11197
|
);
|
|
10093
11198
|
}
|
|
10094
|
-
return href ? /* @__PURE__ */ (0,
|
|
11199
|
+
return href ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
|
|
10095
11200
|
};
|
|
10096
11201
|
const currentViewSnapshot = (0, import_react20.useMemo)(
|
|
10097
11202
|
() => ({
|
|
@@ -10197,7 +11302,7 @@ function MatrxDataTableCore({
|
|
|
10197
11302
|
},
|
|
10198
11303
|
[columns, commitColumnState, commitColumnWidths, controlledQuery, intelligentSearchEnabled, intelligentSearchScopes, toolbar]
|
|
10199
11304
|
);
|
|
10200
|
-
return /* @__PURE__ */ (0,
|
|
11305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ContextMenuBoundary, { label: tableId ?? "Data table", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10201
11306
|
import_core3.DndContext,
|
|
10202
11307
|
{
|
|
10203
11308
|
id: tableDndContextId,
|
|
@@ -10290,7 +11395,7 @@ function MatrxDataTableCore({
|
|
|
10290
11395
|
commitColumnState(order, effectiveHiddenColumnIds);
|
|
10291
11396
|
},
|
|
10292
11397
|
children: [
|
|
10293
|
-
/* @__PURE__ */ (0,
|
|
11398
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10294
11399
|
"div",
|
|
10295
11400
|
{
|
|
10296
11401
|
ref: rootRef,
|
|
@@ -10305,14 +11410,14 @@ function MatrxDataTableCore({
|
|
|
10305
11410
|
),
|
|
10306
11411
|
children: [
|
|
10307
11412
|
notice,
|
|
10308
|
-
savedViewError ? /* @__PURE__ */ (0,
|
|
10309
|
-
toolbarActionError ? /* @__PURE__ */ (0,
|
|
10310
|
-
!hideToolbar && (viewTabs || toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0,
|
|
11413
|
+
savedViewError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
|
|
11414
|
+
toolbarActionError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
|
|
11415
|
+
!hideToolbar && (viewTabs || toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10311
11416
|
TableTitleRow,
|
|
10312
11417
|
{
|
|
10313
|
-
tabs: viewTabs ? /* @__PURE__ */ (0,
|
|
11418
|
+
tabs: viewTabs ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TableViewWorkspace, { snapshot: currentViewSnapshot, onApply: applySavedView, related: relatedTableActions }, tableId ?? "table") : void 0,
|
|
10314
11419
|
...toolbar?.title === void 0 ? {} : { title: toolbar.title },
|
|
10315
|
-
context: tableId && SavedViews ? /* @__PURE__ */ (0,
|
|
11420
|
+
context: tableId && SavedViews ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-view-control": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10316
11421
|
SavedViews,
|
|
10317
11422
|
{
|
|
10318
11423
|
tableId,
|
|
@@ -10321,7 +11426,7 @@ function MatrxDataTableCore({
|
|
|
10321
11426
|
onApply: applySavedView
|
|
10322
11427
|
}
|
|
10323
11428
|
) }) : void 0,
|
|
10324
|
-
search: showSearch ? intelligentSearchEnabled ? /* @__PURE__ */ (0,
|
|
11429
|
+
search: showSearch ? intelligentSearchEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10325
11430
|
TableSearch,
|
|
10326
11431
|
{
|
|
10327
11432
|
value: searchValue,
|
|
@@ -10331,7 +11436,7 @@ function MatrxDataTableCore({
|
|
|
10331
11436
|
scopes: intelligentSearchScopes,
|
|
10332
11437
|
...toolbar?.searchPlaceholder === void 0 ? {} : { placeholder: toolbar.searchPlaceholder }
|
|
10333
11438
|
}
|
|
10334
|
-
) : /* @__PURE__ */ (0,
|
|
11439
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10335
11440
|
"div",
|
|
10336
11441
|
{
|
|
10337
11442
|
"data-matrx-table-search": true,
|
|
@@ -10340,9 +11445,9 @@ function MatrxDataTableCore({
|
|
|
10340
11445
|
toolbar?.searchMatch ? "sm:max-w-md" : "sm:max-w-xs"
|
|
10341
11446
|
),
|
|
10342
11447
|
children: [
|
|
10343
|
-
/* @__PURE__ */ (0,
|
|
10344
|
-
/* @__PURE__ */ (0,
|
|
10345
|
-
/* @__PURE__ */ (0,
|
|
11448
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
11449
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
|
|
11450
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10346
11451
|
Input,
|
|
10347
11452
|
{
|
|
10348
11453
|
value: searchValue,
|
|
@@ -10355,22 +11460,22 @@ function MatrxDataTableCore({
|
|
|
10355
11460
|
style: { fontSize: "16px" }
|
|
10356
11461
|
}
|
|
10357
11462
|
),
|
|
10358
|
-
searchValue ? /* @__PURE__ */ (0,
|
|
10359
|
-
/* @__PURE__ */ (0,
|
|
11463
|
+
searchValue ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
11464
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10360
11465
|
"button",
|
|
10361
11466
|
{
|
|
10362
11467
|
type: "button",
|
|
10363
11468
|
"aria-label": "Clear search",
|
|
10364
11469
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
10365
11470
|
onClick: () => setSearchValue(""),
|
|
10366
|
-
children: /* @__PURE__ */ (0,
|
|
11471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-5 w-5" })
|
|
10367
11472
|
}
|
|
10368
11473
|
) }),
|
|
10369
|
-
/* @__PURE__ */ (0,
|
|
11474
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Clear search" })
|
|
10370
11475
|
] }) : null
|
|
10371
11476
|
] }),
|
|
10372
|
-
toolbar?.searchMatch ? /* @__PURE__ */ (0,
|
|
10373
|
-
/* @__PURE__ */ (0,
|
|
11477
|
+
toolbar?.searchMatch ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
11478
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10374
11479
|
Button,
|
|
10375
11480
|
{
|
|
10376
11481
|
type: "button",
|
|
@@ -10383,18 +11488,18 @@ function MatrxDataTableCore({
|
|
|
10383
11488
|
searchMatchMode === "whole_words" ? "contains" : "whole_words"
|
|
10384
11489
|
),
|
|
10385
11490
|
children: [
|
|
10386
|
-
/* @__PURE__ */ (0,
|
|
11491
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WholeWord, { className: "h-5 w-5" }),
|
|
10387
11492
|
searchMatchMode === "whole_words" ? "Whole words" : "Contains"
|
|
10388
11493
|
]
|
|
10389
11494
|
}
|
|
10390
11495
|
) }),
|
|
10391
|
-
/* @__PURE__ */ (0,
|
|
11496
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
|
|
10392
11497
|
] }) : null
|
|
10393
11498
|
]
|
|
10394
11499
|
}
|
|
10395
11500
|
) : null,
|
|
10396
11501
|
children: [
|
|
10397
|
-
toolbar?.layeredFilters ? /* @__PURE__ */ (0,
|
|
11502
|
+
toolbar?.layeredFilters ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10398
11503
|
LayeredFilterBuilder,
|
|
10399
11504
|
{
|
|
10400
11505
|
fields: toolbar.layeredFilters.fields,
|
|
@@ -10404,9 +11509,9 @@ function MatrxDataTableCore({
|
|
|
10404
11509
|
label: toolbar.layeredFilters.label
|
|
10405
11510
|
}
|
|
10406
11511
|
) : null,
|
|
10407
|
-
toolbar?.anyOf ? /* @__PURE__ */ (0,
|
|
10408
|
-
/* @__PURE__ */ (0,
|
|
10409
|
-
/* @__PURE__ */ (0,
|
|
11512
|
+
toolbar?.anyOf ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative w-full max-w-xs", children: [
|
|
11513
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
|
|
11514
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10410
11515
|
Input,
|
|
10411
11516
|
{
|
|
10412
11517
|
value: anyOfValue,
|
|
@@ -10416,22 +11521,22 @@ function MatrxDataTableCore({
|
|
|
10416
11521
|
style: { fontSize: "16px" }
|
|
10417
11522
|
}
|
|
10418
11523
|
),
|
|
10419
|
-
anyOfValue ? /* @__PURE__ */ (0,
|
|
10420
|
-
/* @__PURE__ */ (0,
|
|
11524
|
+
anyOfValue ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
11525
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10421
11526
|
"button",
|
|
10422
11527
|
{
|
|
10423
11528
|
type: "button",
|
|
10424
11529
|
"aria-label": "Clear match-any search",
|
|
10425
11530
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
10426
11531
|
onClick: () => setAnyOfValue(""),
|
|
10427
|
-
children: /* @__PURE__ */ (0,
|
|
11532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-5 w-5" })
|
|
10428
11533
|
}
|
|
10429
11534
|
) }),
|
|
10430
|
-
/* @__PURE__ */ (0,
|
|
11535
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Clear match-any search" })
|
|
10431
11536
|
] }) : null
|
|
10432
11537
|
] }) : null,
|
|
10433
|
-
renderedFacets ? /* @__PURE__ */ (0,
|
|
10434
|
-
toolbar?.leading ? /* @__PURE__ */ (0,
|
|
11538
|
+
renderedFacets ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ToolbarFacets, { facets: renderedFacets }) : null,
|
|
11539
|
+
toolbar?.leading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10435
11540
|
"div",
|
|
10436
11541
|
{
|
|
10437
11542
|
"data-matrx-table-toolbar-extras": true,
|
|
@@ -10439,30 +11544,13 @@ function MatrxDataTableCore({
|
|
|
10439
11544
|
children: toolbar.leading
|
|
10440
11545
|
}
|
|
10441
11546
|
) : null,
|
|
10442
|
-
/* @__PURE__ */ (0,
|
|
11547
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10443
11548
|
"div",
|
|
10444
11549
|
{
|
|
10445
11550
|
"data-matrx-table-actions": true,
|
|
10446
11551
|
className: "ml-auto flex min-w-0 flex-wrap items-center gap-0",
|
|
10447
11552
|
children: [
|
|
10448
|
-
|
|
10449
|
-
"span",
|
|
10450
|
-
{
|
|
10451
|
-
"data-matrx-table-source-total": true,
|
|
10452
|
-
className: "text-xs tabular-nums text-muted-foreground",
|
|
10453
|
-
children: [
|
|
10454
|
-
data.length.toLocaleString(),
|
|
10455
|
-
" loaded of",
|
|
10456
|
-
" ",
|
|
10457
|
-
Math.max(0, sourceTotal).toLocaleString(),
|
|
10458
|
-
" \xB7",
|
|
10459
|
-
" ",
|
|
10460
|
-
processed.length.toLocaleString(),
|
|
10461
|
-
" matched"
|
|
10462
|
-
]
|
|
10463
|
-
}
|
|
10464
|
-
) : null,
|
|
10465
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11553
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10466
11554
|
TableToolbarAction,
|
|
10467
11555
|
{
|
|
10468
11556
|
HostAction: host.ToolbarAction,
|
|
@@ -10470,10 +11558,10 @@ function MatrxDataTableCore({
|
|
|
10470
11558
|
tooltip: hasActiveFilters ? "Clear search and filters; keep columns and sort" : "No search or filters to clear",
|
|
10471
11559
|
disabled: !hasActiveFilters,
|
|
10472
11560
|
onClick: clearAllFilters,
|
|
10473
|
-
children: /* @__PURE__ */ (0,
|
|
11561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Eraser, {})
|
|
10474
11562
|
}
|
|
10475
11563
|
),
|
|
10476
|
-
showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
11564
|
+
showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10477
11565
|
CopyButtons,
|
|
10478
11566
|
{
|
|
10479
11567
|
size: "toolbar",
|
|
@@ -10516,17 +11604,17 @@ function MatrxDataTableCore({
|
|
|
10516
11604
|
}
|
|
10517
11605
|
}
|
|
10518
11606
|
) : null,
|
|
10519
|
-
columns.length > 0 ? /* @__PURE__ */ (0,
|
|
11607
|
+
columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10520
11608
|
TableToolbarAction,
|
|
10521
11609
|
{
|
|
10522
11610
|
HostAction: host.ToolbarAction,
|
|
10523
11611
|
ariaLabel: "Columns",
|
|
10524
11612
|
tooltip: "Show, hide, or reorder columns",
|
|
10525
11613
|
onClick: () => setColumnManagerOpen(true),
|
|
10526
|
-
children: /* @__PURE__ */ (0,
|
|
11614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SlidersHorizontal, {})
|
|
10527
11615
|
}
|
|
10528
11616
|
) : null,
|
|
10529
|
-
toolbar?.refresh ? /* @__PURE__ */ (0,
|
|
11617
|
+
toolbar?.refresh ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10530
11618
|
TableToolbarAction,
|
|
10531
11619
|
{
|
|
10532
11620
|
HostAction: host.ToolbarAction,
|
|
@@ -10548,10 +11636,10 @@ function MatrxDataTableCore({
|
|
|
10548
11636
|
setToolbarActionPending((current) => ({ ...current, refresh: false }));
|
|
10549
11637
|
});
|
|
10550
11638
|
},
|
|
10551
|
-
children: /* @__PURE__ */ (0,
|
|
11639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RefreshControlIcon, { spinning: isFetching || toolbarActionPending.refresh })
|
|
10552
11640
|
}
|
|
10553
11641
|
) : null,
|
|
10554
|
-
toolbar?.add ? /* @__PURE__ */ (0,
|
|
11642
|
+
toolbar?.add ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10555
11643
|
TableToolbarAction,
|
|
10556
11644
|
{
|
|
10557
11645
|
HostAction: host.ToolbarAction,
|
|
@@ -10573,7 +11661,7 @@ function MatrxDataTableCore({
|
|
|
10573
11661
|
setToolbarActionPending((current) => ({ ...current, add: false }));
|
|
10574
11662
|
});
|
|
10575
11663
|
},
|
|
10576
|
-
children: /* @__PURE__ */ (0,
|
|
11664
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Plus, {})
|
|
10577
11665
|
}
|
|
10578
11666
|
) : null,
|
|
10579
11667
|
toolbar?.actions
|
|
@@ -10583,15 +11671,15 @@ function MatrxDataTableCore({
|
|
|
10583
11671
|
]
|
|
10584
11672
|
}
|
|
10585
11673
|
),
|
|
10586
|
-
selection && selectionCount > 0 ? /* @__PURE__ */ (0,
|
|
10587
|
-
/* @__PURE__ */ (0,
|
|
10588
|
-
(0,
|
|
11674
|
+
selection && selectionCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
|
|
11675
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "text-xs font-medium text-foreground", children: [
|
|
11676
|
+
(0, import_format5.formatCount)(selectionCount),
|
|
10589
11677
|
" ",
|
|
10590
11678
|
selectionNoun,
|
|
10591
11679
|
selectionCount === 1 ? "" : "s",
|
|
10592
11680
|
" selected"
|
|
10593
11681
|
] }),
|
|
10594
|
-
/* @__PURE__ */ (0,
|
|
11682
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10595
11683
|
Button,
|
|
10596
11684
|
{
|
|
10597
11685
|
type: "button",
|
|
@@ -10603,13 +11691,13 @@ function MatrxDataTableCore({
|
|
|
10603
11691
|
selection.onSelectedIdsChange([]);
|
|
10604
11692
|
},
|
|
10605
11693
|
children: [
|
|
10606
|
-
/* @__PURE__ */ (0,
|
|
11694
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
10607
11695
|
"Clear"
|
|
10608
11696
|
]
|
|
10609
11697
|
}
|
|
10610
11698
|
),
|
|
10611
|
-
/* @__PURE__ */ (0,
|
|
10612
|
-
effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0,
|
|
11699
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
|
|
11700
|
+
effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10613
11701
|
CopyButtons,
|
|
10614
11702
|
{
|
|
10615
11703
|
size: "icon",
|
|
@@ -10642,9 +11730,9 @@ function MatrxDataTableCore({
|
|
|
10642
11730
|
selection.actions?.(selectedRows, selection.selectedIds)
|
|
10643
11731
|
] })
|
|
10644
11732
|
] }) : null,
|
|
10645
|
-
/* @__PURE__ */ (0,
|
|
10646
|
-
/* @__PURE__ */ (0,
|
|
10647
|
-
mobileCards ? /* @__PURE__ */ (0,
|
|
11733
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-matrx-table-body-region": true, className: "flex min-h-0 flex-1 flex-col gap-2", children: [
|
|
11734
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
|
|
11735
|
+
mobileCards ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10648
11736
|
"div",
|
|
10649
11737
|
{
|
|
10650
11738
|
ref: cardsScrollRef,
|
|
@@ -10656,34 +11744,34 @@ function MatrxDataTableCore({
|
|
|
10656
11744
|
mobileCardsClass
|
|
10657
11745
|
),
|
|
10658
11746
|
children: [
|
|
10659
|
-
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0,
|
|
11747
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10660
11748
|
"div",
|
|
10661
11749
|
{
|
|
10662
11750
|
role: "status",
|
|
10663
11751
|
className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden bg-primary/15",
|
|
10664
11752
|
children: [
|
|
10665
|
-
/* @__PURE__ */ (0,
|
|
10666
|
-
/* @__PURE__ */ (0,
|
|
11753
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
11754
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
10667
11755
|
]
|
|
10668
11756
|
}
|
|
10669
11757
|
) : null,
|
|
10670
|
-
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0,
|
|
11758
|
+
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10671
11759
|
Skeleton,
|
|
10672
11760
|
{
|
|
10673
11761
|
className: "h-52 w-full shrink-0 rounded-lg"
|
|
10674
11762
|
},
|
|
10675
11763
|
`mobile-card-sk-${index}`
|
|
10676
|
-
)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
11764
|
+
)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
|
|
10677
11765
|
renderedEmptyState?.icon,
|
|
10678
|
-
/* @__PURE__ */ (0,
|
|
10679
|
-
renderedEmptyState?.description ? /* @__PURE__ */ (0,
|
|
11766
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
|
|
11767
|
+
renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
|
|
10680
11768
|
renderedEmptyState?.action
|
|
10681
11769
|
] }) }) : paginated.map((row, index) => {
|
|
10682
11770
|
const id = getRowId(row);
|
|
10683
11771
|
const displayRow = applyRowEdits(row, edits[id]);
|
|
10684
11772
|
const controls = buildRecordControls(displayRow);
|
|
10685
11773
|
const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
|
|
10686
|
-
return /* @__PURE__ */ (0,
|
|
11774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { "data-row-id": id, className: "contents", children: mobileCards(displayRow, index, {
|
|
10687
11775
|
renderCell: (columnKey) => {
|
|
10688
11776
|
const column = columns.find((candidate) => columnId(candidate) === columnKey);
|
|
10689
11777
|
return column ? renderRecordCell(row, column, index) : null;
|
|
@@ -10699,14 +11787,14 @@ function MatrxDataTableCore({
|
|
|
10699
11787
|
else next.delete(id);
|
|
10700
11788
|
setSelectedIds(next);
|
|
10701
11789
|
},
|
|
10702
|
-
actions: showInlineRowCopy || rowActions ? /* @__PURE__ */ (0,
|
|
11790
|
+
actions: showInlineRowCopy || rowActions ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10703
11791
|
"div",
|
|
10704
11792
|
{
|
|
10705
11793
|
"data-matrx-table-row-actions": true,
|
|
10706
11794
|
className: "inline-flex items-center justify-end gap-0",
|
|
10707
11795
|
onClick: (event) => event.stopPropagation(),
|
|
10708
11796
|
children: [
|
|
10709
|
-
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
11797
|
+
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10710
11798
|
TableRowCopyControl,
|
|
10711
11799
|
{
|
|
10712
11800
|
size: "toolbar",
|
|
@@ -10727,7 +11815,7 @@ function MatrxDataTableCore({
|
|
|
10727
11815
|
expandedDetail: expandedDetail && isRowExpanded(row) ? expandedDetail.render(displayRow, controls) : null
|
|
10728
11816
|
}) }, id);
|
|
10729
11817
|
}),
|
|
10730
|
-
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
11818
|
+
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10731
11819
|
"div",
|
|
10732
11820
|
{
|
|
10733
11821
|
"data-matrx-table-append-loading-card": true,
|
|
@@ -10735,7 +11823,7 @@ function MatrxDataTableCore({
|
|
|
10735
11823
|
"aria-live": "polite",
|
|
10736
11824
|
className: "sticky bottom-0 z-20 flex h-16 w-full max-w-[100cqw] shrink-0 items-center justify-center gap-2 rounded-md border border-border bg-card/95 px-3 text-sm font-medium text-foreground shadow-sm backdrop-blur-sm",
|
|
10737
11825
|
children: [
|
|
10738
|
-
/* @__PURE__ */ (0,
|
|
11826
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10739
11827
|
Loader2,
|
|
10740
11828
|
{
|
|
10741
11829
|
"aria-hidden": "true",
|
|
@@ -10749,7 +11837,7 @@ function MatrxDataTableCore({
|
|
|
10749
11837
|
]
|
|
10750
11838
|
}
|
|
10751
11839
|
) : null,
|
|
10752
|
-
/* @__PURE__ */ (0,
|
|
11840
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10753
11841
|
"div",
|
|
10754
11842
|
{
|
|
10755
11843
|
ref: scrollRef,
|
|
@@ -10763,32 +11851,32 @@ function MatrxDataTableCore({
|
|
|
10763
11851
|
tableClassName
|
|
10764
11852
|
),
|
|
10765
11853
|
children: [
|
|
10766
|
-
hierarchy && draggedRow ? /* @__PURE__ */ (0,
|
|
11854
|
+
hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10767
11855
|
HierarchyRootDropTarget,
|
|
10768
11856
|
{
|
|
10769
11857
|
label: hierarchy.rootDropLabel ?? "Drop here to move to the top level",
|
|
10770
11858
|
draggedLabel: hierarchy.itemLabel?.(draggedRow) ?? "Moving row"
|
|
10771
11859
|
}
|
|
10772
11860
|
) : null,
|
|
10773
|
-
hierarchy && draggedRowId ? /* @__PURE__ */ (0,
|
|
11861
|
+
hierarchy && draggedRowId ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10774
11862
|
HierarchyDragIndicatorLayer,
|
|
10775
11863
|
{
|
|
10776
11864
|
scrollRef,
|
|
10777
11865
|
resolve: resolveHierarchyMove
|
|
10778
11866
|
}
|
|
10779
11867
|
) : null,
|
|
10780
|
-
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0,
|
|
11868
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10781
11869
|
"div",
|
|
10782
11870
|
{
|
|
10783
11871
|
role: "status",
|
|
10784
11872
|
className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden bg-primary/15",
|
|
10785
11873
|
children: [
|
|
10786
|
-
/* @__PURE__ */ (0,
|
|
10787
|
-
/* @__PURE__ */ (0,
|
|
11874
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
11875
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
10788
11876
|
]
|
|
10789
11877
|
}
|
|
10790
11878
|
) : null,
|
|
10791
|
-
/* @__PURE__ */ (0,
|
|
11879
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10792
11880
|
"table",
|
|
10793
11881
|
{
|
|
10794
11882
|
ref: tableRef,
|
|
@@ -10806,7 +11894,7 @@ function MatrxDataTableCore({
|
|
|
10806
11894
|
fixedLayoutActive && "sm:table-fixed sm:max-w-none sm:w-[var(--matrx-resized-table-width)]"
|
|
10807
11895
|
),
|
|
10808
11896
|
children: [
|
|
10809
|
-
/* @__PURE__ */ (0,
|
|
11897
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10810
11898
|
"thead",
|
|
10811
11899
|
{
|
|
10812
11900
|
ref: tableHeaderRef,
|
|
@@ -10815,14 +11903,14 @@ function MatrxDataTableCore({
|
|
|
10815
11903
|
"z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm",
|
|
10816
11904
|
stickyHeader && (documentStickyHeader ? "relative translate-y-[var(--matrx-document-sticky-offset)]" : "sticky top-0")
|
|
10817
11905
|
),
|
|
10818
|
-
children: /* @__PURE__ */ (0,
|
|
10819
|
-
selection ? /* @__PURE__ */ (0,
|
|
11906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { children: [
|
|
11907
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10820
11908
|
"th",
|
|
10821
11909
|
{
|
|
10822
11910
|
"data-matrx-table-selection-column": true,
|
|
10823
11911
|
className: "h-9 w-9 px-2 text-left align-middle",
|
|
10824
11912
|
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
10825
|
-
children: /* @__PURE__ */ (0,
|
|
11913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10826
11914
|
"div",
|
|
10827
11915
|
{
|
|
10828
11916
|
"data-matrx-table-selection-target": true,
|
|
@@ -10831,7 +11919,7 @@ function MatrxDataTableCore({
|
|
|
10831
11919
|
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
10832
11920
|
}
|
|
10833
11921
|
},
|
|
10834
|
-
children: /* @__PURE__ */ (0,
|
|
11922
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10835
11923
|
Checkbox,
|
|
10836
11924
|
{
|
|
10837
11925
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -10857,7 +11945,7 @@ function MatrxDataTableCore({
|
|
|
10857
11945
|
const compact = col.compact || marker !== void 0;
|
|
10858
11946
|
const width = marker && col.width === void 0 ? 40 : col.width;
|
|
10859
11947
|
const minWidth = marker && col.minWidth === void 0 ? 40 : col.minWidth;
|
|
10860
|
-
return /* @__PURE__ */ (0,
|
|
11948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10861
11949
|
"th",
|
|
10862
11950
|
{
|
|
10863
11951
|
"data-matrx-table-column-id": id,
|
|
@@ -10882,12 +11970,17 @@ function MatrxDataTableCore({
|
|
|
10882
11970
|
(width !== void 0 || columnResizable) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)]",
|
|
10883
11971
|
col.headerClassName,
|
|
10884
11972
|
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
10885
|
-
col
|
|
10886
|
-
col
|
|
11973
|
+
alignForFormat(col) === "center" && "text-center",
|
|
11974
|
+
alignForFormat(col) === "right" && "text-right",
|
|
11975
|
+
frozenColumns.offsets[id] !== void 0 && FROZEN_HEADER_CLASS,
|
|
11976
|
+
frozenEdgeId === id && FROZEN_EDGE_CLASS
|
|
10887
11977
|
),
|
|
10888
|
-
style:
|
|
11978
|
+
style: {
|
|
11979
|
+
...columnWidthVar(width, effectiveColumnWidths[id], id, columnResizable),
|
|
11980
|
+
...frozenStyle(id)
|
|
11981
|
+
},
|
|
10889
11982
|
children: [
|
|
10890
|
-
/* @__PURE__ */ (0,
|
|
11983
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10891
11984
|
ColumnHeaderCell,
|
|
10892
11985
|
{
|
|
10893
11986
|
label: col.header,
|
|
@@ -10926,7 +12019,7 @@ function MatrxDataTableCore({
|
|
|
10926
12019
|
reorderColumn: reorderableColumns ? { id, label: headerLabel } : void 0
|
|
10927
12020
|
}
|
|
10928
12021
|
) }),
|
|
10929
|
-
columnResizable ? /* @__PURE__ */ (0,
|
|
12022
|
+
columnResizable ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10930
12023
|
ColumnResizeHandle,
|
|
10931
12024
|
{
|
|
10932
12025
|
columnId: id,
|
|
@@ -10947,22 +12040,22 @@ function MatrxDataTableCore({
|
|
|
10947
12040
|
id
|
|
10948
12041
|
);
|
|
10949
12042
|
}),
|
|
10950
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
12043
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10951
12044
|
"th",
|
|
10952
12045
|
{
|
|
10953
12046
|
"data-matrx-table-actions-column": true,
|
|
10954
12047
|
className: "h-9 w-px whitespace-nowrap px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
10955
12048
|
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
10956
|
-
children: /* @__PURE__ */ (0,
|
|
12049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-actions-label": true, className: "inline-block whitespace-nowrap", children: "Actions" })
|
|
10957
12050
|
}
|
|
10958
12051
|
)
|
|
10959
12052
|
] })
|
|
10960
12053
|
}
|
|
10961
12054
|
),
|
|
10962
|
-
/* @__PURE__ */ (0,
|
|
10963
|
-
isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0,
|
|
10964
|
-
selection ? /* @__PURE__ */ (0,
|
|
10965
|
-
visibleColumns.map((col) => /* @__PURE__ */ (0,
|
|
12055
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tbody", { children: [
|
|
12056
|
+
isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { className: "border-b border-border/60", children: [
|
|
12057
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "px-2 py-2", style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
|
|
12058
|
+
visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10966
12059
|
"td",
|
|
10967
12060
|
{
|
|
10968
12061
|
className: cn(
|
|
@@ -10970,20 +12063,20 @@ function MatrxDataTableCore({
|
|
|
10970
12063
|
col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
|
|
10971
12064
|
col.mobileHidden && "max-sm:hidden"
|
|
10972
12065
|
),
|
|
10973
|
-
children: /* @__PURE__ */ (0,
|
|
12066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "h-5 w-full" })
|
|
10974
12067
|
},
|
|
10975
12068
|
columnId(col)
|
|
10976
12069
|
)),
|
|
10977
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
10978
|
-
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
12070
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "text-right align-middle", style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "ml-auto h-5 w-10" }) })
|
|
12071
|
+
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10979
12072
|
"td",
|
|
10980
12073
|
{
|
|
10981
12074
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
10982
12075
|
className: "px-0 py-12 text-center",
|
|
10983
|
-
children: /* @__PURE__ */ (0,
|
|
12076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-matrx-table-empty-state": true, className: "sticky left-0 flex flex-col items-center gap-2 whitespace-normal px-4", style: { width: "100cqw", maxWidth: "100%" }, children: [
|
|
10984
12077
|
renderedEmptyState?.icon,
|
|
10985
|
-
/* @__PURE__ */ (0,
|
|
10986
|
-
renderedEmptyState?.description ? /* @__PURE__ */ (0,
|
|
12078
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
|
|
12079
|
+
renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
|
|
10987
12080
|
renderedEmptyState?.action
|
|
10988
12081
|
] })
|
|
10989
12082
|
}
|
|
@@ -10994,7 +12087,7 @@ function MatrxDataTableCore({
|
|
|
10994
12087
|
const displayRow = applyRowEdits(row, rowEdits);
|
|
10995
12088
|
const controls = buildRecordControls(displayRow);
|
|
10996
12089
|
const isChecked = selectedIdSet.has(id);
|
|
10997
|
-
const rowNode = /* @__PURE__ */ (0,
|
|
12090
|
+
const rowNode = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10998
12091
|
"tr",
|
|
10999
12092
|
{
|
|
11000
12093
|
"data-row-id": id,
|
|
@@ -11027,16 +12120,28 @@ function MatrxDataTableCore({
|
|
|
11027
12120
|
highlightedIndex === index && "bg-muted ring-1 ring-inset ring-primary/60",
|
|
11028
12121
|
rowClassName?.(row, index),
|
|
11029
12122
|
draggedRowId === id && "opacity-40",
|
|
11030
|
-
zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20"
|
|
12123
|
+
zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20",
|
|
12124
|
+
// LAST so a colored row STAYS colored while selected
|
|
12125
|
+
// and on an odd zebra stripe — `cn` is tailwind-merge
|
|
12126
|
+
// and keeps the last background of a group. The
|
|
12127
|
+
// checkbox already says the row is selected; the tint
|
|
12128
|
+
// is the only thing saying WHY the row matters.
|
|
12129
|
+
rowTintClass(row, id)
|
|
11031
12130
|
),
|
|
11032
12131
|
children: [
|
|
11033
|
-
selection ? /* @__PURE__ */ (0,
|
|
12132
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11034
12133
|
"td",
|
|
11035
12134
|
{
|
|
11036
|
-
className:
|
|
12135
|
+
className: cn(
|
|
12136
|
+
"px-2 py-1.5 align-middle lg:py-0.5",
|
|
12137
|
+
// When a data column is frozen the checkbox
|
|
12138
|
+
// column has to freeze with it, or the first
|
|
12139
|
+
// frozen column slides over the checkboxes.
|
|
12140
|
+
frozenColumns.selectionOffset !== null && "sm:sticky sm:left-0 sm:z-20 sm:bg-inherit"
|
|
12141
|
+
),
|
|
11037
12142
|
style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
|
|
11038
12143
|
onClick: (e) => e.stopPropagation(),
|
|
11039
|
-
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0,
|
|
12144
|
+
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11040
12145
|
"div",
|
|
11041
12146
|
{
|
|
11042
12147
|
"data-matrx-table-selection-target": true,
|
|
@@ -11045,7 +12150,7 @@ function MatrxDataTableCore({
|
|
|
11045
12150
|
event.currentTarget.querySelector('[role="checkbox"]')?.click();
|
|
11046
12151
|
}
|
|
11047
12152
|
},
|
|
11048
|
-
children: /* @__PURE__ */ (0,
|
|
12153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11049
12154
|
Checkbox,
|
|
11050
12155
|
{
|
|
11051
12156
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -11060,7 +12165,7 @@ function MatrxDataTableCore({
|
|
|
11060
12165
|
) : null,
|
|
11061
12166
|
visibleColumns.map((col, colIdx) => {
|
|
11062
12167
|
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
11063
|
-
return /* @__PURE__ */ (0,
|
|
12168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11064
12169
|
"td",
|
|
11065
12170
|
{
|
|
11066
12171
|
"data-matrx-table-column-id": columnId(col),
|
|
@@ -11075,23 +12180,33 @@ function MatrxDataTableCore({
|
|
|
11075
12180
|
((resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width) !== void 0 || resizableColumns && col.resizable !== false) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
|
|
11076
12181
|
col.className,
|
|
11077
12182
|
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
11078
|
-
col
|
|
11079
|
-
col
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
12183
|
+
alignForFormat(col) === "center" && "text-center",
|
|
12184
|
+
alignForFormat(col) === "right" && "text-right",
|
|
12185
|
+
frozenColumns.offsets[columnId(col)] !== void 0 && FROZEN_CELL_CLASS,
|
|
12186
|
+
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
12187
|
+
// A cell tint paints OVER the row tint beneath
|
|
12188
|
+
// it, and the consumer's own hook comes last so
|
|
12189
|
+
// it can always win.
|
|
12190
|
+
cellTintClass(row, id, columnId(col)),
|
|
12191
|
+
cellClassName?.(row, columnId(col), index)
|
|
11086
12192
|
),
|
|
11087
|
-
|
|
12193
|
+
style: {
|
|
12194
|
+
...columnWidthVar(
|
|
12195
|
+
resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
|
|
12196
|
+
effectiveColumnWidths[columnId(col)],
|
|
12197
|
+
columnId(col),
|
|
12198
|
+
resizableColumns && col.resizable !== false
|
|
12199
|
+
),
|
|
12200
|
+
...frozenStyle(columnId(col))
|
|
12201
|
+
},
|
|
12202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11088
12203
|
"div",
|
|
11089
12204
|
{
|
|
11090
12205
|
className: cn(
|
|
11091
12206
|
colIdx === 0 && hierarchy && "flex min-w-0 items-center"
|
|
11092
12207
|
),
|
|
11093
12208
|
children: [
|
|
11094
|
-
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0,
|
|
12209
|
+
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11095
12210
|
HierarchyDragHandle,
|
|
11096
12211
|
{
|
|
11097
12212
|
id,
|
|
@@ -11099,7 +12214,7 @@ function MatrxDataTableCore({
|
|
|
11099
12214
|
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
11100
12215
|
}
|
|
11101
12216
|
) : null,
|
|
11102
|
-
/* @__PURE__ */ (0,
|
|
12217
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11103
12218
|
"div",
|
|
11104
12219
|
{
|
|
11105
12220
|
"data-matrx-cell-content": true,
|
|
@@ -11114,20 +12229,20 @@ function MatrxDataTableCore({
|
|
|
11114
12229
|
columnId(col)
|
|
11115
12230
|
);
|
|
11116
12231
|
}),
|
|
11117
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
12232
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11118
12233
|
"td",
|
|
11119
12234
|
{
|
|
11120
12235
|
"data-matrx-table-row-action-cell": true,
|
|
11121
12236
|
className: "text-right align-middle",
|
|
11122
12237
|
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
11123
|
-
children: /* @__PURE__ */ (0,
|
|
12238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11124
12239
|
"div",
|
|
11125
12240
|
{
|
|
11126
12241
|
"data-matrx-table-row-actions": true,
|
|
11127
12242
|
className: "inline-flex items-center justify-end gap-0",
|
|
11128
12243
|
onClick: (e) => e.stopPropagation(),
|
|
11129
12244
|
children: [
|
|
11130
|
-
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
12245
|
+
showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11131
12246
|
TableRowCopyControl,
|
|
11132
12247
|
{
|
|
11133
12248
|
size: "toolbar",
|
|
@@ -11138,8 +12253,8 @@ function MatrxDataTableCore({
|
|
|
11138
12253
|
}
|
|
11139
12254
|
) : null,
|
|
11140
12255
|
renderRowActions(displayRow, controls),
|
|
11141
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
11142
|
-
/* @__PURE__ */ (0,
|
|
12256
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12257
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11143
12258
|
Button,
|
|
11144
12259
|
{
|
|
11145
12260
|
type: "button",
|
|
@@ -11153,10 +12268,10 @@ function MatrxDataTableCore({
|
|
|
11153
12268
|
if (windowConfig?.openOnRowClick === true) openDetail(row);
|
|
11154
12269
|
else openWindow(row);
|
|
11155
12270
|
},
|
|
11156
|
-
children: opensWindowOnRowClick ? /* @__PURE__ */ (0,
|
|
12271
|
+
children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRight, { className: "h-5 w-5" })
|
|
11157
12272
|
}
|
|
11158
12273
|
) }),
|
|
11159
|
-
/* @__PURE__ */ (0,
|
|
12274
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
|
|
11160
12275
|
] }) : null
|
|
11161
12276
|
]
|
|
11162
12277
|
}
|
|
@@ -11168,12 +12283,12 @@ function MatrxDataTableCore({
|
|
|
11168
12283
|
id
|
|
11169
12284
|
);
|
|
11170
12285
|
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
11171
|
-
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0,
|
|
12286
|
+
const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11172
12287
|
"tr",
|
|
11173
12288
|
{
|
|
11174
12289
|
"data-matrx-table-expanded-detail": id,
|
|
11175
12290
|
className: cn("bg-muted/20", expandedDetail.className),
|
|
11176
|
-
children: /* @__PURE__ */ (0,
|
|
12291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11177
12292
|
"td",
|
|
11178
12293
|
{
|
|
11179
12294
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
@@ -11184,8 +12299,8 @@ function MatrxDataTableCore({
|
|
|
11184
12299
|
},
|
|
11185
12300
|
`${id}:expanded-detail`
|
|
11186
12301
|
) : null;
|
|
11187
|
-
return hierarchy ? /* @__PURE__ */ (0,
|
|
11188
|
-
/* @__PURE__ */ (0,
|
|
12302
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react20.Fragment, { children: [
|
|
12303
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11189
12304
|
HierarchyDroppableRow,
|
|
11190
12305
|
{
|
|
11191
12306
|
id,
|
|
@@ -11194,24 +12309,24 @@ function MatrxDataTableCore({
|
|
|
11194
12309
|
}
|
|
11195
12310
|
),
|
|
11196
12311
|
inlineDetail
|
|
11197
|
-
] }, id) : /* @__PURE__ */ (0,
|
|
12312
|
+
] }, id) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react20.Fragment, { children: [
|
|
11198
12313
|
wrappedRow,
|
|
11199
12314
|
inlineDetail
|
|
11200
12315
|
] }, id);
|
|
11201
12316
|
}),
|
|
11202
|
-
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
12317
|
+
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11203
12318
|
"td",
|
|
11204
12319
|
{
|
|
11205
12320
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
11206
12321
|
className: "sticky bottom-0 z-20 h-16 border-y border-border bg-card/95 px-0 py-0 text-left shadow-sm backdrop-blur-sm",
|
|
11207
|
-
children: /* @__PURE__ */ (0,
|
|
12322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11208
12323
|
"div",
|
|
11209
12324
|
{
|
|
11210
12325
|
role: "status",
|
|
11211
12326
|
"aria-live": "polite",
|
|
11212
12327
|
className: "sticky left-0 flex h-16 w-fit max-w-[100cqw] items-center justify-center gap-2 px-3 text-sm font-medium text-foreground",
|
|
11213
12328
|
children: [
|
|
11214
|
-
/* @__PURE__ */ (0,
|
|
12329
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11215
12330
|
Loader2,
|
|
11216
12331
|
{
|
|
11217
12332
|
"aria-hidden": "true",
|
|
@@ -11225,9 +12340,9 @@ function MatrxDataTableCore({
|
|
|
11225
12340
|
}
|
|
11226
12341
|
) }) : null
|
|
11227
12342
|
] }),
|
|
11228
|
-
footerRows.length > 0 ? /* @__PURE__ */ (0,
|
|
11229
|
-
selection ? /* @__PURE__ */ (0,
|
|
11230
|
-
visibleColumns.map((column) => /* @__PURE__ */ (0,
|
|
12343
|
+
footerRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { children: [
|
|
12344
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "px-2 py-2" }) : null,
|
|
12345
|
+
visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11231
12346
|
"td",
|
|
11232
12347
|
{
|
|
11233
12348
|
className: cn(
|
|
@@ -11247,7 +12362,7 @@ function MatrxDataTableCore({
|
|
|
11247
12362
|
},
|
|
11248
12363
|
columnId(column)
|
|
11249
12364
|
)),
|
|
11250
|
-
showActionsCol ? /* @__PURE__ */ (0,
|
|
12365
|
+
showActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", {}) : null
|
|
11251
12366
|
] }, `footer-${index}`)) }) : null
|
|
11252
12367
|
]
|
|
11253
12368
|
}
|
|
@@ -11255,8 +12370,8 @@ function MatrxDataTableCore({
|
|
|
11255
12370
|
]
|
|
11256
12371
|
}
|
|
11257
12372
|
),
|
|
11258
|
-
scrollHintLeft ? /* @__PURE__ */ (0,
|
|
11259
|
-
/* @__PURE__ */ (0,
|
|
12373
|
+
scrollHintLeft ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12374
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11260
12375
|
Button,
|
|
11261
12376
|
{
|
|
11262
12377
|
type: "button",
|
|
@@ -11267,13 +12382,13 @@ function MatrxDataTableCore({
|
|
|
11267
12382
|
"data-matrx-table-scroll-control": "left",
|
|
11268
12383
|
className: "absolute left-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
11269
12384
|
onClick: () => scrollTableHorizontally("left"),
|
|
11270
|
-
children: /* @__PURE__ */ (0,
|
|
12385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronLeft, { className: "h-5 w-5" })
|
|
11271
12386
|
}
|
|
11272
12387
|
) }),
|
|
11273
|
-
/* @__PURE__ */ (0,
|
|
12388
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "More columns to the left" })
|
|
11274
12389
|
] }) : null,
|
|
11275
|
-
scrollHintRight ? /* @__PURE__ */ (0,
|
|
11276
|
-
/* @__PURE__ */ (0,
|
|
12390
|
+
scrollHintRight ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12391
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11277
12392
|
Button,
|
|
11278
12393
|
{
|
|
11279
12394
|
type: "button",
|
|
@@ -11284,26 +12399,26 @@ function MatrxDataTableCore({
|
|
|
11284
12399
|
"data-matrx-table-scroll-control": "right",
|
|
11285
12400
|
className: "absolute right-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
11286
12401
|
onClick: () => scrollTableHorizontally("right"),
|
|
11287
|
-
children: /* @__PURE__ */ (0,
|
|
12402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronRight, { className: "h-5 w-5" })
|
|
11288
12403
|
}
|
|
11289
12404
|
) }),
|
|
11290
|
-
/* @__PURE__ */ (0,
|
|
12405
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "More columns to the right" })
|
|
11291
12406
|
] }) : null
|
|
11292
12407
|
] }),
|
|
11293
|
-
appendQuery ? /* @__PURE__ */ (0,
|
|
12408
|
+
appendQuery ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11294
12409
|
"div",
|
|
11295
12410
|
{
|
|
11296
12411
|
"data-matrx-table-footer": true,
|
|
11297
|
-
className: "flex min-h-
|
|
12412
|
+
className: "flex min-h-8 shrink-0 flex-wrap items-center gap-2 border-t border-border",
|
|
11298
12413
|
"aria-busy": isLoading || isFetching,
|
|
11299
12414
|
children: [
|
|
11300
|
-
/* @__PURE__ */ (0,
|
|
12415
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11301
12416
|
"div",
|
|
11302
12417
|
{
|
|
11303
12418
|
...isFetching && !isLoading ? {} : { role: "status", "aria-live": "polite" },
|
|
11304
|
-
className: "flex w-full min-w-0 items-center gap-2 text-xs text-muted-foreground sm:w-auto sm:flex-1
|
|
12419
|
+
className: "flex w-full min-w-0 items-center gap-2 text-xs text-muted-foreground sm:w-auto sm:flex-1",
|
|
11305
12420
|
children: [
|
|
11306
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
12421
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11307
12422
|
Loader2,
|
|
11308
12423
|
{
|
|
11309
12424
|
"data-matrx-table-append-loader": true,
|
|
@@ -11311,17 +12426,21 @@ function MatrxDataTableCore({
|
|
|
11311
12426
|
className: "h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none"
|
|
11312
12427
|
}
|
|
11313
12428
|
) : null,
|
|
11314
|
-
/* @__PURE__ */ (0,
|
|
11315
|
-
/* @__PURE__ */ (0,
|
|
11316
|
-
appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0,
|
|
11317
|
-
"Source
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
12429
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2", children: [
|
|
12430
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "min-w-0 break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : appendQuery.pagination.sourceRecords ? `${(0, import_format5.formatCount)(processed.length)} ${appendQuery.pagination.sourceRecords.rowLabel}${appendQuery.pagination.sourceRecords.matchedRecords === void 0 ? "" : ` (${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.matchedRecords)} matching ${appendQuery.pagination.sourceRecords.label})`} \xB7 ${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.loaded)}${appendQuery.pagination.sourceRecords.total === void 0 ? "" : ` / ${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.total)}`} ${appendQuery.pagination.sourceRecords.label} loaded` : `${(0, import_format5.formatCount)(data.length)} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${(0, import_format5.formatCount)(appendQuery.pagination.totalItems)}`}` }),
|
|
12431
|
+
appendQuery.pagination.sourceUntil || appendUsesLocalProcessing ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12432
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-label": "Source coverage", className: "shrink-0 text-xs text-muted-foreground underline decoration-dotted underline-offset-4", children: "Source info" }) }),
|
|
12433
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(TooltipContent, { children: [
|
|
12434
|
+
appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { children: [
|
|
12435
|
+
"Source fixed through ",
|
|
12436
|
+
new Date(appendQuery.pagination.sourceUntil).toLocaleString(),
|
|
12437
|
+
"."
|
|
12438
|
+
] }) : null,
|
|
12439
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: !isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? "All source rows are loaded." : appendUsesLocalProcessing ? "Local search and filters cover loaded rows." : "Source paging is active." })
|
|
12440
|
+
] })
|
|
11321
12441
|
] }) : null,
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
appendScrollPolicy?.mode === "suspended" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { role: "status", children: [
|
|
12442
|
+
scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-destructive", children: scrollPagination.error.message }) : null,
|
|
12443
|
+
appendScrollPolicy?.mode === "suspended" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { role: "status", children: [
|
|
11325
12444
|
appendScrollPolicy.reason,
|
|
11326
12445
|
" Load more remains available."
|
|
11327
12446
|
] }) : null
|
|
@@ -11329,73 +12448,74 @@ function MatrxDataTableCore({
|
|
|
11329
12448
|
]
|
|
11330
12449
|
}
|
|
11331
12450
|
),
|
|
11332
|
-
appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0,
|
|
12451
|
+
appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11333
12452
|
Select,
|
|
11334
12453
|
{
|
|
11335
12454
|
value: String(appendQuery.pagination.sourcePageSize.value),
|
|
11336
12455
|
onValueChange: (value) => appendQuery.pagination.sourcePageSize?.onChange(Number(value)),
|
|
11337
12456
|
children: [
|
|
11338
|
-
/* @__PURE__ */ (0,
|
|
12457
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11339
12458
|
SelectTrigger,
|
|
11340
12459
|
{
|
|
11341
12460
|
"aria-label": "Rows per load",
|
|
11342
|
-
className: "h-
|
|
12461
|
+
className: "h-8 min-w-20 shrink-0 rounded-md border border-border bg-card px-3 text-sm [&_svg]:size-5",
|
|
11343
12462
|
disabled: isLoading || isFetching || appendQuery.pagination.loadAll?.isLoading,
|
|
11344
|
-
children: /* @__PURE__ */ (0,
|
|
12463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectValue, {})
|
|
11345
12464
|
}
|
|
11346
12465
|
),
|
|
11347
|
-
/* @__PURE__ */ (0,
|
|
12466
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectItem, { value: String(size), children: size }, size)) })
|
|
11348
12467
|
]
|
|
11349
12468
|
}
|
|
11350
12469
|
) : null,
|
|
11351
|
-
appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0,
|
|
12470
|
+
appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11352
12471
|
Button,
|
|
11353
12472
|
{
|
|
11354
12473
|
type: "button",
|
|
11355
12474
|
variant: "outline",
|
|
11356
|
-
className: "h-
|
|
12475
|
+
className: "h-8 shrink-0 px-3 text-sm",
|
|
11357
12476
|
onClick: appendQuery.pagination.loadAll.stop,
|
|
11358
12477
|
children: "Stop loading"
|
|
11359
12478
|
}
|
|
11360
|
-
) : scrollPagination.error ? /* @__PURE__ */ (0,
|
|
12479
|
+
) : scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11361
12480
|
Button,
|
|
11362
12481
|
{
|
|
11363
12482
|
type: "button",
|
|
11364
12483
|
variant: "outline",
|
|
11365
|
-
className: "h-
|
|
12484
|
+
className: "h-8 shrink-0 px-3 text-sm",
|
|
11366
12485
|
onClick: appendQuery.pagination.retrySource ?? (appendQuery.pagination.hasNextPage ? appendQuery.pagination.loadNextPage : appendQuery.pagination.refresh),
|
|
11367
12486
|
children: appendQuery.pagination.retrySource ? "Retry source" : appendQuery.pagination.hasNextPage ? "Retry" : "Reload rows"
|
|
11368
12487
|
}
|
|
11369
|
-
) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0,
|
|
11370
|
-
/* @__PURE__ */ (0,
|
|
12488
|
+
) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 max-w-full flex-wrap gap-0", children: [
|
|
12489
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11371
12490
|
Button,
|
|
11372
12491
|
{
|
|
11373
12492
|
type: "button",
|
|
11374
12493
|
variant: "outline",
|
|
11375
|
-
className: "h-
|
|
12494
|
+
className: "h-8 px-3 text-sm",
|
|
11376
12495
|
disabled: isLoading || isFetching,
|
|
11377
12496
|
onClick: () => void scrollPagination.requestNextPage(),
|
|
11378
12497
|
children: "Load more"
|
|
11379
12498
|
}
|
|
11380
12499
|
),
|
|
11381
|
-
appendQuery.pagination.loadAll ? /* @__PURE__ */ (0,
|
|
12500
|
+
appendQuery.pagination.loadAll ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11382
12501
|
Button,
|
|
11383
12502
|
{
|
|
11384
12503
|
type: "button",
|
|
11385
12504
|
variant: "ghost",
|
|
11386
|
-
className: "h-
|
|
12505
|
+
className: "h-8 px-3 text-sm",
|
|
11387
12506
|
disabled: isLoading || isFetching,
|
|
11388
12507
|
onClick: appendQuery.pagination.loadAll.request,
|
|
11389
12508
|
children: "Load all"
|
|
11390
12509
|
}
|
|
11391
12510
|
) : null
|
|
11392
|
-
] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0,
|
|
12511
|
+
] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "min-w-0 max-w-full break-words whitespace-normal px-3 text-xs text-muted-foreground sm:text-sm", children: "All rows loaded" }) : null
|
|
11393
12512
|
]
|
|
11394
12513
|
}
|
|
11395
|
-
) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ (0,
|
|
12514
|
+
) : !hidePagination && (totalItems > 0 || sourceTotal !== void 0) ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11396
12515
|
GenericTablePagination,
|
|
11397
12516
|
{
|
|
11398
12517
|
totalItems,
|
|
12518
|
+
...sourceTotal === void 0 ? {} : { labelFormat: (start, end, total) => `${(0, import_format5.formatCount)(start)}\u2013${(0, import_format5.formatCount)(end)} of ${(0, import_format5.formatCount)(total)} matching \xB7 ${(0, import_format5.formatCount)(data.length)} / ${(0, import_format5.formatCount)(sourceTotal)} loaded` },
|
|
11399
12519
|
...localProgressiveEnabled ? { progressive: {
|
|
11400
12520
|
shownCount: progressiveRows.shownCount,
|
|
11401
12521
|
loadedCount: data.length,
|
|
@@ -11418,7 +12538,7 @@ function MatrxDataTableCore({
|
|
|
11418
12538
|
}
|
|
11419
12539
|
) }) : null
|
|
11420
12540
|
] }),
|
|
11421
|
-
/* @__PURE__ */ (0,
|
|
12541
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11422
12542
|
ColumnManager,
|
|
11423
12543
|
{
|
|
11424
12544
|
open: columnManagerOpen,
|
|
@@ -11429,7 +12549,7 @@ function MatrxDataTableCore({
|
|
|
11429
12549
|
onApply: commitColumnState
|
|
11430
12550
|
}
|
|
11431
12551
|
),
|
|
11432
|
-
detailEnabled && selectedRow ? /* @__PURE__ */ (0,
|
|
12552
|
+
detailEnabled && selectedRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11433
12553
|
SidePanelSurface,
|
|
11434
12554
|
{
|
|
11435
12555
|
title: resolveStringTitle(
|
|
@@ -11440,8 +12560,8 @@ function MatrxDataTableCore({
|
|
|
11440
12560
|
description: detail?.description?.(selectedRow),
|
|
11441
12561
|
onClose: () => setSelectedId(null),
|
|
11442
12562
|
defaultWidth: detail?.defaultWidth ?? 480,
|
|
11443
|
-
headerActions: /* @__PURE__ */ (0,
|
|
11444
|
-
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0,
|
|
12563
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12564
|
+
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11445
12565
|
TableRowCopyControl,
|
|
11446
12566
|
{
|
|
11447
12567
|
size: "icon",
|
|
@@ -11453,8 +12573,8 @@ function MatrxDataTableCore({
|
|
|
11453
12573
|
}
|
|
11454
12574
|
) : null,
|
|
11455
12575
|
detail?.headerActions?.(selectedRow),
|
|
11456
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
11457
|
-
/* @__PURE__ */ (0,
|
|
12576
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12577
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11458
12578
|
Button,
|
|
11459
12579
|
{
|
|
11460
12580
|
type: "button",
|
|
@@ -11464,10 +12584,10 @@ function MatrxDataTableCore({
|
|
|
11464
12584
|
className: "h-7 w-7",
|
|
11465
12585
|
"aria-label": "Open in window",
|
|
11466
12586
|
onClick: () => openWindow(selectedRow),
|
|
11467
|
-
children: /* @__PURE__ */ (0,
|
|
12587
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRight, { className: "h-5 w-5" })
|
|
11468
12588
|
}
|
|
11469
12589
|
) }),
|
|
11470
|
-
/* @__PURE__ */ (0,
|
|
12590
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Open in window" })
|
|
11471
12591
|
] }) : null
|
|
11472
12592
|
] }),
|
|
11473
12593
|
children: detail?.render ? (
|
|
@@ -11478,7 +12598,7 @@ function MatrxDataTableCore({
|
|
|
11478
12598
|
// fixes the whole class at once — a custom body that already
|
|
11479
12599
|
// scrolls (`h-full` + `overflow-y-auto` root) still resolves to
|
|
11480
12600
|
// this container's height, so no second scrollbar appears.
|
|
11481
|
-
/* @__PURE__ */ (0,
|
|
12601
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
|
|
11482
12602
|
closeDetail: () => setSelectedId(null),
|
|
11483
12603
|
openDetail: () => openDetail(selectedRow),
|
|
11484
12604
|
openWindow: () => openWindow(selectedRow),
|
|
@@ -11486,7 +12606,7 @@ function MatrxDataTableCore({
|
|
|
11486
12606
|
hasPendingEdits: Boolean(edits[getRowId(selectedRow)]),
|
|
11487
12607
|
discardPendingEdits: () => discardRowEdits(getRowId(selectedRow))
|
|
11488
12608
|
}) })
|
|
11489
|
-
) : /* @__PURE__ */ (0,
|
|
12609
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11490
12610
|
DataRowInspector,
|
|
11491
12611
|
{
|
|
11492
12612
|
row: selectedRow,
|
|
@@ -11498,7 +12618,7 @@ function MatrxDataTableCore({
|
|
|
11498
12618
|
)
|
|
11499
12619
|
}
|
|
11500
12620
|
) : null,
|
|
11501
|
-
windowRow ? /* @__PURE__ */ (0,
|
|
12621
|
+
windowRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11502
12622
|
DataRowWindow,
|
|
11503
12623
|
{
|
|
11504
12624
|
isOpen: true,
|
|
@@ -11509,9 +12629,9 @@ function MatrxDataTableCore({
|
|
|
11509
12629
|
height: windowConfig?.height,
|
|
11510
12630
|
windowId: `matrx-data-row-${urlState?.id ?? "local"}-${getRowId(windowRow)}`,
|
|
11511
12631
|
defaultTab: windowConfig?.defaultTab,
|
|
11512
|
-
headerActions: /* @__PURE__ */ (0,
|
|
11513
|
-
windowConfig?.openOnRowClick === true && detail?.enabled === true ? /* @__PURE__ */ (0,
|
|
11514
|
-
/* @__PURE__ */ (0,
|
|
12632
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12633
|
+
windowConfig?.openOnRowClick === true && detail?.enabled === true ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12634
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11515
12635
|
Button,
|
|
11516
12636
|
{
|
|
11517
12637
|
type: "button",
|
|
@@ -11524,12 +12644,12 @@ function MatrxDataTableCore({
|
|
|
11524
12644
|
closeWindow();
|
|
11525
12645
|
openDetail(windowRow);
|
|
11526
12646
|
},
|
|
11527
|
-
children: /* @__PURE__ */ (0,
|
|
12647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRightOpen, { className: "h-5 w-5" })
|
|
11528
12648
|
}
|
|
11529
12649
|
) }),
|
|
11530
|
-
/* @__PURE__ */ (0,
|
|
12650
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Open in side panel" })
|
|
11531
12651
|
] }) : null,
|
|
11532
|
-
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0,
|
|
12652
|
+
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11533
12653
|
TableRowCopyControl,
|
|
11534
12654
|
{
|
|
11535
12655
|
size: "icon",
|
|
@@ -11548,7 +12668,7 @@ function MatrxDataTableCore({
|
|
|
11548
12668
|
closeWindow,
|
|
11549
12669
|
hasPendingEdits: Boolean(edits[getRowId(windowRow)]),
|
|
11550
12670
|
discardPendingEdits: () => discardRowEdits(getRowId(windowRow))
|
|
11551
|
-
}) ?? /* @__PURE__ */ (0,
|
|
12671
|
+
}) ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11552
12672
|
DataRowInspector,
|
|
11553
12673
|
{
|
|
11554
12674
|
row: windowRow,
|
|
@@ -11584,15 +12704,15 @@ function MatrxDataTableCore({
|
|
|
11584
12704
|
})
|
|
11585
12705
|
}
|
|
11586
12706
|
) : null,
|
|
11587
|
-
editEnabled ? /* @__PURE__ */ (0,
|
|
11588
|
-
foreignDrafts.length > 0 ? /* @__PURE__ */ (0,
|
|
12707
|
+
editEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
12708
|
+
foreignDrafts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11589
12709
|
"div",
|
|
11590
12710
|
{
|
|
11591
12711
|
"data-matrx-foreign-drafts": true,
|
|
11592
12712
|
className: "fixed inset-x-3 bottom-20 z-50 flex flex-wrap items-center justify-center gap-2 rounded-lg border border-amber-500/40 bg-card px-3 py-2 text-xs shadow-lg sm:inset-x-auto sm:left-1/2 sm:-translate-x-1/2 sm:flex-nowrap",
|
|
11593
12713
|
children: [
|
|
11594
|
-
/* @__PURE__ */ (0,
|
|
11595
|
-
/* @__PURE__ */ (0,
|
|
12714
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Unsaved edits from previous results" }),
|
|
12715
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11596
12716
|
CopyButtons,
|
|
11597
12717
|
{
|
|
11598
12718
|
size: "xs",
|
|
@@ -11601,11 +12721,11 @@ function MatrxDataTableCore({
|
|
|
11601
12721
|
json: () => foreignDraftPayload
|
|
11602
12722
|
}
|
|
11603
12723
|
),
|
|
11604
|
-
/* @__PURE__ */ (0,
|
|
12724
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
|
|
11605
12725
|
]
|
|
11606
12726
|
}
|
|
11607
12727
|
) : null,
|
|
11608
|
-
/* @__PURE__ */ (0,
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11609
12729
|
ConfirmDialog,
|
|
11610
12730
|
{
|
|
11611
12731
|
open: confirmForeignDraftDiscard,
|
|
@@ -11625,7 +12745,7 @@ function MatrxDataTableCore({
|
|
|
11625
12745
|
}
|
|
11626
12746
|
}
|
|
11627
12747
|
),
|
|
11628
|
-
/* @__PURE__ */ (0,
|
|
12748
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11629
12749
|
DirtySavePill,
|
|
11630
12750
|
{
|
|
11631
12751
|
changeCount,
|
|
@@ -11638,11 +12758,11 @@ function MatrxDataTableCore({
|
|
|
11638
12758
|
]
|
|
11639
12759
|
}
|
|
11640
12760
|
),
|
|
11641
|
-
/* @__PURE__ */ (0,
|
|
12761
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_core3.DragOverlay, { children: draggedRow ? (
|
|
11642
12762
|
// w-max: the overlay inherits the ACTIVE node's size, and the active
|
|
11643
12763
|
// node is the 16px grip handle — without it the label wraps to one
|
|
11644
12764
|
// character per line.
|
|
11645
|
-
/* @__PURE__ */ (0,
|
|
12765
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
|
|
11646
12766
|
) : null })
|
|
11647
12767
|
]
|
|
11648
12768
|
}
|
|
@@ -11657,7 +12777,7 @@ function HierarchyDragHandle({
|
|
|
11657
12777
|
id,
|
|
11658
12778
|
disabled
|
|
11659
12779
|
});
|
|
11660
|
-
return /* @__PURE__ */ (0,
|
|
12780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11661
12781
|
"button",
|
|
11662
12782
|
{
|
|
11663
12783
|
ref: setNodeRef,
|
|
@@ -11669,7 +12789,7 @@ function HierarchyDragHandle({
|
|
|
11669
12789
|
onClick: (event) => event.stopPropagation(),
|
|
11670
12790
|
...attributes,
|
|
11671
12791
|
...listeners,
|
|
11672
|
-
children: /* @__PURE__ */ (0,
|
|
12792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
11673
12793
|
}
|
|
11674
12794
|
);
|
|
11675
12795
|
}
|
|
@@ -11678,7 +12798,7 @@ function HierarchyRootDropTarget({
|
|
|
11678
12798
|
draggedLabel
|
|
11679
12799
|
}) {
|
|
11680
12800
|
const { isOver, setNodeRef } = (0, import_core3.useDroppable)({ id: "__root__" });
|
|
11681
|
-
return /* @__PURE__ */ (0,
|
|
12801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11682
12802
|
"div",
|
|
11683
12803
|
{
|
|
11684
12804
|
ref: setNodeRef,
|
|
@@ -11688,8 +12808,8 @@ function HierarchyRootDropTarget({
|
|
|
11688
12808
|
isOver && "border-solid bg-primary/20 shadow-md shadow-primary/25"
|
|
11689
12809
|
),
|
|
11690
12810
|
children: [
|
|
11691
|
-
/* @__PURE__ */ (0,
|
|
11692
|
-
/* @__PURE__ */ (0,
|
|
12811
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "truncate", children: draggedLabel }),
|
|
12812
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-primary/75", children: label })
|
|
11693
12813
|
]
|
|
11694
12814
|
}
|
|
11695
12815
|
);
|
|
@@ -11738,7 +12858,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
11738
12858
|
const { preview: preview2 } = indicator;
|
|
11739
12859
|
const indent = indicator.left + 10 + preview2.depth * 12;
|
|
11740
12860
|
if (preview2.position === "inside") {
|
|
11741
|
-
return /* @__PURE__ */ (0,
|
|
12861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11742
12862
|
"div",
|
|
11743
12863
|
{
|
|
11744
12864
|
"aria-hidden": "true",
|
|
@@ -11750,7 +12870,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
11750
12870
|
width: Math.max(0, indicator.width - 4),
|
|
11751
12871
|
height: indicator.height
|
|
11752
12872
|
},
|
|
11753
|
-
children: /* @__PURE__ */ (0,
|
|
12873
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11754
12874
|
"span",
|
|
11755
12875
|
{
|
|
11756
12876
|
className: "absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-card/95 px-1.5 py-0.5 text-[10px] font-medium text-primary",
|
|
@@ -11765,7 +12885,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
11765
12885
|
);
|
|
11766
12886
|
}
|
|
11767
12887
|
const lineTop = preview2.position === "before" ? indicator.top - 1 : indicator.top + indicator.height - 1;
|
|
11768
|
-
return /* @__PURE__ */ (0,
|
|
12888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11769
12889
|
"div",
|
|
11770
12890
|
{
|
|
11771
12891
|
"aria-hidden": "true",
|
|
@@ -11776,9 +12896,9 @@ function HierarchyDragIndicatorLayer({
|
|
|
11776
12896
|
left: indent,
|
|
11777
12897
|
width: Math.max(0, indicator.left + indicator.width - indent - 8)
|
|
11778
12898
|
},
|
|
11779
|
-
children: /* @__PURE__ */ (0,
|
|
11780
|
-
/* @__PURE__ */ (0,
|
|
11781
|
-
/* @__PURE__ */ (0,
|
|
12899
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
|
|
12900
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
|
|
12901
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
11782
12902
|
"span",
|
|
11783
12903
|
{
|
|
11784
12904
|
className: cn(
|
|
@@ -11819,7 +12939,7 @@ function ColumnHeaderDropZone({
|
|
|
11819
12939
|
disabled: !enabled,
|
|
11820
12940
|
data: { matrxDragKind: "column-header", columnId: id }
|
|
11821
12941
|
});
|
|
11822
|
-
return /* @__PURE__ */ (0,
|
|
12942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
|
|
11823
12943
|
}
|
|
11824
12944
|
function fixedUtilityWidth(width) {
|
|
11825
12945
|
return width === void 0 ? void 0 : { width: `${width}px`, minWidth: `${width}px`, maxWidth: `${width}px` };
|
|
@@ -11853,9 +12973,9 @@ function DefaultJsonCell({ value }) {
|
|
|
11853
12973
|
const Viewer = host.JsonViewer;
|
|
11854
12974
|
const text = JSON.stringify(value, null, 2);
|
|
11855
12975
|
const summary = Array.isArray(value) ? `${value.length} items` : Object.keys(value).slice(0, 3).join(", ") || "Empty object";
|
|
11856
|
-
return /* @__PURE__ */ (0,
|
|
11857
|
-
/* @__PURE__ */ (0,
|
|
11858
|
-
/* @__PURE__ */ (0,
|
|
12976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
12977
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12978
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("button", { type: "button", className: "block max-w-full truncate text-left text-sm text-foreground", onClick: (event) => {
|
|
11859
12979
|
event.stopPropagation();
|
|
11860
12980
|
setOpen(true);
|
|
11861
12981
|
}, style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", whiteSpace: "normal", overflowWrap: "anywhere" }, "aria-label": "Open JSON value", children: [
|
|
@@ -11863,9 +12983,9 @@ function DefaultJsonCell({ value }) {
|
|
|
11863
12983
|
" ",
|
|
11864
12984
|
summary
|
|
11865
12985
|
] }) }),
|
|
11866
|
-
/* @__PURE__ */ (0,
|
|
12986
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { className: "max-w-md max-h-80 overflow-auto whitespace-pre-wrap break-words", children: text })
|
|
11867
12987
|
] }),
|
|
11868
|
-
/* @__PURE__ */ (0,
|
|
12988
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DataRowWindow, { isOpen: open, onClose: () => setOpen(false), title: "JSON value", row: value, viewContent: Viewer ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Viewer, { data: value }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "overflow-auto whitespace-pre-wrap p-3 text-xs", children: text }) })
|
|
11869
12989
|
] });
|
|
11870
12990
|
}
|
|
11871
12991
|
function DefaultMarkerCell({
|
|
@@ -11874,8 +12994,8 @@ function DefaultMarkerCell({
|
|
|
11874
12994
|
}) {
|
|
11875
12995
|
const label = marker === "favorite" ? value ? "Favorite" : "Not favorite" : value ? "Pinned" : "Not pinned";
|
|
11876
12996
|
const Icon3 = marker === "favorite" ? Star : Pin;
|
|
11877
|
-
return /* @__PURE__ */ (0,
|
|
11878
|
-
/* @__PURE__ */ (0,
|
|
12997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
12998
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11879
12999
|
"span",
|
|
11880
13000
|
{
|
|
11881
13001
|
role: "img",
|
|
@@ -11884,21 +13004,23 @@ function DefaultMarkerCell({
|
|
|
11884
13004
|
"inline-flex size-5 items-center justify-center",
|
|
11885
13005
|
value ? "text-amber-500" : "text-muted-foreground/45"
|
|
11886
13006
|
),
|
|
11887
|
-
children: /* @__PURE__ */ (0,
|
|
13007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon3, { className: "size-4", ...value ? { fill: "currentColor" } : {} })
|
|
11888
13008
|
}
|
|
11889
13009
|
) }),
|
|
11890
|
-
/* @__PURE__ */ (0,
|
|
13010
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: label })
|
|
11891
13011
|
] });
|
|
11892
13012
|
}
|
|
11893
13013
|
function renderCell(row, col, index) {
|
|
11894
13014
|
if (col.cell) return col.cell(row, index);
|
|
11895
13015
|
const raw = getCellValue(row, col);
|
|
13016
|
+
const formattedByDeclaration = formatColumnValue(col, raw);
|
|
13017
|
+
if (formattedByDeclaration) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FormattedCell, { result: formattedByDeclaration });
|
|
11896
13018
|
const kind = col.cellKind ?? "auto";
|
|
11897
13019
|
const asUuid = kind === "uuid" || kind === "fk" || kind === "auto" && isUuidValue(raw);
|
|
11898
13020
|
if (asUuid && typeof raw === "string") {
|
|
11899
13021
|
const forbidden = typeof col.fk?.forbidden === "function" ? col.fk.forbidden(raw, row) : Boolean(col.fk?.forbidden);
|
|
11900
13022
|
const declaredToken = typeof col.fk?.token === "function" ? col.fk.token(row) : col.fk?.token;
|
|
11901
|
-
return /* @__PURE__ */ (0,
|
|
13023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11902
13024
|
MatrxUuidCell,
|
|
11903
13025
|
{
|
|
11904
13026
|
value: raw,
|
|
@@ -11910,16 +13032,16 @@ function renderCell(row, col, index) {
|
|
|
11910
13032
|
}
|
|
11911
13033
|
);
|
|
11912
13034
|
}
|
|
11913
|
-
if (raw !== null && typeof raw === "object" && !(raw instanceof Date)) return /* @__PURE__ */ (0,
|
|
13035
|
+
if (raw !== null && typeof raw === "object" && !(raw instanceof Date)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DefaultJsonCell, { value: raw });
|
|
11914
13036
|
if (typeof raw === "boolean") {
|
|
11915
13037
|
const marker = resolveColumnMarker(col);
|
|
11916
|
-
if (marker) return /* @__PURE__ */ (0,
|
|
11917
|
-
return /* @__PURE__ */ (0,
|
|
13038
|
+
if (marker) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DefaultMarkerCell, { marker, value: raw });
|
|
13039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: raw ? "rounded bg-emerald-500/10 px-1.5 py-0.5 text-xs text-emerald-600" : "rounded bg-slate-500/10 px-1.5 py-0.5 text-xs text-muted-foreground", children: raw ? "Yes" : "No" });
|
|
11918
13040
|
}
|
|
11919
13041
|
const formatted = formatTableDisplayValue(raw);
|
|
11920
|
-
return /* @__PURE__ */ (0,
|
|
11921
|
-
/* @__PURE__ */ (0,
|
|
11922
|
-
/* @__PURE__ */ (0,
|
|
13042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
|
|
13043
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "block text-sm text-foreground", style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", overflowWrap: "anywhere" }, children: formatted }) }),
|
|
13044
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words max-h-80 overflow-auto", children: typeof raw === "object" && raw !== null ? JSON.stringify(raw, null, 2) : formatted })
|
|
11923
13045
|
] });
|
|
11924
13046
|
}
|
|
11925
13047
|
function resolveStringTitle(title, fallback) {
|
|
@@ -11934,14 +13056,14 @@ var import_react21 = require("react");
|
|
|
11934
13056
|
// src/dropdown-menu.tsx
|
|
11935
13057
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
11936
13058
|
var React17 = __toESM(require("react"), 1);
|
|
11937
|
-
var
|
|
13059
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11938
13060
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
11939
13061
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
11940
13062
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
11941
13063
|
var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
|
|
11942
13064
|
var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
11943
13065
|
var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
11944
|
-
var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13066
|
+
var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
11945
13067
|
DropdownMenuPrimitive.SubTrigger,
|
|
11946
13068
|
{
|
|
11947
13069
|
ref,
|
|
@@ -11954,12 +13076,12 @@ var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, .
|
|
|
11954
13076
|
...props,
|
|
11955
13077
|
children: [
|
|
11956
13078
|
children,
|
|
11957
|
-
/* @__PURE__ */ (0,
|
|
13079
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
11958
13080
|
]
|
|
11959
13081
|
}
|
|
11960
13082
|
));
|
|
11961
13083
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
11962
|
-
var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13084
|
+
var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11963
13085
|
DropdownMenuPrimitive.SubContent,
|
|
11964
13086
|
{
|
|
11965
13087
|
ref,
|
|
@@ -11971,7 +13093,7 @@ var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) =
|
|
|
11971
13093
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
11972
13094
|
var DropdownMenuContent = React17.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
|
|
11973
13095
|
const portalContainer = usePortalContainer(container);
|
|
11974
|
-
return /* @__PURE__ */ (0,
|
|
13096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11975
13097
|
DropdownMenuPrimitive.Content,
|
|
11976
13098
|
{
|
|
11977
13099
|
ref,
|
|
@@ -11988,7 +13110,7 @@ var DropdownMenuContent = React17.forwardRef(({ className, sideOffset = 4, conta
|
|
|
11988
13110
|
) });
|
|
11989
13111
|
});
|
|
11990
13112
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
11991
|
-
var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13113
|
+
var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11992
13114
|
DropdownMenuPrimitive.Item,
|
|
11993
13115
|
{
|
|
11994
13116
|
ref,
|
|
@@ -11998,7 +13120,7 @@ var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref)
|
|
|
11998
13120
|
}
|
|
11999
13121
|
));
|
|
12000
13122
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
12001
|
-
var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13123
|
+
var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12002
13124
|
DropdownMenuPrimitive.CheckboxItem,
|
|
12003
13125
|
{
|
|
12004
13126
|
ref,
|
|
@@ -12006,13 +13128,13 @@ var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...pro
|
|
|
12006
13128
|
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
12007
13129
|
...props,
|
|
12008
13130
|
children: [
|
|
12009
|
-
/* @__PURE__ */ (0,
|
|
13131
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
12010
13132
|
children
|
|
12011
13133
|
]
|
|
12012
13134
|
}
|
|
12013
13135
|
));
|
|
12014
13136
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
12015
|
-
var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13137
|
+
var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12016
13138
|
DropdownMenuPrimitive.RadioItem,
|
|
12017
13139
|
{
|
|
12018
13140
|
ref,
|
|
@@ -12020,13 +13142,13 @@ var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props
|
|
|
12020
13142
|
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
12021
13143
|
...props,
|
|
12022
13144
|
children: [
|
|
12023
|
-
/* @__PURE__ */ (0,
|
|
13145
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
12024
13146
|
children
|
|
12025
13147
|
]
|
|
12026
13148
|
}
|
|
12027
13149
|
));
|
|
12028
13150
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
12029
|
-
var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13151
|
+
var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12030
13152
|
DropdownMenuPrimitive.Label,
|
|
12031
13153
|
{
|
|
12032
13154
|
ref,
|
|
@@ -12036,7 +13158,7 @@ var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref)
|
|
|
12036
13158
|
}
|
|
12037
13159
|
));
|
|
12038
13160
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
12039
|
-
var DropdownMenuSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
13161
|
+
var DropdownMenuSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12040
13162
|
DropdownMenuPrimitive.Separator,
|
|
12041
13163
|
{
|
|
12042
13164
|
ref,
|
|
@@ -12049,7 +13171,7 @@ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
|
12049
13171
|
var DropdownMenuShortcut = ({
|
|
12050
13172
|
className,
|
|
12051
13173
|
...props
|
|
12052
|
-
}) => /* @__PURE__ */ (0,
|
|
13174
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12053
13175
|
"span",
|
|
12054
13176
|
{
|
|
12055
13177
|
"data-slot": "dropdown-menu-shortcut",
|
|
@@ -12060,7 +13182,7 @@ var DropdownMenuShortcut = ({
|
|
|
12060
13182
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
12061
13183
|
|
|
12062
13184
|
// src/data-table/SavedViewsControl.tsx
|
|
12063
|
-
var
|
|
13185
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
12064
13186
|
function SavedViewsControl({
|
|
12065
13187
|
views,
|
|
12066
13188
|
activeId = null,
|
|
@@ -12118,10 +13240,10 @@ function SavedViewsControl({
|
|
|
12118
13240
|
}
|
|
12119
13241
|
};
|
|
12120
13242
|
const activeName = activeId ? views.find((view) => view.id === activeId)?.name : void 0;
|
|
12121
|
-
return /* @__PURE__ */ (0,
|
|
12122
|
-
/* @__PURE__ */ (0,
|
|
12123
|
-
/* @__PURE__ */ (0,
|
|
12124
|
-
/* @__PURE__ */ (0,
|
|
13243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", "data-matrx-table-saved-views": true, children: [
|
|
13244
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenu, { children: [
|
|
13245
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Tooltip, { children: [
|
|
13246
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12125
13247
|
Button,
|
|
12126
13248
|
{
|
|
12127
13249
|
type: "button",
|
|
@@ -12132,38 +13254,38 @@ function SavedViewsControl({
|
|
|
12132
13254
|
"aria-describedby": dirty ? unsavedChangesId : void 0,
|
|
12133
13255
|
disabled: saving,
|
|
12134
13256
|
children: [
|
|
12135
|
-
/* @__PURE__ */ (0,
|
|
12136
|
-
dirty ? /* @__PURE__ */ (0,
|
|
12137
|
-
/* @__PURE__ */ (0,
|
|
13257
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "min-w-0 flex-1 truncate", children: loading ? "Loading views\u2026" : activeName ?? "Default view" }),
|
|
13258
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": "true", className: "size-1.5 shrink-0 rounded-full bg-amber-500" }) : null,
|
|
13259
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { className: "size-3.5 shrink-0" })
|
|
12138
13260
|
]
|
|
12139
13261
|
}
|
|
12140
13262
|
) }) }),
|
|
12141
|
-
/* @__PURE__ */ (0,
|
|
13263
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipContent, { children: "Choose or save a table view" })
|
|
12142
13264
|
] }),
|
|
12143
|
-
/* @__PURE__ */ (0,
|
|
12144
|
-
/* @__PURE__ */ (0,
|
|
12145
|
-
/* @__PURE__ */ (0,
|
|
12146
|
-
/* @__PURE__ */ (0,
|
|
12147
|
-
views.map((view) => /* @__PURE__ */ (0,
|
|
13265
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
13266
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuLabel, { children: "Views" }),
|
|
13267
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenuRadioGroup, { value: activeId ?? "__default__", onValueChange: (value) => onSelect(value === "__default__" ? null : value), children: [
|
|
13268
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuRadioItem, { value: "__default__", children: "Default view" }),
|
|
13269
|
+
views.map((view) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuRadioItem, { value: view.id, children: view.name }, view.id))
|
|
12148
13270
|
] }),
|
|
12149
|
-
/* @__PURE__ */ (0,
|
|
12150
|
-
/* @__PURE__ */ (0,
|
|
13271
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuSeparator, {}),
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => {
|
|
12151
13273
|
setActionError(null);
|
|
12152
13274
|
setSaveOpen(true);
|
|
12153
13275
|
}, children: "Save current view\u2026" }),
|
|
12154
|
-
activeId && onUpdate ? /* @__PURE__ */ (0,
|
|
12155
|
-
onReload ? /* @__PURE__ */ (0,
|
|
13276
|
+
activeId && onUpdate ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => void update(), children: "Update current view" }) : null,
|
|
13277
|
+
onReload ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving || loading, onSelect: () => void reload(), children: "Reload views" }) : null
|
|
12156
13278
|
] })
|
|
12157
13279
|
] }),
|
|
12158
|
-
dirty ? /* @__PURE__ */ (0,
|
|
12159
|
-
visibleError ? /* @__PURE__ */ (0,
|
|
12160
|
-
/* @__PURE__ */ (0,
|
|
12161
|
-
/* @__PURE__ */ (0,
|
|
12162
|
-
visibleError ? /* @__PURE__ */ (0,
|
|
12163
|
-
/* @__PURE__ */ (0,
|
|
12164
|
-
/* @__PURE__ */ (0,
|
|
12165
|
-
/* @__PURE__ */ (0,
|
|
12166
|
-
/* @__PURE__ */ (0,
|
|
13280
|
+
dirty ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: unsavedChangesId, className: "sr-only", children: "This table view has unsaved changes. Open the view menu to save or update it." }) : null,
|
|
13281
|
+
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
|
|
13282
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DialogContent, { children: [
|
|
13283
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogTitle, { children: "Save current view" }) }),
|
|
13284
|
+
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
|
|
13285
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Input, { "aria-label": "View name", value: name, onChange: (event) => setName(event.target.value), placeholder: "View name", autoFocus: true }),
|
|
13286
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DialogFooter, { children: [
|
|
13287
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { type: "button", variant: "outline", onClick: () => setSaveOpen(false), children: "Cancel" }),
|
|
13288
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { type: "button", disabled: !name.trim() || saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save view" })
|
|
12167
13289
|
] })
|
|
12168
13290
|
] }) })
|
|
12169
13291
|
] });
|