iglooform 2.4.7 → 2.4.11

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.
Files changed (262) hide show
  1. package/es/admin-upload/float.js +25 -35
  2. package/es/admin-upload/index.d.ts +2 -0
  3. package/es/admin-upload/index.js +43 -36
  4. package/es/admin-upload/job-list.js +85 -115
  5. package/es/admin-upload/modal.js +19 -26
  6. package/es/alert-message/index.js +11 -9
  7. package/es/amount/index.js +10 -5
  8. package/es/back-top/index.js +14 -10
  9. package/es/button/index.js +23 -28
  10. package/es/button/style/index.less +23 -19
  11. package/es/card-detail/card-group.js +16 -22
  12. package/es/card-detail/card-item.js +16 -21
  13. package/es/card-detail/card-page.js +11 -15
  14. package/es/card-detail/card.js +24 -24
  15. package/es/card-detail/style/index.less +13 -0
  16. package/es/card-detail/utils.js +6 -7
  17. package/es/checkbox/index.js +23 -22
  18. package/es/claim-list/index.js +53 -70
  19. package/es/confirmation/index.js +7 -9
  20. package/es/date-picker/buddhist.js +3 -3
  21. package/es/date-picker/index.js +10 -4
  22. package/es/declaration/index.js +16 -13
  23. package/es/detail-panel/index.js +67 -83
  24. package/es/documents/index.js +6 -8
  25. package/es/example/index.js +9 -11
  26. package/es/filter/checkBox.js +33 -45
  27. package/es/filter/customize.js +3 -4
  28. package/es/filter/index.d.ts +1 -0
  29. package/es/filter/index.js +88 -112
  30. package/es/filter/radioBox.js +23 -31
  31. package/es/filter/rangePicker.js +43 -59
  32. package/es/form/addable-section/index.d.ts +19 -0
  33. package/es/form/addable-section/index.js +211 -0
  34. package/es/form/addable-section/style/index.d.ts +1 -0
  35. package/es/form/addable-section/style/index.js +1 -0
  36. package/es/form/addable-section/style/index.less +22 -0
  37. package/es/form/divider/index.js +7 -1
  38. package/es/form/element/index.js +58 -47
  39. package/es/form/element/style/index.less +9 -0
  40. package/es/form/index.js +16 -17
  41. package/es/form/login/index.js +15 -20
  42. package/es/form/page/index.js +18 -24
  43. package/es/form/page/style/index.less +1 -1
  44. package/es/form/pages/index.js +23 -32
  45. package/es/form/pages/style/index.less +3 -1
  46. package/es/form/render/index.js +1 -1
  47. package/es/form/section/index.js +14 -17
  48. package/es/form/step/index.js +31 -42
  49. package/es/form/steps/index.js +8 -11
  50. package/es/{form/context.d.ts → form-context.d.ts} +1 -0
  51. package/es/{form/context.js → form-context.js} +0 -0
  52. package/es/free-form/addable-section/index.d.ts +18 -0
  53. package/es/free-form/addable-section/index.js +286 -0
  54. package/es/free-form/addable-section/style/index.d.ts +1 -0
  55. package/es/free-form/addable-section/style/index.js +1 -0
  56. package/es/free-form/addable-section/style/index.less +22 -0
  57. package/es/free-form/element/index.js +43 -41
  58. package/es/free-form/element/style/index.less +12 -2
  59. package/es/free-form/index.d.ts +5 -1
  60. package/es/free-form/index.js +17 -17
  61. package/es/free-form/page/index.js +36 -46
  62. package/es/free-form/page/style/index.less +3 -1
  63. package/es/free-form/pages/index.js +8 -10
  64. package/es/free-form/section/index.js +20 -22
  65. package/es/free-form/section/style/index.less +4 -0
  66. package/es/free-form/step/index.js +37 -47
  67. package/es/free-form/steps/index.js +8 -10
  68. package/es/global-message/index.js +1 -1
  69. package/es/home-menu/index.js +52 -71
  70. package/es/index.d.ts +1 -0
  71. package/es/index.js +2 -1
  72. package/es/input/amount.js +10 -5
  73. package/es/input/credit-card.js +7 -1
  74. package/es/input/email.js +8 -1
  75. package/es/input/expiry-date.js +14 -18
  76. package/es/input/input-date.js +12 -16
  77. package/es/input/input-number.js +9 -2
  78. package/es/input/input.js +9 -2
  79. package/es/input/otp.js +17 -15
  80. package/es/input/password.js +12 -6
  81. package/es/input/phone-number.js +6 -8
  82. package/es/input/style/index.less +9 -1
  83. package/es/input/text-area.js +14 -10
  84. package/es/layout/defaultFooter.js +60 -82
  85. package/es/layout/defaultHeader.js +11 -15
  86. package/es/layout/footer.js +108 -148
  87. package/es/layout/header.js +51 -60
  88. package/es/layout/index.js +16 -12
  89. package/es/locale/en-US/messages.json +2 -0
  90. package/es/locale/id-ID/messages.json +2 -0
  91. package/es/locale/locale-provider.js +8 -10
  92. package/es/locale/th-TH/messages.json +2 -0
  93. package/es/locale/vi-VN/messages.json +2 -0
  94. package/es/locale/zh-CN/messages.json +2 -0
  95. package/es/login-page/index.js +30 -42
  96. package/es/media/index.js +20 -27
  97. package/es/media/media.js +9 -12
  98. package/es/media/preview.js +8 -10
  99. package/es/mobile-insurer-detail/index.js +74 -91
  100. package/es/mobile-insurer-list/index.js +34 -38
  101. package/es/modal/index.d.ts +4 -3
  102. package/es/modal/index.js +25 -27
  103. package/es/modal/style/index.less +24 -5
  104. package/es/platform/platform-card/index.js +9 -12
  105. package/es/platform/switch-platform/index.js +24 -32
  106. package/es/policy-list/index.js +11 -14
  107. package/es/policy-list/policy-card.js +119 -153
  108. package/es/radio/index.js +33 -35
  109. package/es/select/attached-select.js +31 -34
  110. package/es/select/select.js +12 -8
  111. package/es/select/style/index.less +1 -1
  112. package/es/select/time-select.js +12 -16
  113. package/es/status-box/index.js +8 -10
  114. package/es/table/index.js +72 -96
  115. package/es/tabs/index.js +7 -1
  116. package/es/types.d.ts +4 -2
  117. package/es/typography/index.js +6 -8
  118. package/es/upload/index.d.ts +2 -1
  119. package/es/upload/index.js +169 -143
  120. package/es/upload-photo/index.d.ts +2 -1
  121. package/es/upload-photo/index.js +170 -142
  122. package/es/upload-photo/media.js +3 -4
  123. package/es/upload-preview/index.js +9 -12
  124. package/es/upload-preview/media.js +12 -16
  125. package/es/upload-preview/style/index.less +2 -2
  126. package/es/utils/form-utils.js +49 -36
  127. package/lib/admin-upload/float.js +25 -35
  128. package/lib/admin-upload/index.d.ts +2 -0
  129. package/lib/admin-upload/index.js +43 -36
  130. package/lib/admin-upload/job-list.js +85 -115
  131. package/lib/admin-upload/modal.js +19 -26
  132. package/lib/alert-message/index.js +11 -9
  133. package/lib/amount/index.js +10 -5
  134. package/lib/back-top/index.js +14 -10
  135. package/lib/button/index.js +24 -29
  136. package/lib/button/style/index.less +23 -19
  137. package/lib/card-detail/card-group.js +16 -22
  138. package/lib/card-detail/card-item.js +16 -21
  139. package/lib/card-detail/card-page.js +11 -15
  140. package/lib/card-detail/card.js +24 -24
  141. package/lib/card-detail/index.js +6 -6
  142. package/lib/card-detail/style/index.less +13 -0
  143. package/lib/card-detail/utils.js +7 -8
  144. package/lib/checkbox/index.js +24 -23
  145. package/lib/claim-list/index.js +53 -70
  146. package/lib/confirmation/index.js +7 -9
  147. package/lib/date-picker/buddhist.js +3 -3
  148. package/lib/date-picker/index.js +11 -5
  149. package/lib/declaration/index.js +16 -13
  150. package/lib/detail-panel/index.js +67 -83
  151. package/lib/documents/index.js +6 -8
  152. package/lib/example/index.js +10 -12
  153. package/lib/filter/checkBox.js +33 -45
  154. package/lib/filter/customize.js +3 -4
  155. package/lib/filter/index.d.ts +1 -0
  156. package/lib/filter/index.js +88 -112
  157. package/lib/filter/radioBox.js +23 -31
  158. package/lib/filter/rangePicker.js +43 -59
  159. package/lib/form/addable-section/index.d.ts +19 -0
  160. package/lib/form/addable-section/index.js +232 -0
  161. package/lib/form/addable-section/style/index.d.ts +1 -0
  162. package/lib/form/addable-section/style/index.js +3 -0
  163. package/lib/form/addable-section/style/index.less +22 -0
  164. package/lib/form/divider/index.js +7 -1
  165. package/lib/form/element/index.js +60 -48
  166. package/lib/form/element/style/index.less +9 -0
  167. package/lib/form/elements.js +1 -1
  168. package/lib/form/index.js +16 -17
  169. package/lib/form/login/index.js +16 -21
  170. package/lib/form/page/index.js +19 -25
  171. package/lib/form/page/style/index.less +1 -1
  172. package/lib/form/pages/index.js +24 -33
  173. package/lib/form/pages/style/index.less +3 -1
  174. package/lib/form/render/index.js +2 -2
  175. package/lib/form/section/index.js +15 -18
  176. package/lib/form/step/index.js +32 -43
  177. package/lib/form/steps/index.js +9 -12
  178. package/lib/{form/context.d.ts → form-context.d.ts} +1 -0
  179. package/lib/{form/context.js → form-context.js} +0 -0
  180. package/lib/free-form/addable-section/index.d.ts +18 -0
  181. package/lib/free-form/addable-section/index.js +306 -0
  182. package/lib/free-form/addable-section/style/index.d.ts +1 -0
  183. package/lib/free-form/addable-section/style/index.js +3 -0
  184. package/lib/free-form/addable-section/style/index.less +22 -0
  185. package/lib/free-form/element/index.js +44 -42
  186. package/lib/free-form/element/style/index.less +12 -2
  187. package/lib/free-form/index.d.ts +5 -1
  188. package/lib/free-form/index.js +17 -17
  189. package/lib/free-form/page/index.js +37 -47
  190. package/lib/free-form/page/style/index.less +3 -1
  191. package/lib/free-form/pages/index.js +8 -10
  192. package/lib/free-form/section/index.js +21 -23
  193. package/lib/free-form/section/style/index.less +4 -0
  194. package/lib/free-form/step/index.js +38 -48
  195. package/lib/free-form/steps/index.js +9 -11
  196. package/lib/global-message/index.js +1 -1
  197. package/lib/home-menu/index.js +52 -71
  198. package/lib/index.d.ts +1 -0
  199. package/lib/index.js +141 -132
  200. package/lib/input/amount.js +10 -5
  201. package/lib/input/credit-card.js +7 -1
  202. package/lib/input/email.js +7 -1
  203. package/lib/input/expiry-date.js +14 -18
  204. package/lib/input/index.js +18 -18
  205. package/lib/input/input-date.js +12 -16
  206. package/lib/input/input-number.js +8 -2
  207. package/lib/input/input.js +8 -2
  208. package/lib/input/otp.js +17 -15
  209. package/lib/input/password.js +11 -6
  210. package/lib/input/phone-number.js +6 -8
  211. package/lib/input/style/index.less +9 -1
  212. package/lib/input/text-area.js +14 -10
  213. package/lib/layout/defaultFooter.js +60 -82
  214. package/lib/layout/defaultHeader.js +11 -15
  215. package/lib/layout/footer.js +108 -148
  216. package/lib/layout/header.js +51 -60
  217. package/lib/layout/index.js +15 -12
  218. package/lib/locale/en-US/messages.json +2 -0
  219. package/lib/locale/format-message.js +1 -1
  220. package/lib/locale/id-ID/messages.json +2 -0
  221. package/lib/locale/index.js +4 -4
  222. package/lib/locale/locale-provider.js +9 -11
  223. package/lib/locale/th-TH/messages.json +2 -0
  224. package/lib/locale/vi-VN/messages.json +2 -0
  225. package/lib/locale/zh-CN/messages.json +2 -0
  226. package/lib/login-page/index.js +30 -42
  227. package/lib/media/index.js +20 -27
  228. package/lib/media/media.js +9 -12
  229. package/lib/media/preview.js +8 -10
  230. package/lib/mobile-insurer-detail/index.js +74 -91
  231. package/lib/mobile-insurer-list/index.js +34 -38
  232. package/lib/modal/index.d.ts +4 -3
  233. package/lib/modal/index.js +25 -27
  234. package/lib/modal/style/index.less +24 -5
  235. package/lib/platform/platform-card/index.js +9 -12
  236. package/lib/platform/switch-platform/index.js +24 -32
  237. package/lib/policy-list/index.js +11 -14
  238. package/lib/policy-list/policy-card.js +119 -153
  239. package/lib/radio/index.js +33 -35
  240. package/lib/select/attached-select.js +32 -35
  241. package/lib/select/select.js +13 -9
  242. package/lib/select/style/index.less +1 -1
  243. package/lib/select/time-select.js +12 -16
  244. package/lib/status-box/index.js +8 -10
  245. package/lib/table/index.js +72 -96
  246. package/lib/tabs/index.js +8 -2
  247. package/lib/types.d.ts +4 -2
  248. package/lib/typography/index.js +6 -8
  249. package/lib/upload/index.d.ts +2 -1
  250. package/lib/upload/index.js +170 -143
  251. package/lib/upload-photo/index.d.ts +2 -1
  252. package/lib/upload-photo/index.js +171 -142
  253. package/lib/upload-photo/media.js +3 -4
  254. package/lib/upload-preview/index.js +9 -12
  255. package/lib/upload-preview/media.js +12 -16
  256. package/lib/upload-preview/style/index.less +2 -2
  257. package/lib/utils/form-utils.js +49 -37
  258. package/package.json +1 -1
  259. package/es/free-form/context.d.ts +0 -19
  260. package/es/free-form/context.js +0 -7
  261. package/lib/free-form/context.d.ts +0 -19
  262. package/lib/free-form/context.js +0 -19
