@indfnd/common 0.0.80 → 0.0.81

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.81](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.80...v0.0.81) (2024-02-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * 表格紧凑模式样式修改 ([fe1106b](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/fe1106b66281d0d74fe451d7e9f3e402d27b44d7))
11
+ * 表格组件支持树形展现、树形选择 ([f50dfbd](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/f50dfbdb9326e25f9d4017c6f1322f5561ea1c09))
12
+ * 导出excel兼容枚举定义为空的场景 ([bb86ec9](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/bb86ec90e2a07a998ee3e9179ef76363d46d8609))
13
+
5
14
  ### [0.0.80](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.79...v0.0.80) (2024-02-04)
6
15
 
7
16
 
@@ -2,7 +2,7 @@ import { Button as Button$1, ButtonGroup as ButtonGroup$1, Input, Drawer as Draw
2
2
  import { isNil, useConfig, getLocalStorage, getQuarterNum, formatQuarter, str2Date, isDate, isArray, checkIdCard, checkVehicleNo, checkPhone, getDictMapApi, formatDate as formatDate$1, axios, isFunction, exportJsonToExcel as exportJsonToExcel$1, importJsonFromExcel, getPriceCode, getPriceSeg, getItem, on as on$1, off as off$1, deleteMenuHistoryApi, deleteMenuCollectApi, getMenuHistoryApi, getMenuCollectApi, getCaptchaURL, guid, setLocalStorage, removeLocalStorage, clearSessionStorage, cryptor, getToken, MIME_TYPE, responseInterceptors, config as config$1, setToken, loginApi, clearUserInfoCache, clearPermissionCache, logoutApi, getUserInfoCache, getUserInfoApi, setUserInfoCache, getSessionStorage, setSessionStorage, getAppListApi, getPermissionCache, getPermissionApi, setPermissionCache, menuHistoryApi, addMenuCollectApi, removeMenuCollectApi } from "@indfnd/utils";
3
3
  import Vue$1 from "vue";
4
4
  const name$1 = "@indfnd/common";
5
- const version$1 = "0.0.79";
5
+ const version$1 = "0.0.81";
6
6
  const author = "huxuetong";
7
7
  const publishConfig = {
8
8
  registry: "https://registry.npmjs.org/"
@@ -54,6 +54,7 @@ const dependencies = {
54
54
  const devDependencies = {
55
55
  "@indfnd/utils": "^0.0.33",
56
56
  "ag-grid-community": "^30.1.0",
57
+ "ag-grid-enterprise": "^30.1.0",
57
58
  "ag-grid-vue": "^30.1.0",
58
59
  eslint: "^3.19.0",
59
60
  "eslint-config-prettier": "^8.5.0",
@@ -43037,13 +43038,13 @@ function getAgColumnTitleAndData({ columns, datas }) {
43037
43038
  } else if (d.cellClass.indexOf("enum") != -1) {
43038
43039
  datasClo.forEach((dd) => {
43039
43040
  var _a, _b, _c;
43040
- let enumList = (_a = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _a.enumList;
43041
- let enumData = (_b = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _b.enumData;
43041
+ let enumList = ((_a = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _a.enumList) || [];
43042
+ let enumData = ((_b = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _b.enumData) || {};
43042
43043
  if (enumList) {
43043
- let v = ((_c = _.find(enumList, { K: dd[d.field] })) == null ? void 0 : _c.V) || "";
43044
+ let v = ((_c = _.find(enumList, { K: dd[d.field] })) == null ? void 0 : _c.V) || dd[d.field];
43044
43045
  dd[d.field] = v;
43045
43046
  } else {
43046
- dd[d.field] = enumData[dd[d.field]];
43047
+ dd[d.field] = enumData[dd[d.field]] || dd[d.field];
43047
43048
  }
43048
43049
  });
43049
43050
  }
@@ -49576,8 +49577,11 @@ const __vue2_script$10 = {
49576
49577
  },
49577
49578
  methods: {
49578
49579
  setDefaultItem(item2) {
49580
+ let oldDefault = item2.isDefault;
49579
49581
  _.forEach(this.datas, (d) => d.isDefault = "0");
49580
- item2.isDefault = "1";
49582
+ item2.isDefault = oldDefault == "1" ? "0" : "1";
49583
+ let datasTmp = _.cloneDeep(this.datas);
49584
+ this.datas = datasTmp;
49581
49585
  this.syncToStorage();
49582
49586
  },
49583
49587
  useItem(item2) {
@@ -49611,7 +49615,6 @@ const __vue2_script$10 = {
49611
49615
  },
49612
49616
  {}
49613
49617
  );
49614
- console.log(field.formKey, " enumTmp is", enumTmp);
49615
49618
  if (v instanceof Array) {
49616
49619
  return v.map((d) => enumTmp[d]).join("\u3001");
49617
49620
  } else {
@@ -56117,7 +56120,7 @@ var render$M = function() {
56117
56120
  _vm.checkAllGroup = $$v;
56118
56121
  }, expression: "checkAllGroup" } }, [_vm._l(_vm.columns, function(item2) {
56119
56122
  return [item2.title ? _c("Checkbox", { key: item2.field, attrs: { "label": item2.title } }, [_vm._v(_vm._s(item2.title))]) : _vm._e()];
56120
- }), _c("br"), _c("br"), _vm._v(" \xA0 "), _c("Button", { staticClass: "table-column-select-btn", attrs: { "type": "default" }, on: { "click": _vm.columnSave } }, [_vm._v("\u4FDD \u5B58")]), _vm._v(" \xA0 "), _c("Button", { staticClass: "table-column-select-btn", attrs: { "type": "default" }, on: { "click": _vm.columnClear } }, [_vm._v("\u6E05 \u9664")])], 2)] : _vm._e(), _vm.btnSel != "1" ? _c("Button", { staticStyle: { "position": "absolute", "top": "10px", "right": "10px" }, attrs: { "type": "primary", "icon": "md-close", "size": "small", "title": "\u5173\u95ED" }, on: { "click": _vm.closeTableSettingDropdown } }) : _vm._e()], 2)], 1) : _vm._e()], 1)]) : _vm._e()], 2)], 1), _c("IndLoadingPanel", { attrs: { "loading": _vm.tableLoading } }, [_vm.refreshTable ? _c("ag-grid-vue", _vm._g(_vm._b({ ref: "tableRef", staticClass: "ag-theme-balham", style: { height: _vm.height && !_vm.fullSreen ? _vm.height + "px" : "100%" }, attrs: { "id": "agTable", "suppressCellFocus": true, "suppressMenu": true, "suppressContextMenu": true, "defaultColDef": _vm.defaultColDef, "getRowHeight": _vm.getRowHeight, "rowData": _vm.tableData, "rowSelection": _vm.rowSelection, "columnDefs": _vm.tableColumns, "localeText": _vm.localeText, "singleClickEdit": true, "pinnedTopRowData": _vm.topRows, "pinnedBottomRowData": _vm.pinnedBottomRowData, "suppressRowClickSelection": _vm.suppressRowClickSelection, "suppressRowTransform": true, "stopEditingWhenCellsLoseFocus": true, "getRowClass": _vm.getRowClass, "tooltipShowDelay": 500, "overlayNoRowsTemplate": _vm.overlayNoRowsTemplate }, on: { "sortChanged": _vm.sortChanged, "selection-changed": _vm.selectionChanged, "grid-ready": _vm.onGridReady, "cellClicked": _vm.cellClicked, "cellDoubleClicked": _vm.cellDoubleClicked } }, "ag-grid-vue", _vm.$attrs, false), _vm.$listeners)) : _vm._e()], 1), _c("div", { ref: "bottom" }, [_c("Row", { staticStyle: { "margin-top": "10px" } }, [_c("i-col", { staticStyle: { "text-align": "left" }, attrs: { "span": "18" } }, [_c("Page", { directives: [{ name: "show", rawName: "v-show", value: !_vm.disablePage, expression: "!disablePage" }], attrs: { "size": "small", "total": _vm.totalNumber, "current": _vm.currentPage, "page-size": _vm.limitNumber, "show-sizer": "", "show-total": "", "show-elevator": "" }, on: { "on-change": _vm.onPageChange, "on-page-size-change": _vm.onPageSizeChange } }), _c("span", { directives: [{ name: "show", rawName: "v-show", value: _vm.disablePage, expression: "disablePage" }] }, [_vm._v("\u5171 " + _vm._s(_vm.tableData.length) + " \u6761\u6570\u636E")])], 1)], 1)], 1)], 1);
56123
+ }), _c("br"), _c("br"), _vm._v(" \xA0 "), _c("Button", { staticClass: "table-column-select-btn", attrs: { "type": "default" }, on: { "click": _vm.columnSave } }, [_vm._v("\u4FDD \u5B58")]), _vm._v(" \xA0 "), _c("Button", { staticClass: "table-column-select-btn", attrs: { "type": "default" }, on: { "click": _vm.columnClear } }, [_vm._v("\u6E05 \u9664")])], 2)] : _vm._e(), _vm.btnSel != "1" ? _c("Button", { staticStyle: { "position": "absolute", "top": "10px", "right": "10px" }, attrs: { "type": "primary", "icon": "md-close", "size": "small", "title": "\u5173\u95ED" }, on: { "click": _vm.closeTableSettingDropdown } }) : _vm._e()], 2)], 1) : _vm._e()], 1)]) : _vm._e()], 2)], 1), _c("IndLoadingPanel", { attrs: { "loading": _vm.tableLoading } }, [_vm.refreshTable ? _c("ag-grid-vue", _vm._g(_vm._b({ ref: "tableRef", staticClass: "ag-theme-balham", style: { height: _vm.height && !_vm.fullSreen ? _vm.height + "px" : "100%" }, attrs: { "id": "agTable", "suppressCellFocus": true, "suppressMenu": true, "suppressContextMenu": true, "defaultColDef": _vm.defaultColDef, "getRowHeight": _vm.getRowHeight, "rowData": _vm.tableData, "rowSelection": _vm.rowSelection, "columnDefs": _vm.tableColumns, "localeText": _vm.localeText, "singleClickEdit": true, "pinnedTopRowData": _vm.topRows, "pinnedBottomRowData": _vm.pinnedBottomRowData, "suppressRowClickSelection": _vm.suppressRowClickSelection, "suppressRowTransform": true, "stopEditingWhenCellsLoseFocus": true, "getRowClass": _vm.getRowClass, "tooltipShowDelay": 500, "overlayNoRowsTemplate": _vm.overlayNoRowsTemplate, "treeData": _vm.treeData, "getDataPath": _vm.getDataPath, "autoGroupColumnDef": _vm.autoGroupColumnDef, "groupSelectsChildren": true }, on: { "sortChanged": _vm.sortChanged, "selection-changed": _vm.selectionChanged, "grid-ready": _vm.onGridReady, "cellClicked": _vm.cellClicked, "cellDoubleClicked": _vm.cellDoubleClicked } }, "ag-grid-vue", _vm.$attrs, false), _vm.$listeners)) : _vm._e()], 1), _c("div", { ref: "bottom" }, [_c("Row", { staticStyle: { "margin-top": "10px" } }, [_c("i-col", { staticStyle: { "text-align": "left" }, attrs: { "span": "18" } }, [_c("Page", { directives: [{ name: "show", rawName: "v-show", value: !_vm.disablePage, expression: "!disablePage" }], attrs: { "size": "small", "total": _vm.totalNumber, "current": _vm.currentPage, "page-size": _vm.limitNumber, "show-sizer": "", "show-total": "", "show-elevator": "" }, on: { "on-change": _vm.onPageChange, "on-page-size-change": _vm.onPageSizeChange } }), _c("span", { directives: [{ name: "show", rawName: "v-show", value: _vm.disablePage, expression: "disablePage" }] }, [_vm._v("\u5171 " + _vm._s(_vm.tableData.length) + " \u6761\u6570\u636E")])], 1)], 1)], 1)], 1);
56121
56124
  };
