@indfnd/common 0.0.76 → 0.0.78

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,26 @@
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.78](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.77...v0.0.78) (2024-02-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * 表格小数位展现问题修复 ([998300b](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/998300b7b178209d4be202dc1e0439902aadb804))
11
+
12
+ ### [0.0.77](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.76...v0.0.77) (2024-02-01)
13
+
14
+
15
+ ### Features
16
+
17
+ * 表单和表格的数值增加输入格式限制 ([2316393](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/2316393b24fceee9fd636e592d64c264ab30f00d))
18
+ * 优化数字格式化 ([e244122](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/e2441227b20a1abf4b6ca08bcb6dbb6e1cda9567))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **detail-view:** 修改样式 ([1ef5941](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/1ef594129d256919d5759f2e8a18a0d12e78acab))
24
+
5
25
  ### [0.0.76](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.75...v0.0.76) (2024-01-31)
6
26
 
7
27
 
@@ -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.75";
5
+ const version$1 = "0.0.77";
6
6
  const author = "huxuetong";
7
7
  const publishConfig = {
8
8
  registry: "https://registry.npmjs.org/"
@@ -41,7 +41,7 @@ const scripts = {
41
41
  "release-major": "standard-version --release-as major",
42
42
  "release-minor": "standard-version --release-as minor",
43
43
  "release-patch": "standard-version --release-as patch",
44
- "re-publish": "yarn public --access public"
44
+ "re-publish": "yarn publish --access public"
45
45
  };
46
46
  const dependencies = {
47
47
  classnames: "^2.5.1",
@@ -43138,9 +43138,15 @@ function getAgColumnTitleAndData({ columns, datas }) {
43138
43138
  var columnWidth = columnsCalc.map(
43139
43139
  (d) => d.excelWidth ? d.excelWidth : d.width ? Math.floor(d.width / 10) : 10
43140
43140
  );
43141
- var numberFormat = columnsCalc.map(
43142
- (d) => d.align == "rightNum" ? "#,##0.0000" : d.align == "right" ? "#,##0.00" : ""
43143
- );
43141
+ var numberFormat = columnsCalc.map((d) => {
43142
+ var _a;
43143
+ let scale = (_a = d == null ? void 0 : d.cellRendererParams) == null ? void 0 : _a.scale;
43144
+ if (scale !== void 0) {
43145
+ return "#,##0." + _.range(scale).fill(0).join("");
43146
+ } else {
43147
+ return d.align == "rightNum" ? "#,##0.0000" : d.align == "right" ? "#,##0.00" : "";
43148
+ }
43149
+ });
43144
43150
  columnsCalc.map((d, idx) => {
43145
43151
  d.field = d.field ? d.field : d.key;
43146
43152
  var t2 = d.excelName || d.headerName || d.title;
@@ -48335,6 +48341,9 @@ var FormImpl = {
48335
48341
  message: d.title + "\u4E0D\u80FD\u4E3A\u7A7A",
48336
48342
  trigger: "blur"
48337
48343
  };
48344
+ if (d.validate) {
48345
+ validateTmp.validator = d.validate;
48346
+ }
48338
48347
  if (["number"].includes(d.type)) {
48339
48348
  validateTmp.type = "number";
48340
48349
  } else if (["checkbox", "treeselect", "fileUpload", "imgUpload"].includes(d.type) || "select" === d.type && ((_a = d.props) == null ? void 0 : _a.multiple)) {
@@ -48357,22 +48366,13 @@ var FormImpl = {
48357
48366
  validateTmp.trigger = "custom";
48358
48367
  }
48359
48368
  validateList[d.formKey] = [validateTmp];
48360
- } else if (d.validate) {
48361
- validateList[d.formKey] = [
48362
- {
48363
- required: true,
48364
- validator: d.validate,
48365
- trigger: "blur"
48366
- }
48367
- ];
48368
48369
  }
48369
48370
  if (d.type == "idcard") {
48370
48371
  validateList[d.formKey] = validateList[d.formKey] || [];
48371
48372
  validateList[d.formKey].push({
48372
- required: true,
48373
48373
  validator: (rule, value, callback) => {
48374
48374
  let checkRlt = checkIdCard(value);
48375
- if (checkRlt == "\u9A8C\u8BC1\u901A\u8FC7!") {
48375
+ if (!value || checkRlt == "\u9A8C\u8BC1\u901A\u8FC7!") {
48376
48376
  callback();
48377
48377
  } else {
48378
48378
  callback(new Error(checkRlt));
@@ -48383,9 +48383,8 @@ var FormImpl = {
48383
48383
  } else if (d.type == "vehicleNo") {
48384
48384
  validateList[d.formKey] = validateList[d.formKey] || [];
48385
48385
  validateList[d.formKey].push({
48386
- required: true,
48387
48386
  validator: (rule, value, callback) => {
48388
- if (checkVehicleNo(value)) {
48387
+ if (!value || checkVehicleNo(value)) {
48389
48388
  callback();
48390
48389
  } else {
48391
48390
  callback(new Error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u8F66\u724C\u53F7\u683C\u5F0F"));
@@ -48396,9 +48395,8 @@ var FormImpl = {
48396
48395
  } else if (d.type == "phone") {
48397
48396
  validateList[d.formKey] = validateList[d.formKey] || [];
48398
48397
  validateList[d.formKey].push({
48399
- required: true,
48400
48398
  validator: (rule, value, callback) => {
48401
- if (checkPhone(value)) {
48399
+ if (!value || checkPhone(value)) {
48402
48400
  callback();
48403
48401
  } else {
48404
48402
  callback(new Error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u7535\u8BDD\u683C\u5F0F"));
@@ -48546,18 +48544,30 @@ var FormImpl = {
48546
48544
  case "number": {
48547
48545
  itemInner = h("Input", {
48548
48546
  ref: d.formKey,
48547
+ attrs: {
48548
+ title: ""
48549
+ },
48549
48550
  props: {
48550
48551
  placeholder: `\u8BF7\u8F93\u5165\u6570\u5B57`,
48551
48552
  ...d.props,
48552
- number: true,
48553
48553
  value: this.form[d.formKey],
48554
48554
  disabled,
48555
48555
  type: "number"
48556
48556
  },
48557
48557
  on: {
48558
- input: (val) => {
48559
- this.form[d.formKey] = val;
48558
+ "on-blur": (event) => {
48559
+ var _a2;
48560
+ let v = event.target.value;
48561
+ let formatRlt = /(-?)(\d{1,10})(\d{0,999})(\.\d{1,6})?/.exec(v);
48562
+ if (formatRlt && formatRlt.length) {
48563
+ v = (((_a2 = d == null ? void 0 : d.props) == null ? void 0 : _a2.enableNegative) ? formatRlt[1] : "") + formatRlt[2] + (formatRlt[4] || "");
48564
+ }
48565
+ this.form[d.formKey] = Infinity;
48560
48566
  this.$emit("input", this.form);
48567
+ this.$nextTick(() => {
48568
+ this.form[d.formKey] = parseFloat(v);
48569
+ this.$emit("input", this.form);
48570
+ });
48561
48571
  }
48562
48572
  }
48563
48573
  });
@@ -55229,12 +55239,30 @@ var AgTooltip = /* @__PURE__ */ function() {
55229
55239
  }();
55230
55240
  const __vue2_script$V = {
55231
55241
  render(h) {
55232
- var _a, _b;
55242
+ var _a, _b, _c;
55233
55243
  const rNode = this.params.api.getRowNode(this.params.rowIndex);
55234
55244
  const props = ((_b = (_a = this.params.column.colDef) == null ? void 0 : _a.cellRendererParams) == null ? void 0 : _b.props) || {};
55235
55245
  const { type, disabled: disabledDef, textCondition } = props;
55236
55246
  const disabled = disabledDef instanceof Function ? disabledDef(this.params.data) : disabledDef;
55237
55247
  const isText = textCondition instanceof Function ? textCondition(this.params.data) : textCondition;
55248
+ let { scale } = ((_c = this.params.column.colDef) == null ? void 0 : _c.cellRendererParams) || {};
55249
+ if (this.params.formatCols) {
55250
+ _.forEach(this.params.formatCols, (v, k) => {
55251
+ if (!isNaN(v) && this.params.column.colDef.field == k) {
55252
+ scale = v;
55253
+ }
55254
+ });
55255
+ }
55256
+ const value = this.params.value;
55257
+ let renderVal = value;
55258
+ if (scale == 0) {
55259
+ renderVal = value ? parseInt(value) : value;
55260
+ } else {
55261
+ let cellV = parseFloat(value);
55262
+ if (!isNaN(cellV)) {
55263
+ renderVal = cellV.toFixed(scale);
55264
+ }
55265
+ }
55238
55266
  if (isText) {
55239
55267
  return h(
55240
55268
  "span",
@@ -55248,15 +55276,24 @@ const __vue2_script$V = {
55248
55276
  props: {
55249
55277
  type: "text",
55250
55278
  ...props,
55251
- value: this.params.value,
55279
+ value: renderVal,
55252
55280
  disabled
55253
55281
  },
55254
55282
  on: {
55255
55283
  "on-blur": (event) => {
55256
- rNode.setDataValue(
55257
- this.params.column,
55258
- type == "number" ? parseFloat(event.target.value) : event.target.value
55259
- );
55284
+ let v = event.target.value;
55285
+ let formatRlt = /(-?)(\d{1,10})(\d{0,999})(\.\d{1,6})?/.exec(v);
55286
+ if (formatRlt && formatRlt.length) {
55287
+ v = ((props == null ? void 0 : props.enableNegative) ? formatRlt[1] : "") + formatRlt[2] + (formatRlt[4] || "");
55288
+ }
55289
+ if (type == "number") {
55290
+ rNode.setDataValue(this.params.column, Infinity);
55291
+ this.$nextTick(() => {
55292
+ rNode.setDataValue(this.params.column, parseFloat(v));
55293
+ });
55294
+ } else {
55295
+ rNode.setDataValue(this.params.column, v);
55296
+ }
55260
55297
  }
55261
55298
  },
55262
55299
  class: "ag-input"
@@ -56046,7 +56083,6 @@ const calcData = function(data, options) {
56046
56083
  var astHash = {};
56047
56084
  var precisionHash = {};
56048
56085
  var errRtnHash = {};
56049
- console.log("data", data, "options", options);
56050
56086
  if (options && options.calcRules) {
56051
56087
  options.calcRules.forEach((n) => {
56052
56088
  astHash[n.rltKey] = n.ast;
@@ -56629,16 +56665,7 @@ const __vue2_script$N = {
56629
56665
  if (!_.isEmpty(this.formatCols)) {
56630
56666
  _.forEach(datasClone, (d) => {
56631
56667
  _.forEach(this.formatCols, (v, k) => {
56632
- if (!isNaN(v)) {
56633
- if (v == 0) {
56634
- d[k] = d[k] ? parseInt(d[k]) : d[k];
56635
- } else {
56636
- let cellV = parseFloat(d[k]);
56637
- if (!isNaN(cellV)) {
56638
- d[k] = cellV.toFixed(v);
56639
- }
56640
- }
56641
- } else if (v == "dateFormat") {
56668
+ if (v == "dateFormat") {
56642
56669
  let rltFormat = formatDate$1(d[k] || "");
56643
56670
  d[k] = rltFormat || d[k];
56644
56671
  }
@@ -56742,7 +56769,7 @@ const __vue2_script$N = {
56742
56769
  this.optionDropdownVisible = false;
56743
56770
  },
56744
56771
  tableColumnsInner(columns, isChildren) {
56745
- var _a, _b;
56772
+ var _a, _b, _c;
56746
56773
  let rlt = [];
56747
56774
  for (let i = 0; i < columns.length; i++) {
56748
56775
  let column = columns[i];
@@ -56875,7 +56902,10 @@ const __vue2_script$N = {
56875
56902
  } else {
56876
56903
  return {
56877
56904
  component: agRenderEnum[column.type],
56878
- params: column.cellRendererParams
56905
+ params: {
56906
+ ...column.cellRendererParams,
56907
+ formatCols: this.formatCols
56908
+ }
56879
56909
  };
56880
56910
  }
56881
56911
  };
@@ -56886,13 +56916,16 @@ const __vue2_script$N = {
56886
56916
  } else {
56887
56917
  return {
56888
56918
  component: agRenderEnum[column.type],
56889
- params: column.cellRendererParams
56919
+ params: {
56920
+ ...column.cellRendererParams,
56921
+ formatCols: this.formatCols
56922
+ }
56890
56923
  };
56891
56924
  }
56892
56925
  };
56893
56926
  }
56894
56927
  }
56895
- if (!column.type && column.isSum) {
56928
+ if (!column.type && (column.isSum || ((_a = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a.scale) !== void 0 || column.isSwitchUnit)) {
56896
56929
  agColumn.cellRendererSelector = (params) => {
56897
56930
  var _a2;
56898
56931
  if (params.node.rowPinned) {
@@ -56901,17 +56934,26 @@ const __vue2_script$N = {
56901
56934
  } else {
56902
56935
  return {
56903
56936
  component: "AgFormat",
56904
- params: column.cellRendererParams
56937
+ params: {
56938
+ ...column.cellRendererParams,
56939
+ formatCols: this.formatCols
56940
+ }
56905
56941
  };
56906
56942
  }
56907
56943
  } else {
56908
- return void 0;
56944
+ return {
56945
+ component: "AgFormat",
56946
+ params: {
56947
+ ...column.cellRendererParams,
56948
+ formatCols: this.formatCols
56949
+ }
56950
+ };
56909
56951
  }
56910
56952
  };
56911
56953
  }
56912
56954
  if (column.cellRendererParams) {
56913
56955
  agColumn.cellRendererParams = column.cellRendererParams;
56914
- if (column.type == "input" && ((_b = (_a = column.cellRendererParams) == null ? void 0 : _a.props) == null ? void 0 : _b.number)) {
56956
+ if (column.type == "input" && ((_c = (_b = column.cellRendererParams) == null ? void 0 : _b.props) == null ? void 0 : _c.number)) {
56915
56957
  agColumn.cellDataType = "number";
56916
56958
  }
56917
56959
  }
@@ -57299,7 +57341,7 @@ const __vue2_script$N = {
57299
57341
  });
57300
57342
  });
57301
57343
  }
57302
- this.topRows = _.concat(this.pinnedTopRowData, sumRows);
57344
+ this.topRows = this.pinnedTopRowData ? _.concat(this.pinnedTopRowData, sumRows) : sumRows;
57303
57345
  } else {
57304
57346
  this.topRows = this.pinnedTopRowData;
57305
57347
  }
@@ -63398,9 +63440,9 @@ var render$c = function() {
63398
63440
  var _vm = this;
63399
63441
  var _h = _vm.$createElement;
63400
63442
  var _c = _vm._self._c || _h;
63401
- return _c("div", { ref: "detailView", staticClass: "ind-detail-view ind-flex-column" }, [_vm.isShowHeader ? _c("div", { staticClass: "ind-flex-no-shrink header" }, [_vm.isShowBackBtn ? _c("Button", { attrs: { "bizType": "back" }, on: { "click": function($event) {
63443
+ return _c("div", { ref: "detailView", staticClass: "ind-detail-view ind-flex-column" }, [_vm.isShowHeader ? _c("div", { staticClass: "ind-flex-no-shrink header" }, [_vm.isShowBackBtn ? _c("Button", { staticClass: "back-btn", attrs: { "bizType": "back" }, on: { "click": function($event) {
63402
63444
  _vm.useGoBack ? _vm.goBack() : _vm.$backToMenu();
63403
- } } }, [_vm._v("\u8FD4\u56DE")]) : _vm._e(), _c("span", { staticClass: "title" }, [_vm._v(_vm._s(_vm.customTitle || _vm.title))]), _c("div", [_vm._t("headerButton")], 2)], 1) : _vm._e(), _c("BackTopPanel", { staticClass: "ind-flex-column ind-flex-grow content" }, [_vm._t("default")], 2), _c("div", { staticClass: "ind-flex-no-shrink function-wrapper" }, [_vm._t("footer")], 2)], 1);
63445
+ } } }, [_vm._v("\u8FD4\u56DE")]) : _vm._e(), _c("span", { staticClass: "title" }, [_vm._v(_vm._s(_vm.customTitle || _vm.title))]), _c("div", { staticClass: "header-buttons" }, [_vm._t("headerButton")], 2)], 1) : _vm._e(), _c("BackTopPanel", { staticClass: "ind-flex-column ind-flex-grow content" }, [_vm._t("default")], 2), _c("div", { staticClass: "ind-flex-no-shrink function-wrapper" }, [_vm._t("footer")], 2)], 1);
63404
63446
  };
63405
63447
  var staticRenderFns$c = [];
63406
63448
  const __vue2_script$d = {
@@ -63456,7 +63498,7 @@ var render$b = function() {
63456
63498
  var _vm = this;
63457
63499
  var _h = _vm.$createElement;
63458
63500
  var _c = _vm._self._c || _h;
63459
- return _c("div", { staticClass: "ind-page-view ind-flex-column" }, [_vm.isShowHeader ? _c("div", { staticClass: "ind-flex-no-shrink header" }, [_vm.isShowBackBtn ? _c("Button", { attrs: { "bizType": "back" }, on: { "click": _vm.$backToMenu } }, [_vm._v("\u8FD4\u56DE")]) : _vm._e(), _c("span", { staticClass: "title" }, [_vm._v(_vm._s(_vm.customTitle || _vm.title))]), _c("div", { staticClass: "function-wrapper" }, [_vm._t("headerButton")], 2)], 1) : _vm._e(), _c("LoadingPanel", { staticClass: "ind-flex-column ind-flex-grow content", attrs: { "loading": _vm.loading } }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.topSearch, expression: "$slots.topSearch" }], staticClass: "ind-flex-no-shrink ind-panel top-search-content search" }, [_vm._t("topSearch")], 2), _c("div", { staticClass: "ind-flex-grow body-content" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.leftContent, expression: "$slots.leftContent" }], staticClass: "ind-panel body-left-content" }, [_vm._t("leftContent")], 2), _c("div", { staticClass: "ind-panel ind-flex-column body-right-content" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.search, expression: "$slots.search" }], staticClass: "ind-flex-no-shrink search" }, [_vm._t("search")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.tip, expression: "$slots.tip" }], staticClass: "tip" }, [_vm._t("tip")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots["important-tip"], expression: "$slots['important-tip']" }], staticClass: "important-tip" }, [_c("Icons", { attrs: { "type": "md-information-circle" } }), _vm._t("important-tip")], 2), _c("div", { staticClass: "ind-flex-grow main-content" }, [_vm._t("default")], 2), _c("div", { staticClass: "ind-flex-no-shrink body-right-content-footer" }, [_vm._t("footer")], 2)])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.bottom, expression: "$slots.bottom" }], staticClass: "ind-flex-no-shrink ind-panel bottom" }, [_vm._t("bottom")], 2)])], 1);
63501
+ return _c("div", { staticClass: "ind-page-view ind-flex-column" }, [_vm.isShowHeader ? _c("div", { staticClass: "ind-flex-no-shrink header" }, [_vm.isShowBackBtn ? _c("Button", { staticClass: "back-btn", attrs: { "bizType": "back" }, on: { "click": _vm.$backToMenu } }, [_vm._v("\u8FD4\u56DE")]) : _vm._e(), _c("span", { staticClass: "title" }, [_vm._v(_vm._s(_vm.customTitle || _vm.title))]), _c("div", { staticClass: "function-wrapper" }, [_vm._t("headerButton")], 2)], 1) : _vm._e(), _c("LoadingPanel", { staticClass: "ind-flex-column ind-flex-grow content", attrs: { "loading": _vm.loading } }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.topSearch, expression: "$slots.topSearch" }], staticClass: "ind-flex-no-shrink ind-panel top-search-content search" }, [_vm._t("topSearch")], 2), _c("div", { staticClass: "ind-flex-grow body-content" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.leftContent, expression: "$slots.leftContent" }], staticClass: "ind-panel body-left-content" }, [_vm._t("leftContent")], 2), _c("div", { staticClass: "ind-panel ind-flex-column body-right-content" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.search, expression: "$slots.search" }], staticClass: "ind-flex-no-shrink search" }, [_vm._t("search")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.tip, expression: "$slots.tip" }], staticClass: "tip" }, [_vm._t("tip")], 2), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots["important-tip"], expression: "$slots['important-tip']" }], staticClass: "important-tip" }, [_c("Icons", { attrs: { "type": "md-information-circle" } }), _vm._t("important-tip")], 2), _c("div", { staticClass: "ind-flex-grow main-content" }, [_vm._t("default")], 2), _c("div", { staticClass: "ind-flex-no-shrink body-right-content-footer" }, [_vm._t("footer")], 2)])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.$slots.bottom, expression: "$slots.bottom" }], staticClass: "ind-flex-no-shrink ind-panel bottom" }, [_vm._t("bottom")], 2)])], 1);
63460
63502
  };
63461
63503
  var staticRenderFns$b = [];
63462
63504
  const __vue2_script$c = {