ztxkui 10.0.61 → 10.0.63

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.
@@ -263,7 +263,9 @@ var TableEnhanceCell = function (_a) {
263
263
  return null;
264
264
  }
265
265
  if (!editableConfig) {
266
- return (React.createElement(Input, { autoComplete: "new-password", maxLength: 50, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
266
+ return (React.createElement(Input, { autoComplete: "new-password",
267
+ // maxLength={50}
268
+ onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
267
269
  e === null || e === void 0 ? void 0 : e.stopPropagation();
268
270
  },
269
271
  // draggable
@@ -339,7 +341,7 @@ var TableEnhanceCell = function (_a) {
339
341
  selectData.map(function (item) { return (React.createElement(Select.Option, { key: item[selectKeyValue.key] + '', value: item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.key] }, item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.label])); })));
340
342
  }
341
343
  else if (type === 'inputNumber') {
342
- return (React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, inputNumberRangeTip, { disabled: disabledResult,
344
+ return (React.createElement(InputNumber, __assign({ autoComplete: "new-password" }, inputNumMaxMin, editableProps, inputNumberRangeTip, { disabled: disabledResult,
343
345
  // draggable
344
346
  // onDragStart={(e) => {
345
347
  // e?.stopPropagation?.();
@@ -364,7 +366,9 @@ var TableEnhanceCell = function (_a) {
364
366
  } })));
365
367
  }
366
368
  else if (type === 'textArea') {
367
- return (React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
369
+ return (React.createElement(Input.TextArea, __assign({ autoComplete: "new-password",
370
+ // maxLength={200}
371
+ autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
368
372
  e === null || e === void 0 ? void 0 : e.stopPropagation();
369
373
  },
370
374
  // draggable
@@ -383,7 +387,7 @@ var TableEnhanceCell = function (_a) {
383
387
  }, allowClear: true })));
384
388
  }
385
389
  else {
386
- return (React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
390
+ return (React.createElement(Input, __assign({ autoComplete: "new-password" }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onMouseUp: function (e) {
387
391
  e === null || e === void 0 ? void 0 : e.stopPropagation();
388
392
  },
389
393
  // draggable
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  interface IProps {
3
3
  visible: boolean;
4
- onCancel: any;
5
- setUserPassword: any;
6
- request: any;
7
- encryptionHandle: any;
4
+ onCancel?: any;
5
+ setUserPassword?: any;
6
+ request?: any;
7
+ encryptionHandle?: any;
8
8
  setUserPasswordOption?: any;
9
9
  }
10
10
  declare const Making: React.FC<IProps>;
@@ -47,9 +47,28 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  import React, { useCallback, useState } from 'react';
49
49
  import { Container, Form, SearchContainer, Input, message, Modal, Button, } from '../../../../index';
50
+ import ZtxkContext from '../../../utils/ZtxkContext';
51
+ //
52
+ var validatePassword = function (str) {
53
+ // 定义正则表达式,分别匹配数字、大写字母、小写字母和特殊字符
54
+ var hasNumber = /\d/.test(str);
55
+ var hasUpperCase = /[A-Z]/.test(str);
56
+ var hasLowerCase = /[a-z]/.test(str);
57
+ var hasSpecialChar = /[^a-zA-Z0-9]/.test(str);
58
+ // 计算满足条件的种类数量
59
+ var conditionsMet = [
60
+ hasNumber,
61
+ hasUpperCase,
62
+ hasLowerCase,
63
+ hasSpecialChar,
64
+ ].filter(Boolean).length;
65
+ // 至少满足三种条件则返回 true,否则返回 false
66
+ return conditionsMet >= 3;
67
+ };
50
68
  var SearchLeft = SearchContainer.SearchLeft, Item = SearchContainer.SearchItem;
51
69
  var Making = function (_a) {
52
70
  var visible = _a.visible, onCancel = _a.onCancel, setUserPassword = _a.setUserPassword, request = _a.request, setUserPasswordOption = _a.setUserPasswordOption, encryptionHandle = _a.encryptionHandle;
71
+ var hightKeywords = React.useContext(ZtxkContext).hightKeywords;
53
72
  var form = Form.useForm()[0];
54
73
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
55
74
  /**提交验证 */
@@ -137,11 +156,24 @@ var Making = function (_a) {
137
156
  var getFieldValue = _a.getFieldValue;
138
157
  return ({
139
158
  validator: function (rule, value) {
140
- if ((value === null || value === void 0 ? void 0 : value.length) >= 8) {
141
- return Promise.resolve();
159
+ if (hightKeywords) {
160
+ if ((value === null || value === void 0 ? void 0 : value.length) <= 8) {
161
+ return Promise.reject('密码长度必须大于8位!');
162
+ }
163
+ else if (!validatePassword(value)) {
164
+ return Promise.reject('密码至少满足数字,大写字母,小写字母,特殊字符中的三种!');
165
+ }
166
+ else {
167
+ return Promise.resolve();
168
+ }
142
169
  }
143
170
  else {
144
- return Promise.reject('密码长度最小为8位!');
171
+ if ((value === null || value === void 0 ? void 0 : value.length) >= 8) {
172
+ return Promise.resolve();
173
+ }
174
+ else {
175
+ return Promise.reject('密码长度最小为8位!');
176
+ }
145
177
  }
146
178
  // const result = validatePassword(
147
179
  // value,
@@ -158,7 +190,9 @@ var Making = function (_a) {
158
190
  ] },
159
191
  React.createElement(Input.Password, { autoComplete: "new-password" })),
160
192
  React.createElement("div", null,
161
- React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } }, "\u5BC6\u7801\u957F\u5EA6\u6700\u5C0F\u4E3A8\u4F4D\uFF01"))),
193
+ React.createElement("p", { style: { height: 32, lineHeight: '32px', color: 'red' } }, hightKeywords
194
+ ? '密码长度大于8位,至少满足数字,大写字母,小写字母,特殊字符中的三种!'
195
+ : '密码长度最小为8位!'))),
162
196
  React.createElement(Item, { name: "newPassword1", label: "\u786E\u8BA4\u65B0\u5BC6\u7801", rules: [
163
197
  { required: true, message: '请确认密码' },
164
198
  function (_a) {
@@ -6,6 +6,7 @@ export interface IZtxkConfig {
6
6
  printContainer?: {
7
7
  print: boolean;
8
8
  };
9
+ hightKeywords?: boolean;
9
10
  }
10
11
  declare const ZtxkContext: React.Context<IZtxkConfig>;
11
12
  export default ZtxkContext;
@@ -5,6 +5,7 @@ var ztxkConfig = {
5
5
  printContainer: {
6
6
  print: false,
7
7
  },
8
+ hightKeywords: false,
8
9
  };
9
10
  var ZtxkContext = React.createContext(ztxkConfig);
10
11
  export default ZtxkContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.61",
3
+ "version": "10.0.63",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",