@gct-paas/word 0.1.62-patch.1 → 0.1.62-patch.2
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.es.js +7 -3
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -37466,7 +37466,8 @@ function toDictValue(field, value, row) {
|
|
|
37466
37466
|
function getSelectOptions(payload) {
|
|
37467
37467
|
const { value, multiple, options = [], key } = payload || {};
|
|
37468
37468
|
const values = (Array.isArray(value) ? value : multiple ? value?.split(",") ?? [] : [value]).filter((i) => !isNil(i));
|
|
37469
|
-
const
|
|
37469
|
+
const optionMap = new Map(options.map((item) => [item.value, item]));
|
|
37470
|
+
const selected = values.map((v) => optionMap.get(v)).filter((item) => item != null);
|
|
37470
37471
|
const labels = selected.map((item) => item[key]);
|
|
37471
37472
|
return {
|
|
37472
37473
|
selectOptions: selected,
|
|
@@ -38288,8 +38289,11 @@ async function readApiLabel(strategy, value, fieldBinding, loadFieldByKey) {
|
|
|
38288
38289
|
refModelKey: fieldInfo?.bindInfo
|
|
38289
38290
|
};
|
|
38290
38291
|
try {
|
|
38291
|
-
const
|
|
38292
|
-
const
|
|
38292
|
+
const isSingle = strategy.fetcher === "rdo2ref" || strategy.fetcher === "ref2lot2sn";
|
|
38293
|
+
const idList = isSingle ? [String(value)] : getValue$1(value, true);
|
|
38294
|
+
const result = isSingle ? await fetcher.getOptionById(idList[0], params) : await fetcher.getOptionByIds(idList, params);
|
|
38295
|
+
const labelByValue = new Map((Array.isArray(result) ? result : result ? [result] : []).filter((item) => item?.value != null && item?.label != null).map((item) => [String(item.value), String(item.label)]));
|
|
38296
|
+
const labels = idList.map((id) => labelByValue.get(String(id))).filter(Boolean);
|
|
38293
38297
|
if (labels.length) return labels.join(",");
|
|
38294
38298
|
return strategy.fallback;
|
|
38295
38299
|
} catch {
|