@wavemaker/react-runtime 11.14.1-rc.236

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 (402) hide show
  1. package/actions/base-action.js +32 -0
  2. package/actions/login-action.js +53 -0
  3. package/actions/logout-action.js +41 -0
  4. package/actions/navigation-action.js +145 -0
  5. package/actions/notification-action.js +147 -0
  6. package/actions/timer-action.js +164 -0
  7. package/actions/toast-provider.js +111 -0
  8. package/actions/toast.js +115 -0
  9. package/actions/toast.service.js +94 -0
  10. package/actions/types/index.js +11 -0
  11. package/components/advanced/carousel/index.js +456 -0
  12. package/components/advanced/carousel/props.js +5 -0
  13. package/components/advanced/carousel/template.js +72 -0
  14. package/components/advanced/login/index.js +307 -0
  15. package/components/advanced/login/props.js +5 -0
  16. package/components/advanced/marquee/index.js +158 -0
  17. package/components/advanced/marquee/props.js +5 -0
  18. package/components/basic/anchor/index.js +239 -0
  19. package/components/basic/anchor/props.js +5 -0
  20. package/components/basic/audio/index.js +61 -0
  21. package/components/basic/html/index.js +158 -0
  22. package/components/basic/icon/index.js +85 -0
  23. package/components/basic/iframe/iframe.utils.js +10 -0
  24. package/components/basic/iframe/index.js +95 -0
  25. package/components/basic/label/index.js +139 -0
  26. package/components/basic/message/index.js +120 -0
  27. package/components/basic/message/props.js +5 -0
  28. package/components/basic/picture/index.js +117 -0
  29. package/components/basic/picture/props.js +5 -0
  30. package/components/basic/progress-bar/index.js +168 -0
  31. package/components/basic/progress-bar/props.js +18 -0
  32. package/components/basic/progress-circle/index.js +196 -0
  33. package/components/basic/progress-circle/props.js +16 -0
  34. package/components/basic/richtexteditor/index.js +533 -0
  35. package/components/basic/richtexteditor/props.js +5 -0
  36. package/components/basic/search/index.js +1023 -0
  37. package/components/basic/search/props.js +5 -0
  38. package/components/basic/search/providers.js +350 -0
  39. package/components/basic/spinner/index.js +202 -0
  40. package/components/basic/spinner/props.js +12 -0
  41. package/components/basic/tile/index.js +91 -0
  42. package/components/basic/tree/Components/TreeNodeComponent.js +142 -0
  43. package/components/basic/tree/index.js +503 -0
  44. package/components/basic/tree/props.js +5 -0
  45. package/components/basic/tree/utils.js +154 -0
  46. package/components/basic/video/index.js +85 -0
  47. package/components/basic/video/props.js +5 -0
  48. package/components/chart/components/barColumnChart/index.js +132 -0
  49. package/components/chart/components/barColumnChart/props.js +5 -0
  50. package/components/chart/components/bubbleChart/index.js +176 -0
  51. package/components/chart/components/bubbleChart/props.js +5 -0
  52. package/components/chart/components/chartLegend/components/ClassicLegendItem.js +39 -0
  53. package/components/chart/components/chartLegend/components/FuriousLegendItem.js +81 -0
  54. package/components/chart/components/chartLegend/index.js +69 -0
  55. package/components/chart/components/chartLegend/props.js +5 -0
  56. package/components/chart/components/chartLegend/utils.js +31 -0
  57. package/components/chart/components/chartTooltip/index.js +53 -0
  58. package/components/chart/components/chartTooltip/styles.js +37 -0
  59. package/components/chart/components/chartTooltip/utils.js +23 -0
  60. package/components/chart/components/cumulativeLineChart/index.js +113 -0
  61. package/components/chart/components/cumulativeLineChart/props.js +5 -0
  62. package/components/chart/components/cumulativeLineChart/utils.js +34 -0
  63. package/components/chart/components/index.js +40 -0
  64. package/components/chart/components/lineAreaChart/index.js +140 -0
  65. package/components/chart/components/lineAreaChart/props.js +5 -0
  66. package/components/chart/components/noDataMessage/index.js +27 -0
  67. package/components/chart/components/pieDonutChart/index.js +171 -0
  68. package/components/chart/components/pieDonutChart/props.js +5 -0
  69. package/components/chart/constant.js +72 -0
  70. package/components/chart/index.js +930 -0
  71. package/components/chart/props.js +5 -0
  72. package/components/chart/utils.js +691 -0
  73. package/components/common/AppSpinner.js +36 -0
  74. package/components/common/app-spinner.js +26 -0
  75. package/components/common/index.js +12 -0
  76. package/components/constants.js +1208 -0
  77. package/components/container/accordion/accordion-pane/index.js +108 -0
  78. package/components/container/accordion/accordion-pane/props.js +11 -0
  79. package/components/container/accordion/index.js +232 -0
  80. package/components/container/accordion/props.js +13 -0
  81. package/components/container/alignment-utils.js +183 -0
  82. package/components/container/index.js +188 -0
  83. package/components/container/layout-grid/grid-column/index.js +34 -0
  84. package/components/container/layout-grid/grid-row/index.js +24 -0
  85. package/components/container/layout-grid/index.js +33 -0
  86. package/components/container/linear-layout/index.js +72 -0
  87. package/components/container/linear-layout/linear-layout-item/index.js +43 -0
  88. package/components/container/panel/components/panel-header/index.js +144 -0
  89. package/components/container/panel/components/panel-header/props.js +5 -0
  90. package/components/container/panel/hooks.js +144 -0
  91. package/components/container/panel/index.js +286 -0
  92. package/components/container/panel/props.js +5 -0
  93. package/components/container/props.js +5 -0
  94. package/components/container/tabs/index.js +379 -0
  95. package/components/container/tabs/props.js +20 -0
  96. package/components/container/tabs/tab-pane/index.js +42 -0
  97. package/components/container/tabs/tab-pane/props.js +5 -0
  98. package/components/container/wizard/WizardContext.js +16 -0
  99. package/components/container/wizard/components/StepComponents.js +100 -0
  100. package/components/container/wizard/components/WizardStep.js +89 -0
  101. package/components/container/wizard/index.js +710 -0
  102. package/components/container/wizard/props.js +5 -0
  103. package/components/container/wizard/utils.js +133 -0
  104. package/components/container/wizard/wizard-action/index.js +22 -0
  105. package/components/container/wizard/wizard-step/index.js +94 -0
  106. package/components/data/card/card-actions/index.js +24 -0
  107. package/components/data/card/card-content/index.js +38 -0
  108. package/components/data/card/card-footer/index.js +24 -0
  109. package/components/data/card/index.js +246 -0
  110. package/components/data/card/props.js +5 -0
  111. package/components/data/form/base-form/constant.js +39 -0
  112. package/components/data/form/base-form/index.js +460 -0
  113. package/components/data/form/base-form/props.js +29 -0
  114. package/components/data/form/base-form/utils.js +42 -0
  115. package/components/data/form/dynamic-fields/index.js +196 -0
  116. package/components/data/form/dynamic-fields/props.js +5 -0
  117. package/components/data/form/dynamic-fields/utils.js +237 -0
  118. package/components/data/form/form-action/index.js +71 -0
  119. package/components/data/form/form-body/index.js +26 -0
  120. package/components/data/form/form-context.js +34 -0
  121. package/components/data/form/form-controller/props.js +19 -0
  122. package/components/data/form/form-controller/validation-contrustor.js +313 -0
  123. package/components/data/form/form-controller/withFormController.js +320 -0
  124. package/components/data/form/form-field/base-field.js +138 -0
  125. package/components/data/form/form-field/index.js +36 -0
  126. package/components/data/form/form-field/props.js +5 -0
  127. package/components/data/form/form-footer/index.js +26 -0
  128. package/components/data/form/form-header/index.js +56 -0
  129. package/components/data/form/index.js +39 -0
  130. package/components/data/form/props.js +5 -0
  131. package/components/data/list/components/GroupHeader.js +35 -0
  132. package/components/data/list/components/GroupedListItems.js +98 -0
  133. package/components/data/list/components/ListContainer.js +27 -0
  134. package/components/data/list/components/ListDND.js +241 -0
  135. package/components/data/list/components/ListHeader.js +59 -0
  136. package/components/data/list/components/ListItem.js +148 -0
  137. package/components/data/list/components/ListItemWithTemplate.js +59 -0
  138. package/components/data/list/components/ListItems.js +231 -0
  139. package/components/data/list/components/ListPagination.js +165 -0
  140. package/components/data/list/components/LoadMoreButton.js +39 -0
  141. package/components/data/list/components/NoDataMessage.js +22 -0
  142. package/components/data/list/components/StandardListItems.js +84 -0
  143. package/components/data/list/components/index.js +119 -0
  144. package/components/data/list/components/props.js +5 -0
  145. package/components/data/list/hooks/index.js +75 -0
  146. package/components/data/list/hooks/props.js +5 -0
  147. package/components/data/list/hooks/useCurrentPageItems.js +48 -0
  148. package/components/data/list/hooks/useGroupedData.js +37 -0
  149. package/components/data/list/hooks/useListData.js +60 -0
  150. package/components/data/list/hooks/useListEffects.js +285 -0
  151. package/components/data/list/hooks/useListEventHandlers.js +291 -0
  152. package/components/data/list/hooks/useListPagination.js +168 -0
  153. package/components/data/list/hooks/useListState.js +98 -0
  154. package/components/data/list/hooks/useListStateManager.js +195 -0
  155. package/components/data/list/hooks/usePaginatedGroupedData.js +121 -0
  156. package/components/data/list/index.js +611 -0
  157. package/components/data/list/props.js +5 -0
  158. package/components/data/list/templates/media-template.js +53 -0
  159. package/components/data/list/utils/constants.js +81 -0
  160. package/components/data/list/utils/list-helpers.js +173 -0
  161. package/components/data/list/utils/list-widget-methods.js +114 -0
  162. package/components/data/live-filter/index.js +279 -0
  163. package/components/data/live-filter/props.js +12 -0
  164. package/components/data/live-form/index.js +93 -0
  165. package/components/data/live-form/props.js +16 -0
  166. package/components/data/pagination/components/BasicPagination.js +77 -0
  167. package/components/data/pagination/components/ClassicPagination.js +191 -0
  168. package/components/data/pagination/components/InlinePagination.js +99 -0
  169. package/components/data/pagination/components/LoadingComponent.js +31 -0
  170. package/components/data/pagination/components/PageSizeSelector.js +175 -0
  171. package/components/data/pagination/components/PagerNavigation.js +105 -0
  172. package/components/data/pagination/components/TotalRecords.js +52 -0
  173. package/components/data/pagination/components/index.js +47 -0
  174. package/components/data/pagination/components/props.js +5 -0
  175. package/components/data/pagination/hooks/index.js +19 -0
  176. package/components/data/pagination/hooks/props.js +5 -0
  177. package/components/data/pagination/hooks/useNavigationSize.js +44 -0
  178. package/components/data/pagination/hooks/usePagination.js +796 -0
  179. package/components/data/pagination/index.js +322 -0
  180. package/components/data/table/components/AddNewRow.js +190 -0
  181. package/components/data/table/components/EditableCell.js +91 -0
  182. package/components/data/table/components/FieldValidationError.js +24 -0
  183. package/components/data/table/components/RowExpansionButton.js +74 -0
  184. package/components/data/table/components/TableBody.js +279 -0
  185. package/components/data/table/components/TableFilters.js +325 -0
  186. package/components/data/table/components/TableFooterActions.js +48 -0
  187. package/components/data/table/components/TableHeader.js +174 -0
  188. package/components/data/table/components/TablePanelHeading.js +68 -0
  189. package/components/data/table/components/index.js +74 -0
  190. package/components/data/table/hooks/index.js +219 -0
  191. package/components/data/table/hooks/useCellState.js +117 -0
  192. package/components/data/table/hooks/useDynamicColumns.js +85 -0
  193. package/components/data/table/hooks/useEditingState.js +47 -0
  194. package/components/data/table/hooks/useFormWidget.js +184 -0
  195. package/components/data/table/hooks/usePaginationState.js +60 -0
  196. package/components/data/table/hooks/usePanelStructure.js +40 -0
  197. package/components/data/table/hooks/useResponsiveColumns.js +34 -0
  198. package/components/data/table/hooks/useRowExpansion.js +110 -0
  199. package/components/data/table/hooks/useRowHandlers.js +38 -0
  200. package/components/data/table/hooks/useRowSelection.js +213 -0
  201. package/components/data/table/hooks/useServerSideSorting.js +165 -0
  202. package/components/data/table/hooks/useTableColumns.js +263 -0
  203. package/components/data/table/hooks/useTableData.js +154 -0
  204. package/components/data/table/hooks/useTableEdit.js +467 -0
  205. package/components/data/table/hooks/useTableEffects.js +139 -0
  206. package/components/data/table/hooks/useTableFilter.js +389 -0
  207. package/components/data/table/hooks/useTableInitialization.js +103 -0
  208. package/components/data/table/hooks/useTableState.js +69 -0
  209. package/components/data/table/hooks/useTableStateManager.js +558 -0
  210. package/components/data/table/index.js +1295 -0
  211. package/components/data/table/live-table/index.js +232 -0
  212. package/components/data/table/props.js +5 -0
  213. package/components/data/table/table-action/index.js +78 -0
  214. package/components/data/table/table-column/index.js +35 -0
  215. package/components/data/table/table-row/index.js +49 -0
  216. package/components/data/table/table-row-action/index.js +74 -0
  217. package/components/data/table/utils/buildSelectionColumns.js +173 -0
  218. package/components/data/table/utils/columnBuilder.js +209 -0
  219. package/components/data/table/utils/columnProxy.js +48 -0
  220. package/components/data/table/utils/columnWidthDistribution.js +98 -0
  221. package/components/data/table/utils/constants.js +80 -0
  222. package/components/data/table/utils/crud-handlers.js +518 -0
  223. package/components/data/table/utils/dynamic-columns.js +118 -0
  224. package/components/data/table/utils/index.js +607 -0
  225. package/components/data/table/utils/renderDisplayCell.js +183 -0
  226. package/components/data/table/utils/selectionUtils.js +166 -0
  227. package/components/data/table/utils/table-helpers.js +100 -0
  228. package/components/data/table/utils/validation.js +124 -0
  229. package/components/data/types.js +113 -0
  230. package/components/data/utils/field-data-utils.js +66 -0
  231. package/components/data/utils/filter-field-util.js +81 -0
  232. package/components/data/utils/index.js +216 -0
  233. package/components/dialogs/alert-dialog/index.js +80 -0
  234. package/components/dialogs/confirm-dialog/index.js +105 -0
  235. package/components/dialogs/dialog/index.js +56 -0
  236. package/components/dialogs/dialog-actions/index.js +18 -0
  237. package/components/dialogs/dialog-body/index.js +21 -0
  238. package/components/dialogs/dialog-content/index.js +30 -0
  239. package/components/dialogs/dialog-header/index.js +93 -0
  240. package/components/dialogs/iframe-dialog/index.js +114 -0
  241. package/components/dialogs/index.js +129 -0
  242. package/components/dialogs/login-dialog/index.js +369 -0
  243. package/components/dialogs/login-dialog/props.js +5 -0
  244. package/components/dialogs/page-dialog/index.js +96 -0
  245. package/components/dialogs/withDialogWrapper.js +108 -0
  246. package/components/form/button/index.js +216 -0
  247. package/components/form/button-group/index.js +60 -0
  248. package/components/input/calendar/index.js +546 -0
  249. package/components/input/calendar/props.js +5 -0
  250. package/components/input/calendar/utils.js +340 -0
  251. package/components/input/chips/SortableChip/index.js +115 -0
  252. package/components/input/chips/SortableChip/props.js +5 -0
  253. package/components/input/chips/index.js +488 -0
  254. package/components/input/chips/props.js +5 -0
  255. package/components/input/chips/utils.js +259 -0
  256. package/components/input/color-picker/index.js +678 -0
  257. package/components/input/color-picker/props.js +5 -0
  258. package/components/input/composite/index.js +137 -0
  259. package/components/input/currency/index.js +263 -0
  260. package/components/input/currency/props.js +5 -0
  261. package/components/input/default/checkbox/index.js +230 -0
  262. package/components/input/default/checkbox/props.js +5 -0
  263. package/components/input/default/checkboxset/index.js +476 -0
  264. package/components/input/default/checkboxset/props.js +5 -0
  265. package/components/input/default/radioset/index.js +379 -0
  266. package/components/input/default/radioset/props.js +5 -0
  267. package/components/input/default/switch/index.js +490 -0
  268. package/components/input/default/switch/prop.js +5 -0
  269. package/components/input/epoch/date/components/DatePickerPopover.js +220 -0
  270. package/components/input/epoch/date/index.js +520 -0
  271. package/components/input/epoch/date/props.js +5 -0
  272. package/components/input/epoch/date/styled.js +70 -0
  273. package/components/input/epoch/date/utils.js +108 -0
  274. package/components/input/epoch/datetime/index.js +656 -0
  275. package/components/input/epoch/datetime/props.js +5 -0
  276. package/components/input/epoch/datetime/styled.js +90 -0
  277. package/components/input/epoch/datetime/utils.js +244 -0
  278. package/components/input/epoch/time/index.js +412 -0
  279. package/components/input/epoch/time/props.js +5 -0
  280. package/components/input/epoch/time/utils.js +209 -0
  281. package/components/input/fileupload/Utils.js +134 -0
  282. package/components/input/fileupload/components/ListItems.js +140 -0
  283. package/components/input/fileupload/components/MultiUpload.js +85 -0
  284. package/components/input/fileupload/components/SingleUpload.js +65 -0
  285. package/components/input/fileupload/index.js +170 -0
  286. package/components/input/fileupload/props.js +5 -0
  287. package/components/input/fileupload/useFileUpload.js +400 -0
  288. package/components/input/number/index.js +295 -0
  289. package/components/input/number/props.js +5 -0
  290. package/components/input/rating/index.js +368 -0
  291. package/components/input/rating/props.js +5 -0
  292. package/components/input/select/index.js +344 -0
  293. package/components/input/select/props.js +5 -0
  294. package/components/input/slider/index.js +167 -0
  295. package/components/input/slider/props.js +5 -0
  296. package/components/input/text/index.js +434 -0
  297. package/components/input/text/props.js +5 -0
  298. package/components/input/text/util.js +179 -0
  299. package/components/input/textarea/index.js +347 -0
  300. package/components/input/textarea/props.js +5 -0
  301. package/components/layout/footer/index.js +30 -0
  302. package/components/layout/header/index.js +30 -0
  303. package/components/layout/leftnav/index.js +44 -0
  304. package/components/layout/rightnav/index.js +32 -0
  305. package/components/layout/topnav/index.js +34 -0
  306. package/components/navbar/index.js +41 -0
  307. package/components/navbar/nav/index.js +102 -0
  308. package/components/navbar/nav/props.js +5 -0
  309. package/components/navbar/nav-item/index.js +44 -0
  310. package/components/navigation/breadcrumb/index.js +56 -0
  311. package/components/navigation/breadcrumb/props.js +5 -0
  312. package/components/navigation/menu/components/ListItems.js +66 -0
  313. package/components/navigation/menu/constants.js +101 -0
  314. package/components/navigation/menu/index.js +807 -0
  315. package/components/navigation/menu/props.js +5 -0
  316. package/components/navigation/popover/index.js +209 -0
  317. package/components/navigation/popover/props.js +15 -0
  318. package/components/page/content/index.js +28 -0
  319. package/components/page/error-boundary/index.js +108 -0
  320. package/components/page/index.js +137 -0
  321. package/components/page/page-content/index.js +23 -0
  322. package/components/page/partial/index.js +36 -0
  323. package/components/page/partial-container/index.js +48 -0
  324. package/components/page/props.js +5 -0
  325. package/components/page/toast-container/index.js +33 -0
  326. package/components/prefab/container/index.js +46 -0
  327. package/components/prefab/index.js +67 -0
  328. package/context/AppContext.js +25 -0
  329. package/context/AppSpinnerProvider.js +43 -0
  330. package/context/LocalizationProvider.js +79 -0
  331. package/context/PrefabContext.js +66 -0
  332. package/context/WidgetProvider.js +187 -0
  333. package/core/app-config.js +1 -0
  334. package/core/app.service.js +357 -0
  335. package/core/appVariablesStore.js +20 -0
  336. package/core/appstore.js +88 -0
  337. package/core/constants/currency-constant.js +1071 -0
  338. package/core/constants/events.js +34 -0
  339. package/core/constants/index.js +27 -0
  340. package/core/dialog.service.js +76 -0
  341. package/core/event-notifier.js +151 -0
  342. package/core/formatter/date-formatters.js +222 -0
  343. package/core/formatter/index.js +131 -0
  344. package/core/formatter/number-formatters.js +142 -0
  345. package/core/formatter/security-formatters.js +323 -0
  346. package/core/formatter/string-formatters.js +52 -0
  347. package/core/formatter/types.js +18 -0
  348. package/core/formatters.js +24 -0
  349. package/core/proxy-service.js +412 -0
  350. package/core/script-registry.js +63 -0
  351. package/core/security.service.js +11 -0
  352. package/core/util/common.js +33 -0
  353. package/core/util/dom.js +107 -0
  354. package/core/util/index.js +136 -0
  355. package/core/util/security.js +184 -0
  356. package/core/util/utils.js +189 -0
  357. package/core/widget-observer.js +98 -0
  358. package/higherOrder/BaseApp.js +430 -0
  359. package/higherOrder/BaseAppProps.js +5 -0
  360. package/higherOrder/BaseDateTime.js +251 -0
  361. package/higherOrder/BasePage.js +715 -0
  362. package/higherOrder/BasePartial.js +124 -0
  363. package/higherOrder/BasePrefab.js +145 -0
  364. package/higherOrder/DataNav.js +377 -0
  365. package/higherOrder/helper.js +43 -0
  366. package/higherOrder/props.js +5 -0
  367. package/higherOrder/withBaseWrapper.js +183 -0
  368. package/hooks/useAccess.js +308 -0
  369. package/hooks/useAppConfig.js +42 -0
  370. package/hooks/useAuth.js +562 -0
  371. package/hooks/useDataSourceSubscription.js +125 -0
  372. package/hooks/useDebounce.js +76 -0
  373. package/hooks/useDeviceVisibility.js +49 -0
  374. package/hooks/useHttp.js +338 -0
  375. package/libs/index.js +20 -0
  376. package/mui-config/theme-provider.js +17 -0
  377. package/mui-config/theme.js +371 -0
  378. package/package-lock.json +10183 -0
  379. package/package.json +95 -0
  380. package/store/index.js +33 -0
  381. package/store/middleware/navigationMiddleware.js +48 -0
  382. package/store/slices/appConfigSlice.js +103 -0
  383. package/store/slices/authSlice.js +508 -0
  384. package/store/slices/i18nSlice.js +206 -0
  385. package/types/index.js +15 -0
  386. package/utils/dataset-util.js +174 -0
  387. package/utils/eval-expression.js +32 -0
  388. package/utils/form-state.util.js +140 -0
  389. package/utils/form-utils.js +187 -0
  390. package/utils/format-util.js +260 -0
  391. package/utils/page-params-util.js +24 -0
  392. package/utils/resource-url.js +27 -0
  393. package/utils/state-persistance.js +343 -0
  394. package/utils/style-utils.js +73 -0
  395. package/utils/transformedDataset-utils.js +633 -0
  396. package/utils/widget-cleanup-util.js +84 -0
  397. package/utils/widgets.js +99 -0
  398. package/variables/base-variable.js +173 -0
  399. package/variables/constants.js +27 -0
  400. package/variables/live-variable.js +166 -0
  401. package/variables/model-variable.js +77 -0
  402. package/variables/service-variable.js +307 -0
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _withBaseWrapper = _interopRequireDefault(require("../../../../higherOrder/withBaseWrapper"));
14
+ var _dialog = _interopRequireDefault(require("../../../dialogs/dialog"));
15
+ var _dialogBody = require("@wavemaker/react-runtime/components/dialogs/dialog-body");
16
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
18
+ var __jsx = _react["default"].createElement;
19
+ 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; }
20
+ 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) { (0, _defineProperty2["default"])(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; }
21
+ var WmLiveTable = function WmLiveTable(props) {
22
+ var _useState = (0, _react.useState)(false),
23
+ isDialogOpen = _useState[0],
24
+ setIsDialogOpen = _useState[1];
25
+ var _useState2 = (0, _react.useState)(null),
26
+ formData = _useState2[0],
27
+ setFormData = _useState2[1];
28
+ var _useState3 = (0, _react.useState)(false),
29
+ isAddingNewRow = _useState3[0],
30
+ setIsAddingNewRow = _useState3[1];
31
+ var isDialogLayout = props.formlayout === "dialog";
32
+ var _props$formlayout = props.formlayout,
33
+ formlayout = _props$formlayout === void 0 ? "form" : _props$formlayout,
34
+ listener = props.listener;
35
+
36
+ // Separate WmTable and WmLiveForm from children - optimized with early exit
37
+ var _useMemo = (0, _react.useMemo)(function () {
38
+ var tableChild;
39
+ var formChild;
40
+ var childArray = _react.Children.toArray(props.children);
41
+ for (var i = 0; i < childArray.length; i++) {
42
+ var child = childArray[i];
43
+ if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
44
+ var _child$type, _child$type2;
45
+ var displayName = ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) || ((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.name) || "";
46
+ if (!tableChild && displayName === "WmTable") {
47
+ tableChild = child;
48
+ } else if (!formChild && displayName === "WmLiveForm") {
49
+ formChild = child;
50
+ }
51
+
52
+ // Early exit if both children found
53
+ if (tableChild && formChild) break;
54
+ }
55
+ }
56
+ return {
57
+ tableChild: tableChild,
58
+ formChild: formChild
59
+ };
60
+ }, [props.children]),
61
+ tableChild = _useMemo.tableChild,
62
+ formChild = _useMemo.formChild;
63
+ var handleOpenDialog = (0, _react.useCallback)(function () {
64
+ setIsDialogOpen(true);
65
+ }, []);
66
+ var handleCloseDialog = (0, _react.useCallback)(function () {
67
+ setIsDialogOpen(false);
68
+ // Clear form data when dialog closes
69
+ setFormData(null);
70
+ }, []);
71
+
72
+ // Helper to get form widget - always get fresh value from listener
73
+ var getFormWidget = (0, _react.useCallback)(function () {
74
+ var _listener$Widgets;
75
+ // Always get fresh value from listener to ensure we have the latest registered methods
76
+ return listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets[formChild === null || formChild === void 0 ? void 0 : formChild.props.name];
77
+ }, [formChild === null || formChild === void 0 ? void 0 : formChild.props.name]);
78
+ var getTableWidget = (0, _react.useCallback)(function () {
79
+ var _listener$Widgets2;
80
+ return listener === null || listener === void 0 || (_listener$Widgets2 = listener.Widgets) === null || _listener$Widgets2 === void 0 ? void 0 : _listener$Widgets2[tableChild === null || tableChild === void 0 ? void 0 : tableChild.props.name];
81
+ }, [tableChild === null || tableChild === void 0 ? void 0 : tableChild.props.name]);
82
+
83
+ // Expose LiveTable methods through its own listener
84
+ (0, _react.useEffect)(function () {
85
+ if (!(listener !== null && listener !== void 0 && listener.onChange) || !(formChild !== null && formChild !== void 0 && formChild.props.name)) return;
86
+ var liveTableContext = {
87
+ addNewRow: function addNewRow(event, widget, row) {
88
+ var formWidget = getFormWidget();
89
+ var tableWidget = getTableWidget();
90
+
91
+ // Set flag to indicate we're adding a new row
92
+ setIsAddingNewRow(true);
93
+ if (isDialogLayout) {
94
+ // Clear form data for new row
95
+ setFormData({});
96
+ handleOpenDialog();
97
+ } else if (formlayout === "form") {
98
+ // For non-dialog mode, just reset the form
99
+ formWidget === null || formWidget === void 0 || formWidget["new"]();
100
+ } else if (formlayout === "inline" || formlayout === "quickedit") {
101
+ tableWidget === null || tableWidget === void 0 || tableWidget.addNewRow();
102
+ }
103
+ },
104
+ editRow: function editRow(event, widget, row) {
105
+ var tableWidget = getTableWidget();
106
+
107
+ // Reset flag since we're editing, not adding new
108
+ setIsAddingNewRow(false);
109
+ if (isDialogLayout) {
110
+ // Set form data first, then open dialog
111
+ setFormData(row);
112
+ handleOpenDialog();
113
+ } else if (formlayout === "form") {
114
+ var formWidget = getFormWidget();
115
+ formWidget === null || formWidget === void 0 || formWidget.edit(row);
116
+ } else if (formlayout === "inline" || formlayout === "quickedit") {
117
+ tableWidget === null || tableWidget === void 0 || tableWidget.editRow(event, widget, row);
118
+ }
119
+ },
120
+ closeDialog: function closeDialog() {
121
+ if (isDialogLayout) {
122
+ handleCloseDialog();
123
+ }
124
+ }
125
+ };
126
+ listener.onChange(props.name, liveTableContext);
127
+ }, [props.name, formChild === null || formChild === void 0 ? void 0 : formChild.props.name]);
128
+
129
+ // Create stable callbacks for form handlers
130
+ var handleFormSuccess = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
131
+ var _formChild$props, _formChild$props$onSu;
132
+ var _formWidget$setShowVi, formWidget, tableWidget;
133
+ return _regenerator["default"].wrap(function _callee$(_context) {
134
+ while (1) switch (_context.prev = _context.next) {
135
+ case 0:
136
+ if (isDialogLayout) {
137
+ handleCloseDialog();
138
+ } else {
139
+ // Set form to view mode after successful submission
140
+ formWidget = getFormWidget();
141
+ formWidget === null || formWidget === void 0 || (_formWidget$setShowVi = formWidget.setShowViewMode) === null || _formWidget$setShowVi === void 0 || _formWidget$setShowVi.call(formWidget, true);
142
+ }
143
+ tableWidget = getTableWidget();
144
+ if (!(tableWidget && tableWidget.datasource)) {
145
+ _context.next = 12;
146
+ break;
147
+ }
148
+ _context.prev = 3;
149
+ if (!(tableWidget.refresh && typeof tableWidget.refresh === "function")) {
150
+ _context.next = 7;
151
+ break;
152
+ }
153
+ _context.next = 7;
154
+ return tableWidget.refresh(isAddingNewRow);
155
+ case 7:
156
+ _context.next = 12;
157
+ break;
158
+ case 9:
159
+ _context.prev = 9;
160
+ _context.t0 = _context["catch"](3);
161
+ console.error("Error refreshing table data:", _context.t0);
162
+ case 12:
163
+ // Reset the flag after refresh
164
+ setIsAddingNewRow(false);
165
+
166
+ // Call original onSuccess if it exists
167
+ formChild === null || formChild === void 0 || (_formChild$props = formChild.props) === null || _formChild$props === void 0 || (_formChild$props$onSu = _formChild$props.onSuccess) === null || _formChild$props$onSu === void 0 || _formChild$props$onSu.call(_formChild$props);
168
+ case 14:
169
+ case "end":
170
+ return _context.stop();
171
+ }
172
+ }, _callee, null, [[3, 9]]);
173
+ })), [isDialogLayout, handleCloseDialog, getFormWidget, getTableWidget, formChild === null || formChild === void 0 ? void 0 : formChild.props, isAddingNewRow]);
174
+ var handleFormCancel = (0, _react.useCallback)(function () {
175
+ var _formChild$props2, _formChild$props2$can;
176
+ handleCloseDialog();
177
+ // Reset the flag when cancelling
178
+ setIsAddingNewRow(false);
179
+ // Call original cancel if it exists
180
+ formChild === null || formChild === void 0 || (_formChild$props2 = formChild.props) === null || _formChild$props2 === void 0 || (_formChild$props2$can = _formChild$props2.cancel) === null || _formChild$props2$can === void 0 || _formChild$props2$can.call(_formChild$props2);
181
+ if (formlayout === "form") {
182
+ var _formWidget$setShowVi2;
183
+ // Set form to view mode after successful submission
184
+ var formWidget = getFormWidget();
185
+ formWidget === null || formWidget === void 0 || (_formWidget$setShowVi2 = formWidget.setShowViewMode) === null || _formWidget$setShowVi2 === void 0 || _formWidget$setShowVi2.call(formWidget, true);
186
+ }
187
+ }, [handleCloseDialog, formChild === null || formChild === void 0 ? void 0 : formChild.props, formlayout, getFormWidget]);
188
+
189
+ // Enhance form child with success/cancel handlers - memoized more efficiently
190
+ var enhancedFormChild = (0, _react.useMemo)(function () {
191
+ if (!formChild || ! /*#__PURE__*/(0, _react.isValidElement)(formChild)) return formChild;
192
+ var newProps = _objectSpread(_objectSpread({}, formChild.props), {}, {
193
+ isLayoutDialog: isDialogLayout,
194
+ onSuccess: handleFormSuccess,
195
+ cancel: handleFormCancel
196
+ }, isDialogLayout && formData !== null && {
197
+ formdata: formData
198
+ });
199
+ return /*#__PURE__*/(0, _react.cloneElement)(formChild, newProps);
200
+ }, [formChild, isDialogLayout, handleFormSuccess, handleFormCancel, formData]);
201
+ var enhancedTableChild = (0, _react.useMemo)(function () {
202
+ if (!tableChild || ! /*#__PURE__*/(0, _react.isValidElement)(tableChild)) return tableChild;
203
+ return /*#__PURE__*/(0, _react.cloneElement)(tableChild, _objectSpread(_objectSpread({}, tableChild.props), {}, {
204
+ formName: formChild === null || formChild === void 0 ? void 0 : formChild.props.name
205
+ }));
206
+ }, [tableChild]);
207
+
208
+ // Render based on formlayout
209
+ if (isDialogLayout) {
210
+ return __jsx(_react["default"].Fragment, null, enhancedTableChild, formChild && __jsx(_dialog["default"], {
211
+ isopen: isDialogOpen,
212
+ onClose: handleCloseDialog,
213
+ name: "".concat(props.name, "_dialog"),
214
+ listener: props.listener,
215
+ modal: true,
216
+ closable: true,
217
+ title: formChild.props.title,
218
+ iconclass: formChild.props.iconclass,
219
+ dialogtype: "design-dialog"
220
+ }, __jsx(_dialogBody.WmDialogBody, {
221
+ name: "popup-body",
222
+ listener: {}
223
+ }, enhancedFormChild)));
224
+ }
225
+
226
+ // Default: render as form
227
+ return __jsx(_Box["default"], {
228
+ component: "div",
229
+ className: "app-livegrid"
230
+ }, enhancedTableChild, enhancedFormChild);
231
+ };
232
+ var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmLiveTable);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.WmTableAction = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
12
+ var _withBaseWrapper = _interopRequireDefault(require("../../../../higherOrder/withBaseWrapper"));
13
+ var _excluded = ["widgetType", "displayName", "iconclass", "action", "position", "shortcutkey", "listener", "children", "variant", "color", "onClick"];
14
+ var __jsx = _react["default"].createElement;
15
+ 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; }
16
+ 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) { (0, _defineProperty2["default"])(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; }
17
+ var WmTableActionComponent = function WmTableActionComponent(_ref) {
18
+ var widgetType = _ref.widgetType,
19
+ displayName = _ref.displayName,
20
+ iconclass = _ref.iconclass,
21
+ action = _ref.action,
22
+ _ref$position = _ref.position,
23
+ position = _ref$position === void 0 ? "footer" : _ref$position,
24
+ shortcutkey = _ref.shortcutkey,
25
+ listener = _ref.listener,
26
+ children = _ref.children,
27
+ _ref$variant = _ref.variant,
28
+ variant = _ref$variant === void 0 ? "contained" : _ref$variant,
29
+ _ref$color = _ref.color,
30
+ color = _ref$color === void 0 ? "primary" : _ref$color,
31
+ onClick = _ref.onClick,
32
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
33
+ var handleClick = function handleClick(event) {
34
+ event.preventDefault();
35
+ event.stopPropagation();
36
+ if (onClick) {
37
+ onClick(event);
38
+ }
39
+ };
40
+ var handleKeyDown = function handleKeyDown(event) {
41
+ if (shortcutkey) {
42
+ var key = event.key.toLowerCase();
43
+ var shortcut = shortcutkey.toLowerCase();
44
+ if (key === shortcut || shortcut.includes("ctrl") && event.ctrlKey && key === shortcut.replace("ctrl+", "") || shortcut.includes("alt") && event.altKey && key === shortcut.replace("alt+", "") || shortcut.includes("shift") && event.shiftKey && key === shortcut.replace("shift+", "")) {
45
+ event.preventDefault();
46
+ handleClick(event);
47
+ }
48
+ }
49
+ };
50
+ var renderIcon = function renderIcon() {
51
+ if (iconclass) {
52
+ return __jsx("i", {
53
+ className: iconclass
54
+ });
55
+ }
56
+ return null;
57
+ };
58
+ return __jsx(_Button["default"], {
59
+ variant: variant,
60
+ color: color,
61
+ className: "wm-table-action ".concat(props.className || ""),
62
+ onClick: handleClick,
63
+ onKeyDown: handleKeyDown,
64
+ title: props.title || displayName || "",
65
+ disabled: props.disabled,
66
+ tabIndex: props.tabindex,
67
+ startIcon: renderIcon(),
68
+ sx: _objectSpread(_objectSpread({}, props.styles), {}, {
69
+ display: props.show === "false" ? "none" : undefined,
70
+ "& .MuiButton-startIcon": {
71
+ marginRight: displayName ? 1 : 0
72
+ }
73
+ })
74
+ }, displayName);
75
+ };
76
+ WmTableActionComponent.displayName = "WmTableAction";
77
+ var WmTableAction = exports.WmTableAction = (0, _withBaseWrapper["default"])(WmTableActionComponent);
78
+ var _default = exports["default"] = WmTableAction;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.WmTableColumn = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _material = require("@mui/material");
11
+ var _withBaseWrapper = _interopRequireDefault(require("../../../../higherOrder/withBaseWrapper"));
12
+ var _excluded = ["binding", "caption", "widgetType", "pcdisplay", "mobiledisplay", "tabletdisplay", "index", "headerindex", "children", "listener"];
13
+ var __jsx = _react["default"].createElement;
14
+ var WmTableColumnComponent = function WmTableColumnComponent(_ref) {
15
+ var binding = _ref.binding,
16
+ caption = _ref.caption,
17
+ widgetType = _ref.widgetType,
18
+ _ref$pcdisplay = _ref.pcdisplay,
19
+ pcdisplay = _ref$pcdisplay === void 0 ? "true" : _ref$pcdisplay,
20
+ _ref$mobiledisplay = _ref.mobiledisplay,
21
+ mobiledisplay = _ref$mobiledisplay === void 0 ? "true" : _ref$mobiledisplay,
22
+ _ref$tabletdisplay = _ref.tabletdisplay,
23
+ tabletdisplay = _ref$tabletdisplay === void 0 ? "true" : _ref$tabletdisplay,
24
+ index = _ref.index,
25
+ headerindex = _ref.headerindex,
26
+ children = _ref.children,
27
+ listener = _ref.listener,
28
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
29
+ return __jsx(_material.TableCell, {
30
+ className: "wm-table-column ".concat(props.className || "")
31
+ }, children);
32
+ };
33
+ WmTableColumnComponent.displayName = "WmTableColumn";
34
+ var WmTableColumn = exports.WmTableColumn = (0, _withBaseWrapper["default"])(WmTableColumnComponent);
35
+ var _default = exports["default"] = WmTableColumn;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.WmTableRow = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _withBaseWrapper = _interopRequireDefault(require("../../../../higherOrder/withBaseWrapper"));
10
+ var _excluded = ["displayName", "widgetType", "expandicon", "collapseicon", "expandtitle", "collapsetitle", "position", "closeothers", "onBeforerowexpand", "onRowexpand", "onBeforerowcollapse", "onRowcollapse", "show", "disabled", "columnwidth", "content", "listener", "children", "renderPartial"];
11
+ var WmTableRowComponent = function WmTableRowComponent(_ref) {
12
+ var displayName = _ref.displayName,
13
+ _ref$widgetType = _ref.widgetType,
14
+ widgetType = _ref$widgetType === void 0 ? "button" : _ref$widgetType,
15
+ _ref$expandicon = _ref.expandicon,
16
+ expandicon = _ref$expandicon === void 0 ? "wi wi-expand-more" : _ref$expandicon,
17
+ _ref$collapseicon = _ref.collapseicon,
18
+ collapseicon = _ref$collapseicon === void 0 ? "wi wi-chevron-right" : _ref$collapseicon,
19
+ expandtitle = _ref.expandtitle,
20
+ collapsetitle = _ref.collapsetitle,
21
+ _ref$position = _ref.position,
22
+ position = _ref$position === void 0 ? "0" : _ref$position,
23
+ _ref$closeothers = _ref.closeothers,
24
+ closeothers = _ref$closeothers === void 0 ? false : _ref$closeothers,
25
+ onBeforerowexpand = _ref.onBeforerowexpand,
26
+ onRowexpand = _ref.onRowexpand,
27
+ onBeforerowcollapse = _ref.onBeforerowcollapse,
28
+ onRowcollapse = _ref.onRowcollapse,
29
+ _ref$show = _ref.show,
30
+ show = _ref$show === void 0 ? true : _ref$show,
31
+ _ref$disabled = _ref.disabled,
32
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
33
+ _ref$columnwidth = _ref.columnwidth,
34
+ columnwidth = _ref$columnwidth === void 0 ? "50px" : _ref$columnwidth,
35
+ content = _ref.content,
36
+ listener = _ref.listener,
37
+ children = _ref.children,
38
+ renderPartial = _ref.renderPartial,
39
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
40
+ // This is a configuration component that defines row expansion behavior.
41
+ // It doesn't render anything directly - the table parses its props
42
+ // and uses them to render expansion controls and expanded content.
43
+ // The renderPartial function receives props (including rowData) and an onLoad callback.
44
+ // The renderPartial prop or children will be rendered when a row is expanded.
45
+ return null;
46
+ };
47
+ WmTableRowComponent.displayName = "WmTableRow";
48
+ var WmTableRow = exports.WmTableRow = (0, _withBaseWrapper["default"])(WmTableRowComponent);
49
+ var _default = exports["default"] = WmTableRow;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.WmTableRowAction = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _material = require("@mui/material");
13
+ var _anchor = require("@wavemaker/react-runtime/components/basic/anchor");
14
+ var _excluded = ["displayName", "title", "iconclass", "action", "row", "rowIndex", "listener", "children", "onClick", "widgettype", "show"];
15
+ var __jsx = _react["default"].createElement;
16
+ 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; }
17
+ 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) { (0, _defineProperty2["default"])(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; }
18
+ var WmTableRowActionComponent = function WmTableRowActionComponent(_ref) {
19
+ var displayName = _ref.displayName,
20
+ title = _ref.title,
21
+ iconclass = _ref.iconclass,
22
+ action = _ref.action,
23
+ row = _ref.row,
24
+ rowIndex = _ref.rowIndex,
25
+ listener = _ref.listener,
26
+ children = _ref.children,
27
+ onClick = _ref.onClick,
28
+ widgettype = _ref.widgettype,
29
+ _ref$show = _ref.show,
30
+ show = _ref$show === void 0 ? true : _ref$show,
31
+ props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
32
+ var handleClick = function handleClick(event) {
33
+ event.preventDefault();
34
+ event.stopPropagation();
35
+ if (onClick) {
36
+ // Pass rowData as part of widget parameter
37
+ onClick(event, {}, row);
38
+ }
39
+ };
40
+ if (!show) {
41
+ return null;
42
+ }
43
+ if (widgettype === "anchor") {
44
+ return __jsx(_anchor.WmAnchor, (0, _extends2["default"])({}, props, {
45
+ title: displayName,
46
+ caption: displayName,
47
+ name: props.name || displayName,
48
+ listener: listener,
49
+ onClick: handleClick,
50
+ iconclass: iconclass,
51
+ show: show.toString(),
52
+ className: "wm-table-row-action ".concat(props.className || "")
53
+ }));
54
+ }
55
+ return __jsx(_material.Button, {
56
+ variant: "text",
57
+ size: "small",
58
+ className: "wm-table-row-action ".concat(props.className || ""),
59
+ onClick: handleClick,
60
+ title: title,
61
+ startIcon: iconclass ? __jsx("i", {
62
+ className: iconclass
63
+ }) : undefined,
64
+ sx: _objectSpread(_objectSpread({}, props.styles), {}, {
65
+ padding: "0.25rem 0.5rem",
66
+ marginRight: "0.25rem",
67
+ minWidth: "auto",
68
+ textTransform: "none"
69
+ })
70
+ }, displayName);
71
+ };
72
+ WmTableRowActionComponent.displayName = "WmTableRowAction";
73
+ var WmTableRowAction = exports.WmTableRowAction = WmTableRowActionComponent;
74
+ var _default = exports["default"] = WmTableRowAction;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.buildSelectionColumns = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _material = require("@mui/material");
10
+ var _index = require("./index");
11
+ var _lodashEs = require("lodash-es");
12
+ var __jsx = _react["default"].createElement;
13
+ var buildSelectionColumns = exports.buildSelectionColumns = function buildSelectionColumns(_ref) {
14
+ var useRadioSelect = _ref.useRadioSelect,
15
+ useMultiSelect = _ref.useMultiSelect,
16
+ selectedRowId = _ref.selectedRowId,
17
+ selectedRowIds = _ref.selectedRowIds,
18
+ handleRadioSelection = _ref.handleRadioSelection,
19
+ handleMultiSelection = _ref.handleMultiSelection,
20
+ handleSelectAll = _ref.handleSelectAll,
21
+ internalDataset = _ref.internalDataset,
22
+ _ref$radioselecttitle = _ref.radioselecttitle,
23
+ radioselecttitle = _ref$radioselecttitle === void 0 ? "" : _ref$radioselecttitle,
24
+ _ref$radioselectarial = _ref.radioselectarialabel,
25
+ radioselectarialabel = _ref$radioselectarial === void 0 ? _index.TABLE_MESSAGES.radioSelectAriaLabel : _ref$radioselectarial,
26
+ _ref$multiselecttitle = _ref.multiselecttitle,
27
+ multiselecttitle = _ref$multiselecttitle === void 0 ? "" : _ref$multiselecttitle,
28
+ _ref$multiselectarial = _ref.multiselectarialabel,
29
+ multiselectarialabel = _ref$multiselectarial === void 0 ? _index.TABLE_MESSAGES.multiSelectAriaLabel : _ref$multiselectarial,
30
+ _ref$tableName = _ref.tableName,
31
+ tableName = _ref$tableName === void 0 ? "table" : _ref$tableName;
32
+ // Radio select column
33
+ if (useRadioSelect) {
34
+ return {
35
+ id: "radioSelect",
36
+ header: function header() {
37
+ return __jsx(_material.Box, {
38
+ sx: {
39
+ display: "flex",
40
+ justifyContent: "center"
41
+ }
42
+ });
43
+ },
44
+ cell: function cell(_ref2) {
45
+ var _table$getState$rowSe;
46
+ var row = _ref2.row,
47
+ table = _ref2.table;
48
+ var rowId = row.id;
49
+ // Get selection state from table's rowSelection state
50
+ var isSelected = ((_table$getState$rowSe = table.getState().rowSelection) === null || _table$getState$rowSe === void 0 ? void 0 : _table$getState$rowSe[rowId]) || false;
51
+ return __jsx(_material.Box, {
52
+ sx: {
53
+ display: "flex",
54
+ justifyContent: "center"
55
+ }
56
+ }, __jsx(_material.Tooltip, {
57
+ title: radioselecttitle,
58
+ placement: "top"
59
+ }, __jsx(_material.Box, {
60
+ className: "radio app-radio"
61
+ }, __jsx(_material.FormControlLabel, {
62
+ control: __jsx(_material.Radio, {
63
+ checked: isSelected,
64
+ onChange: function onChange() {
65
+ return handleRadioSelection(rowId, row.original);
66
+ },
67
+ value: rowId,
68
+ name: "wmRadioselect-".concat(tableName),
69
+ inputProps: {
70
+ "aria-label": radioselectarialabel
71
+ }
72
+ // @ts-ignore - Custom attribute for WaveMaker specific functionality
73
+ ,
74
+ rowselectinput: "",
75
+ size: "small"
76
+ }),
77
+ label: "",
78
+ className: "caption"
79
+ }))));
80
+ },
81
+ size: 40,
82
+ minSize: 40,
83
+ maxSize: 40,
84
+ enableResizing: false
85
+ };
86
+ }
87
+
88
+ // Multiselect column
89
+ if (useMultiSelect) {
90
+ return {
91
+ id: "multiSelect",
92
+ header: function header(_ref3) {
93
+ var table = _ref3.table;
94
+ // Get the current data and selection state from the table instance
95
+ var currentData = table.options.data || [];
96
+ var rowSelection = table.getState().rowSelection || {};
97
+ var selectedCount = (0, _lodashEs.size)((0, _lodashEs.pickBy)(rowSelection));
98
+ var isAllSelected = selectedCount > 0 && selectedCount === currentData.length;
99
+ var isIndeterminate = selectedCount > 0 && selectedCount < currentData.length;
100
+ return __jsx(_material.Box, {
101
+ sx: {
102
+ display: "flex",
103
+ justifyContent: "center",
104
+ width: "100%"
105
+ }
106
+ }, __jsx(_material.Box, {
107
+ className: "app-checkbox checkbox"
108
+ }, __jsx(_material.FormControlLabel, {
109
+ control: __jsx(_material.Checkbox, {
110
+ checked: isAllSelected,
111
+ indeterminate: isIndeterminate,
112
+ onChange: function onChange(e) {
113
+ return handleSelectAll(e.target.checked);
114
+ },
115
+ size: "small",
116
+ inputProps: {
117
+ "aria-label": "Select all rows"
118
+ }
119
+ }),
120
+ label: "",
121
+ className: "caption"
122
+ })));
123
+ },
124
+ cell: function cell(_ref4) {
125
+ var _table$getState$rowSe2;
126
+ var row = _ref4.row,
127
+ table = _ref4.table;
128
+ var rowId = row.id;
129
+ // Get selection state from table's rowSelection state
130
+ var isSelected = ((_table$getState$rowSe2 = table.getState().rowSelection) === null || _table$getState$rowSe2 === void 0 ? void 0 : _table$getState$rowSe2[rowId]) || false;
131
+ return __jsx(_material.Box, {
132
+ sx: {
133
+ display: "flex",
134
+ justifyContent: "center"
135
+ }
136
+ }, __jsx(_material.Tooltip, {
137
+ title: multiselecttitle,
138
+ placement: "top"
139
+ }, __jsx(_material.Box, {
140
+ className: "app-checkbox checkbox"
141
+ }, __jsx(_material.FormControlLabel, {
142
+ control: __jsx(_material.Checkbox, {
143
+ checked: isSelected,
144
+ onChange: function onChange(e) {
145
+ return handleMultiSelection(rowId, row.original, e.target.checked);
146
+ },
147
+ value: rowId,
148
+ name: "gridMultiSelect",
149
+ inputProps: {
150
+ "aria-label": multiselectarialabel,
151
+ role: "checkbox",
152
+ "aria-live": "assertive"
153
+ },
154
+ size: "small"
155
+ }),
156
+ label: "",
157
+ className: "caption"
158
+ }))), isSelected ? __jsx("span", {
159
+ className: "sr-only",
160
+ "aria-live": "assertive"
161
+ }, "Row Selected") : __jsx("span", {
162
+ className: "sr-only",
163
+ "aria-live": "assertive"
164
+ }, "Row Deselected"));
165
+ },
166
+ size: 40,
167
+ minSize: 40,
168
+ maxSize: 40,
169
+ enableResizing: false
170
+ };
171
+ }
172
+ return null;
173
+ };