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

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.662",
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,19 @@ 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);
1088
1199
  },
1089
1200
  colSubmit() {
1090
1201
  this.dialogVisible = !1;
1091
- this.optionModel.tableColumns = this.tableData;
1202
+ const widgetMap = this.buildColumnWidgetMap(
1203
+ this.sourceTableColumnsSnapshot || []
1204
+ );
1205
+ this.optionModel.tableColumns = this.restoreColumnWidgetRefs(
1206
+ this.tableData,
1207
+ widgetMap
1208
+ );
1209
+ this.sourceTableColumnsSnapshot = null;
1092
1210
  this.closeHandle();
1093
1211
  },
1094
1212
  openWidgetRenderDialog(row, sourceData) {
@@ -1217,6 +1335,9 @@ export default {
1217
1335
  rowAddShow: null,
1218
1336
  rowEditShow: null,
1219
1337
  utcTransformEnabled: false,
1338
+ labelIconClass: null,
1339
+ labelIconPosition: "front",
1340
+ labelTooltip: null,
1220
1341
  // treeNode: false,
1221
1342
  };
1222
1343
  return row;
@@ -1515,27 +1636,32 @@ export default {
1515
1636
  let type = this.columnFormatMap[formatS];
1516
1637
 
1517
1638
  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;
1639
+ const existingWidget = isEdit ? row.editWidget : row.widget;
1640
+ if (!isChange && existingWidget) {
1641
+ columnSelectedWidget = this.$baseLodash.cloneDeep(existingWidget);
1528
1642
  } else {
1529
- columnSelectedWidget.id = row.columnId;
1530
- }*/
1531
- // columnSelectedWidget.id = row.columnId;
1643
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1644
+ this.designer.getFieldWidgetByType(type)
1645
+ );
1646
+ }
1532
1647
  let columnOption;
1533
1648
  if (!isEdit) {
1534
1649
  columnOption = row.columnOption;
1535
1650
  } else {
1536
1651
  columnOption = row.editColumnOption;
1537
1652
  }
1538
- if (!isChange && columnOption && Object.keys(columnOption).length) {
1653
+ if (!isChange && existingWidget) {
1654
+ columnOption = columnSelectedWidget.options;
1655
+ columnOption.required = row.required || false;
1656
+ if ("editDelete" == formatS) {
1657
+ columnOption.hiddenByWf = columnOption.hiddenByWf ?? true;
1658
+ columnOption.prefixIcon =
1659
+ columnOption.prefixIcon || "el-icon-delete";
1660
+ } else if ("editButton" == formatS) {
1661
+ columnOption.prefixIcon =
1662
+ columnOption.prefixIcon || "el-icon-edit";
1663
+ }
1664
+ } else if (!isChange && columnOption && Object.keys(columnOption).length) {
1539
1665
  columnOption.required = row.required || false;
1540
1666
  columnSelectedWidget.options = columnOption;
1541
1667
  if ("editDelete" == formatS) {
@@ -1664,7 +1790,15 @@ export default {
1664
1790
  }
1665
1791
  if (row.formatS == "widgetRender") {
1666
1792
  let formWidgetList = deepClone(this.designer.widgetList);
1667
- let tableData = deepClone(this.tableData);
1793
+ const widgetMap = this.buildColumnWidgetMap(
1794
+ this.sourceTableColumnsSnapshot
1795
+ || this.optionModel.tableColumns
1796
+ || []
1797
+ );
1798
+ let tableData = this.restoreColumnWidgetRefs(
1799
+ this.cloneTableColumnsForEdit(this.tableData),
1800
+ widgetMap
1801
+ );
1668
1802
  let columnId = row.columnId;
1669
1803
 
1670
1804
  let dataTableName = this.optionModel.name;
@@ -1711,7 +1845,7 @@ export default {
1711
1845
  index: index,
1712
1846
  columnEditFields,
1713
1847
  callback: (columnOption) => {
1714
- this.confirmFormatConfigDialog(columnOption, row);
1848
+ this.confirmFormatConfigDialog(columnOption, row, columnSelectedWidget);
1715
1849
  },
1716
1850
  });
1717
1851
  },
@@ -1719,16 +1853,26 @@ export default {
1719
1853
  let o = options.name;
1720
1854
  return (options.keyNameEnabled && options.keyName) || o;
1721
1855
  },
1722
- confirmFormatConfigDialog(columnOption, row) {
1856
+ confirmFormatConfigDialog(columnOption, row, columnSelectedWidget) {
1723
1857
  // let row = this.tableData[this.operateIndex];
1724
1858
  row.columnOption = columnOption;
1725
1859
 
1726
1860
  if (row.widget) {
1727
1861
  row.widget.options = columnOption;
1862
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1863
+ row.widget.widgetList = this.$baseLodash.cloneDeep(
1864
+ columnSelectedWidget.widgetList
1865
+ );
1866
+ }
1728
1867
  } else {
1729
1868
  let type = this.columnFormatMap[row.formatS];
1730
1869
  let fieldWidget = this.designer.createColumnWidget(row, false);
1731
1870
  fieldWidget.options = columnOption;
1871
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1872
+ fieldWidget.widgetList = this.$baseLodash.cloneDeep(
1873
+ columnSelectedWidget.widgetList
1874
+ );
1875
+ }
1732
1876
  row.widget = fieldWidget;
1733
1877
  this.$forceUpdate();
1734
1878
  }
@@ -1758,21 +1902,35 @@ export default {
1758
1902
  index: index,
1759
1903
  columnEditFields,
1760
1904
  callback: (columnOption) => {
1761
- this.confirmEditFormatConfigDialog(columnOption, row);
1905
+ this.confirmEditFormatConfigDialog(
1906
+ columnOption,
1907
+ row,
1908
+ columnSelectedWidget
1909
+ );
1762
1910
  },
1763
1911
  });
1764
1912
  },