@@ -134,9 +134,8 @@ var UploadPreview = function UploadPreview(_ref) {
134
134
  if (!files || !files.length) return (0, _jsxRuntime.jsx)("div", {
135
135
  children: "-"
136
136
  }, void 0);
137
- return (0, _jsxRuntime.jsxs)("div", Object.assign({
138
- className: "igloo-upload-preview"
139
- }, {
137
+ return (0, _jsxRuntime.jsxs)("div", {
138
+ className: "igloo-upload-preview",
140
139
  children: [description || (files.length === 1 ? formatMessage({
141
140
  id: '1 file attached.'
142
141
  }) : formatMessage({
@@ -152,20 +151,18 @@ var UploadPreview = function UploadPreview(_ref) {
152
151
  style: {
153
152
  fontSize: 24
154
153
  }
155
- }, void 0), (0, _jsxRuntime.jsxs)(_modal.default, Object.assign({
154
+ }, void 0), (0, _jsxRuntime.jsxs)(_modal.default, {
156
155
  visible: preview,
157
- title: (0, _jsxRuntime.jsxs)(_typography.default, Object.assign({
158
- level: "h4"
159
- }, {
156
+ title: (0, _jsxRuntime.jsxs)(_typography.default, {
157
+ level: "h4",
160
158
  children: [label, " (", current + 1, "/", files.length, ")"]
161
- }), void 0),
159
+ }, void 0),
162
160
  className: "igloo-upload-preview-modal",
163
161
  footer: null,
164
162
  onCancel: function onCancel() {
165
163
  return setPreview(false);
166
164
  },
167
- forceRender: false
168
- }, {
165
+ forceRender: false,
169
166
  children: [(0, _jsxRuntime.jsx)(_button.default, {
170
167
  icon: (0, _jsxRuntime.jsx)(_iglooicon.ArrowLeftOutlined, {}, void 0),
171
168
  className: (0, _classnames.default)('igloo-upload-preview-modal-button', 'igloo-upload-preview-modal-button-left'),
@@ -180,8 +177,8 @@ var UploadPreview = function UploadPreview(_ref) {
180
177
  onClick: next,
181
178
  disabled: current >= files.length - 1
182
179
  }, void 0)]
183
- }), void 0)]
184
- }), void 0);
180
+ }, void 0)]
181
+ }, void 0);
185
182
  };
