@gct-paas/word 1.0.1 → 1.0.2

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.
@@ -1,2 +1 @@
1
- /** 业务任务和新行的身份只在当前操作生成,不更改 model 节点身份。 */
2
1
  export declare function createNativeId(): string;
@@ -1,4 +1,3 @@
1
- /** 新业务行缺少稳定身份时补齐,不覆盖已存在的身份。 */
2
1
  export declare function ensureFrontRowKey(row: Record<string, unknown>): string;
3
2
  /** 活动业务行沿用数据仓库的软删与预览准入。 */
4
3
  export { activeRowIndexes as activeSubtableRowIndexes } from '../../../data/rows/active';
@@ -0,0 +1,3 @@
1
+ /** @file 配置草稿的独立身份生成,不依赖 Word 或宿主的安全上下文。 */
2
+ /** 使用普通 HTTP 也支持的随机源生成 UUID v4,不修改浏览器全局对象。 */
3
+ export declare function createUuid(): string;
@@ -0,0 +1,3 @@
1
+ /** @file 独立于安全上下文的 UUID,用于文档、会话和业务行身份。 */
2
+ /** getRandomValues 在普通 HTTP 中也可用,保持 UUID v4 格式和随机强度。 */
3
+ export declare function createUuid(): string;
package/dist/vue.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { a as getGctFieldIcon, c as getGctBusinessFieldType, i as readGctModelMeta, n as isGctInternalFormField, o as GCT_BASE_FIELD_TYPES, r as readGctFieldCreationContext, s as GCT_BUSINESS_FIELD_TYPES, t as getGctFormModelLoader } from "./chunks/fields-CAcm6X98.js";
2
- import { Jt as commonFieldDeclaration, L as designRegionVariants, Mt as isMaterialLotBinding, Nt as isNamedLotBinding, X as TextFlowError, t as nativeTableRowBatchLimit } from "./chunks/types-XXuIIZ9e.js";
2
+ import { Jt as commonFieldDeclaration, L as designRegionVariants, Mt as isMaterialLotBinding, Nt as isNamedLotBinding, X as TextFlowError, t as nativeTableRowBatchLimit } from "./chunks/types-Bq4hbWKT.js";
3
3
  import { B as isObject, S as repeatingTableVariants, c as DocumentValidationError, l as parseDocument, u as readDocument, v as communicationBusinessSchema, x as repeatingTableSettings } from "./chunks/NodeFactory-D9gVGSok.js";
