@indfnd/common 0.0.76 → 0.0.77

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,19 @@
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.77](http://git.inspur.com/imp-ec/ind-front/ind-common-front/compare/v0.0.76...v0.0.77) (2024-02-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * 表单和表格的数值增加输入格式限制 ([2316393](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/2316393b24fceee9fd636e592d64c264ab30f00d))
11
+ * 优化数字格式化 ([e244122](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/e2441227b20a1abf4b6ca08bcb6dbb6e1cda9567))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **detail-view:** 修改样式 ([1ef5941](http://git.inspur.com/imp-ec/ind-front/ind-common-front/commit/1ef594129d256919d5759f2e8a18a0d12e78acab))
17
+
5
18
  ### [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
19
 
7
20
 
@@ -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.76";
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;
@@ -48546,18 +48552,30 @@ var FormImpl = {
48546
48552
  case "number": {
48547
48553
  itemInner = h("Input", {
48548
48554
  ref: d.formKey,
48555
+ attrs: {
48556
+ title: ""
48557
+ },
48549
48558
  props: {
48550
48559
  placeholder: `\u8BF7\u8F93\u5165\u6570\u5B57`,
48551
48560
  ...d.props,
48552
- number: true,
48553
48561
  value: this.form[d.formKey],
48554
48562
  disabled,
48555
48563
  type: "number"
48556
48564
  },
48557
48565
  on: {
48558
- input: (val) => {
48559
- this.form[d.formKey] = val;
48566
+ "on-blur": (event) => {
48567
+ var _a2;
48568
+ let v = event.target.value;
48569
+ let formatRlt = /(-?)(\d{1,10})(\d{0,999})(\.\d{1,6})?/.exec(v);
48570
+ if (formatRlt && formatRlt.length) {
48571
+ v = (((_a2 = d == null ? void 0 : d.props) == null ? void 0 : _a2.enableNegative) ? formatRlt[1] : "") + formatRlt[2] + (formatRlt[4] || "");
48572
+ }
48573
+ this.form[d.formKey] = Infinity;
48560
48574
  this.$emit("input", this.form);
48575
+ this.$nextTick(() => {
48576
+ this.form[d.formKey] = parseFloat(v);
48577
+ this.$emit("input", this.form);
48578
+ });
48561
48579
  }
48562
48580
  }
48563
48581
  });
@@ -55229,12 +55247,30 @@ var AgTooltip = /* @__PURE__ */ function() {
55229
55247
  }();
55230
55248
  const __vue2_script$V = {
55231
55249
  render(h) {
55232
- var _a, _b;
55250
+ var _a, _b, _c;
55233
55251
  const rNode = this.params.api.getRowNode(this.params.rowIndex);
55234
55252
  const props = ((_b = (_a = this.params.column.colDef) == null ? void 0 : _a.cellRendererParams) == null ? void 0 : _b.props) || {};
55235
55253
  const { type, disabled: disabledDef, textCondition } = props;
55236
55254
  const disabled = disabledDef instanceof Function ? disabledDef(this.params.data) : disabledDef;
55237
55255
  const isText = textCondition instanceof Function ? textCondition(this.params.data) : textCondition;
55256
+ let { scale } = ((_c = this.params.column.colDef) == null ? void 0 : _c.cellRendererParams) || {};
55257
+ if (this.params.formatCols) {
55258
+ _.forEach(this.params.formatCols, (v, k) => {
55259
+ if (!isNaN(v) && this.params.column.colDef.field == k) {
55260
+ scale = v;
55261
+ }
55262
+ });
55263
+ }
55264
+ const value = this.params.value;
55265
+ let renderVal = value;
55266
+ if (scale == 0) {
55267
+ renderVal = value ? parseInt(value) : value;
55268
+ } else {
55269
+ let cellV = parseFloat(value);
55270
+ if (!isNaN(cellV)) {
55271
+ renderVal = cellV.toFixed(scale);
55272
+ }
55273
+ }
55238
55274
  if (isText) {
55239
55275
  return h(
55240
55276
  "span",
@@ -55248,15 +55284,24 @@ const __vue2_script$V = {
55248
55284
  props: {
55249
55285
  type: "text",
55250
55286
  ...props,
55251
- value: this.params.value,
55287
+ value: renderVal,
55252
55288
  disabled
55253
55289
  },
55254
55290
  on: {
55255
55291
  "on-blur": (event) => {
55256
- rNode.setDataValue(
55257
- this.params.column,
55258
- type == "number" ? parseFloat(event.target.value) : event.target.value
55259
- );
55292
+ let v = event.target.value;
55293
+ let formatRlt = /(-?)(\d{1,10})(\d{0,999})(\.\d{1,6})?/.exec(v);
55294
+ if (formatRlt && formatRlt.length) {
55295
+ v = ((props == null ? void 0 : props.enableNegative) ? formatRlt[1] : "") + formatRlt[2] + (formatRlt[4] || "");
55296
+ }
55297
+ if (type == "number") {
55298
+ rNode.setDataValue(this.params.column, Infinity);
55299
+ this.$nextTick(() => {
55300
+ rNode.setDataValue(this.params.column, parseFloat(v));
55301
+ });
55302
+ } else {
55303
+ rNode.setDataValue(this.params.column, v);
55304
+ }
55260
55305
  }
55261
55306
  },
55262
55307
  class: "ag-input"
@@ -56046,7 +56091,6 @@ const calcData = function(data, options) {
56046
56091
  var astHash = {};
56047
56092
  var precisionHash = {};
56048
56093
  var errRtnHash = {};
56049
- console.log("data", data, "options", options);
56050
56094
  if (options && options.calcRules) {
56051
56095
  options.calcRules.forEach((n) => {
56052
56096
  astHash[n.rltKey] = n.ast;
@@ -56629,16 +56673,7 @@ const __vue2_script$N = {
56629
56673
  if (!_.isEmpty(this.formatCols)) {
56630
56674
  _.forEach(datasClone, (d) => {
56631
56675
  _.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") {
56676
+ if (v == "dateFormat") {
56642
56677
  let rltFormat = formatDate$1(d[k] || "");
56643
56678
  d[k] = rltFormat || d[k];
56644
56679
  }
@@ -56742,7 +56777,7 @@ const __vue2_script$N = {
56742
56777
  this.optionDropdownVisible = false;
56743
56778
  },
56744
56779
  tableColumnsInner(columns, isChildren) {
56745
- var _a, _b;
56780
+ var _a, _b, _c;
56746
56781
  let rlt = [];
56747
56782
  for (let i = 0; i < columns.length; i++) {
56748
56783
  let column = columns[i];
@@ -56875,7 +56910,10 @@ const __vue2_script$N = {
56875
56910
  } else {
56876
56911
  return {
56877
56912
  component: agRenderEnum[column.type],
56878
- params: column.cellRendererParams
56913
+ params: {
56914
+ ...column.cellRendererParams,
56915
+ formatCols: this.formatCols
56916
+ }
56879
56917
  };
56880
56918
  }
56881
56919
  };
@@ -56892,7 +56930,7 @@ const __vue2_script$N = {
56892
56930
  };
56893
56931
  }
56894
56932
  }
56895
- if (!column.type && column.isSum) {
56933
+ if (!column.type && (column.isSum || ((_a = column == null ? void 0 : column.cellRendererParams) == null ? void 0 : _a.scale) !== void 0)) {
56896
56934
  agColumn.cellRendererSelector = (params) => {
56897
56935
  var _a2;
56898
56936
  if (params.node.rowPinned) {
@@ -56901,17 +56939,26 @@ const __vue2_script$N = {
56901
56939
  } else {
56902
56940
  return {
56903
56941
  component: "AgFormat",
56904
- params: column.cellRendererParams
56942
+ params: {
56943
+ ...column.cellRendererParams,
56944
+ formatCols: this.formatCols
56945
+ }
56905
56946
  };
56906
56947
  }
56907
56948
  } else {
56908
- return void 0;
56949
+ return {
56950
+ component: "AgFormat",
56951
+ params: {
56952
+ ...column.cellRendererParams,
56953
+ formatCols: this.formatCols
56954
+ }
56955
+ };
56909
56956
  }
56910
56957
  };
56911
56958
  }
56912
56959
  if (column.cellRendererParams) {
56913
56960
  agColumn.cellRendererParams = column.cellRendererParams;
56914
- if (column.type == "input" && ((_b = (_a = column.cellRendererParams) == null ? void 0 : _a.props) == null ? void 0 : _b.number)) {
56961
+ if (column.type == "input" && ((_c = (_b = column.cellRendererParams) == null ? void 0 : _b.props) == null ? void 0 : _c.number)) {
56915
56962
  agColumn.cellDataType = "number";
56916
56963
  }
56917
56964
  }
@@ -57299,7 +57346,7 @@ const __vue2_script$N = {
57299
57346
  });
57300
57347
  });
57301
57348
  }
57302
- this.topRows = _.concat(this.pinnedTopRowData, sumRows);
57349
+ this.topRows = this.pinnedTopRowData ? _.concat(this.pinnedTopRowData, sumRows) : sumRows;
57303
57350
  } else {
57304
57351
  this.topRows = this.pinnedTopRowData;
57305
57352
  }
@@ -63398,9 +63445,9 @@ var render$c = function() {
63398
63445
  var _vm = this;
63399
63446
  var _h = _vm.$createElement;
63400
63447
  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) {
63448
+ 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
63449
  _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);
63450
+ } } }, [_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
63451
  };
63405
63452
  var staticRenderFns$c = [];
63406
63453
  const __vue2_script$d = {
@@ -63456,7 +63503,7 @@ var render$b = function() {
63456
63503
  var _vm = this;
63457
63504
  var _h = _vm.$createElement;
63458
63505
  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);
63506
+ 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
63507
  };
63461
63508
  var staticRenderFns$b = [];
63462
63509
  const __vue2_script$c = {