@object-ui/plugin-list 11.3.0 → 11.4.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 +2 -0
- package/dist/ListView.d.ts.map +1 -1
- package/dist/index.js +88 -85
- package/dist/index.umd.cjs +2 -2
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
package/dist/ListView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAwB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAKhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClD,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7F,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACvD,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IACxE,gFAAgF;IAChF,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;IACtG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAuBD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAyBhE;AAUD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAKtD;AAmBD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,CAAC,EAAE,cAAc,CAAC,uBAAuB,CAAC,GAC9C,KAAK,CAAC,aAAa,CAoDrB;AAqGD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAwB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAKhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClD,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7F,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACvD,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IACxE,gFAAgF;IAChF,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;IACtG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAuBD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAyBhE;AAUD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAKtD;AAmBD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,KAAK,CAAC,EAAE,cAAc,CAAC,uBAAuB,CAAC,GAC9C,KAAK,CAAC,aAAa,CAoDrB;AAqGD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,eAAO,MAAM,QAAQ,mGA+oEnB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -888,14 +888,10 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
888
888
|
conditions: []
|
|
889
889
|
}), V = _.dataSource, [H, Ge] = i.useState([]), [Ke, Je] = i.useState(null), [U, Ye] = i.useState(() => !(Array.isArray(j.data) || j.data && typeof j.data == "object" && j.data.provider === "value" && Array.isArray(j.data.items))), [W, Xe] = i.useState(null), [et, tt] = i.useState(!1), [nt, rt] = i.useState(0), [ot, st] = i.useState(!1);
|
|
890
890
|
i.useImperativeHandle(b, () => ({ refresh: () => rt((e) => e + 1) }), []), i.useEffect(() => {
|
|
891
|
-
if (!(!V?.onMutation || !j.objectName
|
|
891
|
+
if (!(!V?.onMutation || !j.objectName)) return V.onMutation((e) => {
|
|
892
892
|
e.resource === j.objectName && rt((e) => e + 1);
|
|
893
893
|
});
|
|
894
|
-
}, [
|
|
895
|
-
V,
|
|
896
|
-
j.objectName,
|
|
897
|
-
j.refreshTrigger
|
|
898
|
-
]);
|
|
894
|
+
}, [V, j.objectName]);
|
|
899
895
|
let [ct, lt] = i.useState(void 0), G = ct ?? j.pagination?.pageSize ?? 100, [ut, dt] = i.useState(1), [ft, pt] = i.useState(null), K = i.useMemo(() => {
|
|
900
896
|
if (j.grouping?.fields?.length) return j.grouping;
|
|
901
897
|
let e = typeof j.groupBy == "string" ? j.groupBy.trim() : "", t = typeof j.groupBy2 == "string" ? j.groupBy2.trim() : "", n = [];
|
|
@@ -944,7 +940,13 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
944
940
|
}, [Dt]);
|
|
945
941
|
let Ot = i.useCallback((e) => {
|
|
946
942
|
Et(e), c?.(Array.from(e));
|
|
947
|
-
}, [c]), [kt, At] = i.useState(!1), [jt, Mt] = i.useState(
|
|
943
|
+
}, [c]), [kt, At] = i.useState(!1), [jt, Mt] = i.useState(() => !!j.inlineEdit);
|
|
944
|
+
i.useEffect(() => {
|
|
945
|
+
Mt(!!j.inlineEdit);
|
|
946
|
+
}, [j.inlineEdit]);
|
|
947
|
+
let Nt = i.useCallback((e) => {
|
|
948
|
+
Mt(e), l?.(e);
|
|
949
|
+
}, [l]), [Pt, Ft] = i.useState(!1), [It, Lt] = i.useState(!1), [Rt, zt] = i.useState(null), Bt = j.allowExport !== !1 && j.operations?.export !== !1, Vt = i.useMemo(() => {
|
|
948
950
|
if (j.exportOptions) return Array.isArray(j.exportOptions) ? { formats: j.exportOptions } : j.exportOptions;
|
|
949
951
|
}, [j.exportOptions]), Z = Fe(i.useMemo(() => j.densityMode ? j.densityMode : j.rowHeight ? {
|
|
950
952
|
compact: "compact",
|
|
@@ -952,27 +954,27 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
952
954
|
medium: "comfortable",
|
|
953
955
|
tall: "spacious",
|
|
954
956
|
extra_tall: "spacious"
|
|
955
|
-
}[j.rowHeight] || "comfortable" : "compact", [j.densityMode, j.rowHeight]), { onChange: j.onDensityChange }),
|
|
957
|
+
}[j.rowHeight] || "comfortable" : "compact", [j.densityMode, j.rowHeight]), { onChange: j.onDensityChange }), Ht = i.useMemo(() => `objectui:gallery:density:${j.objectName ?? "default"}`, [j.objectName]), [Q, Ut] = i.useState(() => {
|
|
956
958
|
if (typeof window > "u") return j.gallery?.cardSize ?? "medium";
|
|
957
959
|
try {
|
|
958
|
-
let e = window.localStorage.getItem(
|
|
960
|
+
let e = window.localStorage.getItem(Ht);
|
|
959
961
|
if (e === "small" || e === "medium" || e === "large") return e;
|
|
960
962
|
} catch {}
|
|
961
963
|
return j.gallery?.cardSize ?? "medium";
|
|
962
|
-
}),
|
|
963
|
-
|
|
964
|
+
}), Wt = i.useCallback(() => {
|
|
965
|
+
Ut((e) => {
|
|
964
966
|
let t = e === "large" ? "medium" : e === "medium" ? "small" : "large";
|
|
965
967
|
try {
|
|
966
|
-
window.localStorage.setItem(
|
|
968
|
+
window.localStorage.setItem(Ht, t);
|
|
967
969
|
} catch {}
|
|
968
970
|
return t;
|
|
969
971
|
});
|
|
970
|
-
}, [
|
|
972
|
+
}, [Ht]), { ref: Gt, isRefreshing: Kt, pullDistance: qt } = Le({
|
|
971
973
|
onRefresh: i.useCallback(async () => {
|
|
972
974
|
rt((e) => e + 1);
|
|
973
975
|
}, []),
|
|
974
976
|
enabled: !!V && !!j.objectName
|
|
975
|
-
}),
|
|
977
|
+
}), Jt = i.useMemo(() => j.id ? `listview-${j.objectName}-${j.id}-view` : `listview-${j.objectName}-view`, [j.objectName, j.id]);
|
|
976
978
|
i.useEffect(() => {
|
|
977
979
|
let e = !0;
|
|
978
980
|
return tt(!1), Xe(null), (async () => {
|
|
@@ -996,7 +998,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
996
998
|
e = !1;
|
|
997
999
|
};
|
|
998
1000
|
}, [j.objectName, V]);
|
|
999
|
-
let
|
|
1001
|
+
let Yt = i.useMemo(() => {
|
|
1000
1002
|
let e = Array.isArray(j.fields) ? j.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], n = new Set(e), r = (e) => {
|
|
1001
1003
|
if (!e) return;
|
|
1002
1004
|
let t = [
|
|
@@ -1033,7 +1035,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1033
1035
|
j.timeline,
|
|
1034
1036
|
j.gantt,
|
|
1035
1037
|
j.options
|
|
1036
|
-
]),
|
|
1038
|
+
]), Xt = Re();
|
|
1037
1039
|
i.useEffect(() => {
|
|
1038
1040
|
let e = !0, t = ++Ct.current;
|
|
1039
1041
|
if (j.data && typeof j.data == "object" && !Array.isArray(j.data)) {
|
|
@@ -1074,11 +1076,11 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1074
1076
|
field: e.field,
|
|
1075
1077
|
order: e.order
|
|
1076
1078
|
})) : void 0, c = (() => {
|
|
1077
|
-
let e = Array.isArray(j.fields) ? j.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t =
|
|
1079
|
+
let e = Array.isArray(j.fields) ? j.fields.map((e) => typeof e == "string" ? e : e?.field).filter((e) => typeof e == "string" && e.length > 0) : [], t = Xt?.isLoaded && j.objectName ? e.filter((e) => Xt.checkField(j.objectName, e, "read")) : e;
|
|
1078
1080
|
if (t.length === 0) return;
|
|
1079
1081
|
let n = /* @__PURE__ */ new Set(["id"]);
|
|
1080
1082
|
for (let e of t) n.add(e);
|
|
1081
|
-
for (let e of
|
|
1083
|
+
for (let e of Yt) n.add(e);
|
|
1082
1084
|
let r = (() => {
|
|
1083
1085
|
let e = W?.fields;
|
|
1084
1086
|
if (!e) return null;
|
|
@@ -1122,7 +1124,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1122
1124
|
$top: G,
|
|
1123
1125
|
...d > 0 ? { $skip: d } : {},
|
|
1124
1126
|
...c ? { $select: c } : {},
|
|
1125
|
-
...
|
|
1127
|
+
...Yt.length > 0 ? { $expand: Yt } : {},
|
|
1126
1128
|
...F ? {
|
|
1127
1129
|
$search: F,
|
|
1128
1130
|
...j.searchableFields && j.searchableFields.length > 0 ? { $searchFields: j.searchableFields } : {}
|
|
@@ -1153,15 +1155,15 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1153
1155
|
nt,
|
|
1154
1156
|
F,
|
|
1155
1157
|
j.searchableFields,
|
|
1156
|
-
|
|
1158
|
+
Yt,
|
|
1157
1159
|
et,
|
|
1158
1160
|
j.refreshTrigger,
|
|
1159
|
-
|
|
1161
|
+
Xt,
|
|
1160
1162
|
ut,
|
|
1161
1163
|
P,
|
|
1162
1164
|
q
|
|
1163
1165
|
]);
|
|
1164
|
-
let
|
|
1166
|
+
let Zt = JSON.stringify([
|
|
1165
1167
|
j.objectName,
|
|
1166
1168
|
j.filters,
|
|
1167
1169
|
G,
|
|
@@ -1171,11 +1173,11 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1171
1173
|
F,
|
|
1172
1174
|
P,
|
|
1173
1175
|
q
|
|
1174
|
-
]),
|
|
1176
|
+
]), Qt = i.useRef(Zt);
|
|
1175
1177
|
i.useEffect(() => {
|
|
1176
|
-
|
|
1177
|
-
}, [
|
|
1178
|
-
let
|
|
1178
|
+
Qt.current !== Zt && (Qt.current = Zt, dt(1));
|
|
1179
|
+
}, [Zt]);
|
|
1180
|
+
let $t = i.useMemo(() => {
|
|
1179
1181
|
let e = ["grid"];
|
|
1180
1182
|
(j.kanban?.groupByField || j.kanban?.groupField || j.options?.kanban?.groupField) && e.push("kanban"), (j.gallery?.coverField || j.gallery?.imageField || j.options?.gallery?.imageField) && e.push("gallery"), (j.calendar?.startDateField || j.options?.calendar?.startDateField) && e.push("calendar"), (j.timeline?.startDateField || j.options?.timeline?.startDateField || j.options?.timeline?.dateField || j.options?.calendar?.startDateField) && e.push("timeline"), (j.gantt?.startDateField || j.options?.gantt?.startDateField) && e.push("gantt"), (j.options?.map?.locationField || j.options?.map?.latitudeField && j.options?.map?.longitudeField) && e.push("map"), (j.tree?.parentField || j.options?.tree?.parentField || j.viewType === "tree") && e.push("tree"), j.viewType && !e.includes(j.viewType) && [
|
|
1181
1183
|
"grid",
|
|
@@ -1208,26 +1210,26 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1208
1210
|
i.useEffect(() => {
|
|
1209
1211
|
j.viewType && de(j.viewType);
|
|
1210
1212
|
}, [j.viewType]);
|
|
1211
|
-
let
|
|
1213
|
+
let en = i.useCallback((e) => {
|
|
1212
1214
|
de(e);
|
|
1213
1215
|
try {
|
|
1214
|
-
localStorage.setItem(
|
|
1216
|
+
localStorage.setItem(Jt, e);
|
|
1215
1217
|
} catch (e) {
|
|
1216
1218
|
console.warn("Failed to save view preference to localStorage:", e);
|
|
1217
1219
|
}
|
|
1218
1220
|
r?.(e);
|
|
1219
|
-
}, [
|
|
1221
|
+
}, [Jt, r]), tn = i.useCallback((e) => {
|
|
1220
1222
|
Se(e), s?.(e);
|
|
1221
|
-
}, [s]),
|
|
1223
|
+
}, [s]), nn = Ie({
|
|
1222
1224
|
navigation: j.navigation,
|
|
1223
1225
|
objectName: j.objectName,
|
|
1224
1226
|
onNavigate: j.onNavigate,
|
|
1225
1227
|
onRowClick: f
|
|
1226
1228
|
}), $ = i.useMemo(() => {
|
|
1227
1229
|
let e = j.fields || [];
|
|
1228
|
-
if (Array.isArray(e) || (e = []),
|
|
1230
|
+
if (Array.isArray(e) || (e = []), Xt?.isLoaded && j.objectName && (e = e.filter((e) => {
|
|
1229
1231
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1230
|
-
return t ?
|
|
1232
|
+
return t ? Xt.checkField(j.objectName, t, "read") : !0;
|
|
1231
1233
|
})), X.size > 0 && (e = e.filter((e) => {
|
|
1232
1234
|
let t = typeof e == "string" ? e : e?.name || e?.fieldName || e?.field;
|
|
1233
1235
|
return t != null && !X.has(t);
|
|
@@ -1244,8 +1246,8 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1244
1246
|
j.objectName,
|
|
1245
1247
|
X,
|
|
1246
1248
|
j.fieldOrder,
|
|
1247
|
-
|
|
1248
|
-
]),
|
|
1249
|
+
Xt
|
|
1250
|
+
]), rn = i.useMemo(() => {
|
|
1249
1251
|
let e = Z.mode === "compact" ? "compact" : Z.mode === "spacious" ? "tall" : "medium", t = {
|
|
1250
1252
|
objectName: j.objectName,
|
|
1251
1253
|
fields: $,
|
|
@@ -1253,7 +1255,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1253
1255
|
sort: R,
|
|
1254
1256
|
className: "h-full w-full",
|
|
1255
1257
|
showSearch: !1,
|
|
1256
|
-
onRowClick:
|
|
1258
|
+
onRowClick: nn.handleClick,
|
|
1257
1259
|
rowHeight: e,
|
|
1258
1260
|
hideRowHeightToggle: !0,
|
|
1259
1261
|
...j.striped == null ? {} : { striped: j.striped },
|
|
@@ -1268,7 +1270,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1268
1270
|
...t,
|
|
1269
1271
|
columns: $,
|
|
1270
1272
|
...j.conditionalFormatting ? { conditionalFormatting: j.conditionalFormatting } : {},
|
|
1271
|
-
|
|
1273
|
+
editable: jt,
|
|
1272
1274
|
...j.wrapHeaders == null ? {} : { wrapHeaders: j.wrapHeaders },
|
|
1273
1275
|
...j.virtualScroll == null ? {} : { virtualScroll: j.virtualScroll },
|
|
1274
1276
|
...j.resizable == null ? {} : { resizable: j.resizable },
|
|
@@ -1410,10 +1412,11 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1410
1412
|
$,
|
|
1411
1413
|
q,
|
|
1412
1414
|
J,
|
|
1413
|
-
|
|
1415
|
+
nn.handleClick,
|
|
1414
1416
|
Z.mode,
|
|
1415
|
-
Q
|
|
1416
|
-
|
|
1417
|
+
Q,
|
|
1418
|
+
jt
|
|
1419
|
+
]), an = B.conditions && B.conditions.length > 0, on = i.useMemo(() => {
|
|
1417
1420
|
let e, t = (e, t) => {
|
|
1418
1421
|
if (!t) return;
|
|
1419
1422
|
let n = Array.isArray(t) ? t.map((e) => ({
|
|
@@ -1463,9 +1466,9 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1463
1466
|
j.objectName,
|
|
1464
1467
|
M,
|
|
1465
1468
|
A
|
|
1466
|
-
]),
|
|
1467
|
-
if (!
|
|
1468
|
-
let t =
|
|
1469
|
+
]), sn = i.useCallback((e) => {
|
|
1470
|
+
if (!Bt) return;
|
|
1471
|
+
let t = Vt, n = t?.maxRecords || 0, r = t?.includeHeaders !== !1, i = t?.fileNamePrefix || j.objectName || "export";
|
|
1469
1472
|
if ((e === "csv" || e === "xlsx" || e === "json") && typeof V?.exportDownload == "function" && j.objectName && t?.streaming !== !1) {
|
|
1470
1473
|
let t = $.map((e) => typeof e == "string" ? e : e.name || e.fieldName || e.field).filter(Boolean), a = j.filters || [], o = $e(B), s = Qe(Y), c = [
|
|
1471
1474
|
...a.length > 0 ? [a] : [],
|
|
@@ -1475,7 +1478,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1475
1478
|
field: e.field,
|
|
1476
1479
|
direction: e.order
|
|
1477
1480
|
})) : void 0;
|
|
1478
|
-
|
|
1481
|
+
zt(null), Lt(!0), (async () => {
|
|
1479
1482
|
try {
|
|
1480
1483
|
let a = await V.exportDownload(j.objectName, {
|
|
1481
1484
|
format: e,
|
|
@@ -1485,11 +1488,11 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1485
1488
|
includeHeaders: r,
|
|
1486
1489
|
limit: n > 0 ? n : void 0
|
|
1487
1490
|
}), o = URL.createObjectURL(a), s = document.createElement("a");
|
|
1488
|
-
s.href = o, s.download = `${i}.${e}`, s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), URL.revokeObjectURL(o),
|
|
1491
|
+
s.href = o, s.download = `${i}.${e}`, s.rel = "noopener", document.body.appendChild(s), s.click(), s.remove(), URL.revokeObjectURL(o), Ft(!1);
|
|
1489
1492
|
} catch (e) {
|
|
1490
|
-
console.error("ListView export failed:", e),
|
|
1493
|
+
console.error("ListView export failed:", e), zt(e instanceof Error ? e.message : String(e));
|
|
1491
1494
|
} finally {
|
|
1492
|
-
|
|
1495
|
+
Lt(!1);
|
|
1493
1496
|
}
|
|
1494
1497
|
})();
|
|
1495
1498
|
return;
|
|
@@ -1509,19 +1512,19 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1509
1512
|
let e = new Blob([JSON.stringify(a, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1510
1513
|
n.href = t, n.download = `${i}.json`, n.click(), URL.revokeObjectURL(t);
|
|
1511
1514
|
}
|
|
1512
|
-
|
|
1515
|
+
Ft(!1);
|
|
1513
1516
|
}, [
|
|
1514
1517
|
H,
|
|
1515
1518
|
$,
|
|
1516
|
-
|
|
1519
|
+
Vt,
|
|
1517
1520
|
j.objectName,
|
|
1518
1521
|
j.filters,
|
|
1519
|
-
|
|
1522
|
+
Bt,
|
|
1520
1523
|
V,
|
|
1521
1524
|
B,
|
|
1522
1525
|
Y,
|
|
1523
1526
|
R
|
|
1524
|
-
]),
|
|
1527
|
+
]), cn = i.useMemo(() => (j.fields || []).map((e) => {
|
|
1525
1528
|
if (typeof e == "string") return {
|
|
1526
1529
|
name: e,
|
|
1527
1530
|
label: M(e, e)
|
|
@@ -1533,7 +1536,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1533
1536
|
};
|
|
1534
1537
|
}), [j.fields, M]);
|
|
1535
1538
|
return /* @__PURE__ */ L("div", {
|
|
1536
|
-
ref:
|
|
1539
|
+
ref: Gt,
|
|
1537
1540
|
className: E("flex flex-col h-full bg-background relative min-w-0 overflow-hidden", n),
|
|
1538
1541
|
...j.aria?.label ? { "aria-label": j.aria.label } : {},
|
|
1539
1542
|
...j.aria?.describedBy ? { "aria-describedby": j.aria.describedBy } : {},
|
|
@@ -1542,10 +1545,10 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1542
1545
|
"aria-busy": U || void 0,
|
|
1543
1546
|
"data-state": U ? "loading" : "idle",
|
|
1544
1547
|
children: [
|
|
1545
|
-
|
|
1548
|
+
qt > 0 && /* @__PURE__ */ I("div", {
|
|
1546
1549
|
className: "flex items-center justify-center text-xs text-muted-foreground",
|
|
1547
|
-
style: { height:
|
|
1548
|
-
children: D(
|
|
1550
|
+
style: { height: qt },
|
|
1551
|
+
children: D(Kt ? "list.refreshing" : "list.pullToRefresh")
|
|
1549
1552
|
}),
|
|
1550
1553
|
j.description && j.appearance?.showDescription !== !1 && /* @__PURE__ */ I("div", {
|
|
1551
1554
|
className: "px-4 pt-1.5 text-xs text-muted-foreground bg-background",
|
|
@@ -1574,14 +1577,14 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1574
1577
|
children: [
|
|
1575
1578
|
ne && /* @__PURE__ */ L(Oe, { children: [/* @__PURE__ */ I(He, {
|
|
1576
1579
|
currentView: P,
|
|
1577
|
-
availableViews:
|
|
1578
|
-
onViewChange:
|
|
1580
|
+
availableViews: $t,
|
|
1581
|
+
onViewChange: en
|
|
1579
1582
|
}), /* @__PURE__ */ I("div", { className: "h-4 w-px bg-border/60 mx-0.5" })] }),
|
|
1580
1583
|
P === "grid" && l && !N.compactToolbar && /* @__PURE__ */ L(u, {
|
|
1581
1584
|
variant: "ghost",
|
|
1582
1585
|
size: "sm",
|
|
1583
|
-
onClick: () =>
|
|
1584
|
-
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1586
|
+
onClick: () => Nt(!jt),
|
|
1587
|
+
className: E("hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", jt && "text-primary"),
|
|
1585
1588
|
title: D("list.inlineEditLabel", { defaultValue: "Edit records inline (click a cell to edit)" }),
|
|
1586
1589
|
"data-testid": "toolbar-inline-edit-toggle",
|
|
1587
1590
|
children: [/* @__PURE__ */ I(me, { className: "h-3.5 w-3.5 mr-1.5" }), /* @__PURE__ */ I("span", {
|
|
@@ -1629,7 +1632,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1629
1632
|
})]
|
|
1630
1633
|
}), /* @__PURE__ */ I("div", {
|
|
1631
1634
|
className: "max-h-60 overflow-y-auto space-y-1",
|
|
1632
|
-
children:
|
|
1635
|
+
children: cn.map((e) => /* @__PURE__ */ L("label", {
|
|
1633
1636
|
className: "flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer",
|
|
1634
1637
|
children: [/* @__PURE__ */ I("input", {
|
|
1635
1638
|
type: "checkbox",
|
|
@@ -1657,14 +1660,14 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1657
1660
|
children: /* @__PURE__ */ L(u, {
|
|
1658
1661
|
variant: "ghost",
|
|
1659
1662
|
size: "sm",
|
|
1660
|
-
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150",
|
|
1663
|
+
className: E("h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150", an && "text-foreground font-medium"),
|
|
1661
1664
|
children: [
|
|
1662
1665
|
/* @__PURE__ */ I(we, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
1663
1666
|
/* @__PURE__ */ I("span", {
|
|
1664
1667
|
className: "hidden sm:inline",
|
|
1665
1668
|
children: D("list.filter")
|
|
1666
1669
|
}),
|
|
1667
|
-
|
|
1670
|
+
an && /* @__PURE__ */ I("span", {
|
|
1668
1671
|
className: "ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums",
|
|
1669
1672
|
children: B.conditions?.length || 0
|
|
1670
1673
|
})
|
|
@@ -1682,7 +1685,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1682
1685
|
children: D("list.filterRecords")
|
|
1683
1686
|
})
|
|
1684
1687
|
}), /* @__PURE__ */ I(v, {
|
|
1685
|
-
fields:
|
|
1688
|
+
fields: on,
|
|
1686
1689
|
value: B,
|
|
1687
1690
|
onChange: (e) => {
|
|
1688
1691
|
Ue(e), a && a(e);
|
|
@@ -1734,7 +1737,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1734
1737
|
"data-testid": "group-field-list",
|
|
1735
1738
|
children: /* @__PURE__ */ I(ee, {
|
|
1736
1739
|
value: q,
|
|
1737
|
-
fieldOptions:
|
|
1740
|
+
fieldOptions: cn.map((e) => ({
|
|
1738
1741
|
value: e.name,
|
|
1739
1742
|
label: e.label || e.name
|
|
1740
1743
|
})),
|
|
@@ -1783,7 +1786,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1783
1786
|
children: D("list.sortRecords")
|
|
1784
1787
|
})
|
|
1785
1788
|
}), /* @__PURE__ */ I(T, {
|
|
1786
|
-
fields:
|
|
1789
|
+
fields: on,
|
|
1787
1790
|
value: R,
|
|
1788
1791
|
onChange: (e) => {
|
|
1789
1792
|
ze(e), o && o(e);
|
|
@@ -1845,7 +1848,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1845
1848
|
children: [/* @__PURE__ */ I("option", {
|
|
1846
1849
|
value: "",
|
|
1847
1850
|
children: D("list.none")
|
|
1848
|
-
}),
|
|
1851
|
+
}), cn.map((e) => /* @__PURE__ */ I("option", {
|
|
1849
1852
|
value: e.name,
|
|
1850
1853
|
children: e.label
|
|
1851
1854
|
}, e.name))]
|
|
@@ -1879,14 +1882,14 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1879
1882
|
size: "sm",
|
|
1880
1883
|
"aria-label": n,
|
|
1881
1884
|
className: E("hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150", Q !== "small" && "text-foreground font-medium"),
|
|
1882
|
-
onClick:
|
|
1885
|
+
onClick: Wt,
|
|
1883
1886
|
title: r,
|
|
1884
1887
|
children: /* @__PURE__ */ I(e, { className: "h-3.5 w-3.5" })
|
|
1885
1888
|
});
|
|
1886
1889
|
})(),
|
|
1887
1890
|
N.compactToolbar && (N.showGroup || N.showColor || N.showDensity || N.showHideFields) && /* @__PURE__ */ I(We, {
|
|
1888
1891
|
t: D,
|
|
1889
|
-
allFields:
|
|
1892
|
+
allFields: cn,
|
|
1890
1893
|
showGroup: N.showGroup,
|
|
1891
1894
|
groupingConfig: q,
|
|
1892
1895
|
setGroupingConfig: mt,
|
|
@@ -1899,13 +1902,13 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1899
1902
|
hiddenFields: X,
|
|
1900
1903
|
updateHiddenFields: Ot,
|
|
1901
1904
|
showInlineEdit: P === "grid",
|
|
1902
|
-
inlineEdit:
|
|
1903
|
-
setInlineEdit:
|
|
1905
|
+
inlineEdit: jt,
|
|
1906
|
+
setInlineEdit: Nt
|
|
1904
1907
|
}),
|
|
1905
|
-
(N.showColor || N.showDensity || N.compactToolbar) &&
|
|
1906
|
-
|
|
1907
|
-
open:
|
|
1908
|
-
onOpenChange:
|
|
1908
|
+
(N.showColor || N.showDensity || N.compactToolbar) && Vt && Bt && /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }),
|
|
1909
|
+
Vt && Bt && /* @__PURE__ */ L(S, {
|
|
1910
|
+
open: Pt,
|
|
1911
|
+
onOpenChange: Ft,
|
|
1909
1912
|
children: [/* @__PURE__ */ I(w, {
|
|
1910
1913
|
asChild: !0,
|
|
1911
1914
|
children: /* @__PURE__ */ L(u, {
|
|
@@ -1922,18 +1925,18 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1922
1925
|
className: "w-48 p-2",
|
|
1923
1926
|
children: /* @__PURE__ */ L("div", {
|
|
1924
1927
|
className: "space-y-1",
|
|
1925
|
-
children: [(
|
|
1928
|
+
children: [(Vt.formats || ["csv", "json"]).map((e) => /* @__PURE__ */ L(u, {
|
|
1926
1929
|
variant: "ghost",
|
|
1927
1930
|
size: "sm",
|
|
1928
1931
|
className: "w-full justify-start h-8 text-xs",
|
|
1929
|
-
disabled:
|
|
1930
|
-
onClick: () =>
|
|
1931
|
-
children: [
|
|
1932
|
-
}, e)),
|
|
1932
|
+
disabled: It,
|
|
1933
|
+
onClick: () => sn(e),
|
|
1934
|
+
children: [It ? /* @__PURE__ */ I(fe, { className: "h-3.5 w-3.5 mr-2 animate-spin" }) : /* @__PURE__ */ I(oe, { className: "h-3.5 w-3.5 mr-2" }), D("list.exportAs", { format: e.toUpperCase() })]
|
|
1935
|
+
}, e)), Rt && /* @__PURE__ */ I("div", {
|
|
1933
1936
|
className: "px-2 py-1 text-xs",
|
|
1934
1937
|
style: { color: "var(--destructive, #ef4444)" },
|
|
1935
1938
|
role: "alert",
|
|
1936
|
-
children:
|
|
1939
|
+
children: Rt
|
|
1937
1940
|
})]
|
|
1938
1941
|
})
|
|
1939
1942
|
})]
|
|
@@ -1961,7 +1964,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1961
1964
|
})]
|
|
1962
1965
|
}),
|
|
1963
1966
|
(() => {
|
|
1964
|
-
let e = j.allowPrinting || j.sharing?.enabled || j.sharing?.type ||
|
|
1967
|
+
let e = j.allowPrinting || j.sharing?.enabled || j.sharing?.type || Vt && Bt;
|
|
1965
1968
|
return N.showSearch && e ? /* @__PURE__ */ I("div", { className: "h-5 w-px bg-border/50 mx-1 shrink-0" }) : null;
|
|
1966
1969
|
})(),
|
|
1967
1970
|
N.showSearch && /* @__PURE__ */ L(S, {
|
|
@@ -1988,7 +1991,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1988
1991
|
/* @__PURE__ */ I(y, {
|
|
1989
1992
|
placeholder: D("list.search") + "...",
|
|
1990
1993
|
value: F,
|
|
1991
|
-
onChange: (e) =>
|
|
1994
|
+
onChange: (e) => tn(e.target.value),
|
|
1992
1995
|
className: "pl-7 h-8 text-xs",
|
|
1993
1996
|
autoFocus: !0
|
|
1994
1997
|
}),
|
|
@@ -1996,7 +1999,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
1996
1999
|
variant: "ghost",
|
|
1997
2000
|
size: "sm",
|
|
1998
2001
|
className: "absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20",
|
|
1999
|
-
onClick: () =>
|
|
2002
|
+
onClick: () => tn(""),
|
|
2000
2003
|
children: /* @__PURE__ */ I(Ee, { className: "h-3 w-3" })
|
|
2001
2004
|
})
|
|
2002
2005
|
]
|
|
@@ -2071,7 +2074,7 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2071
2074
|
}) : void 0
|
|
2072
2075
|
});
|
|
2073
2076
|
})() : /* @__PURE__ */ I(Me, {
|
|
2074
|
-
schema:
|
|
2077
|
+
schema: rn,
|
|
2075
2078
|
..._,
|
|
2076
2079
|
data: H,
|
|
2077
2080
|
loading: U,
|
|
@@ -2172,8 +2175,8 @@ var ot = i.forwardRef(({ schema: e, className: n, onViewChange: r, onFilterChang
|
|
|
2172
2175
|
})
|
|
2173
2176
|
]
|
|
2174
2177
|
}),
|
|
2175
|
-
|
|
2176
|
-
|
|
2178
|
+
nn.isOverlay && /* @__PURE__ */ I(x, {
|
|
2179
|
+
...nn,
|
|
2177
2180
|
title: j.label ? `${j.label} Detail` : j.objectName ? `${j.objectName.charAt(0).toUpperCase() + j.objectName.slice(1)} Detail` : "Record Detail",
|
|
2178
2181
|
children: (e) => /* @__PURE__ */ I("div", {
|
|
2179
2182
|
className: "space-y-3",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime"),require("@object-ui/i18n"),require("@object-ui/react"),require("@object-ui/mobile"),require("@object-ui/permissions"),require("@object-ui/fields")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`,`@object-ui/i18n`,`@object-ui/react`,`@object-ui/mobile`,`@object-ui/permissions`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.LucideReact,e.jsxRuntime,e.ObjectUIi18n,e.ObjectUIReact,e.ObjectUIMobile,e._object_ui_permissions,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:d(h(e)),_(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v={grid:(0,a.jsx)(i.Grid,{className:`h-4 w-4`}),kanban:(0,a.jsx)(i.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,a.jsx)(i.Images,{className:`h-4 w-4`}),calendar:(0,a.jsx)(i.Calendar,{className:`h-4 w-4`}),timeline:(0,a.jsx)(i.Activity,{className:`h-4 w-4`}),gantt:(0,a.jsx)(i.GanttChartSquare,{className:`h-4 w-4`}),map:(0,a.jsx)(i.Map,{className:`h-4 w-4`}),chart:(0,a.jsx)(i.BarChart3,{className:`h-4 w-4`}),tree:(0,a.jsx)(i.ListTree,{className:`h-4 w-4`})},y={grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`},b=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:o,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=n.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>o(t)):o(t))},[c,e,o]);return t.length>=2&&t.length<=4?(0,a.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:(0,r.cn)(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,s),children:t.map(t=>{let n=t===e;return(0,a.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":y[t],title:y[t],"data-state":n?`on`:`off`,onClick:()=>d(t),className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150`,n?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[v[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:y[t]})]},t)})}):(0,a.jsxs)(r.Popover,{open:l,onOpenChange:u,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":y[e],className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher`,l?`text-foreground bg-muted`:`text-muted-foreground hover:text-foreground`,s),children:[v[e],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:y[e]}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,a.jsxs)(`button`,{type:`button`,onClick:()=>d(t),"data-state":t===e?`on`:`off`,className:(0,r.cn)(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted`,t===e?`text-foreground font-medium`:`text-muted-foreground`),children:[v[t],(0,a.jsx)(`span`,{className:`flex-1 text-left`,children:y[t]}),t===e&&(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})]},t))})]})},x=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:o,animated:s=!0})=>{let c=n.useCallback(t=>{if(!s||t===e){i(t);return}typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>i(t)):i(t)},[s,e,i]);return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,o),children:t.map(t=>{let n=e===t;return(0,a.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"aria-label":y[t],title:y[t],"aria-pressed":n,"data-state":n?`on`:`off`,className:(0,r.cn)(`inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`hover:bg-muted hover:text-muted-foreground`,`gap-2 px-3 py-2`,`data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50`),children:[v[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:y[t]})]},t)})})};function S({title:e,badge:t,onClear:o,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=n.useState(c);return(0,a.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,a.jsx)(i.ChevronDown,{className:(0,r.cn)(`h-3.5 w-3.5 transition-transform`,!u&&`-rotate-90`)}),e,typeof t==`number`&&t>0&&(0,a.jsx)(`span`,{className:`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums`,children:t})]}),o&&(0,a.jsx)(`button`,{type:`button`,onClick:o,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,a.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function C(e){let{t,allFields:o,showGroup:s,groupingConfig:c,setGroupingConfig:l,showColor:u,rowColorConfig:d,setRowColorConfig:f,showDensity:p,density:m,showHideFields:h,hiddenFields:g,updateHiddenFields:_,showInlineEdit:v,inlineEdit:y,setInlineEdit:b}=e,[x,C]=n.useState(!1),w=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,ee=m?.mode===`compact`?i.Rows4:m?.mode===`comfortable`?i.Rows3:i.Rows2,T=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,a.jsxs)(r.Popover,{open:x,onOpenChange:C,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":T,title:T,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,w>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,a.jsx)(i.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:T}),w>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:w})]})}),(0,a.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,a.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold`,children:T}),(0,a.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields.`})})]}),s&&l&&(0,a.jsx)(S,{title:t(`list.group`,{defaultValue:`Group`}),badge:c?.fields?.length||0,onClear:c?()=>l(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,a.jsx)(r.GroupingEditor,{value:c,fieldOptions:o.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:t(`list.addGroup`,`Add group field`),collapseTitle:t(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:t(`list.removeGroup`,`Remove`)},onChange:e=>l(e)})}),u&&f&&(0,a.jsxs)(S,{title:t(`list.color`,{defaultValue:`Row color`}),onClear:d?()=>f(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,a.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,a.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:d?.field||``,onChange:e=>{let t=e.target.value;f(t?{field:t,colors:d?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,a.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),o.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,a.jsx)(S,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,a.jsx)(ee,{className:`h-3.5 w-3.5`}),(0,a.jsx)(`span`,{className:`text-xs`,children:m.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):m.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,a.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,a.jsx)(S,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!y,children:(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!!y,onChange:()=>b(!y),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,a.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,a.jsx)(S,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide fields`}),badge:g.size,onClear:g.size>0?()=>_(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:g.size>0,children:(0,a.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:o.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!g.has(e.name),onChange:()=>{let t=new Set(g);t.has(e.name)?t.delete(e.name):t.add(e.name),_(t)},className:`rounded border-input`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function w(){try{let{t:e}=(0,o.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}catch{return`More`}}var ee=new Set([`lookup`,`master_detail`,`user`,`owner`]);function T(e){switch(e){case void 0:case`equals`:case`eq`:return`=`;case`not_equals`:case`ne`:case`neq`:return`!=`;case`gte`:return`>=`;case`lte`:return`<=`;case`gt`:return`>`;case`lt`:return`<`;case`not_in`:case`nin`:return`not in`;default:return e}}function E(e){return(e||[]).filter(e=>e&&(e.id||e.name)).map(e=>({id:e.id??e.name,label:typeof e.label==`string`?e.label:e.label?.toString?.()??e.id??e.name,filters:Array.isArray(e.filters)?e.filters:Array.isArray(e.filter)?e.filter.filter(e=>e&&typeof e.field==`string`).map(e=>[e.field,T(e.operator),e.value]):[],default:e.default??e.isDefault}))}function D({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c}){switch(e.element){case`dropdown`:return(0,a.jsx)(k,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,a.jsx)(A,{tabs:E(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:o,initialTab:typeof s?._tab?.[0]==`string`?s._tab[0]:void 0,onSelectionsChange:c});default:return null}}function O(e,t,n,r){return e.map(e=>{let i=e.options?[...e.options]:[],a=e.type,o,s,c;if(t?.fields){let n=Array.isArray(t.fields)?t.fields.find(t=>t.name===e.field):t.fields[e.field];n&&(a||=n.type,o=n.reference_to??n.reference,s=n.display_field??n.reference_field,c=n.id_field,i.length===0&&n.options&&(i=Array.isArray(n.options)?n.options.map(e=>({label:e.label??String(e.value??e),value:e.value??e,color:e.color})):Object.entries(n.options).map(([e,t])=>({label:t?.label||e,value:e,color:t?.color}))))}i.length===0&&a===`boolean`&&(i=[{label:`True`,value:!0},{label:`False`,value:!1}]),e.showCount&&n.length>0&&(i=i.map(t=>({...t,count:n.filter(n=>n[e.field]===t.value).length})));let l=e.label;return r?.objectName&&(i=r.translateOptions(r.objectName,e.field,i),l=r.fieldLabel(r.objectName,e.field,e.label||e.field)),{...e,label:l,type:a,options:i,referenceTo:o,displayField:s,idField:c}})}function k({fields:e,objectDef:t,data:s,onFilterChange:c,maxVisible:l,className:u,initialSelections:d,onSelectionsChange:f}){let{fieldLabel:p,translateOptions:m}=(0,o.useSafeFieldLabel)(),h=w(),g=t?.name,[_,v]=n.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=d?.[e.field];n&&n.length>0&&(t[e.field]=n)}),t}),y=n.useRef({}),b=n.useMemo(()=>O(e,t,s,{objectName:g,fieldLabel:p,translateOptions:m}).map(e=>{if(!e.showCount)return e;if((_[e.field]||[]).length===0)return y.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=y.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,s,g,p,m,_]),x=n.useCallback(e=>{c(Object.entries(e).filter(([,e])=>e.length>0).map(([e,t])=>[e,`in`,t]))},[c]),S=(e,t)=>{let n={..._,[e]:t};v(n),x(n),f?.(n)};n.useEffect(()=>{let e=_,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=b.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(v(t),e=t),Object.values(e).some(e=>e.length>0)&&x(e)},[]);let C=l!==void 0&&l<b.length?b.slice(0,l):b,T=l!==void 0&&l<b.length?b.slice(l):[],E=e=>{let t=_[e.field]||[],n=t.length>0,o=ee.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`||e.type===`owner`),s=o?`w-72`:`w-56`;return(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{"data-testid":`filter-badge-${e.field}`,className:(0,r.cn)(`inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md`,n?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,a.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),n&&(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:t.length}),n?(0,a.jsx)(i.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),S(e.field,[])}}):(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:(0,r.cn)(s,`p-2`),children:o?(0,a.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,a.jsx)(r.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField,idField:e.idField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];S(e.field,n)}})}):(0,a.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,a.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,a.jsxs)(`label`,{className:(0,r.cn)(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:t.includes(n.value),onChange:()=>{let r=t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];S(e.field,r)},className:`rounded border-input`}),n.color&&(0,a.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,a.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,u),"data-testid":`user-filters-dropdown`,children:b.length===0?(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,a.jsxs)(a.Fragment,{children:[C.map(E),T.length>0&&(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,a.jsx)(`span`,{children:h}),(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:T.length}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,a.jsx)(`div`,{className:`space-y-1`,children:T.map(E)})})]})]})})}function A({tabs:e,showAllRecords:t,allowAddTab:o,onFilterChange:s,className:c,initialTab:l,onSelectionsChange:u}){let[d,f]=n.useState(()=>l&&(l===`__all__`||e.some(e=>e.id===l))?l:e.find(e=>e.default)?.id||(t?`__all__`:e[0]?.id||``)),p=n.useCallback(t=>{f(t),s(t===`__all__`?[]:e.find(e=>e.id===t)?.filters||[]),u?.({_tab:[t]})},[e,s,u]),m=n.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]);return n.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[m.map(e=>{let t=e.id??e.name??``;return(0,a.jsx)(`button`,{"data-testid":`filter-tab-${t}`,onClick:()=>p(t),className:(0,r.cn)(`inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0`,d===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:e.label},t)}),o&&(0,a.jsx)(`button`,{className:`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0`,"data-testid":`filter-tab-add`,title:`Add filter tab`,children:(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5`})})]})}function j(e){switch(e){case`equals`:case`eq`:return`=`;case`notEquals`:case`not_equals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`notContains`:case`notcontains`:return`notcontains`;case`greaterThan`:case`gt`:return`>`;case`greaterOrEqual`:case`gte`:return`>=`;case`lessThan`:case`lt`:return`<`;case`lessOrEqual`:case`lte`:return`<=`;case`in`:return`in`;case`notIn`:case`not_in`:case`nin`:return`not in`;case`before`:return`<`;case`after`:return`>`;default:return e}}function M(e){if(!Array.isArray(e)||e.length<3)return e;let[t,n,r]=e;return typeof t==`string`&&(t===`and`||t===`or`)?[t,...e.slice(1).map(e=>Array.isArray(e)?M(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:n===`not in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function te(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ne(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?M(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function re(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=ne(e.conditions.map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:[e.field,j(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function ie(e,n){if(!n||n.length===0)return{};for(let r of n){let n=!1,i=(`condition`in r?r.condition:void 0)||(`expression`in r?r.expression:void 0)||void 0;if(i)n=(0,t.evaluatePlainCondition)(i,e);else if(`field`in r&&`operator`in r&&r.field&&r.operator){let t=e[r.field];switch(r.operator){case`equals`:n=t===r.value;break;case`not_equals`:n=t!==r.value;break;case`contains`:n=typeof t==`string`&&typeof r.value==`string`&&t.includes(r.value);break;case`greater_than`:n=typeof t==`number`&&typeof r.value==`number`&&t>r.value;break;case`less_than`:n=typeof t==`number`&&typeof r.value==`number`&&t<r.value;break;case`in`:n=Array.isArray(r.value)&&r.value.includes(t);break}}if(n){let e={};return`style`in r&&r.style&&Object.assign(e,r.style),`backgroundColor`in r&&r.backgroundColor&&(e.backgroundColor=r.backgroundColor),`textColor`in r&&r.textColor&&(e.color=r.textColor),`borderColor`in r&&r.borderColor&&(e.borderColor=r.borderColor),e}}return{}}var N={"list.recordCount":`{{count}} records`,"list.recordCountOne":`{{count}} record`,"list.noItems":`No items found`,"list.noItemsMessage":`There are no records to display. Try adjusting your filters or adding new data.`,"list.firstRunTitle":`Nothing here yet`,"list.firstRunMessage":`Create your first record to get started.`,"list.noMatches":`No matching records`,"list.noMatchesMessage":`No records match your current filters or search. Try adjusting or clearing them.`,"list.loading":`Loading records…`,"list.loadErrorTitle":`Couldn’t load records`,"list.loadErrorMessage":`Something went wrong while loading this data. Check your connection and try again.`,"list.retry":`Retry`,"list.search":`Search`,"list.filter":`Filter`,"list.filterRecords":`Filter Records`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.group":`Group`,"list.groupBy":`Group By`,"list.export":`Export`,"list.exportAs":`Export as {{format}}`,"list.color":`Color`,"list.rowColor":`Row Color`,"list.colorByField":`Color by field`,"list.clear":`Clear`,"list.none":`None`,"list.hideFields":`Hide fields`,"list.showAll":`Show all`,"list.pullToRefresh":`Pull to refresh`,"list.refreshing":`Refreshing…`,"list.dataLimitReached":`Showing first {{limit}} records. More data may be available.`,"list.addRecord":`Add record`,"list.tabs":`Tabs`,"list.allRecords":`All Records`,"list.share":`Share`,"list.print":`Print`,"list.hideFieldsTitle":`Hide Fields`,"table.rowsPerPage":`Rows per page`,"grid.toolbar.densityMode":`Density`,"grid.toolbar.densityCompact":`Compact`,"grid.toolbar.densityComfortable":`Comfortable`,"grid.toolbar.densitySpacious":`Spacious`,"grid.toolbar.densityCycleHint":`{{label}} (click to cycle)`,"grid.toolbar.densityCycleShortHint":`Click to cycle`,"list.viewSettings":`View settings`,"list.viewSettingsHint":`Grouping, color, density, and visible fields.`},P=(e,t,n)=>n,ae=(e,t)=>{let n=N[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n};function oe(){try{let e=(0,o.useObjectTranslation)();return e.t(`list.recordCount`)===`list.recordCount`?{t:ae}:{t:e.t}}catch{return{t:ae}}}function se(){try{let{fieldLabel:e,actionLabel:t}=(0,o.useObjectLabel)();return{fieldLabel:e,actionLabel:t}}catch{return{fieldLabel:P,actionLabel:void 0}}}var F=n.forwardRef(({schema:e,className:u,onViewChange:d,onFilterChange:f,onSortChange:p,onSearchChange:m,onHiddenFieldsChange:h,onInlineEditChange:g,onColumnStateChange:_,onRowClick:v,showViewSwitcher:y,userFilterSelections:x,onUserFilterSelectionsChange:S,...w},ee)=>{let T=y??e?.showViewSwitcher??!1,{t:E}=oe(),{fieldLabel:O,actionLabel:k}=se(),{translateOptions:A}=(0,o.useSafeFieldLabel)(),j=n.useMemo(()=>e.viewType&&e.viewType!==`list`?e:{...e,viewType:`grid`},[e]),M=n.useCallback((e,t)=>j.objectName?O(j.objectName,e,t):t,[j.objectName,O]),ie=n.useCallback(e=>{let t=te(e);return j.objectName&&typeof k==`function`?k(j.objectName,e,t):t},[j.objectName,k]),N=n.useMemo(()=>{let e=j.userActions,t=j.addRecord?.enabled===!0&&e?.addRecordForm!==!1;return{showSearch:e?.search===void 0?j.showSearch!==!1:e.search,showSort:e?.sort===void 0?j.showSort!==!1:e.sort,showFilters:e?.filter===void 0?j.showFilters!==!1:e.filter,showDensity:e?.rowHeight===void 0?j.showDensity!==!1:e.rowHeight,showHideFields:j.showHideFields===!0,showGroup:j.showGroup!==!1,showColor:j.showColor===!0,compactToolbar:j.compactToolbar===!0,showAddRecord:t,addRecordPosition:j.addRecord?.position===`bottom`?`bottom`:`top`}},[j.userActions,j.showSearch,j.showSort,j.showFilters,j.showDensity,j.showHideFields,j.showGroup,j.showColor,j.compactToolbar,j.addRecord,j.userActions?.addRecordForm]),[P,ae]=n.useState(j.viewType),[F,ce]=n.useState(``),[le,ue]=n.useState(!1),[de,fe]=n.useState(!1),[I,pe]=n.useState(()=>j.sort&&j.sort.length>0?j.sort.map(e=>{if(typeof e==`string`){let t=e.trim().split(/\s+/);return{id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`}}return{id:crypto.randomUUID(),field:e.field,order:e.order||`asc`}}):[]),me=n.useMemo(()=>JSON.stringify(j.sort||[]),[j.sort]);n.useEffect(()=>{j.sort&&j.sort.length>0?pe(j.sort.map(e=>{if(typeof e==`string`){let t=e.trim().split(/\s+/);return{id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`}}return{id:crypto.randomUUID(),field:e.field,order:e.order||`asc`}})):pe([])},[me]);let[he,ge]=n.useState(!1),[L,_e]=n.useState({id:`root`,logic:`and`,conditions:[]}),R=w.dataSource,[z,ve]=n.useState([]),[ye,be]=n.useState(null),[B,V]=n.useState(()=>!(Array.isArray(j.data)||j.data&&typeof j.data==`object`&&j.data.provider===`value`&&Array.isArray(j.data.items))),[H,xe]=n.useState(null),[Se,Ce]=n.useState(!1),[we,Te]=n.useState(0),[Ee,De]=n.useState(!1);n.useImperativeHandle(ee,()=>({refresh:()=>Te(e=>e+1)}),[]),n.useEffect(()=>{if(!(!R?.onMutation||!j.objectName||j.refreshTrigger))return R.onMutation(e=>{e.resource===j.objectName&&Te(e=>e+1)})},[R,j.objectName,j.refreshTrigger]);let[Oe,ke]=n.useState(void 0),U=Oe??j.pagination?.pageSize??100,[Ae,je]=n.useState(1),[Me,Ne]=n.useState(null),W=n.useMemo(()=>{if(j.grouping?.fields?.length)return j.grouping;let e=typeof j.groupBy==`string`?j.groupBy.trim():``,t=typeof j.groupBy2==`string`?j.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[j.grouping,j.groupBy,j.groupBy2]),[G,Pe]=n.useState(W),[Fe,Ie]=n.useState(!1),Le=n.useRef(W);n.useEffect(()=>{Le.current!==W&&(Le.current=W,Pe(W))},[W]);let[K,Re]=n.useState(j.rowColor),[ze,Be]=n.useState(!1),[Ve,He]=n.useState([]),Ue=n.useRef(0),[q,We]=n.useState([]),Ge=n.useMemo(()=>{let e=j.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!H?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(H.fields)?H.fields.map(e=>[e.name,e]):Object.entries(H.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:M(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[j.userFilters,H,M]),[J,Ke]=n.useState(()=>new Set(j.hiddenFields||[])),qe=n.useMemo(()=>JSON.stringify(j.hiddenFields||[]),[j.hiddenFields]);n.useEffect(()=>{Ke(new Set(j.hiddenFields||[]))},[qe]);let Je=n.useCallback(e=>{Ke(e),h?.(Array.from(e))},[h]),[Ye,Xe]=n.useState(!1),[Ze,Qe]=n.useState(!1),[$e,et]=n.useState(!1),[tt,nt]=n.useState(null),rt=j.allowExport!==!1&&j.operations?.export!==!1,Y=n.useMemo(()=>{if(j.exportOptions)return Array.isArray(j.exportOptions)?{formats:j.exportOptions}:j.exportOptions},[j.exportOptions]),X=(0,s.useDensityMode)(n.useMemo(()=>j.densityMode?j.densityMode:j.rowHeight?{compact:`compact`,short:`compact`,medium:`comfortable`,tall:`spacious`,extra_tall:`spacious`}[j.rowHeight]||`comfortable`:`compact`,[j.densityMode,j.rowHeight]),{onChange:j.onDensityChange}),it=n.useMemo(()=>`objectui:gallery:density:${j.objectName??`default`}`,[j.objectName]),[Z,at]=n.useState(()=>{if(typeof window>`u`)return j.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(it);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return j.gallery?.cardSize??`medium`}),ot=n.useCallback(()=>{at(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(it,t)}catch{}return t})},[it]),{ref:st,isRefreshing:ct,pullDistance:lt}=(0,c.usePullToRefresh)({onRefresh:n.useCallback(async()=>{Te(e=>e+1)},[]),enabled:!!R&&!!j.objectName}),ut=n.useMemo(()=>j.id?`listview-${j.objectName}-${j.id}-view`:`listview-${j.objectName}-view`,[j.objectName,j.id]);n.useEffect(()=>{let e=!0;return Ce(!1),xe(null),(async()=>{if(!R||!j.objectName){Ce(!0);return}if(typeof R.getObjectSchema!=`function`){Ce(!0);return}try{let t=await R.getObjectSchema(j.objectName);e&&xe(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&Ce(!0)}})(),()=>{e=!1}},[j.objectName,R]);let dt=n.useMemo(()=>{let e=Array.isArray(j.fields)?j.fields.map(e=>typeof e==`string`?e:e?.field).filter(e=>typeof e==`string`&&e.length>0):[],n=new Set(e),r=e=>{if(!e)return;let t=[e.groupField,e.groupBy,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.subtitleField,e.swimlaneField,e.valueField,...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)typeof e==`string`&&e&&n.add(e)};r(j.kanban),r(j.options?.kanban),r(j.calendar),r(j.options?.calendar),r(j.gallery),r(j.options?.gallery),r(j.timeline),r(j.options?.timeline),r(j.gantt),r(j.options?.gantt);let i=n.size>0?Array.from(n):void 0;return(0,t.buildExpandFields)(H?.fields,i)},[H?.fields,j.fields,j.kanban,j.calendar,j.gallery,j.timeline,j.gantt,j.options]),Q=(0,l.usePermissions)();n.useEffect(()=>{let e=!0,t=++Ue.current;if(j.data&&typeof j.data==`object`&&!Array.isArray(j.data)){let e=j.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(F){let e=F.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}ve(t),V(!1),De(!1);return}}if(Array.isArray(j.data)){let e=j.data;if(F){let t=F.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}ve(e),V(!1),De(!1);return}return Se?((async()=>{if(!R||!j.objectName){V(!1);return}V(!0),be(null);try{let n=[],r=j.filters||[],i=re(L),a=ne(q),o=[...r.length>0?[r]:[],...i.length>0?[i]:[],...a].filter(e=>Array.isArray(e)&&e.length>0);o.length>1?n=[`and`,...o]:o.length===1&&(n=o[0]);let s=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,c=(()=>{let e=Array.isArray(j.fields)?j.fields.map(e=>typeof e==`string`?e:e?.field).filter(e=>typeof e==`string`&&e.length>0):[],t=Q?.isLoaded&&j.objectName?e.filter(e=>Q.checkField(j.objectName,e,`read`)):e;if(t.length===0)return;let n=new Set([`id`]);for(let e of t)n.add(e);for(let e of dt)n.add(e);let r=(()=>{let e=H?.fields;if(!e)return null;let t=Array.isArray(e)?e.map(e=>e?.name).filter(e=>typeof e==`string`):Object.keys(e),n=new Set(t);return n.add(`id`),n.add(`created_at`),n.add(`updated_at`),n})(),i=e=>{typeof e!=`string`||!e||(!r||r.has(e))&&n.add(e)},a=e=>{if(!e)return;let t=[e.groupField,e.groupBy,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.subtitleField,e.swimlaneField,e.valueField,...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)i(e)};a(j.kanban),a(j.options?.kanban),a(j.calendar),a(j.options?.calendar),a(j.gallery),a(j.options?.gallery),a(j.timeline),a(j.options?.timeline);{let e=j.timeline??j.options?.timeline;e&&!Array.isArray(e.metaFields)&&(i(`status`),i(`priority`))}return a(j.gantt),a(j.options?.gantt),Array.from(n)})(),l=Array.isArray(n)?n.length>0:!!n&&Object.keys(n).length>0,u=P===`grid`&&!G?.fields?.length,d=u?(Ae-1)*U:0,f=await R.find(j.objectName,{...l?{$filter:n}:{},$orderby:s,$top:U,...d>0?{$skip:d}:{},...c?{$select:c}:{},...dt.length>0?{$expand:dt}:{},...F?{$search:F,...j.searchableFields&&j.searchableFields.length>0?{$searchFields:j.searchableFields}:{}}:{}});if(!e||t!==Ue.current)return;let p=[];Array.isArray(f)?p=f:f&&typeof f==`object`&&(Array.isArray(f.data)?p=f.data:Array.isArray(f.records)?p=f.records:Array.isArray(f.value)&&(p=f.value)),ve(p);let m=f&&typeof f==`object`?f.total??f.count:void 0,h=typeof m==`number`?m:null;Ne(u?h:null),De(!(u&&h!=null)&&p.length>=U)}catch(e){t===Ue.current&&(console.error(`ListView data fetch error:`,e),ve([]),be(e?.message?String(e.message):String(e??`Unknown error`)))}finally{e&&t===Ue.current&&V(!1)}})(),()=>{e=!1}):void 0},[j.objectName,j.data,R,j.filters,U,I,L,q,we,F,j.searchableFields,dt,Se,j.refreshTrigger,Q,Ae,P,G]);let ft=JSON.stringify([j.objectName,j.filters,U,I,L,q,F,P,G]),pt=n.useRef(ft);n.useEffect(()=>{pt.current!==ft&&(pt.current=ft,je(1))},[ft]);let mt=n.useMemo(()=>{let e=[`grid`];(j.kanban?.groupByField||j.kanban?.groupField||j.options?.kanban?.groupField)&&e.push(`kanban`),(j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField)&&e.push(`gallery`),(j.calendar?.startDateField||j.options?.calendar?.startDateField)&&e.push(`calendar`),(j.timeline?.startDateField||j.options?.timeline?.startDateField||j.options?.timeline?.dateField||j.options?.calendar?.startDateField)&&e.push(`timeline`),(j.gantt?.startDateField||j.options?.gantt?.startDateField)&&e.push(`gantt`),(j.options?.map?.locationField||j.options?.map?.latitudeField&&j.options?.map?.longitudeField)&&e.push(`map`),(j.tree?.parentField||j.options?.tree?.parentField||j.viewType===`tree`)&&e.push(`tree`),j.viewType&&!e.includes(j.viewType)&&[`grid`,`kanban`,`calendar`,`timeline`,`gantt`,`map`,`gallery`,`chart`,`tree`].includes(j.viewType)&&e.push(j.viewType);let t=j.appearance?.allowedVisualizations;if(Array.isArray(t)&&t.length>0){let n=t.filter(t=>e.includes(t));return n.length>0?n:[`grid`]}return e},[j.options,j.viewType,j.kanban,j.calendar,j.gantt,j.gallery,j.timeline,j.tree,j.appearance?.allowedVisualizations]);n.useEffect(()=>{j.viewType&&ae(j.viewType)},[j.viewType]);let ht=n.useCallback(e=>{ae(e);try{localStorage.setItem(ut,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}d?.(e)},[ut,d]),gt=n.useCallback(e=>{ce(e),m?.(e)},[m]),_t=(0,s.useNavigationOverlay)({navigation:j.navigation,objectName:j.objectName,onNavigate:j.onNavigate,onRowClick:v}),$=n.useMemo(()=>{let e=j.fields||[];if(Array.isArray(e)||(e=[]),Q?.isLoaded&&j.objectName&&(e=e.filter(e=>{let t=typeof e==`string`?e:e?.name||e?.fieldName||e?.field;return t?Q.checkField(j.objectName,t,`read`):!0})),J.size>0&&(e=e.filter(e=>{let t=typeof e==`string`?e:e?.name||e?.fieldName||e?.field;return t!=null&&!J.has(t)})),j.fieldOrder&&j.fieldOrder.length>0){let t=new Map(j.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,n)=>{let r=typeof e==`string`?e:e?.name||e?.fieldName||e?.field,i=typeof n==`string`?n:n?.name||n?.fieldName||n?.field;return(t.get(r)??1/0)-(t.get(i)??1/0)})}return e},[j.fields,j.objectName,J,j.fieldOrder,Q]),vt=n.useMemo(()=>{let e=X.mode===`compact`?`compact`:X.mode===`spacious`?`tall`:`medium`,t={objectName:j.objectName,fields:$,filters:j.filters,sort:I,className:`h-full w-full`,showSearch:!1,onRowClick:_t.handleClick,rowHeight:e,hideRowHeightToggle:!0,...j.striped==null?{}:{striped:j.striped},...j.bordered==null?{}:{bordered:j.bordered},..._?{onColumnStateChange:_}:{},...j.columnState?{columnState:j.columnState}:{}};switch(P){default:case`grid`:return{type:`object-grid`,...t,columns:$,...j.conditionalFormatting?{conditionalFormatting:j.conditionalFormatting}:{},...j.inlineEdit==null?{}:{editable:j.inlineEdit},...j.wrapHeaders==null?{}:{wrapHeaders:j.wrapHeaders},...j.virtualScroll==null?{}:{virtualScroll:j.virtualScroll},...j.resizable==null?{}:{resizable:j.resizable},...j.selection?{selection:j.selection}:{},...j.pagination?{pagination:j.pagination}:{},...G?{grouping:G}:{},...K?{rowColor:K}:{},...j.rowActions?{rowActions:j.rowActions}:{},...j.rowActionDefs?{rowActionDefs:j.rowActionDefs}:{},...j.bulkActions?{batchActions:j.bulkActions}:{},...j.bulkActionDefs?{bulkActionDefs:j.bulkActionDefs}:{},...j.options?.grid||{}};case`kanban`:return{type:`object-kanban`,...t,groupBy:j.kanban?.groupField||j.options?.kanban?.groupField||`status`,groupField:j.kanban?.groupField||j.options?.kanban?.groupField||`status`,...j.kanban?.titleField||j.options?.kanban?.titleField?{titleField:j.kanban?.titleField||j.options?.kanban?.titleField}:{},cardFields:j.kanban?.cardFields||$||[],...G?{grouping:G}:{},...j.options?.kanban||{},...j.kanban||{}};case`calendar`:return{type:`object-calendar`,...t,startDateField:j.calendar?.startDateField||j.options?.calendar?.startDateField||`start_date`,endDateField:j.calendar?.endDateField||j.options?.calendar?.endDateField||`end_date`,...j.calendar?.titleField||j.options?.calendar?.titleField?{titleField:j.calendar?.titleField||j.options?.calendar?.titleField}:{},...j.calendar?.defaultView?{defaultView:j.calendar.defaultView}:{},...j.options?.calendar||{},...j.calendar||{}};case`gallery`:{let e={...j.options?.gallery||{},...j.gallery||{},cardSize:Z};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField,titleField:j.gallery?.titleField||j.options?.gallery?.titleField||`name`,subtitleField:j.gallery?.subtitleField||j.options?.gallery?.subtitleField,...G?{grouping:G}:{}}}case`timeline`:{let e={...j.options?.timeline||{},...j.timeline||{}};return{type:`object-timeline`,...t,timeline:Object.keys(e).length>0?e:void 0,startDateField:j.timeline?.startDateField||j.options?.timeline?.startDateField||j.options?.timeline?.dateField||`created_at`,titleField:j.timeline?.titleField||j.options?.timeline?.titleField||`name`,...j.timeline?.endDateField?{endDateField:j.timeline.endDateField}:{},...j.timeline?.groupByField?{groupByField:j.timeline.groupByField}:{},...j.timeline?.colorField?{colorField:j.timeline.colorField}:{},...j.timeline?.scale?{scale:j.timeline.scale}:{}}}case`gantt`:return{type:`object-gantt`,...t,startDateField:j.gantt?.startDateField||j.options?.gantt?.startDateField||`start_date`,endDateField:j.gantt?.endDateField||j.options?.gantt?.endDateField||`end_date`,progressField:j.gantt?.progressField||j.options?.gantt?.progressField||`progress`,dependenciesField:j.gantt?.dependenciesField||j.options?.gantt?.dependenciesField||`dependencies`,...j.gantt?.titleField?{titleField:j.gantt.titleField}:{},...j.options?.gantt||{},...j.gantt||{}};case`map`:return{type:`object-map`,...t,locationField:j.options?.map?.locationField||`location`,...j.options?.map||{}};case`tree`:{let e=j.tree||j.options?.tree||{};return{type:`object-tree`,...t,parentField:e.parentField,labelField:e.labelField||e.titleField||`name`,fields:e.fields||$,defaultExpandedDepth:e.defaultExpandedDepth,...e}}case`chart`:{let e=j.chart||j.options?.chart||{};if(e.dataset){let t=Array.isArray(e.dimensions)?e.dimensions:[],n=Array.isArray(e.values)?e.values:[];return{type:`object-chart`,dataset:e.dataset,dimensions:t,values:n,chartType:e.chartType||`bar`,xAxisKey:t[0],series:n.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let t=Array.isArray(e.yAxisFields)&&e.yAxisFields[0]||e.valueField||`value`,n=e.xAxisField||e.categoryField||`name`;return{type:`object-chart`,objectName:j.objectName,chartType:e.chartType||`bar`,filters:j.filters,aggregate:{field:t,function:e.aggregation||`count`,groupBy:n},xAxisKey:n,series:[{dataKey:t,label:t}],className:`h-[400px] w-full`}}}},[P,j,I,$,G,K,_t.handleClick,X.mode,Z]),yt=L.conditions&&L.conditions.length>0,bt=n.useMemo(()=>{let e,t=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return j.objectName?A(j.objectName,e,n):n};if(e=H?.fields?Object.entries(H.fields).map(([e,n])=>({value:e,label:M(e,n.label||e),type:n.type||`text`,options:t(e,n.options),referenceTo:n.reference_to||n.reference,displayField:n.display_field||n.reference_field,idField:n.id_field})):(j.fields||[]).map(e=>{if(typeof e==`string`)return{value:e,label:e,type:`text`};let n=e.name||e.fieldName;return{value:n,label:M(n,e.label||e.name),type:e.type||`text`,options:t(n,e.options),referenceTo:e.reference_to||e.reference,displayField:e.display_field||e.reference_field,idField:e.id_field}}),j.filterableFields&&j.filterableFields.length>0){let t=new Set(j.filterableFields);e=e.filter(e=>t.has(e.value))}return e},[H,j.fields,j.filterableFields,j.objectName,M,A]),xt=n.useCallback(e=>{if(!rt)return;let t=Y,n=t?.maxRecords||0,r=t?.includeHeaders!==!1,i=t?.fileNamePrefix||j.objectName||`export`;if((e===`csv`||e===`xlsx`||e===`json`)&&typeof R?.exportDownload==`function`&&j.objectName&&t?.streaming!==!1){let t=$.map(e=>typeof e==`string`?e:e.name||e.fieldName||e.field).filter(Boolean),a=j.filters||[],o=re(L),s=ne(q),c=[...a.length>0?[a]:[],...o.length>0?[o]:[],...s].filter(e=>Array.isArray(e)&&e.length>0),l=c.length>1?[`and`,...c]:c.length===1?c[0]:void 0,u=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;nt(null),et(!0),(async()=>{try{let a=await R.exportDownload(j.objectName,{format:e,fields:t.length?t:void 0,filter:l,sort:u,includeHeaders:r,limit:n>0?n:void 0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`${i}.${e}`,s.rel=`noopener`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o),Qe(!1)}catch(e){console.error(`ListView export failed:`,e),nt(e instanceof Error?e.message:String(e))}finally{et(!1)}})();return}let a=n>0?z.slice(0,n):z;if(e===`csv`){let e=$.map(e=>typeof e==`string`?e:e.name||e.fieldName||e.field),t=[];r&&t.push(e.join(`,`)),a.forEach(n=>{t.push(e.map(e=>{let t=n[e],r;return r=t==null?``:Array.isArray(t)?t.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof t==`object`?JSON.stringify(t):String(t),r.includes(`,`)||r.includes(`"`)||r.includes(`
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime"),require("@object-ui/i18n"),require("@object-ui/react"),require("@object-ui/mobile"),require("@object-ui/permissions"),require("@object-ui/fields")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`,`@object-ui/i18n`,`@object-ui/react`,`@object-ui/mobile`,`@object-ui/permissions`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.LucideReact,e.jsxRuntime,e.ObjectUIi18n,e.ObjectUIReact,e.ObjectUIMobile,e._object_ui_permissions,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:d(h(e)),_(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v={grid:(0,a.jsx)(i.Grid,{className:`h-4 w-4`}),kanban:(0,a.jsx)(i.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,a.jsx)(i.Images,{className:`h-4 w-4`}),calendar:(0,a.jsx)(i.Calendar,{className:`h-4 w-4`}),timeline:(0,a.jsx)(i.Activity,{className:`h-4 w-4`}),gantt:(0,a.jsx)(i.GanttChartSquare,{className:`h-4 w-4`}),map:(0,a.jsx)(i.Map,{className:`h-4 w-4`}),chart:(0,a.jsx)(i.BarChart3,{className:`h-4 w-4`}),tree:(0,a.jsx)(i.ListTree,{className:`h-4 w-4`})},y={grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`},b=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:o,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=n.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>o(t)):o(t))},[c,e,o]);return t.length>=2&&t.length<=4?(0,a.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:(0,r.cn)(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,s),children:t.map(t=>{let n=t===e;return(0,a.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":y[t],title:y[t],"data-state":n?`on`:`off`,onClick:()=>d(t),className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150`,n?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[v[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:y[t]})]},t)})}):(0,a.jsxs)(r.Popover,{open:l,onOpenChange:u,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":y[e],className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher`,l?`text-foreground bg-muted`:`text-muted-foreground hover:text-foreground`,s),children:[v[e],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:y[e]}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,a.jsxs)(`button`,{type:`button`,onClick:()=>d(t),"data-state":t===e?`on`:`off`,className:(0,r.cn)(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted`,t===e?`text-foreground font-medium`:`text-muted-foreground`),children:[v[t],(0,a.jsx)(`span`,{className:`flex-1 text-left`,children:y[t]}),t===e&&(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})]},t))})]})},x=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:o,animated:s=!0})=>{let c=n.useCallback(t=>{if(!s||t===e){i(t);return}typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>i(t)):i(t)},[s,e,i]);return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,o),children:t.map(t=>{let n=e===t;return(0,a.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"aria-label":y[t],title:y[t],"aria-pressed":n,"data-state":n?`on`:`off`,className:(0,r.cn)(`inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`hover:bg-muted hover:text-muted-foreground`,`gap-2 px-3 py-2`,`data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50`),children:[v[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:y[t]})]},t)})})};function S({title:e,badge:t,onClear:o,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=n.useState(c);return(0,a.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,a.jsx)(i.ChevronDown,{className:(0,r.cn)(`h-3.5 w-3.5 transition-transform`,!u&&`-rotate-90`)}),e,typeof t==`number`&&t>0&&(0,a.jsx)(`span`,{className:`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums`,children:t})]}),o&&(0,a.jsx)(`button`,{type:`button`,onClick:o,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,a.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function C(e){let{t,allFields:o,showGroup:s,groupingConfig:c,setGroupingConfig:l,showColor:u,rowColorConfig:d,setRowColorConfig:f,showDensity:p,density:m,showHideFields:h,hiddenFields:g,updateHiddenFields:_,showInlineEdit:v,inlineEdit:y,setInlineEdit:b}=e,[x,C]=n.useState(!1),w=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,ee=m?.mode===`compact`?i.Rows4:m?.mode===`comfortable`?i.Rows3:i.Rows2,T=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,a.jsxs)(r.Popover,{open:x,onOpenChange:C,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":T,title:T,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,w>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,a.jsx)(i.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:T}),w>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:w})]})}),(0,a.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,a.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold`,children:T}),(0,a.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields.`})})]}),s&&l&&(0,a.jsx)(S,{title:t(`list.group`,{defaultValue:`Group`}),badge:c?.fields?.length||0,onClear:c?()=>l(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,a.jsx)(r.GroupingEditor,{value:c,fieldOptions:o.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:t(`list.addGroup`,`Add group field`),collapseTitle:t(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:t(`list.removeGroup`,`Remove`)},onChange:e=>l(e)})}),u&&f&&(0,a.jsxs)(S,{title:t(`list.color`,{defaultValue:`Row color`}),onClear:d?()=>f(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,a.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,a.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:d?.field||``,onChange:e=>{let t=e.target.value;f(t?{field:t,colors:d?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,a.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),o.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,a.jsx)(S,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,a.jsx)(ee,{className:`h-3.5 w-3.5`}),(0,a.jsx)(`span`,{className:`text-xs`,children:m.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):m.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,a.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,a.jsx)(S,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!y,children:(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!!y,onChange:()=>b(!y),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,a.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,a.jsx)(S,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide fields`}),badge:g.size,onClear:g.size>0?()=>_(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:g.size>0,children:(0,a.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:o.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!g.has(e.name),onChange:()=>{let t=new Set(g);t.has(e.name)?t.delete(e.name):t.add(e.name),_(t)},className:`rounded border-input`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function w(){try{let{t:e}=(0,o.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}catch{return`More`}}var ee=new Set([`lookup`,`master_detail`,`user`,`owner`]);function T(e){switch(e){case void 0:case`equals`:case`eq`:return`=`;case`not_equals`:case`ne`:case`neq`:return`!=`;case`gte`:return`>=`;case`lte`:return`<=`;case`gt`:return`>`;case`lt`:return`<`;case`not_in`:case`nin`:return`not in`;default:return e}}function E(e){return(e||[]).filter(e=>e&&(e.id||e.name)).map(e=>({id:e.id??e.name,label:typeof e.label==`string`?e.label:e.label?.toString?.()??e.id??e.name,filters:Array.isArray(e.filters)?e.filters:Array.isArray(e.filter)?e.filter.filter(e=>e&&typeof e.field==`string`).map(e=>[e.field,T(e.operator),e.value]):[],default:e.default??e.isDefault}))}function D({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c}){switch(e.element){case`dropdown`:return(0,a.jsx)(k,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,a.jsx)(A,{tabs:E(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:o,initialTab:typeof s?._tab?.[0]==`string`?s._tab[0]:void 0,onSelectionsChange:c});default:return null}}function O(e,t,n,r){return e.map(e=>{let i=e.options?[...e.options]:[],a=e.type,o,s,c;if(t?.fields){let n=Array.isArray(t.fields)?t.fields.find(t=>t.name===e.field):t.fields[e.field];n&&(a||=n.type,o=n.reference_to??n.reference,s=n.display_field??n.reference_field,c=n.id_field,i.length===0&&n.options&&(i=Array.isArray(n.options)?n.options.map(e=>({label:e.label??String(e.value??e),value:e.value??e,color:e.color})):Object.entries(n.options).map(([e,t])=>({label:t?.label||e,value:e,color:t?.color}))))}i.length===0&&a===`boolean`&&(i=[{label:`True`,value:!0},{label:`False`,value:!1}]),e.showCount&&n.length>0&&(i=i.map(t=>({...t,count:n.filter(n=>n[e.field]===t.value).length})));let l=e.label;return r?.objectName&&(i=r.translateOptions(r.objectName,e.field,i),l=r.fieldLabel(r.objectName,e.field,e.label||e.field)),{...e,label:l,type:a,options:i,referenceTo:o,displayField:s,idField:c}})}function k({fields:e,objectDef:t,data:s,onFilterChange:c,maxVisible:l,className:u,initialSelections:d,onSelectionsChange:f}){let{fieldLabel:p,translateOptions:m}=(0,o.useSafeFieldLabel)(),h=w(),g=t?.name,[_,v]=n.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=d?.[e.field];n&&n.length>0&&(t[e.field]=n)}),t}),y=n.useRef({}),b=n.useMemo(()=>O(e,t,s,{objectName:g,fieldLabel:p,translateOptions:m}).map(e=>{if(!e.showCount)return e;if((_[e.field]||[]).length===0)return y.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=y.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,s,g,p,m,_]),x=n.useCallback(e=>{c(Object.entries(e).filter(([,e])=>e.length>0).map(([e,t])=>[e,`in`,t]))},[c]),S=(e,t)=>{let n={..._,[e]:t};v(n),x(n),f?.(n)};n.useEffect(()=>{let e=_,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=b.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(v(t),e=t),Object.values(e).some(e=>e.length>0)&&x(e)},[]);let C=l!==void 0&&l<b.length?b.slice(0,l):b,T=l!==void 0&&l<b.length?b.slice(l):[],E=e=>{let t=_[e.field]||[],n=t.length>0,o=ee.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`||e.type===`owner`),s=o?`w-72`:`w-56`;return(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{"data-testid":`filter-badge-${e.field}`,className:(0,r.cn)(`inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md`,n?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,a.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),n&&(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:t.length}),n?(0,a.jsx)(i.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),S(e.field,[])}}):(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:(0,r.cn)(s,`p-2`),children:o?(0,a.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,a.jsx)(r.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField,idField:e.idField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];S(e.field,n)}})}):(0,a.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,a.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,a.jsxs)(`label`,{className:(0,r.cn)(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:t.includes(n.value),onChange:()=>{let r=t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];S(e.field,r)},className:`rounded border-input`}),n.color&&(0,a.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,a.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,u),"data-testid":`user-filters-dropdown`,children:b.length===0?(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,a.jsxs)(a.Fragment,{children:[C.map(E),T.length>0&&(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,a.jsx)(`span`,{children:h}),(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:T.length}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,a.jsx)(`div`,{className:`space-y-1`,children:T.map(E)})})]})]})})}function A({tabs:e,showAllRecords:t,allowAddTab:o,onFilterChange:s,className:c,initialTab:l,onSelectionsChange:u}){let[d,f]=n.useState(()=>l&&(l===`__all__`||e.some(e=>e.id===l))?l:e.find(e=>e.default)?.id||(t?`__all__`:e[0]?.id||``)),p=n.useCallback(t=>{f(t),s(t===`__all__`?[]:e.find(e=>e.id===t)?.filters||[]),u?.({_tab:[t]})},[e,s,u]),m=n.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]);return n.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[m.map(e=>{let t=e.id??e.name??``;return(0,a.jsx)(`button`,{"data-testid":`filter-tab-${t}`,onClick:()=>p(t),className:(0,r.cn)(`inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0`,d===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:e.label},t)}),o&&(0,a.jsx)(`button`,{className:`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0`,"data-testid":`filter-tab-add`,title:`Add filter tab`,children:(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5`})})]})}function j(e){switch(e){case`equals`:case`eq`:return`=`;case`notEquals`:case`not_equals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`notContains`:case`notcontains`:return`notcontains`;case`greaterThan`:case`gt`:return`>`;case`greaterOrEqual`:case`gte`:return`>=`;case`lessThan`:case`lt`:return`<`;case`lessOrEqual`:case`lte`:return`<=`;case`in`:return`in`;case`notIn`:case`not_in`:case`nin`:return`not in`;case`before`:return`<`;case`after`:return`>`;default:return e}}function M(e){if(!Array.isArray(e)||e.length<3)return e;let[t,n,r]=e;return typeof t==`string`&&(t===`and`||t===`or`)?[t,...e.slice(1).map(e=>Array.isArray(e)?M(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:n===`not in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function te(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ne(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?M(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function re(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=ne(e.conditions.map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:[e.field,j(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function ie(e,n){if(!n||n.length===0)return{};for(let r of n){let n=!1,i=(`condition`in r?r.condition:void 0)||(`expression`in r?r.expression:void 0)||void 0;if(i)n=(0,t.evaluatePlainCondition)(i,e);else if(`field`in r&&`operator`in r&&r.field&&r.operator){let t=e[r.field];switch(r.operator){case`equals`:n=t===r.value;break;case`not_equals`:n=t!==r.value;break;case`contains`:n=typeof t==`string`&&typeof r.value==`string`&&t.includes(r.value);break;case`greater_than`:n=typeof t==`number`&&typeof r.value==`number`&&t>r.value;break;case`less_than`:n=typeof t==`number`&&typeof r.value==`number`&&t<r.value;break;case`in`:n=Array.isArray(r.value)&&r.value.includes(t);break}}if(n){let e={};return`style`in r&&r.style&&Object.assign(e,r.style),`backgroundColor`in r&&r.backgroundColor&&(e.backgroundColor=r.backgroundColor),`textColor`in r&&r.textColor&&(e.color=r.textColor),`borderColor`in r&&r.borderColor&&(e.borderColor=r.borderColor),e}}return{}}var N={"list.recordCount":`{{count}} records`,"list.recordCountOne":`{{count}} record`,"list.noItems":`No items found`,"list.noItemsMessage":`There are no records to display. Try adjusting your filters or adding new data.`,"list.firstRunTitle":`Nothing here yet`,"list.firstRunMessage":`Create your first record to get started.`,"list.noMatches":`No matching records`,"list.noMatchesMessage":`No records match your current filters or search. Try adjusting or clearing them.`,"list.loading":`Loading records…`,"list.loadErrorTitle":`Couldn’t load records`,"list.loadErrorMessage":`Something went wrong while loading this data. Check your connection and try again.`,"list.retry":`Retry`,"list.search":`Search`,"list.filter":`Filter`,"list.filterRecords":`Filter Records`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.group":`Group`,"list.groupBy":`Group By`,"list.export":`Export`,"list.exportAs":`Export as {{format}}`,"list.color":`Color`,"list.rowColor":`Row Color`,"list.colorByField":`Color by field`,"list.clear":`Clear`,"list.none":`None`,"list.hideFields":`Hide fields`,"list.showAll":`Show all`,"list.pullToRefresh":`Pull to refresh`,"list.refreshing":`Refreshing…`,"list.dataLimitReached":`Showing first {{limit}} records. More data may be available.`,"list.addRecord":`Add record`,"list.tabs":`Tabs`,"list.allRecords":`All Records`,"list.share":`Share`,"list.print":`Print`,"list.hideFieldsTitle":`Hide Fields`,"table.rowsPerPage":`Rows per page`,"grid.toolbar.densityMode":`Density`,"grid.toolbar.densityCompact":`Compact`,"grid.toolbar.densityComfortable":`Comfortable`,"grid.toolbar.densitySpacious":`Spacious`,"grid.toolbar.densityCycleHint":`{{label}} (click to cycle)`,"grid.toolbar.densityCycleShortHint":`Click to cycle`,"list.viewSettings":`View settings`,"list.viewSettingsHint":`Grouping, color, density, and visible fields.`},P=(e,t,n)=>n,ae=(e,t)=>{let n=N[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n};function oe(){try{let e=(0,o.useObjectTranslation)();return e.t(`list.recordCount`)===`list.recordCount`?{t:ae}:{t:e.t}}catch{return{t:ae}}}function se(){try{let{fieldLabel:e,actionLabel:t}=(0,o.useObjectLabel)();return{fieldLabel:e,actionLabel:t}}catch{return{fieldLabel:P,actionLabel:void 0}}}var F=n.forwardRef(({schema:e,className:u,onViewChange:d,onFilterChange:f,onSortChange:p,onSearchChange:m,onHiddenFieldsChange:h,onInlineEditChange:g,onColumnStateChange:_,onRowClick:v,showViewSwitcher:y,userFilterSelections:x,onUserFilterSelectionsChange:S,...w},ee)=>{let T=y??e?.showViewSwitcher??!1,{t:E}=oe(),{fieldLabel:O,actionLabel:k}=se(),{translateOptions:A}=(0,o.useSafeFieldLabel)(),j=n.useMemo(()=>e.viewType&&e.viewType!==`list`?e:{...e,viewType:`grid`},[e]),M=n.useCallback((e,t)=>j.objectName?O(j.objectName,e,t):t,[j.objectName,O]),ie=n.useCallback(e=>{let t=te(e);return j.objectName&&typeof k==`function`?k(j.objectName,e,t):t},[j.objectName,k]),N=n.useMemo(()=>{let e=j.userActions,t=j.addRecord?.enabled===!0&&e?.addRecordForm!==!1;return{showSearch:e?.search===void 0?j.showSearch!==!1:e.search,showSort:e?.sort===void 0?j.showSort!==!1:e.sort,showFilters:e?.filter===void 0?j.showFilters!==!1:e.filter,showDensity:e?.rowHeight===void 0?j.showDensity!==!1:e.rowHeight,showHideFields:j.showHideFields===!0,showGroup:j.showGroup!==!1,showColor:j.showColor===!0,compactToolbar:j.compactToolbar===!0,showAddRecord:t,addRecordPosition:j.addRecord?.position===`bottom`?`bottom`:`top`}},[j.userActions,j.showSearch,j.showSort,j.showFilters,j.showDensity,j.showHideFields,j.showGroup,j.showColor,j.compactToolbar,j.addRecord,j.userActions?.addRecordForm]),[P,ae]=n.useState(j.viewType),[F,ce]=n.useState(``),[le,ue]=n.useState(!1),[de,fe]=n.useState(!1),[I,pe]=n.useState(()=>j.sort&&j.sort.length>0?j.sort.map(e=>{if(typeof e==`string`){let t=e.trim().split(/\s+/);return{id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`}}return{id:crypto.randomUUID(),field:e.field,order:e.order||`asc`}}):[]),me=n.useMemo(()=>JSON.stringify(j.sort||[]),[j.sort]);n.useEffect(()=>{j.sort&&j.sort.length>0?pe(j.sort.map(e=>{if(typeof e==`string`){let t=e.trim().split(/\s+/);return{id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`}}return{id:crypto.randomUUID(),field:e.field,order:e.order||`asc`}})):pe([])},[me]);let[he,ge]=n.useState(!1),[L,_e]=n.useState({id:`root`,logic:`and`,conditions:[]}),R=w.dataSource,[z,ve]=n.useState([]),[ye,be]=n.useState(null),[B,xe]=n.useState(()=>!(Array.isArray(j.data)||j.data&&typeof j.data==`object`&&j.data.provider===`value`&&Array.isArray(j.data.items))),[V,Se]=n.useState(null),[Ce,we]=n.useState(!1),[Te,Ee]=n.useState(0),[De,Oe]=n.useState(!1);n.useImperativeHandle(ee,()=>({refresh:()=>Ee(e=>e+1)}),[]),n.useEffect(()=>{if(!(!R?.onMutation||!j.objectName))return R.onMutation(e=>{e.resource===j.objectName&&Ee(e=>e+1)})},[R,j.objectName]);let[ke,Ae]=n.useState(void 0),H=ke??j.pagination?.pageSize??100,[je,Me]=n.useState(1),[Ne,Pe]=n.useState(null),U=n.useMemo(()=>{if(j.grouping?.fields?.length)return j.grouping;let e=typeof j.groupBy==`string`?j.groupBy.trim():``,t=typeof j.groupBy2==`string`?j.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[j.grouping,j.groupBy,j.groupBy2]),[W,Fe]=n.useState(U),[Ie,Le]=n.useState(!1),Re=n.useRef(U);n.useEffect(()=>{Re.current!==U&&(Re.current=U,Fe(U))},[U]);let[G,ze]=n.useState(j.rowColor),[Be,Ve]=n.useState(!1),[He,Ue]=n.useState([]),We=n.useRef(0),[K,Ge]=n.useState([]),Ke=n.useMemo(()=>{let e=j.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!V?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(V.fields)?V.fields.map(e=>[e.name,e]):Object.entries(V.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:M(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[j.userFilters,V,M]),[q,qe]=n.useState(()=>new Set(j.hiddenFields||[])),Je=n.useMemo(()=>JSON.stringify(j.hiddenFields||[]),[j.hiddenFields]);n.useEffect(()=>{qe(new Set(j.hiddenFields||[]))},[Je]);let Ye=n.useCallback(e=>{qe(e),h?.(Array.from(e))},[h]),[Xe,Ze]=n.useState(!1),[J,Qe]=n.useState(()=>!!j.inlineEdit);n.useEffect(()=>{Qe(!!j.inlineEdit)},[j.inlineEdit]);let $e=n.useCallback(e=>{Qe(e),g?.(e)},[g]),[et,tt]=n.useState(!1),[nt,rt]=n.useState(!1),[it,at]=n.useState(null),ot=j.allowExport!==!1&&j.operations?.export!==!1,Y=n.useMemo(()=>{if(j.exportOptions)return Array.isArray(j.exportOptions)?{formats:j.exportOptions}:j.exportOptions},[j.exportOptions]),X=(0,s.useDensityMode)(n.useMemo(()=>j.densityMode?j.densityMode:j.rowHeight?{compact:`compact`,short:`compact`,medium:`comfortable`,tall:`spacious`,extra_tall:`spacious`}[j.rowHeight]||`comfortable`:`compact`,[j.densityMode,j.rowHeight]),{onChange:j.onDensityChange}),st=n.useMemo(()=>`objectui:gallery:density:${j.objectName??`default`}`,[j.objectName]),[Z,ct]=n.useState(()=>{if(typeof window>`u`)return j.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(st);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return j.gallery?.cardSize??`medium`}),lt=n.useCallback(()=>{ct(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(st,t)}catch{}return t})},[st]),{ref:ut,isRefreshing:dt,pullDistance:ft}=(0,c.usePullToRefresh)({onRefresh:n.useCallback(async()=>{Ee(e=>e+1)},[]),enabled:!!R&&!!j.objectName}),pt=n.useMemo(()=>j.id?`listview-${j.objectName}-${j.id}-view`:`listview-${j.objectName}-view`,[j.objectName,j.id]);n.useEffect(()=>{let e=!0;return we(!1),Se(null),(async()=>{if(!R||!j.objectName){we(!0);return}if(typeof R.getObjectSchema!=`function`){we(!0);return}try{let t=await R.getObjectSchema(j.objectName);e&&Se(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&we(!0)}})(),()=>{e=!1}},[j.objectName,R]);let mt=n.useMemo(()=>{let e=Array.isArray(j.fields)?j.fields.map(e=>typeof e==`string`?e:e?.field).filter(e=>typeof e==`string`&&e.length>0):[],n=new Set(e),r=e=>{if(!e)return;let t=[e.groupField,e.groupBy,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.subtitleField,e.swimlaneField,e.valueField,...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)typeof e==`string`&&e&&n.add(e)};r(j.kanban),r(j.options?.kanban),r(j.calendar),r(j.options?.calendar),r(j.gallery),r(j.options?.gallery),r(j.timeline),r(j.options?.timeline),r(j.gantt),r(j.options?.gantt);let i=n.size>0?Array.from(n):void 0;return(0,t.buildExpandFields)(V?.fields,i)},[V?.fields,j.fields,j.kanban,j.calendar,j.gallery,j.timeline,j.gantt,j.options]),Q=(0,l.usePermissions)();n.useEffect(()=>{let e=!0,t=++We.current;if(j.data&&typeof j.data==`object`&&!Array.isArray(j.data)){let e=j.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(F){let e=F.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}ve(t),xe(!1),Oe(!1);return}}if(Array.isArray(j.data)){let e=j.data;if(F){let t=F.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}ve(e),xe(!1),Oe(!1);return}return Ce?((async()=>{if(!R||!j.objectName){xe(!1);return}xe(!0),be(null);try{let n=[],r=j.filters||[],i=re(L),a=ne(K),o=[...r.length>0?[r]:[],...i.length>0?[i]:[],...a].filter(e=>Array.isArray(e)&&e.length>0);o.length>1?n=[`and`,...o]:o.length===1&&(n=o[0]);let s=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,c=(()=>{let e=Array.isArray(j.fields)?j.fields.map(e=>typeof e==`string`?e:e?.field).filter(e=>typeof e==`string`&&e.length>0):[],t=Q?.isLoaded&&j.objectName?e.filter(e=>Q.checkField(j.objectName,e,`read`)):e;if(t.length===0)return;let n=new Set([`id`]);for(let e of t)n.add(e);for(let e of mt)n.add(e);let r=(()=>{let e=V?.fields;if(!e)return null;let t=Array.isArray(e)?e.map(e=>e?.name).filter(e=>typeof e==`string`):Object.keys(e),n=new Set(t);return n.add(`id`),n.add(`created_at`),n.add(`updated_at`),n})(),i=e=>{typeof e!=`string`||!e||(!r||r.has(e))&&n.add(e)},a=e=>{if(!e)return;let t=[e.groupField,e.groupBy,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.subtitleField,e.swimlaneField,e.valueField,...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)i(e)};a(j.kanban),a(j.options?.kanban),a(j.calendar),a(j.options?.calendar),a(j.gallery),a(j.options?.gallery),a(j.timeline),a(j.options?.timeline);{let e=j.timeline??j.options?.timeline;e&&!Array.isArray(e.metaFields)&&(i(`status`),i(`priority`))}return a(j.gantt),a(j.options?.gantt),Array.from(n)})(),l=Array.isArray(n)?n.length>0:!!n&&Object.keys(n).length>0,u=P===`grid`&&!W?.fields?.length,d=u?(je-1)*H:0,f=await R.find(j.objectName,{...l?{$filter:n}:{},$orderby:s,$top:H,...d>0?{$skip:d}:{},...c?{$select:c}:{},...mt.length>0?{$expand:mt}:{},...F?{$search:F,...j.searchableFields&&j.searchableFields.length>0?{$searchFields:j.searchableFields}:{}}:{}});if(!e||t!==We.current)return;let p=[];Array.isArray(f)?p=f:f&&typeof f==`object`&&(Array.isArray(f.data)?p=f.data:Array.isArray(f.records)?p=f.records:Array.isArray(f.value)&&(p=f.value)),ve(p);let m=f&&typeof f==`object`?f.total??f.count:void 0,h=typeof m==`number`?m:null;Pe(u?h:null),Oe(!(u&&h!=null)&&p.length>=H)}catch(e){t===We.current&&(console.error(`ListView data fetch error:`,e),ve([]),be(e?.message?String(e.message):String(e??`Unknown error`)))}finally{e&&t===We.current&&xe(!1)}})(),()=>{e=!1}):void 0},[j.objectName,j.data,R,j.filters,H,I,L,K,Te,F,j.searchableFields,mt,Ce,j.refreshTrigger,Q,je,P,W]);let ht=JSON.stringify([j.objectName,j.filters,H,I,L,K,F,P,W]),gt=n.useRef(ht);n.useEffect(()=>{gt.current!==ht&&(gt.current=ht,Me(1))},[ht]);let _t=n.useMemo(()=>{let e=[`grid`];(j.kanban?.groupByField||j.kanban?.groupField||j.options?.kanban?.groupField)&&e.push(`kanban`),(j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField)&&e.push(`gallery`),(j.calendar?.startDateField||j.options?.calendar?.startDateField)&&e.push(`calendar`),(j.timeline?.startDateField||j.options?.timeline?.startDateField||j.options?.timeline?.dateField||j.options?.calendar?.startDateField)&&e.push(`timeline`),(j.gantt?.startDateField||j.options?.gantt?.startDateField)&&e.push(`gantt`),(j.options?.map?.locationField||j.options?.map?.latitudeField&&j.options?.map?.longitudeField)&&e.push(`map`),(j.tree?.parentField||j.options?.tree?.parentField||j.viewType===`tree`)&&e.push(`tree`),j.viewType&&!e.includes(j.viewType)&&[`grid`,`kanban`,`calendar`,`timeline`,`gantt`,`map`,`gallery`,`chart`,`tree`].includes(j.viewType)&&e.push(j.viewType);let t=j.appearance?.allowedVisualizations;if(Array.isArray(t)&&t.length>0){let n=t.filter(t=>e.includes(t));return n.length>0?n:[`grid`]}return e},[j.options,j.viewType,j.kanban,j.calendar,j.gantt,j.gallery,j.timeline,j.tree,j.appearance?.allowedVisualizations]);n.useEffect(()=>{j.viewType&&ae(j.viewType)},[j.viewType]);let vt=n.useCallback(e=>{ae(e);try{localStorage.setItem(pt,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}d?.(e)},[pt,d]),yt=n.useCallback(e=>{ce(e),m?.(e)},[m]),bt=(0,s.useNavigationOverlay)({navigation:j.navigation,objectName:j.objectName,onNavigate:j.onNavigate,onRowClick:v}),$=n.useMemo(()=>{let e=j.fields||[];if(Array.isArray(e)||(e=[]),Q?.isLoaded&&j.objectName&&(e=e.filter(e=>{let t=typeof e==`string`?e:e?.name||e?.fieldName||e?.field;return t?Q.checkField(j.objectName,t,`read`):!0})),q.size>0&&(e=e.filter(e=>{let t=typeof e==`string`?e:e?.name||e?.fieldName||e?.field;return t!=null&&!q.has(t)})),j.fieldOrder&&j.fieldOrder.length>0){let t=new Map(j.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,n)=>{let r=typeof e==`string`?e:e?.name||e?.fieldName||e?.field,i=typeof n==`string`?n:n?.name||n?.fieldName||n?.field;return(t.get(r)??1/0)-(t.get(i)??1/0)})}return e},[j.fields,j.objectName,q,j.fieldOrder,Q]),xt=n.useMemo(()=>{let e=X.mode===`compact`?`compact`:X.mode===`spacious`?`tall`:`medium`,t={objectName:j.objectName,fields:$,filters:j.filters,sort:I,className:`h-full w-full`,showSearch:!1,onRowClick:bt.handleClick,rowHeight:e,hideRowHeightToggle:!0,...j.striped==null?{}:{striped:j.striped},...j.bordered==null?{}:{bordered:j.bordered},..._?{onColumnStateChange:_}:{},...j.columnState?{columnState:j.columnState}:{}};switch(P){default:case`grid`:return{type:`object-grid`,...t,columns:$,...j.conditionalFormatting?{conditionalFormatting:j.conditionalFormatting}:{},editable:J,...j.wrapHeaders==null?{}:{wrapHeaders:j.wrapHeaders},...j.virtualScroll==null?{}:{virtualScroll:j.virtualScroll},...j.resizable==null?{}:{resizable:j.resizable},...j.selection?{selection:j.selection}:{},...j.pagination?{pagination:j.pagination}:{},...W?{grouping:W}:{},...G?{rowColor:G}:{},...j.rowActions?{rowActions:j.rowActions}:{},...j.rowActionDefs?{rowActionDefs:j.rowActionDefs}:{},...j.bulkActions?{batchActions:j.bulkActions}:{},...j.bulkActionDefs?{bulkActionDefs:j.bulkActionDefs}:{},...j.options?.grid||{}};case`kanban`:return{type:`object-kanban`,...t,groupBy:j.kanban?.groupField||j.options?.kanban?.groupField||`status`,groupField:j.kanban?.groupField||j.options?.kanban?.groupField||`status`,...j.kanban?.titleField||j.options?.kanban?.titleField?{titleField:j.kanban?.titleField||j.options?.kanban?.titleField}:{},cardFields:j.kanban?.cardFields||$||[],...W?{grouping:W}:{},...j.options?.kanban||{},...j.kanban||{}};case`calendar`:return{type:`object-calendar`,...t,startDateField:j.calendar?.startDateField||j.options?.calendar?.startDateField||`start_date`,endDateField:j.calendar?.endDateField||j.options?.calendar?.endDateField||`end_date`,...j.calendar?.titleField||j.options?.calendar?.titleField?{titleField:j.calendar?.titleField||j.options?.calendar?.titleField}:{},...j.calendar?.defaultView?{defaultView:j.calendar.defaultView}:{},...j.options?.calendar||{},...j.calendar||{}};case`gallery`:{let e={...j.options?.gallery||{},...j.gallery||{},cardSize:Z};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField,titleField:j.gallery?.titleField||j.options?.gallery?.titleField||`name`,subtitleField:j.gallery?.subtitleField||j.options?.gallery?.subtitleField,...W?{grouping:W}:{}}}case`timeline`:{let e={...j.options?.timeline||{},...j.timeline||{}};return{type:`object-timeline`,...t,timeline:Object.keys(e).length>0?e:void 0,startDateField:j.timeline?.startDateField||j.options?.timeline?.startDateField||j.options?.timeline?.dateField||`created_at`,titleField:j.timeline?.titleField||j.options?.timeline?.titleField||`name`,...j.timeline?.endDateField?{endDateField:j.timeline.endDateField}:{},...j.timeline?.groupByField?{groupByField:j.timeline.groupByField}:{},...j.timeline?.colorField?{colorField:j.timeline.colorField}:{},...j.timeline?.scale?{scale:j.timeline.scale}:{}}}case`gantt`:return{type:`object-gantt`,...t,startDateField:j.gantt?.startDateField||j.options?.gantt?.startDateField||`start_date`,endDateField:j.gantt?.endDateField||j.options?.gantt?.endDateField||`end_date`,progressField:j.gantt?.progressField||j.options?.gantt?.progressField||`progress`,dependenciesField:j.gantt?.dependenciesField||j.options?.gantt?.dependenciesField||`dependencies`,...j.gantt?.titleField?{titleField:j.gantt.titleField}:{},...j.options?.gantt||{},...j.gantt||{}};case`map`:return{type:`object-map`,...t,locationField:j.options?.map?.locationField||`location`,...j.options?.map||{}};case`tree`:{let e=j.tree||j.options?.tree||{};return{type:`object-tree`,...t,parentField:e.parentField,labelField:e.labelField||e.titleField||`name`,fields:e.fields||$,defaultExpandedDepth:e.defaultExpandedDepth,...e}}case`chart`:{let e=j.chart||j.options?.chart||{};if(e.dataset){let t=Array.isArray(e.dimensions)?e.dimensions:[],n=Array.isArray(e.values)?e.values:[];return{type:`object-chart`,dataset:e.dataset,dimensions:t,values:n,chartType:e.chartType||`bar`,xAxisKey:t[0],series:n.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let t=Array.isArray(e.yAxisFields)&&e.yAxisFields[0]||e.valueField||`value`,n=e.xAxisField||e.categoryField||`name`;return{type:`object-chart`,objectName:j.objectName,chartType:e.chartType||`bar`,filters:j.filters,aggregate:{field:t,function:e.aggregation||`count`,groupBy:n},xAxisKey:n,series:[{dataKey:t,label:t}],className:`h-[400px] w-full`}}}},[P,j,I,$,W,G,bt.handleClick,X.mode,Z,J]),St=L.conditions&&L.conditions.length>0,Ct=n.useMemo(()=>{let e,t=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return j.objectName?A(j.objectName,e,n):n};if(e=V?.fields?Object.entries(V.fields).map(([e,n])=>({value:e,label:M(e,n.label||e),type:n.type||`text`,options:t(e,n.options),referenceTo:n.reference_to||n.reference,displayField:n.display_field||n.reference_field,idField:n.id_field})):(j.fields||[]).map(e=>{if(typeof e==`string`)return{value:e,label:e,type:`text`};let n=e.name||e.fieldName;return{value:n,label:M(n,e.label||e.name),type:e.type||`text`,options:t(n,e.options),referenceTo:e.reference_to||e.reference,displayField:e.display_field||e.reference_field,idField:e.id_field}}),j.filterableFields&&j.filterableFields.length>0){let t=new Set(j.filterableFields);e=e.filter(e=>t.has(e.value))}return e},[V,j.fields,j.filterableFields,j.objectName,M,A]),wt=n.useCallback(e=>{if(!ot)return;let t=Y,n=t?.maxRecords||0,r=t?.includeHeaders!==!1,i=t?.fileNamePrefix||j.objectName||`export`;if((e===`csv`||e===`xlsx`||e===`json`)&&typeof R?.exportDownload==`function`&&j.objectName&&t?.streaming!==!1){let t=$.map(e=>typeof e==`string`?e:e.name||e.fieldName||e.field).filter(Boolean),a=j.filters||[],o=re(L),s=ne(K),c=[...a.length>0?[a]:[],...o.length>0?[o]:[],...s].filter(e=>Array.isArray(e)&&e.length>0),l=c.length>1?[`and`,...c]:c.length===1?c[0]:void 0,u=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;at(null),rt(!0),(async()=>{try{let a=await R.exportDownload(j.objectName,{format:e,fields:t.length?t:void 0,filter:l,sort:u,includeHeaders:r,limit:n>0?n:void 0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`${i}.${e}`,s.rel=`noopener`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o),tt(!1)}catch(e){console.error(`ListView export failed:`,e),at(e instanceof Error?e.message:String(e))}finally{rt(!1)}})();return}let a=n>0?z.slice(0,n):z;if(e===`csv`){let e=$.map(e=>typeof e==`string`?e:e.name||e.fieldName||e.field),t=[];r&&t.push(e.join(`,`)),a.forEach(n=>{t.push(e.map(e=>{let t=n[e],r;return r=t==null?``:Array.isArray(t)?t.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof t==`object`?JSON.stringify(t):String(t),r.includes(`,`)||r.includes(`"`)||r.includes(`
|
|
2
2
|
`)||r.includes(`\r`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`))});let n=new Blob([t.join(`
|
|
3
|
-
`)],{type:`text/csv;charset=utf-8;`}),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=`${i}.csv`,s.click(),URL.revokeObjectURL(o)}else if(e===`json`){let e=new Blob([JSON.stringify(a,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${i}.json`,n.click(),URL.revokeObjectURL(t)}Qe(!1)},[z,$,Y,j.objectName,j.filters,rt,R,L,q,I]),St=n.useMemo(()=>(j.fields||[]).map(e=>{if(typeof e==`string`)return{name:e,label:M(e,e)};let t=e.name||e.fieldName||e.field;return{name:t,label:M(t,e.label||e.name||e.field)}}),[j.fields,M]);return(0,a.jsxs)(`div`,{ref:st,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,u),...j.aria?.label?{"aria-label":j.aria.label}:{},...j.aria?.describedBy?{"aria-describedby":j.aria.describedBy}:{},...j.aria?.live?{"aria-live":j.aria.live}:{},role:`region`,"aria-busy":B||void 0,"data-state":B?`loading`:`idle`,children:[lt>0&&(0,a.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:lt},children:E(ct?`list.refreshing`:`list.pullToRefresh`)}),j.description&&j.appearance?.showDescription!==!1&&(0,a.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:typeof j.description==`string`?j.description:``}),(0,a.jsxs)(`div`,{className:`border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:Ge&&(0,a.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,a.jsx)(D,{config:Ge,objectDef:H,data:z,onFilterChange:We,maxVisible:3,initialSelections:x,onSelectionsChange:S})})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,children:[T&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{currentView:P,availableViews:mt,onViewChange:ht}),(0,a.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),P===`grid`&&g&&!N.compactToolbar&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!j.inlineEdit),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,j.inlineEdit&&`text-primary`),title:E(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,a.jsx)(i.Pencil,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),N.showHideFields&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Ye,onOpenChange:Xe,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,J.size>0&&`text-primary`),children:[(0,a.jsx)(i.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.hideFields`)}),J.size>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:J.size})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.hideFieldsTitle`)}),J.size>0&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Je(new Set),children:E(`list.showAll`)})]}),(0,a.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:St.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!J.has(e.name),onChange:()=>{let t=new Set(J);t.has(e.name)?t.delete(e.name):t.add(e.name),Je(t)},className:`rounded border-input`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),N.showHideFields&&!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showFilters&&(0,a.jsxs)(r.Popover,{open:he,onOpenChange:ge,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,yt&&`text-foreground font-medium`),children:[(0,a.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.filter`)}),yt&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:L.conditions?.length||0})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.filterRecords`)})}),(0,a.jsx)(r.FilterBuilder,{fields:bt,value:L,onChange:e=>{_e(e),f&&f(e)}})]})})]}),N.showGroup&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Fe,onOpenChange:Ie,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,G&&`text-foreground font-medium`),children:[(0,a.jsx)(i.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.group`)}),G&&G.fields?.length>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:G.fields.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-72 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.groupBy`)}),G&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Pe(void 0),"data-testid":`clear-grouping`,children:E(`list.clear`)})]}),(0,a.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,a.jsx)(r.GroupingEditor,{value:G,fieldOptions:St.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:E(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:E(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:E(`list.removeGroup`,{defaultValue:`Remove`})},onChange:e=>Pe(e)})})]})})]}),N.showSort&&(0,a.jsxs)(r.Popover,{open:de,onOpenChange:fe,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,I.length>0&&`text-foreground font-medium`),children:[(0,a.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.sort`)}),I.length>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:I.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.sortRecords`)})}),(0,a.jsx)(r.SortBuilder,{fields:bt,value:I,onChange:e=>{pe(e),p&&p(e)}})]})})]}),!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(N.showColor||N.showDensity)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showColor&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:ze,onOpenChange:Be,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,K&&`text-foreground font-medium`),children:[(0,a.jsx)(i.Paintbrush,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.color`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.rowColor`)}),K&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Re(void 0),"data-testid":`clear-row-color`,children:E(`list.clear`)})]}),(0,a.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,a.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:E(`list.colorByField`)}),(0,a.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:K?.field||``,onChange:e=>{let t=e.target.value;Re(t?{field:t,colors:K?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,a.jsx)(`option`,{value:``,children:E(`list.none`)}),St.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),N.showDensity&&!N.compactToolbar&&P!==`gallery`&&(()=>{let e=X.mode===`compact`?i.Rows4:X.mode===`comfortable`?i.Rows3:i.Rows2,t=X.mode===`compact`?E(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):X.mode===`comfortable`?E(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):E(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${E(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=E(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,X.mode!==`compact`&&`text-foreground font-medium`),onClick:X.cycle,title:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.showDensity&&!N.compactToolbar&&P===`gallery`&&(()=>{let e=Z===`small`?i.Rows4:Z===`medium`?i.Rows3:i.Rows2,t=Z===`small`?E(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z===`medium`?E(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):E(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${E(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=E(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Z!==`small`&&`text-foreground font-medium`),onClick:ot,title:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.compactToolbar&&(N.showGroup||N.showColor||N.showDensity||N.showHideFields)&&(0,a.jsx)(C,{t:E,allFields:St,showGroup:N.showGroup,groupingConfig:G,setGroupingConfig:Pe,showColor:N.showColor,rowColorConfig:K,setRowColorConfig:Re,showDensity:N.showDensity,density:X,showHideFields:N.showHideFields,hiddenFields:J,updateHiddenFields:Je,showInlineEdit:P===`grid`,inlineEdit:!!j.inlineEdit,setInlineEdit:e=>g?.(e)}),(N.showColor||N.showDensity||N.compactToolbar)&&Y&&rt&&(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),Y&&rt&&(0,a.jsxs)(r.Popover,{open:Ze,onOpenChange:Qe,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,children:[(0,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.export`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(Y.formats||[`csv`,`json`]).map(e=>(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:$e,onClick:()=>xt(e),children:[$e?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-2`}),E(`list.exportAs`,{format:e.toUpperCase()})]},e)),tt&&(0,a.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:tt})]})})]}),(j.sharing?.enabled||j.sharing?.type)&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${j.sharing?.visibility||j.sharing?.type||`private`}`,"data-testid":`share-button`,children:[(0,a.jsx)(i.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.share`)})]}),j.allowPrinting&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,onClick:()=>window.print(),"data-testid":`print-button`,children:[(0,a.jsx)(i.Printer,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.print`)})]}),(()=>{let e=j.allowPrinting||j.sharing?.enabled||j.sharing?.type||Y&&rt;return N.showSearch&&e?(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),N.showSearch&&(0,a.jsxs)(r.Popover,{open:le,onOpenChange:ue,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,F&&`text-foreground font-medium`),"data-testid":`search-icon-button`,title:E(`list.search`),children:(0,a.jsx)(i.Search,{className:`h-3.5 w-3.5`})})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,a.jsxs)(`div`,{className:`relative`,children:[(0,a.jsx)(i.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,a.jsx)(r.Input,{placeholder:E(`list.search`)+`...`,value:F,onChange:e=>gt(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),F&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20`,onClick:()=>gt(``),children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),N.showAddRecord&&N.addRecordPosition===`top`&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.addRecord`)})]})]})]}),(0,a.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,a.jsx)(r.RefreshIndicator,{active:B&&z.length>0}),ye&&z.length===0?(0,a.jsx)(r.DataEmptyState,{"data-testid":`list-error-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,a.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:E(`list.loadErrorTitle`),description:E(`list.loadErrorMessage`),action:(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>Te(e=>e+1),children:[(0,a.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),E(`list.retry`)]})}):B&&z.length===0?(0,a.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-2`,"data-testid":`list-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,a.jsx)(`span`,{className:`sr-only`,children:E(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,a.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!B&&z.length===0&&P===`grid`?(()=>{let e=j.emptyState?.icon,t=e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??i.Inbox:i.Inbox,n=!!(F&&F.trim())||Array.isArray(q)&&q.length>0||Array.isArray(L?.conditions)&&L.conditions.length>0,o=(typeof j.emptyState?.title==`string`?j.emptyState.title:void 0)??E(n?`list.noMatches`:`list.firstRunTitle`),s=(typeof j.emptyState?.message==`string`?j.emptyState.message:void 0)??E(n?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,a.jsx)(r.DataEmptyState,{"data-testid":`empty-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,a.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:o,description:s,action:N.showAddRecord?(0,a.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),E(`list.addRecord`)]}):void 0})})():(0,a.jsx)(s.SchemaRenderer,{schema:vt,...w,data:z,loading:B,onRowSelect:He,...P===`grid`&&!G?.fields?.length&&Me!=null?{manualPagination:!0,rowCount:Me,page:Ae,pageSize:U,onPageChange:e=>je(e),onPageSizeChange:e=>{ke(e),je(1)}}:{}})]},P),N.showAddRecord&&N.addRecordPosition===`bottom`&&(0,a.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.addRecord`)})]})}),j.bulkActions&&j.bulkActions.length>0&&Ve.length>0&&P!==`grid`&&(0,a.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,a.jsx)(i.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,a.jsxs)(`span`,{className:`font-medium`,children:[Ve.length,` `,Ve.length===1?`item`:`items`,` selected`]}),(0,a.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:j.bulkActions.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),o=n?i.Trash2:null;return(0,a.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>w.onBulkAction?.(e,Ve),"data-testid":`bulk-action-${e}`,children:[o&&(0,a.jsx)(o,{className:`h-3 w-3`}),ie(e)]},e)})}),(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>He([]),children:[(0,a.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!B&&z.length>0&&j.showRecordCount!==!1&&(0,a.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,a.jsx)(`span`,{className:`font-medium text-foreground/80`,children:z.length===1?E(`list.recordCountOne`,{count:z.length}):E(`list.recordCount`,{count:z.length})}),Ee&&(0,a.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:E(`list.dataLimitReached`,{limit:U})}),P!==`grid`&&j.pagination?.pageSizeOptions&&j.pagination.pageSizeOptions.length>0&&(0,a.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,a.jsx)(`span`,{children:E(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,a.jsx)(`select`,{"data-testid":`page-size-selector`,className:`h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background`,value:String(U),onChange:e=>{let t=Number(e.target.value);ke(t),w.onPageSizeChange&&w.onPageSizeChange(t)},children:j.pagination.pageSizeOptions.map(e=>(0,a.jsx)(`option`,{value:String(e),children:e},e))})]})]}),_t.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{..._t,title:j.label?`${j.label} Detail`:j.objectName?`${j.objectName.charAt(0).toUpperCase()+j.objectName.slice(1)} Detail`:`Record Detail`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});F.displayName=`ListView`;var ce={small:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6`,medium:`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,large:`grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3`},le={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},ue=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),de=[{bg:`from-indigo-500/15 via-indigo-500/5 to-purple-500/10`,ring:`ring-indigo-500/15`,text:`text-indigo-600/70 dark:text-indigo-300/70`},{bg:`from-sky-500/15 via-sky-500/5 to-cyan-500/10`,ring:`ring-sky-500/15`,text:`text-sky-600/70 dark:text-sky-300/70`},{bg:`from-emerald-500/15 via-emerald-500/5 to-teal-500/10`,ring:`ring-emerald-500/15`,text:`text-emerald-600/70 dark:text-emerald-300/70`},{bg:`from-amber-500/15 via-amber-500/5 to-orange-500/10`,ring:`ring-amber-500/15`,text:`text-amber-600/70 dark:text-amber-300/70`},{bg:`from-rose-500/15 via-rose-500/5 to-pink-500/10`,ring:`ring-rose-500/15`,text:`text-rose-600/70 dark:text-rose-300/70`},{bg:`from-violet-500/15 via-violet-500/5 to-fuchsia-500/10`,ring:`ring-violet-500/15`,text:`text-violet-600/70 dark:text-violet-300/70`}];function fe(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return de[Math.abs(t)%de.length]}var I=({imageUrl:e,title:t,coverFit:i,aspectClass:o,placeholder:s,hidden:c})=>{let[l,u]=(0,n.useState)(!1),d=!!e&&!l;return(0,a.jsx)(`div`,{className:(0,r.cn)(`w-full overflow-hidden relative`,o),hidden:c,children:d?i===`contain`?(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]`})}):(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]`}):(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset`,s.bg,s.ring),children:(0,a.jsx)(`span`,{className:(0,r.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:t[0]?.toUpperCase()})})})},pe=({imageUrl:e,title:t,placeholder:i})=>{let[o,s]=(0,n.useState)(!1),c=!!e&&!o;return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,i.bg,i.ring),children:c?(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110`}):(0,a.jsx)(`span`,{className:(0,r.cn)(`text-base font-semibold`,i.text),children:t[0]?.toUpperCase()})})},me=e=>{let{schema:o}=e,c=(0,n.useContext)(s.SchemaRendererContext),l=e.dataSource||c?.dataSource,d=(0,s.useDataScope)(o.bind),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!1),[g,_]=(0,n.useState)(null),v=(0,s.useNavigationOverlay)({navigation:o.navigation,objectName:o.objectName,onRowClick:e.onRowClick??e.onCardClick}),y=o.gallery,b=y?.coverField??o.imageField??`image`,x=y?.coverFit??`cover`,S=y?.cardSize??`medium`,C=y?.titleField??o.titleField,w=y?.visibleFields,{fieldLabel:ee,fieldOptionLabel:T}=(0,s.useSafeFieldLabel)(),E=(0,n.useCallback)(e=>{let t=g?.fields?.[e],n={name:e};if(t){t.type&&(n.type=t.type),t.label&&(n.label=t.label),t.options&&(n.options=t.options),t.currency&&(n.currency=t.currency),t.precision!==void 0&&(n.precision=t.precision),t.format&&(n.format=t.format);let e=t.reference_to||t.reference;e&&(n.reference_to=e),t.reference_field&&(n.reference_field=t.reference_field)}if(o.objectName){let t=String(n.label??e);n.label=ee(o.objectName,e,t)}return o.objectName&&Array.isArray(n.options)&&(n.options=n.options.map(t=>{let n=String(t?.value??t),r=String(t?.label??n);return{...t,value:n,label:T(o.objectName,e,n,r)}})),n},[g,o.objectName,ee,T]);(0,n.useEffect)(()=>{let e=!0;return(async()=>{if(!(!l||typeof l.getObjectSchema!=`function`||!o.objectName))try{let t=await l.getObjectSchema(o.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[o.objectName,l]),(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return o.objectName&&!d&&!o.data&&!e.data&&(async()=>{if(!(!l||typeof l.find!=`function`||!o.objectName)){n&&h(!0);try{let e=(0,t.buildExpandFields)(g?.fields),r=await l.find(o.objectName,{$filter:o.filter,...e.length>0?{$expand:e}:{}}),i=[];if(Array.isArray(r))i=r;else if(r&&typeof r==`object`){let e=r;Array.isArray(e.records)?i=e.records:Array.isArray(e.data)&&(i=e.data)}n&&p(i)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&h(!1)}}})(),()=>{n=!1}},[o.objectName,l,d,o.data,o.filter,e.data,g]);let D=e.data||d||o.data||f||[],O=(0,n.useMemo)(()=>D.some(e=>typeof e[b]==`string`&&!!e[b]),[D,b]),k=o.grouping?.fields,A=!!(k&&k.length>0),[j,M]=(0,n.useState)({}),te=(0,n.useMemo)(()=>k?k.some(e=>e.collapsed):!1,[k]),ne=(0,n.useCallback)(e=>{M(t=>({...t,[e]:t[e]===void 0?!te:!t[e]}))},[te]),re=(0,n.useMemo)(()=>{if(!A||!k)return[];let e=new Map,t=[];for(let n of D){let r=k.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=k.map(e=>{let t=n[e.field];return t!=null&&t!==``?String(t):`(empty)`}).join(` / `);e.set(r,{label:i,items:[]}),t.push(r)}e.get(r).items.push(n)}let n=k[0]?.order??`asc`;return t.sort((e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}),t.map(t=>{let n=e.get(t),r=t in j?j[t]:te;return{key:t,label:n.label,items:n.items,collapsed:r}})},[D,k,A,j,te]);if(m&&!D.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!D.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let ie=e=>!w||w.length===0?null:(0,a.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:w.map(t=>{let n=e[t];if(n==null||n===``)return null;let i=E(t),o=(0,u.resolveCellRendererType)(i)||i.type||`text`,s=(0,u.getCellRenderer)(o),c=i?.label&&String(i.label).trim()?String(i.label):void 0,l=c!=null&&ue.has(o);return(0,a.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,l&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[l&&(0,a.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:c}),(0,a.jsx)(s,{value:n,field:i})]},t)})}),N=(n,i)=>{let s=n.id??n._id??i,c=(C!=null&&n[C]!=null&&n[C]!==``?String(n[C]):void 0)??(0,t.getRecordDisplayName)(g,n),l=n[b],u=fe(String(s)+`|`+c),d=(0,r.cn)(`group relative overflow-hidden border-border/60 bg-card`,`transition-all duration-200 ease-out`,`hover:shadow-lg hover:border-border hover:-translate-y-0.5`,(e.onCardClick||e.onRowClick||o.navigation)&&`cursor-pointer`);return O&&x===`contain`?(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(r.CardContent,{className:`p-4`,children:(0,a.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,a.jsx)(pe,{imageUrl:l,title:c,placeholder:u}),(0,a.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),ie(n)]})]})})]},s):(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[!O&&(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(I,{imageUrl:l,title:c,coverFit:x,aspectClass:le[S],placeholder:u,hidden:!O}),(0,a.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,O&&`border-t border-border/60`),children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),ie(n)]})]},s)},P=e=>(0,a.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,ce[S],o.className),role:`list`,children:e.map((e,t)=>N(e,t))});return(0,a.jsxs)(a.Fragment,{children:[A?(0,a.jsx)(`div`,{className:`space-y-2`,children:re.map(e=>(0,a.jsxs)(`div`,{className:`border rounded-md`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors`,onClick:()=>ne(e.key),children:[e.collapsed?(0,a.jsx)(i.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,a.jsx)(i.ChevronDown,{className:`h-4 w-4 shrink-0`}),(0,a.jsx)(`span`,{children:e.label}),(0,a.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&P(e.items)]},e.key))}):P(D),v.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{...v,title:`Gallery Item`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})};t.ComponentRegistry.register(`object-gallery`,me,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function he(e){return e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null:null}function ge(e){return e.filter(e=>e.pinned||e.visible!==`false`&&e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}t.ComponentRegistry.register(`list-view`,F,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`fields`,type:`array`,label:`Fields`},{name:`filters`,type:`array`,label:`Filters`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}],defaultProps:{objectName:``,viewType:`grid`,fields:[],filters:[],sort:[],options:{}}}),t.ComponentRegistry.register(`list`,F,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`fields`,type:`array`,label:`Fields`},{name:`filters`,type:`array`,label:`Filters`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}]}),e.ListView=F,e.ObjectGallery=me,e.TabBar=({tabs:e,activeTab:t,onTabChange:i,className:o})=>{let s=n.useMemo(()=>ge(e),[e]),c=n.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[l,u]=n.useState(c),d=t??l,f=n.useCallback(e=>{u(e.name),i?.(e)},[i]);return s.length===0?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background`,o),"data-testid":`view-tabs`,role:`tablist`,children:s.map(e=>{let t=he(e.icon),n=d===e.name;return(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150`,n?`font-medium text-foreground bg-muted`:`text-muted-foreground hover:text-foreground hover:bg-transparent`),"data-testid":`view-tab-${e.name}`,role:`tab`,"aria-selected":n,onClick:()=>f(e),children:[t&&(0,a.jsx)(t,{className:`h-3 w-3 mr-1.5`}),e.label]},e.name)})})},e.TabBarSelect=({tabs:e,activeTab:t,onTabChange:o,className:s})=>{let c=n.useMemo(()=>ge(e),[e]),l=n.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[u,d]=n.useState(l),f=t??u,p=n.useMemo(()=>c.find(e=>e.name===f)??c[0],[c,f]),m=n.useCallback(e=>{d(e.name),o?.(e)},[o]);if(c.length===0)return null;let h=he(p?.icon);return(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,a.jsxs)(r.DropdownMenu,{children:[(0,a.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate`,"aria-label":`Switch view`,children:[h&&(0,a.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:p?.label??``}),(0,a.jsx)(i.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,a.jsx)(r.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=he(e.icon);return(0,a.jsxs)(r.DropdownMenuItem,{onClick:()=>m(e),className:(0,r.cn)(`text-sm`,f===e.name&&`font-medium bg-muted`),"data-testid":`view-tab-select-${e.name}`,children:[t&&(0,a.jsx)(t,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name)})})]})})},e.UserFilters=D,e.ViewSwitcher=x,e.ViewSwitcherDropdown=b,e.evaluateConditionalFormatting=ie,e.normalizeFilterCondition=M,e.normalizeFilters=ne});
|
|
3
|
+
`)],{type:`text/csv;charset=utf-8;`}),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=`${i}.csv`,s.click(),URL.revokeObjectURL(o)}else if(e===`json`){let e=new Blob([JSON.stringify(a,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${i}.json`,n.click(),URL.revokeObjectURL(t)}tt(!1)},[z,$,Y,j.objectName,j.filters,ot,R,L,K,I]),Tt=n.useMemo(()=>(j.fields||[]).map(e=>{if(typeof e==`string`)return{name:e,label:M(e,e)};let t=e.name||e.fieldName||e.field;return{name:t,label:M(t,e.label||e.name||e.field)}}),[j.fields,M]);return(0,a.jsxs)(`div`,{ref:ut,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,u),...j.aria?.label?{"aria-label":j.aria.label}:{},...j.aria?.describedBy?{"aria-describedby":j.aria.describedBy}:{},...j.aria?.live?{"aria-live":j.aria.live}:{},role:`region`,"aria-busy":B||void 0,"data-state":B?`loading`:`idle`,children:[ft>0&&(0,a.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:ft},children:E(dt?`list.refreshing`:`list.pullToRefresh`)}),j.description&&j.appearance?.showDescription!==!1&&(0,a.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:typeof j.description==`string`?j.description:``}),(0,a.jsxs)(`div`,{className:`border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:Ke&&(0,a.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,a.jsx)(D,{config:Ke,objectDef:V,data:z,onFilterChange:Ge,maxVisible:3,initialSelections:x,onSelectionsChange:S})})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,children:[T&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{currentView:P,availableViews:_t,onViewChange:vt}),(0,a.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),P===`grid`&&g&&!N.compactToolbar&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>$e(!J),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,J&&`text-primary`),title:E(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,a.jsx)(i.Pencil,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),N.showHideFields&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Xe,onOpenChange:Ze,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,q.size>0&&`text-primary`),children:[(0,a.jsx)(i.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.hideFields`)}),q.size>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:q.size})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.hideFieldsTitle`)}),q.size>0&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ye(new Set),children:E(`list.showAll`)})]}),(0,a.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Tt.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!q.has(e.name),onChange:()=>{let t=new Set(q);t.has(e.name)?t.delete(e.name):t.add(e.name),Ye(t)},className:`rounded border-input`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),N.showHideFields&&!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showFilters&&(0,a.jsxs)(r.Popover,{open:he,onOpenChange:ge,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,St&&`text-foreground font-medium`),children:[(0,a.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.filter`)}),St&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:L.conditions?.length||0})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.filterRecords`)})}),(0,a.jsx)(r.FilterBuilder,{fields:Ct,value:L,onChange:e=>{_e(e),f&&f(e)}})]})})]}),N.showGroup&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Ie,onOpenChange:Le,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,W&&`text-foreground font-medium`),children:[(0,a.jsx)(i.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.group`)}),W&&W.fields?.length>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:W.fields.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-72 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.groupBy`)}),W&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Fe(void 0),"data-testid":`clear-grouping`,children:E(`list.clear`)})]}),(0,a.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,a.jsx)(r.GroupingEditor,{value:W,fieldOptions:Tt.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:E(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:E(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:E(`list.removeGroup`,{defaultValue:`Remove`})},onChange:e=>Fe(e)})})]})})]}),N.showSort&&(0,a.jsxs)(r.Popover,{open:de,onOpenChange:fe,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,I.length>0&&`text-foreground font-medium`),children:[(0,a.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.sort`)}),I.length>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:I.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.sortRecords`)})}),(0,a.jsx)(r.SortBuilder,{fields:Ct,value:I,onChange:e=>{pe(e),p&&p(e)}})]})})]}),!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(N.showColor||N.showDensity)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showColor&&!N.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Be,onOpenChange:Ve,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,G&&`text-foreground font-medium`),children:[(0,a.jsx)(i.Paintbrush,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.color`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:E(`list.rowColor`)}),G&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>ze(void 0),"data-testid":`clear-row-color`,children:E(`list.clear`)})]}),(0,a.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,a.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:E(`list.colorByField`)}),(0,a.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:G?.field||``,onChange:e=>{let t=e.target.value;ze(t?{field:t,colors:G?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,a.jsx)(`option`,{value:``,children:E(`list.none`)}),Tt.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),N.showDensity&&!N.compactToolbar&&P!==`gallery`&&(()=>{let e=X.mode===`compact`?i.Rows4:X.mode===`comfortable`?i.Rows3:i.Rows2,t=X.mode===`compact`?E(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):X.mode===`comfortable`?E(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):E(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${E(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=E(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,X.mode!==`compact`&&`text-foreground font-medium`),onClick:X.cycle,title:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.showDensity&&!N.compactToolbar&&P===`gallery`&&(()=>{let e=Z===`small`?i.Rows4:Z===`medium`?i.Rows3:i.Rows2,t=Z===`small`?E(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z===`medium`?E(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):E(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${E(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=E(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Z!==`small`&&`text-foreground font-medium`),onClick:lt,title:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.compactToolbar&&(N.showGroup||N.showColor||N.showDensity||N.showHideFields)&&(0,a.jsx)(C,{t:E,allFields:Tt,showGroup:N.showGroup,groupingConfig:W,setGroupingConfig:Fe,showColor:N.showColor,rowColorConfig:G,setRowColorConfig:ze,showDensity:N.showDensity,density:X,showHideFields:N.showHideFields,hiddenFields:q,updateHiddenFields:Ye,showInlineEdit:P===`grid`,inlineEdit:J,setInlineEdit:$e}),(N.showColor||N.showDensity||N.compactToolbar)&&Y&&ot&&(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),Y&&ot&&(0,a.jsxs)(r.Popover,{open:et,onOpenChange:tt,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,children:[(0,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.export`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,a.jsxs)(`div`,{className:`space-y-1`,children:[(Y.formats||[`csv`,`json`]).map(e=>(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:nt,onClick:()=>wt(e),children:[nt?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-2`}),E(`list.exportAs`,{format:e.toUpperCase()})]},e)),it&&(0,a.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:it})]})})]}),(j.sharing?.enabled||j.sharing?.type)&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${j.sharing?.visibility||j.sharing?.type||`private`}`,"data-testid":`share-button`,children:[(0,a.jsx)(i.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.share`)})]}),j.allowPrinting&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,onClick:()=>window.print(),"data-testid":`print-button`,children:[(0,a.jsx)(i.Printer,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.print`)})]}),(()=>{let e=j.allowPrinting||j.sharing?.enabled||j.sharing?.type||Y&&ot;return N.showSearch&&e?(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),N.showSearch&&(0,a.jsxs)(r.Popover,{open:le,onOpenChange:ue,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,F&&`text-foreground font-medium`),"data-testid":`search-icon-button`,title:E(`list.search`),children:(0,a.jsx)(i.Search,{className:`h-3.5 w-3.5`})})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,a.jsxs)(`div`,{className:`relative`,children:[(0,a.jsx)(i.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,a.jsx)(r.Input,{placeholder:E(`list.search`)+`...`,value:F,onChange:e=>yt(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),F&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20`,onClick:()=>yt(``),children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),N.showAddRecord&&N.addRecordPosition===`top`&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.addRecord`)})]})]})]}),(0,a.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,a.jsx)(r.RefreshIndicator,{active:B&&z.length>0}),ye&&z.length===0?(0,a.jsx)(r.DataEmptyState,{"data-testid":`list-error-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,a.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:E(`list.loadErrorTitle`),description:E(`list.loadErrorMessage`),action:(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>Ee(e=>e+1),children:[(0,a.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),E(`list.retry`)]})}):B&&z.length===0?(0,a.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-2`,"data-testid":`list-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,a.jsx)(`span`,{className:`sr-only`,children:E(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,a.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!B&&z.length===0&&P===`grid`?(()=>{let e=j.emptyState?.icon,t=e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??i.Inbox:i.Inbox,n=!!(F&&F.trim())||Array.isArray(K)&&K.length>0||Array.isArray(L?.conditions)&&L.conditions.length>0,o=(typeof j.emptyState?.title==`string`?j.emptyState.title:void 0)??E(n?`list.noMatches`:`list.firstRunTitle`),s=(typeof j.emptyState?.message==`string`?j.emptyState.message:void 0)??E(n?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,a.jsx)(r.DataEmptyState,{"data-testid":`empty-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,a.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:o,description:s,action:N.showAddRecord?(0,a.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),E(`list.addRecord`)]}):void 0})})():(0,a.jsx)(s.SchemaRenderer,{schema:xt,...w,data:z,loading:B,onRowSelect:Ue,...P===`grid`&&!W?.fields?.length&&Ne!=null?{manualPagination:!0,rowCount:Ne,page:je,pageSize:H,onPageChange:e=>Me(e),onPageSizeChange:e=>{Ae(e),Me(1)}}:{}})]},P),N.showAddRecord&&N.addRecordPosition===`bottom`&&(0,a.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>w.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E(`list.addRecord`)})]})}),j.bulkActions&&j.bulkActions.length>0&&He.length>0&&P!==`grid`&&(0,a.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,a.jsx)(i.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,a.jsxs)(`span`,{className:`font-medium`,children:[He.length,` `,He.length===1?`item`:`items`,` selected`]}),(0,a.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:j.bulkActions.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),o=n?i.Trash2:null;return(0,a.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>w.onBulkAction?.(e,He),"data-testid":`bulk-action-${e}`,children:[o&&(0,a.jsx)(o,{className:`h-3 w-3`}),ie(e)]},e)})}),(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>Ue([]),children:[(0,a.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!B&&z.length>0&&j.showRecordCount!==!1&&(0,a.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,a.jsx)(`span`,{className:`font-medium text-foreground/80`,children:z.length===1?E(`list.recordCountOne`,{count:z.length}):E(`list.recordCount`,{count:z.length})}),De&&(0,a.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:E(`list.dataLimitReached`,{limit:H})}),P!==`grid`&&j.pagination?.pageSizeOptions&&j.pagination.pageSizeOptions.length>0&&(0,a.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,a.jsx)(`span`,{children:E(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,a.jsx)(`select`,{"data-testid":`page-size-selector`,className:`h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background`,value:String(H),onChange:e=>{let t=Number(e.target.value);Ae(t),w.onPageSizeChange&&w.onPageSizeChange(t)},children:j.pagination.pageSizeOptions.map(e=>(0,a.jsx)(`option`,{value:String(e),children:e},e))})]})]}),bt.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{...bt,title:j.label?`${j.label} Detail`:j.objectName?`${j.objectName.charAt(0).toUpperCase()+j.objectName.slice(1)} Detail`:`Record Detail`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});F.displayName=`ListView`;var ce={small:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6`,medium:`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,large:`grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3`},le={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},ue=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),de=[{bg:`from-indigo-500/15 via-indigo-500/5 to-purple-500/10`,ring:`ring-indigo-500/15`,text:`text-indigo-600/70 dark:text-indigo-300/70`},{bg:`from-sky-500/15 via-sky-500/5 to-cyan-500/10`,ring:`ring-sky-500/15`,text:`text-sky-600/70 dark:text-sky-300/70`},{bg:`from-emerald-500/15 via-emerald-500/5 to-teal-500/10`,ring:`ring-emerald-500/15`,text:`text-emerald-600/70 dark:text-emerald-300/70`},{bg:`from-amber-500/15 via-amber-500/5 to-orange-500/10`,ring:`ring-amber-500/15`,text:`text-amber-600/70 dark:text-amber-300/70`},{bg:`from-rose-500/15 via-rose-500/5 to-pink-500/10`,ring:`ring-rose-500/15`,text:`text-rose-600/70 dark:text-rose-300/70`},{bg:`from-violet-500/15 via-violet-500/5 to-fuchsia-500/10`,ring:`ring-violet-500/15`,text:`text-violet-600/70 dark:text-violet-300/70`}];function fe(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return de[Math.abs(t)%de.length]}var I=({imageUrl:e,title:t,coverFit:i,aspectClass:o,placeholder:s,hidden:c})=>{let[l,u]=(0,n.useState)(!1),d=!!e&&!l;return(0,a.jsx)(`div`,{className:(0,r.cn)(`w-full overflow-hidden relative`,o),hidden:c,children:d?i===`contain`?(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]`})}):(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]`}):(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset`,s.bg,s.ring),children:(0,a.jsx)(`span`,{className:(0,r.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:t[0]?.toUpperCase()})})})},pe=({imageUrl:e,title:t,placeholder:i})=>{let[o,s]=(0,n.useState)(!1),c=!!e&&!o;return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,i.bg,i.ring),children:c?(0,a.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110`}):(0,a.jsx)(`span`,{className:(0,r.cn)(`text-base font-semibold`,i.text),children:t[0]?.toUpperCase()})})},me=e=>{let{schema:o}=e,c=(0,n.useContext)(s.SchemaRendererContext),l=e.dataSource||c?.dataSource,d=(0,s.useDataScope)(o.bind),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!1),[g,_]=(0,n.useState)(null),v=(0,s.useNavigationOverlay)({navigation:o.navigation,objectName:o.objectName,onRowClick:e.onRowClick??e.onCardClick}),y=o.gallery,b=y?.coverField??o.imageField??`image`,x=y?.coverFit??`cover`,S=y?.cardSize??`medium`,C=y?.titleField??o.titleField,w=y?.visibleFields,{fieldLabel:ee,fieldOptionLabel:T}=(0,s.useSafeFieldLabel)(),E=(0,n.useCallback)(e=>{let t=g?.fields?.[e],n={name:e};if(t){t.type&&(n.type=t.type),t.label&&(n.label=t.label),t.options&&(n.options=t.options),t.currency&&(n.currency=t.currency),t.precision!==void 0&&(n.precision=t.precision),t.format&&(n.format=t.format);let e=t.reference_to||t.reference;e&&(n.reference_to=e),t.reference_field&&(n.reference_field=t.reference_field)}if(o.objectName){let t=String(n.label??e);n.label=ee(o.objectName,e,t)}return o.objectName&&Array.isArray(n.options)&&(n.options=n.options.map(t=>{let n=String(t?.value??t),r=String(t?.label??n);return{...t,value:n,label:T(o.objectName,e,n,r)}})),n},[g,o.objectName,ee,T]);(0,n.useEffect)(()=>{let e=!0;return(async()=>{if(!(!l||typeof l.getObjectSchema!=`function`||!o.objectName))try{let t=await l.getObjectSchema(o.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[o.objectName,l]),(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return o.objectName&&!d&&!o.data&&!e.data&&(async()=>{if(!(!l||typeof l.find!=`function`||!o.objectName)){n&&h(!0);try{let e=(0,t.buildExpandFields)(g?.fields),r=await l.find(o.objectName,{$filter:o.filter,...e.length>0?{$expand:e}:{}}),i=[];if(Array.isArray(r))i=r;else if(r&&typeof r==`object`){let e=r;Array.isArray(e.records)?i=e.records:Array.isArray(e.data)&&(i=e.data)}n&&p(i)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&h(!1)}}})(),()=>{n=!1}},[o.objectName,l,d,o.data,o.filter,e.data,g]);let D=e.data||d||o.data||f||[],O=(0,n.useMemo)(()=>D.some(e=>typeof e[b]==`string`&&!!e[b]),[D,b]),k=o.grouping?.fields,A=!!(k&&k.length>0),[j,M]=(0,n.useState)({}),te=(0,n.useMemo)(()=>k?k.some(e=>e.collapsed):!1,[k]),ne=(0,n.useCallback)(e=>{M(t=>({...t,[e]:t[e]===void 0?!te:!t[e]}))},[te]),re=(0,n.useMemo)(()=>{if(!A||!k)return[];let e=new Map,t=[];for(let n of D){let r=k.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=k.map(e=>{let t=n[e.field];return t!=null&&t!==``?String(t):`(empty)`}).join(` / `);e.set(r,{label:i,items:[]}),t.push(r)}e.get(r).items.push(n)}let n=k[0]?.order??`asc`;return t.sort((e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}),t.map(t=>{let n=e.get(t),r=t in j?j[t]:te;return{key:t,label:n.label,items:n.items,collapsed:r}})},[D,k,A,j,te]);if(m&&!D.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!D.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let ie=e=>!w||w.length===0?null:(0,a.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:w.map(t=>{let n=e[t];if(n==null||n===``)return null;let i=E(t),o=(0,u.resolveCellRendererType)(i)||i.type||`text`,s=(0,u.getCellRenderer)(o),c=i?.label&&String(i.label).trim()?String(i.label):void 0,l=c!=null&&ue.has(o);return(0,a.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,l&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[l&&(0,a.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:c}),(0,a.jsx)(s,{value:n,field:i})]},t)})}),N=(n,i)=>{let s=n.id??n._id??i,c=(C!=null&&n[C]!=null&&n[C]!==``?String(n[C]):void 0)??(0,t.getRecordDisplayName)(g,n),l=n[b],u=fe(String(s)+`|`+c),d=(0,r.cn)(`group relative overflow-hidden border-border/60 bg-card`,`transition-all duration-200 ease-out`,`hover:shadow-lg hover:border-border hover:-translate-y-0.5`,(e.onCardClick||e.onRowClick||o.navigation)&&`cursor-pointer`);return O&&x===`contain`?(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(r.CardContent,{className:`p-4`,children:(0,a.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,a.jsx)(pe,{imageUrl:l,title:c,placeholder:u}),(0,a.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),ie(n)]})]})})]},s):(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[!O&&(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(I,{imageUrl:l,title:c,coverFit:x,aspectClass:le[S],placeholder:u,hidden:!O}),(0,a.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,O&&`border-t border-border/60`),children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),ie(n)]})]},s)},P=e=>(0,a.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,ce[S],o.className),role:`list`,children:e.map((e,t)=>N(e,t))});return(0,a.jsxs)(a.Fragment,{children:[A?(0,a.jsx)(`div`,{className:`space-y-2`,children:re.map(e=>(0,a.jsxs)(`div`,{className:`border rounded-md`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors`,onClick:()=>ne(e.key),children:[e.collapsed?(0,a.jsx)(i.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,a.jsx)(i.ChevronDown,{className:`h-4 w-4 shrink-0`}),(0,a.jsx)(`span`,{children:e.label}),(0,a.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&P(e.items)]},e.key))}):P(D),v.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{...v,title:`Gallery Item`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})};t.ComponentRegistry.register(`object-gallery`,me,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function he(e){return e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null:null}function ge(e){return e.filter(e=>e.pinned||e.visible!==`false`&&e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}t.ComponentRegistry.register(`list-view`,F,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`fields`,type:`array`,label:`Fields`},{name:`filters`,type:`array`,label:`Filters`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}],defaultProps:{objectName:``,viewType:`grid`,fields:[],filters:[],sort:[],options:{}}}),t.ComponentRegistry.register(`list`,F,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`fields`,type:`array`,label:`Fields`},{name:`filters`,type:`array`,label:`Filters`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}]}),e.ListView=F,e.ObjectGallery=me,e.TabBar=({tabs:e,activeTab:t,onTabChange:i,className:o})=>{let s=n.useMemo(()=>ge(e),[e]),c=n.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[l,u]=n.useState(c),d=t??l,f=n.useCallback(e=>{u(e.name),i?.(e)},[i]);return s.length===0?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background`,o),"data-testid":`view-tabs`,role:`tablist`,children:s.map(e=>{let t=he(e.icon),n=d===e.name;return(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150`,n?`font-medium text-foreground bg-muted`:`text-muted-foreground hover:text-foreground hover:bg-transparent`),"data-testid":`view-tab-${e.name}`,role:`tab`,"aria-selected":n,onClick:()=>f(e),children:[t&&(0,a.jsx)(t,{className:`h-3 w-3 mr-1.5`}),e.label]},e.name)})})},e.TabBarSelect=({tabs:e,activeTab:t,onTabChange:o,className:s})=>{let c=n.useMemo(()=>ge(e),[e]),l=n.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[u,d]=n.useState(l),f=t??u,p=n.useMemo(()=>c.find(e=>e.name===f)??c[0],[c,f]),m=n.useCallback(e=>{d(e.name),o?.(e)},[o]);if(c.length===0)return null;let h=he(p?.icon);return(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,a.jsxs)(r.DropdownMenu,{children:[(0,a.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate`,"aria-label":`Switch view`,children:[h&&(0,a.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:p?.label??``}),(0,a.jsx)(i.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,a.jsx)(r.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=he(e.icon);return(0,a.jsxs)(r.DropdownMenuItem,{onClick:()=>m(e),className:(0,r.cn)(`text-sm`,f===e.name&&`font-medium bg-muted`),"data-testid":`view-tab-select-${e.name}`,children:[t&&(0,a.jsx)(t,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name)})})]})})},e.UserFilters=D,e.ViewSwitcher=x,e.ViewSwitcherDropdown=b,e.evaluateConditionalFormatting=ie,e.normalizeFilterCondition=M,e.normalizeFilters=ne});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-list",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "ListView plugin for Object UI - unified view component with view type switching",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^18.0.0 || ^19.0.0",
|
|
31
31
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
32
|
-
"@object-ui/components": "^11.
|
|
33
|
-
"@object-ui/core": "^11.
|
|
34
|
-
"@object-ui/fields": "^11.
|
|
35
|
-
"@object-ui/i18n": "^11.
|
|
36
|
-
"@object-ui/mobile": "^11.
|
|
37
|
-
"@object-ui/permissions": "^11.
|
|
38
|
-
"@object-ui/react": "^11.
|
|
39
|
-
"@object-ui/types": "^11.
|
|
32
|
+
"@object-ui/components": "^11.4.0",
|
|
33
|
+
"@object-ui/core": "^11.4.0",
|
|
34
|
+
"@object-ui/fields": "^11.4.0",
|
|
35
|
+
"@object-ui/i18n": "^11.4.0",
|
|
36
|
+
"@object-ui/mobile": "^11.4.0",
|
|
37
|
+
"@object-ui/permissions": "^11.4.0",
|
|
38
|
+
"@object-ui/react": "^11.4.0",
|
|
39
|
+
"@object-ui/types": "^11.4.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/react": "19.2.17",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"vite": "^8.1.0",
|
|
47
47
|
"vite-plugin-dts": "^5.0.3",
|
|
48
48
|
"vitest": "^4.1.9",
|
|
49
|
-
"@object-ui/components": "11.
|
|
50
|
-
"@object-ui/core": "11.
|
|
51
|
-
"@object-ui/fields": "11.
|
|
52
|
-
"@object-ui/i18n": "11.
|
|
53
|
-
"@object-ui/mobile": "11.
|
|
54
|
-
"@object-ui/react": "11.
|
|
55
|
-
"@object-ui/types": "11.
|
|
49
|
+
"@object-ui/components": "11.4.0",
|
|
50
|
+
"@object-ui/core": "11.4.0",
|
|
51
|
+
"@object-ui/fields": "11.4.0",
|
|
52
|
+
"@object-ui/i18n": "11.4.0",
|
|
53
|
+
"@object-ui/mobile": "11.4.0",
|
|
54
|
+
"@object-ui/react": "11.4.0",
|
|
55
|
+
"@object-ui/types": "11.4.0"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"objectui",
|