4
- import { At as clippedFrame, B as logicalFillPath, C as NativeReferenceScopeError, D as materialAutofillRegions, E as tableSelectionKind, F as nativeProductReference, H as nativeSourceWorkerCode, It as runtimeRequest, J as sourceParameters, K as copySourceValue, O as productAutofillDetails, P as materialProductMatches, St as compareDocumentContent, T as inventorySelection, Tt as isRecord, U as runNativeSourceScript, V as subtableFillColumn, Y as sourceProperty, _ as CHECK_TABLE_TYPE_TO_VALUE_FIELD, _t as resizedDesignColumnWidth, c as businessNumberMinimum, gt as NestedTableInsertionError, h as allocationNotices, j as getInvalidMaterialLotReason, l as businessTableFieldDefaults, mt as attachNativeInteraction, o as attachNativeDataServices, pt as isDerivedDataPath, q as sourceResult, r as choiceSpacingDefaults, t as attachNativeLayout, u as attachSessionData, v as isSubmitExcludedKey, vt as MissingSubTableHeaderTargetError, wt as validateTemplateSave, xt as DocumentSession, yt as FieldPlacementError } from "./chunks/sdk-DH5c-Bbt.js";
5
- import { h as parseValuePath, o as containsRectangle, t as ModelEditor } from "./chunks/ModelEditor-GzaLnnX8.js";
6
- import { A as revealInputRect, B as viewportClip, C as attachCanvasValidationPanel, F as inputPageLocation, G as NativeFontResources, H as loadBrowserImage, I as inputPointerRequest, J as CanvasTextMeasurer, L as inputScreenPages, M as resourceFileIcon, N as openImageViewer, P as clipInputRect, R as inputScreenRect, T as attachCanvasBusinessTablePanel, U as CanvasImageResources, V as paintPage, W as layoutImages, _ as wordPanelErrorText, a as attachCanvasFieldDesignPanel, c as attachCanvasTableDesignPanel, d as attachCanvasFieldCatalogPanel, g as readWordErrorText, h as isWordValidationError, j as ResourceFileSizes, n as CanvasBusinessTableActions, o as attachCanvasRegionDesignPanel, q as browserAbortable, r as attachCanvasMaterialsPanel, t as CanvasMaterialTableActions, u as attachCanvasFormatPanel, v as fieldSettingControls, w as attachCanvasTextInput, x as attachCanvasFieldDrag, y as attachCanvasObjectHandles, z as CanvasPages } from "./chunks/browser-CP0ycXqN.js";
4
+ import { At as clippedFrame, B as logicalFillPath, C as NativeReferenceScopeError, D as materialAutofillRegions, E as tableSelectionKind, F as nativeProductReference, H as nativeSourceWorkerCode, It as runtimeRequest, J as sourceParameters, K as copySourceValue, O as productAutofillDetails, P as materialProductMatches, St as compareDocumentContent, T as inventorySelection, Tt as isRecord, U as runNativeSourceScript, V as subtableFillColumn, Y as sourceProperty, _ as CHECK_TABLE_TYPE_TO_VALUE_FIELD, _t as resizedDesignColumnWidth, c as businessNumberMinimum, gt as NestedTableInsertionError, h as allocationNotices, j as getInvalidMaterialLotReason, l as businessTableFieldDefaults, mt as attachNativeInteraction, o as attachNativeDataServices, pt as isDerivedDataPath, q as sourceResult, r as choiceSpacingDefaults, t as attachNativeLayout, u as attachSessionData, v as isSubmitExcludedKey, vt as MissingSubTableHeaderTargetError, wt as validateTemplateSave, xt as DocumentSession, yt as FieldPlacementError } from "./chunks/sdk-Dz96Ca_-.js";
5
+ import { h as parseValuePath, o as containsRectangle, t as ModelEditor } from "./chunks/ModelEditor-CXoezurC.js";
6
+ import { A as revealInputRect, B as viewportClip, C as attachCanvasValidationPanel, F as inputPageLocation, G as NativeFontResources, H as loadBrowserImage, I as inputPointerRequest, J as CanvasTextMeasurer, L as inputScreenPages, M as resourceFileIcon, N as openImageViewer, P as clipInputRect, R as inputScreenRect, T as attachCanvasBusinessTablePanel, U as CanvasImageResources, V as paintPage, W as layoutImages, _ as wordPanelErrorText, a as attachCanvasFieldDesignPanel, c as attachCanvasTableDesignPanel, d as attachCanvasFieldCatalogPanel, g as readWordErrorText, h as isWordValidationError, j as ResourceFileSizes, n as CanvasBusinessTableActions, o as attachCanvasRegionDesignPanel, q as browserAbortable, r as attachCanvasMaterialsPanel, t as CanvasMaterialTableActions, u as attachCanvasFormatPanel, v as fieldSettingControls, w as attachCanvasTextInput, x as attachCanvasFieldDrag, y as attachCanvasObjectHandles, z as CanvasPages } from "./chunks/browser-DY0wE3Uz.js";
7
+ import { u as createUuid$1 } from "./chunks/change-set-DgfKTJ6d.js";
7
8
  import { n as wordFontFamilies, t as defaultWordFontFamily } from "./chunks/word-fonts-BA_Tyfnj.js";
8
9
  import { t as waitForAbortable } from "./chunks/abortable-D4G3Ib7H.js";
