@talxis/base-controls 1.2407.2 → 1.2408.2

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 (256) hide show
  1. package/dist/components/DateTime/DateTime.js +133 -1
  2. package/dist/components/DateTime/DateTime.js.map +1 -0
  3. package/dist/components/DateTime/components/Calendar.d.ts +1 -1
  4. package/dist/components/DateTime/components/Calendar.js +63 -1
  5. package/dist/components/DateTime/components/Calendar.js.map +1 -0
  6. package/dist/components/DateTime/hooks/useDateTime.js +137 -1
  7. package/dist/components/DateTime/hooks/useDateTime.js.map +1 -0
  8. package/dist/components/DateTime/index.js +3 -1
  9. package/dist/components/DateTime/index.js.map +1 -0
  10. package/dist/components/DateTime/interfaces.d.ts +11 -1
  11. package/dist/components/DateTime/styles.js +37 -1
  12. package/dist/components/DateTime/styles.js.map +1 -0
  13. package/dist/components/DateTime/translations.js +23 -1
  14. package/dist/components/DateTime/translations.js.map +1 -0
  15. package/dist/components/Decimal/Decimal.js +200 -1
  16. package/dist/components/Decimal/Decimal.js.map +1 -0
  17. package/dist/components/Decimal/components/ArrowButtons.js +38 -1
  18. package/dist/components/Decimal/components/ArrowButtons.js.map +1 -0
  19. package/dist/components/Decimal/components/styles.js +26 -1
  20. package/dist/components/Decimal/components/styles.js.map +1 -0
  21. package/dist/components/Decimal/index.js +2 -1
  22. package/dist/components/Decimal/index.js.map +1 -0
  23. package/dist/components/Decimal/interfaces.d.ts +1 -1
  24. package/dist/components/Duration/Duration.js +132 -1
  25. package/dist/components/Duration/Duration.js.map +1 -0
  26. package/dist/components/Duration/durationOptions.d.ts +2 -0
  27. package/dist/components/Duration/durationOptions.js +27 -0
  28. package/dist/components/Duration/durationOptions.js.map +1 -0
  29. package/dist/components/Duration/index.js +2 -1
  30. package/dist/components/Duration/index.js.map +1 -0
  31. package/dist/components/Duration/translations.js +31 -1
  32. package/dist/components/Duration/translations.js.map +1 -0
  33. package/dist/components/Grid/Grid.js +30 -1
  34. package/dist/components/Grid/Grid.js.map +1 -0
  35. package/dist/components/Grid/GridContext.js +6 -1
  36. package/dist/components/Grid/GridContext.js.map +1 -0
  37. package/dist/components/Grid/constants.js +4 -1
  38. package/dist/components/Grid/constants.js.map +1 -0
  39. package/dist/components/Grid/core/components/AgGrid/AgGrid.js +85 -1
  40. package/dist/components/Grid/core/components/AgGrid/AgGrid.js.map +1 -0
  41. package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js +12 -1
  42. package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js.map +1 -0
  43. package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js +23 -1
  44. package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js.map +1 -0
  45. package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js +11 -1
  46. package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js.map +1 -0
  47. package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js +82 -1
  48. package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js.map +1 -0
  49. package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js +169 -1
  50. package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js.map +1 -0
  51. package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js +116 -1
  52. package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js.map +1 -0
  53. package/dist/components/Grid/core/components/AgGrid/styles.js +91 -1
  54. package/dist/components/Grid/core/components/AgGrid/styles.js.map +1 -0
  55. package/dist/components/Grid/core/components/Cell/Commands/Commands.js +29 -1
  56. package/dist/components/Grid/core/components/Cell/Commands/Commands.js.map +1 -0
  57. package/dist/components/Grid/core/components/Cell/Commands/Icon.js +14 -1
  58. package/dist/components/Grid/core/components/Cell/Commands/Icon.js.map +1 -0
  59. package/dist/components/Grid/core/components/Cell/Commands/styles.js +54 -1
  60. package/dist/components/Grid/core/components/Cell/Commands/styles.js.map +1 -0
  61. package/dist/components/Grid/core/components/Cell/Commands/useCommands.js +52 -1
  62. package/dist/components/Grid/core/components/Cell/Commands/useCommands.js.map +1 -0
  63. package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js +148 -1
  64. package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js.map +1 -0
  65. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js +139 -1
  66. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js.map +1 -0
  67. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js +49 -1
  68. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.js.map +1 -0
  69. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js +27 -1
  70. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.js.map +1 -0
  71. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js +58 -1
  72. package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js.map +1 -0
  73. package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js +60 -1
  74. package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js.map +1 -0
  75. package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js +26 -1
  76. package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js.map +1 -0
  77. package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js +19 -1
  78. package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js.map +1 -0
  79. package/dist/components/Grid/core/components/ColumnHeader/styles.js +44 -1
  80. package/dist/components/Grid/core/components/ColumnHeader/styles.js.map +1 -0
  81. package/dist/components/Grid/core/components/Component/Component.js +53 -1
  82. package/dist/components/Grid/core/components/Component/Component.js.map +1 -0
  83. package/dist/components/Grid/core/components/Component/controller/useComponentController.js +31 -1
  84. package/dist/components/Grid/core/components/Component/controller/useComponentController.js.map +1 -0
  85. package/dist/components/Grid/core/components/Component/model/Component.js +225 -1
  86. package/dist/components/Grid/core/components/Component/model/Component.js.map +1 -0
  87. package/dist/components/Grid/core/components/Dialog/Constants.js +9 -1
  88. package/dist/components/Grid/core/components/Dialog/Constants.js.map +1 -0
  89. package/dist/components/Grid/core/components/Dialog/Styles.js +61 -1
  90. package/dist/components/Grid/core/components/Dialog/Styles.js.map +1 -0
  91. package/dist/components/Grid/core/components/Dialog/index.js +16 -1
  92. package/dist/components/Grid/core/components/Dialog/index.js.map +1 -0
  93. package/dist/components/Grid/core/components/Dialog/interfaces/index.js +1 -0
  94. package/dist/components/Grid/core/components/Dialog/interfaces/index.js.map +1 -0
  95. package/dist/components/Grid/core/components/Save/Save.js +47 -1
  96. package/dist/components/Grid/core/components/Save/Save.js.map +1 -0
  97. package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js +39 -1
  98. package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js.map +1 -0
  99. package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js +136 -1
  100. package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js.map +1 -0
  101. package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js +54 -1
  102. package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js.map +1 -0
  103. package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js +37 -1
  104. package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js.map +1 -0
  105. package/dist/components/Grid/core/components/Save/hooks/useSave.js +45 -1
  106. package/dist/components/Grid/core/components/Save/hooks/useSave.js.map +1 -0
  107. package/dist/components/Grid/core/components/Save/styles.js +44 -1
  108. package/dist/components/Grid/core/components/Save/styles.js.map +1 -0
  109. package/dist/components/Grid/core/controllers/useGridController.js +39 -1
  110. package/dist/components/Grid/core/controllers/useGridController.js.map +1 -0
  111. package/dist/components/Grid/core/enums/ConditionOperator.js +50 -1
  112. package/dist/components/Grid/core/enums/ConditionOperator.js.map +1 -0
  113. package/dist/components/Grid/core/enums/DataType.js +30 -1
  114. package/dist/components/Grid/core/enums/DataType.js.map +1 -0
  115. package/dist/components/Grid/core/hooks/useGridInstance.js +9 -1
  116. package/dist/components/Grid/core/hooks/useGridInstance.js.map +1 -0
  117. package/dist/components/Grid/core/hooks/useRefreshCallback.js +20 -1
  118. package/dist/components/Grid/core/hooks/useRefreshCallback.js.map +1 -0
  119. package/dist/components/Grid/core/hooks/useRerender.js +13 -1
  120. package/dist/components/Grid/core/hooks/useRerender.js.map +1 -0
  121. package/dist/components/Grid/core/model/Grid.js +249 -1
  122. package/dist/components/Grid/core/model/Grid.js.map +1 -0
  123. package/dist/components/Grid/core/model/GridDependency.js +28 -1
  124. package/dist/components/Grid/core/model/GridDependency.js.map +1 -0
  125. package/dist/components/Grid/core/model/Metadata.js +22 -1
  126. package/dist/components/Grid/core/model/Metadata.js.map +1 -0
  127. package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js +25 -1
  128. package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js.map +1 -0
  129. package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js +190 -1
  130. package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js.map +1 -0
  131. package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js +50 -1
  132. package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js.map +1 -0
  133. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js +58 -1
  134. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js.map +1 -0
  135. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js +52 -1
  136. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js.map +1 -0
  137. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js +125 -1
  138. package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js.map +1 -0
  139. package/dist/components/Grid/filtering/components/FilterCallout/styles.js +40 -1
  140. package/dist/components/Grid/filtering/components/FilterCallout/styles.js.map +1 -0
  141. package/dist/components/Grid/filtering/constants.js +51 -1
  142. package/dist/components/Grid/filtering/constants.js.map +1 -0
  143. package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js +42 -1
  144. package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js.map +1 -0
  145. package/dist/components/Grid/filtering/model/Condition.js +297 -1
  146. package/dist/components/Grid/filtering/model/Condition.js.map +1 -0
  147. package/dist/components/Grid/filtering/model/Filtering.js +78 -1
  148. package/dist/components/Grid/filtering/model/Filtering.js.map +1 -0
  149. package/dist/components/Grid/filtering/utils/FilteringUtilts.js +195 -1
  150. package/dist/components/Grid/filtering/utils/FilteringUtilts.js.map +1 -0
  151. package/dist/components/Grid/index.js +2 -1
  152. package/dist/components/Grid/index.js.map +1 -0
  153. package/dist/components/Grid/paging/components/Paging/Paging.js +63 -1
  154. package/dist/components/Grid/paging/components/Paging/Paging.js.map +1 -0
  155. package/dist/components/Grid/paging/components/Paging/styles.js +41 -1
  156. package/dist/components/Grid/paging/components/Paging/styles.js.map +1 -0
  157. package/dist/components/Grid/paging/controllers/usePagingController.js +23 -1
  158. package/dist/components/Grid/paging/controllers/usePagingController.js.map +1 -0
  159. package/dist/components/Grid/paging/model/Paging.js +56 -1
  160. package/dist/components/Grid/paging/model/Paging.js.map +1 -0
  161. package/dist/components/Grid/selection/controllers/useSelectionController.js +17 -1
  162. package/dist/components/Grid/selection/controllers/useSelectionController.js.map +1 -0
  163. package/dist/components/Grid/selection/model/Selection.js +69 -1
  164. package/dist/components/Grid/selection/model/Selection.js.map +1 -0
  165. package/dist/components/Grid/sorting/Sorting.js +33 -1
  166. package/dist/components/Grid/sorting/Sorting.js.map +1 -0
  167. package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js +120 -1
  168. package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js.map +1 -0
  169. package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js +15 -1
  170. package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js.map +1 -0
  171. package/dist/components/Grid/sorting/controllers/useColumnSortingController.js +21 -1
  172. package/dist/components/Grid/sorting/controllers/useColumnSortingController.js.map +1 -0
  173. package/dist/components/Grid/translations.js +81 -1
  174. package/dist/components/Grid/translations.js.map +1 -0
  175. package/dist/components/Grid/validation/controllers/useRecordValidationController.js +25 -1
  176. package/dist/components/Grid/validation/controllers/useRecordValidationController.js.map +1 -0
  177. package/dist/components/Grid/validation/model/ColumnValidation.js +84 -1
  178. package/dist/components/Grid/validation/model/ColumnValidation.js.map +1 -0
  179. package/dist/components/Lookup/Lookup.js +201 -1
  180. package/dist/components/Lookup/Lookup.js.map +1 -0
  181. package/dist/components/Lookup/components/RecordCreator.js +37 -1
  182. package/dist/components/Lookup/components/RecordCreator.js.map +1 -0
  183. package/dist/components/Lookup/components/TargetSelector.js +19 -1
  184. package/dist/components/Lookup/components/TargetSelector.js.map +1 -0
  185. package/dist/components/Lookup/hooks/useFetchXml.js +27 -1
  186. package/dist/components/Lookup/hooks/useFetchXml.js.map +1 -0
  187. package/dist/components/Lookup/hooks/useLoadedEntities.js +20 -1
  188. package/dist/components/Lookup/hooks/useLoadedEntities.js.map +1 -0
  189. package/dist/components/Lookup/hooks/useLookup.js +111 -1
  190. package/dist/components/Lookup/hooks/useLookup.js.map +1 -0
  191. package/dist/components/Lookup/index.js +3 -1
  192. package/dist/components/Lookup/index.js.map +1 -0
  193. package/dist/components/Lookup/styles.js +98 -1
  194. package/dist/components/Lookup/styles.js.map +1 -0
  195. package/dist/components/Lookup/translations.js +33 -1
  196. package/dist/components/Lookup/translations.js.map +1 -0
  197. package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js +74 -1
  198. package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js.map +1 -0
  199. package/dist/components/MultiSelectOptionSet/index.js +2 -1
  200. package/dist/components/MultiSelectOptionSet/index.js.map +1 -0
  201. package/dist/components/OptionSet/OptionSet.js +61 -1
  202. package/dist/components/OptionSet/OptionSet.js.map +1 -0
  203. package/dist/components/OptionSet/index.js +2 -1
  204. package/dist/components/OptionSet/index.js.map +1 -0
  205. package/dist/components/TextField/TextField.js +113 -1
  206. package/dist/components/TextField/TextField.js.map +1 -0
  207. package/dist/components/TextField/index.js +2 -1
  208. package/dist/components/TextField/index.js.map +1 -0
  209. package/dist/components/TwoOptions/TwoOptions.js +36 -1
  210. package/dist/components/TwoOptions/TwoOptions.js.map +1 -0
  211. package/dist/components/TwoOptions/index.js +2 -1
  212. package/dist/components/TwoOptions/index.js.map +1 -0
  213. package/dist/constants.js +35 -1
  214. package/dist/constants.js.map +1 -0
  215. package/dist/hooks/index.js +7 -1
  216. package/dist/hooks/index.js.map +1 -0
  217. package/dist/hooks/useControl.js +95 -1
  218. package/dist/hooks/useControl.js.map +1 -0
  219. package/dist/hooks/useControlSizing.js +15 -1
  220. package/dist/hooks/useControlSizing.js.map +1 -0
  221. package/dist/hooks/useControlTheme.js +9 -1
  222. package/dist/hooks/useControlTheme.js.map +1 -0
  223. package/dist/hooks/useFocusIn.js +33 -1
  224. package/dist/hooks/useFocusIn.js.map +1 -0
  225. package/dist/hooks/useInputBasedControl.js +38 -1
  226. package/dist/hooks/useInputBasedControl.js.map +1 -0
  227. package/dist/hooks/useMouseOver.js +23 -1
  228. package/dist/hooks/useMouseOver.js.map +1 -0
  229. package/dist/index.d.ts +11 -1
  230. package/dist/index.js +19 -1
  231. package/dist/index.js.map +1 -0
  232. package/dist/interfaces/index.js +1 -0
  233. package/dist/interfaces/index.js.map +1 -0
  234. package/dist/utils/Numeral.js +64 -1
  235. package/dist/utils/Numeral.js.map +1 -0
  236. package/dist/utils/Theme.js +72 -1
  237. package/dist/utils/Theme.js.map +1 -0
  238. package/dist/utils/index.js +3 -1
  239. package/dist/utils/index.js.map +1 -0
  240. package/package.json +4 -2
  241. package/dist/Grid-574c3822.js +0 -1
  242. package/dist/components/DateTime/interfaces.js +0 -1
  243. package/dist/components/Decimal/interfaces.js +0 -1
  244. package/dist/components/Duration/interfaces.js +0 -1
  245. package/dist/components/Grid/core/interfaces/IGridColumn.js +0 -1
  246. package/dist/components/Grid/core/interfaces/IGridContext.js +0 -1
  247. package/dist/components/Grid/interfaces.js +0 -1
  248. package/dist/components/Lookup/interfaces.js +0 -1
  249. package/dist/components/MultiSelectOptionSet/interfaces.js +0 -1
  250. package/dist/components/OptionSet/interfaces.js +0 -1
  251. package/dist/components/TextField/interfaces.js +0 -1
  252. package/dist/components/TwoOptions/interfaces.js +0 -1
  253. package/dist/interfaces/context.js +0 -1
  254. package/dist/interfaces/parameters.js +0 -1
  255. package/dist/interfaces/property.js +0 -1
  256. package/dist/interfaces/theme.js +0 -1
