@gct-paas/word 0.1.51-patch.7 → 0.1.51-patch.8
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
|
@@ -32882,7 +32882,8 @@ function toDictValue(field, value, row) {
|
|
|
32882
32882
|
function getSelectOptions(payload) {
|
|
32883
32883
|
const { value, multiple, options = [], key } = payload || {};
|
|
32884
32884
|
const values = (Array.isArray(value) ? value : multiple ? value?.split(",") ?? [] : [value]).filter((i) => !isNil(i));
|
|
32885
|
-
const
|
|
32885
|
+
const optionMap = new Map(options.map((item) => [item.value, item]));
|
|
32886
|
+
const selected = values.map((v) => optionMap.get(v)).filter((item) => item != null);
|
|
32886
32887
|
const labels = selected.map((item) => item[key]);
|
|
32887
32888
|
return {
|
|
32888
32889
|
selectOptions: selected,
|
|
@@ -61890,8 +61891,11 @@ async function fetchLabelAndFill(defaults, valuePath, id, fetcher, props, fallba
|
|
|
61890
61891
|
defaults ??= {};
|
|
61891
61892
|
defaults[valuePath] = id;
|
|
61892
61893
|
try {
|
|
61893
|
-
const
|
|
61894
|
-
const
|
|
61894
|
+
const isSingle = fetcher === "rdo2ref" || fetcher === "lot2sn";
|
|
61895
|
+
const idList = isSingle ? [String(id)] : getValue$1(id, true);
|
|
61896
|
+
const result = isSingle ? await apiFetchers[fetcher].getOptionById(idList[0], props) : await apiFetchers[fetcher].getOptionByIds(idList, props);
|
|
61897
|
+
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)]));
|
|
61898
|
+
const labels = idList.map((itemId) => labelByValue.get(String(itemId))).filter(Boolean);
|
|
61895
61899
|
if (labels.length) defaults[getLabelPath(valuePath)] = labels.join(",");
|
|
61896
61900
|
else if (fallback) defaults[getLabelPath(valuePath)] = fallback;
|
|
61897
61901
|
} catch (error) {
|