9
10
  import { a as saveGctTemplateDesigner, i as readGctTemplateVersions, n as readGctTemplateBoms, r as readGctTemplateVersion, t as readGctRelatedTemplate } from "./chunks/templates-Djcl21k4.js";
@@ -15429,7 +15430,7 @@ var WordCanvasHost = class {
15429
15430
  this.session = new DocumentSession({
15430
15431
  document: options.source.document,
15431
15432
  editorOptions: {
15432
- createId: () => crypto.randomUUID(),
15433
+ createId: () => createUuid$1(),
15433
15434
  ...options.source.editorOptions
15434
15435
  }
15435
15436
  });
@@ -20646,6 +20647,16 @@ function fillSourceOptions(sources, form, context) {
20646
20647
  options
20647
20648
  };
20648
20649
  }
20650
+ // ../form-config/src/identity.ts
20651
+ /** @file 配置草稿的独立身份生成,不依赖 Word 或宿主的安全上下文。 */
20652
+ /** 使用普通 HTTP 也支持的随机源生成 UUID v4,不修改浏览器全局对象。 */
20653
+ function createUuid() {
20654
+ const bytes = globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
20655
+ bytes[6] = bytes[6] & 15 | 64;
20656
+ bytes[8] = bytes[8] & 63 | 128;
20657
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
20658
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
20659
+ }
20649
20660
  // ../form-config/src/data/fills/FieldFillDialog.vue?vue&type=script&setup=true&lang.ts
20650
20661
  var _hoisted_1$72 = ["aria-label"];
20651
20662
  var _hoisted_2$61 = { class: "field-fill-actions" };
@@ -20710,7 +20721,7 @@ var FieldFillDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
20710
20721
  submitted.value = true;
20711
20722
  if (!target.value || !validTarget.value || !binding.value) return;
20712
20723
  return {
20713
- id: props.initial?.id ?? crypto.randomUUID(),
20724
+ id: props.initial?.id ?? createUuid(),
20714
20725
  target: target.value,
20715
20726
  source: binding.value,
20716
20727
  trigger: trigger.value
@@ -20799,7 +20810,7 @@ var FieldFillDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
20799
20810
  ])], 10, _hoisted_1$72);
20800
20811
  };
20801
20812
  }
20802
- }), [["__scopeId", "data-v-76654f2d"]]);
20813
+ }), [["__scopeId", "data-v-fe6f53a9"]]);
20803
20814
  // ../form-config/src/data/fills/FieldFills.vue?vue&type=script&setup=true&lang.ts
20804
20815
  var _hoisted_1$71 = { class: "field-fills" };
20805
20816
  var _hoisted_2$60 = { class: "field-fill-line" };
@@ -20976,7 +20987,7 @@ var ObjectStockSettings_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
20976
20987
  const rows = computed(() => (displayed.value.overrides ?? []).map((item) => {
20977
20988
  let key = rowKeys.get(item);
20978
20989
  if (!key) {
20979
- key = crypto.randomUUID();
20990
+ key = createUuid();
20980
20991
  rowKeys.set(item, key);
20981
20992
  }
20982
20993
  return {
@@ -21284,7 +21295,7 @@ var ObjectStockSettings_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
21284
21295
  ])) : createCommentVNode("", true)], 64);
21285
21296
  };
21286
21297
  }
21287
- }), [["__scopeId", "data-v-e3101b8e"]]);
21298
+ }), [["__scopeId", "data-v-c425e376"]]);
21288
21299
  // ../form-config/src/data/objects/ObjectInitializationEditor.vue?vue&type=script&setup=true&lang.ts
21289
21300
  var _hoisted_1$69 = { class: "object-init-editor" };
