kts-component-invoice-operate 3.0.7 → 3.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Form, AutoComplete, Select, Typography, Button, Input, Spin, Tooltip } from 'kts-components-antd-x3';
2
+ import { Form, AutoComplete, Select, Button, Input, Spin, Tooltip } from 'kts-components-antd-x3';
3
3
  import { InputProps } from 'kts-components-antd-x3/lib/input';
4
4
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
5
5
  import { IGood } from '../../../../InvoiceController';
@@ -15,8 +15,7 @@ import {
15
15
  onChangeTaxRate,
16
16
  onChangeItemName,
17
17
  } from './autoFillFn';
18
-
19
- const { Text } = Typography;
18
+ import ItemNameInput from './ui/ItemNameInput';
20
19
 
21
20
  export default (form: WrappedFormUtils) => {
22
21
  const { getFieldDecorator, getFieldValue } = form;
@@ -93,12 +92,17 @@ export default (form: WrappedFormUtils) => {
93
92
  }
94
93
  ]
95
94
  })(
96
- <MyInput
97
- style={{ flex: 1 }}
95
+ // <MyInput
96
+ // style={{ flex: 1 }}
97
+ // onChange={() => {
98
+ // onChangeItemName(controller, form, record);
99
+ // }}
100
+ // />,
101
+ <ItemNameInput
98
102
  onChange={() => {
99
103
  onChangeItemName(controller, form, record);
100
104
  }}
101
- />,
105
+ />
102
106
  )}
103
107
  <div className="kts-invoice-operate-goods-list-able-list-itemName-import">
104
108
  {controller.getGoodsList && model !== 'readOnly' && (
@@ -0,0 +1,10 @@
1
+ .kts-invoice-operate-goods-list-itemName-input {
2
+ display : flex;
3
+ flex : 1;
4
+ padding-left: 10px;
5
+ height : 31px;
6
+ }
7
+
8
+ .has-error .kts-invoice-operate-goods-list-itemName-input{
9
+ border: 1px solid #f5222d;
10
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import { Input } from 'kts-components-antd-x3';
3
+ import React, { ChangeEvent } from 'react';
4
+ import './index.less';
5
+
6
+ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string }) {
7
+
8
+ const { shorthand, fullName } = getShorthand(props.value);
9
+
10
+ const onChange = React.useCallback((e: ChangeEvent<HTMLInputElement>) => {
11
+ const event = { ...e };
12
+ event.target.value = shorthand ? `*${shorthand}*${e.target.value}` : e.target.value
13
+ props.onChange && props.onChange(event);
14
+ }, [])
15
+
16
+ return (
17
+ <div className='kts-invoice-operate-goods-list-itemName-input'>
18
+ {shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{shorthand}*</span>}
19
+ <Input style={{ height: '100%', border: 'none' }} value={fullName} onChange={onChange} />
20
+ </div>
21
+ )
22
+ }
23
+
24
+ /** 提取简称 */
25
+ const getShorthand = (value?: string) => {
26
+ if (!value) return {};
27
+ const arr = value.match(/\*[^*]+\*/);
28
+
29
+ const shorthand = arr ? arr[0].split('*')[1] : '';
30
+ const fullName = shorthand ? value.replace(`*${shorthand}*`, '') : value;
31
+
32
+ return { shorthand, fullName }
33
+ };
34
+
@@ -24,6 +24,7 @@ export default () => {
24
24
  if (editGood) {
25
25
  if (editGood.$index === record.$index) return;
26
26
  await controller.saveEditGood();
27
+ await controller.wait();
27
28
  await controller.pipeline(async s => { s.goodsListState.editGood || (await controller.setEditGood(record)) })();
28
29
  } else {
29
30
  await controller.setEditGood(record);