@gct-paas/word 0.1.63-beta.8 → 0.1.63-beta.9

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
@@ -108002,33 +108002,16 @@ const DefaultDocxJson = {
108002
108002
  fontTable,
108003
108003
  footers
108004
108004
  };
108005
- const updatePgSzElInfo = (pgSz, paperSize, options) => {
108006
- const direction = options?.direction ?? "portrait";
108007
- let width = 11906;
108008
- let height = 16838;
108009
- switch (paperSize) {
108010
- case PaperSizeConst.A3:
108011
- width = 16838;
108012
- height = 23811;
108013
- break;
108014
- case PaperSizeConst.A5:
108015
- width = 8391;
108016
- height = 11906;
108017
- break;
108018
- case PaperSizeConst.CUSTOM:
108019
- width = Number(UnitConverter.mmToTwip(options.width));
108020
- height = Number(UnitConverter.mmToTwip(options.height));
108021
- break;
108022
- default:
108023
- width = 11906;
108024
- height = 16838;
108025
- break;
108026
- }
108027
- if (direction === "landscape") {
108028
- [width, height] = [height, width];
108029
- }
108030
- pgSz["@attrs"]["w:w"] = String(width);
108031
- pgSz["@attrs"]["w:h"] = String(height);
108005
+ const getDirectedSize = (direction, mmWidth, mmHeight) => {
108006
+ const [short, long] = [mmWidth, mmHeight].sort((a, b2) => a - b2);
108007
+ const isLandscape = direction === "landscape";
108008
+ const width = isLandscape ? long : short;
108009
+ const height = isLandscape ? short : long;
108010
+ return { width, height };
108011
+ };
108012
+ const updatePgSzElInfo = (pgSz, mmWidth, mmHeight) => {
108013
+ pgSz["@attrs"]["w:w"] = String(UnitConverter.mmToTwip(mmWidth));
108014
+ pgSz["@attrs"]["w:h"] = String(UnitConverter.mmToTwip(mmHeight));
108032
108015
  };
108033
108016
  class RuntimeJsonBuilder {
108034
108017
  json;
@@ -108051,10 +108034,11 @@ class RuntimeJsonBuilder {
108051
108034
  /**
108052
108035
  * 页面设置
108053
108036
  */
108054
- setPageSize(paperSize, options) {
108037
+ setPageSize(mmWidth, mmHeight) {
108055
108038
  const pgSz = this.findNode(this.json.document, "w:pgSz");
108056
- if (!pgSz) return this;
108057
- updatePgSzElInfo(pgSz, paperSize, options);
108039
+ if (pgSz) {
108040
+ updatePgSzElInfo(pgSz, mmWidth, mmHeight);
108041
+ }
108058
108042
  return this;
108059
108043
  }
108060
108044
  /**
@@ -109505,14 +109489,13 @@ const syncMaterialConsumeTableBomInfo = async (templateId, docModel) => {
109505
109489
  };
109506
109490
  const initMaterialConsumeTableConfig = (doc, subConfig, tmplBomC) => {
109507
109491
  if (!tmplBomC?.formInstBom?.formTmplBomList) return;
109492
+ const useBomMode = tmplBomC.defaultMCPattern === MaterialConsumptionPatternEnum.BOM;
109508
109493
  tmplBomC.formInstBom.formTmplBomList.forEach(({
109509
- material_consumption_pattern_,
109510
109494
  personal_bom_enabled_,
109511
109495
  entries_,
109512
109496
  table_key_
109513
109497
  }) => {
109514
- const isBomMode = material_consumption_pattern_ === MaterialConsumptionPatternEnum.BOM;
109515
- if (isBomMode) {
109498
+ if (useBomMode) {
109516
109499
  const entries = personal_bom_enabled_ ? entries_ : tmplBomC.bomEntries;
109517
109500
  const includedIds = [];
109518
109501
  (entries || []).forEach((e) => {
@@ -109672,32 +109655,28 @@ class SingleTemplateStrategy extends DocRequestStrategy {
109672
109655
  console.warn(`Document template ${id} not found`);
109673
109656
  return null;
109674
109657
  }
109675
- const { baseId, id: tmpId } = requestInfo;
109658
+ const {
109659
+ baseId,
109660
+ id: tmpId,
109661
+ paperSize,
109662
+ direction,
109663
+ width: w2,
109664
+ height: h2
109665
+ } = requestInfo;
109666
+ const { width, height } = getDirectedSize(direction, w2, h2);
109667
+ requestInfo.width = width;
109668
+ requestInfo.height = height;
109676
109669
  if (!requestInfo.runtimeJson) {
109677
- const json = new RuntimeJsonBuilder(DefaultDocxJson).setPageSize(requestInfo.paperSize, {
109678
- width: requestInfo.width,
109679
- height: requestInfo.height,
109680
- direction: requestInfo.direction
109681
- }).build();
109670
+ const json = new RuntimeJsonBuilder(DefaultDocxJson).setPageSize(width, height).build();
109682
109671
  requestInfo.runtimeJson = JSON.stringify(json);
109683
109672
  } else {
109684
109673
  const jsonObj = JSON.parse(requestInfo.runtimeJson);
109685
109674
  const wSec = jsonObj.document.elements[0]?.elements?.find((el) => el.name === "w:sectPr");
109686
109675
  if (wSec) {
109687
- wSec.paperSize = requestInfo.paperSize;
109676
+ wSec.paperSize = paperSize;
109688
109677
  const pgSzEl = wSec.elements?.find((el) => el.name === "w:pgSz");
109689
109678
  if (pgSzEl) {
109690
- const { paperSize, width: w2, height: h2, direction } = requestInfo;
109691
- const [width, height] = [w2, h2].sort();
109692
- updatePgSzElInfo(
109693
- pgSzEl,
109694
- paperSize,
109695
- {
109696
- width,
109697
- height,
109698
- direction
109699
- }
109700
- );
109679
+ updatePgSzElInfo(pgSzEl, width, height);
109701
109680
  }
109702
109681
  requestInfo.runtimeJson = JSON.stringify(jsonObj);
109703
109682
  }
@@ -124072,7 +124051,7 @@ const manifest$j = {
124072
124051
  ...commonDefaultProps
124073
124052
  },
124074
124053
  computed: {
124075
- onValueChangeRule: idOnValueChangeRule
124054
+ onValueChangeRule: [...hyperlinkAndIdOnValueChangeRules]
124076
124055
  }
124077
124056
  };
124078
124057
  const __vite_glob_0_53 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -127440,9 +127419,13 @@ const _hoisted_1$1w = {
127440
127419
  };
127441
127420
  const _sfc_main$1U = /* @__PURE__ */ defineComponent({
127442
127421
  __name: "page-size-config",
127422
+ props: {
127423
+ orientation: {}
127424
+ },
127443
127425
  setup(__props) {
127444
127426
  const { docInst } = useDocPubApiContext();
127445
127427
  const { active, widget } = useActivePanel();
127428
+ const props = __props;
127446
127429
  const isCustom = (s) => s === PaperSizeConst.CUSTOM;
127447
127430
  const paperSizeOptions = Object.entries(PaperSizeConst).map(([paperSize2, value]) => {
127448
127431
  const label = isCustom(paperSize2) ? "自定义" : `${paperSize2} (${PaperSizeMmMap[paperSize2].join("×")}mm)`;
@@ -127477,6 +127460,15 @@ const _sfc_main$1U = /* @__PURE__ */ defineComponent({
127477
127460
  const [mmWidth, mmHeight] = PaperSizeMmMap[_sizeEnum];
127478
127461
  handlePageSizeChange(mmWidth, mmHeight);
127479
127462
  };
127463
+ watch(
127464
+ () => props.orientation,
127465
+ () => {
127466
+ const { mmWidth, mmHeight } = activeSecSize.value;
127467
+ const { width, height } = getDirectedSize(props.orientation, mmWidth, mmHeight);
127468
+ activeSecSize.value.mmWidth = width;
127469
+ activeSecSize.value.mmHeight = height;
127470
+ }
127471
+ );
127480
127472
  return (_ctx, _cache) => {
127481
127473
  return openBlock(), createElementBlock(Fragment, null, [
127482
127474
  createVNode(unref(GctFormItem), {
@@ -127532,7 +127524,7 @@ const _sfc_main$1U = /* @__PURE__ */ defineComponent({
127532
127524
  };
127533
127525
  }
127534
127526
  });
127535
- const PageSizeConfig = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__scopeId", "data-v-e735bbe5"]]);
127527
+ const PageSizeConfig = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__scopeId", "data-v-0c96db84"]]);
127536
127528
  const _hoisted_1$1v = { style: { "display": "flex", "align-items": "center" } };
127537
127529
  const _hoisted_2$V = { class: "form-item-end" };
127538
127530
  const _hoisted_3$F = { style: { "margin-top": "8px" } };
@@ -127727,7 +127719,7 @@ const _sfc_main$1S = /* @__PURE__ */ defineComponent({
127727
127719
  }, {
127728
127720
  default: withCtx(() => [
127729
127721
  createElementVNode("div", _hoisted_3$E, [
127730
- createVNode(PageSizeConfig),
127722
+ createVNode(PageSizeConfig, { orientation: orient.value }, null, 8, ["orientation"]),
127731
127723
  createVNode(unref(GctFormItem), {
127732
127724
  label: "页面方向",
127733
127725
  inline: false
@@ -127790,7 +127782,7 @@ const _sfc_main$1S = /* @__PURE__ */ defineComponent({
127790
127782
  };
127791
127783
  }
127792
127784
  });
127793
- const PaperPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__scopeId", "data-v-09c58e04"]]);
127785
+ const PaperPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__scopeId", "data-v-243a03df"]]);
127794
127786
  const schema$j = {
127795
127787
  key: "paper.basic",
127796
127788
  title: "表单属性",
@@ -1,10 +1,3 @@
1
- import { PaperSize } from '../../../core/constants';
2
- interface IPageSizeOptions {
3
- width: number;
4
- height: number;
5
- direction?: 'portrait' | 'landscape';
6
- }
7
- export declare const updatePgSzElInfo: (pgSz: any, paperSize: PaperSize, options: IPageSizeOptions) => void;
8
1
  export declare class RuntimeJsonBuilder {
9
2
  private json;
10
3
  constructor(base: any);
@@ -12,10 +5,9 @@ export declare class RuntimeJsonBuilder {
12
5
  /**
13
6
  * 页面设置
14
7
  */
15
- setPageSize(paperSize: PaperSize, options: IPageSizeOptions): this;
8
+ setPageSize(mmWidth: number, mmHeight: number): this;
16
9
  /**
17
10
  * 构建
18
11
  */
19
12
  build(): any;
20
13
  }
21
- export {};
@@ -0,0 +1,12 @@
1
+ import { VOrientationType } from '../../../../../../domain/constants/enum';
2
+ /**
3
+ * 根据纸张方向计算实际展示的宽、高(单位mm)
4
+ */
5
+ export declare const getDirectedSize: (direction: VOrientationType, mmWidth: number, mmHeight: number) => {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ /**
10
+ * 更新 sec 下 pgSz 的 twip 尺寸信息
11
+ */
12
+ export declare const updatePgSzElInfo: (pgSz: any, mmWidth: number, mmHeight: number) => void;
@@ -0,0 +1,6 @@
1
+ import { VOrientationType } from '../../../../../../domain/constants/enum';
2
+ type __VLS_Props = {
3
+ orientation: VOrientationType;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
package/dist/word.css CHANGED
@@ -10540,7 +10540,7 @@ svg.portrait-icon[data-v-8bdb451e] {
10540
10540
  height: 36px;
10541
10541
  color: #bebdc7;
10542
10542
  }
10543
- .page-size-custom-setting[data-v-e735bbe5] {
10543
+ .page-size-custom-setting[data-v-0c96db84] {
10544
10544
  margin: 12px 0;
10545
10545
  display: flex;
10546
10546
  align-items: center;
@@ -10559,10 +10559,10 @@ svg.portrait-icon[data-v-8bdb451e] {
10559
10559
  width: 240px;
10560
10560
  color: #666;
10561
10561
  }
10562
- .panel-paper[data-v-09c58e04] {
10562
+ .panel-paper[data-v-243a03df] {
10563
10563
  position: relative;
10564
10564
  }
10565
- .panel-paper .container[data-v-09c58e04] {
10565
+ .panel-paper .container[data-v-243a03df] {
10566
10566
  padding: 16px;
10567
10567
  }
10568
10568
  .qrcode-parse-modal[data-v-7a8c7960] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.63-beta.8",
3
+ "version": "0.1.63-beta.9",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",
@@ -1,2 +0,0 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
- export default _default;