cloud-web-corejs 1.0.54-dev.688 → 1.0.54-dev.689
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/package.json +1 -1
- package/src/components/fileLibrary/index.vue +113 -33
- package/src/components/xform/docs//345/220/216/345/217/260/345/255/227/346/256/265/357/274/210/345/212/250/346/200/201/347/224/237/346/210/220/357/274/211JSON /350/257/264/346/230/216.md" +210 -305
- package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +657 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +80 -14
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -13
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +11 -8
- package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +143 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +87 -25
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +5 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +80 -34
- package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +54 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +56 -1
- package/src/components/xform/form-render/container-item/data-table-mixin.js +296 -118
- package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +25 -37
- package/src/components/xform/form-render/container-item/list-h5-item.vue +5 -1
- package/src/components/xform/form-render/indexMixin.js +175 -6
- package/src/components/xform/lang/en-US.js +1 -0
- package/src/components/xform/lang/zh-CN.js +1 -0
- package/src/components/xform/utils/dynamicSchemaUtil.js +312 -0
- package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
- package/src/components/xform/utils/tableColumnHelper.js +21 -1
- package/src/components/xform/utils/util.js +126 -0
|
@@ -14,9 +14,28 @@ import {
|
|
|
14
14
|
loopHandleWidget,
|
|
15
15
|
columnFormatMap,
|
|
16
16
|
getColumnWidgetOptions,
|
|
17
|
+
applyColumnMetaToFieldWidget,
|
|
18
|
+
applyColumnMetaToColumnRow,
|
|
17
19
|
traverseAllWidgetsNew,
|
|
20
|
+
isAttachmentWidgetType,
|
|
21
|
+
isVabsearchMultiWidget,
|
|
18
22
|
} from "../../../../components/xform/utils/util";
|
|
19
|
-
import { applyColumnLabelIcon } from "../../../../components/xform/utils/tableColumnHelper";
|
|
23
|
+
import { applyColumnLabelIcon, resolveColumnRequiredFlag } from "../../../../components/xform/utils/tableColumnHelper";
|
|
24
|
+
import {
|
|
25
|
+
buildCellRequiredHint,
|
|
26
|
+
buildTableCellFormProp,
|
|
27
|
+
getCellFieldKey,
|
|
28
|
+
isCellFieldRequired,
|
|
29
|
+
isEmptyCellValueInRow,
|
|
30
|
+
shouldSkipCellValidation,
|
|
31
|
+
} from "../../../../components/xform/utils/tableCellValidateUtil";
|
|
32
|
+
import {
|
|
33
|
+
buildDynamicSchemaRequestData,
|
|
34
|
+
getDynamicSchemaOption,
|
|
35
|
+
isActionColumnFormat,
|
|
36
|
+
normalizeDynamicColumns as normalizeDynamicColumnList,
|
|
37
|
+
resolveDynamicSchemaResponse,
|
|
38
|
+
} from "../../utils/dynamicSchemaUtil";
|
|
20
39
|
import { tableTreeMixins } from "../../../../mixins/tableTree/index.js";
|
|
21
40
|
|
|
22
41
|
let modules = {};
|
|
@@ -211,9 +230,15 @@ modules = {
|
|
|
211
230
|
return widget ? this.getOptionItemLabelKey(widget) : null;
|
|
212
231
|
},
|
|
213
232
|
getOptionItemValueKey(widget) {
|
|
233
|
+
if (widget?.options?.commonAttributeEnabled) {
|
|
234
|
+
return widget.options.valueKey || "sn";
|
|
235
|
+
}
|
|
214
236
|
return widget.options.valueKey || "value";
|
|
215
237
|
},
|
|
216
238
|
getOptionItemLabelKey(widget) {
|
|
239
|
+
if (widget?.options?.commonAttributeEnabled) {
|
|
240
|
+
return widget.options.labelKey || "value";
|
|
241
|
+
}
|
|
217
242
|
return widget.options.labelKey || "label";
|
|
218
243
|
},
|
|
219
244
|
getTableColumnWidget(obj) {
|
|
@@ -222,7 +247,7 @@ modules = {
|
|
|
222
247
|
},
|
|
223
248
|
isShowColumnStatusWidget(obj, item) {
|
|
224
249
|
let widget = this.getTableColumnWidget(obj);
|
|
225
|
-
let valueKey = widget
|
|
250
|
+
let valueKey = this.getOptionItemValueKey(widget);
|
|
226
251
|
return (
|
|
227
252
|
obj.row[this.getTableColumnWidgetFieldKeyName(obj)] === item[valueKey]
|
|
228
253
|
);
|
|
@@ -272,6 +297,7 @@ modules = {
|
|
|
272
297
|
},
|
|
273
298
|
syncEffectiveColumnWidgetFieldKeys(tableColumns) {
|
|
274
299
|
this.loodHandleColumns(tableColumns, (row) => {
|
|
300
|
+
applyColumnMetaToColumnRow(row);
|
|
275
301
|
this.syncColumnWidgetFieldKey(row, row.widget);
|
|
276
302
|
this.syncColumnWidgetFieldKey(row, row.editWidget);
|
|
277
303
|
});
|
|
@@ -398,6 +424,7 @@ modules = {
|
|
|
398
424
|
formRef.getFieldWidgetByType(type)
|
|
399
425
|
);
|
|
400
426
|
fieldWidget.options = widgetOptions;
|
|
427
|
+
applyColumnMetaToFieldWidget(fieldWidget, row, false);
|
|
401
428
|
row.widget = fieldWidget;
|
|
402
429
|
}
|
|
403
430
|
let type2 = columnFormatMap[row.editFormatS];
|
|
@@ -407,6 +434,7 @@ modules = {
|
|
|
407
434
|
formRef.getFieldWidgetByType(type2)
|
|
408
435
|
);
|
|
409
436
|
fieldWidget.options = editWidgetOptions;
|
|
437
|
+
applyColumnMetaToFieldWidget(fieldWidget, row, true);
|
|
410
438
|
row.editWidget = fieldWidget;
|
|
411
439
|
}
|
|
412
440
|
});
|
|
@@ -506,7 +534,7 @@ modules = {
|
|
|
506
534
|
},
|
|
507
535
|
initValue(val) {
|
|
508
536
|
// this.clearRowWidgets()
|
|
509
|
-
let rows = val || [];
|
|
537
|
+
let rows = this.normalizeTableRows(val || [], false);
|
|
510
538
|
// this.handleNullValue(rows);
|
|
511
539
|
rows.forEach((row, index) => {
|
|
512
540
|
row._X_ROW_KEY = "row_" + generateId();
|
|
@@ -580,15 +608,28 @@ modules = {
|
|
|
580
608
|
}
|
|
581
609
|
}
|
|
582
610
|
},
|
|
611
|
+
normalizeTableRows(rows, defaultValueEnabled = false) {
|
|
612
|
+
if (!Array.isArray(rows) || !rows.length) {
|
|
613
|
+
return rows || [];
|
|
614
|
+
}
|
|
615
|
+
const emptyRow = this.createNewTableData(false, defaultValueEnabled);
|
|
616
|
+
return rows.map((row) => {
|
|
617
|
+
const nextRow = row && typeof row === "object" ? { ...row } : {};
|
|
618
|
+
Object.keys(emptyRow).forEach((key) => {
|
|
619
|
+
if (!Object.prototype.hasOwnProperty.call(nextRow, key)) {
|
|
620
|
+
nextRow[key] = emptyRow[key];
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
if (!nextRow._X_ROW_KEY) {
|
|
624
|
+
nextRow._X_ROW_KEY = "row_" + generateId();
|
|
625
|
+
}
|
|
626
|
+
return nextRow;
|
|
627
|
+
});
|
|
628
|
+
},
|
|
583
629
|
setValue(val) {
|
|
584
630
|
// console.log("rows:",val);
|
|
585
631
|
this.clearRowWidgets();
|
|
586
|
-
let rows = val || [];
|
|
587
|
-
rows.forEach((row, index) => {
|
|
588
|
-
if (!row._X_ROW_KEY) {
|
|
589
|
-
row._X_ROW_KEY = "row_" + generateId();
|
|
590
|
-
}
|
|
591
|
-
});
|
|
632
|
+
let rows = this.normalizeTableRows(val || [], false);
|
|
592
633
|
this.formModel[this.fieldKeyName] = rows;
|
|
593
634
|
let $grid = this.getGridTable();
|
|
594
635
|
this.fieldModel = rows;
|
|
@@ -604,6 +645,169 @@ modules = {
|
|
|
604
645
|
let o = widget.options.name;
|
|
605
646
|
return (widget.options.keyNameEnabled && widget.options.keyName) || o;
|
|
606
647
|
},
|
|
648
|
+
getDatasetRequiredHint() {
|
|
649
|
+
if (this.widget.options.requiredHint) {
|
|
650
|
+
return this.$t1(this.widget.options.requiredHint);
|
|
651
|
+
}
|
|
652
|
+
const label = this.$t1(this.widget.options.label || this.fieldKeyName);
|
|
653
|
+
return this.$t1("[{label}]不能为空", { label });
|
|
654
|
+
},
|
|
655
|
+
validateDatasetRequired() {
|
|
656
|
+
if (!this.widget.options.required || this.widget.options.hidden) {
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
const rows = this.formModel[this.fieldKeyName];
|
|
660
|
+
if (Array.isArray(rows) && rows.length > 0) {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
return this.getDatasetRequiredHint();
|
|
664
|
+
},
|
|
665
|
+
getValidationRows() {
|
|
666
|
+
const formRows = this.formModel[this.fieldKeyName];
|
|
667
|
+
if (Array.isArray(formRows) && formRows.length) {
|
|
668
|
+
return formRows;
|
|
669
|
+
}
|
|
670
|
+
const $grid = this.getGridTable?.();
|
|
671
|
+
if ($grid) {
|
|
672
|
+
return $grid.getTableData()?.fullData || [];
|
|
673
|
+
}
|
|
674
|
+
return [];
|
|
675
|
+
},
|
|
676
|
+
getValidationRowIndex(row, rows, fallbackIndex = 0) {
|
|
677
|
+
if (!row || !Array.isArray(rows)) {
|
|
678
|
+
return fallbackIndex;
|
|
679
|
+
}
|
|
680
|
+
const isTreeTable = this.widget.options.isTreeTable || false;
|
|
681
|
+
if (isTreeTable && row._X_ROW_KEY) {
|
|
682
|
+
const treeIndex = rows.findIndex(
|
|
683
|
+
(item) => item._X_ROW_KEY === row._X_ROW_KEY
|
|
684
|
+
);
|
|
685
|
+
if (treeIndex >= 0) {
|
|
686
|
+
return treeIndex;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const index = rows.indexOf(row);
|
|
690
|
+
return index >= 0 ? index : fallbackIndex;
|
|
691
|
+
},
|
|
692
|
+
collectColumnValidateEntries(column, isEditTable, entries) {
|
|
693
|
+
if (column.widget) {
|
|
694
|
+
entries.push({
|
|
695
|
+
column,
|
|
696
|
+
templateWidget: column.widget,
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
if (isEditTable && column.editWidget) {
|
|
700
|
+
entries.push({
|
|
701
|
+
column,
|
|
702
|
+
templateWidget: column.editWidget,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
if (column.widgetList?.length) {
|
|
706
|
+
loopHandleWidget(column.widgetList, (w) => {
|
|
707
|
+
entries.push({
|
|
708
|
+
column,
|
|
709
|
+
templateWidget: w,
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
resolveRowFieldWidget(row, templateWidget) {
|
|
715
|
+
if (!row || !templateWidget) {
|
|
716
|
+
return templateWidget;
|
|
717
|
+
}
|
|
718
|
+
const schema = this.fieldSchemaMap[row._X_ROW_KEY];
|
|
719
|
+
if (schema && schema[templateWidget.id]) {
|
|
720
|
+
return schema[templateWidget.id];
|
|
721
|
+
}
|
|
722
|
+
return templateWidget;
|
|
723
|
+
},
|
|
724
|
+
locateValidationError(row, propName) {
|
|
725
|
+
const $grid = this.getGridTable?.();
|
|
726
|
+
if ($grid && row) {
|
|
727
|
+
if (typeof $grid.scrollToRow === "function") {
|
|
728
|
+
$grid.scrollToRow(row);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const formRef = this.getFormRef?.();
|
|
732
|
+
const renderForm = formRef?.$refs?.renderForm;
|
|
733
|
+
if (propName && renderForm) {
|
|
734
|
+
renderForm.validateField(propName, () => {});
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
validateCellsRequired() {
|
|
738
|
+
if (this.widget.options.hidden || this.designState) {
|
|
739
|
+
return null;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
const rows = this.getValidationRows();
|
|
743
|
+
if (!rows.length) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const isEditTable = this.widget.options.isEditTable || false;
|
|
748
|
+
const tableColumns = this.widget.options.tableColumns || [];
|
|
749
|
+
const tableFieldKeyName = this.getFieldKeyName(this.widget);
|
|
750
|
+
const columnEntries = [];
|
|
751
|
+
|
|
752
|
+
this.loodHandleColumns(tableColumns, (column) => {
|
|
753
|
+
this.collectColumnValidateEntries(column, isEditTable, columnEntries);
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
757
|
+
const row = rows[rowIndex];
|
|
758
|
+
if (!row) {
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
const seenFieldKeys = new Set();
|
|
762
|
+
|
|
763
|
+
for (const entry of columnEntries) {
|
|
764
|
+
const { column, templateWidget } = entry;
|
|
765
|
+
const fieldWidget = this.resolveRowFieldWidget(row, templateWidget);
|
|
766
|
+
|
|
767
|
+
if (!isCellFieldRequired(column, fieldWidget)) {
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
if (shouldSkipCellValidation(fieldWidget)) {
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
const property = getCellFieldKey(fieldWidget, column);
|
|
775
|
+
const dedupeKey = column.prop || property;
|
|
776
|
+
if (!dedupeKey || seenFieldKeys.has(dedupeKey)) {
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
seenFieldKeys.add(dedupeKey);
|
|
780
|
+
|
|
781
|
+
if (!isEmptyCellValueInRow(row, fieldWidget, column)) {
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
const validationRowIndex = this.getValidationRowIndex(
|
|
786
|
+
row,
|
|
787
|
+
rows,
|
|
788
|
+
rowIndex
|
|
789
|
+
);
|
|
790
|
+
const propName = buildTableCellFormProp(
|
|
791
|
+
tableFieldKeyName,
|
|
792
|
+
validationRowIndex,
|
|
793
|
+
property
|
|
794
|
+
);
|
|
795
|
+
const message = buildCellRequiredHint(
|
|
796
|
+
fieldWidget,
|
|
797
|
+
column,
|
|
798
|
+
this.$t1.bind(this)
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
this.locateValidationError(row, propName);
|
|
802
|
+
return message;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
return null;
|
|
807
|
+
},
|
|
808
|
+
setRequired(required) {
|
|
809
|
+
this.$set(this.widget.options, "required", !!required);
|
|
810
|
+
},
|
|
607
811
|
selectWidget: function (e) {
|
|
608
812
|
this.designer.setSelected(e);
|
|
609
813
|
},
|
|
@@ -719,19 +923,14 @@ modules = {
|
|
|
719
923
|
return result;
|
|
720
924
|
}
|
|
721
925
|
if (Array.isArray(result)) {
|
|
722
|
-
return
|
|
926
|
+
return normalizeDynamicColumnList(result);
|
|
723
927
|
}
|
|
724
928
|
if (typeof result !== "object") {
|
|
725
929
|
return result;
|
|
726
930
|
}
|
|
727
931
|
const normalized = { ...result };
|
|
728
932
|
if (Array.isArray(result.columns)) {
|
|
729
|
-
normalized.columns =
|
|
730
|
-
}
|
|
731
|
-
if (Array.isArray(result.tableColumns)) {
|
|
732
|
-
normalized.tableColumns = this.normalizeDynamicColumns(
|
|
733
|
-
result.tableColumns
|
|
734
|
-
);
|
|
933
|
+
normalized.columns = normalizeDynamicColumnList(result.columns);
|
|
735
934
|
}
|
|
736
935
|
return normalized;
|
|
737
936
|
},
|
|
@@ -796,6 +995,17 @@ modules = {
|
|
|
796
995
|
const effectiveColumns = this.getEffectiveTableColumns(forceDynamic);
|
|
797
996
|
this.attachTableColumnWidgets(effectiveColumns);
|
|
798
997
|
this.syncEffectiveColumnWidgetFieldKeys(effectiveColumns);
|
|
998
|
+
this.afterDynamicColumnsCommonWidget(effectiveColumns);
|
|
999
|
+
},
|
|
1000
|
+
afterDynamicColumnsCommonWidget(tableColumns) {
|
|
1001
|
+
if (this.getDynamicColumnSourceType() === "none") return;
|
|
1002
|
+
const formRef = this.getFormRef();
|
|
1003
|
+
if (!formRef || formRef.designState) return;
|
|
1004
|
+
this.$nextTick(() => {
|
|
1005
|
+
if (formRef.hanldeCommonWidgetForTableColumns) {
|
|
1006
|
+
formRef.hanldeCommonWidgetForTableColumns(tableColumns);
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
799
1009
|
},
|
|
800
1010
|
shouldSkipDynamicColumnsOnInit() {
|
|
801
1011
|
return (
|
|
@@ -836,6 +1046,7 @@ modules = {
|
|
|
836
1046
|
const reloadResult = $grid.reloadColumn(columns);
|
|
837
1047
|
const finish = () => {
|
|
838
1048
|
this.initFieldSchemaData(true);
|
|
1049
|
+
this.afterDynamicColumnsCommonWidget(effectiveColumns);
|
|
839
1050
|
resolve(columns);
|
|
840
1051
|
};
|
|
841
1052
|
if (reloadResult?.then) {
|
|
@@ -879,95 +1090,51 @@ modules = {
|
|
|
879
1090
|
refreshColumnVisible() {
|
|
880
1091
|
return this.applyTableColumnsReload();
|
|
881
1092
|
},
|
|
882
|
-
normalizeDynamicColumnItem(item, index) {
|
|
883
|
-
if (!item || typeof item !== "object") {
|
|
884
|
-
return null;
|
|
885
|
-
}
|
|
886
|
-
const prop =
|
|
887
|
-
item.prop ?? item.field ?? item.name ?? item.key ?? undefined;
|
|
888
|
-
const label = item.label ?? item.title ?? undefined;
|
|
889
|
-
let formatS = item.formatS || item.format || null;
|
|
890
|
-
let editFormatS = item.editFormatS || null;
|
|
891
|
-
const widgetOptions = item.widgetOptions;
|
|
892
|
-
const editWidgetOptions = item.editWidgetOptions;
|
|
893
|
-
|
|
894
|
-
const normalized = {
|
|
895
|
-
...item,
|
|
896
|
-
columnId: item.columnId || `${Date.now()}_${index}`,
|
|
897
|
-
prop,
|
|
898
|
-
label,
|
|
899
|
-
width: item.width ?? 150,
|
|
900
|
-
show: item.show !== false,
|
|
901
|
-
sortable: item.sortable !== false,
|
|
902
|
-
filterable: item.filterable !== false,
|
|
903
|
-
align: item.align || "left",
|
|
904
|
-
formatS,
|
|
905
|
-
editFormatS: editFormatS || undefined,
|
|
906
|
-
widgetOptions,
|
|
907
|
-
editWidgetOptions: editWidgetOptions || undefined,
|
|
908
|
-
};
|
|
909
|
-
delete normalized.columnOption;
|
|
910
|
-
delete normalized.editColumnOption;
|
|
911
|
-
return normalized;
|
|
912
|
-
},
|
|
913
|
-
normalizeDynamicColumns(columns) {
|
|
914
|
-
if (!Array.isArray(columns)) {
|
|
915
|
-
return [];
|
|
916
|
-
}
|
|
917
|
-
return columns
|
|
918
|
-
.map((item, index) => this.normalizeDynamicColumnItem(item, index))
|
|
919
|
-
.filter(Boolean);
|
|
920
|
-
},
|
|
921
1093
|
buildDynamicColumnRequestData(options = {}) {
|
|
922
1094
|
if (options.data !== undefined) {
|
|
923
1095
|
return options.data;
|
|
924
1096
|
}
|
|
925
|
-
const paramScript = this.widget.options.dynamicColumnScriptParam;
|
|
926
|
-
let customParam = {};
|
|
927
|
-
if (paramScript) {
|
|
928
|
-
customParam =
|
|
929
|
-
(this.handleCustomParam &&
|
|
930
|
-
this.handleCustomParam(paramScript)) ||
|
|
931
|
-
this.handleCustomEvent(paramScript) ||
|
|
932
|
-
{};
|
|
933
|
-
}
|
|
934
1097
|
const formRef = this.getFormRef();
|
|
935
1098
|
const reportTemplate = formRef.reportTemplate || {};
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1099
|
+
const paramScript = getDynamicSchemaOption(
|
|
1100
|
+
this.widget.options,
|
|
1101
|
+
"scriptParam"
|
|
1102
|
+
);
|
|
1103
|
+
const handleParam = (script) => {
|
|
1104
|
+
if (this.handleCustomParam) {
|
|
1105
|
+
const customResult = this.handleCustomParam(script);
|
|
1106
|
+
if (
|
|
1107
|
+
customResult &&
|
|
1108
|
+
typeof customResult === "object" &&
|
|
1109
|
+
!Array.isArray(customResult)
|
|
1110
|
+
) {
|
|
1111
|
+
return customResult;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return this.handleCustomEvent(script);
|
|
945
1115
|
};
|
|
1116
|
+
return buildDynamicSchemaRequestData(
|
|
1117
|
+
this.globalModel?.formModel || {},
|
|
1118
|
+
paramScript,
|
|
1119
|
+
handleParam,
|
|
1120
|
+
{
|
|
1121
|
+
formCode: reportTemplate.formCode,
|
|
1122
|
+
formVersion: reportTemplate.formVersion,
|
|
1123
|
+
taBm: this.fieldKeyName,
|
|
1124
|
+
dataId: this.formDataId,
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
946
1127
|
},
|
|
947
1128
|
convertDynamicColumnResponse(res, options = {}) {
|
|
948
1129
|
const convertScript =
|
|
949
|
-
options.convertScript ??
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
return [];
|
|
959
|
-
}
|
|
960
|
-
const objx = res?.objx;
|
|
961
|
-
if (Array.isArray(objx)) {
|
|
962
|
-
return this.normalizeDynamicColumns(objx);
|
|
963
|
-
}
|
|
964
|
-
if (objx?.columns && Array.isArray(objx.columns)) {
|
|
965
|
-
return this.normalizeDynamicColumns(objx.columns);
|
|
966
|
-
}
|
|
967
|
-
if (objx?.tableColumns && Array.isArray(objx.tableColumns)) {
|
|
968
|
-
return this.normalizeDynamicColumns(objx.tableColumns);
|
|
969
|
-
}
|
|
970
|
-
return [];
|
|
1130
|
+
options.convertScript ??
|
|
1131
|
+
getDynamicSchemaOption(this.widget.options, "convert");
|
|
1132
|
+
const items = resolveDynamicSchemaResponse(
|
|
1133
|
+
res,
|
|
1134
|
+
convertScript,
|
|
1135
|
+
this.handleCustomEvent.bind(this)
|
|
1136
|
+
);
|
|
1137
|
+
return normalizeDynamicColumnList(items);
|
|
971
1138
|
},
|
|
972
1139
|
loadDynamicColumns(options = {}) {
|
|
973
1140
|
const source = this.getDynamicColumnSourceType();
|
|
@@ -1197,13 +1364,16 @@ modules = {
|
|
|
1197
1364
|
let tableWidgetName = this.widget.options.name;
|
|
1198
1365
|
let isEditTable = this.widget.options.isEditTable || false;
|
|
1199
1366
|
const createColumn = (t, isChild) => {
|
|
1200
|
-
|
|
1367
|
+
const isActionCol = isActionColumnFormat(t.formatS, t.type);
|
|
1368
|
+
let filterable = isActionCol
|
|
1369
|
+
? t.filterable === true
|
|
1370
|
+
: t.filterable !== false;
|
|
1201
1371
|
let filterType = filterable ? null : false;
|
|
1202
1372
|
let col = {
|
|
1203
1373
|
fixed: !!t.fixed && t.fixed,
|
|
1204
1374
|
field: t.prop,
|
|
1205
1375
|
title: this.getI18nLabel(t.label),
|
|
1206
|
-
sortable: t.sortable,
|
|
1376
|
+
sortable: isActionCol ? t.sortable === true : t.sortable !== false,
|
|
1207
1377
|
filterType,
|
|
1208
1378
|
align: t.align ? t.align : "center",
|
|
1209
1379
|
formatter: this.formatterValue,
|
|
@@ -1283,7 +1453,7 @@ modules = {
|
|
|
1283
1453
|
...columnOption,
|
|
1284
1454
|
widget,
|
|
1285
1455
|
formatS: t.formatS,
|
|
1286
|
-
required: t
|
|
1456
|
+
required: resolveColumnRequiredFlag(t),
|
|
1287
1457
|
columnConfig: t,
|
|
1288
1458
|
editWidget,
|
|
1289
1459
|
utcTransformEnabled:
|
|
@@ -1435,8 +1605,8 @@ modules = {
|
|
|
1435
1605
|
return null;
|
|
1436
1606
|
} else {
|
|
1437
1607
|
let resultList = [];
|
|
1438
|
-
let labelField = fieldWidget
|
|
1439
|
-
let valueField = fieldWidget
|
|
1608
|
+
let labelField = this.getOptionItemLabelKey(fieldWidget);
|
|
1609
|
+
let valueField = this.getOptionItemValueKey(fieldWidget);
|
|
1440
1610
|
fieldWidget.options.optionItems.forEach((oItem) => {
|
|
1441
1611
|
if (
|
|
1442
1612
|
oItem[valueField] === fieldModel ||
|
|
@@ -2366,13 +2536,7 @@ modules = {
|
|
|
2366
2536
|
let rows = res.objx ? res.objx.records || res.objx || [] : [];
|
|
2367
2537
|
|
|
2368
2538
|
// that.handleNullValue(rows);
|
|
2369
|
-
|
|
2370
|
-
rows = rows.map((row) => {
|
|
2371
|
-
return {
|
|
2372
|
-
...defaultRow,
|
|
2373
|
-
...row,
|
|
2374
|
-
};
|
|
2375
|
-
});
|
|
2539
|
+
rows = this.normalizeTableRows(rows, false);
|
|
2376
2540
|
this.initValue(rows);
|
|
2377
2541
|
this.$nextTick(() => {
|
|
2378
2542
|
/*if (this.widget.options.isTreeTable) {
|
|
@@ -2575,13 +2739,18 @@ modules = {
|
|
|
2575
2739
|
defaultValueEnabled !== false
|
|
2576
2740
|
) {
|
|
2577
2741
|
nullValue = defaultValue;
|
|
2742
|
+
} else if (widgetType === "number") {
|
|
2743
|
+
nullValue = undefined;
|
|
2578
2744
|
} else if (widgetType === "select" && widget.options.multiple) {
|
|
2579
2745
|
nullValue = [];
|
|
2580
2746
|
} else if (widgetType === "date" && widget.options.type === "dates") {
|
|
2581
2747
|
nullValue = [];
|
|
2582
2748
|
} else if (widgetType === "vabsearch" && widget.options.multipleChoices) {
|
|
2583
2749
|
nullValue = [];
|
|
2584
|
-
} else if (
|
|
2750
|
+
} else if (
|
|
2751
|
+
multiWidgetTypes.includes(widgetType) ||
|
|
2752
|
+
isAttachmentWidgetType(widgetType)
|
|
2753
|
+
) {
|
|
2585
2754
|
nullValue = [];
|
|
2586
2755
|
}
|
|
2587
2756
|
return nullValue;
|
|
@@ -2594,13 +2763,13 @@ modules = {
|
|
|
2594
2763
|
}
|
|
2595
2764
|
return result;
|
|
2596
2765
|
},
|
|
2597
|
-
handleWidgetNullValue(widget, newData) {
|
|
2766
|
+
handleWidgetNullValue(widget, newData, defaultValueEnabled = true) {
|
|
2598
2767
|
if (!widget || !newData) return;
|
|
2599
2768
|
if (this.getIsFormWidget(widget)) {
|
|
2600
2769
|
let field = this.getFieldKeyName(widget);
|
|
2601
2770
|
let nullValue = newData.hasOwnProperty(field)
|
|
2602
2771
|
? null
|
|
2603
|
-
: this.getColumnNullValue(widget);
|
|
2772
|
+
: this.getColumnNullValue(widget, defaultValueEnabled);
|
|
2604
2773
|
newData[field] = nullValue;
|
|
2605
2774
|
if (this.isSingerlSearch(widget)) {
|
|
2606
2775
|
let vabSearchName = widget.options.vabSearchName;
|
|
@@ -2631,7 +2800,11 @@ modules = {
|
|
|
2631
2800
|
}
|
|
2632
2801
|
} else {
|
|
2633
2802
|
if (widget) {
|
|
2634
|
-
this.handleWidgetNullValue(
|
|
2803
|
+
this.handleWidgetNullValue(
|
|
2804
|
+
widget,
|
|
2805
|
+
newData,
|
|
2806
|
+
defaultValueEnabled
|
|
2807
|
+
);
|
|
2635
2808
|
} else {
|
|
2636
2809
|
newData[item.prop] = null;
|
|
2637
2810
|
}
|
|
@@ -2682,7 +2855,10 @@ modules = {
|
|
|
2682
2855
|
|
|
2683
2856
|
let fieldKeyName = this.getFieldKeyName(this.widget);
|
|
2684
2857
|
let property = this.getFieldKeyName(rowWidget);
|
|
2685
|
-
if (
|
|
2858
|
+
if (
|
|
2859
|
+
this.isVabsearchFlagWidget(rowWidget) &&
|
|
2860
|
+
!isVabsearchMultiWidget(rowWidget)
|
|
2861
|
+
) {
|
|
2686
2862
|
property = rowWidget.options.vabSearchName || property;
|
|
2687
2863
|
}
|
|
2688
2864
|
let rowIndex = Math.max(obj.rowIndex, 0);
|
|
@@ -2745,7 +2921,10 @@ modules = {
|
|
|
2745
2921
|
let rowIndex = $grid.getRowIndex(row);
|
|
2746
2922
|
let fieldKeyName = this.getFieldKeyName(this.widget);
|
|
2747
2923
|
let property = this.getFieldKeyName(widget);
|
|
2748
|
-
if (
|
|
2924
|
+
if (
|
|
2925
|
+
this.isVabsearchFlagWidget(widget) &&
|
|
2926
|
+
!isVabsearchMultiWidget(widget)
|
|
2927
|
+
) {
|
|
2749
2928
|
property = widget.options.vabSearchName || property;
|
|
2750
2929
|
}
|
|
2751
2930
|
let propName = fieldKeyName + "." + rowIndex + "." + property;
|
|
@@ -2779,11 +2958,10 @@ modules = {
|
|
|
2779
2958
|
}
|
|
2780
2959
|
|
|
2781
2960
|
let property = this.getFieldKeyName(fieldWidget);
|
|
2782
|
-
if (
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
if (this.isVabsearchFlagWidget(fieldWidget)) {
|
|
2961
|
+
if (
|
|
2962
|
+
this.isVabsearchFlagWidget(fieldWidget) &&
|
|
2963
|
+
!isVabsearchMultiWidget(fieldWidget)
|
|
2964
|
+
) {
|
|
2787
2965
|
property = fieldWidget.options.vabSearchName || property;
|
|
2788
2966
|
}
|
|
2789
2967
|
let propName = fieldKeyName + "." + rowIndex + "." + property;
|