1765
- confirmEditFormatConfigDialog(columnOption, row) {
1913
+ confirmEditFormatConfigDialog(columnOption, row, columnSelectedWidget) {
1766
1914
  // let row = this.tableData[this.operateIndex];
1767
1915
  row.editColumnOption = columnOption;
1768
1916
  // row.editWidget.options = columnOption;
1769
1917
 
1770
1918
  if (row.editWidget) {
1771
1919
  row.editWidget.options = columnOption;
1920
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1921
+ row.editWidget.widgetList = this.$baseLodash.cloneDeep(
1922
+ columnSelectedWidget.widgetList
1923
+ );
1924
+ }
1772
1925
  } else {
1773
1926
  let type = this.columnFormatMap[row.editFormatS];
1774
1927
  let fieldWidget = this.designer.createColumnWidget(row, true);
1775
1928
  fieldWidget.options = columnOption;
1929
+ if (columnSelectedWidget && columnSelectedWidget.widgetList) {
1930
+ fieldWidget.widgetList = this.$baseLodash.cloneDeep(
1931
+ columnSelectedWidget.widgetList
1932
+ );
1933
+ }
1776
1934
  row.editWidget = fieldWidget;
1777
1935
  this.$forceUpdate();
1778
1936
  }
@@ -1870,13 +2028,23 @@ export default {
1870
2028
  },
1871
2029
  openRowEditDialog(row, index) {
1872
2030
  this.editRowData = row;
1873
- this.rowData = this.$baseLodash.cloneDeep(row);
2031
+ this.rowData = this.cloneTableColumnsForEdit([row])[0];
1874
2032
  this.rowDataIndex = index;
1875
2033
  this.showRowEditDialog = true;
1876
2034
  },
1877
2035
  submitRowEditDialog() {
1878
- Object.assign(this.editRowData, this.$baseLodash.cloneDeep(this.rowData));
1879
- // this.editRowData = this.$baseLodash.cloneDeep(this.rowData);
2036
+ Object.assign(this.editRowData, this.rowData);
2037
+ if (this.rowData.widget) {
2038
+ this.editRowData.widget = this.rowData.widget;
2039
+ this.editRowData.columnOption = this.rowData.widget.options;
2040
+ }
2041
+ if (this.rowData.editWidget) {
2042
+ this.editRowData.editWidget = this.rowData.editWidget;
2043
+ this.editRowData.editColumnOption = this.rowData.editWidget.options;
2044
+ }
2045
+ if (this.rowData.widgetList && this.rowData.widgetList.length) {
2046
+ this.editRowData.widgetList = this.rowData.widgetList;
2047
+ }
1880
2048
  this.showRowEditDialog = false;
1881
2049
  },
1882
2050
  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
  }