@@ -1 +1,200 @@
1
- import{jsx as e}from"react/jsx-runtime";import{TextField as r}from"@talxis/react-components";import{useInputBasedControl as t}from"../../hooks/useInputBasedControl.js";import{useRef as o,useEffect as n,useMemo as a}from"react";import i from"numeral";import{Numeral as l}from"../../utils/Numeral.js";import{CURRENCY_POSITIVE_PATTERN as s,CURRENCY_NEGATIVE_PATTERN as u,NUMBER_NEGATIVE_PATTERN as c}from"../../constants.js";import{ThemeProvider as m}from"@fluentui/react";import{ArrowButtons as p}from"./components/ArrowButtons.js";import"../../hooks/useControl.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"../../hooks/useControlTheme.js";import"../../utils/Theme.js";import"@fluentui/react-migration-v8-v9";import"../../hooks/useControlSizing.js";import"./components/styles.js";const d=d=>{var v,f,y,g,b,h;const w=o(null),C=d.context,D=d.parameters,k=D.value,P=C.userSettings.numberFormattingInfo,j=null!==(v=d.onOverrideComponentProps)&&void 0!==v?v:e=>e,$=(e,r)=>new RegExp(`^${S(e).replace("n",r)}$`.replace(/\s/g,"")),B=(e,r)=>{const t=S(e),o=`(${S(P.currencySymbol)})?`,n=t.replace("\\$",o).replace("n",r);return new RegExp(`^${n.replace(/\s/g,"")}$`)},S=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=e=>{var r;if("number"==typeof e)return e;const t=null==e?void 0:e.replace(/\s/g,"");let o,n;switch(l.decimal(P),d.parameters.value.type){case"Whole.None":{const e=`\\d{1,}(${P.numberGroupSeparator}\\d{1,})*`;o=$("n",e),n=$(c[P.numberNegativePattern],e);break}case"Decimal":{const e=`\\d{1,}(${P.numberGroupSeparator}\\d{1,})*(\\${P.numberDecimalSeparator}\\d+)?`;o=$("n",e),n=$(c[P.numberNegativePattern],e);break}case"Currency":{l.currency(P);const e=`\\d{1,}(${P.currencyGroupSeparator}\\d{1,})*(\\${P.currencyDecimalSeparator}\\d+)?`;o=B(s[P.currencyPositivePattern],e),n=B(u[P.currencyNegativePattern],e);break}}if(o.test(t))return null!==(r=i(t).value())&&void 0!==r?r:void 0;if(n.test(t)){const e=i(t).value();return e>0?-1*e:e}return e},{value:E,sizing:N,theme:O,setValue:A,onNotifyOutputChanged:M}=t("Decimal",d,{formatter:e=>{var r,t;return"number"==typeof e?"Decimal"===d.parameters.value.type?C.formatting.formatDecimal(e,null===(r=k.attributes)||void 0===r?void 0:r.Precision):"Currency"===d.parameters.value.type?d.parameters.value.formatted?d.parameters.value.formatted:C.formatting.formatCurrency(e,null===(t=k.attributes)||void 0===t?void 0:t.Precision):C.formatting.formatInteger(e):e},valueExtractor:x}),F=e=>{var r,t,o,n,a;const i=null!==(r=k.raw)&&void 0!==r?r:0;if("number"!=typeof i)return;const l=Math.pow(10,null!==(o=null===(t=k.attributes)||void 0===t?void 0:t.Precision)&&void 0!==o?o:0),s=parseFloat((i+("increment"===e?1:-1)/l).toFixed(null!==(a=null===(n=k.attributes)||void 0===n?void 0:n.Precision)&&void 0!==a?a:0));M({value:s})};n((()=>{"Currency"===k.type&&A(k.formatted)}),[k.formatted]);const I=j({underlined:O.effects.underlined,hideErrorMessage:!(null===(f=D.ShowErrorMessage)||void 0===f?void 0:f.raw),readOnly:C.mode.isControlDisabled,inputMode:a((()=>(()=>{switch(d.parameters.value.type){case"Whole.None":return"numeric";case"Decimal":case"Currency":return"decimal"}})()),[d.parameters.value.type]),suffixItems:(()=>{var r;if(!C.mode.isControlDisabled&&(null===(r=D.EnableSpinButton)||void 0===r?void 0:r.raw))return[{key:"arrows",onRender:()=>e(p,{ref:w,onDecrement:()=>F("decrement"),onIncrement:()=>F("increment")})}]})(),autoFocus:null===(y=D.AutoFocus)||void 0===y?void 0:y.raw,borderless:!1===(null===(g=D.EnableBorder)||void 0===g?void 0:g.raw),errorMessage:k.errorMessage,styles:{fieldGroup:{height:N.height,width:N.width}},deleteButtonProps:!0===(null===(b=D.EnableDeleteButton)||void 0===b?void 0:b.raw)?{key:"delete",showOnlyOnHover:!0,iconProps:{iconName:"Delete"},onClick:()=>A(void 0)}:void 0,clickToCopyProps:!0===(null===(h=D.EnableCopyButton)||void 0===h?void 0:h.raw)?{key:"copy",showOnlyOnHover:!0,iconProps:{iconName:"Copy"}}:void 0,value:null!=E?E:"",onBlur:e=>{M({value:x(e.target.value)})},onChange:(e,r)=>{A(r)},onKeyDown:e=>{var r,t;if(!C.mode.isControlDisabled)switch(e.key){case"ArrowDown":e.preventDefault(),F("decrement"),null===(r=w.current)||void 0===r||r.setActiveBtn("down");break;case"ArrowUp":e.preventDefault(),F("increment"),null===(t=w.current)||void 0===t||t.setActiveBtn("up")}}});return e(m,Object.assign({theme:O,applyTo:"none"},{children:e(r,Object.assign({},I))}))};export{d as Decimal};
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { TextField } from '@talxis/react-components';
3
+ import { useInputBasedControl } from '../../hooks/useInputBasedControl.js';
4
+ import { useRef, useEffect, useMemo } from 'react';
5
+ import numeral from 'numeral';
6
+ import { Numeral } from '../../utils/Numeral.js';
7
+ import { CURRENCY_POSITIVE_PATTERN, CURRENCY_NEGATIVE_PATTERN, NUMBER_NEGATIVE_PATTERN } from '../../constants.js';
8
+ import { ThemeProvider } from '@fluentui/react';
9
+ import { ArrowButtons } from './components/ArrowButtons.js';
10
+
11
+ const Decimal = (props) => {
12
+ const arrowButtonsRef = useRef(null);
13
+ const context = props.context;
14
+ const parameters = props.parameters;
15
+ const boundValue = parameters.value;
16
+ const numberFormatting = context.userSettings.numberFormattingInfo;
17
+ const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);
18
+ const formatter = (value) => {
19
+ if (typeof value === 'number') {
20
+ if (props.parameters.value.type === 'Decimal') {
21
+ return context.formatting.formatDecimal(value, boundValue.attributes?.Precision);
22
+ }
23
+ if (props.parameters.value.type === 'Currency') {
24
+ //the layer above has information about the symbol, so we can use the formatted string
25
+ if (props.parameters.value.formatted) {
26
+ return props.parameters.value.formatted;
27
+ }
28
+ return context.formatting.formatCurrency(value, boundValue.attributes?.Precision);
29
+ }
30
+ return context.formatting.formatInteger(value);
31
+ }
32
+ return value;
33
+ };
34
+ const createNumberPattern = (pattern, numberPattern) => {
35
+ return new RegExp(`^${escapeRegExp(pattern).replace('n', numberPattern)}$`.replace(/\s/g, ''));
36
+ };
37
+ const createCurrencyPattern = (pattern, numberPattern) => {
38
+ const escapedPattern = escapeRegExp(pattern);
39
+ const escapedCurrencySymbolPattern = `(${escapeRegExp(numberFormatting.currencySymbol)})?`;
40
+ const finalPattern = escapedPattern.replace('\\$', escapedCurrencySymbolPattern).replace('n', numberPattern);
41
+ return new RegExp(`^${finalPattern.replace(/\s/g, '')}$`);
42
+ };
43
+ const escapeRegExp = (string) => {
44
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
45
+ };
46
+ const extractNumericPart = (value) => {
47
+ // Currency control just sends the string up and lets the framework decide whether the value is correct
48
+ // It only tries to parse the number based on the current user format
49
+ // This means that the value will also pass if the user inputs his own currency even though
50
+ // the currency is different on the field
51
+ if (typeof value === 'number') {
52
+ return value;
53
+ }
54
+ const str = value?.replace(/\s/g, '');
55
+ Numeral.decimal(numberFormatting);
56
+ let positivePattern;
57
+ let negativePattern;
58
+ switch (props.parameters.value.type) {
59
+ case 'Whole.None': {
60
+ const numberPattern = `\\d{1,}(${numberFormatting.numberGroupSeparator}\\d{1,})*`;
61
+ positivePattern = createNumberPattern('n', numberPattern);
62
+ negativePattern = createNumberPattern(NUMBER_NEGATIVE_PATTERN[numberFormatting.numberNegativePattern], numberPattern);
63
+ break;
64
+ }
65
+ case 'Decimal': {
66
+ const numberPattern = `\\d{1,}(${numberFormatting.numberGroupSeparator}\\d{1,})*(\\${numberFormatting.numberDecimalSeparator}\\d+)?`;
67
+ positivePattern = createNumberPattern('n', numberPattern);
68
+ negativePattern = createNumberPattern(NUMBER_NEGATIVE_PATTERN[numberFormatting.numberNegativePattern], numberPattern);
69
+ break;
70
+ }
71
+ case 'Currency': {
72
+ Numeral.currency(numberFormatting);
73
+ const numberPattern = `\\d{1,}(${numberFormatting.currencyGroupSeparator}\\d{1,})*(\\${numberFormatting.currencyDecimalSeparator}\\d+)?`;
74
+ positivePattern = createCurrencyPattern(CURRENCY_POSITIVE_PATTERN[numberFormatting.currencyPositivePattern], numberPattern);
75
+ negativePattern = createCurrencyPattern(CURRENCY_NEGATIVE_PATTERN[numberFormatting.currencyNegativePattern], numberPattern);
76
+ break;
77
+ }
78
+ }
79
+ if (positivePattern.test(str)) {
80
+ return numeral(str).value() ?? undefined;
81
+ }
82
+ if (negativePattern.test(str)) {
83
+ const value = numeral(str).value();
84
+ if (value > 0) {
85
+ return value * -1;
86
+ }
87
+ return value;
88
+ }
89
+ return value;
90
+ };
91
+ const { value, sizing, theme, setValue, onNotifyOutputChanged } = useInputBasedControl('Decimal', props, {
92
+ formatter: formatter,
93
+ valueExtractor: extractNumericPart
94
+ });
95
+ const getSuffixItems = () => {
96
+ if (context.mode.isControlDisabled || !parameters.EnableSpinButton?.raw) {
97
+ return undefined;
98
+ }
99
+ return [
100
+ {
101
+ key: 'arrows',
102
+ onRender: () => jsx(ArrowButtons, { ref: arrowButtonsRef, onDecrement: () => makeStep('decrement'), onIncrement: () => makeStep('increment') })
103
+ }
104
+ ];
105
+ };
106
+ const makeStep = (type) => {
107
+ const value = boundValue.raw ?? 0;
108
+ if (typeof value !== 'number') {
109
+ return;
110
+ }
111
+ const precision = Math.pow(10, boundValue.attributes?.Precision ?? 0);
112
+ const adjustment = type === 'increment' ? 1 : -1;
113
+ const newValue = parseFloat(((value) + adjustment / precision).toFixed(boundValue.attributes?.Precision ?? 0));
114
+ onNotifyOutputChanged({ value: newValue });
115
+ };
116
+ const onKeyDown = (e) => {
117
+ if (context.mode.isControlDisabled) {
118
+ return;
119
+ }
120
+ switch (e.key) {
121
+ case 'ArrowDown': {
122
+ e.preventDefault();
123
+ makeStep('decrement');
124
+ arrowButtonsRef.current?.setActiveBtn('down');
125
+ break;
126
+ }
127
+ case 'ArrowUp': {
128
+ e.preventDefault();
129
+ makeStep('increment');
130
+ arrowButtonsRef.current?.setActiveBtn('up');
131
+ break;
132
+ }
133
+ }
134
+ };
135
+ const getInputMode = () => {
136
+ switch (props.parameters.value.type) {
137
+ case 'Whole.None': {
138
+ return 'numeric';
139
+ }
140
+ case 'Decimal':
141
+ case 'Currency': {
142
+ return 'decimal';
143
+ }
144
+ }
145
+ };
146
+ useEffect(() => {
147
+ if (boundValue.type === 'Currency') {
148
+ setValue(boundValue.formatted);
149
+ }
150
+ }, [boundValue.formatted]);
151
+ const componentProps = onOverrideComponentProps({
152
+ underlined: theme.effects.underlined,
153
+ hideErrorMessage: !parameters.ShowErrorMessage?.raw,
154
+ readOnly: context.mode.isControlDisabled,
155
+ inputMode: useMemo(() => getInputMode(), [props.parameters.value.type]),
156
+ suffixItems: getSuffixItems(),
157
+ autoFocus: parameters.AutoFocus?.raw,
158
+ borderless: parameters.EnableBorder?.raw === false,
159
+ errorMessage: boundValue.errorMessage,
160
+ styles: {
161
+ fieldGroup: {
162
+ height: sizing.height,
163
+ width: sizing.width
164
+ }
165
+ },
166
+ deleteButtonProps: parameters.EnableDeleteButton?.raw === true
167
+ ? {
168
+ key: "delete",
169
+ showOnlyOnHover: true,
170
+ iconProps: {
171
+ iconName: "Cancel",
172
+ },
173
+ onClick: () => setValue(undefined),
174
+ }
175
+ : undefined,
176
+ clickToCopyProps: parameters.EnableCopyButton?.raw === true
177
+ ? {
178
+ key: "copy",
179
+ showOnlyOnHover: true,
180
+ iconProps: {
181
+ iconName: "Copy",
182
+ },
183
+ }
184
+ : undefined,
185
+ value: value ?? "",
186
+ onBlur: (event) => {
187
+ onNotifyOutputChanged({
188
+ value: extractNumericPart(event.target.value)
189
+ });
190
+ },
191
+ onChange: (e, value) => {
192
+ setValue(value);
193
+ },
194
+ onKeyDown: onKeyDown,
195
+ });
196
+ return (jsx(ThemeProvider, { theme: theme, applyTo: "none", children: jsx(TextField, { ...componentProps }) }));
197
+ };
198
+
199
+ export { Decimal };
200
+ //# sourceMappingURL=Decimal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Decimal.js","sources":["../../../src/components/Decimal/Decimal.tsx"],"sourcesContent":["import { TextField } from \"@talxis/react-components\";\nimport { useInputBasedControl } from \"../../hooks/useInputBasedControl\";\nimport { IDecimal, IDecimalOutputs, IDecimalParameters } from \"./interfaces\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport numeral from \"numeral\";\nimport { Numeral } from \"../../utils/Numeral\";\nimport { CURRENCY_NEGATIVE_PATTERN, CURRENCY_POSITIVE_PATTERN, NUMBER_NEGATIVE_PATTERN } from \"../../constants\";\nimport { ICommandBarItemProps, ThemeProvider } from \"@fluentui/react\";\nimport { ArrowButtons, IArrowButtons } from \"./components/ArrowButtons\";\n\nexport const Decimal = (props: IDecimal) => {\n const arrowButtonsRef = useRef<IArrowButtons>(null);\n const context = props.context;\n const parameters = props.parameters;\n const boundValue = parameters.value;\n const numberFormatting = context.userSettings.numberFormattingInfo;\n const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);\n\n const formatter = (value: string | number | null): string | undefined | null => {\n if (typeof value === 'number') {\n if (props.parameters.value.type === 'Decimal') {\n return context.formatting.formatDecimal(value, boundValue.attributes?.Precision);\n }\n if (props.parameters.value.type === 'Currency') {\n //the layer above has information about the symbol, so we can use the formatted string\n if (props.parameters.value.formatted) {\n return props.parameters.value.formatted;\n }\n return context.formatting.formatCurrency(value, boundValue.attributes?.Precision);\n }\n return context.formatting.formatInteger(value);\n }\n return value;\n };\n\n const createNumberPattern = (pattern: string, numberPattern: string) => {\n return new RegExp(`^${escapeRegExp(pattern).replace('n', numberPattern)}$`.replace(/\\s/g, ''));\n };\n\n const createCurrencyPattern = (pattern: string, numberPattern: string) => {\n const escapedPattern = escapeRegExp(pattern);\n const escapedCurrencySymbolPattern = `(${escapeRegExp(numberFormatting.currencySymbol)})?`;\n const finalPattern = escapedPattern.replace('\\\\$', escapedCurrencySymbolPattern).replace('n', numberPattern);\n return new RegExp(`^${finalPattern.replace(/\\s/g, '')}$`);\n };\n\n const escapeRegExp = (string: string) => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n };\n\n const extractNumericPart = (value: any): number | undefined => {\n // Currency control just sends the string up and lets the framework decide whether the value is correct\n // It only tries to parse the number based on the current user format\n // This means that the value will also pass if the user inputs his own currency even though\n // the currency is different on the field\n if (typeof value === 'number') {\n return value\n }\n const str = value?.replace(/\\s/g, '');\n Numeral.decimal(numberFormatting);\n let positivePattern: any;\n let negativePattern: any;\n\n switch (props.parameters.value.type) {\n case 'Whole.None': {\n const numberPattern = `\\\\d{1,}(${numberFormatting.numberGroupSeparator}\\\\d{1,})*`;\n positivePattern = createNumberPattern('n', numberPattern);\n negativePattern = createNumberPattern(NUMBER_NEGATIVE_PATTERN[numberFormatting.numberNegativePattern], numberPattern);\n break;\n }\n case 'Decimal': {\n const numberPattern = `\\\\d{1,}(${numberFormatting.numberGroupSeparator}\\\\d{1,})*(\\\\${numberFormatting.numberDecimalSeparator}\\\\d+)?`;\n positivePattern = createNumberPattern('n', numberPattern);\n negativePattern = createNumberPattern(NUMBER_NEGATIVE_PATTERN[numberFormatting.numberNegativePattern], numberPattern);\n break;\n }\n case 'Currency': {\n Numeral.currency(numberFormatting);\n const numberPattern = `\\\\d{1,}(${numberFormatting.currencyGroupSeparator}\\\\d{1,})*(\\\\${numberFormatting.currencyDecimalSeparator}\\\\d+)?`;\n positivePattern = createCurrencyPattern(CURRENCY_POSITIVE_PATTERN[numberFormatting.currencyPositivePattern], numberPattern);\n negativePattern = createCurrencyPattern(CURRENCY_NEGATIVE_PATTERN[numberFormatting.currencyNegativePattern], numberPattern);\n break;\n }\n }\n if (positivePattern.test(str)) {\n return numeral(str).value() ?? undefined;\n }\n if (negativePattern.test(str)) {\n const value = numeral(str).value()!;\n if (value > 0) {\n return value * -1;\n }\n return value;\n }\n return value;\n };\n\n const { value, sizing, theme, setValue, onNotifyOutputChanged } = useInputBasedControl<string | undefined, IDecimalParameters, IDecimalOutputs, any>('Decimal', props, {\n formatter: formatter,\n valueExtractor: extractNumericPart\n });\n\n const getSuffixItems = (): ICommandBarItemProps[] | undefined => {\n if (context.mode.isControlDisabled || !parameters.EnableSpinButton?.raw) {\n return undefined;\n }\n return [\n {\n key: 'arrows',\n onRender: () => <ArrowButtons\n ref={arrowButtonsRef}\n onDecrement={() => makeStep('decrement')}\n onIncrement={() => makeStep('increment')} />\n }\n ]\n }\n\n const makeStep = (type: 'increment' | 'decrement') => {\n const value = boundValue.raw ?? 0;\n if (typeof value !== 'number') {\n return;\n }\n const precision = Math.pow(10, boundValue.attributes?.Precision ?? 0);\n const adjustment = type === 'increment' ? 1 : -1;\n const newValue = parseFloat(((value) + adjustment / precision).toFixed(boundValue.attributes?.Precision ?? 0));\n onNotifyOutputChanged({ value: newValue });\n\n }\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (context.mode.isControlDisabled) {\n return;\n }\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n makeStep('decrement');\n arrowButtonsRef.current?.setActiveBtn('down');\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n makeStep('increment');\n arrowButtonsRef.current?.setActiveBtn('up');\n break;\n }\n }\n }\n\n const getInputMode = () => {\n switch (props.parameters.value.type) {\n case 'Whole.None': {\n return 'numeric';\n }\n case 'Decimal':\n case 'Currency': {\n return 'decimal';\n }\n }\n }\n useEffect(() => {\n if (boundValue.type === 'Currency') {\n setValue(boundValue.formatted);\n }\n }, [boundValue.formatted]);\n\n const componentProps = onOverrideComponentProps({\n underlined: theme.effects.underlined,\n hideErrorMessage: !parameters.ShowErrorMessage?.raw,\n readOnly: context.mode.isControlDisabled,\n inputMode: useMemo(() => getInputMode(), [props.parameters.value.type]),\n suffixItems: getSuffixItems(),\n autoFocus: parameters.AutoFocus?.raw,\n borderless: parameters.EnableBorder?.raw === false,\n errorMessage: boundValue.errorMessage,\n styles: {\n fieldGroup: {\n height: sizing.height,\n width: sizing.width\n }\n },\n deleteButtonProps: parameters.EnableDeleteButton?.raw === true\n ? {\n key: \"delete\",\n showOnlyOnHover: true,\n iconProps: {\n iconName: \"Cancel\",\n },\n onClick: () => setValue(undefined),\n }\n : undefined,\n clickToCopyProps: parameters.EnableCopyButton?.raw === true\n ? {\n key: \"copy\",\n showOnlyOnHover: true,\n iconProps: {\n iconName: \"Copy\",\n },\n }\n : undefined,\n value: value ?? \"\",\n onBlur: (event) => {\n onNotifyOutputChanged({\n value: extractNumericPart(event.target.value)\n });\n },\n onChange: (e, value) => {\n setValue(value);\n },\n onKeyDown: onKeyDown,\n });\n return (\n <ThemeProvider theme={theme} applyTo=\"none\">\n <TextField {...componentProps} />\n </ThemeProv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Q,EAAE,QAAQ;AACrB,iBAAA;AACD,gBAAA,OAAO,EAAE,MAAM,QAAQ,CAAC,SAAS,CAAC;AACrC,aAAA;AACD,cAAE,SAAS;AACf,QAAA,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,EAAE,GAAG,KAAK,IAAI;AACvD,cAAE;AACE,gBAAA,GAAG,EAAE,MAAM;AACX,gBAAA,eAAe,EAAE,IAAI;AACrB,gBAAA,SAAS,EAAE;AACP,oBAAA,QAAQ,EAAE,MAAM;AACnB,iBAAA;AACJ,aAAA;AACD,cAAE,SAAS;QACf,KAAK,EAAE,KAAK,IAAI,EAAE;AAClB,QAAA,MAAM,EAAE,CAAC,KAAK,KAAI;AACd,YAAA,qBAAqB,CAAC;gBAClB,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AAChD,aAAA,CAAC,CAAC;SACN;AACD,QAAA,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,KAAI;YACnB,QAAQ,CAAC,KAAK,CAAC,CAAC;SACnB;AACD,QAAA,SAAS,EAAE,SAAS;AACvB,KAAA,CAAC,CAAC;AACH,IAAA,QACIA,GAAC,CAAA,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,MAAM,EAAA,QAAA,EACvCA,IAAC,SAAS,EAAA,EAAA,GAAK,cAAc,EAAI,CAAA,EAAA,CACrB,EAClB;AACN;;;;"}
@@ -1 +1,38 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useTheme as e,IconButton as n}from"@fluentui/react";import{forwardRef as r,useMemo as c,useState as i,useEffect as m,useImperativeHandle as s}from"react";import{getArrowButtonStyles as a}from"./styles.js";const l=r(((r,l)=>{const p=e(),u=c((()=>a(p)),[]),[v,d]=i(void 0),f=o=>{let t=`${u.iconButton}`;return v===o&&(t+=` ${u.iconButtonActive}`),t};return m((()=>{v&&setTimeout((()=>{d(void 0)}),100)}),[v]),s(l,(()=>({setActiveBtn:d}))),o("div",Object.assign({className:u.root},{children:[t(n,{onClick:r.onIncrement,className:f("up"),iconProps:{iconName:"ChevronUpSmall"}}),t(n,{onClick:r.onDecrement,className:f("down"),iconProps:{iconName:"ChevronDownSmall"}})]}))}));export{l as ArrowButtons};
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useTheme, IconButton } from '@fluentui/react';
3
+ import { forwardRef, useMemo, useState, useEffect, useImperativeHandle } from 'react';
4
+ import { getArrowButtonStyles } from './styles.js';
5
+
6
+ const ArrowButtons = forwardRef((props, ref) => {
7
+ const theme = useTheme();
8
+ const styles = useMemo(() => getArrowButtonStyles(theme), []);
9
+ const [activeBtn, setActiveBtn] = useState(undefined);
10
+ const getIconButtonClassNames = (type) => {
11
+ let classNames = `${styles.iconButton}`;
12
+ if (activeBtn === type) {
13
+ classNames += ` ${styles.iconButtonActive}`;
14
+ }
15
+ return classNames;
16
+ };
17
+ useEffect(() => {
18
+ if (!activeBtn) {
19
+ return;
20
+ }
21
+ setTimeout(() => {
22
+ setActiveBtn(undefined);
23
+ }, 100);
24
+ }, [activeBtn]);
25
+ useImperativeHandle(ref, () => {
26
+ return {
27
+ setActiveBtn: setActiveBtn
28
+ };
29
+ });
30
+ return jsxs("div", { className: styles.root, children: [jsx(IconButton, { onClick: props.onIncrement, className: getIconButtonClassNames('up'), iconProps: {
31
+ iconName: 'ChevronUpSmall'
32
+ } }), jsx(IconButton, { onClick: props.onDecrement, className: getIconButtonClassNames('down'), iconProps: {
33
+ iconName: 'ChevronDownSmall'
34
+ } })] });
35
+ });
36
+
37
+ export { ArrowButtons };
38
+ //# sourceMappingURL=ArrowButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrowButtons.js","sources":["../../../../src/components/Decimal/components/ArrowButtons.tsx"],"sourcesContent":["import { IconButton, useTheme } from \"@fluentui/react\"\nimport { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from \"react\"\nimport { getArrowButtonStyles } from \"./styles\";\nimport React from 'react';\n\ninterface IArrowButtonsProps {\n onIncrement: () => void;\n onDecrement: () => void;\n}\n\nexport interface IArrowButtons {\n setActiveBtn: (direction: 'up' | 'down') => void;\n}\n\nexport const ArrowButtons = forwardRef<IArrowButtons, IArrowButtonsProps>((props, ref) => {\n const theme = useTheme();\n const styles = useMemo(() => getArrowButtonStyles(theme), []);\n const [activeBtn, setActiveBtn] = useState<'up' | 'down' | undefined>(undefined);\n\n const getIconButtonClassNames = (type: 'up' | 'down') => {\n let classNames = `${styles.iconButton}`;\n if(activeBtn === type) {\n classNames += ` ${styles.iconButtonActive}`\n }\n return classNames;\n }\n useEffect(() => {\n if(!activeBtn) {\n return;\n }\n setTimeout(() => {\n setActiveBtn(undefined);\n }, 100)\n }, [activeBtn]);\n\n useImperativeHandle(ref, () => {\n return {\n setActiveBtn: setActiveBtn\n }\n });\n \n return <div className={styles.root}>\n <IconButton onClick={props.onIncrement} className={getIconButtonClassNames('up')} iconProps={{\n iconName: 'ChevronUpSmall'\n }} />\n <IconButton onClick={props.onDecrement} className={getIconButtonClassNames('down')} iconProps={{\n iconName: 'ChevronDownSmall'\n }} />\n </div>\n});"],"names":["_jsxs","_jsx"],"mappings":";;;;;AAca,MAAA,YAAY,GAAG,UAAU,CAAoC,CAAC,KAAK,EAAE,GAAG,KAAI;AACrF,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AACzB,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,oBAAoB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAA4B,SAAS,CAAC,CAAC;AAEjF,IAAA,MAAM,uBAAuB,GAAG,CAAC,IAAmB,KAAI;AACpD,QAAA,IAAI,UAAU,GAAG,CAAA,EAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,IAAG,SAAS,KAAK,IAAI,EAAE;AACnB,YAAA,UAAU,IAAI,CAAI,CAAA,EAAA,MAAM,CAAC,gBAAgB,EAAE,CAAA;AAC9C,SAAA;AACD,QAAA,OAAO,UAAU,CAAC;AACtB,KAAC,CAAA;IACD,SAAS,CAAC,MAAK;QACX,IAAG,CAAC,SAAS,EAAE;YACX,OAAO;AACV,SAAA;QACD,UAAU,CAAC,MAAK;YACZ,YAAY,CAAC,SAAS,CAAC,CAAC;SAC3B,EAAE,GAAG,CAAC,CAAA;AACX,KAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AAEhB,IAAA,mBAAmB,CAAC,GAAG,EAAE,MAAK;QAC1B,OAAO;AACH,YAAA,YAAY,EAAE,YAAY;SAC7B,CAAA;AACL,KAAC,CAAC,CAAC;IAEH,OAAOA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,IAAI,EAC9B,QAAA,EAAA,CAAAC,GAAA,CAAC,UAAU,EAAA,EAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE;AACzF,oBAAA,QAAQ,EAAE,gBAAgB;AAC7B,iBAAA,EAAA,CAAI,EACHA,GAAC,CAAA,UAAU,IAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,uBAAuB,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE;AAC7F,oBAAA,QAAQ,EAAE,kBAAkB;AAC/B,iBAAA,EAAA,CAAI,IACH,CAAA;AACV,CAAC;;;;"}
@@ -1 +1,26 @@
1
- import{mergeStyleSets as o}from"@fluentui/react";const t=t=>o({root:{display:"flex",flexDirection:"column"},iconButton:{borderRadius:0,height:"50%",i:{fontSize:8}},iconButtonActive:{backgroundColor:t.semanticColors.buttonBackgroundPressed,i:{color:t.semanticColors.inputIconHovered}}});export{t as getArrowButtonStyles};
1
+ import { mergeStyleSets } from '@fluentui/react';
2
+
3
+ const getArrowButtonStyles = (theme) => {
4
+ return mergeStyleSets({
5
+ root: {
6
+ display: 'flex',
7
+ flexDirection: 'column',
8
+ },
9
+ iconButton: {
10
+ borderRadius: 0,
11
+ height: '50%',
12
+ 'i': {
13
+ fontSize: 8,
14
+ }
15
+ },
16
+ iconButtonActive: {
17
+ backgroundColor: theme.semanticColors.buttonBackgroundPressed,
18
+ 'i': {
19
+ color: theme.semanticColors.inputIconHovered
20
+ }
21
+ }
22
+ });
23
+ };
24
+
25
+ export { getArrowButtonStyles };
26
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Decimal/components/styles.ts"],"sourcesContent":["import { ITheme, mergeStyleSets } from \"@fluentui/react\"\n\nexport const getArrowButtonStyles = (theme: ITheme) => {\n return mergeStyleSets({\n root: {\n display: 'flex',\n flexDirection: 'column',\n },\n iconButton: {\n borderRadius: 0,\n height: '50%',\n 'i': {\n fontSize: 8,\n }\n },\n iconButtonActive: {\n backgroundColor: theme.semanticColors.buttonBackgroundPressed,\n 'i': {\n color: theme.semanticColors.inputIconHovered\n }\n }\n })\n}"],"names":[],"mappings":";;AAEa,MAAA,oBAAoB,GAAG,CAAC,KAAa,KAAI;AAClD,IAAA,OAAO,cAAc,CAAC;AAClB,QAAA,IAAI,EAAE;AACF,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,QAAQ;AAC1B,SAAA;AACD,QAAA,UAAU,EAAE;AACR,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,MAAM,EAAE,KAAK;AACb,YAAA,GAAG,EAAE;AACD,gBAAA,QAAQ,EAAE,CAAC;AACd,aAAA;AACJ,SAAA;AACD,QAAA,gBAAgB,EAAE;AACd,YAAA,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,uBAAuB;AAC7D,YAAA,GAAG,EAAE;AACD,gBAAA,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB;AAC/C,aAAA;AACJ,SAAA;AACJ,KAAA,CAAC,CAAA;AACN;;;;"}
@@ -1 +1,2 @@
1
- export{Decimal}from"./Decimal.js";import"react/jsx-runtime";import"@talxis/react-components";import"../../hooks/useInputBasedControl.js";import"react";import"../../hooks/useControl.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"../../hooks/useControlTheme.js";import"../../utils/Theme.js";import"@fluentui/react";import"@fluentui/react-migration-v8-v9";import"../../hooks/useControlSizing.js";import"numeral";import"../../utils/Numeral.js";import"../../constants.js";import"./components/ArrowButtons.js";import"./components/styles.js";
1
+ export { Decimal } from './Decimal.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -6,7 +6,7 @@ export interface IDecimal extends IControl<IDecimalParameters, IDecimalOutputs,
6
6
  }
