iglooform 2.5.52 → 2.5.53

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.
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
package/.idea/misc.xml ADDED
@@ -0,0 +1,5 @@
1
+ <project version="4">
2
+ <component name="ProjectRootManager">
3
+ <output url="file://$PROJECT_DIR$/out" />
4
+ </component>
5
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/iglooform.iml" filepath="$PROJECT_DIR$/.idea/iglooform.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -98,7 +98,7 @@ var Step = function Step(_ref) {
98
98
 
99
99
  invariant(!validationRule || getRuleValidationApi, 'Please provide getRuleValidationApi in Form props');
100
100
  useEffect(function () {
101
- if (shouldRender || getButtonDisabledState) {
101
+ if (shouldRender || getButtonDisabledState || shouldRenderCode) {
102
102
  registerDependencies(Array.isArray(subscribedFields) ? subscribedFields : 'SUBSCRIBE_ALL', dispatch);
103
103
  }
104
104
 
package/es/input/email.js CHANGED
@@ -10,6 +10,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import omit from 'omit.js';
12
12
  import formMethods from '../utils/form-methods';
13
+ import { staticFormatMessage as formatMessage } from '../locale';
13
14
  import './style/index.less';
14
15
 
15
16
  var Email = function Email(props) {
@@ -18,11 +19,30 @@ var Email = function Email(props) {
18
19
  }, omit(props, formMethods)));
19
20
  };
20
21
 
21
- Email.formItemPropsHandler = function () {
22
+ Email.formItemPropsHandler = function (config) {
23
+ var maxLength = config.maxLength,
24
+ label = config.label;
25
+ var rules = [{
26
+ type: 'email'
27
+ }];
28
+
29
+ if (maxLength !== undefined) {
30
+ rules.push({
31
+ validator: function validator(_, value) {
32
+ if (value === undefined || value === null || value === '' || String(value).length <= maxLength) return Promise.resolve();
33
+ return Promise.reject(formatMessage({
34
+ id: '{label} must be less than {maxLength} characters.',
35
+ values: {
36
+ maxLength: maxLength,
37
+ label: label
38
+ }
39
+ }));
40
+ }
41
+ });
42
+ }
43
+
22
44
  return {
23
- rules: [{
24
- type: 'email'
25
- }]
45
+ rules: rules
26
46
  };
27
47
  };
28
48
 
@@ -1,14 +1,6 @@
1
1
  import "antd/es/input/style";
2
2
  import _Input from "antd/es/input";
3
3
 
4
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
-
6
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
-
8
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
-
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
-
12
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
5
 
14
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -82,7 +74,7 @@ var IglooTextArea = function IglooTextArea(props) {
82
74
  children: [_jsx(_Input.TextArea, _objectSpread(_objectSpread({
83
75
  className: classnames('igloo-input'),
84
76
  rows: 3
85
- }, omit(props, [].concat(_toConsumableArray(formMethods), ['maxLength']))), {}, {
77
+ }, omit(props, formMethods)), {}, {
86
78
  onChange: function onChange(e) {
87
79
  return handleOnChange(e, onChangeProps, maxLength);
88
80
  }
@@ -1 +1 @@
1
- export default ['containerRef', 'setFieldError', 'setFieldValue', 'setShowStepButton', 'locales', 'getFormInstance', 'hideWhenPreview', 'validateField', 'subscribedFields'];
1
+ export default ['containerRef', 'setFieldError', 'setFieldValue', 'setShowStepButton', 'locales', 'getFormInstance', 'hideWhenPreview', 'validateField', 'subscribedFields', 'maxLength', 'minLength', 'length', 'pattern'];
@@ -122,7 +122,7 @@ var Step = function Step(_ref) {
122
122
 
123
123
  (0, _invariant.default)(!validationRule || getRuleValidationApi, 'Please provide getRuleValidationApi in Form props');
124
124
  (0, _react.useEffect)(function () {
125
- if (shouldRender || getButtonDisabledState) {
125
+ if (shouldRender || getButtonDisabledState || shouldRenderCode) {
126
126
  registerDependencies(Array.isArray(subscribedFields) ? subscribedFields : 'SUBSCRIBE_ALL', dispatch);
127
127
  }
128
128
 
@@ -15,6 +15,8 @@ var _omit = _interopRequireDefault(require("omit.js"));
15
15
 
16
16
  var _formMethods = _interopRequireDefault(require("../utils/form-methods"));
17
17
 
18
+ var _locale = require("../locale");
19
+
18
20
  require("./style/index.less");
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -31,11 +33,30 @@ var Email = function Email(props) {
31
33
  }, (0, _omit.default)(props, _formMethods.default)));
32
34
  };
33
35
 
34
- Email.formItemPropsHandler = function () {
36
+ Email.formItemPropsHandler = function (config) {
37
+ var maxLength = config.maxLength,
38
+ label = config.label;
39
+ var rules = [{
40
+ type: 'email'
41
+ }];
42
+
43
+ if (maxLength !== undefined) {
44
+ rules.push({
45
+ validator: function validator(_, value) {
46
+ if (value === undefined || value === null || value === '' || String(value).length <= maxLength) return Promise.resolve();
47
+ return Promise.reject((0, _locale.staticFormatMessage)({
48
+ id: '{label} must be less than {maxLength} characters.',
49
+ values: {
50
+ maxLength: maxLength,
51
+ label: label
52
+ }
53
+ }));
54
+ }
55
+ });
56
+ }
57
+
35
58
  return {
36
- rules: [{
37
- type: 'email'
38
- }]
59
+ rules: rules
39
60
  };
40
61
  };
41
62
 
@@ -25,14 +25,6 @@ require("./style/index.less");
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
29
-
30
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
-
32
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
33
-
34
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
35
-
36
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
29
 
38
30
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -98,7 +90,7 @@ var IglooTextArea = function IglooTextArea(props) {
98
90
  children: [(0, _jsxRuntime.jsx)(_input.default.TextArea, _objectSpread(_objectSpread({
99
91
  className: (0, _classnames.default)('igloo-input'),
100
92
  rows: 3
101
- }, (0, _omit.default)(props, [].concat(_toConsumableArray(_formMethods.default), ['maxLength']))), {}, {
93
+ }, (0, _omit.default)(props, _formMethods.default)), {}, {
102
94
  onChange: function onChange(e) {
103
95
  return handleOnChange(e, onChangeProps, maxLength);
104
96
  }
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = ['containerRef', 'setFieldError', 'setFieldValue', 'setShowStepButton', 'locales', 'getFormInstance', 'hideWhenPreview', 'validateField', 'subscribedFields'];
7
+ var _default = ['containerRef', 'setFieldError', 'setFieldValue', 'setShowStepButton', 'locales', 'getFormInstance', 'hideWhenPreview', 'validateField', 'subscribedFields', 'maxLength', 'minLength', 'length', 'pattern'];
8
8
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.5.52",
3
+ "version": "2.5.53",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",