kts-component-invoice-operate 3.2.11 → 3.2.13

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.
@@ -10,6 +10,8 @@ export interface IFormValues {
10
10
  invoiceType?: any;
11
11
  }
12
12
  export interface IInvoiceTypeModalProps {
13
+ /** 是否禁用 */
14
+ isDisabled?: boolean;
13
15
  /** 窗口标题 */
14
16
  modalTitle?: string;
15
17
  /** 是否开启 */
package/dist/index.esm.js CHANGED
@@ -18143,7 +18143,7 @@ function AddDiscountRowDrawer(props) {
18143
18143
  while (1) {
18144
18144
  switch (_context7.prev = _context7.next) {
18145
18145
  case 0:
18146
- if (value) {
18146
+ if (!isNaN(parseFloat(value))) {
18147
18147
  _context7.next = 2;
18148
18148
  break;
18149
18149
  }
@@ -18151,14 +18151,22 @@ function AddDiscountRowDrawer(props) {
18151
18151
  return _context7.abrupt("return");
18152
18152
 
18153
18153
  case 2:
18154
- if (!(value > totalAmount)) {
18154
+ if (!(value <= 0)) {
18155
18155
  _context7.next = 4;
18156
18156
  break;
18157
18157
  }
18158
18158
 
18159
- throw new Error('不可以大于商品金额');
18159
+ throw new Error('需大于0');
18160
18160
 
18161
18161
  case 4:
18162
+ if (!(value > totalAmount)) {
18163
+ _context7.next = 6;
18164
+ break;
18165
+ }
18166
+
18167
+ throw new Error('不可以大于商品金额');
18168
+
18169
+ case 6:
18162
18170
  case "end":
18163
18171
  return _context7.stop();
18164
18172
  }
@@ -18190,7 +18198,7 @@ function AddDiscountRowDrawer(props) {
18190
18198
  while (1) {
18191
18199
  switch (_context8.prev = _context8.next) {
18192
18200
  case 0:
18193
- if (value) {
18201
+ if (!isNaN(parseFloat(value))) {
18194
18202
  _context8.next = 2;
18195
18203
  break;
18196
18204
  }
@@ -18198,14 +18206,22 @@ function AddDiscountRowDrawer(props) {
18198
18206
  return _context8.abrupt("return");
18199
18207
 
18200
18208
  case 2:
18201
- if (!(value > 100)) {
18209
+ if (!(value <= 0)) {
18202
18210
  _context8.next = 4;
18203
18211
  break;
18204
18212
  }
18205
18213
 
18206
- throw new Error('不可以大于100');
18214
+ throw new Error('需大于0');
18207
18215
 
18208
18216
  case 4:
18217
+ if (!(value > 100)) {
18218
+ _context8.next = 6;
18219
+ break;
18220
+ }
18221
+
18222
+ throw new Error('不可以大于100');
18223
+
18224
+ case 6:
18209
18225
  case "end":
18210
18226
  return _context8.stop();
18211
18227
  }
@@ -18601,10 +18617,11 @@ var useReselectInvoiceType = (function () {
18601
18617
  onClose();
18602
18618
  }, [onClose, typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.onOk]);
18603
18619
  var isEnable = React.useMemo(function () {
18620
+ if ((typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.isDisabled) === true) return false;
18604
18621
  if (model === 'readOnly') return false;
18605
18622
  if (model === 'prefab') return false;
18606
18623
  return true;
18607
- }, [model]);
18624
+ }, [model, typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.isDisabled]);
18608
18625
  var button = React.useMemo(function () {
18609
18626
  if (isEnable === false) return React.createElement(React.Fragment, null);
18610
18627
  return React.createElement(React.Fragment, null, React.createElement(Button$1, {
package/dist/index.js CHANGED
@@ -18153,7 +18153,7 @@ function AddDiscountRowDrawer(props) {
18153
18153
  while (1) {
18154
18154
  switch (_context7.prev = _context7.next) {
18155
18155
  case 0:
18156
- if (value) {
18156
+ if (!isNaN(parseFloat(value))) {
18157
18157
  _context7.next = 2;
18158
18158
  break;
18159
18159
  }
@@ -18161,14 +18161,22 @@ function AddDiscountRowDrawer(props) {
18161
18161
  return _context7.abrupt("return");
18162
18162
 
18163
18163
  case 2:
18164
- if (!(value > totalAmount)) {
18164
+ if (!(value <= 0)) {
18165
18165
  _context7.next = 4;
18166
18166
  break;
18167
18167
  }
18168
18168
 
18169
- throw new Error('不可以大于商品金额');
18169
+ throw new Error('需大于0');
18170
18170
 
18171
18171
  case 4:
18172
+ if (!(value > totalAmount)) {
18173
+ _context7.next = 6;
18174
+ break;
18175
+ }
18176
+
18177
+ throw new Error('不可以大于商品金额');
18178
+
18179
+ case 6:
18172
18180
  case "end":
18173
18181
  return _context7.stop();
18174
18182
  }
@@ -18200,7 +18208,7 @@ function AddDiscountRowDrawer(props) {
18200
18208
  while (1) {
18201
18209
  switch (_context8.prev = _context8.next) {
18202
18210
  case 0:
18203
- if (value) {
18211
+ if (!isNaN(parseFloat(value))) {
18204
18212
  _context8.next = 2;
18205
18213
  break;
18206
18214
  }
@@ -18208,14 +18216,22 @@ function AddDiscountRowDrawer(props) {
18208
18216
  return _context8.abrupt("return");
18209
18217
 
18210
18218
  case 2:
18211
- if (!(value > 100)) {
18219
+ if (!(value <= 0)) {
18212
18220
  _context8.next = 4;
18213
18221
  break;
18214
18222
  }
18215
18223
 
18216
- throw new Error('不可以大于100');
18224
+ throw new Error('需大于0');
18217
18225
 
18218
18226
  case 4:
18227
+ if (!(value > 100)) {
18228
+ _context8.next = 6;
18229
+ break;
18230
+ }
18231
+
18232
+ throw new Error('不可以大于100');
18233
+
18234
+ case 6:
18219
18235
  case "end":
18220
18236
  return _context8.stop();
18221
18237
  }
@@ -18611,10 +18627,11 @@ var useReselectInvoiceType = (function () {
18611
18627
  onClose();
18612
18628
  }, [onClose, typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.onOk]);
18613
18629
  var isEnable = React__default['default'].useMemo(function () {
18630
+ if ((typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.isDisabled) === true) return false;
18614
18631
  if (model === 'readOnly') return false;
18615
18632
  if (model === 'prefab') return false;
18616
18633
  return true;
18617
- }, [model]);
18634
+ }, [model, typeModalProps === null || typeModalProps === void 0 ? void 0 : typeModalProps.isDisabled]);
18618
18635
  var button = React__default['default'].useMemo(function () {
18619
18636
  if (isEnable === false) return React__default['default'].createElement(React__default['default'].Fragment, null);
18620
18637
  return React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(ktsXui.Button, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.11",
3
+ "version": "3.2.13",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -82,7 +82,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
82
82
  const endowCodeButton = useEndowCodeButton();
83
83
 
84
84
  /** 重选发票类型 */
85
- const reselectInvoiceType = useReselectInvoiceType()
85
+ const reselectInvoiceType = useReselectInvoiceType();
86
86
 
87
87
  /** 清空重填 */
88
88
  const emptyRefill = useEmptyRefill();
@@ -284,7 +284,8 @@ function AddDiscountRowDrawer(props: {
284
284
  { required: true, message: '必填' },
285
285
  {
286
286
  validator: async (_, value) => {
287
- if (!value) return;
287
+ if (isNaN(parseFloat(value))) return;
288
+ if (value <= 0) throw new Error('需大于0');
288
289
  if (value > totalAmount) throw new Error('不可以大于商品金额');
289
290
  }
290
291
  }
@@ -300,7 +301,8 @@ function AddDiscountRowDrawer(props: {
300
301
  { required: true, message: '必填' },
301
302
  {
302
303
  validator: async (_, value) => {
303
- if (!value) return;
304
+ if (isNaN(parseFloat(value))) return;
305
+ if (value <= 0) throw new Error('需大于0');
304
306
  if (value > 100) throw new Error('不可以大于100');
305
307
  }
306
308
  }
@@ -4,7 +4,6 @@ import { Button } from "kts-xui";
4
4
  import React from "react";
5
5
  import Invoice from '../../../../../../..';
6
6
  import InvoiceTypeModal from "../../../../../../../../InvoiceTypeModal";
7
- import { e } from "mathjs";
8
7
 
9
8
  export default () => {
10
9
 
@@ -29,11 +28,12 @@ export default () => {
29
28
  onClose();
30
29
  }, [onClose, typeModalProps?.onOk]);
31
30
 
32
- const isEnable = React.useMemo(()=>{
31
+ const isEnable = React.useMemo(() => {
32
+ if (typeModalProps?.isDisabled === true) return false
33
33
  if (model === 'readOnly') return false;
34
34
  if (model === 'prefab') return false;
35
35
  return true;
36
- }, [model])
36
+ }, [model, typeModalProps?.isDisabled])
37
37
 
38
38
  const button = React.useMemo(() => {
39
39
  if (isEnable === false) return <></>;
@@ -18,6 +18,9 @@ export interface IFormValues {
18
18
 
19
19
  export interface IInvoiceTypeModalProps {
20
20
 
21
+ /** 是否禁用 */
22
+ isDisabled?:boolean;
23
+
21
24
  /** 窗口标题 */
22
25
  modalTitle?: string;
23
26