@gct-paas/word 0.1.41 → 0.1.42

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.
@@ -175,8 +175,10 @@ export declare class DataManager {
175
175
  */
176
176
  applyInitData(initDataMap: Record<string, any>): void;
177
177
  /**
178
- * 补齐二维/检验表的关联轴子表(如 f_ewblink / f_jianyan2)到动态关联铺砖槽位数。
179
- * 不处理主体轴(如 f_ewb / f_jianyan1),避免覆盖接口行或误扩纵向轴。
178
+ * 按版面铺砖槽位补齐子表行数:
179
+ * - 固定表:按槽位补齐自身子表行
180
+ * - 二维/检验表:仅补齐关联轴(如 f_ewblink / f_jianyan2)
181
+ * 不处理主体轴(如 f_ewb / f_jianyan1),避免覆盖接口行或误扩纵向轴。
180
182
  */
181
183
  private syncSubTableRowsToLayout;
182
184
  /** 子表在 rawData 中的行数(支持尚未转成数组的 { data: [] } 接口形态,此时返回 0 且不在此阶段强转) */
package/dist/index.es.js CHANGED
@@ -41252,22 +41252,29 @@ class FieldBaseHandler {
41252
41252
  }
41253
41253
  static getNoValueLabel(ctx) {
41254
41254
  const { context, wr } = ctx;
41255
+ const widgetMeta = wr.widgetMeta;
41255
41256
  if (context.doc.mode === DocModeTypeConst.Print) {
41256
- return { label: wr.widgetMeta?.props.emptySymbol ?? "", type: "noneLabel" };
41257
- } else {
41258
- if (wr.widgetMeta?.props?.placeholder) {
41259
- return {
41260
- label: wr.widgetMeta.props.placeholder,
41261
- type: "placeholder"
41262
- };
41263
- } else if (wr.widgetMeta?.extra?.biz?.fieldIdentity?.label) {
41264
- return {
41265
- label: wr.widgetMeta.extra.biz.fieldIdentity.label,
41266
- type: "fieldName"
41267
- };
41268
- }
41257
+ return {
41258
+ label: widgetMeta?.props.emptySymbol ?? "",
41259
+ type: "noneLabel"
41260
+ };
41269
41261
  }
41270
- return {
41262
+ const candidates = [
41263
+ {
41264
+ label: widgetMeta?.props?.newSpecificConfig?.newPlaceholder,
41265
+ type: "placeholder"
41266
+ },
41267
+ {
41268
+ label: widgetMeta?.props?.placeholder,
41269
+ type: "placeholder"
41270
+ },
41271
+ {
41272
+ label: widgetMeta?.extra?.biz?.fieldIdentity?.label,
41273
+ type: "fieldName"
41274
+ }
41275
+ ];
41276
+ const matched = candidates.find((item) => item.label);
41277
+ return matched ?? {
41271
41278
  label: "--",
41272
41279
  type: "default"
41273
41280
  };
@@ -42524,7 +42531,7 @@ const FIELD_TYPE_TO_FW = {
42524
42531
  [FIELD_TYPE.INTEGER]: "fw:number",
42525
42532
  [FIELD_TYPE.LONG]: "fw:number",
42526
42533
  [FIELD_TYPE.DOUBLE]: "fw:double",
42527
- [FIELD_TYPE.DECIMAL]: "fw:double",
42534
+ [FIELD_TYPE.DECIMAL]: "fw:number",
42528
42535
  [FIELD_TYPE.BOOLEAN]: "fw:enum",
42529
42536
  [FIELD_TYPE.DATE]: "fw:date",
42530
42537
  [FIELD_TYPE.DATE_TIME]: "fw:date-time",
@@ -47621,23 +47628,31 @@ class DataManager {
47621
47628
  this.syncSubTableRowsToLayout();
47622
47629
  }
47623
47630
  /**
47624
- * 补齐二维/检验表的关联轴子表(如 f_ewblink / f_jianyan2)到动态关联铺砖槽位数。
47625
- * 不处理主体轴(如 f_ewb / f_jianyan1),避免覆盖接口行或误扩纵向轴。
47631
+ * 按版面铺砖槽位补齐子表行数:
47632
+ * - 固定表:按槽位补齐自身子表行
47633
+ * - 二维/检验表:仅补齐关联轴(如 f_ewblink / f_jianyan2)
47634
+ * 不处理主体轴(如 f_ewb / f_jianyan1),避免覆盖接口行或误扩纵向轴。
47626
47635
  */
47627
47636
  syncSubTableRowsToLayout() {
47628
47637
  const listSubTables = this.doc?.model?.getSubTableInfoList;
47629
47638
  if (typeof listSubTables !== "function") return;
47630
47639
  for (const info of listSubTables.call(this.doc?.model)) {
47631
- if (!info.field || !["check-table-2d-link", "sub-table-2d-link"].includes(info.subType)) {
47640
+ if (!info.field) {
47632
47641
  continue;
47633
47642
  }
47634
- const linkFieldKey = info.field;
47635
- const layoutRows = this.doc?.model?.getSubTableLayoutSlotCount(linkFieldKey) ?? 0;
47643
+ const subTableKey = info.field;
47644
+ const layoutRows = this.doc?.model?.getSubTableLayoutSlotCount(subTableKey) ?? 0;
47636
47645
  if (layoutRows <= 0) continue;
47637
- const dataRows = this.countSubTableDataRows(linkFieldKey);
47646
+ const dataRows = this.countSubTableDataRows(subTableKey);
47638
47647
  const targetRows = Math.max(dataRows, layoutRows);
47639
47648
  if (targetRows <= dataRows) continue;
47640
- this.ensureCheckTableLinkLayoutRows(linkFieldKey, targetRows);
47649
+ if (["check-table-2d-link", "sub-table-2d-link"].includes(info.subType)) {
47650
+ this.ensureCheckTableLinkLayoutRows(subTableKey, targetRows);
47651
+ continue;
47652
+ }
47653
+ if (info.subType === "fixed-table") {
47654
+ this.ensureSubTableRowCount(subTableKey, targetRows, true);
47655
+ }
47641
47656
  }
47642
47657
  }
47643
47658
  /** 子表在 rawData 中的行数(支持尚未转成数组的 { data: [] } 接口形态,此时返回 0 且不在此阶段强转) */
@@ -48242,9 +48257,6 @@ class InteractionManager {
48242
48257
  this.batcher = new Transaction((q2) => {
48243
48258
  this.broadcastChange(q2.type, q2.prev, q2.reason);
48244
48259
  });
48245
- setTimeout(() => {
48246
- this.emitChange("panelData", null);
48247
- });
48248
48260
  }
48249
48261
  /** 获取 interaction */
48250
48262
  get(type4) {
@@ -48588,10 +48600,14 @@ function useInteraction(docRef) {
48588
48600
  "focusAnnotationId",
48589
48601
  "annotationList"
48590
48602
  ];
48603
+ const setState = (type4, value) => {
48604
+ state[type4] = value;
48605
+ };
48591
48606
  interactionTypes.forEach((type4) => {
48592
48607
  try {
48608
+ setState(type4, doc.interactionManager.get(type4));
48593
48609
  const off2 = doc.eventManager.eventBus.on(`${type4}:change`, (payload) => {
48594
- state[type4] = payload?.value ?? null;
48610
+ setState(type4, payload?.value);
48595
48611
  });
48596
48612
  unsubscribes.push(off2);
48597
48613
  } catch {
@@ -100137,6 +100153,63 @@ async function waitForDataManagerSettle() {
100137
100153
  function syncInitRawDataSnapshot(doc) {
100138
100154
  doc.docRuntimeMeta.handleInfo.initRawDataSnapshot = cloneDeep(doc.dataManager.getRawData());
100139
100155
  }
100156
+ function useSpecificConfig(options) {
100157
+ const { widget, fieldInfo } = options;
100158
+ const resolvedFieldInfo = fieldInfo?.value ?? fieldInfo;
100159
+ const specificFieldConfig = resolvedFieldInfo?.specificConfig;
100160
+ const specificConfig = widget.widgetMeta?.props.newSpecificConfig;
100161
+ if (!specificConfig) return;
100162
+ const widgetMeta = widget.widgetMeta;
100163
+ const widgetType = widgetMeta?.type;
100164
+ switch (widgetType) {
100165
+ case "fw:input": {
100166
+ const fieldType = widgetMeta?.field?.fieldType;
100167
+ if (fieldType === FIELD_TYPE.RECORD_NO && specificFieldConfig?.signGenerate === "snRule") {
100168
+ Object.assign(specificConfig, {
100169
+ newDisabled: true,
100170
+ newPlaceholder: "记录单号自动生成,无需填写"
100171
+ });
100172
+ }
100173
+ break;
100174
+ }
100175
+ case "fw:number": {
100176
+ const { digits, rulesForRounding } = specificFieldConfig ?? {};
100177
+ if (digits !== void 0) {
100178
+ specificConfig.digits = digits;
100179
+ }
100180
+ specificConfig.rulesForRounding = rulesForRounding ?? 6;
100181
+ break;
100182
+ }
100183
+ }
100184
+ }
100185
+ function resolveFieldInfo(options) {
100186
+ if (options.fieldInfo) return options.fieldInfo;
100187
+ const runtime = options.ctx?.runtime;
100188
+ const field = options.widget?.widgetMeta?.field;
100189
+ const modelKey = getLastSegment(field?.modelLink);
100190
+ const fieldKey = getLastSegment(field?.fieldLink);
100191
+ if (!runtime || !modelKey || !fieldKey) return void 0;
100192
+ const list = runtime.getFieldList(modelKey) ?? [];
100193
+ return list.find((item) => item.key === fieldKey);
100194
+ }
100195
+ function applyWidgetRuntimeInitializer(options) {
100196
+ const fieldInfo = resolveFieldInfo(options);
100197
+ useSpecificConfig({
100198
+ ...options,
100199
+ fieldInfo
100200
+ });
100201
+ }
100202
+ function useWidgetInitializer(options) {
100203
+ const init2 = (isSupport) => {
100204
+ if (!isSupport) {
100205
+ return;
100206
+ }
100207
+ applyWidgetRuntimeInitializer(options);
100208
+ };
100209
+ return {
100210
+ init: init2
100211
+ };
100212
+ }
100140
100213
  function snapshotDocInfo(docInst) {
100141
100214
  return {
100142
100215
  pages: docInst?.pages ?? [],
@@ -100162,8 +100235,18 @@ async function initializeDocumentEngine(props, payload, result) {
100162
100235
  const runtimeJsonForModel = expandCheckTableRuntimeJson(cloneRuntimeJson, {
100163
100236
  itemCountByRegionId
100164
100237
  });
100238
+ const checkTableRegions = listCheckTableRegionsInRuntimeJson(runtimeJsonForModel);
100239
+ const linkFieldKey = checkTableRegions[0]?.linkFieldKey;
100165
100240
  const docModel = ModelConverter.toModel(runtimeJsonForModel);
100166
100241
  const instances = docModel.getWidgetInstances();
100242
+ if (fillModeType !== DocModeTypeConst.Edit) {
100243
+ instances.forEach((instance2) => {
100244
+ applyWidgetRuntimeInitializer({
100245
+ widget: instance2,
100246
+ ctx: payload.ctx
100247
+ });
100248
+ });
100249
+ }
100167
100250
  const defaultQueryIds = getDefaultQueryIdsByFieldType({
100168
100251
  materialNumber: paramsConfig?.materialNo || requestInfo.materialNo,
100169
100252
  productId: paramsConfig?.productId,
@@ -100178,8 +100261,6 @@ async function initializeDocumentEngine(props, payload, result) {
100178
100261
  defaultQueryIds,
100179
100262
  masterSlaveList
100180
100263
  );
100181
- const checkTableRegions = listCheckTableRegionsInRuntimeJson(runtimeJsonForModel);
100182
- const linkFieldKey = checkTableRegions[0]?.linkFieldKey;
100183
100264
  mergeCheckTableItemInfosIntoDefaults(defaultDataMap, runtimeJsonForModel, checkTableItemInfos, {
100184
100265
  layoutColumnCount: linkFieldKey ? docModel.getSubTableLayoutSlotCount(linkFieldKey) : 0
100185
100266
  });
@@ -102804,30 +102885,6 @@ function useDependency(doc, widget, ctx) {
102804
102885
  initDependency
102805
102886
  };
102806
102887
  }
102807
- function useSpecificConfig(options) {
102808
- const { widget, fieldInfo } = options;
102809
- const widgetType = widget.widgetMeta?.type;
102810
- if (widgetType !== "fw:number") {
102811
- return;
102812
- }
102813
- const specificConfig = widget.widgetMeta.props.newSpecificConfig;
102814
- const digits = fieldInfo?.value?.specificConfig?.digits;
102815
- if (digits !== void 0) {
102816
- specificConfig.digits = digits;
102817
- }
102818
- specificConfig.rulesForRounding = fieldInfo?.value?.specificConfig?.rulesForRounding ?? 6;
102819
- }
102820
- function useWidgetInitializer(options) {
102821
- const init2 = (isSupport) => {
102822
- if (!isSupport) {
102823
- return;
102824
- }
102825
- useSpecificConfig(options);
102826
- };
102827
- return {
102828
- init: init2
102829
- };
102830
- }
102831
102888
  const _sfc_main$2Q = /* @__PURE__ */ defineComponent({
102832
102889
  __name: "overlay-render",
102833
102890
  props: {
@@ -102864,7 +102921,8 @@ const _sfc_main$2Q = /* @__PURE__ */ defineComponent({
102864
102921
  const { init: init2 } = useWidgetInitializer({
102865
102922
  doc: props.doc,
102866
102923
  widget: props.widget,
102867
- fieldInfo
102924
+ fieldInfo,
102925
+ ctx: designCtx
102868
102926
  });
102869
102927
  init2(props.isLastWidgetId);
102870
102928
  const { validateField } = createFormValidator();
@@ -113089,7 +113147,8 @@ const _sfc_main$1X = /* @__PURE__ */ defineComponent({
113089
113147
  showDisabled,
113090
113148
  showReadonly,
113091
113149
  widgetProps,
113092
- widgetType
113150
+ widgetType,
113151
+ fieldMeta
113093
113152
  } = useWidgetStaticAttrs(props.widget);
113094
113153
  const CurrentComp = computed(() => {
113095
113154
  if (widgetType.value === "fw:file") {
@@ -113108,12 +113167,16 @@ const _sfc_main$1X = /* @__PURE__ */ defineComponent({
113108
113167
  const optionValue = computed(() => props.widget?.widgetOption?.value);
113109
113168
  const modelValue = computed({
113110
113169
  get() {
113170
+ let value;
113111
113171
  if (docInst.value.isInEditMode()) {
113112
- const value2 = docInst.value?.dataManager?.getDefault(runtimeValuePath.value);
113113
- return toBoolean(getValue$1(value2, isMultiple.value));
113172
+ value = docInst.value?.dataManager?.getDefault(runtimeValuePath.value);
113173
+ } else {
113174
+ value = docInst.value?.dataManager?.get(runtimeValuePath.value);
113175
+ }
113176
+ if (fieldMeta.value?.fieldType === FIELD_TYPE.BOOLEAN) {
113177
+ value = toBoolean(value);
113114
113178
  }
113115
- const value = docInst.value?.dataManager?.get(runtimeValuePath.value);
113116
- return toBoolean(getValue$1(value, isMultiple.value));
113179
+ return getValue$1(value, isMultiple.value);
113117
113180
  },
113118
113181
  set(v) {
113119
113182
  const data = setValue(v, runtimeValuePath.value, {
@@ -113301,13 +113364,6 @@ const _sfc_main$1U = /* @__PURE__ */ defineComponent({
113301
113364
  () => props.modelId === interCtx.panelData?.modelId || props.modelId === interCtx.hoverModelId
113302
113365
  );
113303
113366
  const colors = computed(() => {
113304
- if (showRequired.value) {
113305
- return {
113306
- text: "#f26c6c",
113307
- line: "#f26c6c",
113308
- bg: isActive.value ? "rgba(255, 230, 230, 1)" : "rgba(255, 242, 242, 1)"
113309
- };
113310
- }
113311
113367
  if (showDisabled.value) {
113312
113368
  return {
113313
113369
  text: "#c9c9c9",
@@ -113322,6 +113378,13 @@ const _sfc_main$1U = /* @__PURE__ */ defineComponent({
113322
113378
  bg: isActive.value ? "#f5f7fa" : "#fafafa"
113323
113379
  };
113324
113380
  }
113381
+ if (showRequired.value) {
113382
+ return {
113383
+ text: "#f26c6c",
113384
+ line: "#f26c6c",
113385
+ bg: isActive.value ? "rgba(255, 230, 230, 1)" : "rgba(255, 242, 242, 1)"
113386
+ };
113387
+ }
113325
113388
  return {
113326
113389
  text: "#999999",
113327
113390
  line: "#999999",
@@ -1,10 +1,12 @@
1
1
  import { Doc } from '../../core';
2
2
  export interface WidgetInitializerOptions {
3
- doc: Doc;
3
+ doc?: Doc;
4
4
  widget: any;
5
5
  fieldInfo?: any;
6
6
  ctx?: any;
7
7
  }
8
+ /** 运行时执行单个 widget 初始化 */
9
+ export declare function applyWidgetRuntimeInitializer(options: WidgetInitializerOptions): void;
8
10
  /** widget 运行时初始化 */
9
11
  export declare function useWidgetInitializer(options: WidgetInitializerOptions): {
10
12
  init: (isSupport: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",