186
183
 
187
184
  var _default = UploadPreview;
@@ -70,11 +70,10 @@ var PDF = function PDF(_ref) {
70
70
  }, i));
71
71
  }
72
72
 
73
- return (0, _jsxRuntime.jsx)("div", Object.assign({
74
- className: "igloo-upload-preview-pdf"
75
- }, {
73
+ return (0, _jsxRuntime.jsx)("div", {
74
+ className: "igloo-upload-preview-pdf",
76
75
  children: pages
77
- }), void 0);
76
+ }, void 0);
78
77
  };
79
78
 
80
79
  var Media = function Media(_ref3) {
@@ -85,20 +84,18 @@ var Media = function Media(_ref3) {
85
84
  var _useContext = (0, _react.useContext)(_localeContext.default),
86
85
  formatMessage = _useContext.formatMessage;
87
86
 
88
- var children = (0, _jsxRuntime.jsxs)("div", Object.assign({
89
- className: "igloo-upload-prevew-not-supported"
90
- }, {
87
+ var children = (0, _jsxRuntime.jsxs)("div", {
88
+ className: "igloo-upload-prevew-not-supported",
91
89
  children: [(0, _jsxRuntime.jsx)(_iglooicon.ErrorFilled, {
92
90
  className: "igloo-upload-prevew-not-supported-icon"
93
- }, void 0), (0, _jsxRuntime.jsx)(_typography.default, Object.assign({
91
+ }, void 0), (0, _jsxRuntime.jsx)(_typography.default, {
94
92
  level: "body1",
95
- className: "igloo-upload-prevew-not-supported-text"
96
- }, {
93
+ className: "igloo-upload-prevew-not-supported-text",
97
94
  children: formatMessage({
98
95
  id: 'No preview for this file. Only support image, video or PDF file.'
99
96
  })
100
- }), void 0)]
101
- }), void 0);
97
+ }, void 0)]
98
+ }, void 0);
102
99
 
