linear-react-components-ui 1.1.13 → 1.1.14-beta.0

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 (368) hide show
  1. package/.eslintrc.json +77 -45
  2. package/.gitlab-ci.yml +5 -13
  3. package/.tool-versions +1 -0
  4. package/.vscode/settings.json +3 -12
  5. package/babel.config.json +4 -4
  6. package/lib/@types/SizePixels.d.ts +1 -1
  7. package/lib/alerts/AlertContainer.js +56 -47
  8. package/lib/alerts/AlertProvider.js +51 -33
  9. package/lib/alerts/BaseAlert.js +18 -11
  10. package/lib/alerts/Message.d.ts +1 -1
  11. package/lib/alerts/Message.js +44 -77
  12. package/lib/alerts/helpers.js +3 -2
  13. package/lib/alerts/index.js +3 -2
  14. package/lib/alerts/types.d.ts +0 -1
  15. package/lib/alerts/withAlert.js +9 -8
  16. package/lib/assets/styles/alerts.scss +7 -4
  17. package/lib/assets/styles/button.scss +9 -11
  18. package/lib/assets/styles/checkbox.scss +38 -45
  19. package/lib/assets/styles/colors.scss +1 -3
  20. package/lib/assets/styles/commons.scss +0 -1
  21. package/lib/assets/styles/dialog.scss +20 -37
  22. package/lib/assets/styles/drawers.scss +6 -9
  23. package/lib/assets/styles/fieldset.scss +0 -3
  24. package/lib/assets/styles/gridlayout.scss +2 -0
  25. package/lib/assets/styles/hint.scss +0 -21
  26. package/lib/assets/styles/icon.scss +4 -31
  27. package/lib/assets/styles/input.scss +7 -7
  28. package/lib/assets/styles/multiSelect.scss +1 -6
  29. package/lib/assets/styles/radio.scss +35 -37
  30. package/lib/assets/styles/select.scss +7 -13
  31. package/lib/assets/styles/table.scss +1 -9
  32. package/lib/assets/styles/tabs.scss +18 -28
  33. package/lib/avatar/index.js +39 -39
  34. package/lib/badge/index.js +13 -11
  35. package/lib/buttons/ActivateButton.js +7 -4
  36. package/lib/buttons/AddButton.js +10 -7
  37. package/lib/buttons/Button.js +9 -8
  38. package/lib/buttons/ButtonGroups.js +4 -5
  39. package/lib/buttons/CancelButton.js +5 -6
  40. package/lib/buttons/DangerButton.js +5 -6
  41. package/lib/buttons/DefaultButton.js +85 -85
  42. package/lib/buttons/DestroyButton.js +5 -6
  43. package/lib/buttons/EditButton.js +7 -4
  44. package/lib/buttons/InactivateButton.js +7 -4
  45. package/lib/buttons/InfoButton.js +5 -6
  46. package/lib/buttons/PrimaryButton.js +5 -6
  47. package/lib/buttons/RestoreButton.js +7 -4
  48. package/lib/buttons/SaveButton.js +5 -6
  49. package/lib/buttons/SuccessButton.js +5 -6
  50. package/lib/buttons/WarningButton.js +5 -6
  51. package/lib/buttons/button_container/index.js +19 -15
  52. package/lib/buttons/index.js +16 -15
  53. package/lib/buttons/split_button/index.js +23 -20
  54. package/lib/buttons/types.d.ts +0 -1
  55. package/lib/calendar/DangerCalendar.js +5 -6
  56. package/lib/calendar/InfoCalendar.js +5 -6
  57. package/lib/calendar/PrimaryCalendar.js +5 -6
  58. package/lib/calendar/SuccessCalendar.js +5 -6
  59. package/lib/calendar/WarningCalendar.js +5 -6
  60. package/lib/calendar/base/Day.js +11 -12
  61. package/lib/calendar/base/Month.js +17 -12
  62. package/lib/calendar/base/Week.js +17 -12
  63. package/lib/calendar/base/helpers.js +11 -11
  64. package/lib/calendar/base/index.js +43 -29
  65. package/lib/calendar/index.js +7 -6
  66. package/lib/checkbox/Label.js +9 -19
  67. package/lib/checkbox/index.d.ts +2 -2
  68. package/lib/checkbox/index.js +95 -81
  69. package/lib/checkbox/types.d.ts +1 -2
  70. package/lib/dialog/Alert.js +4 -3
  71. package/lib/dialog/Custom.js +16 -14
  72. package/lib/dialog/Error.js +4 -3
  73. package/lib/dialog/Information.js +4 -3
  74. package/lib/dialog/Question.js +12 -11
  75. package/lib/dialog/Warning.js +5 -5
  76. package/lib/dialog/base/Content.js +5 -7
  77. package/lib/dialog/base/Footer.js +7 -4
  78. package/lib/dialog/base/Header.js +28 -28
  79. package/lib/dialog/base/index.d.ts +2 -8
  80. package/lib/dialog/base/index.js +104 -108
  81. package/lib/dialog/base/style.js +10 -7
  82. package/lib/dialog/form/index.js +35 -36
  83. package/lib/dialog/index.js +8 -7
  84. package/lib/dialog/types.d.ts +13 -8
  85. package/lib/drawer/Content.js +10 -11
  86. package/lib/drawer/Drawer.js +83 -69
  87. package/lib/drawer/Header.js +36 -33
  88. package/lib/drawer/helpers.js +3 -2
  89. package/lib/drawer/index.js +4 -3
  90. package/lib/dropdown/Popup.d.ts +1 -1
  91. package/lib/dropdown/Popup.js +39 -38
  92. package/lib/dropdown/helper.js +5 -3
  93. package/lib/dropdown/types.d.ts +0 -1
  94. package/lib/dropdown/withDropdown.js +58 -37
  95. package/lib/fieldset/index.js +56 -50
  96. package/lib/fieldset/types.d.ts +0 -2
  97. package/lib/form/Field.d.ts +0 -2
  98. package/lib/form/Field.js +74 -68
  99. package/lib/form/FieldArray.d.ts +0 -2
  100. package/lib/form/FieldArray.js +90 -66
  101. package/lib/form/FieldNumber.d.ts +0 -2
  102. package/lib/form/FieldNumber.js +53 -33
  103. package/lib/form/FieldPeriod.d.ts +0 -2
  104. package/lib/form/FieldPeriod.js +52 -46
  105. package/lib/form/helpers.d.ts +0 -2
  106. package/lib/form/helpers.js +26 -21
  107. package/lib/form/index.d.ts +0 -2
  108. package/lib/form/index.js +143 -111
  109. package/lib/form/types.d.ts +4 -7
  110. package/lib/form/withFieldHOC.d.ts +0 -2
  111. package/lib/form/withFieldHOC.js +38 -31
  112. package/lib/form/withFormSecurity.d.ts +0 -2
  113. package/lib/form/withFormSecurity.js +34 -26
  114. package/lib/gridlayout/GridCol.js +13 -13
  115. package/lib/gridlayout/GridRow.js +11 -17
  116. package/lib/gridlayout/index.js +3 -2
  117. package/lib/gridlayout/types.d.ts +1 -1
  118. package/lib/hint/index.d.ts +1 -2
  119. package/lib/hint/index.js +28 -17
  120. package/lib/hint/types.d.ts +0 -3
  121. package/lib/icons/helper.d.ts +0 -4
  122. package/lib/icons/helper.js +4 -7
  123. package/lib/icons/index.d.ts +2 -3
  124. package/lib/icons/index.js +47 -42
  125. package/lib/icons/types.d.ts +9 -22
  126. package/lib/index.d.ts +1 -2
  127. package/lib/index.js +9 -9
  128. package/lib/inputs/base/InputTextBase.d.ts +0 -2
  129. package/lib/inputs/base/InputTextBase.js +111 -143
  130. package/lib/inputs/base/helpers.d.ts +2 -3
  131. package/lib/inputs/base/helpers.js +25 -20
  132. package/lib/inputs/base/types.d.ts +3 -17
  133. package/lib/inputs/color/index.js +38 -27
  134. package/lib/inputs/date/Dialog.d.ts +0 -2
  135. package/lib/inputs/date/Dialog.js +9 -8
  136. package/lib/inputs/date/Dropdown.d.ts +0 -2
  137. package/lib/inputs/date/Dropdown.js +10 -11
  138. package/lib/inputs/date/helpers.d.ts +0 -2
  139. package/lib/inputs/date/helpers.js +13 -13
  140. package/lib/inputs/date/index.d.ts +0 -2
  141. package/lib/inputs/date/index.js +150 -125
  142. package/lib/inputs/date/types.d.ts +1 -4
  143. package/lib/inputs/file/DefaultFile.d.ts +0 -2
  144. package/lib/inputs/file/DefaultFile.js +72 -45
  145. package/lib/inputs/file/DragDropFile.d.ts +0 -2
  146. package/lib/inputs/file/DragDropFile.js +147 -95
  147. package/lib/inputs/file/File.d.ts +1 -3
  148. package/lib/inputs/file/File.js +28 -22
  149. package/lib/inputs/file/FileButtonSettings.d.ts +0 -2
  150. package/lib/inputs/file/FileButtonSettings.js +12 -12
  151. package/lib/inputs/file/helpers.d.ts +0 -2
  152. package/lib/inputs/file/helpers.js +6 -4
  153. package/lib/inputs/file/index.d.ts +0 -2
  154. package/lib/inputs/file/index.js +4 -3
  155. package/lib/inputs/file/types.d.ts +0 -2
  156. package/lib/inputs/inputHOC.d.ts +1 -2
  157. package/lib/inputs/inputHOC.js +32 -19
  158. package/lib/inputs/mask/BaseMask.d.ts +5 -4
  159. package/lib/inputs/mask/BaseMask.js +34 -121
  160. package/lib/inputs/mask/Cnpj.d.ts +0 -2
  161. package/lib/inputs/mask/Cnpj.js +29 -16
  162. package/lib/inputs/mask/Cpf.d.ts +0 -2
  163. package/lib/inputs/mask/Cpf.js +35 -18
  164. package/lib/inputs/mask/Phone.d.ts +0 -2
  165. package/lib/inputs/mask/Phone.js +4 -5
  166. package/lib/inputs/mask/ZipCode.d.ts +0 -2
  167. package/lib/inputs/mask/ZipCode.js +7 -4
  168. package/lib/inputs/mask/helpers.d.ts +12 -53
  169. package/lib/inputs/mask/helpers.js +36 -90
  170. package/lib/inputs/{errorMessage/index.d.ts → mask/imaskHOC.d.ts} +7 -5
  171. package/lib/inputs/mask/imaskHOC.js +224 -0
  172. package/lib/inputs/mask/index.d.ts +2 -4
  173. package/lib/inputs/mask/index.js +6 -5
  174. package/lib/inputs/mask/types.d.ts +18 -22
  175. package/lib/inputs/multiSelect/ActionButtons.d.ts +0 -2
  176. package/lib/inputs/multiSelect/ActionButtons.js +21 -22
  177. package/lib/inputs/multiSelect/Dropdown.d.ts +0 -2
  178. package/lib/inputs/multiSelect/Dropdown.js +65 -48
  179. package/lib/inputs/multiSelect/helper.d.ts +0 -2
  180. package/lib/inputs/multiSelect/helper.js +7 -8
  181. package/lib/inputs/multiSelect/index.d.ts +0 -2
  182. package/lib/inputs/multiSelect/index.js +132 -80
  183. package/lib/inputs/multiSelect/types.d.ts +0 -2
  184. package/lib/inputs/number/BaseNumber.d.ts +2 -3
  185. package/lib/inputs/number/BaseNumber.js +21 -22
  186. package/lib/inputs/number/Currency.d.ts +2 -3
  187. package/lib/inputs/number/Currency.js +6 -6
  188. package/lib/inputs/number/Decimal.d.ts +2 -3
  189. package/lib/inputs/number/Decimal.js +5 -2
  190. package/lib/inputs/number/format_number.js +5 -5
  191. package/lib/inputs/number/index.d.ts +2 -3
  192. package/lib/inputs/number/index.js +49 -18
  193. package/lib/inputs/number/types.d.ts +14 -15
  194. package/lib/inputs/period/Dialog.d.ts +1 -3
  195. package/lib/inputs/period/Dialog.js +9 -8
  196. package/lib/inputs/period/Dropdown.d.ts +0 -2
  197. package/lib/inputs/period/Dropdown.js +8 -7
  198. package/lib/inputs/period/PeriodList.d.ts +0 -2
  199. package/lib/inputs/period/PeriodList.js +12 -13
  200. package/lib/inputs/period/helper.d.ts +0 -2
  201. package/lib/inputs/period/helper.js +36 -33
  202. package/lib/inputs/period/index.d.ts +0 -2
  203. package/lib/inputs/period/index.js +194 -160
  204. package/lib/inputs/period/types.d.ts +1 -3
  205. package/lib/inputs/search/index.d.ts +1 -2
  206. package/lib/inputs/search/index.js +63 -40
  207. package/lib/inputs/select/ActionButtons.d.ts +1 -2
  208. package/lib/inputs/select/ActionButtons.js +34 -24
  209. package/lib/inputs/select/Dropdown.d.ts +1 -2
  210. package/lib/inputs/select/Dropdown.js +58 -39
  211. package/lib/inputs/select/helper.d.ts +1 -2
  212. package/lib/inputs/select/helper.js +43 -49
  213. package/lib/inputs/select/index.d.ts +0 -2
  214. package/lib/inputs/select/index.js +8 -9
  215. package/lib/inputs/select/multiple/Selecteds.d.ts +1 -3
  216. package/lib/inputs/select/multiple/Selecteds.js +21 -16
  217. package/lib/inputs/select/multiple/index.d.ts +0 -2
  218. package/lib/inputs/select/multiple/index.js +176 -128
  219. package/lib/inputs/select/simple/index.d.ts +0 -2
  220. package/lib/inputs/select/simple/index.js +179 -151
  221. package/lib/inputs/select/types.d.ts +2 -5
  222. package/lib/inputs/text/index.js +5 -2
  223. package/lib/inputs/textarea/index.d.ts +0 -2
  224. package/lib/inputs/textarea/index.js +9 -9
  225. package/lib/inputs/textarea/types.d.ts +0 -2
  226. package/lib/inputs/types.d.ts +7 -12
  227. package/lib/internals/colorStyles.js +3 -2
  228. package/lib/internals/constants.js +4 -2
  229. package/lib/internals/types.d.ts +2 -5
  230. package/lib/internals/withTooltip.d.ts +2 -3
  231. package/lib/internals/withTooltip.js +74 -74
  232. package/lib/labelMessages/index.js +41 -21
  233. package/lib/labels/DangerLabel.js +5 -6
  234. package/lib/labels/DefaultLabel.js +39 -25
  235. package/lib/labels/InfoLabel.js +5 -6
  236. package/lib/labels/PrimaryLabel.js +5 -6
  237. package/lib/labels/SuccessLabel.js +5 -6
  238. package/lib/labels/WarningLabel.js +5 -6
  239. package/lib/labels/index.js +8 -7
  240. package/lib/labels/label_container/index.js +7 -7
  241. package/lib/list/Header.js +7 -8
  242. package/lib/list/Item.js +68 -72
  243. package/lib/list/Separator.js +7 -4
  244. package/lib/list/helpers.js +5 -3
  245. package/lib/list/index.js +100 -73
  246. package/lib/menus/float/MenuItem.js +19 -18
  247. package/lib/menus/float/SubMenuContainer.js +32 -26
  248. package/lib/menus/float/helpers.js +3 -2
  249. package/lib/menus/float/index.js +17 -16
  250. package/lib/menus/float/types.d.ts +1 -1
  251. package/lib/menus/index.js +2 -1
  252. package/lib/menus/sidenav/ExpandMenu.js +7 -8
  253. package/lib/menus/sidenav/MenuLink.js +8 -9
  254. package/lib/menus/sidenav/NavMenuGroup.js +11 -12
  255. package/lib/menus/sidenav/NavMenuItem.js +60 -46
  256. package/lib/menus/sidenav/NavSubMenuItem.js +24 -19
  257. package/lib/menus/sidenav/helpers.js +8 -5
  258. package/lib/menus/sidenav/index.js +111 -83
  259. package/lib/menus/sidenav/popup_menu_search/EmptyList.js +6 -6
  260. package/lib/menus/sidenav/popup_menu_search/index.js +83 -63
  261. package/lib/menus/sidenav/types.d.ts +1 -1
  262. package/lib/noPermission/index.js +16 -13
  263. package/lib/panel/Content.d.ts +1 -1
  264. package/lib/panel/Content.js +56 -43
  265. package/lib/panel/DangerPanel.d.ts +1 -1
  266. package/lib/panel/DangerPanel.js +7 -4
  267. package/lib/panel/Default.d.ts +1 -1
  268. package/lib/panel/Default.js +56 -41
  269. package/lib/panel/Header.d.ts +1 -1
  270. package/lib/panel/Header.js +26 -28
  271. package/lib/panel/InfoPanel.d.ts +1 -1
  272. package/lib/panel/InfoPanel.js +7 -4
  273. package/lib/panel/PrimaryPanel.d.ts +1 -1
  274. package/lib/panel/PrimaryPanel.js +7 -4
  275. package/lib/panel/SuccessPanel.d.ts +1 -1
  276. package/lib/panel/SuccessPanel.js +7 -4
  277. package/lib/panel/ToolBar.d.ts +1 -1
  278. package/lib/panel/ToolBar.js +4 -5
  279. package/lib/panel/WarningPanel.d.ts +1 -1
  280. package/lib/panel/WarningPanel.js +7 -4
  281. package/lib/panel/helpers.d.ts +2 -7
  282. package/lib/panel/helpers.js +23 -11
  283. package/lib/panel/index.d.ts +1 -1
  284. package/lib/panel/index.js +9 -8
  285. package/lib/panel/types.d.ts +5 -46
  286. package/lib/permissionValidations.js +29 -24
  287. package/lib/popover/PopoverText.js +4 -5
  288. package/lib/popover/PopoverTitle.js +4 -5
  289. package/lib/popover/index.js +18 -14
  290. package/lib/progress/Bar.js +36 -30
  291. package/lib/progress/index.js +18 -16
  292. package/lib/radio/index.js +55 -34
  293. package/lib/shortcuts/index.js +8 -9
  294. package/lib/skeleton/SkeletonContainer.js +10 -9
  295. package/lib/skeleton/index.js +32 -25
  296. package/lib/spinner/SpinnerLoading.js +7 -6
  297. package/lib/spinner/index.js +36 -22
  298. package/lib/split/Split.js +110 -93
  299. package/lib/split/SplitSide.js +18 -19
  300. package/lib/split/helpers.js +3 -2
  301. package/lib/split/index.js +3 -2
  302. package/lib/table/Body.js +44 -41
  303. package/lib/table/Header.js +31 -28
  304. package/lib/table/HeaderColumn.d.ts +1 -1
  305. package/lib/table/HeaderColumn.js +21 -34
  306. package/lib/table/Row.js +47 -44
  307. package/lib/table/RowColumn.js +37 -36
  308. package/lib/table/helpers.js +12 -6
  309. package/lib/table/index.js +98 -78
  310. package/lib/table/types.d.ts +0 -3
  311. package/lib/tabs/{MenuTabs.d.ts → DropdownItems.d.ts} +3 -3
  312. package/lib/tabs/DropdownItems.js +65 -0
  313. package/lib/tabs/Menu.d.ts +1 -1
  314. package/lib/tabs/Menu.js +20 -32
  315. package/lib/tabs/MenuItems.d.ts +11 -0
  316. package/lib/tabs/MenuItems.js +76 -0
  317. package/lib/tabs/Panel.d.ts +1 -1
  318. package/lib/tabs/Panel.js +65 -69
  319. package/lib/tabs/index.d.ts +1 -1
  320. package/lib/tabs/index.js +221 -42
  321. package/lib/tabs/tabHelpers.d.ts +15 -4
  322. package/lib/tabs/tabHelpers.js +41 -36
  323. package/lib/tabs/types.d.ts +15 -48
  324. package/lib/toolbar/ButtonBar.js +39 -35
  325. package/lib/toolbar/LabelBar.js +36 -32
  326. package/lib/toolbar/Separator.js +7 -4
  327. package/lib/toolbar/ToolBarGroup.js +6 -6
  328. package/lib/toolbar/helpers.js +3 -2
  329. package/lib/toolbar/index.js +21 -19
  330. package/lib/toolbar/types.d.ts +0 -1
  331. package/lib/tooltip/index.js +32 -27
  332. package/lib/treetable/Body.js +32 -20
  333. package/lib/treetable/Header.js +14 -11
  334. package/lib/treetable/Row.js +137 -85
  335. package/lib/treetable/helpers.js +24 -15
  336. package/lib/treetable/index.js +10 -8
  337. package/lib/treeview/Header.js +6 -7
  338. package/lib/treeview/Node.js +132 -92
  339. package/lib/treeview/constants.js +2 -1
  340. package/lib/treeview/index.js +214 -148
  341. package/lib/treeview_old/Header.js +28 -0
  342. package/lib/treeview_old/Node.js +88 -0
  343. package/lib/treeview_old/index.js +42 -0
  344. package/lib/types-c2a0f035.d.ts +50 -0
  345. package/lib/uitour/helpers.js +7 -4
  346. package/lib/uitour/index.d.ts +1 -2
  347. package/lib/uitour/index.js +99 -112
  348. package/lib/uitour/types.d.ts +1 -9
  349. package/package.json +82 -77
  350. package/tsconfig.json +0 -1
  351. package/.eslintcache +0 -1
  352. package/.nvmrc +0 -1
  353. package/lib/assets/styles/error.scss +0 -9
  354. package/lib/assets/styles/textContent.scss +0 -9
  355. package/lib/hint/helpers.d.ts +0 -3
  356. package/lib/hint/helpers.js +0 -21
  357. package/lib/inputs/base/Label.d.ts +0 -14
  358. package/lib/inputs/base/Label.js +0 -35
  359. package/lib/inputs/errorMessage/index.js +0 -26
  360. package/lib/tabs/DropdownTabs.d.ts +0 -11
  361. package/lib/tabs/DropdownTabs.js +0 -71
  362. package/lib/tabs/MenuTabs.js +0 -82
  363. package/lib/tabs/context.d.ts +0 -12
  364. package/lib/tabs/context.js +0 -130
  365. package/lib/tabs/useTabs.d.ts +0 -11
  366. package/lib/tabs/useTabs.js +0 -11
  367. package/lib/textContent/index.d.ts +0 -8
  368. package/lib/textContent/index.js +0 -30
