@gct-paas/word 0.1.51-patch.6 → 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 +2046 -7
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -6,6 +6,8 @@ import exifr from "exifr";
6
6
  import { VxeGrid } from "vxe-table";
7
7
  import CryptoJS from "crypto-js";
8
8
  import { jsPDF } from "jspdf";
9
+ import JsBarcode from "jsbarcode";
10
+ import QRCode from "qrcode";
9
11
  import draggable from "vuedraggable";
10
12
  //#region \0rolldown/runtime.js
11
13
  var __create = Object.create;
@@ -32880,7 +32882,8 @@ function toDictValue(field, value, row) {
32880
32882
  function getSelectOptions(payload) {
32881
32883
  const { value, multiple, options = [], key } = payload || {};
32882
32884
  const values = (Array.isArray(value) ? value : multiple ? value?.split(",") ?? [] : [value]).filter((i) => !isNil(i));
32883
- 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);
32884
32887
  const labels = selected.map((item) => item[key]);
32885
32888
  return {
32886
32889
  selectOptions: selected,
@@ -61888,8 +61891,11 @@ async function fetchLabelAndFill(defaults, valuePath, id, fetcher, props, fallba
61888
61891
  defaults ??= {};
61889
61892
  defaults[valuePath] = id;
61890
61893
  try {
61891
- const result = fetcher === "rdo2ref" || fetcher === "lot2sn" ? await apiFetchers[fetcher].getOptionById(id, props) : await apiFetchers[fetcher].getOptionByIds(getValue$1(id, true), props);
61892
- 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);
61893
61899
  if (labels.length) defaults[getLabelPath(valuePath)] = labels.join(",");
61894
61900
  else if (fallback) defaults[getLabelPath(valuePath)] = fallback;
61895
61901
  } catch (error) {
@@ -141045,6 +141051,14 @@ function useWidgetMeta(widget) {
141045
141051
  isDialog: computed(() => DIALOG_TYPES.has(widgetType.value))
141046
141052
  };
141047
141053
  }
141054
+ function usePaperWidgetMeta(widget) {
141055
+ const { meta: pageWidgetMeta, props: pageWidgetProps, widgetType } = useMetaFromWidget(widget, "pageWidgetMeta");
141056
+ return {
141057
+ pageWidgetMeta,
141058
+ pageWidgetProps,
141059
+ widgetType
141060
+ };
141061
+ }
141048
141062
  function useFieldInfo(fieldMeta) {
141049
141063
  const designCtx = useDesignSuiteContext();
141050
141064
  const field = computed(() => fieldMeta());
@@ -141141,6 +141155,17 @@ function useWidgetStaticAttrs(widget) {
141141
141155
  showDisplayStatus: newDisplayStatus
141142
141156
  };
141143
141157
  }
141158
+ function usePaperWidgetStaticAttrs(widget) {
141159
+ const { docInst, isDesignMode } = useDocPubApiContext();
141160
+ const { pageWidgetMeta, pageWidgetProps, widgetType } = usePaperWidgetMeta(widget);
141161
+ return {
141162
+ docInst,
141163
+ isDesignMode,
141164
+ pageWidgetMeta,
141165
+ pageWidgetProps,
141166
+ widgetType
141167
+ };
141168
+ }
141144
141169
  var MULTIPLE_TYPES, ASYNC_TYPES, DROPDOWN_TYPES, DIALOG_TYPES;
141145
141170
  var init_useWidgetRenderData = __esmMin((() => {
141146
141171
  init_core$1();
@@ -145637,6 +145662,22 @@ function computeImageDisplaySize(natural, opts = {}) {
145637
145662
  height: Math.round(nh * scale)
145638
145663
  };
145639
145664
  }
145665
+ /**
145666
+ * 在目标框内等比缩放(contain),不压缩、不拉伸
145667
+ */
145668
+ function computeContainDisplaySize(natural, box) {
145669
+ const nw = natural.width;
145670
+ const nh = natural.height;
145671
+ if (!nw || !nh || !box.width || !box.height) return {
145672
+ width: box.width || nw,
145673
+ height: box.height || nh
145674
+ };
145675
+ const scale = Math.min(box.width / nw, box.height / nh);
145676
+ return {
145677
+ width: Math.round(nw * scale),
145678
+ height: Math.round(nh * scale)
145679
+ };
145680
+ }
145640
145681
  function wrapText(text, maxWidth, context) {
145641
145682
  const characters = text.split("");
145642
145683
  const lines = [];
@@ -145775,6 +145816,13 @@ function createFormSignFallbackImage(name, width, height, time) {
145775
145816
  });
145776
145817
  return canvas.toDataURL("image/png");
145777
145818
  }
145819
+ function loadDataUrlAsImage(dataUrl) {
145820
+ return new Promise((resolve) => {
145821
+ const img = new Image();
145822
+ img.src = dataUrl;
145823
+ img.onload = () => resolve(img);
145824
+ });
145825
+ }
145778
145826
  /**
145779
145827
  * 创建无图签名兜底图(用户名 + 电子签名 + 验证日期)
145780
145828
  * 按字段宽高绘制,显示框设多大,字就按多大排
@@ -145782,6 +145830,9 @@ function createFormSignFallbackImage(name, width, height, time) {
145782
145830
  function createSignatureImageDataUrl(name, width = 180, height = 102, time) {
145783
145831
  return createFormSignFallbackImage(name, Math.max(1, Math.round(width)), Math.max(1, Math.round(height)), time);
145784
145832
  }
145833
+ function createSignatureImage(name, width = 180, height = 102, time) {
145834
+ return loadDataUrlAsImage(createSignatureImageDataUrl(name, width, height, time));
145835
+ }
145785
145836
  var import_dayjs_min$1, SIGN_CANVAS_BASE_WIDTH, FALLBACK_SIGN_DPR, ELECTRONIC_SIGNATURE_LABEL, DATE_LABEL;
145786
145837
  var init_image_size_util = __esmMin((() => {
145787
145838
  import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
@@ -157436,12 +157487,2000 @@ function loadPaperWidgetManifestModules() {
157436
157487
  }
157437
157488
  var paperWidgetManifestMap = loadPaperWidgetManifestModules();
157438
157489
  //#endregion
157490
+ //#region src/suites/shared/components/checkbox-canvas.vue?vue&type=script&setup=true&lang.ts
157491
+ init_core$1();
157492
+ //#endregion
157493
+ //#region src/suites/shared/components/checkbox-canvas.vue
157494
+ var checkbox_canvas_default = /* @__PURE__ */ defineComponent({
157495
+ __name: "checkbox-canvas",
157496
+ props: {
157497
+ id: {},
157498
+ x: {},
157499
+ y: {},
157500
+ value: { type: [
157501
+ String,
157502
+ Number,
157503
+ Boolean
157504
+ ] },
157505
+ modelValue: {},
157506
+ readonly: { type: Boolean },
157507
+ disabled: { type: Boolean },
157508
+ required: { type: Boolean },
157509
+ multiple: { type: Boolean },
157510
+ size: {},
157511
+ iconType: {}
157512
+ },
157513
+ emits: ["update:modelValue", "change"],
157514
+ setup(__props, { emit: __emit }) {
157515
+ const props = __props;
157516
+ const emit = __emit;
157517
+ const hover = ref(false);
157518
+ const boxSize = computed(() => props.size === "small" ? 14 : 18);
157519
+ const hitArea = computed(() => {
157520
+ return {
157521
+ x: -4,
157522
+ y: -4,
157523
+ size: boxSize.value + 8
157524
+ };
157525
+ });
157526
+ const checked = computed(() => {
157527
+ if (props.multiple) return Array.isArray(props.modelValue) && props.modelValue.includes(props.value);
157528
+ return props.modelValue === props.value;
157529
+ });
157530
+ const isReadonly = computed(() => !!props.readonly);
157531
+ const isDisabled = computed(() => !!props.disabled);
157532
+ const isRequired = computed(() => !!props.required);
157533
+ const borderColor = computed(() => {
157534
+ if (isDisabled.value) return "#d9d9d9";
157535
+ if (checked.value) return "#026ac8";
157536
+ if (isRequired.value) return "#ff4d4f";
157537
+ if (hover.value) return "#026ac8";
157538
+ return "rgb(128, 128, 128)";
157539
+ });
157540
+ const backgroundColor = computed(() => {
157541
+ if (isDisabled.value) return "rgba(0, 0, 0, 0.04)";
157542
+ if (checked.value) return "#026ac8";
157543
+ if (isRequired.value) return "rgba(255, 77, 79, 0.05)";
157544
+ return "#fff";
157545
+ });
157546
+ const checkedColor = computed(() => {
157547
+ if (isDisabled.value) return "rgba(0, 0, 0, 0.25)";
157548
+ return "#fff";
157549
+ });
157550
+ const checkPoints = computed(() => {
157551
+ const s = boxSize.value;
157552
+ return [
157553
+ halfPixel(s * .25) - 2,
157554
+ halfPixel(s * .55) - 1,
157555
+ halfPixel(s * .42) - 1,
157556
+ halfPixel(s * .72),
157557
+ halfPixel(s * .75),
157558
+ halfPixel(s * .28) - 1
157559
+ ];
157560
+ });
157561
+ function onClick() {
157562
+ if (isDisabled.value || isReadonly.value) return;
157563
+ const mv = props.modelValue;
157564
+ setTimeout(() => {
157565
+ if (props.multiple) {
157566
+ const list = Array.isArray(mv) ? [...mv] : [];
157567
+ const index = list.indexOf(props.value);
157568
+ if (index > -1) list.splice(index, 1);
157569
+ else list.push(props.value);
157570
+ emit("update:modelValue", list);
157571
+ emit("change", list);
157572
+ return;
157573
+ }
157574
+ if (checked.value) {
157575
+ emit("update:modelValue", void 0);
157576
+ emit("change", void 0);
157577
+ } else {
157578
+ emit("update:modelValue", props.value);
157579
+ emit("change", props.value);
157580
+ }
157581
+ }, 120);
157582
+ }
157583
+ function onEnter() {
157584
+ if (isReadonly.value || isDisabled.value) return;
157585
+ hover.value = true;
157586
+ }
157587
+ function onLeave() {
157588
+ hover.value = false;
157589
+ }
157590
+ return (_ctx, _cache) => {
157591
+ const _component_v_rect = resolveComponent("v-rect");
157592
+ const _component_v_line = resolveComponent("v-line");
157593
+ const _component_v_group = resolveComponent("v-group");
157594
+ return openBlock(), createBlock(_component_v_group, { config: {
157595
+ x: __props.x,
157596
+ y: __props.y,
157597
+ id: __props.id,
157598
+ onPointerenter: onEnter,
157599
+ onPointerleave: onLeave
157600
+ } }, {
157601
+ default: withCtx(() => [
157602
+ createVNode(_component_v_rect, {
157603
+ width: boxSize.value,
157604
+ height: boxSize.value,
157605
+ cornerRadius: 2,
157606
+ stroke: borderColor.value,
157607
+ fill: backgroundColor.value,
157608
+ strokeWidth: 1,
157609
+ listening: false
157610
+ }, null, 8, [
157611
+ "width",
157612
+ "height",
157613
+ "stroke",
157614
+ "fill"
157615
+ ]),
157616
+ checked.value ? (openBlock(), createBlock(_component_v_line, {
157617
+ key: 0,
157618
+ points: checkPoints.value,
157619
+ stroke: checkedColor.value,
157620
+ strokeWidth: 2,
157621
+ lineCap: "round",
157622
+ lineJoin: "round",
157623
+ perfectDrawEnabled: false,
157624
+ listening: false
157625
+ }, null, 8, ["points", "stroke"])) : createCommentVNode("", true),
157626
+ createVNode(_component_v_rect, {
157627
+ x: hitArea.value.x,
157628
+ y: hitArea.value.y,
157629
+ width: hitArea.value.size,
157630
+ height: hitArea.value.size,
157631
+ fill: "transparent",
157632
+ listening: true,
157633
+ onPointerdown: onClick
157634
+ }, null, 8, [
157635
+ "x",
157636
+ "y",
157637
+ "width",
157638
+ "height"
157639
+ ])
157640
+ ]),
157641
+ _: 1
157642
+ }, 8, ["config"]);
157643
+ };
157644
+ }
157645
+ });
157646
+ //#endregion
157647
+ //#region src/suites/shared/components/radio-canvas.vue?vue&type=script&setup=true&lang.ts
157648
+ var radius = 8;
157649
+ //#endregion
157650
+ //#region src/suites/shared/components/radio-canvas.vue
157651
+ var radio_canvas_default = /* @__PURE__ */ defineComponent({
157652
+ __name: "radio-canvas",
157653
+ props: {
157654
+ id: {},
157655
+ x: {},
157656
+ y: {},
157657
+ value: { type: [
157658
+ String,
157659
+ Number,
157660
+ Boolean
157661
+ ] },
157662
+ modelValue: {},
157663
+ readonly: { type: Boolean },
157664
+ disabled: { type: Boolean },
157665
+ required: { type: Boolean },
157666
+ multiple: { type: Boolean },
157667
+ iconType: {}
157668
+ },
157669
+ emits: ["update:modelValue", "change"],
157670
+ setup(__props, { emit: __emit }) {
157671
+ const props = __props;
157672
+ const emit = __emit;
157673
+ const hover = ref(false);
157674
+ const hitArea = computed(() => {
157675
+ return {
157676
+ x: -3,
157677
+ y: -3,
157678
+ size: 23
157679
+ };
157680
+ });
157681
+ const checked = computed(() => {
157682
+ if (props.multiple) return Array.isArray(props.modelValue) && props.modelValue.includes(props.value);
157683
+ return props.modelValue === props.value;
157684
+ });
157685
+ const isReadonly = computed(() => !!props.readonly);
157686
+ const isDisabled = computed(() => !!props.disabled);
157687
+ const isRequired = computed(() => !!props.required);
157688
+ const borderColor = computed(() => {
157689
+ if (isDisabled.value) return "#d9d9d9";
157690
+ if (checked.value) return "#026ac8";
157691
+ if (isRequired.value) return "#ff4d4f";
157692
+ if (hover.value) return "#026ac8";
157693
+ return "rgb(128, 128, 128)";
157694
+ });
157695
+ const backgroundColor = computed(() => {
157696
+ if (isDisabled.value) return "rgba(0, 0, 0, 0.04)";
157697
+ if (checked.value) return "#026ac8";
157698
+ if (isRequired.value) return "rgba(255, 77, 79, 0.05)";
157699
+ return "#fff";
157700
+ });
157701
+ const checkedColor = computed(() => {
157702
+ if (isDisabled.value) return "rgba(0, 0, 0, 0.25)";
157703
+ return "#fff";
157704
+ });
157705
+ const innerRadius = computed(() => radius * .5);
157706
+ function onClick() {
157707
+ if (isDisabled.value || isReadonly.value) return;
157708
+ const mv = props.modelValue;
157709
+ setTimeout(() => {
157710
+ if (props.multiple) {
157711
+ const list = Array.isArray(mv) ? [...mv] : [];
157712
+ const index = list.indexOf(props.value);
157713
+ if (index > -1) list.splice(index, 1);
157714
+ else list.push(props.value);
157715
+ emit("update:modelValue", list);
157716
+ emit("change", list);
157717
+ return;
157718
+ }
157719
+ if (checked.value) {
157720
+ emit("update:modelValue", void 0);
157721
+ emit("change", void 0);
157722
+ } else {
157723
+ emit("update:modelValue", props.value);
157724
+ emit("change", props.value);
157725
+ }
157726
+ }, 120);
157727
+ }
157728
+ function onEnter() {
157729
+ if (isReadonly.value || isDisabled.value) return;
157730
+ hover.value = true;
157731
+ }
157732
+ function onLeave() {
157733
+ hover.value = false;
157734
+ }
157735
+ return (_ctx, _cache) => {
157736
+ const _component_v_circle = resolveComponent("v-circle");
157737
+ const _component_v_rect = resolveComponent("v-rect");
157738
+ const _component_v_group = resolveComponent("v-group");
157739
+ return openBlock(), createBlock(_component_v_group, { config: {
157740
+ x: __props.x,
157741
+ y: __props.y,
157742
+ id: __props.id,
157743
+ onPointerenter: onEnter,
157744
+ onPointerleave: onLeave
157745
+ } }, {
157746
+ default: withCtx(() => [
157747
+ createVNode(_component_v_circle, {
157748
+ x: radius,
157749
+ y: radius,
157750
+ radius,
157751
+ stroke: borderColor.value,
157752
+ strokeWidth: 1,
157753
+ fill: backgroundColor.value,
157754
+ perfectDrawEnabled: false,
157755
+ strokeScaleEnabled: false,
157756
+ hitGraphEnabled: false
157757
+ }, null, 8, ["stroke", "fill"]),
157758
+ checked.value ? (openBlock(), createBlock(_component_v_circle, {
157759
+ key: 0,
157760
+ x: radius,
157761
+ y: radius,
157762
+ radius: innerRadius.value,
157763
+ fill: checkedColor.value,
157764
+ perfectDrawEnabled: false,
157765
+ strokeScaleEnabled: false,
157766
+ hitGraphEnabled: false
157767
+ }, null, 8, ["radius", "fill"])) : createCommentVNode("", true),
157768
+ createVNode(_component_v_rect, {
157769
+ x: hitArea.value.x,
157770
+ y: hitArea.value.y,
157771
+ width: hitArea.value.size,
157772
+ height: hitArea.value.size,
157773
+ fill: "transparent",
157774
+ listening: true,
157775
+ onPointerdown: onClick
157776
+ }, null, 8, [
157777
+ "x",
157778
+ "y",
157779
+ "width",
157780
+ "height"
157781
+ ])
157782
+ ]),
157783
+ _: 1
157784
+ }, 8, ["config"]);
157785
+ };
157786
+ }
157787
+ });
157788
+ //#endregion
157789
+ //#region src/suites/shared/components/icon-canvas.vue?vue&type=script&setup=true&lang.ts
157790
+ init_attachment();
157791
+ init_doc();
157792
+ init_img();
157793
+ init_mp4();
157794
+ init_pdf();
157795
+ init_ppt();
157796
+ init_xlsx();
157797
+ //#endregion
157798
+ //#region src/suites/shared/components/icon-canvas.vue
157799
+ var icon_canvas_default = /* @__PURE__ */ defineComponent({
157800
+ __name: "icon-canvas",
157801
+ props: {
157802
+ id: {},
157803
+ x: {},
157804
+ y: {},
157805
+ value: { type: [
157806
+ String,
157807
+ Number,
157808
+ Boolean
157809
+ ] },
157810
+ modelValue: {},
157811
+ readonly: { type: Boolean },
157812
+ disabled: { type: Boolean },
157813
+ required: { type: Boolean },
157814
+ multiple: { type: Boolean },
157815
+ size: {},
157816
+ iconType: {}
157817
+ },
157818
+ setup(__props) {
157819
+ const svg = {
157820
+ img: img_default,
157821
+ doc: doc_default,
157822
+ mp4: mp4_default,
157823
+ pdf: pdf_default,
157824
+ xlsx: xlsx_default,
157825
+ ppt: ppt_default,
157826
+ attachment: attachment_default
157827
+ };
157828
+ const props = __props;
157829
+ const imageObj = ref();
157830
+ onMounted(() => {
157831
+ const img = new Image();
157832
+ img.src = svg[props.iconType || "attachment"];
157833
+ img.onload = () => {
157834
+ imageObj.value = img;
157835
+ };
157836
+ });
157837
+ return (_ctx, _cache) => {
157838
+ const _component_v_image = resolveComponent("v-image");
157839
+ return imageObj.value ? (openBlock(), createBlock(_component_v_image, {
157840
+ key: 0,
157841
+ config: {
157842
+ x: __props.x,
157843
+ y: __props.y - 6,
157844
+ image: imageObj.value,
157845
+ width: 24,
157846
+ height: 24
157847
+ }
157848
+ }, null, 8, ["config"])) : createCommentVNode("", true);
157849
+ };
157850
+ }
157851
+ });
157852
+ //#endregion
157853
+ //#region src/suites/edhr/component/gct-control-render.vue?vue&type=script&setup=true&name=gct-control-render&lang.ts
157854
+ init_core$1();
157855
+ init_file();
157856
+ init_enum();
157857
+ init_useWidgetRenderData();
157858
+ init_form();
157859
+ init_core();
157860
+ init_field_type();
157861
+ var gct_control_render_vue_vue_type_script_setup_true_name_gct_control_render_lang_default = /*@__PURE__*/ defineComponent({
157862
+ __name: "gct-control-render",
157863
+ props: {
157864
+ modelId: {},
157865
+ widget: {}
157866
+ },
157867
+ setup(__props) {
157868
+ const props = __props;
157869
+ /**
157870
+ * 组件映射表
157871
+ */
157872
+ const RenderCompMap = {
157873
+ [RenderCompTypeConst.Checkbox]: checkbox_canvas_default,
157874
+ [RenderCompTypeConst.Radio]: radio_canvas_default,
157875
+ icon: icon_canvas_default
157876
+ };
157877
+ const { docInst, isMultiple, runtimeValuePath, showRequired, showDisabled, showReadonly, widgetProps, widgetType, fieldMeta } = useWidgetStaticAttrs(props.widget);
157878
+ const CurrentComp = computed(() => {
157879
+ if (widgetType.value === "fw:file") return RenderCompMap["icon"] ?? null;
157880
+ const type = widgetProps.value.renderComp;
157881
+ return RenderCompMap[type] ?? null;
157882
+ });
157883
+ const iconType = computed(() => {
157884
+ if (widgetType.value === "fw:file") return getUploadFileIcon(props.widget?.widgetFileItem?.value);
157885
+ });
157886
+ const options = computed(() => safeParseJson(widgetProps.value.optionsJson));
157887
+ /**
157888
+ * 当前选项值
157889
+ */
157890
+ const optionValue = computed(() => props.widget?.widgetOption?.value);
157891
+ const modelValue = computed({
157892
+ get() {
157893
+ let value;
157894
+ if (docInst.value.isInEditMode()) value = docInst.value?.dataManager?.getDefault(runtimeValuePath.value);
157895
+ else value = docInst.value?.dataManager?.get(runtimeValuePath.value);
157896
+ if (fieldMeta.value?.fieldType === FIELD_TYPE.BOOLEAN) value = toBoolean(value);
157897
+ return getValue$1(value, isMultiple.value);
157898
+ },
157899
+ set(v) {
157900
+ const data = setValue(v, runtimeValuePath.value, {
157901
+ multiple: isMultiple.value,
157902
+ options: options.value,
157903
+ labelKey: "label",
157904
+ needLabel: true
157905
+ });
157906
+ docInst.value?.dataManager.setMultiple(data);
157907
+ }
157908
+ });
157909
+ return (_ctx, _cache) => {
157910
+ return CurrentComp.value ? (openBlock(), createBlock(resolveDynamicComponent(CurrentComp.value), {
157911
+ key: 0,
157912
+ id: __props.widget.id,
157913
+ x: 0,
157914
+ y: 0,
157915
+ readonly: unref(showReadonly),
157916
+ disabled: unref(showDisabled),
157917
+ required: unref(showRequired),
157918
+ multiple: unref(isMultiple),
157919
+ iconType: iconType.value,
157920
+ value: optionValue.value,
157921
+ "model-value": modelValue.value,
157922
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
157923
+ }, null, 8, [
157924
+ "id",
157925
+ "readonly",
157926
+ "disabled",
157927
+ "required",
157928
+ "multiple",
157929
+ "iconType",
157930
+ "value",
157931
+ "model-value"
157932
+ ])) : createCommentVNode("", true);
157933
+ };
157934
+ }
157935
+ });
157936
+ //#endregion
157937
+ //#region src/suites/edhr/component/gct-control-render.vue
157938
+ var gct_control_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_control_render_default });
157939
+ var gct_control_render_default = gct_control_render_vue_vue_type_script_setup_true_name_gct_control_render_lang_default;
157940
+ //#endregion
157941
+ //#region src/suites/edhr/component/gct-image-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
157942
+ init_asset_helper_util();
157943
+ init_image_size_util();
157944
+ init_canvas$1();
157945
+ init_core$1();
157946
+ init__register_();
157947
+ init_useWidgetRenderData();
157948
+ var gct_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
157949
+ __name: "gct-image-render",
157950
+ props: {
157951
+ widget: {},
157952
+ modelId: {}
157953
+ },
157954
+ setup(__props) {
157955
+ const interCtx = useInteractionContext();
157956
+ const props = __props;
157957
+ const imgRef = ref(null);
157958
+ const { runtimeValuePath } = useWidgetStaticAttrs(props.widget);
157959
+ const natural = ref({
157960
+ width: 0,
157961
+ height: 0
157962
+ });
157963
+ const display = ref({
157964
+ width: props.widget.width ?? 100,
157965
+ height: props.widget.height ?? 100
157966
+ });
157967
+ const placeholder = {
157968
+ width: props.widget.width ?? 120,
157969
+ height: props.widget.height ?? 80,
157970
+ fill: "#f3f3f3"
157971
+ };
157972
+ watch(() => props.widget.src, async (v) => {
157973
+ const img = await AssetHelper.loadImage(v);
157974
+ if (!img) return;
157975
+ natural.value = {
157976
+ width: img.naturalWidth,
157977
+ height: img.naturalHeight
157978
+ };
157979
+ const size = computeImageDisplaySize(natural.value, {
157980
+ width: props.widget.width,
157981
+ height: props.widget.height,
157982
+ keepAspect: props.widget.keepAspect ?? true,
157983
+ maxDefaultWidth: 200
157984
+ });
157985
+ display.value = size;
157986
+ imgRef.value = img;
157987
+ }, { immediate: true });
157988
+ const imageConfig = computed(() => {
157989
+ const w = display.value.width;
157990
+ const h = display.value.height;
157991
+ return {
157992
+ x: 0,
157993
+ y: 0,
157994
+ image: imgRef.value,
157995
+ width: w,
157996
+ height: h
157997
+ };
157998
+ });
157999
+ const baseLineConfig = {
158000
+ stroke: "#ff4d4f",
158001
+ strokeWidth: 1,
158002
+ ...baseCanvasAttrs
158003
+ };
158004
+ const useLineConfig = (offsetY = 0) => computed(() => ({
158005
+ points: [
158006
+ 0,
158007
+ halfPixel(display.value.height + offsetY),
158008
+ halfPixel(props.widget.width),
158009
+ halfPixel(display.value.height + offsetY)
158010
+ ],
158011
+ ...baseLineConfig
158012
+ }));
158013
+ const lineOneConfig = useLineConfig(0);
158014
+ const lineTwoConfig = useLineConfig(2);
158015
+ const isShowMark = computed(() => {
158016
+ return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
158017
+ });
158018
+ return (_ctx, _cache) => {
158019
+ const _component_v_line = resolveComponent("v-line");
158020
+ const _component_v_image = resolveComponent("v-image");
158021
+ const _component_v_rect = resolveComponent("v-rect");
158022
+ const _component_v_group = resolveComponent("v-group");
158023
+ return openBlock(), createBlock(_component_v_group, null, {
158024
+ default: withCtx(() => [
158025
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158026
+ key: 0,
158027
+ config: unref(lineOneConfig)
158028
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158029
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158030
+ key: 1,
158031
+ config: unref(lineTwoConfig)
158032
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158033
+ imgRef.value ? (openBlock(), createBlock(_component_v_image, {
158034
+ key: 2,
158035
+ config: imageConfig.value
158036
+ }, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
158037
+ key: 3,
158038
+ width: placeholder.width,
158039
+ height: placeholder.height,
158040
+ fill: placeholder.fill
158041
+ }, null, 8, [
158042
+ "width",
158043
+ "height",
158044
+ "fill"
158045
+ ]))
158046
+ ]),
158047
+ _: 1
158048
+ });
158049
+ };
158050
+ }
158051
+ });
158052
+ //#endregion
158053
+ //#region src/suites/edhr/component/gct-image-render.vue
158054
+ var gct_image_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_image_render_default });
158055
+ var gct_image_render_default = gct_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
158056
+ //#endregion
158057
+ //#region src/suites/edhr/component/gct-leftMarker-render.vue?vue&type=script&setup=true&name=gct-leftMarker-render&lang.ts
158058
+ var gct_leftMarker_render_vue_vue_type_script_setup_true_name_gct_leftMarker_render_lang_default = /*@__PURE__*/ defineComponent({
158059
+ __name: "gct-leftMarker-render",
158060
+ props: {
158061
+ widget: {},
158062
+ modelId: {}
158063
+ },
158064
+ setup(__props) {
158065
+ const props = __props;
158066
+ const textConfig = computed(() => ({
158067
+ x: 0,
158068
+ y: 0,
158069
+ width: props.widget.width,
158070
+ text: props.widget.text,
158071
+ fontSize: props.widget.fontSize,
158072
+ fontFamily: props.widget.fontFamily,
158073
+ fill: "#000",
158074
+ wrap: "none"
158075
+ }));
158076
+ return (_ctx, _cache) => {
158077
+ const _component_v_text = resolveComponent("v-text");
158078
+ const _component_v_group = resolveComponent("v-group");
158079
+ return openBlock(), createBlock(_component_v_group, null, {
158080
+ default: withCtx(() => [createVNode(_component_v_text, {
158081
+ ref: "textRef",
158082
+ id: __props.widget.id,
158083
+ config: textConfig.value
158084
+ }, null, 8, ["id", "config"])]),
158085
+ _: 1
158086
+ });
158087
+ };
158088
+ }
158089
+ });
158090
+ //#endregion
158091
+ //#region src/suites/edhr/component/gct-leftMarker-render.vue
158092
+ var gct_leftMarker_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_leftMarker_render_default });
158093
+ var gct_leftMarker_render_default = gct_leftMarker_render_vue_vue_type_script_setup_true_name_gct_leftMarker_render_lang_default;
158094
+ //#endregion
158095
+ //#region src/suites/edhr/component/gct-placeholder-render.vue?vue&type=script&setup=true&name=gct-placeholder-render&lang.ts
158096
+ init__register_();
158097
+ init_useWidgetRenderData();
158098
+ var gct_placeholder_render_vue_vue_type_script_setup_true_name_gct_placeholder_render_lang_default = /*@__PURE__*/ defineComponent({
158099
+ __name: "gct-placeholder-render",
158100
+ props: {
158101
+ widget: {},
158102
+ modelId: {}
158103
+ },
158104
+ setup(__props) {
158105
+ const props = __props;
158106
+ const interCtx = useInteractionContext();
158107
+ const { showDisabled, showRequired, showReadonly } = useWidgetStaticAttrs(props.widget);
158108
+ const isActive = computed(() => props.modelId === interCtx.panelData?.modelId || props.modelId === interCtx.hoverModelId);
158109
+ /**
158110
+ * 统一颜色逻辑
158111
+ */
158112
+ const colors = computed(() => {
158113
+ if (showDisabled.value) return {
158114
+ text: "#c9c9c9",
158115
+ line: "#c9c9c9",
158116
+ bg: isActive.value ? "#f0f0f0" : "#f5f5f5"
158117
+ };
158118
+ if (showReadonly.value) return {
158119
+ text: "#666666",
158120
+ line: "#d9d9d9",
158121
+ bg: isActive.value ? "#f5f7fa" : "#fafafa"
158122
+ };
158123
+ if (showRequired.value) return {
158124
+ text: "#f26c6c",
158125
+ line: "#f26c6c",
158126
+ bg: isActive.value ? "rgba(255, 230, 230, 1)" : "rgba(255, 242, 242, 1)"
158127
+ };
158128
+ return {
158129
+ text: "#999999",
158130
+ line: "#999999",
158131
+ bg: isActive.value ? "rgba(147, 197, 253, 0.4)" : "#F2F8FE"
158132
+ };
158133
+ });
158134
+ const textConfig = computed(() => ({
158135
+ x: 0,
158136
+ y: 0,
158137
+ text: props.widget.text,
158138
+ fontSize: props.widget.fontSize,
158139
+ fontFamily: props.widget.fontFamily,
158140
+ fill: colors.value.text,
158141
+ wrap: "none"
158142
+ }));
158143
+ computed(() => ({
158144
+ points: [
158145
+ 0,
158146
+ props.widget.fontSize + 4,
158147
+ props.widget.width,
158148
+ props.widget.fontSize + 4
158149
+ ],
158150
+ stroke: colors.value.line,
158151
+ strokeWidth: 1
158152
+ }));
158153
+ const bgConfig = computed(() => ({
158154
+ x: 0,
158155
+ y: -3,
158156
+ width: props.widget.width,
158157
+ height: props.widget.height + 6,
158158
+ fill: colors.value.bg
158159
+ }));
158160
+ return (_ctx, _cache) => {
158161
+ const _component_v_rect = resolveComponent("v-rect");
158162
+ const _component_v_text = resolveComponent("v-text");
158163
+ const _component_v_group = resolveComponent("v-group");
158164
+ return openBlock(), createBlock(_component_v_group, null, {
158165
+ default: withCtx(() => [createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"]), createVNode(_component_v_text, {
158166
+ ref: "textRef",
158167
+ id: __props.widget.id,
158168
+ config: textConfig.value
158169
+ }, null, 8, ["id", "config"])]),
158170
+ _: 1
158171
+ });
158172
+ };
158173
+ }
158174
+ });
158175
+ //#endregion
158176
+ //#region src/suites/edhr/component/gct-placeholder-render.vue
158177
+ var gct_placeholder_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_placeholder_render_default });
158178
+ var gct_placeholder_render_default = gct_placeholder_render_vue_vue_type_script_setup_true_name_gct_placeholder_render_lang_default;
158179
+ //#endregion
158180
+ //#region src/suites/edhr/component/gct-rightMarker-render.vue?vue&type=script&setup=true&name=gct-rightMarker-render&lang.ts
158181
+ var gct_rightMarker_render_vue_vue_type_script_setup_true_name_gct_rightMarker_render_lang_default = /*@__PURE__*/ defineComponent({
158182
+ __name: "gct-rightMarker-render",
158183
+ props: {
158184
+ widget: {},
158185
+ modelId: {}
158186
+ },
158187
+ setup(__props) {
158188
+ const props = __props;
158189
+ const textConfig = computed(() => ({
158190
+ x: 0,
158191
+ y: 0,
158192
+ width: props.widget.width,
158193
+ text: props.widget.text,
158194
+ fontSize: props.widget.fontSize,
158195
+ fontFamily: props.widget.fontFamily,
158196
+ fill: "#000",
158197
+ wrap: "none",
158198
+ align: "right"
158199
+ }));
158200
+ return (_ctx, _cache) => {
158201
+ const _component_v_text = resolveComponent("v-text");
158202
+ const _component_v_group = resolveComponent("v-group");
158203
+ return openBlock(), createBlock(_component_v_group, null, {
158204
+ default: withCtx(() => [createVNode(_component_v_text, {
158205
+ ref: "textRef",
158206
+ id: __props.widget.id,
158207
+ config: textConfig.value
158208
+ }, null, 8, ["id", "config"])]),
158209
+ _: 1
158210
+ });
158211
+ };
158212
+ }
158213
+ });
158214
+ //#endregion
158215
+ //#region src/suites/edhr/component/gct-rightMarker-render.vue
158216
+ var gct_rightMarker_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_rightMarker_render_default });
158217
+ var gct_rightMarker_render_default = gct_rightMarker_render_vue_vue_type_script_setup_true_name_gct_rightMarker_render_lang_default;
158218
+ //#endregion
158219
+ //#region src/suites/edhr/component/gct-signature-render.vue?vue&type=script&setup=true&name=gct-signature-render&lang.ts
158220
+ init_asset_helper_util();
158221
+ init_image_size_util();
158222
+ init_canvas$1();
158223
+ init_core$1();
158224
+ init__register_();
158225
+ init_useWidgetRenderData();
158226
+ var gct_signature_render_vue_vue_type_script_setup_true_name_gct_signature_render_lang_default = /*@__PURE__*/ defineComponent({
158227
+ __name: "gct-signature-render",
158228
+ props: {
158229
+ widget: {},
158230
+ modelId: {}
158231
+ },
158232
+ setup(__props) {
158233
+ const interCtx = useInteractionContext();
158234
+ const props = __props;
158235
+ const imgRef = ref(null);
158236
+ const { runtimeValuePath } = useWidgetStaticAttrs(props.widget);
158237
+ const imageWidth = computed(() => props.widget._width);
158238
+ const imageHeight = computed(() => props.widget._height);
158239
+ const natural = ref({
158240
+ width: 0,
158241
+ height: 0
158242
+ });
158243
+ const display = ref({
158244
+ width: imageWidth.value,
158245
+ height: imageHeight.value
158246
+ });
158247
+ const placeholder = computed(() => ({
158248
+ width: imageWidth.value ?? 180,
158249
+ height: imageHeight.value ?? 102,
158250
+ fill: "#f3f3f3"
158251
+ }));
158252
+ async function loadImage() {
158253
+ const { src, signature, signTime } = props.widget;
158254
+ if (signature) return await createSignatureImage(signature, imageWidth.value, imageHeight.value, signTime);
158255
+ if (src) return await AssetHelper.loadImage(src);
158256
+ return null;
158257
+ }
158258
+ watch(() => [
158259
+ props.widget.src,
158260
+ props.widget.signature,
158261
+ props.widget.signTime,
158262
+ imageWidth.value,
158263
+ imageHeight.value
158264
+ ], async () => {
158265
+ const img = await loadImage();
158266
+ if (!img) return;
158267
+ natural.value = {
158268
+ width: img.naturalWidth,
158269
+ height: img.naturalHeight
158270
+ };
158271
+ display.value = computeContainDisplaySize(natural.value, {
158272
+ width: imageWidth.value,
158273
+ height: imageHeight.value
158274
+ });
158275
+ imgRef.value = img;
158276
+ }, { immediate: true });
158277
+ const imageConfig = computed(() => ({
158278
+ x: (imageWidth.value - display.value.width) / 2,
158279
+ y: (imageHeight.value - display.value.height) / 2,
158280
+ image: imgRef.value,
158281
+ width: display.value.width,
158282
+ height: display.value.height
158283
+ }));
158284
+ const dateTimeConfigs = computed(() => {
158285
+ const list = props.widget.decorations;
158286
+ if (!list?.length) return [];
158287
+ return list.map((item) => ({
158288
+ x: item.x,
158289
+ y: item.y,
158290
+ text: item.text,
158291
+ fontSize: item.fontSize || 14,
158292
+ fill: "#000",
158293
+ width: item.width,
158294
+ height: item.height
158295
+ }));
158296
+ });
158297
+ const baseLineConfig = {
158298
+ stroke: "#ff4d4f",
158299
+ strokeWidth: 1,
158300
+ ...baseCanvasAttrs
158301
+ };
158302
+ const useLineConfig = (offsetY = 0) => computed(() => ({
158303
+ points: [
158304
+ 0,
158305
+ halfPixel(display.value.height + offsetY),
158306
+ halfPixel(props.widget.width),
158307
+ halfPixel(display.value.height + offsetY)
158308
+ ],
158309
+ ...baseLineConfig
158310
+ }));
158311
+ const lineOneConfig = useLineConfig(0);
158312
+ const lineTwoConfig = useLineConfig(2);
158313
+ const isShowMark = computed(() => {
158314
+ return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
158315
+ });
158316
+ return (_ctx, _cache) => {
158317
+ const _component_v_line = resolveComponent("v-line");
158318
+ const _component_v_image = resolveComponent("v-image");
158319
+ const _component_v_rect = resolveComponent("v-rect");
158320
+ const _component_v_text = resolveComponent("v-text");
158321
+ const _component_v_group = resolveComponent("v-group");
158322
+ return openBlock(), createBlock(_component_v_group, null, {
158323
+ default: withCtx(() => [
158324
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158325
+ key: 0,
158326
+ config: unref(lineOneConfig)
158327
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158328
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158329
+ key: 1,
158330
+ config: unref(lineTwoConfig)
158331
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158332
+ imgRef.value ? (openBlock(), createBlock(_component_v_image, {
158333
+ key: 2,
158334
+ config: imageConfig.value
158335
+ }, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
158336
+ key: 3,
158337
+ width: placeholder.value.width,
158338
+ height: placeholder.value.height,
158339
+ fill: placeholder.value.fill
158340
+ }, null, 8, [
158341
+ "width",
158342
+ "height",
158343
+ "fill"
158344
+ ])),
158345
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dateTimeConfigs.value, (cfg, i) => {
158346
+ return openBlock(), createBlock(_component_v_text, {
158347
+ key: i,
158348
+ config: cfg
158349
+ }, null, 8, ["config"]);
158350
+ }), 128))
158351
+ ]),
158352
+ _: 1
158353
+ });
158354
+ };
158355
+ }
158356
+ });
158357
+ //#endregion
158358
+ //#region src/suites/edhr/component/gct-signature-render.vue
158359
+ var gct_signature_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_signature_render_default });
158360
+ var gct_signature_render_default = gct_signature_render_vue_vue_type_script_setup_true_name_gct_signature_render_lang_default;
158361
+ //#endregion
158362
+ //#region src/suites/edhr/component/gct-space-render.vue?vue&type=script&setup=true&name=gct-space-render&lang.ts
158363
+ var gct_space_render_vue_vue_type_script_setup_true_name_gct_space_render_lang_default = /*@__PURE__*/ defineComponent({
158364
+ __name: "gct-space-render",
158365
+ props: { widget: {} },
158366
+ setup(__props) {
158367
+ const props = __props;
158368
+ const textConfig = computed(() => {
158369
+ return {
158370
+ x: 0,
158371
+ y: 0,
158372
+ text: props.widget.text || "",
158373
+ fontSize: props.widget.fontSize,
158374
+ fontFamily: props.widget.fontFamily,
158375
+ fill: props.widget.color,
158376
+ width: props.widget.width,
158377
+ height: props.widget.height,
158378
+ wrap: "none"
158379
+ };
158380
+ });
158381
+ return (_ctx, _cache) => {
158382
+ const _component_v_text = resolveComponent("v-text");
158383
+ return openBlock(), createBlock(_component_v_text, {
158384
+ id: __props.widget.id,
158385
+ config: textConfig.value
158386
+ }, null, 8, ["id", "config"]);
158387
+ };
158388
+ }
158389
+ });
158390
+ //#endregion
158391
+ //#region src/suites/edhr/component/gct-space-render.vue
158392
+ var gct_space_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_space_render_default });
158393
+ var gct_space_render_default = gct_space_render_vue_vue_type_script_setup_true_name_gct_space_render_lang_default;
158394
+ //#endregion
158395
+ //#region src/suites/edhr/component/gct-text-render.vue?vue&type=script&setup=true&name=gct-text-render&lang.ts
158396
+ init__register_();
158397
+ init_canvas$1();
158398
+ init_useWidgetRenderData();
158399
+ init_core$1();
158400
+ var gct_text_render_vue_vue_type_script_setup_true_name_gct_text_render_lang_default = /*@__PURE__*/ defineComponent({
158401
+ __name: "gct-text-render",
158402
+ props: {
158403
+ widget: {},
158404
+ modelId: {}
158405
+ },
158406
+ setup(__props) {
158407
+ const props = __props;
158408
+ const interCtx = useInteractionContext();
158409
+ const { docInst, showDisabled, showReadonly, runtimeValuePath } = useWidgetStaticAttrs(props.widget);
158410
+ const isActive = computed(() => props.modelId === interCtx.panelData?.modelId || props.modelId === interCtx.hoverModelId);
158411
+ const isShowMark = computed(() => {
158412
+ return interCtx.annotationIds && interCtx.annotationIds.length !== 0 && interCtx.annotationIds.includes(runtimeValuePath.value);
158413
+ });
158414
+ /**
158415
+ * 统一颜色逻辑
158416
+ */
158417
+ const colors = computed(() => {
158418
+ const textColor = props.widget.color;
158419
+ if (isShowMark.value) return {
158420
+ text: "#ff4d4f",
158421
+ line: "#ff4d4f",
158422
+ bg: "#fff2f2"
158423
+ };
158424
+ if (docInst.value.isInPrintMode() || showReadonly.value) return {
158425
+ text: textColor,
158426
+ line: "#999999",
158427
+ bg: "transparent"
158428
+ };
158429
+ if (showDisabled.value) return {
158430
+ text: "#c9c9c9",
158431
+ line: "#c9c9c9",
158432
+ bg: isActive.value ? "#f0f0f0" : "#f5f5f5"
158433
+ };
158434
+ return {
158435
+ text: textColor,
158436
+ line: "#999999",
158437
+ bg: isActive.value ? "rgba(147, 197, 253, 0.4)" : "#F2F8FE"
158438
+ };
158439
+ });
158440
+ const textConfig = computed(() => ({
158441
+ x: 0,
158442
+ y: 0,
158443
+ text: props.widget.text,
158444
+ fontSize: props.widget.fontSize,
158445
+ fontFamily: props.widget.fontFamily,
158446
+ fill: colors.value.text,
158447
+ textDecoration: props.widget.underline ? "underline" : void 0,
158448
+ wrap: "none"
158449
+ }));
158450
+ const baseLineConfig = {
158451
+ strokeWidth: 1,
158452
+ ...baseCanvasAttrs
158453
+ };
158454
+ const useLineConfig = (offsetY = 0) => computed(() => ({
158455
+ points: [
158456
+ 0,
158457
+ halfPixel(props.widget.fontSize + offsetY),
158458
+ halfPixel(props.widget.width),
158459
+ halfPixel(props.widget.fontSize + offsetY)
158460
+ ],
158461
+ stroke: colors.value.line,
158462
+ ...baseLineConfig
158463
+ }));
158464
+ const lineOneConfig = useLineConfig(0);
158465
+ const lineTwoConfig = useLineConfig(2);
158466
+ const bgConfig = computed(() => ({
158467
+ x: 0,
158468
+ y: -3,
158469
+ width: props.widget.width,
158470
+ height: props.widget.height + 6,
158471
+ fill: colors.value.bg
158472
+ }));
158473
+ return (_ctx, _cache) => {
158474
+ const _component_v_rect = resolveComponent("v-rect");
158475
+ const _component_v_line = resolveComponent("v-line");
158476
+ const _component_v_text = resolveComponent("v-text");
158477
+ const _component_v_group = resolveComponent("v-group");
158478
+ return openBlock(), createBlock(_component_v_group, null, {
158479
+ default: withCtx(() => [
158480
+ createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"]),
158481
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158482
+ key: 0,
158483
+ config: unref(lineOneConfig)
158484
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158485
+ isShowMark.value ? (openBlock(), createBlock(_component_v_line, {
158486
+ key: 1,
158487
+ config: unref(lineTwoConfig)
158488
+ }, null, 8, ["config"])) : createCommentVNode("", true),
158489
+ createVNode(_component_v_text, {
158490
+ ref: "textRef",
158491
+ id: __props.widget.id,
158492
+ config: textConfig.value
158493
+ }, null, 8, ["id", "config"])
158494
+ ]),
158495
+ _: 1
158496
+ });
158497
+ };
158498
+ }
158499
+ });
158500
+ //#endregion
158501
+ //#region src/suites/edhr/component/gct-text-render.vue
158502
+ var gct_text_render_exports = /* @__PURE__ */ __exportAll({ default: () => gct_text_render_default });
158503
+ var gct_text_render_default = gct_text_render_vue_vue_type_script_setup_true_name_gct_text_render_lang_default;
158504
+ //#endregion
158505
+ //#region src/suites/edhr/component/pw-barcode-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
158506
+ init_core();
158507
+ init_enum();
158508
+ init_core$1();
158509
+ init_useWidgetRenderData();
158510
+ var UNIT_WIDTH = 1;
158511
+ var pw_barcode_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
158512
+ __name: "pw-barcode-render",
158513
+ props: {
158514
+ widget: {},
158515
+ modelId: {}
158516
+ },
158517
+ setup(__props) {
158518
+ const props = __props;
158519
+ const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
158520
+ const readonlyValue = ref();
158521
+ const valueType = computed(() => pageWidgetProps.value.valueType);
158522
+ const alignType = computed(() => pageWidgetProps.value.justifyContent);
158523
+ /** 值处理 */
158524
+ const modelValue = computed(() => {
158525
+ let text = pageWidgetProps.value.value;
158526
+ if (valueType.value === ValueTypeConst.Field) {
158527
+ const path = text?.exp?.fieldData?.valuePath;
158528
+ if (path) {
158529
+ const runtimePath = replacePathIndexPlaceholders({
158530
+ y: props.widget?.dataSlotIndex?.yDataIndex,
158531
+ x: props.widget?.dataSlotIndex?.xDataIndex,
158532
+ n: props.widget?.dataSlotIndex?.dataIndex,
158533
+ templatePath: path
158534
+ });
158535
+ text = docInst.value?.dataManager?.get(runtimePath);
158536
+ }
158537
+ }
158538
+ return Array.isArray(text) ? text.join() : text;
158539
+ });
158540
+ watch(() => modelValue.value, async () => {
158541
+ if (isDesignMode.value) {
158542
+ readonlyValue.value = "GCT";
158543
+ return;
158544
+ }
158545
+ if (valueType.value === ValueTypeConst.Formula) {
158546
+ const subFieldKey = modelValue.value?.subFieldKey;
158547
+ const rawData = docInst.value.dataManager.getRawData();
158548
+ const path = subFieldKey ? `${subFieldKey}[${props.widget?.dataSlotIndex?.dataIndex}]` : "";
158549
+ const subRowData = path ? docInst.value.dataManager.get(path) : {};
158550
+ const result = await formulaUtils.calculateFormula(modelValue.value?.exp, rawData, subRowData);
158551
+ readonlyValue.value = result;
158552
+ } else readonlyValue.value = modelValue.value;
158553
+ }, { immediate: true });
158554
+ /** 布局 */
158555
+ const layout = computed(() => {
158556
+ const h = props.widget.height;
158557
+ return {
158558
+ paddingX: 12,
158559
+ paddingY: 4,
158560
+ barcodeHeight: showText.value ? h * .7 : h,
158561
+ textHeight: showText.value ? h * .3 : 0
158562
+ };
158563
+ });
158564
+ const rawBars = computed(() => {
158565
+ if (!readonlyValue.value) return [];
158566
+ return getBarsFromSVG(readonlyValue.value, pageWidgetProps.value.codeType);
158567
+ });
158568
+ /** 渲染条码 */
158569
+ const bars = computed(() => {
158570
+ if (!rawBars.value.length) return getBrokenBarsStable("barcode-placeholder").map((b) => ({
158571
+ ...b,
158572
+ fill: "#bbb"
158573
+ }));
158574
+ return rawBars.value.map((bar) => ({
158575
+ x: layout.value.paddingX + bar.x * UNIT_WIDTH,
158576
+ width: bar.width * UNIT_WIDTH,
158577
+ fill: "#000"
158578
+ }));
158579
+ });
158580
+ /** 宽度自适应 */
158581
+ const renderWidth = computed(() => {
158582
+ if (!rawBars.value.length) return props.widget.width;
158583
+ return Math.max(...rawBars.value.map((b) => b.x + b.width)) * UNIT_WIDTH + layout.value.paddingX * 2;
158584
+ });
158585
+ /** 闪电遮罩 */
158586
+ const lightningPath = computed(() => {
158587
+ const w = renderWidth.value;
158588
+ const mid = layout.value.barcodeHeight / 2;
158589
+ return `
158590
+ M 0 ${mid - 6}
158591
+ L ${w * .25} ${mid - 2}
158592
+ L ${w * .4} ${mid + 2}
158593
+ L ${w * .6} ${mid - 4}
158594
+ L ${w * .8} ${mid + 3}
158595
+ L ${w} ${mid - 1}
158596
+ L ${w} ${mid + 6}
158597
+ L ${w * .8} ${mid + 10}
158598
+ L ${w * .6} ${mid + 4}
158599
+ L ${w * .4} ${mid + 12}
158600
+ L ${w * .25} ${mid + 6}
158601
+ L 0 ${mid + 10}
158602
+ Z
158603
+ `;
158604
+ });
158605
+ /** 是否显示文本 */
158606
+ const showText = computed(() => {
158607
+ return !isEmptyValue$1(readonlyValue.value) && pageWidgetProps.value.showValue;
158608
+ });
158609
+ /** 文本内容 */
158610
+ const textValue = computed(() => {
158611
+ if (isDesignMode.value) {
158612
+ if (valueType.value === ValueTypeConst.Field) return "请配置字段";
158613
+ if (valueType.value === ValueTypeConst.Formula) return "请配置公式";
158614
+ return "请输入文本";
158615
+ }
158616
+ return readonlyValue.value;
158617
+ });
158618
+ const fontSize = computed(() => {
158619
+ if (!textValue.value) return 12;
158620
+ return Math.max(8, Math.min(14, renderWidth.value / textValue.value.length * 1));
158621
+ });
158622
+ const textColor = computed(() => isDesignMode.value ? "#999" : "#333");
158623
+ const bgConfig = computed(() => ({
158624
+ x: 0,
158625
+ y: 0,
158626
+ width: props.widget.width,
158627
+ height: props.widget.height,
158628
+ fill: "transparent"
158629
+ }));
158630
+ watch(() => renderWidth.value, (value) => {
158631
+ if (!isDesignMode.value) {
158632
+ props.widget.pageWidgetMeta.props.newSpecificConfig ??= {};
158633
+ props.widget.pageWidgetMeta.props.newSpecificConfig[`${props.widget.modelRef.id}@${props.widget?.dataSlotIndex?.dataIndex}`] = {
158634
+ relWidth: value,
158635
+ relValue: readonlyValue.value
158636
+ };
158637
+ }
158638
+ }, { immediate: true });
158639
+ function getBarsFromSVG(value, format) {
158640
+ if (!value) return [];
158641
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
158642
+ try {
158643
+ JsBarcode(svg, value, {
158644
+ format,
158645
+ displayValue: false,
158646
+ margin: 0,
158647
+ background: "transparent"
158648
+ });
158649
+ } catch (e) {
158650
+ console.error(e);
158651
+ return [];
158652
+ }
158653
+ const group = svg.querySelector("g");
158654
+ if (!group) return [];
158655
+ const rects = group.querySelectorAll("rect");
158656
+ const bars = [];
158657
+ rects.forEach((rect) => {
158658
+ const x = Number(rect.getAttribute("x") || 0);
158659
+ const width = Number(rect.getAttribute("width") || 0);
158660
+ if (width > 0) bars.push({
158661
+ x,
158662
+ width
158663
+ });
158664
+ });
158665
+ return bars;
158666
+ }
158667
+ function getBrokenBarsStable(seed) {
158668
+ const bars = [];
158669
+ const totalWidth = renderWidth.value;
158670
+ let x = layout.value.paddingX;
158671
+ let hash = 0;
158672
+ for (let i = 0; i < seed.length; i++) hash += seed.charCodeAt(i);
158673
+ let i = 0;
158674
+ while (x < totalWidth - layout.value.paddingX) {
158675
+ const width = i % 3 === 0 ? 2 : 1;
158676
+ if ((hash + i * 7) % 10 > 2) bars.push({
158677
+ x,
158678
+ width
158679
+ });
158680
+ x += width + 1;
158681
+ i++;
158682
+ }
158683
+ return bars;
158684
+ }
158685
+ return (_ctx, _cache) => {
158686
+ const _component_v_rect = resolveComponent("v-rect");
158687
+ const _component_v_path = resolveComponent("v-path");
158688
+ const _component_v_text = resolveComponent("v-text");
158689
+ const _component_v_group = resolveComponent("v-group");
158690
+ return openBlock(), createBlock(_component_v_group, { config: {
158691
+ x: __props.widget.x,
158692
+ y: __props.widget.y,
158693
+ id: __props.widget.id
158694
+ } }, {
158695
+ default: withCtx(() => [
158696
+ (openBlock(true), createElementBlock(Fragment, null, renderList(bars.value, (bar, i) => {
158697
+ return openBlock(), createBlock(_component_v_rect, {
158698
+ key: i,
158699
+ x: bar.x,
158700
+ y: 0,
158701
+ width: bar.width,
158702
+ height: layout.value.barcodeHeight,
158703
+ fill: bar.fill
158704
+ }, null, 8, [
158705
+ "x",
158706
+ "width",
158707
+ "height",
158708
+ "fill"
158709
+ ]);
158710
+ }), 128)),
158711
+ !rawBars.value.length ? (openBlock(), createBlock(_component_v_path, {
158712
+ key: 0,
158713
+ data: lightningPath.value,
158714
+ fill: "#fff"
158715
+ }, null, 8, ["data"])) : createCommentVNode("", true),
158716
+ showText.value ? (openBlock(), createBlock(_component_v_text, {
158717
+ key: 1,
158718
+ x: 0,
158719
+ y: layout.value.barcodeHeight + layout.value.paddingY,
158720
+ width: renderWidth.value,
158721
+ height: layout.value.textHeight,
158722
+ text: textValue.value,
158723
+ align: alignType.value,
158724
+ verticalAlign: "middle",
158725
+ fontSize: fontSize.value,
158726
+ fill: textColor.value
158727
+ }, null, 8, [
158728
+ "y",
158729
+ "width",
158730
+ "height",
158731
+ "text",
158732
+ "align",
158733
+ "fontSize",
158734
+ "fill"
158735
+ ])) : createCommentVNode("", true),
158736
+ createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
158737
+ ]),
158738
+ _: 1
158739
+ }, 8, ["config"]);
158740
+ };
158741
+ }
158742
+ });
158743
+ //#endregion
158744
+ //#region src/suites/edhr/component/pw-barcode-render.vue
158745
+ var pw_barcode_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_barcode_render_default });
158746
+ var pw_barcode_render_default = pw_barcode_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
158747
+ //#endregion
158748
+ //#region src/suites/edhr/component/pw-diagonal-render.vue?vue&type=script&setup=true&name=pw-diagonal-render&lang.ts
158749
+ init_core();
158750
+ init_useWidgetRenderData();
158751
+ init_enum();
158752
+ init_core$1();
158753
+ init__register_();
158754
+ var CELL_PADDING = 5;
158755
+ var pw_diagonal_render_vue_vue_type_script_setup_true_name_pw_diagonal_render_lang_default = /*@__PURE__*/ defineComponent({
158756
+ __name: "pw-diagonal-render",
158757
+ props: {
158758
+ modelId: {},
158759
+ widget: {}
158760
+ },
158761
+ setup(__props) {
158762
+ const designCtx = useDesignSuiteContext();
158763
+ const props = __props;
158764
+ const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
158765
+ const textStyle = computed(() => {
158766
+ const style = {
158767
+ ...DEFAULT_WIDGET_TEXT_STYLE,
158768
+ ...pageWidgetProps.value.textStyle
158769
+ };
158770
+ const fontStyle = [style.bold && "bold", style.italic && "italic"].filter(Boolean).join(" ") || void 0;
158771
+ const textDecoration = [style.underline && "underline", style.strike && "line-through"].filter(Boolean).filter((v, i, arr) => arr.indexOf(v) === i).join(" ") || void 0;
158772
+ return {
158773
+ fontSize: style.fontSize,
158774
+ fontFamily: style.fontFamily,
158775
+ lineHeight: 1.2,
158776
+ fill: style.color,
158777
+ fontStyle,
158778
+ textDecoration,
158779
+ bold: style.bold,
158780
+ italic: style.italic
158781
+ };
158782
+ });
158783
+ const fontSize = computed(() => textStyle.value.fontSize);
158784
+ const lineHeight = computed(() => textStyle.value.fontSize * 1.2);
158785
+ const width = computed(() => props.widget.width);
158786
+ const height = computed(() => props.widget.height);
158787
+ const size = computed(() => pageWidgetProps.value.size);
158788
+ const isBackward = computed(() => pageWidgetProps.value.direction === DiagonalDirectionTypeConst.Backward);
158789
+ /** 分割线 */
158790
+ function flipX(x) {
158791
+ return isBackward.value ? width.value - x : x;
158792
+ }
158793
+ const lines = computed(() => {
158794
+ if (size.value === 2) return [{
158795
+ points: [
158796
+ flipX(0),
158797
+ 0,
158798
+ flipX(width.value),
158799
+ height.value
158800
+ ],
158801
+ stroke: "rgb(128, 128, 128)",
158802
+ strokeWidth: 1
158803
+ }];
158804
+ return [{
158805
+ points: [
158806
+ flipX(width.value * .4),
158807
+ 0,
158808
+ flipX(width.value),
158809
+ height.value
158810
+ ],
158811
+ stroke: "rgb(128, 128, 128)",
158812
+ strokeWidth: 1
158813
+ }, {
158814
+ points: [
158815
+ flipX(0),
158816
+ height.value * .4,
158817
+ flipX(width.value),
158818
+ height.value
158819
+ ],
158820
+ stroke: "rgb(128, 128, 128)",
158821
+ strokeWidth: 1
158822
+ }];
158823
+ });
158824
+ const getNameByIndex = (index) => {
158825
+ if (!pageWidgetProps.value.enableFields?.[index]) return pageWidgetProps.value.names[index];
158826
+ const fieldMeta = pageWidgetProps.value.bindFields?.[index];
158827
+ if (fieldMeta && fieldMeta.fieldData) {
158828
+ const modelKey = getLastSegment(fieldMeta.fieldData.modelLink);
158829
+ const fieldKey = getLastSegment(fieldMeta.fieldData.fieldLink);
158830
+ const fieldInfo = modelKey && fieldKey ? designCtx.runtime.getFieldList(modelKey)?.find((f) => f.key === fieldKey) ?? null : null;
158831
+ const path = fieldMeta.fieldData?.valuePath;
158832
+ if (isDesignMode.value) return fieldInfo?.name ? `\${${fieldInfo.name}}` : path;
158833
+ if (path) {
158834
+ const runtimePath = replacePathIndexPlaceholders({
158835
+ y: props.widget?.dataSlotIndex?.yDataIndex,
158836
+ x: props.widget?.dataSlotIndex?.xDataIndex,
158837
+ n: props.widget?.dataSlotIndex?.dataIndex,
158838
+ templatePath: path
158839
+ });
158840
+ return docInst.value?.dataManager?.get(runtimePath);
158841
+ }
158842
+ }
158843
+ return "";
158844
+ };
158845
+ const names = computed(() => {
158846
+ return [
158847
+ 0,
158848
+ 1,
158849
+ 2
158850
+ ].map((i) => getNameByIndex(i));
158851
+ });
158852
+ function createCharWidthGetter(size, family, bold, italic) {
158853
+ const cache = /* @__PURE__ */ new Map();
158854
+ return (char) => {
158855
+ const key = [
158856
+ char,
158857
+ size,
158858
+ family,
158859
+ bold,
158860
+ italic
158861
+ ].join("_");
158862
+ if (cache.has(key)) return cache.get(key);
158863
+ const { width } = TextUtil.getLayoutSize({
158864
+ fontSize: size,
158865
+ fontFamily: family,
158866
+ bold,
158867
+ italic,
158868
+ text: char
158869
+ });
158870
+ cache.set(key, width);
158871
+ return width;
158872
+ };
158873
+ }
158874
+ function sliceLine(text, start, maxWidth, getCharWidth) {
158875
+ let width = 0;
158876
+ let end = start;
158877
+ while (end < text.length) {
158878
+ const w = getCharWidth(text[end]);
158879
+ if (width + w > maxWidth) break;
158880
+ width += w;
158881
+ end++;
158882
+ }
158883
+ if (end === start) {
158884
+ width = getCharWidth(text[start]);
158885
+ end = start + 1;
158886
+ }
158887
+ return {
158888
+ end,
158889
+ width,
158890
+ text: text.slice(start, end)
158891
+ };
158892
+ }
158893
+ function layoutByLineWidth({ text, x0, y0, height, getLineWidth, getX = (y, width, maxWidth) => x0 }) {
158894
+ const result = [];
158895
+ const getCharWidth = createCharWidthGetter(fontSize.value, textStyle.value.fontFamily, textStyle.value.bold, textStyle.value.italic);
158896
+ let y = y0;
158897
+ let cursor = 0;
158898
+ while (cursor < text.length) {
158899
+ if (y + lineHeight.value > y0 + height) break;
158900
+ const maxWidth = getLineWidth(y);
158901
+ if (maxWidth <= 0) {
158902
+ y += lineHeight.value;
158903
+ continue;
158904
+ }
158905
+ const { end, width, text: lineText } = sliceLine(text, cursor, maxWidth, getCharWidth);
158906
+ result.push({
158907
+ text: lineText,
158908
+ x: getX(y, width, maxWidth),
158909
+ y
158910
+ });
158911
+ cursor = end;
158912
+ y += lineHeight.value;
158913
+ }
158914
+ return result;
158915
+ }
158916
+ const topTextLines = computed(() => {
158917
+ const text = names.value[isBackward.value ? 0 : 2] || "";
158918
+ if (isBackward.value) {
158919
+ const w = size.value === 2 ? width.value : width.value - width.value * .4;
158920
+ return layoutByLineWidth({
158921
+ text,
158922
+ x0: 0,
158923
+ y0: 0,
158924
+ height: height.value,
158925
+ getLineWidth: (y) => w * (1 - y / height.value) - 12
158926
+ });
158927
+ }
158928
+ const y0 = size.value === 2 ? 0 : height.value * .4;
158929
+ const h = size.value === 2 ? height.value : height.value - height.value * .4;
158930
+ return layoutByLineWidth({
158931
+ text,
158932
+ x0: 0,
158933
+ y0,
158934
+ height: h,
158935
+ getLineWidth: (y) => width.value * (y - y0) / h
158936
+ });
158937
+ });
158938
+ const bottomTextLines = computed(() => {
158939
+ const text = names.value[isBackward.value ? 2 : 0] || "";
158940
+ if (isBackward.value) {
158941
+ const y0 = size.value === 2 ? 0 : height.value * .4;
158942
+ const h = size.value === 2 ? height.value : height.value - height.value * .4;
158943
+ return layoutByLineWidth({
158944
+ text,
158945
+ x0: 0,
158946
+ y0,
158947
+ height: h,
158948
+ getLineWidth: (y) => width.value * ((y - y0) / h),
158949
+ getX: (y, lineWidth) => width.value - lineWidth
158950
+ });
158951
+ }
158952
+ const x0 = size.value === 2 ? 0 : width.value * .4;
158953
+ const w = size.value === 2 ? width.value : width.value - width.value * .4;
158954
+ return layoutByLineWidth({
158955
+ text,
158956
+ x0,
158957
+ y0: 0,
158958
+ height: height.value,
158959
+ getLineWidth: (y) => w * (1 - y / height.value) - 13,
158960
+ getX: (y, lineWidth) => x0 + w - lineWidth
158961
+ });
158962
+ });
158963
+ function layoutInShape({ text, height, xLeft, xRight }) {
158964
+ const result = [];
158965
+ const getCharWidth = createCharWidthGetter(fontSize.value, textStyle.value.fontFamily, textStyle.value.bold, textStyle.value.italic);
158966
+ let cursor = 0;
158967
+ let y = 0;
158968
+ while (y < height && cursor < text.length) {
158969
+ const yTop = y;
158970
+ const yBottom = Math.min(y + lineHeight.value, height);
158971
+ const left = Math.max(xLeft(yTop), xLeft(yBottom));
158972
+ const maxWidth = Math.min(xRight(yTop), xRight(yBottom)) - left;
158973
+ if (maxWidth <= 0) break;
158974
+ const { end, width, text: lineText } = sliceLine(text, cursor, maxWidth, getCharWidth);
158975
+ const isLastLine = end >= text.length;
158976
+ const charCount = lineText.length;
158977
+ let x = left;
158978
+ let letterSpacing = 0;
158979
+ if (!isLastLine && charCount > 1) letterSpacing = (maxWidth - width) / (charCount - 1);
158980
+ result.push({
158981
+ text: lineText,
158982
+ x,
158983
+ y: yTop,
158984
+ width: maxWidth,
158985
+ textWidth: width,
158986
+ letterSpacing
158987
+ });
158988
+ cursor = end;
158989
+ y += lineHeight.value;
158990
+ }
158991
+ return result;
158992
+ }
158993
+ const middleTextLines = computed(() => {
158994
+ const text = names.value[1] || "";
158995
+ if (isBackward.value) {
158996
+ const x1 = width.value - width.value * .4;
158997
+ const y2 = height.value * .4;
158998
+ const kRight = (y2 - height.value) / width.value;
158999
+ const xLeft = (y) => x1 * (height.value - y) / height.value;
159000
+ const xRight = (y) => {
159001
+ if (y <= y2) return width.value;
159002
+ return (y - height.value) / kRight;
159003
+ };
159004
+ return layoutInShape({
159005
+ text,
159006
+ height: height.value,
159007
+ xLeft,
159008
+ xRight
159009
+ });
159010
+ }
159011
+ const x1 = width.value * .4;
159012
+ const y1 = height.value * .4;
159013
+ const xLeft = (y) => y <= y1 ? 0 : width.value * (y - y1) / (height.value - y1);
159014
+ const xRight = (y) => x1 + (width.value - x1) * y / height.value;
159015
+ return layoutInShape({
159016
+ text,
159017
+ height: height.value,
159018
+ xLeft,
159019
+ xRight
159020
+ });
159021
+ });
159022
+ const allTextLines = computed(() => {
159023
+ return [
159024
+ ...topTextLines.value.map((i) => ({
159025
+ ...i,
159026
+ align: "left"
159027
+ })),
159028
+ ...size.value === 3 ? middleTextLines.value.map((i) => ({
159029
+ ...i,
159030
+ align: "left"
159031
+ })) : [],
159032
+ ...bottomTextLines.value.map((i) => ({
159033
+ ...i,
159034
+ align: "right"
159035
+ }))
159036
+ ];
159037
+ });
159038
+ const bgConfig = computed(() => ({
159039
+ x: 0,
159040
+ y: 0,
159041
+ width: props.widget.width,
159042
+ height: props.widget.height,
159043
+ fill: "transparent"
159044
+ }));
159045
+ return (_ctx, _cache) => {
159046
+ const _component_v_line = resolveComponent("v-line");
159047
+ const _component_v_text = resolveComponent("v-text");
159048
+ const _component_v_rect = resolveComponent("v-rect");
159049
+ const _component_v_group = resolveComponent("v-group");
159050
+ return openBlock(), createBlock(_component_v_group, { config: {
159051
+ x: __props.widget.x - CELL_PADDING,
159052
+ y: __props.widget.y - CELL_PADDING,
159053
+ id: __props.widget.id
159054
+ } }, {
159055
+ default: withCtx(() => [
159056
+ (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (line, i) => {
159057
+ return openBlock(), createBlock(_component_v_line, {
159058
+ key: i,
159059
+ config: line
159060
+ }, null, 8, ["config"]);
159061
+ }), 128)),
159062
+ (openBlock(true), createElementBlock(Fragment, null, renderList(allTextLines.value, (line, i) => {
159063
+ return openBlock(), createBlock(_component_v_text, {
159064
+ key: "text-" + i,
159065
+ config: {
159066
+ x: line.x,
159067
+ y: line.y,
159068
+ text: line.text,
159069
+ fontSize: textStyle.value.fontSize,
159070
+ fontFamily: textStyle.value.fontFamily,
159071
+ lineHeight: textStyle.value.lineHeight,
159072
+ fill: textStyle.value.fill,
159073
+ fontStyle: textStyle.value.fontStyle,
159074
+ textDecoration: textStyle.value.textDecoration,
159075
+ align: line.align
159076
+ }
159077
+ }, null, 8, ["config"]);
159078
+ }), 128)),
159079
+ createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
159080
+ ]),
159081
+ _: 1
159082
+ }, 8, ["config"]);
159083
+ };
159084
+ }
159085
+ });
159086
+ //#endregion
159087
+ //#region src/suites/edhr/component/pw-diagonal-render.vue
159088
+ var pw_diagonal_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_diagonal_render_default });
159089
+ var pw_diagonal_render_default = pw_diagonal_render_vue_vue_type_script_setup_true_name_pw_diagonal_render_lang_default;
159090
+ //#endregion
159091
+ //#region src/suites/edhr/component/pw-image-render.vue?vue&type=script&setup=true&name=gct-image-render&lang.ts
159092
+ init_asset_helper_util();
159093
+ init_image_size_util();
159094
+ init_useWidgetRenderData();
159095
+ var pw_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default = /*@__PURE__*/ defineComponent({
159096
+ __name: "pw-image-render",
159097
+ props: {
159098
+ widget: {},
159099
+ modelId: {}
159100
+ },
159101
+ setup(__props) {
159102
+ const props = __props;
159103
+ const imgRef = ref(null);
159104
+ const { pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
159105
+ const natural = ref({
159106
+ width: 0,
159107
+ height: 0
159108
+ });
159109
+ const display = ref({
159110
+ width: props.widget.width,
159111
+ height: props.widget.height
159112
+ });
159113
+ const placeholder = {
159114
+ width: props.widget.width,
159115
+ height: props.widget.height,
159116
+ fill: "#f3f3f3"
159117
+ };
159118
+ watch(() => pageWidgetProps.value.value, async (v) => {
159119
+ const img = await AssetHelper.loadImage(v);
159120
+ if (!img) return;
159121
+ natural.value = {
159122
+ width: img.naturalWidth,
159123
+ height: img.naturalHeight
159124
+ };
159125
+ const size = computeImageDisplaySize(natural.value, {
159126
+ width: props.widget.width,
159127
+ height: props.widget.height,
159128
+ keepAspect: props.widget.keepAspect ?? true,
159129
+ maxDefaultWidth: 200
159130
+ });
159131
+ display.value = size;
159132
+ imgRef.value = img;
159133
+ }, { immediate: true });
159134
+ const imageConfig = computed(() => {
159135
+ const w = display.value.width;
159136
+ const h = display.value.height;
159137
+ return {
159138
+ x: 0,
159139
+ y: 0,
159140
+ image: imgRef.value,
159141
+ width: w,
159142
+ height: h
159143
+ };
159144
+ });
159145
+ return (_ctx, _cache) => {
159146
+ const _component_v_image = resolveComponent("v-image");
159147
+ const _component_v_rect = resolveComponent("v-rect");
159148
+ const _component_v_group = resolveComponent("v-group");
159149
+ return openBlock(), createBlock(_component_v_group, { config: {
159150
+ x: __props.widget.x,
159151
+ y: __props.widget.y,
159152
+ id: __props.widget.id
159153
+ } }, {
159154
+ default: withCtx(() => [imgRef.value ? (openBlock(), createBlock(_component_v_image, {
159155
+ key: 0,
159156
+ config: imageConfig.value
159157
+ }, null, 8, ["config"])) : (openBlock(), createBlock(_component_v_rect, {
159158
+ key: 1,
159159
+ width: placeholder.width,
159160
+ height: placeholder.height,
159161
+ fill: placeholder.fill
159162
+ }, null, 8, [
159163
+ "width",
159164
+ "height",
159165
+ "fill"
159166
+ ]))]),
159167
+ _: 1
159168
+ }, 8, ["config"]);
159169
+ };
159170
+ }
159171
+ });
159172
+ //#endregion
159173
+ //#region src/suites/edhr/component/pw-image-render.vue
159174
+ var pw_image_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_image_render_default });
159175
+ var pw_image_render_default = pw_image_render_vue_vue_type_script_setup_true_name_gct_image_render_lang_default;
159176
+ //#endregion
159177
+ //#region src/suites/edhr/component/pw-line-render.vue?vue&type=script&setup=true&lang.ts
159178
+ init_canvas$1();
159179
+ init_core$1();
159180
+ init_useWidgetRenderData();
159181
+ var pw_line_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
159182
+ __name: "pw-line-render",
159183
+ props: {
159184
+ widget: {},
159185
+ modelId: {}
159186
+ },
159187
+ setup(__props) {
159188
+ const props = __props;
159189
+ const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
159190
+ const lineGroupConfig = computed(() => {
159191
+ return {
159192
+ x: props.widget.x,
159193
+ y: props.widget.y,
159194
+ id: props.widget.id
159195
+ };
159196
+ });
159197
+ const lineProps = computed(() => {
159198
+ const { borderColor, borderWidth, borderStyle, direction, rotate } = pageWidgetProps.value;
159199
+ const width = props.widget.width;
159200
+ const height = props.widget.height;
159201
+ const centerX = halfPixel(width / 2);
159202
+ const centerY = halfPixel(height / 2);
159203
+ let points;
159204
+ let offsetX = 0;
159205
+ let offsetY = 0;
159206
+ if (direction === "vertical") {
159207
+ points = [
159208
+ centerX,
159209
+ 0,
159210
+ centerX,
159211
+ height
159212
+ ];
159213
+ offsetX = centerX;
159214
+ offsetY = height / 2;
159215
+ } else {
159216
+ points = [
159217
+ 0,
159218
+ centerY,
159219
+ width,
159220
+ centerY
159221
+ ];
159222
+ offsetX = width / 2;
159223
+ offsetY = centerY;
159224
+ }
159225
+ return {
159226
+ x: offsetX,
159227
+ y: offsetY,
159228
+ stroke: borderColor || "#000",
159229
+ strokeWidth: borderWidth || 1,
159230
+ dash: borderStyle === "dashed" ? [6, 4] : borderStyle === "dotted" ? [2, 2] : void 0,
159231
+ points,
159232
+ offsetX,
159233
+ offsetY,
159234
+ rotation: rotate || 0,
159235
+ ...baseCanvasAttrs
159236
+ };
159237
+ });
159238
+ return (_ctx, _cache) => {
159239
+ const _component_v_line = resolveComponent("v-line");
159240
+ const _component_v_group = resolveComponent("v-group");
159241
+ return openBlock(), createBlock(_component_v_group, { config: lineGroupConfig.value }, {
159242
+ default: withCtx(() => [createVNode(_component_v_line, normalizeProps(guardReactiveProps(lineProps.value)), null, 16)]),
159243
+ _: 1
159244
+ }, 8, ["config"]);
159245
+ };
159246
+ }
159247
+ });
159248
+ //#endregion
159249
+ //#region src/suites/edhr/component/pw-line-render.vue
159250
+ var pw_line_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_line_render_default });
159251
+ var pw_line_render_default = pw_line_render_vue_vue_type_script_setup_true_lang_default;
159252
+ //#endregion
159253
+ //#region src/suites/edhr/component/pw-pagination-render.vue?vue&type=script&setup=true&lang.ts
159254
+ var pw_pagination_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
159255
+ __name: "pw-pagination-render",
159256
+ props: {
159257
+ widget: {},
159258
+ modelId: {}
159259
+ },
159260
+ setup(__props) {
159261
+ const props = __props;
159262
+ const textConfig = computed(() => {
159263
+ const widget = props.widget;
159264
+ const fontStyle = [widget.bold && "bold", widget.italic && "italic"].filter(Boolean).join(" ") || void 0;
159265
+ const textDecoration = [
159266
+ widget.isComposition && "underline",
159267
+ widget.underline && "underline",
159268
+ widget.strike && "line-through"
159269
+ ].filter(Boolean).filter((v, i, arr) => arr.indexOf(v) === i).join(" ") || void 0;
159270
+ return {
159271
+ x: 0,
159272
+ y: 0,
159273
+ text: widget.text,
159274
+ fontSize: widget.fontSize,
159275
+ fontFamily: widget.fontFamily,
159276
+ fill: widget.color,
159277
+ fontStyle,
159278
+ align: widget.textAlign,
159279
+ letterSpacing: widget.letterSpacing,
159280
+ textDecoration,
159281
+ wrap: "none"
159282
+ };
159283
+ });
159284
+ return (_ctx, _cache) => {
159285
+ const _component_v_text = resolveComponent("v-text");
159286
+ const _component_v_group = resolveComponent("v-group");
159287
+ return openBlock(), createBlock(_component_v_group, { config: {
159288
+ x: __props.widget.x,
159289
+ y: __props.widget.y,
159290
+ id: __props.widget.id
159291
+ } }, {
159292
+ default: withCtx(() => [createVNode(_component_v_text, { config: textConfig.value }, null, 8, ["config"])]),
159293
+ _: 1
159294
+ }, 8, ["config"]);
159295
+ };
159296
+ }
159297
+ });
159298
+ //#endregion
159299
+ //#region src/suites/edhr/component/pw-pagination-render.vue
159300
+ var pw_pagination_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_pagination_render_default });
159301
+ var pw_pagination_render_default = pw_pagination_render_vue_vue_type_script_setup_true_lang_default;
159302
+ //#endregion
159303
+ //#region src/suites/edhr/component/pw-qrcode-render.vue?vue&type=script&setup=true&lang.ts
159304
+ init_core$1();
159305
+ init_useWidgetRenderData();
159306
+ init_enum();
159307
+ init_core();
159308
+ var pw_qrcode_render_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
159309
+ __name: "pw-qrcode-render",
159310
+ props: {
159311
+ widget: {},
159312
+ modelId: {}
159313
+ },
159314
+ setup(__props) {
159315
+ const props = __props;
159316
+ const { docInst, isDesignMode, pageWidgetProps } = usePaperWidgetStaticAttrs(props.widget);
159317
+ const readonlyValue = ref("");
159318
+ const valueType = computed(() => pageWidgetProps.value.valueType);
159319
+ /** 值处理 */
159320
+ const modelValue = computed(() => {
159321
+ let text = pageWidgetProps.value.value;
159322
+ if (valueType.value === ValueTypeConst.Field) {
159323
+ const path = text?.exp?.fieldData?.valuePath;
159324
+ if (path) {
159325
+ const runtimePath = replacePathIndexPlaceholders({
159326
+ y: props.widget?.dataSlotIndex?.yDataIndex,
159327
+ x: props.widget?.dataSlotIndex?.xDataIndex,
159328
+ n: props.widget?.dataSlotIndex?.dataIndex,
159329
+ templatePath: path
159330
+ });
159331
+ text = docInst.value?.dataManager?.get(runtimePath);
159332
+ }
159333
+ }
159334
+ return Array.isArray(text) ? text.join() : text;
159335
+ });
159336
+ watch(() => modelValue.value, async () => {
159337
+ if (isDesignMode.value) {
159338
+ readonlyValue.value = "GCT";
159339
+ return;
159340
+ }
159341
+ if (valueType.value === ValueTypeConst.Formula) {
159342
+ const subFieldKey = modelValue.value?.subFieldKey;
159343
+ const rawData = docInst.value.dataManager.getRawData();
159344
+ const path = subFieldKey ? `${subFieldKey}[${props.widget?.dataSlotIndex?.dataIndex}]` : "";
159345
+ const subRowData = path ? docInst.value.dataManager.get(path) : {};
159346
+ const result = await formulaUtils.calculateFormula(modelValue.value?.exp, rawData, subRowData);
159347
+ readonlyValue.value = result;
159348
+ } else readonlyValue.value = modelValue.value;
159349
+ }, { immediate: true });
159350
+ const isValueEmpty = computed(() => {
159351
+ return isEmptyValue$1(readonlyValue.value);
159352
+ });
159353
+ const qrData = computed(() => {
159354
+ if (isValueEmpty.value) return [];
159355
+ try {
159356
+ return QRCode.create(readonlyValue.value, {
159357
+ errorCorrectionLevel: "H",
159358
+ margin: 1
159359
+ }).modules.data;
159360
+ } catch {
159361
+ return [];
159362
+ }
159363
+ });
159364
+ const blocks = computed(() => {
159365
+ if (isValueEmpty.value) {
159366
+ const placeholder = [];
159367
+ const size = 21;
159368
+ const unit = props.widget.width / size;
159369
+ for (let row = 0; row < size; row++) for (let col = 0; col < size; col++) if ((row + col) % 3 === 0) placeholder.push({
159370
+ x: col * unit,
159371
+ y: row * unit,
159372
+ w: unit,
159373
+ h: unit,
159374
+ fill: "#bbb"
159375
+ });
159376
+ return placeholder;
159377
+ }
159378
+ const blocksArr = [];
159379
+ const size = Math.sqrt(qrData.value.length);
159380
+ const unit = props.widget.width / size;
159381
+ for (let row = 0; row < size; row++) for (let col = 0; col < size; col++) {
159382
+ const idx = row * size + col;
159383
+ if (qrData.value[idx]) blocksArr.push({
159384
+ x: col * unit,
159385
+ y: row * unit,
159386
+ w: unit,
159387
+ h: unit,
159388
+ fill: "#000"
159389
+ });
159390
+ }
159391
+ return blocksArr;
159392
+ });
159393
+ const lightningPath = computed(() => {
159394
+ const w = props.widget.width;
159395
+ const mid = props.widget.width / 2;
159396
+ return `
159397
+ M 0 ${mid - 6}
159398
+ L ${w * .25} ${mid - 2}
159399
+ L ${w * .4} ${mid + 2}
159400
+ L ${w * .6} ${mid - 4}
159401
+ L ${w * .8} ${mid + 3}
159402
+ L ${w} ${mid - 1}
159403
+ L ${w} ${mid + 6}
159404
+ L ${w * .8} ${mid + 10}
159405
+ L ${w * .6} ${mid + 4}
159406
+ L ${w * .4} ${mid + 12}
159407
+ L ${w * .25} ${mid + 6}
159408
+ L 0 ${mid + 10}
159409
+ Z
159410
+ `;
159411
+ });
159412
+ const bgConfig = computed(() => ({
159413
+ x: 0,
159414
+ y: 0,
159415
+ width: props.widget.width,
159416
+ height: props.widget.height,
159417
+ fill: "transparent"
159418
+ }));
159419
+ return (_ctx, _cache) => {
159420
+ const _component_v_rect = resolveComponent("v-rect");
159421
+ const _component_v_path = resolveComponent("v-path");
159422
+ const _component_v_group = resolveComponent("v-group");
159423
+ return openBlock(), createBlock(_component_v_group, { config: {
159424
+ x: __props.widget.x,
159425
+ y: __props.widget.y,
159426
+ id: __props.widget.id
159427
+ } }, {
159428
+ default: withCtx(() => [
159429
+ (openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, i) => {
159430
+ return openBlock(), createBlock(_component_v_rect, {
159431
+ key: i,
159432
+ x: block.x,
159433
+ y: block.y,
159434
+ width: block.w,
159435
+ height: block.h,
159436
+ fill: block.fill
159437
+ }, null, 8, [
159438
+ "x",
159439
+ "y",
159440
+ "width",
159441
+ "height",
159442
+ "fill"
159443
+ ]);
159444
+ }), 128)),
159445
+ isValueEmpty.value ? (openBlock(), createBlock(_component_v_path, {
159446
+ key: 0,
159447
+ data: lightningPath.value,
159448
+ fill: "#fff"
159449
+ }, null, 8, ["data"])) : createCommentVNode("", true),
159450
+ createVNode(_component_v_rect, { config: bgConfig.value }, null, 8, ["config"])
159451
+ ]),
159452
+ _: 1
159453
+ }, 8, ["config"]);
159454
+ };
159455
+ }
159456
+ });
159457
+ //#endregion
159458
+ //#region src/suites/edhr/component/pw-qrcode-render.vue
159459
+ var pw_qrcode_render_exports = /* @__PURE__ */ __exportAll({ default: () => pw_qrcode_render_default });
159460
+ var pw_qrcode_render_default = pw_qrcode_render_vue_vue_type_script_setup_true_lang_default;
159461
+ //#endregion
157439
159462
  //#region src/suites/edhr/component/index.ts
