@universe-platform/ui 0.1.0-beta.74 → 0.1.0-beta.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -16
- package/dist/index.mjs +43 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6124,16 +6124,31 @@ function SubTableCell({
|
|
|
6124
6124
|
);
|
|
6125
6125
|
}
|
|
6126
6126
|
function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
6127
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
6128
6128
|
const isReadOnly = readOnly != null ? readOnly : Boolean(context == null ? void 0 : context.readOnly);
|
|
6129
6129
|
const { addToast } = useToast();
|
|
6130
6130
|
const entries = Array.isArray(value) ? value : [];
|
|
6131
|
+
const linkedRepField = (_b = (_a = column.config) == null ? void 0 : _a.linkConfig) == null ? void 0 : _b.repField;
|
|
6132
|
+
const linkedRepValue = linkedRepField ? (_c = context == null ? void 0 : context.rowData) == null ? void 0 : _c[linkedRepField] : void 0;
|
|
6133
|
+
const repIndicatorField = (_e = (_d = column.config) == null ? void 0 : _d.linkConfig) == null ? void 0 : _e.repIndicatorField;
|
|
6134
|
+
const isRepEligible = (recordId) => {
|
|
6135
|
+
var _a2, _b2;
|
|
6136
|
+
if (!linkedRepField || !repIndicatorField) return true;
|
|
6137
|
+
const rec = linkedRecords.find((r) => r.id === recordId);
|
|
6138
|
+
const entry = entries.find((e) => e.recordId === recordId);
|
|
6139
|
+
const v = (_b2 = (_a2 = rec == null ? void 0 : rec.data) != null ? _a2 : entry == null ? void 0 : entry._resolvedData) == null ? void 0 : _b2[repIndicatorField];
|
|
6140
|
+
return v === true || v === "true" || v === "TRUE" || v === "\u05DB\u05DF";
|
|
6141
|
+
};
|
|
6131
6142
|
const effectivePrimaryRecordId = (0, import_react14.useMemo)(() => {
|
|
6143
|
+
if (Array.isArray(linkedRepValue)) {
|
|
6144
|
+
const repEntry = linkedRepValue.find((e) => e && typeof e === "object" && e.isSelected !== false && e.recordId);
|
|
6145
|
+
if (repEntry && entries.some((e) => e.isSelected && e.recordId === repEntry.recordId)) return repEntry.recordId;
|
|
6146
|
+
}
|
|
6132
6147
|
const explicit = entries.find((e) => e.isSelected && e.isPrimary);
|
|
6133
6148
|
if (explicit) return explicit.recordId;
|
|
6134
6149
|
const fallback = entries.find((e) => e.isSelected);
|
|
6135
6150
|
return fallback ? fallback.recordId : null;
|
|
6136
|
-
}, [entries]);
|
|
6151
|
+
}, [entries, linkedRepValue]);
|
|
6137
6152
|
const [linkedRecords, setLinkedRecords] = (0, import_react14.useState)(() => {
|
|
6138
6153
|
const initial = [];
|
|
6139
6154
|
for (const entry of entries) {
|
|
@@ -6159,7 +6174,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6159
6174
|
const searchRef = (0, import_react14.useRef)(null);
|
|
6160
6175
|
const searchTimerRef = (0, import_react14.useRef)(null);
|
|
6161
6176
|
const executeAction = context == null ? void 0 : context.executeAction;
|
|
6162
|
-
const referencedTableId = ((
|
|
6177
|
+
const referencedTableId = ((_f = column.config) == null ? void 0 : _f.referencedTableId) || column.referencedTableId;
|
|
6163
6178
|
const fetchedIdsRef = (0, import_react14.useRef)(/* @__PURE__ */ new Set());
|
|
6164
6179
|
(0, import_react14.useEffect)(() => {
|
|
6165
6180
|
if (entries.length > 0) {
|
|
@@ -6241,7 +6256,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6241
6256
|
const [localColumnOrder, setLocalColumnOrder] = (0, import_react14.useState)(null);
|
|
6242
6257
|
(0, import_react14.useEffect)(() => {
|
|
6243
6258
|
setLocalColumnOrder(null);
|
|
6244
|
-
}, [column.name, (
|
|
6259
|
+
}, [column.name, (_g = column.config) == null ? void 0 : _g.subTableColumnOrder]);
|
|
6245
6260
|
const rawTargetColumns = (0, import_react14.useMemo)(() => {
|
|
6246
6261
|
return ((targetSchema == null ? void 0 : targetSchema.columns) || []).filter(
|
|
6247
6262
|
(c) => c.name !== "_id" && c.type !== "SUB_TABLE"
|
|
@@ -6263,7 +6278,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6263
6278
|
return idxA - idxB;
|
|
6264
6279
|
});
|
|
6265
6280
|
return sorted;
|
|
6266
|
-
}, [rawTargetColumns, localColumnOrder, (
|
|
6281
|
+
}, [rawTargetColumns, localColumnOrder, (_h = column.config) == null ? void 0 : _h.subTableColumnOrder]);
|
|
6267
6282
|
const handleSubTableColumnReorder = async (draggedName, dropTargetName) => {
|
|
6268
6283
|
if (draggedName === dropTargetName) return;
|
|
6269
6284
|
const currentNames = targetColumns.map((c) => c.name);
|
|
@@ -6502,6 +6517,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6502
6517
|
if (isReadOnly) return;
|
|
6503
6518
|
const target = entries.find((e) => e.recordId === recordId);
|
|
6504
6519
|
if (!target || !target.isSelected) return;
|
|
6520
|
+
if (!isRepEligible(recordId)) return;
|
|
6505
6521
|
const updated = entries.map((e) => {
|
|
6506
6522
|
const record = linkedRecords.find((r) => r.id === e.recordId);
|
|
6507
6523
|
if (e.recordId === recordId) {
|
|
@@ -6515,6 +6531,9 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6515
6531
|
_resolvedData: (record == null ? void 0 : record.data) || e._resolvedData
|
|
6516
6532
|
});
|
|
6517
6533
|
});
|
|
6534
|
+
if (linkedRepField && (context == null ? void 0 : context.updateQuietly)) {
|
|
6535
|
+
context.updateQuietly(rowId, linkedRepField, [{ recordId, isSelected: true, isPrimary: true }]);
|
|
6536
|
+
}
|
|
6518
6537
|
updateParentLinkage(updated);
|
|
6519
6538
|
};
|
|
6520
6539
|
const isMountedRef = (0, import_react14.useRef)(true);
|
|
@@ -6702,7 +6721,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6702
6721
|
};
|
|
6703
6722
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "p-3 animate-in fade-in slide-in-from-top-2 duration-200", dir: "rtl", children: [
|
|
6704
6723
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-4 mb-2.5", children: [
|
|
6705
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-xs font-bold text-slate-600", children: (
|
|
6724
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-xs font-bold text-slate-600", children: (_j = targetSchema == null ? void 0 : targetSchema.name) != null ? _j : (_i = column.config) == null ? void 0 : _i.referencedTableName }) }),
|
|
6706
6725
|
!isReadOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
6707
6726
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative", ref: searchRef, children: [
|
|
6708
6727
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -6892,10 +6911,10 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6892
6911
|
"button",
|
|
6893
6912
|
{
|
|
6894
6913
|
type: "button",
|
|
6895
|
-
disabled: isReadOnly || !entry.isSelected,
|
|
6914
|
+
disabled: isReadOnly || !entry.isSelected || !isRepEligible(entry.recordId),
|
|
6896
6915
|
onClick: () => handleTogglePrimary(entry.recordId),
|
|
6897
|
-
title: !entry.isSelected ? "\u05D9\u05E9 \u05DC\u05E1\u05DE\u05DF \u05D0\u05EA \u05D4\u05E8\u05E9\u05D5\u05DE\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D2\u05D3\u05D9\u05E8\u05D4 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : entry.recordId === effectivePrimaryRecordId ? "\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : "\u05D4\u05D2\u05D3\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9",
|
|
6898
|
-
className: `p-0.5 rounded transition-all inline-flex items-center justify-center ${entry.recordId === effectivePrimaryRecordId ? "text-amber-500 hover:text-amber-600 scale-110" : "text-slate-300 hover:text-amber-400 hover:scale-105"} ${isReadOnly || !entry.isSelected ? "opacity-25 cursor-not-allowed" : "cursor-pointer"}`,
|
|
6916
|
+
title: !entry.isSelected ? "\u05D9\u05E9 \u05DC\u05E1\u05DE\u05DF \u05D0\u05EA \u05D4\u05E8\u05E9\u05D5\u05DE\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D2\u05D3\u05D9\u05E8\u05D4 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : !isRepEligible(entry.recordId) ? "\u05DB\u05D3\u05D9 \u05DC\u05D1\u05D7\u05D5\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05DE\u05D5\u05E2\u05D3\u05E3, \u05E1\u05DE\u05DF \u05E7\u05D5\u05D3\u05DD '\u05D4\u05D0\u05DD \u05E0\u05E6\u05D9\u05D2'" : entry.recordId === effectivePrimaryRecordId ? "\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : "\u05D4\u05D2\u05D3\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9",
|
|
6917
|
+
className: `p-0.5 rounded transition-all inline-flex items-center justify-center ${entry.recordId === effectivePrimaryRecordId ? "text-amber-500 hover:text-amber-600 scale-110" : "text-slate-300 hover:text-amber-400 hover:scale-105"} ${isReadOnly || !entry.isSelected || !isRepEligible(entry.recordId) ? "opacity-25 cursor-not-allowed" : "cursor-pointer"}`,
|
|
6899
6918
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6900
6919
|
import_lucide_react7.Star,
|
|
6901
6920
|
{
|
|
@@ -7055,7 +7074,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
7055
7074
|
" \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05E7\u05D9\u05D9\u05DE\u05D5\u05EA. \u05D4\u05D0\u05DD \u05DC\u05E7\u05E9\u05E8 \u05D0\u05EA \u05DB\u05D5\u05DC\u05DF?"
|
|
7056
7075
|
] }),
|
|
7057
7076
|
conflictModalState.matchingRecords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "overflow-x-auto border border-slate-200 rounded-lg max-h-48 text-xs bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "w-full text-right border-collapse", children: [
|
|
7058
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: "bg-slate-100 text-slate-700 font-semibold border-b whitespace-nowrap", children: (targetColumns.length > 0 ? targetColumns.filter((c) => c.name !== "_id" && c.name !== "id") : Object.keys(((
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: "bg-slate-100 text-slate-700 font-semibold border-b whitespace-nowrap", children: (targetColumns.length > 0 ? targetColumns.filter((c) => c.name !== "_id" && c.name !== "id") : Object.keys(((_k = conflictModalState.matchingRecords[0]) == null ? void 0 : _k.data) || {}).filter((k) => k !== "_id" && k !== "id").map((name) => ({ name }))).map((col) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
7059
7078
|
"th",
|
|
7060
7079
|
{
|
|
7061
7080
|
className: "bg-slate-100 text-slate-700 font-semibold p-2 border-b whitespace-nowrap",
|
|
@@ -11863,10 +11882,18 @@ function ExpandedSubTables({
|
|
|
11863
11882
|
context
|
|
11864
11883
|
}) {
|
|
11865
11884
|
var _a;
|
|
11866
|
-
const
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11885
|
+
const repMirrorNames = new Set(
|
|
11886
|
+
subTableColumns.map((c) => {
|
|
11887
|
+
var _a2, _b;
|
|
11888
|
+
return (_b = (_a2 = c == null ? void 0 : c.config) == null ? void 0 : _a2.linkConfig) == null ? void 0 : _b.repField;
|
|
11889
|
+
}).filter((n) => typeof n === "string" && n.length > 0)
|
|
11890
|
+
);
|
|
11891
|
+
const visibleColumns = subTableColumns.filter((c) => !repMirrorNames.has(c.name));
|
|
11892
|
+
const tabColumns = visibleColumns.length > 0 ? visibleColumns : subTableColumns;
|
|
11893
|
+
const [activeTab, setActiveTab] = (0, import_react24.useState)((_a = tabColumns[0]) == null ? void 0 : _a.name);
|
|
11894
|
+
if (tabColumns.length === 0) return null;
|
|
11895
|
+
if (tabColumns.length === 1) {
|
|
11896
|
+
const stCol = tabColumns[0];
|
|
11870
11897
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: filteredColumnsLength + 2, className: "p-0 border-b border-slate-200 bg-slate-50/50", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11871
11898
|
SubTableViewer,
|
|
11872
11899
|
{
|
|
@@ -11878,9 +11905,9 @@ function ExpandedSubTables({
|
|
|
11878
11905
|
}
|
|
11879
11906
|
) }) });
|
|
11880
11907
|
}
|
|
11881
|
-
const activeCol =
|
|
11908
|
+
const activeCol = tabColumns.find((c) => c.name === activeTab) || tabColumns[0];
|
|
11882
11909
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("td", { colSpan: filteredColumnsLength + 2, className: "p-0 border-b border-slate-200 bg-slate-50/50 overflow-hidden", children: [
|
|
11883
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex border-b border-slate-200 bg-slate-100/50 px-2 pt-2 gap-1 overflow-hidden", children:
|
|
11910
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex border-b border-slate-200 bg-slate-100/50 px-2 pt-2 gap-1 overflow-hidden", children: tabColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
11884
11911
|
"button",
|
|
11885
11912
|
{
|
|
11886
11913
|
type: "button",
|
package/dist/index.mjs
CHANGED
|
@@ -5925,16 +5925,31 @@ function SubTableCell({
|
|
|
5925
5925
|
);
|
|
5926
5926
|
}
|
|
5927
5927
|
function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
5928
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5928
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
5929
5929
|
const isReadOnly = readOnly != null ? readOnly : Boolean(context == null ? void 0 : context.readOnly);
|
|
5930
5930
|
const { addToast } = useToast();
|
|
5931
5931
|
const entries = Array.isArray(value) ? value : [];
|
|
5932
|
+
const linkedRepField = (_b = (_a = column.config) == null ? void 0 : _a.linkConfig) == null ? void 0 : _b.repField;
|
|
5933
|
+
const linkedRepValue = linkedRepField ? (_c = context == null ? void 0 : context.rowData) == null ? void 0 : _c[linkedRepField] : void 0;
|
|
5934
|
+
const repIndicatorField = (_e = (_d = column.config) == null ? void 0 : _d.linkConfig) == null ? void 0 : _e.repIndicatorField;
|
|
5935
|
+
const isRepEligible = (recordId) => {
|
|
5936
|
+
var _a2, _b2;
|
|
5937
|
+
if (!linkedRepField || !repIndicatorField) return true;
|
|
5938
|
+
const rec = linkedRecords.find((r) => r.id === recordId);
|
|
5939
|
+
const entry = entries.find((e) => e.recordId === recordId);
|
|
5940
|
+
const v = (_b2 = (_a2 = rec == null ? void 0 : rec.data) != null ? _a2 : entry == null ? void 0 : entry._resolvedData) == null ? void 0 : _b2[repIndicatorField];
|
|
5941
|
+
return v === true || v === "true" || v === "TRUE" || v === "\u05DB\u05DF";
|
|
5942
|
+
};
|
|
5932
5943
|
const effectivePrimaryRecordId = useMemo5(() => {
|
|
5944
|
+
if (Array.isArray(linkedRepValue)) {
|
|
5945
|
+
const repEntry = linkedRepValue.find((e) => e && typeof e === "object" && e.isSelected !== false && e.recordId);
|
|
5946
|
+
if (repEntry && entries.some((e) => e.isSelected && e.recordId === repEntry.recordId)) return repEntry.recordId;
|
|
5947
|
+
}
|
|
5933
5948
|
const explicit = entries.find((e) => e.isSelected && e.isPrimary);
|
|
5934
5949
|
if (explicit) return explicit.recordId;
|
|
5935
5950
|
const fallback = entries.find((e) => e.isSelected);
|
|
5936
5951
|
return fallback ? fallback.recordId : null;
|
|
5937
|
-
}, [entries]);
|
|
5952
|
+
}, [entries, linkedRepValue]);
|
|
5938
5953
|
const [linkedRecords, setLinkedRecords] = useState12(() => {
|
|
5939
5954
|
const initial = [];
|
|
5940
5955
|
for (const entry of entries) {
|
|
@@ -5960,7 +5975,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
5960
5975
|
const searchRef = useRef9(null);
|
|
5961
5976
|
const searchTimerRef = useRef9(null);
|
|
5962
5977
|
const executeAction = context == null ? void 0 : context.executeAction;
|
|
5963
|
-
const referencedTableId = ((
|
|
5978
|
+
const referencedTableId = ((_f = column.config) == null ? void 0 : _f.referencedTableId) || column.referencedTableId;
|
|
5964
5979
|
const fetchedIdsRef = useRef9(/* @__PURE__ */ new Set());
|
|
5965
5980
|
useEffect10(() => {
|
|
5966
5981
|
if (entries.length > 0) {
|
|
@@ -6042,7 +6057,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6042
6057
|
const [localColumnOrder, setLocalColumnOrder] = useState12(null);
|
|
6043
6058
|
useEffect10(() => {
|
|
6044
6059
|
setLocalColumnOrder(null);
|
|
6045
|
-
}, [column.name, (
|
|
6060
|
+
}, [column.name, (_g = column.config) == null ? void 0 : _g.subTableColumnOrder]);
|
|
6046
6061
|
const rawTargetColumns = useMemo5(() => {
|
|
6047
6062
|
return ((targetSchema == null ? void 0 : targetSchema.columns) || []).filter(
|
|
6048
6063
|
(c) => c.name !== "_id" && c.type !== "SUB_TABLE"
|
|
@@ -6064,7 +6079,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6064
6079
|
return idxA - idxB;
|
|
6065
6080
|
});
|
|
6066
6081
|
return sorted;
|
|
6067
|
-
}, [rawTargetColumns, localColumnOrder, (
|
|
6082
|
+
}, [rawTargetColumns, localColumnOrder, (_h = column.config) == null ? void 0 : _h.subTableColumnOrder]);
|
|
6068
6083
|
const handleSubTableColumnReorder = async (draggedName, dropTargetName) => {
|
|
6069
6084
|
if (draggedName === dropTargetName) return;
|
|
6070
6085
|
const currentNames = targetColumns.map((c) => c.name);
|
|
@@ -6303,6 +6318,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6303
6318
|
if (isReadOnly) return;
|
|
6304
6319
|
const target = entries.find((e) => e.recordId === recordId);
|
|
6305
6320
|
if (!target || !target.isSelected) return;
|
|
6321
|
+
if (!isRepEligible(recordId)) return;
|
|
6306
6322
|
const updated = entries.map((e) => {
|
|
6307
6323
|
const record = linkedRecords.find((r) => r.id === e.recordId);
|
|
6308
6324
|
if (e.recordId === recordId) {
|
|
@@ -6316,6 +6332,9 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6316
6332
|
_resolvedData: (record == null ? void 0 : record.data) || e._resolvedData
|
|
6317
6333
|
});
|
|
6318
6334
|
});
|
|
6335
|
+
if (linkedRepField && (context == null ? void 0 : context.updateQuietly)) {
|
|
6336
|
+
context.updateQuietly(rowId, linkedRepField, [{ recordId, isSelected: true, isPrimary: true }]);
|
|
6337
|
+
}
|
|
6319
6338
|
updateParentLinkage(updated);
|
|
6320
6339
|
};
|
|
6321
6340
|
const isMountedRef = useRef9(true);
|
|
@@ -6503,7 +6522,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6503
6522
|
};
|
|
6504
6523
|
return /* @__PURE__ */ jsxs11("div", { className: "p-3 animate-in fade-in slide-in-from-top-2 duration-200", dir: "rtl", children: [
|
|
6505
6524
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 mb-2.5", children: [
|
|
6506
|
-
/* @__PURE__ */ jsx13("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx13("span", { className: "text-xs font-bold text-slate-600", children: (
|
|
6525
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx13("span", { className: "text-xs font-bold text-slate-600", children: (_j = targetSchema == null ? void 0 : targetSchema.name) != null ? _j : (_i = column.config) == null ? void 0 : _i.referencedTableName }) }),
|
|
6507
6526
|
!isReadOnly && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
|
|
6508
6527
|
/* @__PURE__ */ jsxs11("div", { className: "relative", ref: searchRef, children: [
|
|
6509
6528
|
/* @__PURE__ */ jsxs11(
|
|
@@ -6693,10 +6712,10 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6693
6712
|
"button",
|
|
6694
6713
|
{
|
|
6695
6714
|
type: "button",
|
|
6696
|
-
disabled: isReadOnly || !entry.isSelected,
|
|
6715
|
+
disabled: isReadOnly || !entry.isSelected || !isRepEligible(entry.recordId),
|
|
6697
6716
|
onClick: () => handleTogglePrimary(entry.recordId),
|
|
6698
|
-
title: !entry.isSelected ? "\u05D9\u05E9 \u05DC\u05E1\u05DE\u05DF \u05D0\u05EA \u05D4\u05E8\u05E9\u05D5\u05DE\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D2\u05D3\u05D9\u05E8\u05D4 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : entry.recordId === effectivePrimaryRecordId ? "\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : "\u05D4\u05D2\u05D3\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9",
|
|
6699
|
-
className: `p-0.5 rounded transition-all inline-flex items-center justify-center ${entry.recordId === effectivePrimaryRecordId ? "text-amber-500 hover:text-amber-600 scale-110" : "text-slate-300 hover:text-amber-400 hover:scale-105"} ${isReadOnly || !entry.isSelected ? "opacity-25 cursor-not-allowed" : "cursor-pointer"}`,
|
|
6717
|
+
title: !entry.isSelected ? "\u05D9\u05E9 \u05DC\u05E1\u05DE\u05DF \u05D0\u05EA \u05D4\u05E8\u05E9\u05D5\u05DE\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D2\u05D3\u05D9\u05E8\u05D4 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : !isRepEligible(entry.recordId) ? "\u05DB\u05D3\u05D9 \u05DC\u05D1\u05D7\u05D5\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05DE\u05D5\u05E2\u05D3\u05E3, \u05E1\u05DE\u05DF \u05E7\u05D5\u05D3\u05DD '\u05D4\u05D0\u05DD \u05E0\u05E6\u05D9\u05D2'" : entry.recordId === effectivePrimaryRecordId ? "\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9" : "\u05D4\u05D2\u05D3\u05E8 \u05DB\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9",
|
|
6718
|
+
className: `p-0.5 rounded transition-all inline-flex items-center justify-center ${entry.recordId === effectivePrimaryRecordId ? "text-amber-500 hover:text-amber-600 scale-110" : "text-slate-300 hover:text-amber-400 hover:scale-105"} ${isReadOnly || !entry.isSelected || !isRepEligible(entry.recordId) ? "opacity-25 cursor-not-allowed" : "cursor-pointer"}`,
|
|
6700
6719
|
children: /* @__PURE__ */ jsx13(
|
|
6701
6720
|
Star,
|
|
6702
6721
|
{
|
|
@@ -6856,7 +6875,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
6856
6875
|
" \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05E7\u05D9\u05D9\u05DE\u05D5\u05EA. \u05D4\u05D0\u05DD \u05DC\u05E7\u05E9\u05E8 \u05D0\u05EA \u05DB\u05D5\u05DC\u05DF?"
|
|
6857
6876
|
] }),
|
|
6858
6877
|
conflictModalState.matchingRecords.length > 0 && /* @__PURE__ */ jsx13("div", { className: "overflow-x-auto border border-slate-200 rounded-lg max-h-48 text-xs bg-white", children: /* @__PURE__ */ jsxs11("table", { className: "w-full text-right border-collapse", children: [
|
|
6859
|
-
/* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsx13("tr", { className: "bg-slate-100 text-slate-700 font-semibold border-b whitespace-nowrap", children: (targetColumns.length > 0 ? targetColumns.filter((c) => c.name !== "_id" && c.name !== "id") : Object.keys(((
|
|
6878
|
+
/* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsx13("tr", { className: "bg-slate-100 text-slate-700 font-semibold border-b whitespace-nowrap", children: (targetColumns.length > 0 ? targetColumns.filter((c) => c.name !== "_id" && c.name !== "id") : Object.keys(((_k = conflictModalState.matchingRecords[0]) == null ? void 0 : _k.data) || {}).filter((k) => k !== "_id" && k !== "id").map((name) => ({ name }))).map((col) => /* @__PURE__ */ jsx13(
|
|
6860
6879
|
"th",
|
|
6861
6880
|
{
|
|
6862
6881
|
className: "bg-slate-100 text-slate-700 font-semibold p-2 border-b whitespace-nowrap",
|
|
@@ -11664,10 +11683,18 @@ function ExpandedSubTables({
|
|
|
11664
11683
|
context
|
|
11665
11684
|
}) {
|
|
11666
11685
|
var _a;
|
|
11667
|
-
const
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11686
|
+
const repMirrorNames = new Set(
|
|
11687
|
+
subTableColumns.map((c) => {
|
|
11688
|
+
var _a2, _b;
|
|
11689
|
+
return (_b = (_a2 = c == null ? void 0 : c.config) == null ? void 0 : _a2.linkConfig) == null ? void 0 : _b.repField;
|
|
11690
|
+
}).filter((n) => typeof n === "string" && n.length > 0)
|
|
11691
|
+
);
|
|
11692
|
+
const visibleColumns = subTableColumns.filter((c) => !repMirrorNames.has(c.name));
|
|
11693
|
+
const tabColumns = visibleColumns.length > 0 ? visibleColumns : subTableColumns;
|
|
11694
|
+
const [activeTab, setActiveTab] = useState20((_a = tabColumns[0]) == null ? void 0 : _a.name);
|
|
11695
|
+
if (tabColumns.length === 0) return null;
|
|
11696
|
+
if (tabColumns.length === 1) {
|
|
11697
|
+
const stCol = tabColumns[0];
|
|
11671
11698
|
return /* @__PURE__ */ jsx21("tr", { children: /* @__PURE__ */ jsx21("td", { colSpan: filteredColumnsLength + 2, className: "p-0 border-b border-slate-200 bg-slate-50/50", children: /* @__PURE__ */ jsx21(
|
|
11672
11699
|
SubTableViewer,
|
|
11673
11700
|
{
|
|
@@ -11679,9 +11706,9 @@ function ExpandedSubTables({
|
|
|
11679
11706
|
}
|
|
11680
11707
|
) }) });
|
|
11681
11708
|
}
|
|
11682
|
-
const activeCol =
|
|
11709
|
+
const activeCol = tabColumns.find((c) => c.name === activeTab) || tabColumns[0];
|
|
11683
11710
|
return /* @__PURE__ */ jsx21("tr", { children: /* @__PURE__ */ jsxs17("td", { colSpan: filteredColumnsLength + 2, className: "p-0 border-b border-slate-200 bg-slate-50/50 overflow-hidden", children: [
|
|
11684
|
-
/* @__PURE__ */ jsx21("div", { className: "flex border-b border-slate-200 bg-slate-100/50 px-2 pt-2 gap-1 overflow-hidden", children:
|
|
11711
|
+
/* @__PURE__ */ jsx21("div", { className: "flex border-b border-slate-200 bg-slate-100/50 px-2 pt-2 gap-1 overflow-hidden", children: tabColumns.map((col) => /* @__PURE__ */ jsx21(
|
|
11685
11712
|
"button",
|
|
11686
11713
|
{
|
|
11687
11714
|
type: "button",
|