kts-component-invoice-operate 3.1.16 → 3.1.18
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/dist/Invoice/index.d.ts +3 -0
- package/dist/Invoice/tools/calculate/index.d.ts +7 -0
- package/dist/index.esm.js +32 -5
- package/dist/index.js +29 -2
- package/package.json +3 -2
- package/src/Invoice/index.tsx +5 -0
- package/src/Invoice/tools/calculate/index.ts +15 -0
- package/src/Invoice/ui/GoodsList/ui/TableRow/index.tsx +0 -2
- package/src/Invoice/ui/GoodsList/ui/TableVirtual/index.tsx +5 -2
package/dist/Invoice/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import InvoiceController from './InvoiceController';
|
|
|
4
4
|
import GoodsList from './ui/GoodsList';
|
|
5
5
|
import Seller from './ui/Seller';
|
|
6
6
|
import Buyer from './ui/Buyer';
|
|
7
|
+
import * as calculator from './tools/calculate';
|
|
7
8
|
/** 发票组件的上下文 */
|
|
8
9
|
export declare const InvoiceContext: React.Context<InvoiceController>;
|
|
9
10
|
export interface IInvoiceProps {
|
|
@@ -37,6 +38,8 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
|
|
|
37
38
|
static readonly Buyer: typeof Buyer;
|
|
38
39
|
/** 货物索引生成器 */
|
|
39
40
|
static idGenerator: () => string;
|
|
41
|
+
/** 金额计算方法 */
|
|
42
|
+
static calculator: typeof calculator;
|
|
40
43
|
/** 获取控制器钩子 */
|
|
41
44
|
static useInvoiceController: () => InvoiceController;
|
|
42
45
|
render(): JSX.Element;
|
|
@@ -31,3 +31,10 @@ export declare function countTaxAmount(amountIncludeTax: string | number, deduct
|
|
|
31
31
|
* @returns 单价
|
|
32
32
|
*/
|
|
33
33
|
export declare function countPrice(amount: string | number, quantity: string | number, calculatingDigits?: number): number | undefined | '';
|
|
34
|
+
/**
|
|
35
|
+
* 数量 = 金额/单价
|
|
36
|
+
* @param amount 金额
|
|
37
|
+
* @param price 单价
|
|
38
|
+
* @returns 数量
|
|
39
|
+
*/
|
|
40
|
+
export declare function countQuantity(amount: string | number, price: string | number, calculatingDigits?: number): number | undefined | '';
|
package/dist/index.esm.js
CHANGED
|
@@ -2,10 +2,11 @@ import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
|
|
|
2
2
|
import React, { createElement } from 'react';
|
|
3
3
|
import GreyReactBox, { decorator } from 'grey-react-box';
|
|
4
4
|
import { chain as chain$1, bignumber, create, all } from 'mathjs';
|
|
5
|
-
import { message, Form, Input, Icon, Tag, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover, Table, Tree, Modal, Row, Col } from 'kts-components-antd-x3';
|
|
5
|
+
import { message, Form, Input, Icon, Tag, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover, Table as Table$1, Tree, Modal, Row, Col } from 'kts-components-antd-x3';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { TableManual, Switch, Form as Form$1, Drawer as Drawer$1 } from 'kts-xui';
|
|
9
|
+
import { Table } from 'kts-components-antd-x4-v4';
|
|
9
10
|
import { Input as Input$1, NumberPicker } from '@formily/antd-components';
|
|
10
11
|
import { createAsyncFormActions, FormEffectHooks, SchemaForm, FormButtonGroup, SchemaMarkupField } from '@formily/antd';
|
|
11
12
|
|
|
@@ -1134,6 +1135,28 @@ function countPrice(amount, quantity, calculatingDigits) {
|
|
|
1134
1135
|
if (!quantity && quantity !== 0) return undefined;
|
|
1135
1136
|
return format15(chain$1(bignumber(amount)).divide(bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1136
1137
|
}
|
|
1138
|
+
/**
|
|
1139
|
+
* 数量 = 金额/单价
|
|
1140
|
+
* @param amount 金额
|
|
1141
|
+
* @param price 单价
|
|
1142
|
+
* @returns 数量
|
|
1143
|
+
*/
|
|
1144
|
+
function countQuantity(amount, price, calculatingDigits) {
|
|
1145
|
+
if (!amount && amount !== 0) return undefined;
|
|
1146
|
+
if (!price && price !== 0) return undefined;
|
|
1147
|
+
return format15(chain$1(bignumber(amount)).divide(bignumber(price)).done().toNumber(), calculatingDigits);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
var calculator = /*#__PURE__*/Object.freeze({
|
|
1151
|
+
__proto__: null,
|
|
1152
|
+
format2: format2,
|
|
1153
|
+
format15: format15,
|
|
1154
|
+
countAmountIncludeTax: countAmountIncludeTax,
|
|
1155
|
+
countAmountExcludeTax: countAmountExcludeTax,
|
|
1156
|
+
countTaxAmount: countTaxAmount,
|
|
1157
|
+
countPrice: countPrice,
|
|
1158
|
+
countQuantity: countQuantity
|
|
1159
|
+
});
|
|
1137
1160
|
|
|
1138
1161
|
/**
|
|
1139
1162
|
* 设置当前的编辑货物
|
|
@@ -1700,7 +1723,9 @@ function TableVirtual (props) {
|
|
|
1700
1723
|
setSelf(e);
|
|
1701
1724
|
}
|
|
1702
1725
|
}, /*#__PURE__*/React.createElement(TableManual, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1703
|
-
dataSource: dataSource
|
|
1726
|
+
dataSource: dataSource,
|
|
1727
|
+
// 新版本Table会有输入框无法连续输入的问题,先兼容老版本
|
|
1728
|
+
tableComponent: Table
|
|
1704
1729
|
})));
|
|
1705
1730
|
}
|
|
1706
1731
|
|
|
@@ -2154,7 +2179,6 @@ function TableRow(props) {
|
|
|
2154
2179
|
return undefined;
|
|
2155
2180
|
}
|
|
2156
2181
|
}, [props['data-row-key'], goodsMap]);
|
|
2157
|
-
console.log('===> discount', discount);
|
|
2158
2182
|
return /*#__PURE__*/React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2159
2183
|
className: classnames(props.className, discount)
|
|
2160
2184
|
}));
|
|
@@ -11759,7 +11783,7 @@ var DrawerBody$1 = function DrawerBody() {
|
|
|
11759
11783
|
}
|
|
11760
11784
|
});
|
|
11761
11785
|
}, [controller]);
|
|
11762
|
-
return /*#__PURE__*/React.createElement(Table, {
|
|
11786
|
+
return /*#__PURE__*/React.createElement(Table$1, {
|
|
11763
11787
|
bordered: true,
|
|
11764
11788
|
size: "small",
|
|
11765
11789
|
columns: columns,
|
|
@@ -11877,7 +11901,7 @@ var DrawerBody$2 = function DrawerBody() {
|
|
|
11877
11901
|
}
|
|
11878
11902
|
});
|
|
11879
11903
|
}, [controller]);
|
|
11880
|
-
return /*#__PURE__*/React.createElement(Table, {
|
|
11904
|
+
return /*#__PURE__*/React.createElement(Table$1, {
|
|
11881
11905
|
bordered: true,
|
|
11882
11906
|
size: "small",
|
|
11883
11907
|
columns: columns,
|
|
@@ -12830,6 +12854,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
12830
12854
|
|
|
12831
12855
|
/** 货物索引生成器 */
|
|
12832
12856
|
|
|
12857
|
+
/** 金额计算方法 */
|
|
12858
|
+
|
|
12833
12859
|
/** 获取控制器钩子 */
|
|
12834
12860
|
|
|
12835
12861
|
function render() {
|
|
@@ -12845,6 +12871,7 @@ Invoice.Seller = Buyer;
|
|
|
12845
12871
|
Invoice.Sign = Sign;
|
|
12846
12872
|
Invoice.Buyer = Buyer$1;
|
|
12847
12873
|
Invoice.idGenerator = idGenerator;
|
|
12874
|
+
Invoice.calculator = calculator;
|
|
12848
12875
|
Invoice.useInvoiceController = function () {
|
|
12849
12876
|
return React.useContext(InvoiceContext);
|
|
12850
12877
|
};
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var ktsComponentsAntdX3 = require('kts-components-antd-x3');
|
|
|
10
10
|
var uuid = require('uuid');
|
|
11
11
|
var classnames = require('classnames');
|
|
12
12
|
var ktsXui = require('kts-xui');
|
|
13
|
+
var ktsComponentsAntdX4V4 = require('kts-components-antd-x4-v4');
|
|
13
14
|
var antdComponents = require('@formily/antd-components');
|
|
14
15
|
var antd = require('@formily/antd');
|
|
15
16
|
|
|
@@ -1144,6 +1145,28 @@ function countPrice(amount, quantity, calculatingDigits) {
|
|
|
1144
1145
|
if (!quantity && quantity !== 0) return undefined;
|
|
1145
1146
|
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(quantity)).done().toNumber(), calculatingDigits);
|
|
1146
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* 数量 = 金额/单价
|
|
1150
|
+
* @param amount 金额
|
|
1151
|
+
* @param price 单价
|
|
1152
|
+
* @returns 数量
|
|
1153
|
+
*/
|
|
1154
|
+
function countQuantity(amount, price, calculatingDigits) {
|
|
1155
|
+
if (!amount && amount !== 0) return undefined;
|
|
1156
|
+
if (!price && price !== 0) return undefined;
|
|
1157
|
+
return format15(mathjs.chain(mathjs.bignumber(amount)).divide(mathjs.bignumber(price)).done().toNumber(), calculatingDigits);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
var calculator = /*#__PURE__*/Object.freeze({
|
|
1161
|
+
__proto__: null,
|
|
1162
|
+
format2: format2,
|
|
1163
|
+
format15: format15,
|
|
1164
|
+
countAmountIncludeTax: countAmountIncludeTax,
|
|
1165
|
+
countAmountExcludeTax: countAmountExcludeTax,
|
|
1166
|
+
countTaxAmount: countTaxAmount,
|
|
1167
|
+
countPrice: countPrice,
|
|
1168
|
+
countQuantity: countQuantity
|
|
1169
|
+
});
|
|
1147
1170
|
|
|
1148
1171
|
/**
|
|
1149
1172
|
* 设置当前的编辑货物
|
|
@@ -1710,7 +1733,9 @@ function TableVirtual (props) {
|
|
|
1710
1733
|
setSelf(e);
|
|
1711
1734
|
}
|
|
1712
1735
|
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.TableManual, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1713
|
-
dataSource: dataSource
|
|
1736
|
+
dataSource: dataSource,
|
|
1737
|
+
// 新版本Table会有输入框无法连续输入的问题,先兼容老版本
|
|
1738
|
+
tableComponent: ktsComponentsAntdX4V4.Table
|
|
1714
1739
|
})));
|
|
1715
1740
|
}
|
|
1716
1741
|
|
|
@@ -2164,7 +2189,6 @@ function TableRow(props) {
|
|
|
2164
2189
|
return undefined;
|
|
2165
2190
|
}
|
|
2166
2191
|
}, [props['data-row-key'], goodsMap]);
|
|
2167
|
-
console.log('===> discount', discount);
|
|
2168
2192
|
return /*#__PURE__*/React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2169
2193
|
className: classnames__default['default'](props.className, discount)
|
|
2170
2194
|
}));
|
|
@@ -12840,6 +12864,8 @@ var Invoice = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
12840
12864
|
|
|
12841
12865
|
/** 货物索引生成器 */
|
|
12842
12866
|
|
|
12867
|
+
/** 金额计算方法 */
|
|
12868
|
+
|
|
12843
12869
|
/** 获取控制器钩子 */
|
|
12844
12870
|
|
|
12845
12871
|
function render() {
|
|
@@ -12855,6 +12881,7 @@ Invoice.Seller = Buyer;
|
|
|
12855
12881
|
Invoice.Sign = Sign;
|
|
12856
12882
|
Invoice.Buyer = Buyer$1;
|
|
12857
12883
|
Invoice.idGenerator = idGenerator;
|
|
12884
|
+
Invoice.calculator = calculator;
|
|
12858
12885
|
Invoice.useInvoiceController = function () {
|
|
12859
12886
|
return React__default['default'].useContext(InvoiceContext);
|
|
12860
12887
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kts-component-invoice-operate",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"grey-react-box": "^0.2.22",
|
|
32
32
|
"kts-components-antd-x3": "^3.26.20-5",
|
|
33
33
|
"kts-components-antd-x4": "5.0.0",
|
|
34
|
-
"kts-
|
|
34
|
+
"kts-components-antd-x4-v4": "npm:kts-components-antd-x4@^4.0.3",
|
|
35
|
+
"kts-xui": "^2.0.3",
|
|
35
36
|
"mathjs": "^9.4.2",
|
|
36
37
|
"next": "^11.0.1",
|
|
37
38
|
"nzh": "^1.0.4",
|
package/src/Invoice/index.tsx
CHANGED
|
@@ -12,6 +12,8 @@ import ImportGoodsDrawer from './ui/ImportGoodsDrawer';
|
|
|
12
12
|
import EndowCodeDrawer from './ui/EndowCodeDrawer';
|
|
13
13
|
import AddComparisonDrawer from './ui/AddComparisonDrawer';
|
|
14
14
|
import idGenerator from './tools/idGenerator';
|
|
15
|
+
import * as calculator from './tools/calculate';
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
/** 发票组件的上下文 */
|
|
17
19
|
export const InvoiceContext = React.createContext<InvoiceController>(
|
|
@@ -63,6 +65,9 @@ export default class Invoice extends React.PureComponent<IInvoiceProps> {
|
|
|
63
65
|
/** 货物索引生成器 */
|
|
64
66
|
static idGenerator = idGenerator;
|
|
65
67
|
|
|
68
|
+
/** 金额计算方法 */
|
|
69
|
+
static calculator = calculator;
|
|
70
|
+
|
|
66
71
|
/** 获取控制器钩子 */
|
|
67
72
|
static useInvoiceController = () => { return React.useContext(InvoiceContext) };
|
|
68
73
|
|
|
@@ -92,6 +92,21 @@ export function countPrice(amount: string | number, quantity: string | number, c
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* 数量 = 金额/单价
|
|
97
|
+
* @param amount 金额
|
|
98
|
+
* @param price 单价
|
|
99
|
+
* @returns 数量
|
|
100
|
+
*/
|
|
101
|
+
export function countQuantity(amount: string | number, price: string | number, calculatingDigits?: number): number | undefined | '' {
|
|
102
|
+
if (!amount && amount !== 0) return undefined;
|
|
103
|
+
if (!price && price !== 0) return undefined;
|
|
104
|
+
|
|
105
|
+
return format15(chain(bignumber(amount)).divide(bignumber(price))
|
|
106
|
+
.done()
|
|
107
|
+
.toNumber(), calculatingDigits)
|
|
108
|
+
}
|
|
109
|
+
|
|
95
110
|
|
|
96
111
|
|
|
97
112
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { TableManual
|
|
3
|
+
import { TableManual, TableProps } from "kts-xui";
|
|
4
|
+
import { Table } from 'kts-components-antd-x4-v4';
|
|
4
5
|
import './index.less';
|
|
5
6
|
|
|
6
7
|
export default function <T extends object = any>(props: TableProps<T>) {
|
|
@@ -97,9 +98,11 @@ export default function <T extends object = any>(props: TableProps<T>) {
|
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
100
|
<span className="kts-invoice-operate-goods-table-virtual" ref={(e) => { setSelf(e) }} >
|
|
100
|
-
<
|
|
101
|
+
<TableManual
|
|
101
102
|
{...props}
|
|
102
103
|
dataSource={dataSource}
|
|
104
|
+
// 新版本Table会有输入框无法连续输入的问题,先兼容老版本
|
|
105
|
+
tableComponent={Table as any}
|
|
103
106
|
/>
|
|
104
107
|
</span>
|
|
105
108
|
)
|