@universe-platform/ui 0.1.0-beta.53 → 0.1.0-beta.54
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 +13 -0
- package/dist/index.mjs +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5506,6 +5506,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
5506
5506
|
{
|
|
5507
5507
|
type: "button",
|
|
5508
5508
|
onClick: () => {
|
|
5509
|
+
var _a2, _b2, _c2;
|
|
5509
5510
|
setIsCreating(true);
|
|
5510
5511
|
const initialData = {};
|
|
5511
5512
|
targetColumns.forEach((c) => {
|
|
@@ -5517,6 +5518,18 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
5517
5518
|
else initialData[c.name] = "";
|
|
5518
5519
|
}
|
|
5519
5520
|
});
|
|
5521
|
+
const linkCfg = (_a2 = column.config) == null ? void 0 : _a2.linkConfig;
|
|
5522
|
+
const parentRowData = (context == null ? void 0 : context.rowData) || ((_b2 = context == null ? void 0 : context.parentRecord) == null ? void 0 : _b2.data);
|
|
5523
|
+
if ((linkCfg == null ? void 0 : linkCfg.parentMatchField) && (linkCfg == null ? void 0 : linkCfg.subTableMatchField) && parentRowData) {
|
|
5524
|
+
const parentValue = parentRowData[linkCfg.parentMatchField];
|
|
5525
|
+
const hasParentValue = parentValue !== void 0 && parentValue !== null && String(parentValue).trim() !== "";
|
|
5526
|
+
const matchCol = targetColumns.find((c) => c.name === linkCfg.subTableMatchField);
|
|
5527
|
+
if (hasParentValue && matchCol) {
|
|
5528
|
+
const matchType = (_c2 = matchCol.type) == null ? void 0 : _c2.toUpperCase();
|
|
5529
|
+
const asNumber = Number(parentValue);
|
|
5530
|
+
initialData[matchCol.name] = matchType === "NUMBER" || matchType === "CURRENCY" ? isNaN(asNumber) ? 0 : asNumber : String(parentValue);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5520
5533
|
setNewRecordData(initialData);
|
|
5521
5534
|
},
|
|
5522
5535
|
className: "h-7 px-2.5 text-[11px] font-semibold bg-emerald-50 hover:bg-emerald-100 text-emerald-700 border border-emerald-200 rounded-md transition-colors cursor-pointer flex items-center gap-1",
|
package/dist/index.mjs
CHANGED
|
@@ -5355,6 +5355,7 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
5355
5355
|
{
|
|
5356
5356
|
type: "button",
|
|
5357
5357
|
onClick: () => {
|
|
5358
|
+
var _a2, _b2, _c2;
|
|
5358
5359
|
setIsCreating(true);
|
|
5359
5360
|
const initialData = {};
|
|
5360
5361
|
targetColumns.forEach((c) => {
|
|
@@ -5366,6 +5367,18 @@ function SubTableViewer({ rowId, column, value, onChange, context, readOnly }) {
|
|
|
5366
5367
|
else initialData[c.name] = "";
|
|
5367
5368
|
}
|
|
5368
5369
|
});
|
|
5370
|
+
const linkCfg = (_a2 = column.config) == null ? void 0 : _a2.linkConfig;
|
|
5371
|
+
const parentRowData = (context == null ? void 0 : context.rowData) || ((_b2 = context == null ? void 0 : context.parentRecord) == null ? void 0 : _b2.data);
|
|
5372
|
+
if ((linkCfg == null ? void 0 : linkCfg.parentMatchField) && (linkCfg == null ? void 0 : linkCfg.subTableMatchField) && parentRowData) {
|
|
5373
|
+
const parentValue = parentRowData[linkCfg.parentMatchField];
|
|
5374
|
+
const hasParentValue = parentValue !== void 0 && parentValue !== null && String(parentValue).trim() !== "";
|
|
5375
|
+
const matchCol = targetColumns.find((c) => c.name === linkCfg.subTableMatchField);
|
|
5376
|
+
if (hasParentValue && matchCol) {
|
|
5377
|
+
const matchType = (_c2 = matchCol.type) == null ? void 0 : _c2.toUpperCase();
|
|
5378
|
+
const asNumber = Number(parentValue);
|
|
5379
|
+
initialData[matchCol.name] = matchType === "NUMBER" || matchType === "CURRENCY" ? isNaN(asNumber) ? 0 : asNumber : String(parentValue);
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5369
5382
|
setNewRecordData(initialData);
|
|
5370
5383
|
},
|
|
5371
5384
|
className: "h-7 px-2.5 text-[11px] font-semibold bg-emerald-50 hover:bg-emerald-100 text-emerald-700 border border-emerald-200 rounded-md transition-colors cursor-pointer flex items-center gap-1",
|