@gct-paas/word 0.2.24-beta.1 → 0.2.24-beta.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.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @gct-paas/word v0.2.24-beta.1 */
1
+ /*! @gct-paas/word v0.2.24-beta.2 */
2
2
  import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toValue, unref, useAttrs, useCssVars, useModel, useSlots, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
3
3
  import fa, { PopperWrapper } from "floating-vue";
4
4
  import VueKonva from "vue-konva";
@@ -141203,14 +141203,18 @@ var init_FieldBaseHandler = __esmMin((() => {
141203
141203
  else return dm.get(path);
141204
141204
  }
141205
141205
  static getLabel(ctx, valuePath) {
141206
- const { context } = ctx;
141207
- const dm = context.doc.dataManager;
141208
- if (context.doc.mode === DocModeTypeConst.Edit) {
141209
- const labelPath = dm.getLabelPath(valuePath);
141210
- let value = dm.getDefault(labelPath);
141211
- if (value === void 0) value = dm.getDefault(valuePath);
141212
- return value;
141213
- } else return dm.getLabel(valuePath);
141206
+ const doc = ctx.context.doc;
141207
+ const dm = doc.dataManager;
141208
+ if (doc.mode !== DocModeTypeConst.Edit) return dm.getLabel(valuePath);
141209
+ const label = dm.getDefault(dm.getLabelPath(valuePath));
141210
+ if (label !== void 0) return label;
141211
+ if (!doc.isMockReport) {
141212
+ var _ctx$wr$widgetMeta, _manifest$computed;
141213
+ const fieldType = (_ctx$wr$widgetMeta = ctx.wr.widgetMeta) === null || _ctx$wr$widgetMeta === void 0 || (_ctx$wr$widgetMeta = _ctx$wr$widgetMeta.field) === null || _ctx$wr$widgetMeta === void 0 ? void 0 : _ctx$wr$widgetMeta.fieldType;
141214
+ const manifest = fieldType ? doc.fieldModelQuery.getFieldManifest(fieldType) : void 0;
141215
+ if ((manifest === null || manifest === void 0 || (_manifest$computed = manifest.computed) === null || _manifest$computed === void 0 || (_manifest$computed = _manifest$computed.defaultValueRule) === null || _manifest$computed === void 0 ? void 0 : _manifest$computed.type) === "api") return;
141216
+ }
141217
+ return dm.getDefault(valuePath);
141214
141218
  }
141215
141219
  static getNoValueLabel(ctx) {
141216
141220
  var _widgetMeta$props, _widgetMeta$props2, _widgetMeta$extra;
@@ -151008,12 +151012,13 @@ function getObjectBomDropdownQuery(fieldType, opts) {
151008
151012
  * 表单提交:校验所有物料消耗对象的数量 vs 需求数量
151009
151013
  * - 开了数量校验且需求数量有值才校验
151010
151014
  * - 人为指定:用 objectBom.entries_[0];否则用 bomEntries 中与对象物料匹配的明细
151011
- * - 失败返回与物料消耗表 submitValidate 同类的 field/message 结构
151015
+ * - 收集全部对象的 field/message 错误,无错误返回空数组
151012
151016
  */
151013
151017
  async function validateObjectBomQtyOnSubmit(opts) {
151014
151018
  var _formInstBom$sequence;
151015
151019
  const { formState, objectFieldList, modelFields, formInstBom } = opts;
151016
- if (!formInstBom || !(objectFieldList === null || objectFieldList === void 0 ? void 0 : objectFieldList.length)) return null;
151020
+ const errors = [];
151021
+ if (!formInstBom || !(objectFieldList === null || objectFieldList === void 0 ? void 0 : objectFieldList.length)) return errors;
151017
151022
  const sequential = !!((_formInstBom$sequence = formInstBom.sequenceEntries) === null || _formInstBom$sequence === void 0 || (_formInstBom$sequence = _formInstBom$sequence[0]) === null || _formInstBom$sequence === void 0 ? void 0 : _formInstBom$sequence.enabled_);
151018
151023
  for (const obj of objectFieldList) {
151019
151024
  if (!(obj === null || obj === void 0 ? void 0 : obj.objectField)) continue;
@@ -151039,17 +151044,17 @@ async function validateObjectBomQtyOnSubmit(opts) {
151039
151044
  sequential
151040
151045
  });
151041
151046
  } catch (e) {
151042
- return {
151047
+ errors.push({
151043
151048
  field: qtyKey,
151044
151049
  message: JSON.stringify({
151045
151050
  message: (e === null || e === void 0 ? void 0 : e.message) || String(e),
151046
151051
  showFieldName: qtyFieldName || qtyKey,
151047
151052
  targetFieldId: qtyKey
151048
151053
  })
151049
- };
151054
+ });
151050
151055
  }
151051
151056
  }
151052
- return null;
151057
+ return errors;
151053
151058
  }
151054
151059
  var $t$1, ERR_MATERIAL_NOT_MATCH;
151055
151060
  var init_bom_validator = __esmMin((() => {
@@ -151450,23 +151455,24 @@ async function runValidation(doc, mode, { showComments = true, paths, isSessionC
151450
151455
  const materialConsumeObjectKeys = new Set(modelFields.filter(isMaterialConsumeObjectField).map((field) => field.key));
151451
151456
  const objectFieldList = (((_doc$model = doc.model) === null || _doc$model === void 0 || (_doc$model = _doc$model.document) === null || _doc$model === void 0 || (_doc$model = _doc$model.config) === null || _doc$model === void 0 || (_doc$model = _doc$model.dataInit) === null || _doc$model === void 0 ? void 0 : _doc$model.objectInitialValues) ?? []).filter((item) => materialConsumeObjectKeys.has(item.objectField));
151452
151457
  const formTmplBomController = (_window$TMPL_BOM_CONT2 = window[TMPL_BOM_CONTROLLER]) === null || _window$TMPL_BOM_CONT2 === void 0 ? void 0 : _window$TMPL_BOM_CONT2.value;
151453
- const objectBomError = await validateObjectBomQtyOnSubmit({
151458
+ const objectBomErrors = await validateObjectBomQtyOnSubmit({
151454
151459
  formState: doc.dataManager.getRawData(),
151455
151460
  objectFieldList,
151456
151461
  modelFields,
151457
151462
  formInstBom: formTmplBomController === null || formTmplBomController === void 0 ? void 0 : formTmplBomController.formInstBom
151458
151463
  });
151459
- if (objectBomError) {
151460
- const runtimeValuePath = toRootRuntimeValuePath(objectBomError.field);
151461
- businessResult = { [runtimeValuePath]: [{
151462
- ...objectBomError,
151464
+ for (const error of objectBomErrors) {
151465
+ const runtimeValuePath = toRootRuntimeValuePath(error.field);
151466
+ businessResult ??= {};
151467
+ (businessResult[runtimeValuePath] ??= []).push({
151468
+ ...error,
151463
151469
  field: runtimeValuePath,
151464
151470
  fieldValue: doc.dataManager.get(runtimeValuePath)
151465
- }] };
151466
- result = {
151467
- ...fields ?? {},
151468
- [runtimeValuePath]: [...(fields === null || fields === void 0 ? void 0 : fields[runtimeValuePath]) ?? [], ...businessResult[runtimeValuePath]]
151469
- };
151471
+ });
151472
+ }
151473
+ if (businessResult) {
151474
+ result = { ...fields ?? {} };
151475
+ for (const [runtimeValuePath, errors] of Object.entries(businessResult)) result[runtimeValuePath] = [...result[runtimeValuePath] ?? [], ...errors];
151470
151476
  }
151471
151477
  }
151472
151478
  if (mode === "all") {
@@ -52,19 +52,20 @@ export declare function getObjectBomDropdownQuery(fieldType: string | undefined,
52
52
  } | {
53
53
  'id_.in': string[];
54
54
  } | null;
55
+ export interface ObjectBomQtyError {
56
+ field: string;
57
+ message: string;
58
+ }
55
59
  /**
56
60
  * 表单提交:校验所有物料消耗对象的数量 vs 需求数量
57
61
  * - 开了数量校验且需求数量有值才校验
58
62
  * - 人为指定:用 objectBom.entries_[0];否则用 bomEntries 中与对象物料匹配的明细
59
- * - 失败返回与物料消耗表 submitValidate 同类的 field/message 结构
63
+ * - 收集全部对象的 field/message 错误,无错误返回空数组
60
64
  */
61
65
  export declare function validateObjectBomQtyOnSubmit(opts: {
62
66
  formState: Record<string, any>;
63
67
  objectFieldList?: IMaterialConsumeObjectInfo[];
64
68
  modelFields: readonly FieldMeta[];
65
69
  formInstBom?: FormInstBomResponse | null;
66
- }): Promise<{
67
- field: string;
68
- message: string;
69
- } | null>;
70
+ }): Promise<ObjectBomQtyError[]>;
70
71
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.2.24-beta.1",
3
+ "version": "0.2.24-beta.2",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",