7
7
  export interface IDecimalParameters extends IInputParameters {
8
8
  value: IDecimalNumberProperty;
9
- EnableSpinButton?: ITwoOptionsProperty;
9
+ EnableSpinButton?: Omit<ITwoOptionsProperty, 'attributes'>;
10
10
  }
11
11
  export interface IDecimalOutputs extends IOutputs {
12
12
  value?: number;
@@ -1 +1,132 @@
1
- import{jsx as e}from"react/jsx-runtime";import{ComboBox as o}from"@talxis/react-components";import{useRef as r,useEffect as l}from"react";import{useInputBasedControl as a}from"../../hooks/useInputBasedControl.js";import{ThemeProvider as t}from"@fluentui/react";import n from"numeral";import{Numeral as i}from"../../utils/Numeral.js";import{getDefaultDurationTranslations as u}from"./translations.js";import"../../hooks/useControl.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"../../hooks/useControlTheme.js";import"../../utils/Theme.js";import"@fluentui/react-migration-v8-v9";import"../../hooks/useControlSizing.js";const s=[{Label:"1",Value:1,Color:""},{Label:"15",Value:2,Color:""},{Label:"30",Value:3,Color:""},{Label:"45",Value:4,Color:""},{Label:"60",Value:5,Color:""},{Label:"90",Value:6,Color:""},{Label:"120",Value:7,Color:""},{Label:"150",Value:8,Color:""},{Label:"180",Value:9,Color:""},{Label:"210",Value:10,Color:""},{Label:"240",Value:11,Color:""},{Label:"270",Value:12,Color:""},{Label:"300",Value:13,Color:""},{Label:"330",Value:14,Color:""},{Label:"360",Value:15,Color:""},{Label:"390",Value:16,Color:""},{Label:"420",Value:17,Color:""},{Label:"450",Value:18,Color:""},{Label:"480",Value:19,Color:""},{Label:"1440",Value:20,Color:""},{Label:"2880",Value:21,Color:""},{Label:"4320",Value:22,Color:""}],m=m=>{var p,d;const c=m.parameters,C=c.value,b=r(null),h=m.context,f=require("humanize-duration"),g=h.userSettings.locale,V=h.userSettings.numberFormattingInfo,v=e=>{if("number"==typeof e){const o=6e4*e,r={units:e<60?["m"]:e>=1440?["d"]:["h"],maxDecimalPoints:2,language:g.slice(0,g.indexOf("-")),decimal:h.userSettings.numberFormattingInfo.numberDecimalSeparator,fallbacks:["en"]};return f(o,r)}return e},L=e=>{const o=JSON.parse(y.minute()),r=JSON.parse(y.minutes()),l=JSON.parse(y.hour()),a=JSON.parse(y.hours()),t=JSON.parse(y.day()),n=JSON.parse(y.days()),i=new RegExp("^("+o.join("|")+")\\s|\\s("+o.join("|")+")$|^("+r.join("|")+")\\s|\\s("+r.join("|")+")$","i"),u=new RegExp("^("+l.join("|")+")\\s|\\s("+l.join("|")+")$|^("+a.join("|")+")\\s|\\s("+a.join("|")+")$","i"),s=new RegExp("^("+t.join("|")+")\\s|\\s("+t.join("|")+")$|^("+n.join("|")+")\\s|\\s("+n.join("|")+")$","i");if(e&&e.trim()){let o=e.trim().toLowerCase(),r="minute";i.test(o)?o=o.replace(i,"").trim():u.test(o)?(o=o.replace(u,"").trim(),r="hour"):s.test(o)&&(o=o.replace(s,"").trim(),r="day");const l=j(o);return l&&!isNaN(l)?x(l,r):e}},j=e=>{var o;return i.decimal(V),null!==(o=n(e).value())&&void 0!==o?o:void 0},x=(e,o)=>{switch(o){case"hour":return 60*e;case"day":return 60*e*24;default:return e}},S=s.map((e=>({key:e.Value.toString(),text:v(parseInt(e.Label))}))),{value:w,labels:y,sizing:N,setValue:O,onNotifyOutputChanged:I,theme:k}=a("Duration",m,{formatter:v,valueExtractor:L,defaultTranslations:u()});return l((()=>{var e,o;(null===(e=c.AutoFocus)||void 0===e?void 0:e.raw)&&(null===(o=b.current)||void 0===o||o.focus(!0))}),[]),e(t,Object.assign({theme:k,applyTo:"none"},{children:e(o,{componentRef:b,options:S,hideErrorMessage:!(null===(p=c.ShowErrorMessage)||void 0===p?void 0:p.raw),underlined:k.effects.underlined,allowFreeInput:!0,autoComplete:"on",autofill:!0===(null===(d=c.AutoFocus)||void 0===d?void 0:d.raw)?{autoFocus:!0}:void 0,readOnly:h.mode.isControlDisabled,useComboBoxAsMenuWidth:!0,errorMessage:C.errorMessage,text:null!=w?w:"",styles:{root:{height:N.height,width:N.width,display:"flex",alignItems:"center"},callout:{height:300}},onInputValueChange:e=>{O(null!=e?e:"")},onBlur:e=>{I({value:L(w)})},onChange:(e,o)=>{var r;I({value:L(null!==(r=null==o?void 0:o.text)&&void 0!==r?r:"")})}})}))};export{m as Duration};
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { ComboBox } from '@talxis/react-components';
3
+ import { useRef, useEffect } from 'react';
4
+ import { useInputBasedControl } from '../../hooks/useInputBasedControl.js';
5
+ import { ThemeProvider } from '@fluentui/react';
6
+ import numeral from 'numeral';
7
+ import { Numeral } from '../../utils/Numeral.js';
8
+ import { getDefaultDurationTranslations } from './translations.js';
9
+ import { durationOptions } from './durationOptions.js';
10
+
11
+ const Duration = (props) => {
12
+ const parameters = props.parameters;
13
+ const boundValue = parameters.value;
14
+ const componentRef = useRef(null);
15
+ const context = props.context;
16
+ const humanizeDuration = require("humanize-duration");
17
+ const formattingInfo = context.userSettings;
18
+ //@ts-ignore - locale is part of UserSettings
19
+ const language = formattingInfo.locale;
20
+ const numberFormatting = context.userSettings.numberFormattingInfo;
21
+ const formatter = (value) => {
22
+ //all duration formatting should happen here
23
+ if (typeof value === 'number') {
24
+ const durationInMilliseconds = value * 60000;
25
+ const units = value < 60 ? ['m'] : value >= 1440 ? ['d'] : ['h'];
26
+ const options = {
27
+ units: units,
28
+ maxDecimalPoints: 2,
29
+ language: language.slice(0, language.indexOf("-")),
30
+ decimal: context.userSettings.numberFormattingInfo.numberDecimalSeparator,
31
+ fallbacks: ["en"]
32
+ };
33
+ return humanizeDuration(durationInMilliseconds, options);
34
+ }
35
+ return value;
36
+ };
37
+ const valueExtractor = (str) => {
38
+ //extraction of number of minutes from formatted string should happen here
39
+ // parsing because labels are string that represent array of strings
40
+ const minuteLabels = JSON.parse(labels.minute());
41
+ const minutesLabels = JSON.parse(labels.minutes());
42
+ const hourLabels = JSON.parse(labels.hour());
43
+ const hoursLabels = JSON.parse(labels.hours());
44
+ const dayLabels = JSON.parse(labels.day());
45
+ const daysLabels = JSON.parse(labels.days());
46
+ const minuteRegex = new RegExp("^(" + minuteLabels.join('|') + ")\\s|\\s(" + minuteLabels.join('|') + ")$|^(" + minutesLabels.join('|') + ")\\s|\\s(" + minutesLabels.join('|') + ")$", "i");
47
+ const hourRegex = new RegExp("^(" + hourLabels.join('|') + ")\\s|\\s(" + hourLabels.join('|') + ")$|^(" + hoursLabels.join('|') + ")\\s|\\s(" + hoursLabels.join('|') + ")$", "i");
48
+ const dayRegex = new RegExp("^(" + dayLabels.join('|') + ")\\s|\\s(" + dayLabels.join('|') + ")$|^(" + daysLabels.join('|') + ")\\s|\\s(" + daysLabels.join('|') + ")$", "i");
49
+ if (str && str.trim()) {
50
+ let input = str.trim().toLowerCase();
51
+ let unit = 'minute';
52
+ if (minuteRegex.test(input)) {
53
+ input = input.replace(minuteRegex, "").trim();
54
+ }
55
+ else if (hourRegex.test(input)) {
56
+ input = input.replace(hourRegex, "").trim();
57
+ unit = 'hour';
58
+ }
59
+ else if (dayRegex.test(input)) {
60
+ input = input.replace(dayRegex, "").trim();
61
+ unit = 'day';
62
+ }
63
+ const parsedNumber = parseNumber(input);
64
+ if (parsedNumber && !isNaN(parsedNumber)) {
65
+ return getDurationInMinutes(parsedNumber, unit);
66
+ }
67
+ return str;
68
+ }
69
+ return undefined;
70
+ };
71
+ const parseNumber = (input) => {
72
+ Numeral.decimal(numberFormatting);
73
+ return numeral(input).value() ?? undefined;
74
+ };
75
+ const getDurationInMinutes = (value, unit) => {
76
+ switch (unit) {
77
+ case 'hour':
78
+ return 60 * value;
79
+ case 'day':
80
+ return 60 * value * 24;
81
+ case 'minute':
82
+ default:
83
+ return value;
84
+ }
85
+ };
86
+ const presetOptions = () => {
87
+ const formattedOptions = durationOptions.map(option => ({
88
+ key: option.Value.toString(),
89
+ text: formatter(parseInt(option.Label)),
90
+ }));
91
+ return formattedOptions;
92
+ };
93
+ const comboBoxOptions = presetOptions();
94
+ const { value, labels, sizing, setValue, onNotifyOutputChanged, theme } = useInputBasedControl('Duration', props, {
95
+ formatter: formatter,
96
+ valueExtractor: valueExtractor,
97
+ defaultTranslations: getDefaultDurationTranslations(),
98
+ });
99
+ useEffect(() => {
100
+ if (parameters.AutoFocus?.raw) {
101
+ componentRef.current?.focus(true);
102
+ }
103
+ }, []);
104
+ return (jsx(ThemeProvider, { theme: theme, applyTo: "none", children: jsx(ComboBox, { componentRef: componentRef, options: comboBoxOptions, hideErrorMessage: !parameters.ShowErrorMessage?.raw, allowFreeInput: true, autoComplete: 'on', autofill: parameters.AutoFocus?.raw === true ? {
105
+ autoFocus: true
106
+ } : undefined, readOnly: context.mode.isControlDisabled, useComboBoxAsMenuWidth: true, errorMessage: boundValue.errorMessage, text: value ?? '', styles: {
107
+ root: {
108
+ height: sizing.height,
109
+ width: sizing.width,
110
+ display: 'flex',
111
+ alignItems: 'center',
112
+ },
113
+ callout: {
114
+ height: 300
115
+ }
116
+ }, onInputValueChange: (text) => {
117
+ setValue(text ?? '');
118
+ }, onBlur: (event) => {
119
+ onNotifyOutputChanged({
120
+ //any is needed here because we can return string in case of error values
121
+ value: valueExtractor(value)
122
+ });
123
+ }, onChange: (e, value) => {
124
+ onNotifyOutputChanged({
125
+ //any is needed here because we can return string in case of error values
126
+ value: valueExtractor(value?.text ?? '')
127
+ });
128
+ } }) }));
129
+ };
130
+
131
+ export { Duration };
132
+ //# sourceMappingURL=Duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Duration.js","sources":["../../../src/components/Duration/Duration.tsx"],"sourcesContent":["import { ComboBox } from \"@talxis/react-components\";\nimport React, { useEffect, useRef } from 'react';\nimport { useInputBasedControl } from '../../hooks/useInputBasedControl';\nimport { IDuration, IDurationOutputs, IDurationParameters } from './interfaces';\nimport { IComboBox, IComboBoxOption, ThemeProvider } from '@fluentui/react';\nimport numeral from \"numeral\";\nimport { Numeral } from '../../utils/Numeral';\nimport { getDefaultDurationTranslations } from './translations';\nimport { durationOptions } from \"./durationOptions\";\n\nexport const Duration = (props: IDuration) => {\n const parameters = props.parameters;\n const boundValue = parameters.value;\n const componentRef = useRef<IComboBox>(null);\n const context = props.context;\n const humanizeDuration = require(\"humanize-duration\");\n const formattingInfo = context.userSettings;\n //@ts-ignore - locale is part of UserSettings\n const language = formattingInfo.locale;\n const numberFormatting = context.userSettings.numberFormattingInfo;\n\n const formatter = (value: number | null) => {\n //all duration formatting should happen here\n if (typeof value === 'number') {\n const durationInMilliseconds = value * 60000;\n const units = value < 60 ? ['m'] : value >= 1440 ? ['d'] : ['h'];\n const options = {\n units: units,\n maxDecimalPoints: 2,\n language: language.slice(0, language.indexOf(\"-\")),\n decimal: context.userSettings.numberFormattingInfo.numberDecimalSeparator,\n fallbacks: [\"en\"]\n };\n return humanizeDuration(durationInMilliseconds, options);\n }\n return value;\n };\n\n const valueExtractor = (str: string | null): number | undefined | string => {\n //extraction of number of minutes from formatted string should happen here\n // parsing because labels are string that represent array of strings\n const minuteLabels = JSON.parse(labels.minute());\n const minutesLabels = JSON.parse(labels.minutes());\n const hourLabels = JSON.parse(labels.hour());\n const hoursLabels = JSON.parse(labels.hours());\n const dayLabels = JSON.parse(labels.day());\n const daysLabels = JSON.parse(labels.days());\n const minuteRegex = new RegExp(\"^(\" + minuteLabels.join('|') + \")\\\\s|\\\\s(\" + minuteLabels.join('|') + \")$|^(\" + minutesLabels.join('|') + \")\\\\s|\\\\s(\" + minutesLabels.join('|') + \")$\", \"i\");\n const hourRegex = new RegExp(\"^(\" + hourLabels.join('|') + \")\\\\s|\\\\s(\" + hourLabels.join('|') + \")$|^(\" + hoursLabels.join('|') + \")\\\\s|\\\\s(\" + hoursLabels.join('|') + \")$\", \"i\");\n const dayRegex = new RegExp(\"^(\" + dayLabels.join('|') + \")\\\\s|\\\\s(\" + dayLabels.join('|') + \")$|^(\" + daysLabels.join('|') + \")\\\\s|\\\\s(\" + daysLabels.join('|') + \")$\", \"i\");\n\n if (str && str.trim()) {\n let input = str.trim().toLowerCase();\n let unit = 'minute';\n\n if (minuteRegex.test(input)) {\n input = input.replace(minuteRegex, \"\").trim();\n } else if (hourRegex.test(input)) {\n input = input.replace(hourRegex, \"\").trim();\n unit = 'hour';\n } else if (dayRegex.test(input)) {\n input = input.replace(dayRegex, \"\").trim();\n unit = 'day';\n }\n const parsedNumber = parseNumber(input);\n if (parsedNumber && !isNaN(parsedNumber)) {\n return getDurationInMinutes(parsedNumber, unit);\n }\n return str;\n }\n return undefined;\n };\n\n const parseNumber = (input: string): number | undefined => {\n Numeral.decimal(numberFormatting);\n return numeral(input).value() ?? undefined;\n };\n\n const getDurationInMinutes = (value: number, unit: string): number => {\n switch (unit) {\n case 'hour':\n return 60 * value;\n case 'day':\n return 60 * value * 24;\n case 'minute':\n default:\n return value;\n }\n };\n\n const presetOptions = (): IComboBoxOption[] => {\n const formattedOptions = durationOptions.map(option => ({\n key: option.Value.toString(),\n text: formatter(parseInt(option.Label)),\n }));\n return formattedOptions;\n };\n\n const comboBoxOptions: IComboBoxOption[] = presetOptions();\n\n const { value, labels, sizing, setValue, onNotifyOutputChanged, theme } = useInputBasedControl<string | null, IDurationParameters, IDurationOutputs, Required<IDuration>['translations']>('Duration', props, {\n formatter: formatter,\n valueExtractor: valueExtractor,\n defaultTranslations: getDefaultDurationTranslations(),\n });\n\n useEffect(() => {\n if (parameters.AutoFocus?.raw) {\n componentRef.current?.focus(true);\n }\n }, []);\n\n return (\n <ThemeProvider theme={theme} applyTo=\"none\">\n <ComboBox\n componentRef={componentRef}\n options={comboBoxOptions}\n hideErrorMessage={!parameters.ShowErrorMessage?.raw}\n allowFreeInput={true}\n autoComplete='on'\n autofill={parameters.AutoFocus?.raw === true ? {\n autoFocus: true\n } : undefined}\n readOnly={context.mode.isControlDisabled}\n useComboBoxAsMenuWidth\n errorMessage={boundValue.errorMessage}\n text={value ?? ''}\n styles={{\n root: {\n height: sizing.height,\n width: sizing.width,\n display: 'flex',\n alignItems: 'center',\n },\n callout: {\n height: 300\n }\n }}\n onInputValueChange={(text) => {\n setValue(text ?? '');\n }}\n onBlur={(event) => {\n onNotifyOutputChanged({\n //any is needed here because we can return string in case of error values\n value: valueExtractor(value) as any\n });\n }}\n onChange={(e, value) => {\n onNotifyOutputChanged({\n //any is needed here because we can return string in case of error values\n value: valueExtractor(value?.text ?? '') as any\n });\n }}\n />\n </ThemeProvider>\n );\n};"],"names":["_jsx"],"mappings":";;;;;;;;;;AAUa,MAAA,QAAQ,GAAG,CAAC,KAAgB,KAAI;AACzC,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;AACpC,IAAA,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;AACpC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAY,IAAI,CAAC,CAAC;AAC7C,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACtD,IAAA,MAAM,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;;AAE5C,IAAA,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC;AACvC,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC;AAEnE,I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IAAI;aAClB,GAAG,SAAS,EACb,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EACxC,sBAAsB,EACtB,IAAA,EAAA,YAAY,EAAE,UAAU,CAAC,YAAY,EACrC,IAAI,EAAE,KAAK,IAAI,EAAE,EACjB,MAAM,EAAE;AACJ,gBAAA,IAAI,EAAE;oBACF,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;AACnB,oBAAA,OAAO,EAAE,MAAM;AACf,oBAAA,UAAU,EAAE,QAAQ;AACvB,iBAAA;AACD,gBAAA,OAAO,EAAE;AACL,oBAAA,MAAM,EAAE,GAAG;AACd,iBAAA;AACJ,aAAA,EACD,kBAAkB,EAAE,CAAC,IAAI,KAAI;AACzB,gBAAA,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AACzB,aAAC,EACD,MAAM,EAAE,CAAC,KAAK,KAAI;AACd,gBAAA,qBAAqB,CAAC;;AAElB,oBAAA,KAAK,EAAE,cAAc,CAAC,KAAK,CAAQ;AACtC,iBAAA,CAAC,CAAC;aACN,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,KAAI;AACnB,gBAAA,qBAAqB,CAAC;;oBAElB,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAQ;AAClD,iBAAA,CAAC,CAAC;aACN,EAAA,CACH,EACc,CAAA,EAClB;AACN;;;;"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="powerapps-component-framework" />
2
+ export declare const durationOptions: ComponentFramework.PropertyHelper.OptionMetadata[];
@@ -0,0 +1,27 @@
1
+ const durationOptions = [
2
+ { Label: '1', Value: 1, Color: '' },
3
+ { Label: '15', Value: 2, Color: '' },
4
+ { Label: '30', Value: 3, Color: '' },
5
+ { Label: '45', Value: 4, Color: '' },
6
+ { Label: '60', Value: 5, Color: '' },
7
+ { Label: '90', Value: 6, Color: '' },
8
+ { Label: '120', Value: 7, Color: '' },
9
+ { Label: '150', Value: 8, Color: '' },
10
+ { Label: '180', Value: 9, Color: '' },
11
+ { Label: '210', Value: 10, Color: '' },
12
+ { Label: '240', Value: 11, Color: '' },
13
+ { Label: '270', Value: 12, Color: '' },
14
+ { Label: '300', Value: 13, Color: '' },
15
+ { Label: '330', Value: 14, Color: '' },
16
+ { Label: '360', Value: 15, Color: '' },
17
+ { Label: '390', Value: 16, Color: '' },
18
+ { Label: '420', Value: 17, Color: '' },
19
+ { Label: '450', Value: 18, Color: '' },
20
+ { Label: '480', Value: 19, Color: '' },
21
+ { Label: '1440', Value: 20, Color: '' },
22
+ { Label: '2880', Value: 21, Color: '' },
23
+ { Label: '4320', Value: 22, Color: '' },
24
+ ];
25
+
26
+ export { durationOptions };
27
+ //# sourceMappingURL=durationOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durationOptions.js","sources":["../../../src/components/Duration/durationOptions.ts"],"sourcesContent":["export const durationOptions: ComponentFramework.PropertyHelper.OptionMetadata[] = [\n { Label: '1', Value: 1, Color: '' },\n { Label: '15', Value: 2, Color: '' },\n { Label: '30', Value: 3, Color: '' },\n { Label: '45', Value: 4, Color: '' },\n { Label: '60', Value: 5, Color: '' },\n { Label: '90', Value: 6, Color: '' },\n { Label: '120', Value: 7, Color: '' },\n { Label: '150', Value: 8, Color: '' },\n { Label: '180', Value: 9, Color: '' },\n { Label: '210', Value: 10, Color: '' },\n { Label: '240', Value: 11, Color: '' },\n { Label: '270', Value: 12, Color: '' },\n { Label: '300', Value: 13, Color: '' },\n { Label: '330', Value: 14, Color: '' },\n { Label: '360', Value: 15, Color: '' },\n { Label: '390', Value: 16, Color: '' },\n { Label: '420', Value: 17, Color: '' },\n { Label: '450', Value: 18, Color: '' },\n { Label: '480', Value: 19, Color: '' },\n { Label: '1440', Value: 20, Color: '' },\n { Label: '2880', Value: 21, Color: '' },\n { Label: '4320', Value: 22, Color: '' },\n];"],"names":[],"mappings":"AAAa,MAAA,eAAe,GAAu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AAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACtC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACvC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACvC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;;;;;"}
@@ -1 +1,2 @@
1
- export{Duration}from"./Duration.js";import"react/jsx-runtime";import"@talxis/react-components";import"react";import"../../hooks/useInputBasedControl.js";import"../../hooks/useControl.js";import"fast-deep-equal/es6";import"merge-anything";import"liquidjs";import"../../hooks/useControlTheme.js";import"../../utils/Theme.js";import"@fluentui/react";import"@fluentui/react-migration-v8-v9";import"../../hooks/useControlSizing.js";import"numeral";import"../../utils/Numeral.js";import"./translations.js";
1
+ export { Duration } from './Duration.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +1,31 @@
1
- const n=()=>({minute:{1029:["min","minuta","minuty","minute","minutu","minutě","minutou","minuta","minuty","minute","minutu","minute","minutou"],1033:["min","minute"]},minutes:{1029:["minuty","minut","minutám","minutách","minutami","minuty","minut","minutam","minutach","minutami"],1033:["minutes"]},hour:{1029:["hod","hodina","hodiny","hodině","hodinu","hodinou","hodina","hodiny","hodine","hodinu","hodinou"],1033:["hour"]},hours:{1029:["hodiny","hodin","hodinám","hodinách","hodinami","hodiny","hodin","hodinam","hodinach","hodinami"],1033:["hours"]},day:{1029:["den","dne","dni","dnu","dnem","den","dne","dni","dnu","dnem"],1033:["day"]},days:{1029:["dny","dnů","dnům","dnech","dny","dní","dny","dnu","dnom","dnech","dny","dni"],1033:["days"]}});export{n as getDefaultDurationTranslations};
1
+ const getDefaultDurationTranslations = () => {
2
+ return {
3
+ minute: {
4
+ 1029: ['min', 'minuta', 'minuty', 'minute', 'minutu', 'minutě', 'minutou', 'minuta', 'minuty', 'minute', 'minutu', 'minute', 'minutou'],
5
+ 1033: ['min', 'minute']
6
+ },
7
+ minutes: {
8
+ 1029: ['minuty', 'minut', 'minutám', 'minutách', 'minutami', 'minuty', 'minut', 'minutam', 'minutach', 'minutami'],
9
+ 1033: ['minutes']
10
+ },
11
+ hour: {
12
+ 1029: ['hod', 'hodina', 'hodiny', 'hodině', 'hodinu', 'hodinou', 'hodina', 'hodiny', 'hodine', 'hodinu', 'hodinou'],
13
+ 1033: ['hour']
14
+ },
15
+ hours: {
16
+ 1029: ['hodiny', 'hodin', 'hodinám', 'hodinách', 'hodinami', 'hodiny', 'hodin', 'hodinam', 'hodinach', 'hodinami'],
17
+ 1033: ['hours']
18
+ },
19
+ day: {
20
+ 1029: ['den', 'dne', 'dni', 'dnu', 'dnem', 'den', 'dne', 'dni', 'dnu', 'dnem'],
21
+ 1033: ['day']
22
+ },
23
+ days: {
24
+ 1029: ['dny', 'dnů', 'dnům', 'dnech', 'dny', 'dní', 'dny', 'dnu', 'dnom', 'dnech', 'dny', 'dni'],
25
+ 1033: ['days']
26
+ },
27
+ };
28
+ };
29
+
30
+ export { getDefaultDurationTranslations };
31
+ //# sourceMappingURL=translations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.js","sources":["../../../src/components/Duration/translations.ts"],"sourcesContent":["\nexport const getDefaultDurationTranslations = () => {\n return {\n minute: {\n 1029: ['min','minuta', 'minuty', 'minute', 'minutu', 'minutě', 'minutou', 'minuta', 'minuty', 'minute', 'minutu', 'minute', 'minutou'],\n 1033: ['min','minute']\n },\n minutes: {\n 1029: ['minuty', 'minut', 'minutám', 'minutách', 'minutami', 'minuty', 'minut', 'minutam', 'minutach', 'minutami'],\n 1033: ['minutes']\n },\n hour: {\n 1029: ['hod','hodina', 'hodiny', 'hodině', 'hodinu', 'hodinou', 'hodina', 'hodiny', 'hodine', 'hodinu', 'hodinou'],\n 1033: ['hour']\n },\n hours: {\n 1029: ['hodiny', 'hodin', 'hodinám', 'hodinách', 'hodinami', 'hodiny', 'hodin', 'hodinam', 'hodinach', 'hodinami'],\n 1033: ['hours']\n },\n day: {\n 1029: ['den', 'dne', 'dni', 'dnu', 'dnem', 'den', 'dne', 'dni', 'dnu', 'dnem'],\n 1033: ['day']\n },\n days: {\n 1029: ['dny', 'dnů', 'dnům', 'dnech', 'dny', 'dní', 'dny', 'dnu', 'dnom', 'dnech', 'dny', 'dni'],\n 1033: ['days']\n },\n };\n};"],"names":[],"mappings":"AACO,MAAM,8BAA8B,GAAG,MAAK;IAC/C,OAAO;AACH,QAAA,MAAM,EAAE;YACJ,IAAI,EAAE,CAAC,KAAK,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;AACtI,YAAA,IAAI,EAAE,CAAC,KAAK,EAAC,QAAQ,CAAC;AACzB,SAAA;AACD,QAAA,OAAO,EAAE;YACL,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;YAClH,IAAI,EAAE,CAAC,SAAS,CAAC;AACpB,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