157440
- /**
157441
- * 同步加载 Vue 组件
157442
- */
157443
159463
  function loadVueComponentModulesSync() {
157444
- const componentModules = /* #__PURE__ */ Object.assign({});
159464
+ const componentModules = {
159465
+ .../* #__PURE__ */ Object.assign({
159466
+ "./gct-control-render.vue": gct_control_render_exports,
159467
+ "./gct-image-render.vue": gct_image_render_exports,
159468
+ "./gct-leftMarker-render.vue": gct_leftMarker_render_exports,
159469
+ "./gct-placeholder-render.vue": gct_placeholder_render_exports,
159470
+ "./gct-rightMarker-render.vue": gct_rightMarker_render_exports,
159471
+ "./gct-signature-render.vue": gct_signature_render_exports,
159472
+ "./gct-space-render.vue": gct_space_render_exports,
159473
+ "./gct-text-render.vue": gct_text_render_exports
159474
+ }),
159475
+ .../* #__PURE__ */ Object.assign({
159476
+ "./pw-barcode-render.vue": pw_barcode_render_exports,
159477
+ "./pw-diagonal-render.vue": pw_diagonal_render_exports,
159478
+ "./pw-image-render.vue": pw_image_render_exports,
159479
+ "./pw-line-render.vue": pw_line_render_exports,
159480
+ "./pw-pagination-render.vue": pw_pagination_render_exports,
159481
+ "./pw-qrcode-render.vue": pw_qrcode_render_exports
159482
+ })
159483
+ };
157445
159484
  const vueComponentMap = {};
157446
159485
  Object.entries(componentModules).forEach(([filePath, componentModule]) => {
157447
159486
  try {