@mcurros2/microm 1.1.293-0 → 1.1.294-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/dist/index.d.ts +83 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +850 -294
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2309,6 +2309,8 @@ var $TaFFV = parcelRequire("TaFFV");
|
|
|
2309
2309
|
|
|
2310
2310
|
var $5vnOT = parcelRequire("5vnOT");
|
|
2311
2311
|
|
|
2312
|
+
var $7qUhz = parcelRequire("7qUhz");
|
|
2313
|
+
|
|
2312
2314
|
var $hkmnY = parcelRequire("hkmnY");
|
|
2313
2315
|
$parcel$exportWildcard(module.exports, $iKzSR);
|
|
2314
2316
|
$parcel$exportWildcard(module.exports, $bmxG4);
|
|
@@ -2329,6 +2331,7 @@ $parcel$exportWildcard(module.exports, $7T941);
|
|
|
2329
2331
|
$parcel$exportWildcard(module.exports, $9dFnv);
|
|
2330
2332
|
$parcel$exportWildcard(module.exports, $TaFFV);
|
|
2331
2333
|
$parcel$exportWildcard(module.exports, $5vnOT);
|
|
2334
|
+
$parcel$exportWildcard(module.exports, $7qUhz);
|
|
2332
2335
|
$parcel$exportWildcard(module.exports, $hkmnY);
|
|
2333
2336
|
|
|
2334
2337
|
});
|
|
@@ -3178,6 +3181,9 @@ parcelRegister("h4O7Z", function(module, exports) {
|
|
|
3178
3181
|
|
|
3179
3182
|
parcelRegister("e12RS", function(module, exports) {
|
|
3180
3183
|
|
|
3184
|
+
$parcel$export(module.exports, "DefaultKeySeparator", function () { return $f2b3ec1f76edf8b0$export$19de16090a0b5ca7; });
|
|
3185
|
+
const $f2b3ec1f76edf8b0$export$19de16090a0b5ca7 = '-';
|
|
3186
|
+
|
|
3181
3187
|
});
|
|
3182
3188
|
|
|
3183
3189
|
parcelRegister("kY0Yt", function(module, exports) {
|
|
@@ -3425,11 +3431,13 @@ function $ff0229238bff77e7$export$1e992583465cbafe(obj) {
|
|
|
3425
3431
|
// Basic checks for required properties
|
|
3426
3432
|
const hasBasicProps = typeof obj === "object" && obj !== null && typeof obj.name === "string" && typeof obj.entityConstructor === "function";
|
|
3427
3433
|
// Optional properties
|
|
3428
|
-
const
|
|
3429
|
-
const
|
|
3430
|
-
const
|
|
3431
|
-
const
|
|
3432
|
-
|
|
3434
|
+
const lookup = obj;
|
|
3435
|
+
const hasView = lookup?.view === undefined || typeof lookup.view === "string";
|
|
3436
|
+
const hasProc = lookup?.proc === undefined || typeof lookup.proc === "string";
|
|
3437
|
+
const hasBindingColumnKey = lookup?.bindingColumnKey === undefined || typeof lookup.bindingColumnKey === "string";
|
|
3438
|
+
const hasCompoundKeyGroupName = lookup?.compoundKeyGroupName === undefined || typeof lookup.compoundKeyGroupName === "string";
|
|
3439
|
+
const hasViewMapping = lookup?.viewMapping === undefined || $ff0229238bff77e7$export$6c0c5d5a180781be(lookup.viewMapping);
|
|
3440
|
+
return hasBasicProps && hasView && hasProc && hasBindingColumnKey && hasCompoundKeyGroupName && hasViewMapping;
|
|
3433
3441
|
}
|
|
3434
3442
|
|
|
3435
3443
|
});
|
|
@@ -3551,6 +3559,60 @@ class $3486445f405aa87a$export$a333b91d5f4a5e74 {
|
|
|
3551
3559
|
|
|
3552
3560
|
});
|
|
3553
3561
|
|
|
3562
|
+
parcelRegister("7qUhz", function(module, exports) {
|
|
3563
|
+
|
|
3564
|
+
$parcel$export(module.exports, "MaxCompoundKeyValues", function () { return $339509672b4afaaa$export$436aa97c91eff738; });
|
|
3565
|
+
$parcel$export(module.exports, "getOrderedCompoundKeyMappings", function () { return $339509672b4afaaa$export$2c47116d1da7d40c; });
|
|
3566
|
+
$parcel$export(module.exports, "resolveCompoundKeyGroup", function () { return $339509672b4afaaa$export$46fc332f80e0e47; });
|
|
3567
|
+
$parcel$export(module.exports, "splitCompoundKey", function () { return $339509672b4afaaa$export$bf74a7b66f5064ad; });
|
|
3568
|
+
$parcel$export(module.exports, "composeCompoundKey", function () { return $339509672b4afaaa$export$dc2eb1d80ba42023; });
|
|
3569
|
+
$parcel$export(module.exports, "extractCompoundKeyValues", function () { return $339509672b4afaaa$export$9ba7fe989b927b10; });
|
|
3570
|
+
$parcel$export(module.exports, "extractCompoundRecordKeys", function () { return $339509672b4afaaa$export$d385a667f0f7c0ea; });
|
|
3571
|
+
|
|
3572
|
+
var $e12RS = parcelRequire("e12RS");
|
|
3573
|
+
const $339509672b4afaaa$export$436aa97c91eff738 = 10;
|
|
3574
|
+
function $339509672b4afaaa$export$2c47116d1da7d40c(group) {
|
|
3575
|
+
const mappings = Object.entries(group.keyMappings).sort((left, right)=>left[1] - right[1]);
|
|
3576
|
+
if (mappings.length < 2 || mappings.length > $339509672b4afaaa$export$436aa97c91eff738 || mappings.some(([, position], index)=>position !== index)) throw new Error(`Compound key groups must define ${2}-${$339509672b4afaaa$export$436aa97c91eff738} unique, contiguous positions beginning at zero.`);
|
|
3577
|
+
return mappings;
|
|
3578
|
+
}
|
|
3579
|
+
function $339509672b4afaaa$export$46fc332f80e0e47(view, groupName) {
|
|
3580
|
+
const group = view.compoundKeyGroups?.[groupName];
|
|
3581
|
+
if (!group) throw new Error(`Compound key group '${groupName}' was not found in view '${view.name}'.`);
|
|
3582
|
+
$339509672b4afaaa$export$2c47116d1da7d40c(group);
|
|
3583
|
+
return group;
|
|
3584
|
+
}
|
|
3585
|
+
function $339509672b4afaaa$export$bf74a7b66f5064ad(rawValue, group) {
|
|
3586
|
+
const expectedCount = $339509672b4afaaa$export$2c47116d1da7d40c(group).length;
|
|
3587
|
+
const values = rawValue.split(group.keySeparator ?? (0, $e12RS.DefaultKeySeparator));
|
|
3588
|
+
return {
|
|
3589
|
+
values: values,
|
|
3590
|
+
complete: values.length === expectedCount && values.every((value)=>value.length > 0)
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
function $339509672b4afaaa$export$dc2eb1d80ba42023(values, group) {
|
|
3594
|
+
$339509672b4afaaa$export$2c47116d1da7d40c(group);
|
|
3595
|
+
const parts = values.map((value)=>value?.toString() ?? '');
|
|
3596
|
+
return parts.every((value)=>value.length === 0) ? '' : parts.join(group.keySeparator ?? (0, $e12RS.DefaultKeySeparator));
|
|
3597
|
+
}
|
|
3598
|
+
function $339509672b4afaaa$export$9ba7fe989b927b10(keys, group) {
|
|
3599
|
+
const values = $339509672b4afaaa$export$2c47116d1da7d40c(group).map(([columnName])=>keys[columnName]);
|
|
3600
|
+
return values.every((value)=>value !== undefined && value !== null && value.toString().length > 0) ? values : undefined;
|
|
3601
|
+
}
|
|
3602
|
+
function $339509672b4afaaa$export$d385a667f0f7c0ea(record, group) {
|
|
3603
|
+
const properties = Object.keys(record);
|
|
3604
|
+
if (group.viewIndex < 0 || group.viewIndex >= properties.length) return undefined;
|
|
3605
|
+
const rawValue = record[properties[group.viewIndex]];
|
|
3606
|
+
if (typeof rawValue !== 'string') return undefined;
|
|
3607
|
+
const split = $339509672b4afaaa$export$bf74a7b66f5064ad(rawValue, group);
|
|
3608
|
+
if (!split.complete) return undefined;
|
|
3609
|
+
const result = {};
|
|
3610
|
+
$339509672b4afaaa$export$2c47116d1da7d40c(group).forEach(([columnName, position])=>result[columnName] = split.values[position]);
|
|
3611
|
+
return result;
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
});
|
|
3615
|
+
|
|
3554
3616
|
parcelRegister("hkmnY", function(module, exports) {
|
|
3555
3617
|
|
|
3556
3618
|
});
|
|
@@ -33743,6 +33805,8 @@ parcelRegister("5JIrZ", function(module, exports) {
|
|
|
33743
33805
|
$parcel$export(module.exports, "useDataGrid", function () { return $8e67432a124f4bfb$export$f77741f33c48605; });
|
|
33744
33806
|
|
|
33745
33807
|
|
|
33808
|
+
parcelRequire("2eyXi");
|
|
33809
|
+
var $7qUhz = parcelRequire("7qUhz");
|
|
33746
33810
|
parcelRequire("7xGLy");
|
|
33747
33811
|
var $1uAlg = parcelRequire("1uAlg");
|
|
33748
33812
|
function $8e67432a124f4bfb$export$f77741f33c48605(props, stateProps) {
|
|
@@ -33801,13 +33865,24 @@ function $8e67432a124f4bfb$export$f77741f33c48605(props, stateProps) {
|
|
|
33801
33865
|
const record = selection[i];
|
|
33802
33866
|
const keys = {};
|
|
33803
33867
|
const record_properties = Object.keys(record);
|
|
33868
|
+
// direct key mappings
|
|
33804
33869
|
const key_mappings = entity.def.views[viewName].keyMappings;
|
|
33805
33870
|
for(const columnName in key_mappings){
|
|
33806
33871
|
const idx = key_mappings[columnName];
|
|
33807
33872
|
if (idx >= record_properties.length) continue;
|
|
33808
33873
|
keys[columnName] = record[record_properties[idx]];
|
|
33809
33874
|
}
|
|
33810
|
-
|
|
33875
|
+
const compound_key_groups = entity.def.views[viewName].compoundKeyGroups ?? {};
|
|
33876
|
+
for(const groupName in compound_key_groups){
|
|
33877
|
+
const compoundGroup = compound_key_groups[groupName];
|
|
33878
|
+
const compoundKeys = (0, $7qUhz.extractCompoundRecordKeys)(record, compoundGroup);
|
|
33879
|
+
if (!compoundKeys) {
|
|
33880
|
+
console.warn(`DataGrid: compound key group '${groupName}' in view '${viewName}' has an incomplete result value; its keys were omitted.`);
|
|
33881
|
+
continue;
|
|
33882
|
+
}
|
|
33883
|
+
Object.assign(keys, compoundKeys);
|
|
33884
|
+
}
|
|
33885
|
+
result.push(keys);
|
|
33811
33886
|
}
|
|
33812
33887
|
return result;
|
|
33813
33888
|
}, [
|
|
@@ -34243,6 +34318,8 @@ var $726hz = parcelRequire("726hz");
|
|
|
34243
34318
|
|
|
34244
34319
|
var $2Zki2 = parcelRequire("2Zki2");
|
|
34245
34320
|
|
|
34321
|
+
var $gMI48 = parcelRequire("gMI48");
|
|
34322
|
+
|
|
34246
34323
|
var $iuZkb = parcelRequire("iuZkb");
|
|
34247
34324
|
|
|
34248
34325
|
var $42GxC = parcelRequire("42GxC");
|
|
@@ -34251,6 +34328,7 @@ var $hiss3 = parcelRequire("hiss3");
|
|
|
34251
34328
|
$parcel$exportWildcard(module.exports, $d1Ssg);
|
|
34252
34329
|
$parcel$exportWildcard(module.exports, $726hz);
|
|
34253
34330
|
$parcel$exportWildcard(module.exports, $2Zki2);
|
|
34331
|
+
$parcel$exportWildcard(module.exports, $gMI48);
|
|
34254
34332
|
$parcel$exportWildcard(module.exports, $iuZkb);
|
|
34255
34333
|
$parcel$exportWildcard(module.exports, $42GxC);
|
|
34256
34334
|
$parcel$exportWildcard(module.exports, $hiss3);
|
|
@@ -34258,8 +34336,28 @@ $parcel$exportWildcard(module.exports, $hiss3);
|
|
|
34258
34336
|
});
|
|
34259
34337
|
parcelRegister("d1Ssg", function(module, exports) {
|
|
34260
34338
|
|
|
34261
|
-
$parcel$export(module.exports, "LookupDefaultProps", function () { return $3c9a6257599b90ac$export$9c2b2ccf03658905; });
|
|
34262
34339
|
$parcel$export(module.exports, "Lookup", function () { return $3c9a6257599b90ac$export$710993ff54d9590c; });
|
|
34340
|
+
$parcel$export(module.exports, "LookupDefaultProps", function () { return (parcelRequire("557VF")).LookupDefaultProps; });
|
|
34341
|
+
|
|
34342
|
+
|
|
34343
|
+
var $5hHAJ = parcelRequire("5hHAJ");
|
|
34344
|
+
|
|
34345
|
+
var $557VF = parcelRequire("557VF");
|
|
34346
|
+
|
|
34347
|
+
var $7Gk9n = parcelRequire("7Gk9n");
|
|
34348
|
+
function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
34349
|
+
if (props.bindingColumns) return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $5hHAJ.CompoundLookup), {
|
|
34350
|
+
...props
|
|
34351
|
+
});
|
|
34352
|
+
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $7Gk9n.SingleLookup), {
|
|
34353
|
+
...props
|
|
34354
|
+
});
|
|
34355
|
+
}
|
|
34356
|
+
|
|
34357
|
+
});
|
|
34358
|
+
parcelRegister("5hHAJ", function(module, exports) {
|
|
34359
|
+
|
|
34360
|
+
$parcel$export(module.exports, "CompoundLookup", function () { return $9d29608dc6ae79e3$export$7c17b3a1430b33c0; });
|
|
34263
34361
|
|
|
34264
34362
|
|
|
34265
34363
|
|
|
@@ -34267,73 +34365,49 @@ $parcel$export(module.exports, "Lookup", function () { return $3c9a6257599b90ac$
|
|
|
34267
34365
|
|
|
34268
34366
|
parcelRequire("2eyXi");
|
|
34269
34367
|
var $4H7ea = parcelRequire("4H7ea");
|
|
34270
|
-
|
|
34271
|
-
var $
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
const $3c9a6257599b90ac$export$9c2b2ccf03658905 = {
|
|
34275
|
-
idMaxWidth: "15rem",
|
|
34276
|
-
icon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconSearch), {
|
|
34368
|
+
|
|
34369
|
+
var $gMI48 = parcelRequire("gMI48");
|
|
34370
|
+
function $9d29608dc6ae79e3$export$7c17b3a1430b33c0(props) {
|
|
34371
|
+
const { entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, autoFocus: autoFocus, label: label, parentKeys: parentKeys, bindingColumns: bindingColumns, required: required, readonly: readonly, disabled: disabled, idMaxWidth: idMaxWidth = "15rem", icon: icon = /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconSearch), {
|
|
34277
34372
|
size: "1rem",
|
|
34278
34373
|
stroke: "1.5"
|
|
34279
|
-
}),
|
|
34280
|
-
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
|
|
34285
|
-
|
|
34286
|
-
enableView: true,
|
|
34287
|
-
autoTrim: true
|
|
34288
|
-
};
|
|
34289
|
-
function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
34290
|
-
const { entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, autoFocus: autoFocus, label: label, parentKeys: parentKeys, column: column, required: required, readonly: readonly, disabled: disabled, idMaxWidth: idMaxWidth, icon: icon, iconVariant: iconVariant, requiredLabel: requiredLabel, description: description, size: size, onLookupPerformed: onLookupPerformed, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform, autoTrim: autoTrim } = (0, $b4te3$mantinecore.useComponentDefaultProps)('Lookup', $3c9a6257599b90ac$export$9c2b2ccf03658905, props);
|
|
34374
|
+
}), iconVariant: iconVariant = "light", requiredLabel: requiredLabel = "A value is required", description: description, size: size = "sm", onLookupPerformed: onLookupPerformed, enableAdd: enableAdd = false, enableEdit: enableEdit = false, enableDelete: enableDelete = false, enableView: enableView = true, transform: transform, autoTrim: autoTrim = true } = props;
|
|
34375
|
+
if (bindingColumns.length < 2) throw new Error('Compound Lookup requires at least two bindingColumns.');
|
|
34376
|
+
const significantColumn = bindingColumns[bindingColumns.length - 1];
|
|
34377
|
+
const bindingColumnKey = bindingColumns.map((column)=>column.name).join('\u0000');
|
|
34378
|
+
const bindingColumnNames = (0, $b4te3$react.useMemo)(()=>bindingColumns.map((column)=>column.name), [
|
|
34379
|
+
bindingColumnKey
|
|
34380
|
+
]);
|
|
34291
34381
|
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
34292
|
-
const
|
|
34293
|
-
const
|
|
34294
|
-
entityForm: entityForm,
|
|
34295
|
-
column: column,
|
|
34296
|
-
transform: transform,
|
|
34297
|
-
autoTrim: autoTrim
|
|
34298
|
-
});
|
|
34299
|
-
const lookupAPI = (0, $2Zki2.useLookup)({
|
|
34382
|
+
const inputRef = (0, $b4te3$react.useRef)(null);
|
|
34383
|
+
const lookupAPI = (0, $gMI48.useCompoundLookup)({
|
|
34300
34384
|
entityForm: entityForm,
|
|
34301
34385
|
entity: entity,
|
|
34302
34386
|
lookupDefName: lookupDefName,
|
|
34303
|
-
|
|
34387
|
+
bindingColumns: bindingColumnNames,
|
|
34304
34388
|
parentKeys: parentKeys,
|
|
34305
34389
|
required: required,
|
|
34306
|
-
|
|
34390
|
+
inputRef: inputRef,
|
|
34307
34391
|
enableAdd: enableAdd,
|
|
34308
34392
|
enableEdit: enableEdit,
|
|
34309
34393
|
enableDelete: enableDelete,
|
|
34310
34394
|
enableView: enableView,
|
|
34311
|
-
transform:
|
|
34395
|
+
transform: transform,
|
|
34396
|
+
autoTrim: autoTrim
|
|
34312
34397
|
});
|
|
34313
34398
|
(0, $b4te3$react.useEffect)(()=>{
|
|
34314
|
-
if (required ?? !
|
|
34315
|
-
else entityForm.removeValidation(
|
|
34399
|
+
if (required ?? !significantColumn.hasFlag((0, $4H7ea.EntityColumnFlags).nullable)) entityForm.configureField(significantColumn, (0, $b4te3$mantineform.isNotEmpty)(requiredLabel));
|
|
34400
|
+
else entityForm.removeValidation(significantColumn);
|
|
34316
34401
|
}, [
|
|
34317
|
-
column,
|
|
34318
34402
|
entityForm,
|
|
34319
34403
|
required,
|
|
34320
|
-
requiredLabel
|
|
34404
|
+
requiredLabel,
|
|
34405
|
+
significantColumn
|
|
34321
34406
|
]);
|
|
34322
|
-
const controlSize = (0, $b4te3$mantinecore.getSize)({
|
|
34323
|
-
size: size ?? "sm",
|
|
34324
|
-
sizes: theme.fontSizes
|
|
34325
|
-
});
|
|
34326
|
-
const descriptionSize = (0, $b4te3$mantinecore.getSize)({
|
|
34327
|
-
size: size ?? "sm",
|
|
34328
|
-
sizes: theme.fontSizes
|
|
34329
|
-
});
|
|
34330
|
-
const labelColor = theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[9];
|
|
34331
|
-
const descriptionColor = theme.colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[6];
|
|
34332
|
-
// MMC: set the binding column description value
|
|
34333
34407
|
(0, $b4te3$react.useEffect)(()=>{
|
|
34334
|
-
column.valueDescription = lookupAPI.lookupResult?.description;
|
|
34408
|
+
bindingColumns.forEach((column, index)=>column.valueDescription = index === bindingColumns.length - 1 ? lookupAPI.lookupResult?.description : undefined);
|
|
34335
34409
|
}, [
|
|
34336
|
-
|
|
34410
|
+
bindingColumns,
|
|
34337
34411
|
lookupAPI.lookupResult?.description
|
|
34338
34412
|
]);
|
|
34339
34413
|
(0, $b4te3$react.useEffect)(()=>{
|
|
@@ -34342,10 +34416,20 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34342
34416
|
lookupAPI.lookupResult,
|
|
34343
34417
|
onLookupPerformed
|
|
34344
34418
|
]);
|
|
34419
|
+
const controlSize = (0, $b4te3$mantinecore.getSize)({
|
|
34420
|
+
size: size,
|
|
34421
|
+
sizes: theme.fontSizes
|
|
34422
|
+
});
|
|
34423
|
+
const descriptionSize = (0, $b4te3$mantinecore.getSize)({
|
|
34424
|
+
size: size,
|
|
34425
|
+
sizes: theme.fontSizes
|
|
34426
|
+
});
|
|
34427
|
+
const labelColor = theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[9];
|
|
34428
|
+
const descriptionColor = theme.colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[6];
|
|
34345
34429
|
const { formMode: formMode, status: status } = entityForm;
|
|
34346
|
-
const
|
|
34347
|
-
const
|
|
34348
|
-
const
|
|
34430
|
+
const addAutofocus = formMode === 'add' ? true : undefined;
|
|
34431
|
+
const editAutofocus = status.loading === false && formMode !== 'add' ? true : undefined;
|
|
34432
|
+
const readonlyCondition = readonly === undefined ? significantColumn.hasFlag((0, $4H7ea.EntityColumnFlags).autoNum) || entityForm.formMode !== 'add' && significantColumn.hasFlag((0, $4H7ea.EntityColumnFlags).pk) : readonly;
|
|
34349
34433
|
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
34350
34434
|
style: {
|
|
34351
34435
|
gap: "0.1rem",
|
|
@@ -34361,9 +34445,9 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34361
34445
|
size: controlSize,
|
|
34362
34446
|
weight: "500",
|
|
34363
34447
|
color: labelColor,
|
|
34364
|
-
children: label ??
|
|
34448
|
+
children: label ?? significantColumn.prompt
|
|
34365
34449
|
}),
|
|
34366
|
-
(required ?? (!readonly &&
|
|
34450
|
+
(required ?? (!readonly && entityForm.formMode !== 'view' && !significantColumn.hasFlag((0, $4H7ea.EntityColumnFlags).nullable))) && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
34367
34451
|
size: controlSize,
|
|
34368
34452
|
weight: "500",
|
|
34369
34453
|
color: theme.colors.red[5],
|
|
@@ -34371,13 +34455,13 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34371
34455
|
})
|
|
34372
34456
|
]
|
|
34373
34457
|
}),
|
|
34374
|
-
(description ??
|
|
34458
|
+
(description ?? significantColumn.description) && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
34375
34459
|
style: {
|
|
34376
34460
|
fontSize: `calc(${descriptionSize} - ${(0, $b4te3$mantinecore.rem)(2)})`,
|
|
34377
34461
|
lineHeight: 1.2
|
|
34378
34462
|
},
|
|
34379
34463
|
color: descriptionColor,
|
|
34380
|
-
children: description ??
|
|
34464
|
+
children: description ?? significantColumn.description
|
|
34381
34465
|
}),
|
|
34382
34466
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
34383
34467
|
style: {
|
|
@@ -34386,29 +34470,29 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34386
34470
|
align: "flex-start",
|
|
34387
34471
|
children: [
|
|
34388
34472
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
34473
|
+
ref: inputRef,
|
|
34389
34474
|
size: size,
|
|
34390
34475
|
maw: idMaxWidth,
|
|
34391
|
-
readOnly:
|
|
34392
|
-
autoFocus: autoFocus === 'autoFocusOnAdd' ?
|
|
34393
|
-
"data-autofocus": autoFocus === 'autoFocusOnAdd' ?
|
|
34476
|
+
readOnly: readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
|
|
34477
|
+
autoFocus: autoFocus === 'autoFocusOnAdd' ? addAutofocus : autoFocus === 'autoFocusOnEdit' ? editAutofocus : autoFocus,
|
|
34478
|
+
"data-autofocus": autoFocus === 'autoFocusOnAdd' ? addAutofocus : autoFocus === 'autoFocusOnEdit' ? editAutofocus : autoFocus,
|
|
34394
34479
|
disabled: disabled,
|
|
34395
34480
|
rightSection: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.ActionIcon), {
|
|
34396
34481
|
color: theme.primaryColor,
|
|
34397
|
-
disabled:
|
|
34482
|
+
disabled: readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
|
|
34398
34483
|
onClick: async ()=>{
|
|
34399
|
-
|
|
34400
|
-
|
|
34401
|
-
await lookupAPI.onBlur(column.name, true);
|
|
34484
|
+
if (readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading) return;
|
|
34485
|
+
await lookupAPI.onBlur(significantColumn.name, true);
|
|
34402
34486
|
},
|
|
34403
34487
|
variant: iconVariant,
|
|
34404
34488
|
size: "md",
|
|
34405
34489
|
children: icon
|
|
34406
34490
|
}),
|
|
34407
34491
|
...lookupAPI.lookupInputProps,
|
|
34408
|
-
onBlur: async (
|
|
34409
|
-
await lookupAPI.onBlur(
|
|
34492
|
+
onBlur: async (event)=>{
|
|
34493
|
+
await lookupAPI.onBlur(significantColumn.name, false, event);
|
|
34410
34494
|
}
|
|
34411
|
-
}, `${entity.name}${
|
|
34495
|
+
}, `${entity.name}${significantColumn.name}Compound`),
|
|
34412
34496
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
34413
34497
|
style: {
|
|
34414
34498
|
flexGrow: 1
|
|
@@ -34416,20 +34500,19 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34416
34500
|
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
34417
34501
|
size: size,
|
|
34418
34502
|
readOnly: true,
|
|
34419
|
-
value: lookupAPI.lookupResult?.description,
|
|
34503
|
+
value: lookupAPI.lookupResult?.description ?? '',
|
|
34420
34504
|
rightSection: lookupAPI.status.loading && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Loader), {
|
|
34421
34505
|
size: "xs",
|
|
34422
34506
|
variant: "bars"
|
|
34423
34507
|
}),
|
|
34424
|
-
ref: HTMLDescriptionRef,
|
|
34425
34508
|
sx: {
|
|
34426
34509
|
flexGrow: 1
|
|
34427
34510
|
}
|
|
34428
|
-
}, `${entity.name}${
|
|
34511
|
+
}, `${entity.name}${significantColumn.name}CompoundDescription`)
|
|
34429
34512
|
})
|
|
34430
34513
|
]
|
|
34431
34514
|
}),
|
|
34432
|
-
lookupAPI.lookupResult?.error && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
34515
|
+
lookupAPI.lookupResult?.error && lookupAPI.lookupResult.errorDescription && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
34433
34516
|
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
34434
34517
|
size: "xs",
|
|
34435
34518
|
color: "red",
|
|
@@ -34441,148 +34524,618 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
|
|
|
34441
34524
|
}
|
|
34442
34525
|
|
|
34443
34526
|
});
|
|
34527
|
+
parcelRegister("gMI48", function(module, exports) {
|
|
34444
34528
|
|
|
34445
|
-
|
|
34446
|
-
|
|
34447
|
-
$parcel$export(module.exports, "LookupFormDefaultProps", function () { return $b5f5c79046a37f01$export$661ffebdb61ba44e; });
|
|
34448
|
-
$parcel$export(module.exports, "LookupForm", function () { return $b5f5c79046a37f01$export$31fe10f004166bd6; });
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
|
|
34452
|
-
|
|
34453
|
-
parcelRequire("2Qb3Q");
|
|
34454
|
-
var $kjFvY = parcelRequire("kjFvY");
|
|
34455
|
-
const $b5f5c79046a37f01$export$661ffebdb61ba44e = {
|
|
34456
|
-
helpMessage: "Select the records that you need and click OK",
|
|
34457
|
-
okLabel: "OK",
|
|
34458
|
-
cancelLabel: "Cancel"
|
|
34459
|
-
};
|
|
34460
|
-
function $b5f5c79046a37f01$export$31fe10f004166bd6(props) {
|
|
34461
|
-
const { dataGridProps: dataGridProps, onOK: onOK, onCancel: onCancel, okLabel: okLabel, cancelLabel: cancelLabel, helpMessage: helpMessage, breadCrumbs: breadCrumbs } = (0, $b4te3$mantinecore.useComponentDefaultProps)('LookupForm', $b5f5c79046a37f01$export$661ffebdb61ba44e, props);
|
|
34462
|
-
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
34463
|
-
const selectionKeys = (0, $b4te3$react.useRef)([]);
|
|
34464
|
-
const handleSelectionChanged = (0, $b4te3$react.useCallback)((selection, keys)=>{
|
|
34465
|
-
selectionKeys.current = keys;
|
|
34466
|
-
}, []);
|
|
34467
|
-
const handleOK = (0, $b4te3$react.useCallback)(()=>{
|
|
34468
|
-
onOK(selectionKeys.current);
|
|
34469
|
-
}, [
|
|
34470
|
-
onOK
|
|
34471
|
-
]);
|
|
34472
|
-
const { parentKeys: parentKeys } = dataGridProps;
|
|
34473
|
-
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
34474
|
-
children: [
|
|
34475
|
-
breadCrumbs && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Breadcrumbs), {
|
|
34476
|
-
children: breadCrumbs
|
|
34477
|
-
}),
|
|
34478
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Card), {
|
|
34479
|
-
shadow: "sm",
|
|
34480
|
-
withBorder: theme.colorScheme === 'dark' ? false : true,
|
|
34481
|
-
children: [
|
|
34482
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Card).Section, {
|
|
34483
|
-
p: "xs",
|
|
34484
|
-
bg: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors[theme.primaryColor][3],
|
|
34485
|
-
mb: "1rem",
|
|
34486
|
-
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
34487
|
-
sx: {
|
|
34488
|
-
gap: "0.25rem"
|
|
34489
|
-
},
|
|
34490
|
-
children: [
|
|
34491
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconInfoCircle), {
|
|
34492
|
-
size: "1.1rem"
|
|
34493
|
-
}),
|
|
34494
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
34495
|
-
fz: "xs",
|
|
34496
|
-
c: "dimmed",
|
|
34497
|
-
children: helpMessage
|
|
34498
|
-
})
|
|
34499
|
-
]
|
|
34500
|
-
})
|
|
34501
|
-
}),
|
|
34502
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $kjFvY.DataGrid), {
|
|
34503
|
-
...dataGridProps,
|
|
34504
|
-
onSelectionChanged: handleSelectionChanged,
|
|
34505
|
-
autoFocus: true
|
|
34506
|
-
})
|
|
34507
|
-
]
|
|
34508
|
-
}),
|
|
34509
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
34510
|
-
mt: "md",
|
|
34511
|
-
position: "right",
|
|
34512
|
-
children: [
|
|
34513
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
34514
|
-
variant: "light",
|
|
34515
|
-
leftIcon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconCircleX), {
|
|
34516
|
-
size: "1.5rem"
|
|
34517
|
-
}),
|
|
34518
|
-
onClick: ()=>onCancel ? onCancel() : null,
|
|
34519
|
-
children: cancelLabel
|
|
34520
|
-
}),
|
|
34521
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
34522
|
-
onClick: handleOK,
|
|
34523
|
-
color: theme.colors.green[5],
|
|
34524
|
-
leftIcon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconCircleCheck), {
|
|
34525
|
-
size: "1.5rem"
|
|
34526
|
-
}),
|
|
34527
|
-
children: okLabel
|
|
34528
|
-
})
|
|
34529
|
-
]
|
|
34530
|
-
})
|
|
34531
|
-
]
|
|
34532
|
-
});
|
|
34533
|
-
}
|
|
34534
|
-
|
|
34535
|
-
});
|
|
34536
|
-
|
|
34537
|
-
parcelRegister("2Zki2", function(module, exports) {
|
|
34538
|
-
|
|
34539
|
-
$parcel$export(module.exports, "useLookup", function () { return $d296e9f4d3930bfd$export$4db9dd7eda56bf7b; });
|
|
34529
|
+
$parcel$export(module.exports, "useCompoundLookup", function () { return $1e0694bb407199c5$export$cf48e8dd7daeb58f; });
|
|
34540
34530
|
|
|
34541
34531
|
parcelRequire("6Rdyz");
|
|
34542
34532
|
var $98ddT = parcelRequire("98ddT");
|
|
34533
|
+
parcelRequire("2eyXi");
|
|
34534
|
+
var $7qUhz = parcelRequire("7qUhz");
|
|
34543
34535
|
|
|
34544
34536
|
var $iKzSR = parcelRequire("iKzSR");
|
|
34545
|
-
|
|
34537
|
+
|
|
34546
34538
|
var $42GxC = parcelRequire("42GxC");
|
|
34547
|
-
|
|
34539
|
+
function $1e0694bb407199c5$var$transformValue(value, autoTrim, transform) {
|
|
34540
|
+
const transformed = autoTrim ? value.trim() : value;
|
|
34541
|
+
switch(transform){
|
|
34542
|
+
case 'uppercase':
|
|
34543
|
+
return transformed.toUpperCase();
|
|
34544
|
+
case 'lowercase':
|
|
34545
|
+
return transformed.toLowerCase();
|
|
34546
|
+
case 'capitalize':
|
|
34547
|
+
return transformed.charAt(0).toUpperCase() + transformed.slice(1);
|
|
34548
|
+
case 'titlecase':
|
|
34549
|
+
return transformed.split(' ').map((word)=>word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
34550
|
+
default:
|
|
34551
|
+
return transformed;
|
|
34552
|
+
}
|
|
34553
|
+
}
|
|
34554
|
+
function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, bindingColumns: bindingColumns, parentKeys: parentKeys, required: required, inputRef: inputRef, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform, autoTrim: autoTrim }) {
|
|
34555
|
+
const lookupForm = (0, $42GxC.useLookupForm)();
|
|
34548
34556
|
const [status, setStatus] = (0, $b4te3$react.useState)({});
|
|
34549
|
-
const [previousLookupResult, setPreviousLookupResult] = (0, $b4te3$react.useState)();
|
|
34550
34557
|
const [lookupResult, setLookupResult] = (0, $b4te3$react.useState)();
|
|
34551
|
-
const
|
|
34552
|
-
const
|
|
34553
|
-
const
|
|
34554
|
-
const
|
|
34555
|
-
const
|
|
34556
|
-
const
|
|
34557
|
-
|
|
34558
|
-
|
|
34559
|
-
|
|
34560
|
-
|
|
34558
|
+
const [rawValue, setRawValue] = (0, $b4te3$react.useState)('');
|
|
34559
|
+
const dirty = (0, $b4te3$react.useRef)(false);
|
|
34560
|
+
const looking = (0, $b4te3$react.useRef)(false);
|
|
34561
|
+
const significantColumn = bindingColumns[bindingColumns.length - 1];
|
|
34562
|
+
const bindingColumnsKey = bindingColumns.join('\u0000');
|
|
34563
|
+
const context = (0, $b4te3$react.useMemo)(()=>{
|
|
34564
|
+
if (bindingColumns.length < 2) throw new Error(`Compound Lookup '${lookupDefName}' requires at least two bindingColumns.`);
|
|
34565
|
+
const lookupDef = entity.def.lookups[lookupDefName];
|
|
34566
|
+
if (!lookupDef) throw new Error(`Lookup definition '${lookupDefName}' was not found in entity '${entity.name}'.`);
|
|
34567
|
+
if (!lookupDef.compoundKeyGroupName) throw new Error(`Compound Lookup '${lookupDefName}' requires compoundKeyGroupName.`);
|
|
34568
|
+
const lookupEntity = lookupDef.entityConstructor(entity.API.client, parentKeys);
|
|
34569
|
+
const viewName = lookupDef.view ?? lookupEntity.def.standardView() ?? '';
|
|
34570
|
+
const view = lookupEntity.def.views[viewName];
|
|
34571
|
+
if (!view) throw new Error(`View '${viewName}' was not found for compound Lookup '${lookupDefName}'.`);
|
|
34572
|
+
const group = (0, $7qUhz.resolveCompoundKeyGroup)(view, lookupDef.compoundKeyGroupName);
|
|
34573
|
+
const mappings = (0, $7qUhz.getOrderedCompoundKeyMappings)(group);
|
|
34574
|
+
if (mappings.length !== bindingColumns.length) throw new Error(`Compound Lookup '${lookupDefName}' defines ${mappings.length} group members but received ${bindingColumns.length} bindingColumns.`);
|
|
34575
|
+
return {
|
|
34576
|
+
lookupDef: lookupDef,
|
|
34577
|
+
lookupEntity: lookupEntity,
|
|
34578
|
+
viewName: viewName,
|
|
34579
|
+
group: group,
|
|
34580
|
+
mappings: mappings
|
|
34581
|
+
};
|
|
34582
|
+
}, [
|
|
34583
|
+
bindingColumnsKey,
|
|
34584
|
+
entity,
|
|
34585
|
+
lookupDefName,
|
|
34586
|
+
parentKeys
|
|
34587
|
+
]);
|
|
34588
|
+
const bindingSignature = bindingColumns.map((column)=>entityForm.form.values[column]?.toString() ?? '').join('\u0000');
|
|
34589
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
34590
|
+
if (!dirty.current || entityForm.status.loading || entityForm.status.operationType === 'get') {
|
|
34591
|
+
dirty.current = false;
|
|
34592
|
+
setRawValue((0, $7qUhz.composeCompoundKey)(bindingColumns.map((column)=>entityForm.form.values[column]), context.group));
|
|
34593
|
+
}
|
|
34594
|
+
}, [
|
|
34595
|
+
bindingSignature,
|
|
34596
|
+
bindingColumnsKey,
|
|
34597
|
+
context.group,
|
|
34598
|
+
entityForm.status.loading,
|
|
34599
|
+
entityForm.status.operationType
|
|
34600
|
+
]);
|
|
34601
|
+
const clearDescriptions = (0, $b4te3$react.useCallback)(()=>{
|
|
34602
|
+
bindingColumns.forEach((columnName)=>entity.def.columns[columnName].valueDescription = undefined);
|
|
34603
|
+
}, [
|
|
34604
|
+
bindingColumns,
|
|
34605
|
+
entity.def.columns
|
|
34606
|
+
]);
|
|
34607
|
+
const setInvalid = (0, $b4te3$react.useCallback)((raw, errorDescription)=>{
|
|
34608
|
+
clearDescriptions();
|
|
34609
|
+
entityForm.form.setFieldError(significantColumn, errorDescription || true);
|
|
34610
|
+
setLookupResult({
|
|
34611
|
+
columnName: significantColumn,
|
|
34612
|
+
key: raw,
|
|
34561
34613
|
description: '',
|
|
34614
|
+
error: true,
|
|
34562
34615
|
cancel: false,
|
|
34616
|
+
updateParentKeys: false,
|
|
34617
|
+
errorDescription: errorDescription
|
|
34618
|
+
});
|
|
34619
|
+
queueMicrotask(()=>inputRef.current?.focus());
|
|
34620
|
+
}, [
|
|
34621
|
+
clearDescriptions,
|
|
34622
|
+
entityForm.form,
|
|
34623
|
+
inputRef,
|
|
34624
|
+
significantColumn
|
|
34625
|
+
]);
|
|
34626
|
+
const commit = (0, $b4te3$react.useCallback)((values, raw, description)=>{
|
|
34627
|
+
bindingColumns.forEach((columnName, index)=>{
|
|
34628
|
+
entityForm.form.setFieldValue(columnName, values[index]);
|
|
34629
|
+
entity.def.columns[columnName].value = values[index];
|
|
34630
|
+
entity.def.columns[columnName].valueDescription = index === bindingColumns.length - 1 ? description : undefined;
|
|
34631
|
+
});
|
|
34632
|
+
dirty.current = false;
|
|
34633
|
+
setRawValue(raw);
|
|
34634
|
+
entityForm.form.setFieldError(significantColumn, null);
|
|
34635
|
+
setLookupResult({
|
|
34636
|
+
columnName: significantColumn,
|
|
34637
|
+
key: raw,
|
|
34638
|
+
description: description,
|
|
34563
34639
|
error: false,
|
|
34640
|
+
cancel: false,
|
|
34564
34641
|
updateParentKeys: true
|
|
34565
34642
|
});
|
|
34566
|
-
|
|
34567
|
-
|
|
34568
|
-
|
|
34569
|
-
|
|
34570
|
-
|
|
34571
|
-
|
|
34572
|
-
|
|
34573
|
-
|
|
34574
|
-
|
|
34575
|
-
|
|
34576
|
-
|
|
34577
|
-
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
|
|
34581
|
-
|
|
34582
|
-
|
|
34583
|
-
|
|
34584
|
-
|
|
34585
|
-
|
|
34643
|
+
}, [
|
|
34644
|
+
bindingColumns,
|
|
34645
|
+
entity.def.columns,
|
|
34646
|
+
entityForm.form,
|
|
34647
|
+
significantColumn
|
|
34648
|
+
]);
|
|
34649
|
+
const executeDescriptionLookup = (0, $b4te3$react.useCallback)(async (values)=>{
|
|
34650
|
+
try {
|
|
34651
|
+
setStatus({
|
|
34652
|
+
loading: true
|
|
34653
|
+
});
|
|
34654
|
+
$iKzSR.setValues(context.lookupEntity.def.columns, parentKeys, null, true);
|
|
34655
|
+
context.mappings.forEach(([columnName], index)=>context.lookupEntity.def.columns[columnName].value = values[index]);
|
|
34656
|
+
const description = await context.lookupEntity.API.lookupData(null, null, context.lookupDef.proc);
|
|
34657
|
+
setStatus({
|
|
34658
|
+
data: {
|
|
34659
|
+
description: description
|
|
34660
|
+
}
|
|
34661
|
+
});
|
|
34662
|
+
return {
|
|
34663
|
+
description: description,
|
|
34664
|
+
errorDescription: undefined
|
|
34665
|
+
};
|
|
34666
|
+
} catch (error) {
|
|
34667
|
+
const microMError = (0, $98ddT.toMicroMError)(error);
|
|
34668
|
+
setStatus({
|
|
34669
|
+
error: microMError
|
|
34670
|
+
});
|
|
34671
|
+
return {
|
|
34672
|
+
description: '',
|
|
34673
|
+
errorDescription: microMError.message ?? microMError.statusMessage ?? 'Lookup failed.'
|
|
34674
|
+
};
|
|
34675
|
+
}
|
|
34676
|
+
}, [
|
|
34677
|
+
context,
|
|
34678
|
+
parentKeys
|
|
34679
|
+
]);
|
|
34680
|
+
const browse = (0, $b4te3$react.useCallback)(async (raw)=>{
|
|
34681
|
+
await new Promise(async (resolve)=>{
|
|
34682
|
+
await lookupForm({
|
|
34683
|
+
entity: context.lookupEntity,
|
|
34684
|
+
parentKeys: parentKeys,
|
|
34685
|
+
selectionMode: 'single',
|
|
34686
|
+
search: raw ? [
|
|
34687
|
+
raw
|
|
34688
|
+
] : [],
|
|
34689
|
+
viewName: context.viewName,
|
|
34690
|
+
onOK: async (selectedKeys)=>{
|
|
34691
|
+
const values = selectedKeys.length ? (0, $7qUhz.extractCompoundKeyValues)(selectedKeys[0], context.group) : undefined;
|
|
34692
|
+
if (!values) {
|
|
34693
|
+
setInvalid(raw, 'The selected record contains an incomplete compound key.');
|
|
34694
|
+
resolve();
|
|
34695
|
+
return;
|
|
34696
|
+
}
|
|
34697
|
+
const lookup = await executeDescriptionLookup(values);
|
|
34698
|
+
if (lookup.errorDescription) setInvalid(raw, lookup.errorDescription);
|
|
34699
|
+
else if (lookup.description) commit(values, (0, $7qUhz.composeCompoundKey)(values, context.group), lookup.description);
|
|
34700
|
+
else setInvalid(raw, 'The selected record could not be resolved.');
|
|
34701
|
+
resolve();
|
|
34702
|
+
},
|
|
34703
|
+
onCancel: async ()=>{
|
|
34704
|
+
setInvalid(raw);
|
|
34705
|
+
setLookupResult({
|
|
34706
|
+
columnName: significantColumn,
|
|
34707
|
+
key: raw,
|
|
34708
|
+
description: '',
|
|
34709
|
+
error: true,
|
|
34710
|
+
cancel: true,
|
|
34711
|
+
updateParentKeys: false
|
|
34712
|
+
});
|
|
34713
|
+
resolve();
|
|
34714
|
+
},
|
|
34715
|
+
modalProps: {
|
|
34716
|
+
size: 'xl',
|
|
34717
|
+
trapFocus: true
|
|
34718
|
+
},
|
|
34719
|
+
enableAdd: enableAdd,
|
|
34720
|
+
enableEdit: enableEdit,
|
|
34721
|
+
enableDelete: enableDelete,
|
|
34722
|
+
enableView: enableView
|
|
34723
|
+
});
|
|
34724
|
+
});
|
|
34725
|
+
}, [
|
|
34726
|
+
commit,
|
|
34727
|
+
context,
|
|
34728
|
+
enableAdd,
|
|
34729
|
+
enableDelete,
|
|
34730
|
+
enableEdit,
|
|
34731
|
+
enableView,
|
|
34732
|
+
executeDescriptionLookup,
|
|
34733
|
+
lookupForm,
|
|
34734
|
+
parentKeys,
|
|
34735
|
+
setInvalid,
|
|
34736
|
+
significantColumn
|
|
34737
|
+
]);
|
|
34738
|
+
const onBlur = (0, $b4te3$react.useCallback)(async (_bindingColumn, force = false, _event = null)=>{
|
|
34739
|
+
if (looking.current) return;
|
|
34740
|
+
looking.current = true;
|
|
34741
|
+
const transformed = $1e0694bb407199c5$var$transformValue(rawValue, autoTrim, transform);
|
|
34742
|
+
setRawValue(transformed);
|
|
34743
|
+
if (!transformed) {
|
|
34744
|
+
bindingColumns.forEach((columnName)=>{
|
|
34745
|
+
entityForm.form.setFieldValue(columnName, '');
|
|
34746
|
+
entity.def.columns[columnName].value = '';
|
|
34747
|
+
});
|
|
34748
|
+
clearDescriptions();
|
|
34749
|
+
entityForm.form.setFieldError(significantColumn, required ? true : null);
|
|
34750
|
+
setLookupResult({
|
|
34751
|
+
columnName: significantColumn,
|
|
34752
|
+
key: '',
|
|
34753
|
+
description: '',
|
|
34754
|
+
error: required,
|
|
34755
|
+
cancel: false,
|
|
34756
|
+
updateParentKeys: true
|
|
34757
|
+
});
|
|
34758
|
+
dirty.current = false;
|
|
34759
|
+
looking.current = false;
|
|
34760
|
+
return;
|
|
34761
|
+
}
|
|
34762
|
+
const split = (0, $7qUhz.splitCompoundKey)(transformed, context.group);
|
|
34763
|
+
if (force || !split.complete) await browse(transformed);
|
|
34764
|
+
else {
|
|
34765
|
+
const lookup = await executeDescriptionLookup(split.values);
|
|
34766
|
+
if (lookup.errorDescription) setInvalid(transformed, lookup.errorDescription);
|
|
34767
|
+
else if (lookup.description) commit(split.values, transformed, lookup.description);
|
|
34768
|
+
else await browse(transformed);
|
|
34769
|
+
}
|
|
34770
|
+
looking.current = false;
|
|
34771
|
+
}, [
|
|
34772
|
+
autoTrim,
|
|
34773
|
+
bindingColumns,
|
|
34774
|
+
browse,
|
|
34775
|
+
clearDescriptions,
|
|
34776
|
+
commit,
|
|
34777
|
+
context.group,
|
|
34778
|
+
entity.def.columns,
|
|
34779
|
+
entityForm.form,
|
|
34780
|
+
executeDescriptionLookup,
|
|
34781
|
+
rawValue,
|
|
34782
|
+
required,
|
|
34783
|
+
setInvalid,
|
|
34784
|
+
significantColumn,
|
|
34785
|
+
transform
|
|
34786
|
+
]);
|
|
34787
|
+
const lookupInputProps = {
|
|
34788
|
+
...entityForm.form.getInputProps(significantColumn),
|
|
34789
|
+
value: rawValue,
|
|
34790
|
+
onChange: (event)=>{
|
|
34791
|
+
dirty.current = true;
|
|
34792
|
+
setRawValue(event.currentTarget.value);
|
|
34793
|
+
clearDescriptions();
|
|
34794
|
+
setLookupResult(undefined);
|
|
34795
|
+
}
|
|
34796
|
+
};
|
|
34797
|
+
return {
|
|
34798
|
+
status: status,
|
|
34799
|
+
lookupResult: lookupResult,
|
|
34800
|
+
lookupInputProps: lookupInputProps,
|
|
34801
|
+
onBlur: onBlur
|
|
34802
|
+
};
|
|
34803
|
+
}
|
|
34804
|
+
|
|
34805
|
+
});
|
|
34806
|
+
parcelRegister("42GxC", function(module, exports) {
|
|
34807
|
+
|
|
34808
|
+
$parcel$export(module.exports, "UseLookupFormDefaultProps", function () { return $bead45746c9b4701$export$7c798c3f2245eb6; });
|
|
34809
|
+
$parcel$export(module.exports, "useLookupForm", function () { return $bead45746c9b4701$export$5ff8a4fe1be12a7c; });
|
|
34810
|
+
|
|
34811
|
+
|
|
34812
|
+
|
|
34813
|
+
parcelRequire("7xGLy");
|
|
34814
|
+
var $k7qj2 = parcelRequire("k7qj2");
|
|
34815
|
+
parcelRequire("17D0Z");
|
|
34816
|
+
var $726hz = parcelRequire("726hz");
|
|
34817
|
+
const $bead45746c9b4701$export$7c798c3f2245eb6 = {
|
|
34818
|
+
modalProps: {
|
|
34819
|
+
size: 'xl'
|
|
34820
|
+
},
|
|
34821
|
+
selectLabel: "Select",
|
|
34822
|
+
showActions: false,
|
|
34823
|
+
enableAdd: false,
|
|
34824
|
+
enableEdit: false,
|
|
34825
|
+
enableDelete: false,
|
|
34826
|
+
enableView: true
|
|
34827
|
+
};
|
|
34828
|
+
function $bead45746c9b4701$export$5ff8a4fe1be12a7c() {
|
|
34829
|
+
const modals = (0, $k7qj2.useModal)();
|
|
34830
|
+
const buttonResult = (0, $b4te3$react.useRef)('Quit');
|
|
34831
|
+
const open = async (props)=>{
|
|
34832
|
+
const { entity: entity, viewName: viewName, onOK: onOK, onCancel: onCancel, modalProps: modalProps, selectionMode: selectionMode, search: search, selectLabel: selectLabel, onClosed: onClosed, parentKeys: parentKeys, showActions: showActions, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, breadCrumbs: breadCrumbs } = {
|
|
34833
|
+
...$bead45746c9b4701$export$7c798c3f2245eb6,
|
|
34834
|
+
...props
|
|
34835
|
+
};
|
|
34836
|
+
buttonResult.current = 'Quit';
|
|
34837
|
+
const handleOK = async (selectedKeys)=>{
|
|
34838
|
+
buttonResult.current = 'OK';
|
|
34839
|
+
await modals.close();
|
|
34840
|
+
if (onOK) await onOK(selectedKeys);
|
|
34841
|
+
};
|
|
34842
|
+
const handleCancel = async ()=>{
|
|
34843
|
+
buttonResult.current = 'Cancel';
|
|
34844
|
+
await modals.close();
|
|
34845
|
+
if (onCancel) onCancel();
|
|
34846
|
+
};
|
|
34847
|
+
const handleClosed = async ()=>{
|
|
34848
|
+
if (buttonResult.current === 'Quit') {
|
|
34849
|
+
if (onCancel) onCancel();
|
|
34850
|
+
}
|
|
34851
|
+
if (onClosed) onClosed();
|
|
34852
|
+
};
|
|
34853
|
+
await modals.open({
|
|
34854
|
+
content: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $726hz.LookupForm), {
|
|
34855
|
+
dataGridProps: {
|
|
34856
|
+
entity: entity,
|
|
34857
|
+
parentKeys: parentKeys,
|
|
34858
|
+
viewName: viewName,
|
|
34859
|
+
limit: "10000",
|
|
34860
|
+
refreshOnInit: true,
|
|
34861
|
+
selectionMode: selectionMode ? selectionMode : 'multi',
|
|
34862
|
+
search: search,
|
|
34863
|
+
showActions: showActions,
|
|
34864
|
+
enableAdd: enableAdd,
|
|
34865
|
+
enableEdit: enableEdit,
|
|
34866
|
+
enableDelete: enableDelete,
|
|
34867
|
+
enableView: enableView
|
|
34868
|
+
},
|
|
34869
|
+
onOK: async (selectedKeys)=>await handleOK(selectedKeys),
|
|
34870
|
+
onCancel: ()=>handleCancel(),
|
|
34871
|
+
breadCrumbs: breadCrumbs
|
|
34872
|
+
}),
|
|
34873
|
+
modalProps: {
|
|
34874
|
+
...modalProps,
|
|
34875
|
+
trapFocus: true,
|
|
34876
|
+
returnFocus: true,
|
|
34877
|
+
withFullscreenButton: true,
|
|
34878
|
+
title: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Text), {
|
|
34879
|
+
fw: "700",
|
|
34880
|
+
children: [
|
|
34881
|
+
selectLabel,
|
|
34882
|
+
" ",
|
|
34883
|
+
entity.Title
|
|
34884
|
+
]
|
|
34885
|
+
})
|
|
34886
|
+
},
|
|
34887
|
+
onClosed: async ()=>{
|
|
34888
|
+
await handleClosed();
|
|
34889
|
+
}
|
|
34890
|
+
});
|
|
34891
|
+
};
|
|
34892
|
+
return open;
|
|
34893
|
+
}
|
|
34894
|
+
|
|
34895
|
+
});
|
|
34896
|
+
|
|
34897
|
+
|
|
34898
|
+
|
|
34899
|
+
parcelRegister("557VF", function(module, exports) {
|
|
34900
|
+
|
|
34901
|
+
$parcel$export(module.exports, "LookupDefaultProps", function () { return $00c9d91a9839ec3c$export$9c2b2ccf03658905; });
|
|
34902
|
+
|
|
34903
|
+
|
|
34904
|
+
const $00c9d91a9839ec3c$export$9c2b2ccf03658905 = {
|
|
34905
|
+
idMaxWidth: "15rem",
|
|
34906
|
+
icon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconSearch), {
|
|
34907
|
+
size: "1rem",
|
|
34908
|
+
stroke: "1.5"
|
|
34909
|
+
}),
|
|
34910
|
+
iconVariant: "light",
|
|
34911
|
+
requiredLabel: "A value is required",
|
|
34912
|
+
size: "sm",
|
|
34913
|
+
enableAdd: false,
|
|
34914
|
+
enableEdit: false,
|
|
34915
|
+
enableDelete: false,
|
|
34916
|
+
enableView: true,
|
|
34917
|
+
autoTrim: true
|
|
34918
|
+
};
|
|
34919
|
+
|
|
34920
|
+
});
|
|
34921
|
+
|
|
34922
|
+
parcelRegister("7Gk9n", function(module, exports) {
|
|
34923
|
+
|
|
34924
|
+
$parcel$export(module.exports, "SingleLookup", function () { return $7453d94b4131a5b6$export$5d8bfd620f16e3fd; });
|
|
34925
|
+
|
|
34926
|
+
|
|
34927
|
+
|
|
34928
|
+
|
|
34929
|
+
parcelRequire("2eyXi");
|
|
34930
|
+
var $4H7ea = parcelRequire("4H7ea");
|
|
34931
|
+
parcelRequire("7xGLy");
|
|
34932
|
+
var $OciKL = parcelRequire("OciKL");
|
|
34933
|
+
|
|
34934
|
+
var $557VF = parcelRequire("557VF");
|
|
34935
|
+
|
|
34936
|
+
var $2Zki2 = parcelRequire("2Zki2");
|
|
34937
|
+
function $7453d94b4131a5b6$export$5d8bfd620f16e3fd(props) {
|
|
34938
|
+
const { entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, autoFocus: autoFocus, label: label, parentKeys: parentKeys, column: column, required: required, readonly: readonly, disabled: disabled, idMaxWidth: idMaxWidth, icon: icon, iconVariant: iconVariant, requiredLabel: requiredLabel, description: description, size: size, onLookupPerformed: onLookupPerformed, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform, autoTrim: autoTrim } = (0, $b4te3$mantinecore.useComponentDefaultProps)('Lookup', (0, $557VF.LookupDefaultProps), props);
|
|
34939
|
+
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
34940
|
+
const HTMLDescriptionRef = (0, $b4te3$react.useRef)(null);
|
|
34941
|
+
const textTransform = (0, $OciKL.useTextTransform)({
|
|
34942
|
+
entityForm: entityForm,
|
|
34943
|
+
column: column,
|
|
34944
|
+
transform: transform,
|
|
34945
|
+
autoTrim: autoTrim
|
|
34946
|
+
});
|
|
34947
|
+
const lookupAPI = (0, $2Zki2.useLookup)({
|
|
34948
|
+
entityForm: entityForm,
|
|
34949
|
+
entity: entity,
|
|
34950
|
+
lookupDefName: lookupDefName,
|
|
34951
|
+
column: column.name,
|
|
34952
|
+
parentKeys: parentKeys,
|
|
34953
|
+
required: required,
|
|
34954
|
+
HTMLDescriptionRef: HTMLDescriptionRef,
|
|
34955
|
+
enableAdd: enableAdd,
|
|
34956
|
+
enableEdit: enableEdit,
|
|
34957
|
+
enableDelete: enableDelete,
|
|
34958
|
+
enableView: enableView,
|
|
34959
|
+
transform: textTransform
|
|
34960
|
+
});
|
|
34961
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
34962
|
+
if (required ?? !column.hasFlag((0, $4H7ea.EntityColumnFlags).nullable)) entityForm.configureField(column, (0, $b4te3$mantineform.isNotEmpty)(requiredLabel));
|
|
34963
|
+
else entityForm.removeValidation(column);
|
|
34964
|
+
}, [
|
|
34965
|
+
column,
|
|
34966
|
+
entityForm,
|
|
34967
|
+
required,
|
|
34968
|
+
requiredLabel
|
|
34969
|
+
]);
|
|
34970
|
+
const controlSize = (0, $b4te3$mantinecore.getSize)({
|
|
34971
|
+
size: size ?? "sm",
|
|
34972
|
+
sizes: theme.fontSizes
|
|
34973
|
+
});
|
|
34974
|
+
const descriptionSize = (0, $b4te3$mantinecore.getSize)({
|
|
34975
|
+
size: size ?? "sm",
|
|
34976
|
+
sizes: theme.fontSizes
|
|
34977
|
+
});
|
|
34978
|
+
const labelColor = theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[9];
|
|
34979
|
+
const descriptionColor = theme.colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[6];
|
|
34980
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
34981
|
+
column.valueDescription = lookupAPI.lookupResult?.description;
|
|
34982
|
+
}, [
|
|
34983
|
+
column,
|
|
34984
|
+
lookupAPI.lookupResult?.description
|
|
34985
|
+
]);
|
|
34986
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
34987
|
+
if (onLookupPerformed && lookupAPI.lookupResult) onLookupPerformed(lookupAPI.lookupResult);
|
|
34988
|
+
}, [
|
|
34989
|
+
lookupAPI.lookupResult,
|
|
34990
|
+
onLookupPerformed
|
|
34991
|
+
]);
|
|
34992
|
+
const { formMode: formMode, status: status } = entityForm;
|
|
34993
|
+
const addAutofocus = formMode === 'add' ? true : undefined;
|
|
34994
|
+
const editAutofocus = status.loading === false && formMode !== 'add' ? true : undefined;
|
|
34995
|
+
const readonlyCondition = readonly === undefined ? column.hasFlag((0, $4H7ea.EntityColumnFlags).autoNum) || entityForm.formMode !== 'add' && column.hasFlag((0, $4H7ea.EntityColumnFlags).pk) : readonly;
|
|
34996
|
+
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
34997
|
+
style: {
|
|
34998
|
+
gap: "0.1rem",
|
|
34999
|
+
flexGrow: "1"
|
|
35000
|
+
},
|
|
35001
|
+
children: [
|
|
35002
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
35003
|
+
style: {
|
|
35004
|
+
gap: "0.2rem"
|
|
35005
|
+
},
|
|
35006
|
+
children: [
|
|
35007
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
35008
|
+
size: controlSize,
|
|
35009
|
+
weight: "500",
|
|
35010
|
+
color: labelColor,
|
|
35011
|
+
children: label ?? column.prompt
|
|
35012
|
+
}),
|
|
35013
|
+
(required ?? (!readonly && entityForm.formMode !== 'view' && !column.hasFlag((0, $4H7ea.EntityColumnFlags).nullable))) && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
35014
|
+
size: controlSize,
|
|
35015
|
+
weight: "500",
|
|
35016
|
+
color: theme.colors.red[5],
|
|
35017
|
+
children: "*"
|
|
35018
|
+
})
|
|
35019
|
+
]
|
|
35020
|
+
}),
|
|
35021
|
+
(description ?? column.description) && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
35022
|
+
style: {
|
|
35023
|
+
fontSize: `calc(${descriptionSize} - ${(0, $b4te3$mantinecore.rem)(2)})`,
|
|
35024
|
+
lineHeight: 1.2
|
|
35025
|
+
},
|
|
35026
|
+
color: descriptionColor,
|
|
35027
|
+
children: description ?? column.description
|
|
35028
|
+
}),
|
|
35029
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
35030
|
+
style: {
|
|
35031
|
+
marginTop: `calc(${theme.spacing.xs} / 2)`
|
|
35032
|
+
},
|
|
35033
|
+
align: "flex-start",
|
|
35034
|
+
children: [
|
|
35035
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
35036
|
+
size: size,
|
|
35037
|
+
maw: idMaxWidth,
|
|
35038
|
+
readOnly: readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
|
|
35039
|
+
autoFocus: autoFocus === 'autoFocusOnAdd' ? addAutofocus : autoFocus === 'autoFocusOnEdit' ? editAutofocus : autoFocus,
|
|
35040
|
+
"data-autofocus": autoFocus === 'autoFocusOnAdd' ? addAutofocus : autoFocus === 'autoFocusOnEdit' ? editAutofocus : autoFocus,
|
|
35041
|
+
disabled: disabled,
|
|
35042
|
+
rightSection: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.ActionIcon), {
|
|
35043
|
+
color: theme.primaryColor,
|
|
35044
|
+
disabled: readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
|
|
35045
|
+
onClick: async ()=>{
|
|
35046
|
+
if (readonlyCondition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading) return;
|
|
35047
|
+
await lookupAPI.onBlur(column.name, true);
|
|
35048
|
+
},
|
|
35049
|
+
variant: iconVariant,
|
|
35050
|
+
size: "md",
|
|
35051
|
+
children: icon
|
|
35052
|
+
}),
|
|
35053
|
+
...lookupAPI.lookupInputProps,
|
|
35054
|
+
onBlur: async (event)=>{
|
|
35055
|
+
await lookupAPI.onBlur(column.name, false, event);
|
|
35056
|
+
}
|
|
35057
|
+
}, `${entity.name}${column.name}`),
|
|
35058
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
35059
|
+
style: {
|
|
35060
|
+
flexGrow: 1
|
|
35061
|
+
},
|
|
35062
|
+
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
35063
|
+
size: size,
|
|
35064
|
+
readOnly: true,
|
|
35065
|
+
value: lookupAPI.lookupResult?.description,
|
|
35066
|
+
rightSection: lookupAPI.status.loading && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Loader), {
|
|
35067
|
+
size: "xs",
|
|
35068
|
+
variant: "bars"
|
|
35069
|
+
}),
|
|
35070
|
+
ref: HTMLDescriptionRef,
|
|
35071
|
+
sx: {
|
|
35072
|
+
flexGrow: 1
|
|
35073
|
+
}
|
|
35074
|
+
}, `${entity.name}${column.name}description`)
|
|
35075
|
+
})
|
|
35076
|
+
]
|
|
35077
|
+
}),
|
|
35078
|
+
lookupAPI.lookupResult?.error && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
35079
|
+
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
35080
|
+
size: "xs",
|
|
35081
|
+
color: "red",
|
|
35082
|
+
children: lookupAPI.lookupResult.errorDescription
|
|
35083
|
+
})
|
|
35084
|
+
})
|
|
35085
|
+
]
|
|
35086
|
+
});
|
|
35087
|
+
}
|
|
35088
|
+
|
|
35089
|
+
});
|
|
35090
|
+
parcelRegister("2Zki2", function(module, exports) {
|
|
35091
|
+
|
|
35092
|
+
$parcel$export(module.exports, "useLookup", function () { return $d296e9f4d3930bfd$export$4db9dd7eda56bf7b; });
|
|
35093
|
+
|
|
35094
|
+
parcelRequire("6Rdyz");
|
|
35095
|
+
var $98ddT = parcelRequire("98ddT");
|
|
35096
|
+
|
|
35097
|
+
var $iKzSR = parcelRequire("iKzSR");
|
|
35098
|
+
parcelRequire("17D0Z");
|
|
35099
|
+
var $42GxC = parcelRequire("42GxC");
|
|
35100
|
+
const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, column: column, parentKeys: parentKeys, required: required, HTMLDescriptionRef: HTMLDescriptionRef, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform })=>{
|
|
35101
|
+
const [status, setStatus] = (0, $b4te3$react.useState)({});
|
|
35102
|
+
const [previousLookupResult, setPreviousLookupResult] = (0, $b4te3$react.useState)();
|
|
35103
|
+
const [lookupResult, setLookupResult] = (0, $b4te3$react.useState)();
|
|
35104
|
+
const lookupForm = (0, $42GxC.useLookupForm)();
|
|
35105
|
+
const lookupEntity = (0, $b4te3$react.useRef)();
|
|
35106
|
+
const viewName = (0, $b4te3$react.useRef)('');
|
|
35107
|
+
const lookupDef = (0, $b4te3$react.useRef)();
|
|
35108
|
+
const isLooking = (0, $b4te3$react.useRef)(false);
|
|
35109
|
+
const lastFocusedElement = (0, $b4te3$react.useRef)();
|
|
35110
|
+
const performLookup = (0, $b4te3$react.useCallback)((bindingColumn, keyValue, force = false)=>{
|
|
35111
|
+
if (!lookupEntity.current) return Promise.resolve({
|
|
35112
|
+
columnName: bindingColumn,
|
|
35113
|
+
key: '',
|
|
35114
|
+
description: '',
|
|
35115
|
+
cancel: false,
|
|
35116
|
+
error: false,
|
|
35117
|
+
updateParentKeys: true
|
|
35118
|
+
});
|
|
35119
|
+
const mappedKeyColumnName = lookupDef.current.bindingColumnKey ?? bindingColumn;
|
|
35120
|
+
lookupEntity.current.def.columns[mappedKeyColumnName].value = keyValue;
|
|
35121
|
+
if (parentKeys) lookupEntity.current.parentKeys = parentKeys;
|
|
35122
|
+
return new Promise(async (resolve, reject)=>{
|
|
35123
|
+
const doLookup = async ()=>{
|
|
35124
|
+
try {
|
|
35125
|
+
setStatus({
|
|
35126
|
+
loading: true
|
|
35127
|
+
});
|
|
35128
|
+
// Set parentKeys
|
|
35129
|
+
$iKzSR.setValues(lookupEntity.current.def.columns, parentKeys, null, true);
|
|
35130
|
+
const result = await lookupEntity.current.API.lookupData(null, null, lookupDef.current?.proc);
|
|
35131
|
+
const new_status = {
|
|
35132
|
+
data: {
|
|
35133
|
+
key: keyValue,
|
|
35134
|
+
description: result
|
|
35135
|
+
}
|
|
35136
|
+
};
|
|
35137
|
+
setStatus(new_status);
|
|
35138
|
+
return {
|
|
34586
35139
|
description: result,
|
|
34587
35140
|
status: new_status,
|
|
34588
35141
|
errorDescription: ''
|
|
@@ -34820,6 +35373,100 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
|
|
|
34820
35373
|
|
|
34821
35374
|
});
|
|
34822
35375
|
|
|
35376
|
+
|
|
35377
|
+
|
|
35378
|
+
parcelRegister("726hz", function(module, exports) {
|
|
35379
|
+
|
|
35380
|
+
$parcel$export(module.exports, "LookupFormDefaultProps", function () { return $b5f5c79046a37f01$export$661ffebdb61ba44e; });
|
|
35381
|
+
$parcel$export(module.exports, "LookupForm", function () { return $b5f5c79046a37f01$export$31fe10f004166bd6; });
|
|
35382
|
+
|
|
35383
|
+
|
|
35384
|
+
|
|
35385
|
+
|
|
35386
|
+
parcelRequire("2Qb3Q");
|
|
35387
|
+
var $kjFvY = parcelRequire("kjFvY");
|
|
35388
|
+
const $b5f5c79046a37f01$export$661ffebdb61ba44e = {
|
|
35389
|
+
helpMessage: "Select the records that you need and click OK",
|
|
35390
|
+
okLabel: "OK",
|
|
35391
|
+
cancelLabel: "Cancel"
|
|
35392
|
+
};
|
|
35393
|
+
function $b5f5c79046a37f01$export$31fe10f004166bd6(props) {
|
|
35394
|
+
const { dataGridProps: dataGridProps, onOK: onOK, onCancel: onCancel, okLabel: okLabel, cancelLabel: cancelLabel, helpMessage: helpMessage, breadCrumbs: breadCrumbs } = (0, $b4te3$mantinecore.useComponentDefaultProps)('LookupForm', $b5f5c79046a37f01$export$661ffebdb61ba44e, props);
|
|
35395
|
+
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
35396
|
+
const selectionKeys = (0, $b4te3$react.useRef)([]);
|
|
35397
|
+
const handleSelectionChanged = (0, $b4te3$react.useCallback)((selection, keys)=>{
|
|
35398
|
+
selectionKeys.current = keys;
|
|
35399
|
+
}, []);
|
|
35400
|
+
const handleOK = (0, $b4te3$react.useCallback)(()=>{
|
|
35401
|
+
onOK(selectionKeys.current);
|
|
35402
|
+
}, [
|
|
35403
|
+
onOK
|
|
35404
|
+
]);
|
|
35405
|
+
const { parentKeys: parentKeys } = dataGridProps;
|
|
35406
|
+
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
35407
|
+
children: [
|
|
35408
|
+
breadCrumbs && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Breadcrumbs), {
|
|
35409
|
+
children: breadCrumbs
|
|
35410
|
+
}),
|
|
35411
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Card), {
|
|
35412
|
+
shadow: "sm",
|
|
35413
|
+
withBorder: theme.colorScheme === 'dark' ? false : true,
|
|
35414
|
+
children: [
|
|
35415
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Card).Section, {
|
|
35416
|
+
p: "xs",
|
|
35417
|
+
bg: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors[theme.primaryColor][3],
|
|
35418
|
+
mb: "1rem",
|
|
35419
|
+
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
35420
|
+
sx: {
|
|
35421
|
+
gap: "0.25rem"
|
|
35422
|
+
},
|
|
35423
|
+
children: [
|
|
35424
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconInfoCircle), {
|
|
35425
|
+
size: "1.1rem"
|
|
35426
|
+
}),
|
|
35427
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Text), {
|
|
35428
|
+
fz: "xs",
|
|
35429
|
+
c: "dimmed",
|
|
35430
|
+
children: helpMessage
|
|
35431
|
+
})
|
|
35432
|
+
]
|
|
35433
|
+
})
|
|
35434
|
+
}),
|
|
35435
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $kjFvY.DataGrid), {
|
|
35436
|
+
...dataGridProps,
|
|
35437
|
+
onSelectionChanged: handleSelectionChanged,
|
|
35438
|
+
autoFocus: true
|
|
35439
|
+
})
|
|
35440
|
+
]
|
|
35441
|
+
}),
|
|
35442
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
35443
|
+
mt: "md",
|
|
35444
|
+
position: "right",
|
|
35445
|
+
children: [
|
|
35446
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
35447
|
+
variant: "light",
|
|
35448
|
+
leftIcon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconCircleX), {
|
|
35449
|
+
size: "1.5rem"
|
|
35450
|
+
}),
|
|
35451
|
+
onClick: ()=>onCancel ? onCancel() : null,
|
|
35452
|
+
children: cancelLabel
|
|
35453
|
+
}),
|
|
35454
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
35455
|
+
onClick: handleOK,
|
|
35456
|
+
color: theme.colors.green[5],
|
|
35457
|
+
leftIcon: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$tablericonsreact.IconCircleCheck), {
|
|
35458
|
+
size: "1.5rem"
|
|
35459
|
+
}),
|
|
35460
|
+
children: okLabel
|
|
35461
|
+
})
|
|
35462
|
+
]
|
|
35463
|
+
})
|
|
35464
|
+
]
|
|
35465
|
+
});
|
|
35466
|
+
}
|
|
35467
|
+
|
|
35468
|
+
});
|
|
35469
|
+
|
|
34823
35470
|
parcelRegister("iuZkb", function(module, exports) {
|
|
34824
35471
|
|
|
34825
35472
|
$parcel$export(module.exports, "useLookupEntity", function () { return $6899d2333cf49324$export$983248af60bcb386; });
|
|
@@ -34848,97 +35495,6 @@ function $6899d2333cf49324$export$983248af60bcb386({ entity: entity, lookupDefNa
|
|
|
34848
35495
|
|
|
34849
35496
|
});
|
|
34850
35497
|
|
|
34851
|
-
parcelRegister("42GxC", function(module, exports) {
|
|
34852
|
-
|
|
34853
|
-
$parcel$export(module.exports, "UseLookupFormDefaultProps", function () { return $bead45746c9b4701$export$7c798c3f2245eb6; });
|
|
34854
|
-
$parcel$export(module.exports, "useLookupForm", function () { return $bead45746c9b4701$export$5ff8a4fe1be12a7c; });
|
|
34855
|
-
|
|
34856
|
-
|
|
34857
|
-
|
|
34858
|
-
parcelRequire("7xGLy");
|
|
34859
|
-
var $k7qj2 = parcelRequire("k7qj2");
|
|
34860
|
-
parcelRequire("17D0Z");
|
|
34861
|
-
var $726hz = parcelRequire("726hz");
|
|
34862
|
-
const $bead45746c9b4701$export$7c798c3f2245eb6 = {
|
|
34863
|
-
modalProps: {
|
|
34864
|
-
size: 'xl'
|
|
34865
|
-
},
|
|
34866
|
-
selectLabel: "Select",
|
|
34867
|
-
showActions: false,
|
|
34868
|
-
enableAdd: false,
|
|
34869
|
-
enableEdit: false,
|
|
34870
|
-
enableDelete: false,
|
|
34871
|
-
enableView: true
|
|
34872
|
-
};
|
|
34873
|
-
function $bead45746c9b4701$export$5ff8a4fe1be12a7c() {
|
|
34874
|
-
const modals = (0, $k7qj2.useModal)();
|
|
34875
|
-
const buttonResult = (0, $b4te3$react.useRef)('Quit');
|
|
34876
|
-
const open = async (props)=>{
|
|
34877
|
-
const { entity: entity, viewName: viewName, onOK: onOK, onCancel: onCancel, modalProps: modalProps, selectionMode: selectionMode, search: search, selectLabel: selectLabel, onClosed: onClosed, parentKeys: parentKeys, showActions: showActions, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, breadCrumbs: breadCrumbs } = {
|
|
34878
|
-
...$bead45746c9b4701$export$7c798c3f2245eb6,
|
|
34879
|
-
...props
|
|
34880
|
-
};
|
|
34881
|
-
buttonResult.current = 'Quit';
|
|
34882
|
-
const handleOK = async (selectedKeys)=>{
|
|
34883
|
-
buttonResult.current = 'OK';
|
|
34884
|
-
await modals.close();
|
|
34885
|
-
if (onOK) await onOK(selectedKeys);
|
|
34886
|
-
};
|
|
34887
|
-
const handleCancel = async ()=>{
|
|
34888
|
-
buttonResult.current = 'Cancel';
|
|
34889
|
-
await modals.close();
|
|
34890
|
-
if (onCancel) onCancel();
|
|
34891
|
-
};
|
|
34892
|
-
const handleClosed = async ()=>{
|
|
34893
|
-
if (buttonResult.current === 'Quit') {
|
|
34894
|
-
if (onCancel) onCancel();
|
|
34895
|
-
}
|
|
34896
|
-
if (onClosed) onClosed();
|
|
34897
|
-
};
|
|
34898
|
-
await modals.open({
|
|
34899
|
-
content: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $726hz.LookupForm), {
|
|
34900
|
-
dataGridProps: {
|
|
34901
|
-
entity: entity,
|
|
34902
|
-
parentKeys: parentKeys,
|
|
34903
|
-
viewName: viewName,
|
|
34904
|
-
limit: "10000",
|
|
34905
|
-
refreshOnInit: true,
|
|
34906
|
-
selectionMode: selectionMode ? selectionMode : 'multi',
|
|
34907
|
-
search: search,
|
|
34908
|
-
showActions: showActions,
|
|
34909
|
-
enableAdd: enableAdd,
|
|
34910
|
-
enableEdit: enableEdit,
|
|
34911
|
-
enableDelete: enableDelete,
|
|
34912
|
-
enableView: enableView
|
|
34913
|
-
},
|
|
34914
|
-
onOK: async (selectedKeys)=>await handleOK(selectedKeys),
|
|
34915
|
-
onCancel: ()=>handleCancel(),
|
|
34916
|
-
breadCrumbs: breadCrumbs
|
|
34917
|
-
}),
|
|
34918
|
-
modalProps: {
|
|
34919
|
-
...modalProps,
|
|
34920
|
-
trapFocus: true,
|
|
34921
|
-
returnFocus: true,
|
|
34922
|
-
withFullscreenButton: true,
|
|
34923
|
-
title: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Text), {
|
|
34924
|
-
fw: "700",
|
|
34925
|
-
children: [
|
|
34926
|
-
selectLabel,
|
|
34927
|
-
" ",
|
|
34928
|
-
entity.Title
|
|
34929
|
-
]
|
|
34930
|
-
})
|
|
34931
|
-
},
|
|
34932
|
-
onClosed: async ()=>{
|
|
34933
|
-
await handleClosed();
|
|
34934
|
-
}
|
|
34935
|
-
});
|
|
34936
|
-
};
|
|
34937
|
-
return open;
|
|
34938
|
-
}
|
|
34939
|
-
|
|
34940
|
-
});
|
|
34941
|
-
|
|
34942
35498
|
parcelRegister("hiss3", function(module, exports) {
|
|
34943
35499
|
|
|
34944
35500
|
$parcel$export(module.exports, "LookupFormActionDefaultProps", function () { return $9987aca4488b336f$export$cfa3d1bdbe24a61; });
|