@gct-paas/word 0.1.73-patch.10 → 0.1.73-patch.12

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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! @gct-paas/word v0.1.73-patch.10 */
1
+ /*! @gct-paas/word v0.1.73-patch.12 */
2
2
  import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toValue, unref, useCssVars, useModel, useSlots, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
3
3
  import FloatingVue, { PopperWrapper } from "floating-vue";
4
4
  import VueKonva from "vue-konva";
@@ -13651,7 +13651,8 @@ function toDictValue(field, value, row) {
13651
13651
  function getSelectOptions(payload) {
13652
13652
  const { value, multiple, options = [], key } = payload || {};
13653
13653
  const values = (Array.isArray(value) ? value : multiple ? (value === null || value === void 0 ? void 0 : value.split(",")) ?? [] : [value]).filter((i) => !isNil(i));
13654
- const selected = options.filter((item) => values.includes(item.value));
13654
+ const optionMap = new Map(options.map((item) => [item.value, item]));
13655
+ const selected = values.map((v) => optionMap.get(v)).filter((item) => item != null);
13655
13656
  const labels = selected.map((item) => item[key]);
13656
13657
  return {
13657
13658
  selectOptions: selected,
@@ -94839,8 +94840,11 @@ async function readApiLabel(strategy, value, fieldBinding, loadFieldByKey) {
94839
94840
  refModelKey: fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.bindInfo
94840
94841
  };
94841
94842
  try {
94842
- const result = strategy.fetcher === "rdo2ref" ? await fetcher.getOptionById(String(value), params) : await fetcher.getOptionByIds(getValue$1(value, true), params);
94843
- const labels = (Array.isArray(result) ? result : result ? [result] : []).map((item) => item === null || item === void 0 ? void 0 : item.label).filter(Boolean);
94843
+ const isSingle = strategy.fetcher === "rdo2ref";
94844
+ const idList = isSingle ? [String(value)] : getValue$1(value, true);
94845
+ const result = isSingle ? await fetcher.getOptionById(idList[0], params) : await fetcher.getOptionByIds(idList, params);
94846
+ const labelByValue = new Map((Array.isArray(result) ? result : result ? [result] : []).filter((item) => (item === null || item === void 0 ? void 0 : item.value) != null && (item === null || item === void 0 ? void 0 : item.label) != null).map((item) => [String(item.value), String(item.label)]));
94847
+ const labels = idList.map((id) => labelByValue.get(String(id))).filter(Boolean);
94844
94848
  if (labels.length) return labels.join(",");
94845
94849
  return strategy.fallback;
94846
94850
  } catch {
@@ -104107,6 +104111,251 @@ var init_TextUtil = __esmMin((() => {
104107
104111
  _defineProperty(TextUtil, "layoutSizeCache", /* @__PURE__ */ new Map());
104108
104112
  }));
104109
104113
  //#endregion
104114
+ //#region src/runtime/designer/ribbon/constant/font.ts
104115
+ var FontFamilyEnum, FontFamilyOptions, FontSizeOptions;
104116
+ var init_font = __esmMin((() => {
104117
+ FontFamilyEnum = /* @__PURE__ */ function(FontFamilyEnum) {
104118
+ FontFamilyEnum["Serif"] = "Roboto,RobotoDraft,Helvetica,Arial,sans-serif";
104119
+ /** 宋体 */
104120
+ FontFamilyEnum["SimSun"] = "\"SimSun\", \"宋体\", \"华文宋体\", STSong, STSongti-SC-Light, sans-serif";
104121
+ /** 黑体 */
104122
+ FontFamilyEnum["SimHei"] = "\"SimHei\", \"黑体\", \"华文黑体\", STHeiti, sans-serif";
104123
+ /** 楷体 */
104124
+ FontFamilyEnum["KaiTi"] = "\"Kai\", \"STKai\", \"楷体\", \"KaiTi\", \"华文楷体\", sans-serif";
104125
+ return FontFamilyEnum;
104126
+ }({});
104127
+ FontFamilyOptions = [
104128
+ {
104129
+ label: "默认",
104130
+ value: "Roboto,RobotoDraft,Helvetica,Arial,sans-serif"
104131
+ },
104132
+ {
104133
+ label: "宋体",
104134
+ value: "\"SimSun\", \"宋体\", \"华文宋体\", STSong, STSongti-SC-Light, sans-serif"
104135
+ },
104136
+ {
104137
+ label: "黑体",
104138
+ value: "\"SimHei\", \"黑体\", \"华文黑体\", STHeiti, sans-serif"
104139
+ },
104140
+ {
104141
+ label: "楷体",
104142
+ value: "\"Kai\", \"STKai\", \"楷体\", \"KaiTi\", \"华文楷体\", sans-serif"
104143
+ }
104144
+ ];
104145
+ FontSizeOptions = [
104146
+ {
104147
+ label: "初号",
104148
+ value: "42"
104149
+ },
104150
+ {
104151
+ label: "小初",
104152
+ value: "36"
104153
+ },
104154
+ {
104155
+ label: "一号",
104156
+ value: "26"
104157
+ },
104158
+ {
104159
+ label: "小一",
104160
+ value: "24"
104161
+ },
104162
+ {
104163
+ label: "二号",
104164
+ value: "22"
104165
+ },
104166
+ {
104167
+ label: "小二",
104168
+ value: "18"
104169
+ },
104170
+ {
104171
+ label: "三号",
104172
+ value: "16"
104173
+ },
104174
+ {
104175
+ label: "小三",
104176
+ value: "15"
104177
+ },
104178
+ {
104179
+ label: "四号",
104180
+ value: "14"
104181
+ },
104182
+ {
104183
+ label: "小四",
104184
+ value: "12"
104185
+ },
104186
+ {
104187
+ label: "五号",
104188
+ value: "10.5"
104189
+ },
104190
+ {
104191
+ label: "小五",
104192
+ value: "9"
104193
+ },
104194
+ {
104195
+ label: "六号",
104196
+ value: "7.5"
104197
+ },
104198
+ {
104199
+ label: "小六",
104200
+ value: "6.5"
104201
+ },
104202
+ {
104203
+ label: "七号",
104204
+ value: "5.5"
104205
+ },
104206
+ {
104207
+ label: "八号",
104208
+ value: "5"
104209
+ },
104210
+ {
104211
+ label: "5",
104212
+ value: 5
104213
+ },
104214
+ {
104215
+ label: "5.5",
104216
+ value: 5.5
104217
+ },
104218
+ {
104219
+ label: "6.5",
104220
+ value: 6.5
104221
+ },
104222
+ {
104223
+ label: "7.5",
104224
+ value: 7.5
104225
+ },
104226
+ {
104227
+ label: "8",
104228
+ value: 8
104229
+ },
104230
+ {
104231
+ label: "9",
104232
+ value: 9
104233
+ },
104234
+ {
104235
+ label: "10",
104236
+ value: 10
104237
+ },
104238
+ {
104239
+ label: "10.5",
104240
+ value: 10.5
104241
+ },
104242
+ {
104243
+ label: "11",
104244
+ value: 11
104245
+ },
104246
+ {
104247
+ label: "12",
104248
+ value: 12
104249
+ },
104250
+ {
104251
+ label: "14",
104252
+ value: 14
104253
+ },
104254
+ {
104255
+ label: "16",
104256
+ value: 16
104257
+ },
104258
+ {
104259
+ label: "18",
104260
+ value: 18
104261
+ },
104262
+ {
104263
+ label: "20",
104264
+ value: 20
104265
+ },
104266
+ {
104267
+ label: "22",
104268
+ value: 22
104269
+ },
104270
+ {
104271
+ label: "24",
104272
+ value: 24
104273
+ },
104274
+ {
104275
+ label: "26",
104276
+ value: 26
104277
+ },
104278
+ {
104279
+ label: "28",
104280
+ value: 28
104281
+ },
104282
+ {
104283
+ label: "30",
104284
+ value: 30
104285
+ },
104286
+ {
104287
+ label: "36",
104288
+ value: 36
104289
+ },
104290
+ {
104291
+ label: "48",
104292
+ value: 48
104293
+ },
104294
+ {
104295
+ label: "56",
104296
+ value: 56
104297
+ },
104298
+ {
104299
+ label: "72",
104300
+ value: 72
104301
+ },
104302
+ {
104303
+ label: "96",
104304
+ value: 96
104305
+ }
104306
+ ];
104307
+ }));
104308
+ //#endregion
104309
+ //#region src/utils/fonts/normalize-document-font.ts
104310
+ /**
104311
+ * 从 OOXML rFonts 取展示用字体名。
104312
+ * 中文 Word 常把字体写在 eastAsia,优先于 ascii。
104313
+ */
104314
+ function pickDocumentFontName(rFonts) {
104315
+ if (!rFonts) return void 0;
104316
+ return rFonts.eastAsia || rFonts.ascii || rFonts.hAnsi || rFonts.cs || void 0;
104317
+ }
104318
+ /**
104319
+ * 识别是否为产品支持的黑 / 宋 / 楷(含常见别名)。
104320
+ * 无法识别时返回 null(应回落默认字体)。
104321
+ * 注意:不能用裸 includes('serif'),否则会误伤 "sans-serif"。
104322
+ */
104323
+ function detectSupportedCjkKind(fontFamily) {
104324
+ if (!fontFamily) return null;
104325
+ const name = fontFamily.toLowerCase();
104326
+ const isKai = /lxgw|wenkai|kaiti|楷/.test(name) || /(^|[,\"\s])kai([,\"\s]|$)/.test(name) || name.includes("stkai");
104327
+ const isSong = /noto\s*serif|notoserif|simsun|华文宋|stsong|songti|宋体/.test(name) || /(^|[,\"\s])song([,\"\s]|$)/.test(name);
104328
+ const isHei = /noto\s*sans|notosans|simhei|华文黑|stheiti|黑体/.test(name) || name.includes("heiti");
104329
+ if (isKai) return "kai";
104330
+ if (isSong && !isHei) return "song";
104331
+ if (isHei) return "hei";
104332
+ return null;
104333
+ }
104334
+ /**
104335
+ * 将任意字体名归一到产品支持的黑 / 宋 / 楷。
104336
+ * 无法识别(如 Arial、微软雅黑)时回落默认字体。
104337
+ */
104338
+ function normalizeSupportedFontFamily(fontFamily) {
104339
+ if (!fontFamily) return DEFAULT_FONT_FAMILY;
104340
+ if (fontFamily === "Roboto,RobotoDraft,Helvetica,Arial,sans-serif" || fontFamily === FontFamilyEnum.Serif) return fontFamily;
104341
+ for (const stack of SUPPORTED_DOCUMENT_FONT_FAMILIES) if (fontFamily === stack) return fontFamily;
104342
+ const kind = detectSupportedCjkKind(fontFamily);
104343
+ if (kind === "kai") return FontFamilyEnum.KaiTi;
104344
+ if (kind === "song") return FontFamilyEnum.SimSun;
104345
+ if (kind === "hei") return FontFamilyEnum.SimHei;
104346
+ return DEFAULT_FONT_FAMILY;
104347
+ }
104348
+ var SUPPORTED_DOCUMENT_FONT_FAMILIES;
104349
+ var init_normalize_document_font = __esmMin((() => {
104350
+ init_constants$1();
104351
+ init_font();
104352
+ SUPPORTED_DOCUMENT_FONT_FAMILIES = [
104353
+ FontFamilyEnum.SimHei,
104354
+ FontFamilyEnum.SimSun,
104355
+ FontFamilyEnum.KaiTi
104356
+ ];
104357
+ }));
104358
+ //#endregion
104110
104359
  //#region src/core/view/runs/TextRun.ts
104111
104360
  var TextRun;
104112
104361
  var init_TextRun = __esmMin((() => {
@@ -104114,6 +104363,7 @@ var init_TextRun = __esmMin((() => {
104114
104363
  init_constants$1();
104115
104364
  init_helpers();
104116
104365
  init_TextUtil();
104366
+ init_normalize_document_font();
104117
104367
  init_defineProperty();
104118
104368
  TextRun = class TextRun extends LayoutNode {
104119
104369
  constructor(options) {
@@ -104280,11 +104530,11 @@ var init_TextRun = __esmMin((() => {
104280
104530
  * @returns TextRun 的样式属性
104281
104531
  */
104282
104532
  static textStyle2LayoutStyle(textStyle) {
104283
- var _textStyle$rFonts;
104284
104533
  if (!textStyle) return {};
104285
104534
  const layoutStyle = {};
104286
104535
  if (textStyle.sz !== void 0) layoutStyle.fontSize = textStyle.sz / 2 * 96 / 72;
104287
- if ((_textStyle$rFonts = textStyle.rFonts) === null || _textStyle$rFonts === void 0 ? void 0 : _textStyle$rFonts.ascii) layoutStyle.fontFamily = textStyle.rFonts.ascii;
104536
+ const rawFontFamily = pickDocumentFontName(textStyle.rFonts);
104537
+ if (rawFontFamily) layoutStyle.fontFamily = normalizeSupportedFontFamily(rawFontFamily);
104288
104538
  if (textStyle.highlight) layoutStyle.highlight = normalizeColor(textStyle.highlight, "none");
104289
104539
  if (textStyle.color) layoutStyle.color = normalizeColor(textStyle.color, DEFAULT_TEXT_COLOR);
104290
104540
  if (textStyle.b !== void 0) layoutStyle.bold = textStyle.b;
@@ -123976,6 +124226,17 @@ var init_uom_convert_runtime = __esmMin((() => {
123976
124226
  DEFAULT_INPUT_FIELD = "qty_";
123977
124227
  }));
123978
124228
  //#endregion
124229
+ //#region src/runtime/canvas/table/render/material-consume/derived-qty.ts
124230
+ /**
124231
+ * 未选择物料时,已消耗数量与当前行消耗数量保持一致。
124232
+ * 空值统一写为 null,避免数值字段向提交接口传递空字符串。
124233
+ */
124234
+ function resolveConsumedQtyWithoutProduct(value) {
124235
+ if (value === void 0 || value === null || value === "") return null;
124236
+ return Number(value);
124237
+ }
124238
+ var init_derived_qty = __esmMin((() => {}));
124239
+ //#endregion
123979
124240
  //#region src/runtime/canvas/table/render/material-consume/material-consume-table-controller.ts
123980
124241
  /**
123981
124242
  * 解析规则配置字符串解析成对象
@@ -124003,6 +124264,7 @@ var init_material_consume_table_controller = __esmMin((() => {
124003
124264
  init_TriggerUtil();
124004
124265
  init_data();
124005
124266
  init_uom_convert_runtime();
124267
+ init_derived_qty();
124006
124268
  init_defineProperty();
124007
124269
  MCDataUtil = class MCDataUtil {
124008
124270
  /**
@@ -124503,7 +124765,7 @@ var init_material_consume_table_controller = __esmMin((() => {
124503
124765
  const modifySingleRow = (row, rowIndex) => {
124504
124766
  const fieldKey = `${this.subTableInfo.valuePath}[${rowIndex}].qty_consumed_`;
124505
124767
  if (!row.product_id_) {
124506
- doc.dataManager.set(fieldKey, row.qty_ ? Number(row.qty_) : "", "user");
124768
+ doc.dataManager.set(fieldKey, resolveConsumedQtyWithoutProduct(row.qty_), "user");
124507
124769
  return;
124508
124770
  }
124509
124771
  let total = 0;
@@ -138250,204 +138512,12 @@ var table_ribbon_group_vue_vue_type_script_setup_true_name_table_ribbon_group_la
138250
138512
  init__plugin_vue_export_helper();
138251
138513
  var table_ribbon_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(table_ribbon_group_vue_vue_type_script_setup_true_name_table_ribbon_group_lang_default, [["__scopeId", "data-v-a6ebfeaa"]]);
138252
138514
  //#endregion
138253
- //#region src/runtime/designer/ribbon/constant/font.ts
138254
- /** 字重 */
138255
- var FontFamilyEnum = /* @__PURE__ */ function(FontFamilyEnum) {
138256
- FontFamilyEnum["Serif"] = "Roboto,RobotoDraft,Helvetica,Arial,sans-serif";
138257
- /** 宋体 */
138258
- FontFamilyEnum["SimSun"] = "\"SimSun\", \"宋体\", \"华文宋体\", STSong, STSongti-SC-Light, sans-serif";
138259
- /** 黑体 */
138260
- FontFamilyEnum["SimHei"] = "\"SimHei\", \"黑体\", \"华文黑体\", STHeiti, sans-serif";
138261
- /** 楷体 */
138262
- FontFamilyEnum["KaiTi"] = "\"Kai\", \"STKai\", \"楷体\", \"KaiTi\", \"华文楷体\", sans-serif";
138263
- return FontFamilyEnum;
138264
- }({});
138265
- var FontFamilyOptions = [
138266
- {
138267
- label: "默认",
138268
- value: "Roboto,RobotoDraft,Helvetica,Arial,sans-serif"
138269
- },
138270
- {
138271
- label: "宋体",
138272
- value: "\"SimSun\", \"宋体\", \"华文宋体\", STSong, STSongti-SC-Light, sans-serif"
138273
- },
138274
- {
138275
- label: "黑体",
138276
- value: "\"SimHei\", \"黑体\", \"华文黑体\", STHeiti, sans-serif"
138277
- },
138278
- {
138279
- label: "楷体",
138280
- value: "\"Kai\", \"STKai\", \"楷体\", \"KaiTi\", \"华文楷体\", sans-serif"
138281
- }
138282
- ];
138283
- var FontSizeOptions = [
138284
- {
138285
- label: "初号",
138286
- value: "42"
138287
- },
138288
- {
138289
- label: "小初",
138290
- value: "36"
138291
- },
138292
- {
138293
- label: "一号",
138294
- value: "26"
138295
- },
138296
- {
138297
- label: "小一",
138298
- value: "24"
138299
- },
138300
- {
138301
- label: "二号",
138302
- value: "22"
138303
- },
138304
- {
138305
- label: "小二",
138306
- value: "18"
138307
- },
138308
- {
138309
- label: "三号",
138310
- value: "16"
138311
- },
138312
- {
138313
- label: "小三",
138314
- value: "15"
138315
- },
138316
- {
138317
- label: "四号",
138318
- value: "14"
138319
- },
138320
- {
138321
- label: "小四",
138322
- value: "12"
138323
- },
138324
- {
138325
- label: "五号",
138326
- value: "10.5"
138327
- },
138328
- {
138329
- label: "小五",
138330
- value: "9"
138331
- },
138332
- {
138333
- label: "六号",
138334
- value: "7.5"
138335
- },
138336
- {
138337
- label: "小六",
138338
- value: "6.5"
138339
- },
138340
- {
138341
- label: "七号",
138342
- value: "5.5"
138343
- },
138344
- {
138345
- label: "八号",
138346
- value: "5"
138347
- },
138348
- {
138349
- label: "5",
138350
- value: 5
138351
- },
138352
- {
138353
- label: "5.5",
138354
- value: 5.5
138355
- },
138356
- {
138357
- label: "6.5",
138358
- value: 6.5
138359
- },
138360
- {
138361
- label: "7.5",
138362
- value: 7.5
138363
- },
138364
- {
138365
- label: "8",
138366
- value: 8
138367
- },
138368
- {
138369
- label: "9",
138370
- value: 9
138371
- },
138372
- {
138373
- label: "10",
138374
- value: 10
138375
- },
138376
- {
138377
- label: "10.5",
138378
- value: 10.5
138379
- },
138380
- {
138381
- label: "11",
138382
- value: 11
138383
- },
138384
- {
138385
- label: "12",
138386
- value: 12
138387
- },
138388
- {
138389
- label: "14",
138390
- value: 14
138391
- },
138392
- {
138393
- label: "16",
138394
- value: 16
138395
- },
138396
- {
138397
- label: "18",
138398
- value: 18
138399
- },
138400
- {
138401
- label: "20",
138402
- value: 20
138403
- },
138404
- {
138405
- label: "22",
138406
- value: 22
138407
- },
138408
- {
138409
- label: "24",
138410
- value: 24
138411
- },
138412
- {
138413
- label: "26",
138414
- value: 26
138415
- },
138416
- {
138417
- label: "28",
138418
- value: 28
138419
- },
138420
- {
138421
- label: "30",
138422
- value: 30
138423
- },
138424
- {
138425
- label: "36",
138426
- value: 36
138427
- },
138428
- {
138429
- label: "48",
138430
- value: 48
138431
- },
138432
- {
138433
- label: "56",
138434
- value: 56
138435
- },
138436
- {
138437
- label: "72",
138438
- value: 72
138439
- },
138440
- {
138441
- label: "96",
138442
- value: 96
138443
- }
138444
- ];
138445
- //#endregion
138446
138515
  //#region src/runtime/designer/ribbon/tabs/word-tab.vue?vue&type=script&setup=true&name=home-tab&lang.ts
138447
138516
  init_dist();
138448
138517
  init_base$2();
138449
138518
  init_core();
138450
138519
  init_asset_helper_util();
138520
+ init_font();
138451
138521
  init_logic$1();
138452
138522
  init_constants$1();
138453
138523
  var _hoisted_1$104 = { class: "items-container" };
@@ -143670,6 +143740,7 @@ var manifest$7 = {
143670
143740
  //#endregion
143671
143741
  //#region src/suites/edhr/manifest/paper-widget/_common_/basic.ts
143672
143742
  init_constants$1();
143743
+ init_font();
143673
143744
  var DEFAULT_WIDGET_TEXT_STYLE = {
143674
143745
  fontFamily: FontFamilyEnum.Serif,
143675
143746
  fontSize: 13,
@@ -158399,6 +158470,7 @@ var widget_barcode_config_default = /*#__PURE__*/ _plugin_vue_export_helper_defa
158399
158470
  //#endregion
158400
158471
  //#region src/suites/shared/panel/config/editor/font-editor/font-editor.vue?vue&type=script&setup=true&lang.ts
158401
158472
  init_base$2();
158473
+ init_font();
158402
158474
  var _hoisted_1$8 = { class: "content" };
158403
158475
  var _hoisted_2$4 = { class: "value" };
158404
158476
  var font_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 未选择物料时,已消耗数量与当前行消耗数量保持一致。
3
+ * 空值统一写为 null,避免数值字段向提交接口传递空字符串。
4
+ */
5
+ export declare function resolveConsumedQtyWithoutProduct(value: unknown): number | null;
@@ -0,0 +1,16 @@
1
+ export type DocRFonts = {
2
+ ascii?: string;
3
+ hAnsi?: string;
4
+ eastAsia?: string;
5
+ cs?: string;
6
+ };
7
+ /**
8
+ * 从 OOXML rFonts 取展示用字体名。
9
+ * 中文 Word 常把字体写在 eastAsia,优先于 ascii。
10
+ */
11
+ export declare function pickDocumentFontName(rFonts?: DocRFonts | null): string | undefined;
12
+ /**
13
+ * 将任意字体名归一到产品支持的黑 / 宋 / 楷。
14
+ * 无法识别(如 Arial、微软雅黑)时回落默认字体。
15
+ */
16
+ export declare function normalizeSupportedFontFamily(fontFamily?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.73-patch.10",
3
+ "version": "0.1.73-patch.12",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",