103
100
  if (type === 'image') {
104
101
  children = (0, _jsxRuntime.jsx)("img", {
@@ -122,11 +119,10 @@ var Media = function Media(_ref3) {
122
119
  }, void 0);
123
120
  }
124
121
 
125
- return (0, _jsxRuntime.jsx)("div", Object.assign({
126
- className: (0, _classnames.default)('igloo-upload-preview-container', className)
127
- }, {
122
+ return (0, _jsxRuntime.jsx)("div", {
123
+ className: (0, _classnames.default)('igloo-upload-preview-container', className),
128
124
  children: children
129
- }), void 0);
125
+ }, void 0);
130
126
  };
131
127
 
132
128
  var _default = Media;
@@ -4,8 +4,8 @@
4
4
 
5
5
  .igloo-upload-prevew-icon {
6
6
  cursor: pointer;
7
- width: 22px;
8
- height: 22px;
7
+ width: 24px;
8
+ height: 24px;
9
9
  margin-left: 8px;
10
10
  }
11
11
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.calcShouldRender = exports.calcSelectValue = exports.calcCopyValue = exports.calcDisabled = exports.calcFormItemProps = exports.testAssert = exports.calcNamePath = void 0;
6
+ exports.testAssert = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = void 0;
7
7
 
8
8
  var _jsxRuntime = require("react/jsx-runtime");