56122
56125
  var staticRenderFns$M = [];
56123
56126
  function suppressNavigation(params) {
@@ -56170,13 +56173,13 @@ function suppressNavigation(params) {
56170
56173
  });
56171
56174
  return suppress;
56172
56175
  }
56173
- function deepEach$2(list, callback) {
56176
+ function deepEach$2(parentNode, list, callback) {
56174
56177
  if (Array.isArray(list) && list.length) {
56175
- _.forEach(list, (node) => {
56178
+ _.forEach(list, (node, idx) => {
56176
56179
  let breakDeep = false;
56177
56180
  if (typeof callback === "function") {
56178
56181
  try {
56179
- const callbackResult = callback(node);
56182
+ const callbackResult = callback(node, parentNode, idx);
56180
56183
  if (typeof callbackResult === "boolean") {
56181
56184
  breakDeep = callbackResult;
56182
56185
  }
@@ -56185,7 +56188,7 @@ function deepEach$2(list, callback) {
56185
56188
  }
56186
56189
  }
56187
56190
  if (!breakDeep) {
56188
- deepEach$2(node.children, callback);
56191
+ deepEach$2(node, node.children, callback);
56189
56192
  }
56190
56193
  });
56191
56194
  }
@@ -56319,9 +56322,11 @@ const __vue2_script$N = {
56319
56322
  type: Number,
56320
56323
  default: 4
56321
56324
  },
56322
- funId: String
56325
+ funId: String,
56326
+ xmlInfo: String
56323
56327
  },
56324
56328
  data() {
56329
+ var _a, _b, _c, _d;
56325
56330
  return {
56326
56331
  tableRef: null,
56327
56332
  refreshTable: true,
@@ -56358,8 +56363,8 @@ const __vue2_script$N = {
56358
56363
  suppressMenu: true,
56359
56364
  wrapHeaderText: this.headerAutoHeight,
56360
56365
  autoHeaderHeight: this.headerAutoHeight,
56361
- wrapText: true,
56362
- autoHeight: true,
56366
+ wrapText: ((_b = (_a = this.$store) == null ? void 0 : _a.getters) == null ? void 0 : _b.getTheme) != "theme1",
56367
+ autoHeight: ((_d = (_c = this.$store) == null ? void 0 : _c.getters) == null ? void 0 : _d.getTheme) != "theme1",
56363
56368
  suppressKeyboardEvent: (params) => {
56364
56369
  return suppressNavigation(params);
56365
56370
  },
@@ -56383,13 +56388,18 @@ const __vue2_script$N = {
56383
56388
  showUnitSwitch: false,
56384
56389
  switchCols: [],
56385
56390
  unitType: this.defaultUnitType || "X",
56386
- topRows: this.pinnedTopRowData || null
56391
+ topRows: this.pinnedTopRowData || null,
56392
+ treeData: false,
56393
+ getDataPath: (data) => {
56394
+ return data.treeLevelFlag;
56395
+ },
56396
+ autoGroupColumnDef: null
56387
56397
  };
56388
56398
  },
56389
56399
  computed: {
56390
56400
  flatColumns() {
56391
56401
  let rlt = [];
56392
- deepEach$2(this.columns, (d) => {
56402
+ deepEach$2(null, this.columns, (d) => {
56393
56403
  rlt.push(d);
56394
56404
  });
56395
56405
  return rlt;
@@ -56558,9 +56568,9 @@ const __vue2_script$N = {
56558
56568
  deep: true
56559
56569
  },
56560
56570
  value: {
56561
- handler(val) {
56562
- this.overlayNoRowsTemplate = '<span style="padding: 10px;">\u6570\u636E\u4E3A\u7A7A</span>';
56571
+ async handler(val) {
56563
56572
  if (!this.updating) {
56573
+ val = await this.renderTreeData(val);
56564
56574
  this.tableData = this.formatDatas(_.cloneDeep(val));
56565
56575
  this.totalNumber = val.length;
56566
56576
  }
@@ -56568,7 +56578,8 @@ const __vue2_script$N = {
56568
56578
  deep: true
56569
56579
  },
56570
56580
  tableData: {
56571
- handler(val) {
56581
+ async handler(val) {
56582
+ this.overlayNoRowsTemplate = '<span style="padding: 10px;">\u6570\u636E\u4E3A\u7A7A</span>';
56572
56583
  this.updating = true;
56573
56584
  this.renderSumRow();
56574
56585
  this.$emit("input", _.cloneDeep(val));
@@ -56637,7 +56648,7 @@ const __vue2_script$N = {
56637
56648
  if (this.$listeners && this.$listeners.cellClicked) {
56638
56649
  this.$listeners.cellClicked(event);
56639
56650
  } else {
56640
- let col = event.colDef;
56651
+ let col = event.colDef || {};
56641
56652
  if (((_a = col == null ? void 0 : col.cellRendererParams) == null ? void 0 : _a.onClick) instanceof Function) {
56642
56653
  col.cellRendererParams.onClick(event.data);
56643
56654
  }
@@ -56647,7 +56658,7 @@ const __vue2_script$N = {
56647
56658
  if (this.$listeners && this.$listeners.cellDoubleClicked) {
56648
56659
  this.$listeners.cellDoubleClicked(event);
56649
56660
  } else {
56650
- let colClicked = event.colDef;
56661
+ let colClicked = event.colDef || {};
56651
56662
  colClicked = _.find(
56652
56663
  this.columns,
56653
56664
  (d) => colClicked.key && d.key == colClicked.key || colClicked.field && d.field == colClicked.field
@@ -56858,14 +56869,14 @@ const __vue2_script$N = {
56858
56869
  agColumn.cellClass = agColumn.cellClass + " ag-center-aligned-cell";
56859
56870
  } else if (column.type == "checkbox") {
56860
56871
  agColumn.headerCheckboxSelection = true;
56861
- agColumn.checkboxSelection = true;
56872
+ agColumn.checkboxSelection = column.checkboxSelection || true;
56862
56873
  agColumn.showDisabledCheckboxes = true;
56863
56874
  this.rowSelection = "multiple";
56864
56875
  agColumn.cellClass = agColumn.cellClass + " ag-center-aligned-cell ind-ag-check-cell";
56865
56876
  this.suppressRowClickSelection = true;
56866
56877
  } else if (column.type == "radio") {
56867
56878
  agColumn.headerCheckboxSelection = false;
56868
- agColumn.checkboxSelection = true;
56879
+ agColumn.checkboxSelection = column.checkboxSelection || true;
56869
56880
  agColumn.showDisabledCheckboxes = true;
56870
56881
  this.rowSelection = "single";
56871
56882
  this.suppressRowClickSelection = false;
@@ -57039,7 +57050,7 @@ const __vue2_script$N = {
57039
57050
  this.sortParams,
57040
57051
  this.searchParams
57041
57052
  )
57042
- ).then((result) => {
57053
+ ).then(async (result) => {
57043
57054
  if (result) {
57044
57055
  this.overlayNoRowsTemplate = '<span style="padding: 10px;">\u6570\u636E\u4E3A\u7A7A</span>';
57045
57056
  this.$emit("on-data-load", result);
@@ -57070,7 +57081,7 @@ const __vue2_script$N = {
57070
57081
  });
57071
57082
  }
57072
57083
  }
57073
- this.tableData = this.formatDatas(data);
57084
+ this.tableData = await this.renderTreeData(this.formatDatas(data));
57074
57085
  this.totalNumber = result.data.total || 0;
57075
57086
  this.$emit("on-data-format-load", result);
57076
57087
  }
@@ -57373,6 +57384,49 @@ const __vue2_script$N = {
57373
57384
  } else {
57374
57385
  this.topRows = this.pinnedTopRowData;
57375
57386
  }
57387
+ },
57388
+ async renderTreeData(val) {
57389
+ var _a;
57390
+ this.treeData = _.some(val, (d) => {
57391
+ var _a2, _b;
57392
+ return ((_a2 = d.children) == null ? void 0 : _a2.length) || ((_b = d.treeLevelFlag) == null ? void 0 : _b.length);
57393
+ });
57394
+ if (this.treeData) {
57395
+ this.renderTreeFlag(val);
57396
+ let rlt = [];
57397
+ deepEach$2(null, val, (d) => {
57398
+ rlt.push(d);
57399
+ });
57400
+ val = rlt;
57401
+ let treeColDef = _.find(this.columns, { tree: true });
57402
+ if (_.isEmpty(treeColDef)) {
57403
+ treeColDef = this.columns[0];
57404
+ }
57405
+ let treeCol = (treeColDef == null ? void 0 : treeColDef.field) || (treeColDef == null ? void 0 : treeColDef.key);
57406
+ let tableColumnTree = _.find(this.tableColumns, { field: treeCol });
57407
+ this.autoGroupColumnDef = {
57408
+ ...tableColumnTree
57409
+ };
57410
+ if ((_a = tableColumnTree == null ? void 0 : tableColumnTree.cellRendererParams) == null ? void 0 : _a.checkbox) {
57411
+ this.rowSelection = "multiple";
57412
+ }
57413
+ let tableColumnsClone = _.cloneDeep(this.tableColumns);
57414
+ this.tableColumns = tableColumnsClone.slice(1);
57415
+ this.refreshTable = false;
57416
+ await this.$nextTick();
57417
+ this.refreshTable = true;
57418
+ }
57419
+ return val;
57420
+ },
57421
+ renderTreeFlag(datas) {
57422
+ let treeColDef = _.find(this.columns, { tree: true });
57423
+ if (_.isEmpty(treeColDef)) {
57424
+ treeColDef = this.columns[0];
57425
+ }
57426
+ let treeCol = (treeColDef == null ? void 0 : treeColDef.field) || (treeColDef == null ? void 0 : treeColDef.key);
57427
+ deepEach$2(null, datas, (d, parentNode, idx) => {
57428
+ d.treeLevelFlag = parentNode ? [...parentNode.treeLevelFlag, d[treeCol]] : [d[treeCol]];
57429
+ });
57376
57430
  }
57377
57431
  },
57378
57432
  components: {
@@ -58076,6 +58130,26 @@ const __vue2_script$J = {
58076
58130
  this.backupTreeData = _.cloneDeep(this.treeData);
58077
58131
  },
58078
58132
  processAncestorNodesExpandStatus() {
58133
+ if (!this.showCheckbox) {
58134
+ deepEach$1(this.treeData, (node) => {
58135
+ let matched = false;
58136
+ deepEach$1(node.children, (child) => {
58137
+ if (child.selected || child.checked || child.expand || node.expand) {
58138
+ return matched = true;
58139
+ }
58140
+ });
58141
+ node.expand = matched;
58142
+ });
58143
+ deepEach$1(this.backupTreeData, (node) => {
58144
+ let matched = false;
58145
+ deepEach$1(node.children, (child) => {
58146
+ if (child.selected || child.checked || child.expand || node.expand) {
58147
+ return matched = true;
58148
+ }
58149
+ });
58150
+ node.expand = matched;
58151
+ });
58152
+ }
58079
58153
  },
58080
58154
  watchDataProp() {
58081
58155
  if (!this.dataApi) {