21290
21301
  var _hoisted_2$58 = {
@@ -22153,7 +22164,7 @@ var recommendedPrompt = "任务:图片OCR文字提取\n规则:不虚构内
22153
22164
  /** 根据 v3 的默认值创建 OCR 草稿。 */
22154
22165
  function createOcrTemplate() {
22155
22166
  return {
22156
- id: crypto.randomUUID(),
22167
+ id: createUuid(),
22157
22168
  type: "AI_OCR",
22158
22169
  name: "",
22159
22170
  deviceName: "",
@@ -22167,7 +22178,7 @@ function createOcrTemplate() {
22167
22178
  promptMode: "RECOMMENDED",
22168
22179
  recommendedPrompt,
22169
22180
  extraPrompt: "",
22170
- identifyParams: [{ id: crypto.randomUUID() }]
22181
+ identifyParams: [{ id: createUuid() }]
22171
22182
  };
22172
22183
  }
22173
22184
  /** 按当前提示词模式生成平台运行时使用的 JSON 回写提示。 */
@@ -22902,7 +22913,7 @@ var OcrTemplateEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
22902
22913
  const existing = draft.value.identifyParams.find(({ formField }) => formField === field.value);
22903
22914
  if (existing) existing.prompt = field.name;
22904
22915
  else draft.value.identifyParams.push({
22905
- id: crypto.randomUUID(),
22916
+ id: createUuid(),
22906
22917
  prompt: field.name,
22907
22918
  formField: field.value
22908
22919
  });
@@ -22920,7 +22931,7 @@ var OcrTemplateEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
22920
22931
  }
22921
22932
  /** 新增一条可独立排序的识别参数。 */
22922
22933
  function addParameter() {
22923
- draft.value.identifyParams.push({ id: crypto.randomUUID() });
22934
+ draft.value.identifyParams.push({ id: createUuid() });
22924
22935
  }
22925
22936
  function setMode(value) {
22926
22937
  if (value !== "NORMAL" && value !== "RECOMMENDED") return;
@@ -23259,7 +23270,7 @@ var OcrTemplateEditor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
23259
23270
  ], 512);
23260
23271
  };
23261
23272
  }
23262
- }), [["__scopeId", "data-v-c70fb970"]]);
23273
+ }), [["__scopeId", "data-v-9e39704b"]]);
23263
23274
  // ../form-config/src/communication/CommunicationPanel.vue?vue&type=script&setup=true&lang.ts
23264
23275
  var _hoisted_1$60 = { class: "communication-panel" };
23265
23276
  var _hoisted_2$50 = { key: 0 };
@@ -23367,7 +23378,7 @@ var CommunicationPanel_default = /*#__PURE__*/ _plugin_vue_export_helper_default
23367
23378
  function addDevice() {
23368
23379
  if (busy.value || !props.editable) return;
23369
23380
  const item = {
23370
- id: crypto.randomUUID(),
23381
+ id: createUuid(),
23371
23382
  type: "DEVICE_INTERCONNECTION",
23372
23383
  fieldMaps: []
23373
23384
  };
@@ -23511,7 +23522,7 @@ var CommunicationPanel_default = /*#__PURE__*/ _plugin_vue_export_helper_default
23511
23522
  ]);
23512
23523
  };
23513
23524
  }
23514
- }), [["__scopeId", "data-v-fde725db"]]);
23525
+ }), [["__scopeId", "data-v-84d82bc3"]]);
23515
23526
  // ../platform-gct/src/data-sources.ts
23516
23527
  /** 使用当前平台认证上下文调用数源端点,并丢弃已取消的迟到结果。 */
23517
23528
  async function requestGctDataSource([root, group, method], input, signal) {
@@ -27542,7 +27553,7 @@ var FieldAutofillDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
27542
27553
  if (!props.readonly && !rows.value.length && !props.presets.length) rows.value.push(newRow());
27543
27554
  function newRow() {
27544
27555
  return {
27545
- id: crypto.randomUUID(),
27556
+ id: createUuid$1(),
27546
27557
  source: "",
27547
27558
  target: "",
27548
27559
  checked: false
@@ -27712,7 +27723,7 @@ var FieldAutofillDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
27712
27723
  ], 10, _hoisted_1$43);
27713
27724
  };