9
9
 
@@ -13,16 +13,16 @@ var _typography = _interopRequireDefault(require("../typography"));
13
13
 
14
14
  var _formattedMessage = _interopRequireDefault(require("../locale/formatted-message"));
15
15
 
16
- var _excluded = ["type", "name", "required", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
16
+ var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
17
17
  _excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
21
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
22
22
 
23
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
+ 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; }
24
24
 
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+ 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; }
26
26
 
27
27
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
28
 
@@ -49,7 +49,7 @@ var calcNamePath = function calcNamePath(parentName, name) {
49
49
  names.push(parentName);
50
50
  }
51
51
 
52
- if (name) {
52
+ if (name !== undefined) {
53
53
  names.push(name);
54
54
  }
55
55
 
@@ -61,9 +61,8 @@ exports.calcNamePath = calcNamePath;
61
61
  var testAssert = function testAssert(form, assert) {
62
62
  var field = assert.field,
63
63
  value = assert.value,
64
- _assert$operation = assert.operation,
65
- operation = _assert$operation === void 0 ? 'eq' : _assert$operation;
66
- var v = form.getFieldValue(field);
64
+ operation = assert.operation;
65
+ var v = form.getFieldValue(typeof field === 'string' ? field.split('.') : field);
67
66
 
68
67
  switch (operation) {
69
68
  case 'ne':
@@ -102,9 +101,15 @@ var testAssert = function testAssert(form, assert) {
102
101
  if (v === undefined || v < value) return false;
103
102
  break;
104
103
 
104
+ case 'filled':
105
+ return v !== undefined;
106
+
105
107
  case 'eq':
108
+ return v === value;
109
+
106
110
  default:
107
- if (v !== value) return false;
111
+ if (value !== undefined) return v === value;
112
+ return v !== undefined;
108
113
  }
109
114
 
110
115
  return true;
@@ -112,11 +117,25 @@ var testAssert = function testAssert(form, assert) {
112
117
 
113
118
  exports.testAssert = testAssert;
114
119
 
120
+ var calcRequired = function calcRequired() {
121
+ var required = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
122
+ var form = arguments.length > 1 ? arguments[1] : undefined;
123
+ var requiredAsserts = arguments.length > 2 ? arguments[2] : undefined;
124
+
125
+ if (Array.isArray(requiredAsserts)) {
126
+ return requiredAsserts.every(function (assert) {
127
+ return form && testAssert(form, assert);
128
+ });
129
+ }
130
+
131
+ return required;
132
+ };
133
+
115
134
  var calcFormItemProps = function calcFormItemProps(config, extraProps, form, parentName) {
116
135
  var type = config.type,
117
136
  nameProp = config.name,
118
- _config$required = config.required,
119
- required = _config$required === void 0 ? true : _config$required,
137
+ required = config.required,
138
+ requiredAsserts = config.requiredAsserts,
120
139
  _config$showOptional = config.showOptional,
121
140
  showOptional = _config$showOptional === void 0 ? false : _config$showOptional,
122
141
  _config$rules = config.rules,
@@ -180,7 +199,7 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
180
199
  className = extraProps.className,
181
200
  extraRest = _objectWithoutProperties(extraProps, _excluded2);
182
201
 
183
- var rules = required === true && extraRequired ? [{
202
+ var rules = calcRequired(required, form, requiredAsserts) ? [{
184
203
  required: true,
185
204
  message: requiredMessage || extraRequiredMessage
186
205
  }].concat(_toConsumableArray(propsRules)) : _toConsumableArray(propsRules);
@@ -225,40 +244,33 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
225
244
  normalize: normalize || extraNormalize,
226
245
  rules: rules,
227
246
  validateTrigger: _toConsumableArray(new Set(validateTriggers)),
228
- label: label ? (0, _jsxRuntime.jsxs)("div", Object.assign({
229
- className: "igloo-form-label"
230
- }, {
231
- children: [(0, _jsxRuntime.jsxs)("div", Object.assign({
232
- className: "igloo-form-label-text"
233
- }, {
234
- children: [(0, _jsxRuntime.jsx)(_typography.default, Object.assign({
235
- level: "body1"
236
- }, {
247
+ label: label ? (0, _jsxRuntime.jsxs)("div", {
248
+ className: "igloo-form-label",
249
+ children: [(0, _jsxRuntime.jsxs)("div", {
250
+ className: "igloo-form-label-text",
251
+ children: [(0, _jsxRuntime.jsx)(_typography.default, {
252
+ level: "body1",
237
253
  children: label
238
- }), void 0), isRequired && requiredMark && (0, _jsxRuntime.jsx)("span", Object.assign({
239
- className: "igloo-form-label-required"
240
- }, {
254
+ }, void 0), isRequired && requiredMark && (0, _jsxRuntime.jsx)("span", {
255
+ className: "igloo-form-label-required",
241
256
  children: "*"
242
- }), void 0), showOptional && (0, _jsxRuntime.jsxs)("span", Object.assign({
243
- className: "igloo-form-label-optional"
244
- }, {
257
+ }, void 0), showOptional && (0, _jsxRuntime.jsxs)("span", {
258
+ className: "igloo-form-label-optional",
245
259
  children: ["(", (0, _formattedMessage.default)({
246
260
  id: 'Optional'
247
261
  }), ")"]
248
- }), void 0)]
249
- }), void 0), extraLabel && (0, _jsxRuntime.jsx)("div", Object.assign({
250
- className: "igloo-form-label-extra"
251
- }, {
262
+ }, void 0)]
263
+ }, void 0), extraLabel && (0, _jsxRuntime.jsx)("div", {
264
+ className: "igloo-form-label-extra",
252
265
  children: typeof extraLabel === 'function' ? extraLabel(form) : extraLabel
253
- }), void 0)]
254
- }), void 0) : null,
266
+ }, void 0)]
267
+ }, void 0) : null,
255
268
  getValueFromEvent: getValueFromEvent || extraGetValueFromEvent,
256
269
  getValueProps: getValueProps,
257
- extra: (extra || extraExtra) && (0, _jsxRuntime.jsx)(_typography.default, Object.assign({
258
- level: "caption2"
259
- }, {
270
+ extra: (extra || extraExtra) && (0, _jsxRuntime.jsx)(_typography.default, {
271
+ level: "caption2",
260
272
  children: extra || extraExtra
261
- }), void 0),
273
+ }, void 0),
262
274
  help: help || extraHelp,
263
275
  valuePropName: valuePropName || extraValuePropName,
264
276
  messageVariables: _objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.4.7",
3
+ "version": "2.4.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { FormInstance } from 'antd/es/form';
3
- import { FormItemName } from '@/types';
4
- declare const _default: React.Context<{
5
- form?: FormInstance<any> | undefined;
6
- onCancel?(): void;
7
- cancelText?: string | undefined;
8
- submitText?: string | undefined;
9
- previewText?: string | undefined;
10
- nextText?: string | undefined;
11
- continueText?: string | undefined;
12
- validateMessages?: Object | undefined;
13
- submitting?: boolean | undefined;
14
- requiredMark?: boolean | undefined;
15
- showSubmitButton?: boolean | undefined;
16
- getScrollContainer: () => HTMLElement | Window | null;
17
- registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
18
- }>;
19
- export default _default;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- export default /*#__PURE__*/React.createContext({
3
- getScrollContainer: function getScrollContainer() {
4
- return window;
5
- },
6
- registerDependencies: function registerDependencies() {}
7
- });
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { FormInstance } from 'antd/es/form';
3
- import { FormItemName } from '@/types';
4
- declare const _default: React.Context<{
5
- form?: FormInstance<any> | undefined;
6
- onCancel?(): void;
7
- cancelText?: string | undefined;
8
- submitText?: string | undefined;
9
- previewText?: string | undefined;
10
- nextText?: string | undefined;
11
- continueText?: string | undefined;
12
- validateMessages?: Object | undefined;
13
- submitting?: boolean | undefined;
14
- requiredMark?: boolean | undefined;
15
- showSubmitButton?: boolean | undefined;
16
- getScrollContainer: () => HTMLElement | Window | null;
17
- registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
18
- }>;
19
- export default _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- var _default = /*#__PURE__*/_react.default.createContext({
13
- getScrollContainer: function getScrollContainer() {
14
- return window;
15
- },
16
- registerDependencies: function registerDependencies() {}
17
- });
18
-
19
- exports.default = _default;