@gct-paas/word 0.1.42 → 0.1.44

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.
@@ -27,6 +27,7 @@ export declare class AssetHelper {
27
27
  static init(opts: {
28
28
  transfer: (key: string) => string;
29
29
  }): void;
30
+ private static normalizeUploadedPath;
30
31
  /** 上传(基础版) */
31
32
  static upload(file: File, opts?: UploadOptions): Promise<any>;
32
33
  /** 上传(带进度) */
package/dist/index.es.js CHANGED
@@ -115,13 +115,22 @@ class AssetHelper {
115
115
  static init(opts) {
116
116
  this.transfer = opts.transfer;
117
117
  }
118
+ static normalizeUploadedPath(path2) {
119
+ if (!path2) return path2;
120
+ if (/^https?:\/\//.test(path2)) return path2;
121
+ return path2.startsWith("/") ? path2 : `/${path2}`;
122
+ }
118
123
  /** 上传(基础版) */
119
124
  static async upload(file, opts) {
120
- return serviceUtil.uploadFile(file, {
125
+ const res = await serviceUtil.uploadFile(file, {
121
126
  modelKey: opts?.modelKey,
122
127
  signal: opts?.signal,
123
128
  onProgress: opts?.onProgress
124
129
  });
130
+ if (res?.data && typeof res.data === "string") {
131
+ res.data = this.normalizeUploadedPath(res.data);
132
+ }
133
+ return res;
125
134
  }
126
135
  /** 上传(带进度) */
127
136
  static async uploadWithProgress(file, opts = {}) {
@@ -32089,11 +32098,20 @@ class Enter extends CommandBase {
32089
32098
  const { nodeId, offset: offset2, side } = cursor.getCursor();
32090
32099
  const mapper = this.doc.layoutMapper;
32091
32100
  const run = mapper.getLayoutNodeById(nodeId);
32101
+ const wpId = run?.parent?.modelRef?.id;
32102
+ if (!run || !wpId) {
32103
+ this.isTerminated = true;
32104
+ return null;
32105
+ }
32092
32106
  if (!this.doc.eventManager.policy.canInput(run)) {
32093
32107
  this.isTerminated = true;
32094
32108
  return null;
32095
32109
  }
32096
- const wp = mapper.getModelNodeById(run.parent.modelRef.id);
32110
+ const wp = mapper.getModelNodeById(wpId);
32111
+ if (!wp) {
32112
+ this.isTerminated = true;
32113
+ return null;
32114
+ }
32097
32115
  let targetModelIndex = 0;
32098
32116
  if (!run.isPlaceholderRun) {
32099
32117
  if (run.isWidgetRun || run.isPageWidgetRun) {
@@ -40350,6 +40368,7 @@ class CommandManager {
40350
40368
  compositionUpdate(text) {
40351
40369
  }
40352
40370
  compositionEnd(text) {
40371
+ if (!text) return;
40353
40372
  this.doc.commandManager.execute(CommandType.insertText, {
40354
40373
  text
40355
40374
  });
@@ -46547,10 +46566,11 @@ class IMEHandler {
46547
46566
  this.eventManager.doc.commandManager.compositionUpdate(data);
46548
46567
  }
46549
46568
  handleCompositionEnd(payload) {
46550
- const data = payload?.data ?? this.lastComposedText ?? "";
46569
+ const data = payload?.data !== null && payload?.data !== void 0 ? payload.data : this.lastComposedText ?? "";
46551
46570
  this.lastComposedText = null;
46552
46571
  this.isComposing = false;
46553
46572
  this.lastCompositionCommitTime = performance.now();
46573
+ if (!data) return;
46554
46574
  this.eventManager.doc.commandManager.compositionEnd(data);
46555
46575
  }
46556
46576
  handleInput(payload) {
@@ -46579,6 +46599,7 @@ class IMEHandler {
46579
46599
  case "delete":
46580
46600
  break;
46581
46601
  case "enter":
46602
+ if (this.isComposing) return;
46582
46603
  doc.commandManager.execute(CommandType.enter);
46583
46604
  break;
46584
46605
  case "tab":
@@ -51118,8 +51139,18 @@ const _sfc_main$2X = /* @__PURE__ */ defineComponent({
51118
51139
  lastComposedText.value = data;
51119
51140
  dispatch("ime:compositionupdate", { data });
51120
51141
  }
51142
+ function resolveCompositionEndData(e) {
51143
+ if (e.data !== null && e.data !== void 0) {
51144
+ return e.data;
51145
+ }
51146
+ const fromTextarea = ta2.value?.value ?? "";
51147
+ if (fromTextarea !== lastComposedText.value) {
51148
+ lastComposedText.value = fromTextarea;
51149
+ }
51150
+ return lastComposedText.value ?? "";
51151
+ }
51121
51152
  function onCompositionEnd(e) {
51122
- const data = e.data ?? lastComposedText.value ?? "";
51153
+ const data = resolveCompositionEndData(e);
51123
51154
  isComposing.value = false;
51124
51155
  pos.opacity = props.idleOpacity;
51125
51156
  lastComposedText.value = "";
@@ -51148,6 +51179,7 @@ const _sfc_main$2X = /* @__PURE__ */ defineComponent({
51148
51179
  }
51149
51180
  break;
51150
51181
  case "Enter":
51182
+ if (isComposing.value) return;
51151
51183
  e.preventDefault();
51152
51184
  dispatch("ime:keydown", { type: "enter" });
51153
51185
  break;
@@ -51195,9 +51227,10 @@ const _sfc_main$2X = /* @__PURE__ */ defineComponent({
51195
51227
  function onBlur(e) {
51196
51228
  if (isComposing.value) {
51197
51229
  isComposing.value = false;
51198
- dispatch("ime:compositionend", { data: lastComposedText.value });
51230
+ const data = ta2.value?.value ?? lastComposedText.value ?? "";
51199
51231
  lastComposedText.value = "";
51200
51232
  lastCompositionCommitTime.value = performance.now();
51233
+ dispatch("ime:compositionend", { data });
51201
51234
  }
51202
51235
  dispatch("ime:blur", {});
51203
51236
  }
@@ -51296,7 +51329,7 @@ const _sfc_main$2X = /* @__PURE__ */ defineComponent({
51296
51329
  };
51297
51330
  }
51298
51331
  });
51299
- const HiddenInput = /* @__PURE__ */ _export_sfc(_sfc_main$2X, [["__scopeId", "data-v-58dae928"]]);
51332
+ const HiddenInput = /* @__PURE__ */ _export_sfc(_sfc_main$2X, [["__scopeId", "data-v-72d0b6f5"]]);
51300
51333
  function useLatestRequest(execFn) {
51301
51334
  let lastReqId = 0;
51302
51335
  const loading = ref(false);
@@ -51859,8 +51892,33 @@ function resolveSubmitCrossKeys(formData, subTableInfoList) {
51859
51892
  }
51860
51893
  return Object.keys(formData).filter((k) => k.includes(":"));
51861
51894
  }
51895
+ const handleSyncCheckValue = (row) => {
51896
+ const { type_, value_ } = row;
51897
+ if (type_ === "boolean") {
51898
+ row.bool_value_ = value_;
51899
+ } else if (type_ === "string") {
51900
+ row.text_value_ = value_;
51901
+ } else if (type_ === "integer") {
51902
+ row.int_value_ = value_;
51903
+ } else if (type_ === "decimal") {
51904
+ row.double_value_ = value_;
51905
+ } else if (type_ === "user") {
51906
+ row.user_value_ = value_;
51907
+ } else if (type_ === "org") {
51908
+ row.org_value_ = value_;
51909
+ } else if (type_ === "date") {
51910
+ row.date_value_ = value_;
51911
+ } else if (type_ === "date_time") {
51912
+ row.date_time_value_ = value_;
51913
+ } else if (type_ === "image") {
51914
+ row.image_value_ = value_;
51915
+ } else if (type_ === "attachment") {
51916
+ row.attachment_value_ = value_;
51917
+ }
51918
+ };
51862
51919
  function getSubmitFormData(formData, subTableInfoList) {
51863
51920
  const _formData = { ...formData };
51921
+ const checkTableFieldList = (subTableInfoList || []).filter((o) => o.subType === "check-table-2d").map((o) => o.field);
51864
51922
  resolveSubmitCrossKeys(_formData, subTableInfoList).forEach((crossKey) => {
51865
51923
  const [subKey, linkKey] = crossKey.split(":");
51866
51924
  const subData = _formData[subKey] || [];
@@ -51882,6 +51940,7 @@ function getSubmitFormData(formData, subTableInfoList) {
51882
51940
  delete _formData[crossKey];
51883
51941
  });
51884
51942
  const realFormData = Object.keys(_formData).reduce((reducedData, fieldKey) => {
51943
+ const isCheckTable = checkTableFieldList.includes(fieldKey);
51885
51944
  const fieldValue = _formData[fieldKey];
51886
51945
  if (Array.isArray(fieldValue)) {
51887
51946
  fieldValue.forEach((row) => {
@@ -51889,6 +51948,9 @@ function getSubmitFormData(formData, subTableInfoList) {
51889
51948
  if (__gw_x_uid) {
51890
51949
  row.group_ = __gw_x_uid;
51891
51950
  }
51951
+ if (isCheckTable) {
51952
+ handleSyncCheckValue(row);
51953
+ }
51892
51954
  });
51893
51955
  reducedData[fieldKey] = _formData[fieldKey].map(
51894
51956
  (row) => Object.fromEntries(
@@ -100024,9 +100086,7 @@ async function addSubModelsToFieldScope(modelKey, ctx) {
100024
100086
  try {
100025
100087
  const res = await api.apaas.modelMeta.getListSlaveModel({ modelKey });
100026
100088
  const subModelKeys = Array.isArray(res) ? res.map((item) => item?.key || "").filter(Boolean) : [];
100027
- subModelKeys.forEach((subKey) => {
100028
- ctx.runtime.fieldScope.addModel(subKey);
100029
- });
100089
+ await Promise.all(subModelKeys.map((subKey) => ctx.runtime.fieldScope.addModel(subKey)));
100030
100090
  } catch (error) {
100031
100091
  console.error("拉取子模型key失败", { modelKey, error });
100032
100092
  return;
package/dist/word.css CHANGED
@@ -7572,7 +7572,7 @@ textarea[data-v-57fe54a3]::placeholder {
7572
7572
  .avatar--horizontal .avatar__name[data-v-b2773d93] {
7573
7573
  margin-left: 6px;
7574
7574
  }
7575
- .hidden-input[data-v-58dae928] {
7575
+ .hidden-input[data-v-72d0b6f5] {
7576
7576
  position: absolute;
7577
7577
  resize: none;
7578
7578
  border: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",