cloud-web-corejs 1.0.54-dev.661 → 1.0.54-dev.663

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.661",
4
+ "version": "1.0.54-dev.663",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -190,6 +190,7 @@ import TableCellWidget from '../../../../../components/xform/form-designer/form-
190
190
  import FieldComponents from '../../../../../components/xform/form-designer/form-widget/field-widget/index';
191
191
  import Draggable from 'vuedraggable';
192
192
  import dataTableMixin from './data-table-mixin.js';
193
+ import { enrichTableColumnsWithLabelIcon } from '../../../utils/tableColumnHelper';
193
194
 
194
195
  export default {
195
196
  name: 'data-table-widget',
@@ -200,6 +201,15 @@ export default {
200
201
  ...FieldComponents
201
202
  },
202
203
  mixins: [dataTableMixin],
204
+ computed: {
205
+ columns() {
206
+ const baseColumns = dataTableMixin.computed.columns.call(this);
207
+ return enrichTableColumnsWithLabelIcon(
208
+ baseColumns,
209
+ this.widget.options.tableColumns || []
210
+ );
211
+ },
212
+ },
203
213
  created() {
204
214
  if(this.widget.options.isNotQueryAllPage===undefined)this.widget.options.isNotQueryAllPage = false;
205
215
  }
@@ -615,6 +615,27 @@
615
615
  <el-option value="#ea5353" label="红"></el-option>
616
616
  </el-select>
617
617
  </el-form-item>
618
+ <el-form-item label-width="0">
619
+ <el-divider class="custom-divider">{{
620
+ i18nt("designer.setting.customLabelIcon")
621
+ }}</el-divider>
622
+ </el-form-item>
623
+ <el-form-item :label="i18nt('designer.setting.labelIconClass')">
624
+ <icon-picker v-model="rowData.labelIconClass"></icon-picker>
625
+ </el-form-item>
626
+ <el-form-item :label="i18nt('designer.setting.labelIconPosition')">
627
+ <el-select v-model="rowData.labelIconPosition" clearable>
628
+ <el-option label="front" value="front"></el-option>
629
+ <el-option label="rear" value="rear"></el-option>
630
+ </el-select>
631
+ </el-form-item>
632
+ <el-form-item :label="i18nt('designer.setting.labelTooltip')">
633
+ <el-input
634
+ type="text"
635
+ v-model="rowData.labelTooltip"
636
+ clearable
637
+ ></el-input>
638
+ </el-form-item>
618
639
  </el-form>
619
640
  </div>
620
641
  <div class="dialog-footer" slot="footer">
@@ -648,6 +669,7 @@ import {
648
669
  } from "../../../../../../components/xform/utils/util";
649
670
  import columnRenderDialog from "./columnRenderDialog.vue";
650
671
  import editTreeButtonGroupConfigDialog from "./edit-tree-button-group-config-dialog.vue";
672
+ import IconPicker from "@base/components/xform/icon-picker/index.vue";
651
673
 
652
674
  let businessOptions = [
653
675
  {
@@ -680,7 +702,11 @@ export default {
680
702
  default: false,
681
703
  },
682
704
  },
683
- components: { columnRenderDialog, editTreeButtonGroupConfigDialog },
705
+ components: {
706
+ columnRenderDialog,
707
+ editTreeButtonGroupConfigDialog,
708
+ IconPicker,
709
+ },
684
710
  inject: ["openWidgetPropertyDialog"],
685
711
  data() {
686
712
  return {
@@ -937,6 +963,7 @@ export default {
937
963
  rowData: null,
938
964
  rowDataIndex: 0,
939
965
  showRowEditDialog: false,
966
+ sourceTableColumnsSnapshot: null,
940
967
  };
941
968
  },
942
969
  beforeDestroy() {
@@ -991,21 +1018,38 @@ export default {
991
1018
  if (!Array.isArray(columns)) {
992
1019
  return [];
993
1020
  }
994
- const skipKeys = ["widget", "editWidget"];
1021
+ const refKeys = ["widget", "editWidget", "widgetList"];
995
1022
  const cloneRow = (row) => {
996
1023
  if (!row || typeof row !== "object") {
997
1024
  return row;
998
1025
  }
999
1026
  const cloned = {};
1000
1027
  Object.keys(row).forEach((key) => {
1001
- if (skipKeys.includes(key)) {
1002
- return;
1003
- }
1004
1028
  const val = row[key];
1005
1029
  if (key === "children" && Array.isArray(val) && val.length) {
1006
1030
  cloned.children = val.map(cloneRow);
1007
1031
  return;
1008
1032
  }
1033
+ if (refKeys.includes(key)) {
1034
+ cloned[key] = val;
1035
+ return;
1036
+ }
1037
+ if (key === "columnOption") {
1038
+ cloned.columnOption = row.widget
1039
+ ? row.widget.options
1040
+ : val !== null && typeof val === "object"
1041
+ ? deepClone(val)
1042
+ : val;
1043
+ return;
1044
+ }
1045
+ if (key === "editColumnOption") {
1046
+ cloned.editColumnOption = row.editWidget
1047
+ ? row.editWidget.options
1048
+ : val !== null && typeof val === "object"
1049
+ ? deepClone(val)
1050
+ : val;
1051
+ return;
1052
+ }
1009
1053
  if (val !== null && typeof val === "object") {
1010
1054
  try {
1011
1055
  cloned[key] = deepClone(val);
@@ -1016,10 +1060,79 @@ export default {
1016
1060
  }
1017
1061
  cloned[key] = val;
1018
1062
  });
1063
+ if (row.widget && !cloned.widget) {
1064
+ cloned.widget = row.widget;
1065
+ }
1066
+ if (row.editWidget && !cloned.editWidget) {
1067
+ cloned.editWidget = row.editWidget;
1068
+ }
1069
+ if (row.widget) {
1070
+ cloned.columnOption = row.widget.options;
1071
+ }
1072
+ if (row.editWidget) {
1073
+ cloned.editColumnOption = row.editWidget.options;
1074
+ }
1019
1075
  return cloned;
1020
1076
  };
1021
1077
  return columns.map(cloneRow);
1022
1078
  },
1079
+ buildColumnWidgetMap(columns, map = {}) {
1080
+ if (!Array.isArray(columns)) {
1081
+ return map;
1082
+ }
1083
+ columns.forEach((col) => {
1084
+ if (col && col.columnId) {
1085
+ map[col.columnId] = col;
1086
+ }
1087
+ if (col.children && col.children.length) {
1088
+ this.buildColumnWidgetMap(col.children, map);
1089
+ }
1090
+ });
1091
+ return map;
1092
+ },
1093
+ restoreColumnWidgetRefs(columns, widgetMap) {
1094
+ if (!Array.isArray(columns)) {
1095
+ return [];
1096
+ }
1097
+ return columns.map((row) => {
1098
+ const next = Object.assign({}, row);
1099
+ const orig = widgetMap[next.columnId];
1100
+ if (orig) {
1101
+ if (!next.widget && orig.widget) {
1102
+ next.widget = orig.widget;
1103
+ }
1104
+ if (!next.editWidget && orig.editWidget) {
1105
+ next.editWidget = orig.editWidget;
1106
+ }
1107
+ if (
1108
+ (!next.widgetList || !next.widgetList.length) &&
1109
+ orig.widgetList &&
1110
+ orig.widgetList.length
1111
+ ) {
1112
+ next.widgetList = orig.widgetList;
1113
+ }
1114
+ }
1115
+ if (next.widget) {
1116
+ next.columnOption = next.widget.options;
1117
+ } else if (orig && orig.widget) {
1118
+ next.widget = orig.widget;
1119
+ next.columnOption = orig.widget.options;
1120
+ }
1121
+ if (next.editWidget) {
1122
+ next.editColumnOption = next.editWidget.options;
1123
+ } else if (orig && orig.editWidget) {
1124
+ next.editWidget = orig.editWidget;
1125
+ next.editColumnOption = orig.editWidget.options;
1126
+ }
1127
+ if (next.children && next.children.length) {
1128
+ next.children = this.restoreColumnWidgetRefs(
1129
+ next.children,
1130
+ widgetMap
1131
+ );
1132
+ }
1133
+ return next;
1134
+ });
1135
+ },
1023
1136
  editFormEventHandler(row, index, eventName) {
1024
1137
  this.curEventRow = row;
1025
1138
  this.curEventName = eventName;
@@ -1050,6 +1163,7 @@ export default {
1050
1163
  },
1051
1164
  onDialogClose() {
1052
1165
  this.tableReady = false;
1166
+ this.sourceTableColumnsSnapshot = null;
1053
1167
  if (this.dragSort) {
1054
1168
  this.dragSort.destroy();
1055
1169
  this.dragSort = null;
@@ -1080,15 +1194,21 @@ export default {
1080
1194
  },
1081
1195
  loadTableData() {
1082
1196
  const source = this.optionModel.tableColumns || [];
1083
- try {
1084
- this.tableData = this.cloneTableColumnsForEdit(source);
1085
- } catch (e) {
1086
- this.tableData = this.$baseLodash.cloneDeep(source);
1087
- }
1197
+ this.sourceTableColumnsSnapshot = source;
1198
+ this.tableData = this.cloneTableColumnsForEdit(source);
1199
+ debugger;
1200
+ let a = 1;
1088
1201
  },
1089
1202
  colSubmit() {
1090
1203
  this.dialogVisible = !1;
1091
- this.optionModel.tableColumns = this.tableData;
1204
+ const widgetMap = this.buildColumnWidgetMap(
1205
+ this.sourceTableColumnsSnapshot || []
1206
+ );
1207
+ this.optionModel.tableColumns = this.restoreColumnWidgetRefs(
1208
+ this.tableData,
1209
+ widgetMap
1210
+ );
1211
+ this.sourceTableColumnsSnapshot = null;
1092
1212
  this.closeHandle();
1093
1213
  },
1094
1214
  openWidgetRenderDialog(row, sourceData) {
@@ -1217,6 +1337,9 @@ export default {
1217
1337
  rowAddShow: null,
1218
1338
  rowEditShow: null,
1219
1339
  utcTransformEnabled: false,
1340
+ labelIconClass: null,
1341
+ labelIconPosition: "front",
1342
+ labelTooltip: null,
1220
1343
  // treeNode: false,
1221
1344
  };
1222
1345
  return row;
@@ -1515,27 +1638,35 @@ export default {
1515
1638
  let type = this.columnFormatMap[formatS];
1516
1639
 
1517
1640
  if (type) {
1518
- // columnSelectedWidget = this.$baseLodash.cloneDeep(this.designer.getFieldWidgetByType(type));
1519
- columnSelectedWidget = this.designer.copyNewFieldWidget(
1520
- this.designer.getFieldWidgetByType(type)
1521
- );
1522
- /*let tmpId = generateId();
1523
- let idVal = row.prop ? row.prop : (type + tmpId);*/
1524
- /*columnSelectedWidget.id = idVal;*/
1525
- // columnSelectedWidget.options.name = idVal;
1526
- /*if (isEdit) {
1527
- columnSelectedWidget.id = "edit_" + row.columnId;
1641
+ const existingWidget = isEdit ? row.editWidget : row.widget;
1642
+ if (!isChange && existingWidget) {
1643
+ columnSelectedWidget = this.$baseLodash.cloneDeep(existingWidget);
1528
1644
  } else {
1529
- columnSelectedWidget.id = row.columnId;
1530
- }*/
1531
- // columnSelectedWidget.id = row.columnId;
1645
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1646
+ this.designer.getFieldWidgetByType(type)
1647
+ );
1648
+ }
1532
1649
  let columnOption;
1533
1650
  if (!isEdit) {
1534
1651
  columnOption = row.columnOption;
1535
1652
  } else {
1536
1653
  columnOption = row.editColumnOption;
1537
1654
  }
1538
- if (!isChange && columnOption && Object.keys(columnOption).length) {
1655
+ if (!isChange && existingWidget) {
1656
+ columnOption = columnSelectedWidget.options;
1657
+ columnOption.required = row.required || false;
1658
+ if ("editDelete" == formatS) {
1659
+ columnOption.hiddenByWf = columnOption.hiddenByWf ?? true;
1660
+ columnOption.prefixIcon =
1661
+ columnOption.prefixIcon || "el-icon-delete";
1662
+ } else if ("editButton" == formatS) {
1663
+ columnOption.prefixIcon = columnOption.prefixIcon || "el-icon-edit";
1664
+ }
1665
+ } else if (
1666
+ !isChange &&
1667
+ columnOption &&
1668
+ Object.keys(columnOption).length
1669
+ ) {
1539
1670
  columnOption.required = row.required || false;
1540
1671
  columnSelectedWidget.options = columnOption;
1541
1672
  if ("editDelete" == formatS) {
@@ -1664,7 +1795,13 @@ export default {
1664
1795
  }
1665
1796
  if (row.formatS == "widgetRender") {
1666
1797
  let formWidgetList = deepClone(this.designer.widgetList);
1667
- let tableData = deepClone(this.tableData);
1798
+ const widgetMap = this.buildColumnWidgetMap(
1799
+ this.sourceTableColumnsSnapshot || this.optionModel.tableColumns || []
1800
+ );
1801
+ let tableData = this.restoreColumnWidgetRefs(
1802
+ this.cloneTableColumnsForEdit(this.tableData),
1803
+ widgetMap
1804
+ );
1668
1805
  let columnId = row.columnId;
1669
1806
 
1670
1807
  let dataTableName = this.optionModel.name;
@@ -1711,7 +1848,11 @@ export default {
1711
1848
  index: index,
1712
1849
  columnEditFields,
1713
1850
  callback: (columnOption) => {
1714
- this.confirmFormatConfigDialog(columnOption, row);
1851
+ this.confirmFormatConfigDialog(
1852
+ columnOption,
1853
+ row,
1854
+ columnSelectedWidget
1855
+ );
1715
1856
  },
1716
1857
  });
1717
1858
  },
@@ -1719,16 +1860,26 @@ export default {
1719
1860
  let o = options.name;
1720
1861
  return (options.keyNameEnabled && options.keyName) || o;
1721
1862
  },
1722
- confirmFormatConfigDialog(columnOption, row) {
1863
+ confirmFormatConfigDialog(columnOption, row, columnSelectedWidget) {
1723
1864
  // let row = this.tableData[this.operateIndex];
1724
1865
  row.columnOption = columnOption;
1725
1866
 
1726
1867
  if (row.widget) {
1727
1868
  row.widget.options = columnOption;
1869
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1870
+ row.widget.widgetList = this.$baseLodash.cloneDeep(
1871
+ columnSelectedWidget.widgetList
1872
+ );
1873
+ }
1728
1874
  } else {
1729
1875
  let type = this.columnFormatMap[row.formatS];
1730
1876
  let fieldWidget = this.designer.createColumnWidget(row, false);
1731
1877
  fieldWidget.options = columnOption;
1878
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1879
+ fieldWidget.widgetList = this.$baseLodash.cloneDeep(
1880
+ columnSelectedWidget.widgetList
1881
+ );
1882
+ }
1732
1883
  row.widget = fieldWidget;
1733
1884
  this.$forceUpdate();
1734
1885
  }
@@ -1758,21 +1909,35 @@ export default {
1758
1909
  index: index,
1759
1910
  columnEditFields,
1760
1911
  callback: (columnOption) => {
1761
- this.confirmEditFormatConfigDialog(columnOption, row);
1912
+ this.confirmEditFormatConfigDialog(
1913
+ columnOption,
1914
+ row,
1915
+ columnSelectedWidget
1916
+ );
1762
1917
  },
1763
1918
  });
1764
1919
  },
1765
- confirmEditFormatConfigDialog(columnOption, row) {
1920
+ confirmEditFormatConfigDialog(columnOption, row, columnSelectedWidget) {
1766
1921
  // let row = this.tableData[this.operateIndex];
1767
1922
  row.editColumnOption = columnOption;
1768
1923
  // row.editWidget.options = columnOption;
1769
1924
 
1770
1925
  if (row.editWidget) {
1771
1926
  row.editWidget.options = columnOption;
1927
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1928
+ row.editWidget.widgetList = this.$baseLodash.cloneDeep(
1929
+ columnSelectedWidget.widgetList
1930
+ );
1931
+ }
1772
1932
  } else {
1773
1933
  let type = this.columnFormatMap[row.editFormatS];
1774
1934
  let fieldWidget = this.designer.createColumnWidget(row, true);
1775
1935
  fieldWidget.options = columnOption;
1936
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1937
+ fieldWidget.widgetList = this.$baseLodash.cloneDeep(
1938
+ columnSelectedWidget.widgetList
1939
+ );
1940
+ }
1776
1941
  row.editWidget = fieldWidget;
1777
1942
  this.$forceUpdate();
1778
1943
  }
@@ -1870,13 +2035,23 @@ export default {
1870
2035
  },
1871
2036
  openRowEditDialog(row, index) {
1872
2037
  this.editRowData = row;
1873
- this.rowData = this.$baseLodash.cloneDeep(row);
2038
+ this.rowData = this.cloneTableColumnsForEdit([row])[0];
1874
2039
  this.rowDataIndex = index;
1875
2040
  this.showRowEditDialog = true;
1876
2041
  },
1877
2042
  submitRowEditDialog() {
1878
- Object.assign(this.editRowData, this.$baseLodash.cloneDeep(this.rowData));
1879
- // this.editRowData = this.$baseLodash.cloneDeep(this.rowData);
2043
+ Object.assign(this.editRowData, this.rowData);
2044
+ if (this.rowData.widget) {
2045
+ this.editRowData.widget = this.rowData.widget;
2046
+ this.editRowData.columnOption = this.rowData.widget.options;
2047
+ }
2048
+ if (this.rowData.editWidget) {
2049
+ this.editRowData.editWidget = this.rowData.editWidget;
2050
+ this.editRowData.editColumnOption = this.rowData.editWidget.options;
2051
+ }
2052
+ if (this.rowData.widgetList && this.rowData.widgetList.length) {
2053
+ this.editRowData.widgetList = this.rowData.widgetList;
2054
+ }
1880
2055
  this.showRowEditDialog = false;
1881
2056
  },
1882
2057
  closeRowEditDialog() {
@@ -15,6 +15,7 @@ import {
15
15
  columnFormatMap,
16
16
  traverseAllWidgetsNew,
17
17
  } from "../../../../components/xform/utils/util";
18
+ import { applyColumnLabelIcon } from "../../../../components/xform/utils/tableColumnHelper";
18
19
  import { tableTreeMixins } from "../../../../mixins/tableTree/index.js";
19
20
 
20
21
  let modules = {};
@@ -750,17 +751,7 @@ modules = {
750
751
  visible: t.show,
751
752
  slots: {},
752
753
  };
753
- if (t.required) {
754
- col.title = col.title;
755
- /* if(!isEditTable){
756
- col.titlePrefix = {
757
- icon: "vxe-cell--required-icon"
758
- }
759
- } */
760
- col.titlePrefix = {
761
- icon: "vxe-cell--required-icon",
762
- };
763
- }
754
+ applyColumnLabelIcon(col, t);
764
755
  if (t.treeNode) {
765
756
  col.treeNode = true;
766
757
  }