iglooform 2.5.52 → 2.5.54

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.
@@ -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
  }
@@ -8,5 +8,6 @@ declare const PlatformCard: FC<{
8
8
  onClick: any;
9
9
  className?: any;
10
10
  style?: CSSProperties;
11
+ badgeText?: string;
11
12
  }>;
12
13
  export default PlatformCard;
@@ -23,7 +23,8 @@ var PlatformCard = function PlatformCard(_ref) {
23
23
  var platform = _ref.platform,
24
24
  className = _ref.className,
25
25
  style = _ref.style,
26
- onClick = _ref.onClick;
26
+ onClick = _ref.onClick,
27
+ badgeText = _ref.badgeText;
27
28
 
28
29
  var _useState = useState(false),
29
30
  _useState2 = _slicedToArray(_useState, 2),
@@ -33,9 +34,10 @@ var PlatformCard = function PlatformCard(_ref) {
33
34
  var key = typeof platform === 'string' ? platform : platform.key;
34
35
  var name = typeof platform === 'string' ? platform : platform.name;
35
36
  return _jsxs("div", {
36
- className: classnames('igloo-platform', className),
37
+ className: classnames('igloo-platform', className, badgeText && 'igloo-platform-has-badge-text'),
37
38
  onClick: onClick,
38
39
  style: style,
40
+ "data-badge-text": badgeText,
39
41
  children: [showDefault && _jsxs("div", {
40
42
  style: {
41
43
  textAlign: 'center'
@@ -19,6 +19,22 @@
19
19
  border: 3px solid @active-color;
20
20
  }
21
21
 
22
+ &.igloo-platform-has-badge-text {
23
+ position: relative;
24
+ &::before {
25
+ position: absolute;
26
+ right: 0;
27
+ top: 0;
28
+ content: attr(data-badge-text);
29
+ color: @primary-color;
30
+ background-color: @purple-light;
31
+ font-size: 12px;
32
+ padding: 2px 6px;
33
+ border-top-right-radius: 3px;
34
+ border-bottom-left-radius: 3px;
35
+ }
36
+ }
37
+
22
38
  .igloo-platform-logo {
23
39
  width: 220px;
24
40
  height: 120px;
@@ -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
  }
@@ -8,5 +8,6 @@ declare const PlatformCard: FC<{
8
8
  onClick: any;
9
9
  className?: any;
10
10
  style?: CSSProperties;
11
+ badgeText?: string;
11
12
  }>;
12
13
  export default PlatformCard;
@@ -37,7 +37,8 @@ var PlatformCard = function PlatformCard(_ref) {
37
37
  var platform = _ref.platform,
38
38
  className = _ref.className,
39
39
  style = _ref.style,
40
- onClick = _ref.onClick;
40
+ onClick = _ref.onClick,
41
+ badgeText = _ref.badgeText;
41
42
 
42
43
  var _useState = (0, _react.useState)(false),
43
44
  _useState2 = _slicedToArray(_useState, 2),
@@ -47,9 +48,10 @@ var PlatformCard = function PlatformCard(_ref) {
47
48
  var key = typeof platform === 'string' ? platform : platform.key;
48
49
  var name = typeof platform === 'string' ? platform : platform.name;
49
50
  return (0, _jsxRuntime.jsxs)("div", {
50
- className: (0, _classnames.default)('igloo-platform', className),
51
+ className: (0, _classnames.default)('igloo-platform', className, badgeText && 'igloo-platform-has-badge-text'),
51
52
  onClick: onClick,
52
53
  style: style,
54
+ "data-badge-text": badgeText,
53
55
  children: [showDefault && (0, _jsxRuntime.jsxs)("div", {
54
56
  style: {
55
57
  textAlign: 'center'
@@ -19,6 +19,22 @@
19
19
  border: 3px solid @active-color;
20
20
  }
21
21
 
22
+ &.igloo-platform-has-badge-text {
23
+ position: relative;
24
+ &::before {
25
+ position: absolute;
26
+ right: 0;
27
+ top: 0;
28
+ content: attr(data-badge-text);
29
+ color: @primary-color;
30
+ background-color: @purple-light;
31
+ font-size: 12px;
32
+ padding: 2px 6px;
33
+ border-top-right-radius: 3px;
34
+ border-bottom-left-radius: 3px;
35
+ }
36
+ }
37
+
22
38
  .igloo-platform-logo {
23
39
  width: 220px;
24
40
  height: 120px;
@@ -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.54",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",