ztxkui 10.0.91 → 10.0.92

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.
@@ -15,6 +15,11 @@ export default function Basic() {
15
15
  })), panes = _c[0], setPanes = _c[1];
16
16
  var _d = useState(), inputVal = _d[0], setInputVal = _d[1];
17
17
  var _e = useState(), txeVal = _e[0], setTxeVal = _e[1];
18
+ var handleKeyPress = function (e) {
19
+ if (e.key === 'Enter') {
20
+ e.target.blur();
21
+ }
22
+ };
18
23
  return (React.createElement("div", null,
19
24
  React.createElement("button", { onClick: function () {
20
25
  var result = [
@@ -75,5 +80,15 @@ export default function Basic() {
75
80
  console.log(val);
76
81
  setValue(val);
77
82
  }, readOnly: true }),
83
+ React.createElement(InputNumber, { className: "applyAmount-input-number", precision: 2, formatterType: "currency", style: { width: '100%' },
84
+ // min={0.01}
85
+ onChange: function (e) {
86
+ console.log(111, e);
87
+ }, onBlur: function (e) {
88
+ console.log('onBlur', e.target.value);
89
+ setTimeout(function () {
90
+ console.log('onBlur', e.target.value);
91
+ }, 0);
92
+ }, onKeyDown: function (e) { return handleKeyPress(e); } }),
78
93
  React.createElement(Input, { doubleClickReadOnly: true })));
79
94
  }
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React, { useRef, useState } from 'react';
24
24
  import { InputNumber as AntInputNumber } from 'antd';
25
+ import { exactRound } from 'ztxkutils/dist/tools';
25
26
  import { message } from '../../index';
26
27
  import { getFormatter, useHighFormatter, } from '../../hooks/useFormatter';
27
28
  var isKeyDownDisable = function (value, _a) {
@@ -74,8 +75,18 @@ function InputNumber(props) {
74
75
  }
75
76
  };
76
77
  var onBlurHandle = function (e) {
78
+ var _a;
77
79
  isFocusRef.current = false;
78
80
  onOverRangeHandle();
81
+ // 组件内部根据 precision 处理小数位,将处理后的值同步到 e.target.value
82
+ // 外部通过 e.target.value 拿到的就是组件处理过后的数据
83
+ var effectivePrecision = precision !== null && precision !== void 0 ? precision : _precision;
84
+ if (effectivePrecision && ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value)) {
85
+ var rawValue = String(e.target.value).replace(/[^\d.-]/g, '');
86
+ if (rawValue && !isNaN(Number(rawValue))) {
87
+ e.target.value = exactRound(rawValue, effectivePrecision);
88
+ }
89
+ }
79
90
  onBlur && onBlur(e);
80
91
  if (doubleClickReadOnly) {
81
92
  setReadOnly(true);
@@ -112,9 +112,7 @@ export function htmlToPdf(_a) {
112
112
  var pageClassName = _a.pageClassName, dom = _a.dom, pdfName = _a.pdfName, isShowPage = _a.isShowPage, noWater = _a.noWater, pdfOptions = _a.pdfOptions, imgPositionX = _a.imgPositionX, waterText = _a.waterText, apiUrl = _a.apiUrl;
113
113
  var jsBridgeObj = window.jsBridgeObj
114
114
  ? window.jsBridgeObj
115
- : new JsBridge({
116
- ZT_API_BASEURL: apiUrl,
117
- });
115
+ : null;
118
116
  var allDom = document.querySelectorAll(pageClassName ? pageClassName : '.html2canvas-container-page');
119
117
  var format = (pdfOptions === null || pdfOptions === void 0 ? void 0 : pdfOptions.format) || [632.28, 841.89];
120
118
  var pdf = new jsPDF(__assign({ unit: 'pt', format: format }, (pdfOptions || {})));
package/dist/index.js CHANGED
@@ -31,7 +31,13 @@
31
31
  // ReactDOM.render(
32
32
  // // <React.StrictMode>
33
33
  // <ConfigProvider locale={zhCN}>
34
- // <ZtxkContext.Provider value={{ apiBaseUrl: 'http://192.168.0.83:8000' }}>
34
+ // <ZtxkContext.Provider
35
+ // value={{
36
+ // apiBaseUrl: 'http://192.168.0.83:8000',
37
+ // serviceNames: { mdmServiceName: 'zmdms-scm-system' },
38
+ // precisions: { price: 2, amount: 2 },
39
+ // }}
40
+ // >
35
41
  // <BrowserRouter>
36
42
  // <Switch>
37
43
  // <Route path="/ui">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.91",
3
+ "version": "10.0.92",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",
@@ -30,6 +30,7 @@
30
30
  "react-to-print": "^2.14.7",
31
31
  "react-window": "^1.8.9",
32
32
  "virtuallist-antd": "^0.7.6",
33
+ "ztxkui": "10.0.91",
33
34
  "ztxkutils": "20.0.4"
34
35
  },
35
36
  "scripts": {