@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.
Files changed (2) hide show
  1. package/dist/index.es.js +7 -3
  2. 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 selected = options.filter((item) => values.includes(item.value));
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 result = fetcher === "rdo2ref" || fetcher === "lot2sn" ? await apiFetchers[fetcher].getOptionById(id, props) : await apiFetchers[fetcher].getOptionByIds(getValue$1(id, true), props);
61894
- const labels = (Array.isArray(result) ? result : result ? [result] : []).map((i) => i?.label).filter(Boolean);
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.51-patch.7",
3
+ "version": "0.1.51-patch.8",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",