package/lib/form/index.js CHANGED
@@ -1,29 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  Object.defineProperty(exports, "Field", {
7
8
  enumerable: true,
8
- get: function () {
9
+ get: function get() {
9
10
  return _Field.default;
10
11
  }
11
12
  });
12
13
  Object.defineProperty(exports, "FieldArray", {
13
14
  enumerable: true,
14
- get: function () {
15
+ get: function get() {
15
16
  return _FieldArray.default;
16
17
  }
17
18
  });
18
19
  Object.defineProperty(exports, "FieldNumber", {
19
20
  enumerable: true,
20
- get: function () {
21
+ get: function get() {
21
22
  return _FieldNumber.default;
22
23
  }
23
24
  });
24
25
  Object.defineProperty(exports, "FieldPeriod", {
25
26
  enumerable: true,
26
- get: function () {
27
+ get: function get() {
27
28
  return _FieldPeriod.default;
28
29
  }
29
30
  });
@@ -39,106 +40,130 @@ require("../assets/styles/form.scss");
39
40
  var _dialog = require("../dialog");
40
41
  var _withFormSecurity = require("./withFormSecurity");
41
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
43
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
43
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
44
45
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
45
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
46
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
46
+ 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; }
47
+ 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; }
47
48
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
48
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
49
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
50
- const Form = _ref => {
51
- let {
52
- submitOnPressEnterKey = true,
53
- dataSource,
54
- securityBeforeUnload,
55
- handlerReset,
56
- handlerSubmit,
57
- handlerValidates,
58
- style,
59
- customClass,
60
- securityTitle,
61
- securityText,
62
- securityData,
63
- onDataChange,
64
- onValidateForm,
65
- externalFieldErrors,
66
- onSubmit,
67
- skeletonize,
68
- disabled,
69
- children,
70
- useInternalState = false
71
- } = _ref;
72
- const [data, setData] = (0, _react.useState)(dataSource);
73
- const [originalData, setOriginalData] = (0, _react.useState)(dataSource);
74
- const [submitFormOnEnter, setSubmitFormOnEnter] = (0, _react.useState)(submitOnPressEnterKey);
75
- const [fieldErrors, setFieldErrors] = (0, _react.useState)({});
76
- const fieldsValidators = (0, _react.useRef)({});
77
- const [oldFieldsValidatorsQuantity, setOldFieldsValidatorsQuantity] = (0, _react.useState)(0);
78
- const context = (0, _react.useContext)(_withFormSecurity.FormSecurityContext);
79
- const usedData = useInternalState ? data : dataSource;
80
- const getValidatesErrorMessages = (validators, fieldValue) => {
81
- const validatorsArray = !(validators instanceof Array) ? [validators] : validators;
82
- let errors = [];
83
- validatorsArray.forEach(validator => {
49
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
50
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
51
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
52
+ 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."); }
53
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
54
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
55
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
56
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
57
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
58
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
59
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
60
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
61
+ var Form = function Form(_ref) {
62
+ var _ref$submitOnPressEnt = _ref.submitOnPressEnterKey,
63
+ submitOnPressEnterKey = _ref$submitOnPressEnt === void 0 ? true : _ref$submitOnPressEnt,
64
+ dataSource = _ref.dataSource,
65
+ securityBeforeUnload = _ref.securityBeforeUnload,
66
+ handlerReset = _ref.handlerReset,
67
+ handlerSubmit = _ref.handlerSubmit,
68
+ handlerValidates = _ref.handlerValidates,
69
+ style = _ref.style,
70
+ customClass = _ref.customClass,
71
+ securityTitle = _ref.securityTitle,
72
+ securityText = _ref.securityText,
73
+ securityData = _ref.securityData,
74
+ onDataChange = _ref.onDataChange,
75
+ onValidateForm = _ref.onValidateForm,
76
+ externalFieldErrors = _ref.externalFieldErrors,
77
+ onSubmit = _ref.onSubmit,
78
+ skeletonize = _ref.skeletonize,
79
+ disabled = _ref.disabled,
80
+ children = _ref.children,
81
+ _ref$useInternalState = _ref.useInternalState,
82
+ useInternalState = _ref$useInternalState === void 0 ? false : _ref$useInternalState;
83
+ var _useState = (0, _react.useState)(dataSource),
84
+ _useState2 = _slicedToArray(_useState, 2),
85
+ data = _useState2[0],
86
+ setData = _useState2[1];
87
+ var _useState3 = (0, _react.useState)(dataSource),
88
+ _useState4 = _slicedToArray(_useState3, 2),
89
+ originalData = _useState4[0],
90
+ setOriginalData = _useState4[1];
91
+ var _useState5 = (0, _react.useState)(submitOnPressEnterKey),
92
+ _useState6 = _slicedToArray(_useState5, 2),
93
+ submitFormOnEnter = _useState6[0],
94
+ setSubmitFormOnEnter = _useState6[1];
95
+ var _useState7 = (0, _react.useState)({}),
96
+ _useState8 = _slicedToArray(_useState7, 2),
97
+ fieldErrors = _useState8[0],
98
+ setFieldErrors = _useState8[1];
99
+ var fieldsValidators = (0, _react.useRef)({});
100
+ var _useState9 = (0, _react.useState)(0),
101
+ _useState10 = _slicedToArray(_useState9, 2),
102
+ oldFieldsValidatorsQuantity = _useState10[0],
103
+ setOldFieldsValidatorsQuantity = _useState10[1];
104
+ var context = (0, _react.useContext)(_withFormSecurity.FormSecurityContext);
105
+ var usedData = useInternalState ? data : dataSource;
106
+ var getValidatesErrorMessages = function getValidatesErrorMessages(validators, fieldValue) {
107
+ var validatorsArray = !(validators instanceof Array) ? [validators] : validators;
108
+ var errors = [];
109
+ validatorsArray.forEach(function (validator) {
84
110
  if (typeof validator === 'function') {
85
- const result = validator(fieldValue);
86
- if (result) errors = [...errors, result];
111
+ var result = validator(fieldValue);
112
+ if (result) errors = [].concat(_toConsumableArray(errors), [result]);
87
113
  }
88
114
  });
89
115
  return errors;
90
116
  };
91
- const getErrorMessages = (currentData, currentValidators) => {
92
- const dataValidate = currentData || usedData;
93
- let currentFieldErrors = _lodash.default.pickBy(fieldErrors, (error, fieldName) => {
94
- const fieldValidatorsNames = Object.keys(currentValidators);
117
+ var getErrorMessages = function getErrorMessages(currentData, currentValidators) {
118
+ var dataValidate = currentData || usedData;
119
+ var currentFieldErrors = _lodash.default.pickBy(fieldErrors, function (error, fieldName) {
120
+ var fieldValidatorsNames = Object.keys(currentValidators);
95
121
  return fieldValidatorsNames.includes(fieldName);
96
122
  });
97
- _lodash.default.forEach(currentValidators, (validators, fieldName) => {
98
- const fieldValue = _lodash.default.get(dataValidate, fieldName);
99
- const messages = getValidatesErrorMessages(validators, fieldValue);
100
- currentFieldErrors = _objectSpread(_objectSpread({}, currentFieldErrors), {}, {
101
- [fieldName]: messages
102
- });
123
+ _lodash.default.forEach(currentValidators, function (validators, fieldName) {
124
+ var fieldValue = _lodash.default.get(dataValidate, fieldName);
125
+ var messages = getValidatesErrorMessages(validators, fieldValue);
126
+ currentFieldErrors = _objectSpread(_objectSpread({}, currentFieldErrors), {}, _defineProperty({}, fieldName, messages));
103
127
  });
104
128
  return currentFieldErrors;
105
129
  };
106
- const checkIsValid = function (currentData) {
107
- let updateState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
108
- let currentValidators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
109
- const currentFieldErrors = getErrorMessages(currentData, currentValidators || fieldsValidators.current);
130
+ var checkIsValid = function checkIsValid(currentData) {
131
+ var updateState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
132
+ var currentValidators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
133
+ var currentFieldErrors = getErrorMessages(currentData, currentValidators || fieldsValidators.current);
110
134
  if (updateState) setFieldErrors(currentFieldErrors);
111
- return Object.values(currentFieldErrors).every(value => value.length === 0);
135
+ return Object.values(currentFieldErrors).every(function (value) {
136
+ return value.length === 0;
137
+ });
112
138
  };
113
- const onFieldChange = (0, _react.useCallback)(event => {
114
- const {
115
- target
116
- } = event;
139
+ var onFieldChange = function onFieldChange(event) {
140
+ var target = event.target;
117
141
  if (!useInternalState && onDataChange) {
118
- onDataChange(prevState => (0, _helpers.changeValue)(prevState, target));
142
+ var newData = (0, _helpers.changeValue)(dataSource, target);
143
+ onDataChange(newData);
119
144
  } else {
120
- setData(prevState => (0, _helpers.changeValue)(prevState, target));
145
+ setData(function (prevState) {
146
+ return (0, _helpers.changeValue)(prevState, target);
147
+ });
121
148
  }
122
- }, []);
123
- const onValidate = (fieldName, fieldValue, validators) => {
149
+ };
150
+ var onValidate = function onValidate(fieldName, fieldValue, validators) {
124
151
  if (validators) {
125
- let currentFieldErrors = fieldErrors;
126
- const errors = getValidatesErrorMessages(validators, fieldValue);
152
+ var currentFieldErrors = fieldErrors;
153
+ var errors = getValidatesErrorMessages(validators, fieldValue);
127
154
  if (errors.length === 0) {
128
155
  currentFieldErrors = _lodash.default.omit(currentFieldErrors, fieldName);
129
156
  } else {
130
- currentFieldErrors = _objectSpread(_objectSpread({}, currentFieldErrors), {}, {
131
- [fieldName]: errors
132
- });
157
+ currentFieldErrors = _objectSpread(_objectSpread({}, currentFieldErrors), {}, _defineProperty({}, fieldName, errors));
133
158
  }
134
159
  setFieldErrors(currentFieldErrors);
135
160
  }
136
161
  };
137
- const onFormSubmit = (0, _react.useCallback)(event => {
162
+ var onFormSubmit = function onFormSubmit(event) {
138
163
  if (event) event.preventDefault();
139
164
  if (checkIsValid(usedData)) onSubmit(usedData);
140
- }, [usedData]);
141
- const onReset = () => {
165
+ };
166
+ var onReset = function onReset() {
142
167
  if (!useInternalState && onDataChange) {
143
168
  onDataChange(JSON.parse(JSON.stringify(originalData)));
144
169
  } else {
@@ -146,95 +171,101 @@ const Form = _ref => {
146
171
  }
147
172
  setFieldErrors({});
148
173
  };
149
- const onRemoveFieldValidators = fieldName => {
150
- const newFieldsValidators = _lodash.default.omit(fieldsValidators, fieldName);
174
+ var onRemoveFieldValidators = function onRemoveFieldValidators(fieldName) {
175
+ var newFieldsValidators = _lodash.default.omit(fieldsValidators, fieldName);
151
176
  fieldsValidators.current = newFieldsValidators;
152
177
  };
153
- const onBeforeUnload = e => {
154
- const event = e;
178
+ var onBeforeUnload = function onBeforeUnload(e) {
179
+ var event = e;
155
180
  event.preventDefault();
156
181
  if (_lodash.default.isEqual(usedData, originalData)) {
157
182
  return;
158
183
  }
159
184
  event.returnValue = true;
160
185
  };
161
- const submitOnEnter = event => {
186
+ var submitOnEnter = function submitOnEnter(event) {
162
187
  if (event.key === 'Enter') {
163
188
  event.preventDefault();
164
189
  if (submitFormOnEnter) onFormSubmit();
165
190
  }
166
191
  };
167
- const formProps = () => {
168
- let propsForm = null;
192
+ var formProps = function formProps() {
193
+ var propsForm = null;
169
194
  if (!disabled) {
170
195
  propsForm = {
171
- onSubmit: event => event.preventDefault(),
172
- onKeyPress: event => submitOnEnter(event)
196
+ onSubmit: function onSubmit(event) {
197
+ return event.preventDefault();
198
+ },
199
+ onKeyPress: function onKeyPress(event) {
200
+ return submitOnEnter(event);
201
+ }
173
202
  };
174
203
  }
175
204
  return propsForm;
176
205
  };
177
- const updateFormState = () => {
206
+ var updateFormState = function updateFormState() {
178
207
  if (!_lodash.default.isEmpty(context)) {
179
- const {
180
- onChangedData
181
- } = context;
208
+ var onChangedData = context.onChangedData;
182
209
  if (securityData && !_lodash.default.isEqual(usedData, securityData)) {
183
210
  onChangedData(true);
184
211
  } else {
185
212
  onChangedData(false);
186
213
  }
187
214
  }
188
- if (onDataChange && useInternalState) onDataChange(usedData);
215
+ if (onDataChange) onDataChange(usedData);
189
216
 
190
217
  // TODO - Usar debounce para evitar chamada a cada letra digitada
191
218
  if (onValidateForm) onValidateForm(checkIsValid(usedData, true));
192
219
  if (!disabled) {
193
220
  handlerSubmit(onFormSubmit);
194
221
  if (handlerReset) handlerReset(onReset);
195
- if (handlerValidates) handlerValidates(() => checkIsValid(usedData));
222
+ if (handlerValidates) handlerValidates(function () {
223
+ return checkIsValid(usedData);
224
+ });
196
225
  }
197
226
  if (_lodash.default.isEmpty(usedData)) setOriginalData(usedData);
198
227
  };
199
- (0, _react.useEffect)(() => {
228
+ (0, _react.useEffect)(function () {
200
229
  if (useInternalState) updateFormState();
201
230
  }, [JSON.stringify(data), useInternalState]);
202
- (0, _react.useEffect)(() => {
231
+ (0, _react.useEffect)(function () {
203
232
  if (!useInternalState && onDataChange) updateFormState();
204
233
  }, [JSON.stringify(dataSource), useInternalState]);
205
- (0, _react.useEffect)(() => {
234
+ (0, _react.useEffect)(function () {
206
235
  if (securityBeforeUnload) {
207
236
  if (context) context.setSecurityBeforeUnload(true);
208
237
  window.addEventListener('beforeunload', onBeforeUnload);
209
238
  }
210
- return () => window.removeEventListener('beforeunload', onBeforeUnload);
239
+ return function () {
240
+ return window.removeEventListener('beforeunload', onBeforeUnload);
241
+ };
211
242
  }, [securityBeforeUnload, onBeforeUnload]);
212
- (0, _react.useEffect)(() => {
243
+ (0, _react.useEffect)(function () {
213
244
  if (!disabled && submitOnPressEnterKey !== submitFormOnEnter) {
214
245
  setSubmitFormOnEnter(submitOnPressEnterKey);
215
246
  }
216
247
  }, [submitOnPressEnterKey]);
217
- (0, _react.useEffect)(() => {
218
- const newValidatorsQuantity = Object.values(fieldsValidators.current).reduce((acc, currentValue) => acc + ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) || 0), 0);
248
+ (0, _react.useEffect)(function () {
249
+ var newValidatorsQuantity = Object.values(fieldsValidators.current).reduce(function (acc, currentValue) {
250
+ return acc + ((currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) || 0);
251
+ }, 0);
219
252
  if (fieldsValidators.current && onValidateForm && oldFieldsValidatorsQuantity !== newValidatorsQuantity) {
220
253
  setOldFieldsValidatorsQuantity(newValidatorsQuantity);
221
254
  onValidateForm(checkIsValid(usedData, true, fieldsValidators.current));
222
255
  }
223
256
  }, [fieldsValidators.current, oldFieldsValidatorsQuantity, onValidateForm, JSON.stringify(usedData)]);
224
- const contextValues = {
225
- skeletonize,
257
+ var contextValues = {
258
+ skeletonize: skeletonize,
226
259
  handlerFieldChange: onFieldChange,
227
260
  handlerFieldValidade: onValidate,
228
- handlerStoreValidators: (fieldName, fieldValidates) => {
229
- fieldsValidators.current = _objectSpread(_objectSpread({}, fieldsValidators.current), {}, {
230
- [fieldName]: fieldValidates
231
- });
261
+ handlerStoreValidators: function handlerStoreValidators(fieldName, fieldValidates) {
262
+ fieldsValidators.current = _objectSpread(_objectSpread({}, fieldsValidators.current), {}, _defineProperty({}, fieldName, fieldValidates));
232
263
  },
233
264
  handlerRemoveValidators: onRemoveFieldValidators,
234
265
  data: useInternalState ? data : dataSource,
235
- originalData,
236
- fieldErrors,
237
- externalFieldErrors
266
+ originalData: originalData,
267
+ fieldErrors: fieldErrors,
268
+ externalFieldErrors: externalFieldErrors
238
269
  };
239
270
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Provider, {
240
271
  value: contextValues
@@ -248,8 +279,9 @@ const Form = _ref => {
248
279
  title: securityTitle || 'Dados Alterados',
249
280
  text: securityText || 'Você possui dados alterados, confirma o fechamento?',
250
281
  visible: !_lodash.default.isEmpty(context) && context.showQuestion,
251
- onConfirmClick: context ? context.onConfirmClick : () => {},
252
- onUnconfirmClick: context ? context.onUnconfirmClick : () => {}
282
+ onConfirmClick: context ? context.onConfirmClick : function () {},
283
+ onUnconfirmClick: context ? context.onUnconfirmClick : function () {}
253
284
  }));
254
285
  };
255
- var _default = exports.default = Form;
286
+ var _default = Form;
287
+ exports.default = _default;
@@ -5,8 +5,6 @@ import '../@types/DataCombo.js';
5
5
  import '../@types/PermissionAttr.js';
6
6
  import '../inputs/base/types.js';
7
7
  import '../@types/Period.js';
8
- import '../internals/types.js';
9
- import '../@types/Position.js';
10
8
 
11
9
  type Validator = (value: string) => string | undefined;
12
10
  type PeriodValidator = (value: {
@@ -38,13 +36,12 @@ type BaseFormProps = {
38
36
  skeletonize?: boolean;
39
37
  disabled?: boolean;
40
38
  };
41
- type OnDataChange = React.Dispatch<React.SetStateAction<any>>;
42
39
  type FormProps = BaseFormProps & ({
43
40
  useInternalState?: false;
44
- onDataChange: OnDataChange;
41
+ onDataChange: (data: object) => void;
45
42
  } | {
46
43
  useInternalState: true;
47
- onDataChange?: OnDataChange;
44
+ onDataChange?: (data: object) => void;
48
45
  });
49
46
  type Data = {
50
47
  [key: string]: any;
@@ -85,6 +82,7 @@ interface IFieldProps extends WithFieldProps {
85
82
  autoFocus?: boolean;
86
83
  autoCompleteMask?: 'left' | 'right';
87
84
  mask?: string;
85
+ removeZeroLeft?: boolean;
88
86
  }
89
87
  interface CustomEvent {
90
88
  target: {
@@ -172,14 +170,12 @@ interface WithFieldProps {
172
170
  handlerStoreValidators?: (name: string, validators: Validator | Validator[]) => void;
173
171
  handlerRemoveValidators?: (name: string) => void;
174
172
  validators?: Validator | Validator[] | PeriodValidator | PeriodValidator[];
175
- customClass?: string;
176
173
  }
177
174
  interface IWithFieldContext {
178
175
  validatorFromComponent: Validator | Validator[] | undefined;
179
176
  handlerSetValidatorFromComponent: (validator: Validator | Validator[]) => void;
180
177
  }
181
178
  interface IWithFormSecurity {
182
- onOpenChange?: (open: boolean) => void;
183
179
  handlerClose?: () => void;
184
180
  onClick?: MouseEventHandler;
185
181
  children?: ReactNode;
@@ -203,6 +199,7 @@ interface IEventParams {
203
199
  handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => void;
204
200
  validatorFromComponent?: Validator | Validator[];
205
201
  handleShowValidateMessages: (value: boolean) => void;
202
+ component?: ComponentType<any>;
206
203
  }
207
204
  interface IGetErrorMessagesParams {
208
205
  name: string;
@@ -6,8 +6,6 @@ import '../@types/DataCombo.js';
6
6
  import '../@types/PermissionAttr.js';
7
7
  import '../inputs/base/types.js';
8
8
  import '../@types/Period.js';
9
- import '../internals/types.js';
10
- import '../@types/Position.js';
11
9
 
12
10
  declare const withFieldHOC: <ComponentProps extends WithFieldProps>(WrappedComponent: React__default.ComponentType<ComponentProps>) => React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ComponentProps> & React__default.RefAttributes<HTMLElement>>;
13
11
 
@@ -1,39 +1,47 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
8
  var _react = _interopRequireWildcard(require("react"));
8
9
  var _helpers = require("./helpers");
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
12
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
12
- const withFieldHOC = WrappedComponent => {
13
- const EnhancedComponent = props => {
14
- const {
15
- name,
16
- validators,
17
- handlerStoreValidators,
18
- handlerRemoveValidators
19
- } = props;
20
- const [validatorFromComponent, setValidatorFromComponent] = (0, _react.useState)(undefined);
21
- const updateValidators = () => {
22
- const validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+ var withFieldHOC = function withFieldHOC(WrappedComponent) {
20
+ var EnhancedComponent = function EnhancedComponent(props) {
21
+ var name = props.name,
22
+ validators = props.validators,
23
+ handlerStoreValidators = props.handlerStoreValidators,
24
+ handlerRemoveValidators = props.handlerRemoveValidators;
25
+ var _useState = (0, _react.useState)(undefined),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ validatorFromComponent = _useState2[0],
28
+ setValidatorFromComponent = _useState2[1];
29
+ var updateValidators = function updateValidators() {
30
+ var validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
23
31
  if (validatorsArray && handlerStoreValidators) handlerStoreValidators(name, validatorsArray);
24
32
  };
25
- (0, _react.useEffect)(() => {
33
+ (0, _react.useEffect)(function () {
26
34
  updateValidators();
27
- return () => {
35
+ return function () {
28
36
  if (validators && handlerRemoveValidators) handlerRemoveValidators(name);
29
37
  };
30
38
  }, []);
31
- (0, _react.useEffect)(() => {
39
+ (0, _react.useEffect)(function () {
32
40
  updateValidators();
33
41
  }, [validators]);
34
- const contextValues = {
35
- validatorFromComponent,
36
- handlerSetValidatorFromComponent: validator => {
42
+ var contextValues = {
43
+ validatorFromComponent: validatorFromComponent,
44
+ handlerSetValidatorFromComponent: function handlerSetValidatorFromComponent(validator) {
37
45
  setValidatorFromComponent(validator);
38
46
  }
39
47
  };
@@ -42,17 +50,15 @@ const withFieldHOC = WrappedComponent => {
42
50
  }, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
43
51
  };
44
52
  function forwardRef(props, ref) {
45
- return /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Consumer, null, _ref => {
46
- let {
47
- handlerFieldChange,
48
- handlerFieldValidade,
49
- data,
50
- fieldErrors,
51
- externalFieldErrors,
52
- handlerStoreValidators,
53
- handlerRemoveValidators,
54
- skeletonize
55
- } = _ref;
53
+ return /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Consumer, null, function (_ref) {
54
+ var handlerFieldChange = _ref.handlerFieldChange,
55
+ handlerFieldValidade = _ref.handlerFieldValidade,
56
+ data = _ref.data,
57
+ fieldErrors = _ref.fieldErrors,
58
+ externalFieldErrors = _ref.externalFieldErrors,
59
+ handlerStoreValidators = _ref.handlerStoreValidators,
60
+ handlerRemoveValidators = _ref.handlerRemoveValidators,
61
+ skeletonize = _ref.skeletonize;
56
62
  return /*#__PURE__*/_react.default.createElement(EnhancedComponent, _extends({}, props, {
57
63
  skeletonize: skeletonize,
58
64
  handlerFieldChange: handlerFieldChange,
@@ -68,4 +74,5 @@ const withFieldHOC = WrappedComponent => {
68
74
  }
69
75
  return /*#__PURE__*/_react.default.forwardRef(forwardRef);
70
76
  };
71
- var _default = exports.default = withFieldHOC;
77
+ var _default = withFieldHOC;
78
+ exports.default = _default;
@@ -6,8 +6,6 @@ import '../@types/DataCombo.js';
6
6
  import '../@types/PermissionAttr.js';
7
7
  import '../inputs/base/types.js';
8
8
  import '../@types/Period.js';
9
- import '../internals/types.js';
10
- import '../@types/Position.js';
11
9
 
12
10
  declare const FormSecurityContext: React__default.Context<IFormSecurityContext>;
13
11
  declare const withFormSecurity: <ComponentProps extends IWithFormSecurity>(WrappedComponent: React__default.ComponentType<ComponentProps>) => (props: ComponentProps) => JSX.Element;