27714
27725
  }
27715
- }), [["__scopeId", "data-v-1e2796c3"]]);
27726
+ }), [["__scopeId", "data-v-893f1574"]]);
27716
27727
  // src/adapters/vue/field-properties/FieldAutofill.vue?vue&type=script&setup=true&lang.ts
27717
27728
  var _hoisted_1$42 = ["disabled"];
27718
27729
  // src/adapters/vue/field-properties/FieldAutofill.vue
@@ -33786,7 +33797,7 @@ var DecisionRuleGroup_default = /* @__PURE__ */ defineComponent({
33786
33797
  collapsed.value = false;
33787
33798
  replaceAt(index, {
33788
33799
  kind: "condition",
33789
- id: crypto.randomUUID()
33800
+ id: createUuid$1()
33790
33801
  }, true);
33791
33802
  }
33792
33803
  /** 新分组从一个条件开始。 */
@@ -33794,11 +33805,11 @@ var DecisionRuleGroup_default = /* @__PURE__ */ defineComponent({
33794
33805
  collapsed.value = false;
33795
33806
  replaceAt(props.group.children.length, {
33796
33807
  kind: "group",
33797
- id: crypto.randomUUID(),
33808
+ id: createUuid$1(),
33798
33809
  operator: "and",
33799
33810
  children: [{
33800
33811
  kind: "condition",
33801
- id: crypto.randomUUID()
33812
+ id: createUuid$1()
33802
33813
  }]
33803
33814
  });
33804
33815
  }
@@ -34128,11 +34139,11 @@ var InspectionRuleDialog_default = /* @__PURE__ */ defineComponent({
34128
34139
  const props = __props;
34129
34140
  const root = shallowRef(props.initial?.predicate ? cloneDeep(props.initial.predicate) : {
34130
34141
  kind: "group",
34131
- id: crypto.randomUUID(),
34142
+ id: createUuid$1(),
34132
34143
  operator: "and",
34133
34144
  children: [{
34134
34145
  kind: "condition",
34135
- id: crypto.randomUUID()
34146
+ id: createUuid$1()
34136
34147
  }]
34137
34148
  });
34138
34149
  const usedFields = computed(() => usedDecisionFields(root.value));
@@ -34748,7 +34759,7 @@ var UnitConversionDialog_default = /* @__PURE__ */ defineComponent({
34748
34759
  setup(__props, { expose: __expose }) {
34749
34760
  const props = __props;
34750
34761
  const draft = reactive(props.initial ? cloneDeep(toRaw(props.initial)) : {
34751
- id: crypto.randomUUID(),
34762
+ id: createUuid$1(),
34752
34763
  mappings: []
34753
34764
  });
34754
34765
  const checked = ref(false);
@@ -37509,7 +37520,7 @@ async function encodeMaterials(entries, previous, lookupProduct) {
37509
37520
  /** 从本次设计快照生成平台独立字段,接口记录身份仅在保存时合并。 */
37510
37521
  async function encodeGctWordTemplateBusiness(document, savedBoms, signal) {
37511
37522
  const editor = new ModelEditor(document, {
37512
- createId: () => crypto.randomUUID(),
37523
+ createId: () => createUuid$1(),
37513
37524
  historyLimit: 0
37514
37525
  });
37515
37526
  try {
@@ -39615,7 +39626,7 @@ function prepareGctWordBusinessFormula(expression, values, context, register, si
39615
39626
  variable = `__gct_word_${"parameter" in definition ? definition.parameter : "deviceRequest"}`;
39616
39627
  while (Object.hasOwn(variables, variable) || expression.includes(variable)) variable += "_";
39617
39628
  variables[variable] = "parameter" in definition ? gctWordParameterLimits(context[definition.parameter]) : {
39618
- requestId: crypto.randomUUID(),
39629
+ requestId: createUuid$1(),
39619
39630
  signal
39620
39631
  };
39621
39632
  names.set(name, variable);
@@ -40089,7 +40100,7 @@ function materialHistory(rows, entries) {
40089
40100
  /** 已配置的物耗表及对象直接从原生结构读取,避免普通表单多发接口请求。 */
40090
40101
  function materialDeclarations(document) {
40091
40102
  const editor = new ModelEditor(document, {
40092
- createId: () => crypto.randomUUID(),
40103
+ createId: () => createUuid$1(),
40093
40104
  historyLimit: 0
40094
40105
  });
40095
40106
  try {
@@ -42687,7 +42698,7 @@ var GctWordTemplateComparison_default = /*#__PURE__*/ _plugin_vue_export_helper_
42687
42698
  const [a, b] = await waitForAbortable(Promise.all([loadGctWordTemplate(left, task.signal), loadGctWordTemplate(right, task.signal)]), task.signal, () => /* @__PURE__ */ new Error("版本对照已取消"));
42688
42699
  if (task.signal.aborted) return;
42689
42700
  const editors = [a, b].map(({ document }) => new ModelEditor(document, {
42690
- createId: () => crypto.randomUUID(),
42701
+ createId: () => createUuid$1(),
42691
42702
  historyLimit: 0
42692
42703
  }));
42693
42704
  try {
@@ -42797,13 +42808,13 @@ var GctWordTemplateComparison_default = /*#__PURE__*/ _plugin_vue_export_helper_
42797
42808
  ], 8, _hoisted_1$3);
42798
42809
  };
42799
42810
  }
42800
- }), [["__scopeId", "data-v-4bf59b23"]]);
42811
+ }), [["__scopeId", "data-v-c0506469"]]);
42801
42812
  // src/adapters/platform/form-history-schema.ts
42802
42813
  /** @file 历史记录与原生绑定之间的纯协议投影,不持有填写值或第二套变更状态。 */
42803
42814
  /** 仅从当前模板读取实际字段及矩阵声明,查询完成立即释放。 */
42804
42815
  function wordHistorySchema(document) {
42805
42816
  const editor = new ModelEditor(document, {
42806
- createId: () => crypto.randomUUID(),
42817
+ createId: () => createUuid$1(),
42807
42818
  historyLimit: 0
42808
42819
  });
42809
42820
  try {
@@ -42866,7 +42877,7 @@ function historyFieldValue(row, field, matrix) {
42866
42877
  /** 模板已经通过原生协议解析,读取时不创建编辑历史。 */
42867
42878
  function openTemplateQuery(document) {
42868
42879
  return new ModelEditor(document, {
42869
- createId: () => crypto.randomUUID(),
42880
+ createId: () => createUuid$1(),
42870
42881
  historyLimit: 0
42871
42882
  });
42872
42883
  }
@@ -43814,7 +43825,7 @@ function useWordFormCommunication(options) {
43814
43825
  function wordValidationFields(document, mainModelKey, issues, modelName) {
43815
43826
  const result = Object.create(null);
43816
43827
  const editor = new ModelEditor(document, {
43817
- createId: () => crypto.randomUUID(),
43828
+ createId: () => createUuid$1(),
43818
43829
  historyLimit: 0
43819
43830
  });
43820
43831
  try {
@@ -43848,7 +43859,7 @@ function wordValidationFields(document, mainModelKey, issues, modelName) {
43848
43859
  /** 仅同一主表印章字段的所有实际绑定都使用同一已配置印章时允许审批用印。 */
43849
43860
  function resolveWordInstanceSealSource(document, fieldKey) {
43850
43861
  const editor = new ModelEditor(document, {
43851
- createId: () => crypto.randomUUID(),
43862
+ createId: () => createUuid$1(),
43852
43863
  historyLimit: 0
43853
43864
  });
43854
43865
  const sources = /* @__PURE__ */ new Set();