nexus-shared 1.1.21 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/CHANGELOG.md +262 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1000 -0
  4. package/dist/Client.Index.d.ts +55 -0
  5. package/dist/Client.Index.js +60 -0
  6. package/dist/Components/Chats/Chat.d.ts +28 -0
  7. package/dist/Components/Chats/Chat.js +19 -0
  8. package/dist/Components/Chats/ChatButton.d.ts +26 -0
  9. package/dist/Components/Chats/ChatButton.js +41 -0
  10. package/dist/Components/Chats/ChatComposer.d.ts +41 -0
  11. package/dist/Components/Chats/ChatComposer.js +177 -0
  12. package/dist/Components/Chats/ChatConversations.d.ts +35 -0
  13. package/dist/Components/Chats/ChatConversations.js +38 -0
  14. package/dist/Components/Chats/ChatPanel.d.ts +66 -0
  15. package/dist/Components/Chats/ChatPanel.js +94 -0
  16. package/dist/Components/Chats/ChatParts.d.ts +87 -0
  17. package/dist/Components/Chats/ChatParts.js +100 -0
  18. package/dist/Components/Chats/ChatThread.d.ts +22 -0
  19. package/dist/Components/Chats/ChatThread.js +96 -0
  20. package/dist/Components/Documents/Button.d.ts +29 -0
  21. package/dist/Components/Documents/Button.js +11 -0
  22. package/dist/Components/Documents/Menu.d.ts +102 -0
  23. package/dist/Components/Documents/Menu.js +242 -0
  24. package/dist/Components/Documents/SplitButton.d.ts +64 -0
  25. package/dist/Components/Documents/SplitButton.js +129 -0
  26. package/dist/Components/Documents/TabButtons.d.ts +80 -0
  27. package/dist/Components/Documents/TabButtons.js +38 -0
  28. package/dist/Components/Forms/ApiForm.d.ts +23 -0
  29. package/dist/Components/Forms/ApiForm.js +100 -0
  30. package/dist/Components/Forms/Crud.d.ts +17 -0
  31. package/dist/Components/Forms/Crud.js +708 -0
  32. package/dist/Components/Forms/CrudParts.d.ts +15 -0
  33. package/dist/Components/Forms/CrudParts.js +36 -0
  34. package/dist/Components/Forms/ExcelImport.d.ts +42 -0
  35. package/dist/Components/Forms/ExcelImport.js +190 -0
  36. package/dist/Components/Forms/Form.d.ts +52 -0
  37. package/dist/Components/Forms/Form.js +323 -0
  38. package/dist/Components/Forms/SubmitForm.d.ts +65 -0
  39. package/dist/Components/Forms/SubmitForm.js +198 -0
  40. package/dist/Components/Inputs/Calendar.d.ts +69 -0
  41. package/dist/Components/Inputs/Calendar.js +258 -0
  42. package/dist/Components/Inputs/CheckBox.d.ts +53 -0
  43. package/dist/Components/Inputs/CheckBox.js +87 -0
  44. package/dist/Components/Inputs/CheckBoxGroup.d.ts +20 -0
  45. package/dist/Components/Inputs/CheckBoxGroup.js +80 -0
  46. package/dist/Components/Inputs/ChoiceField.d.ts +122 -0
  47. package/dist/Components/Inputs/ChoiceField.js +169 -0
  48. package/dist/Components/Inputs/DatePicker.d.ts +54 -0
  49. package/dist/Components/Inputs/DatePicker.js +246 -0
  50. package/dist/Components/Inputs/DateRangePicker.d.ts +62 -0
  51. package/dist/Components/Inputs/DateRangePicker.js +283 -0
  52. package/dist/Components/Inputs/DateTimePicker.d.ts +75 -0
  53. package/dist/Components/Inputs/DateTimePicker.js +400 -0
  54. package/dist/Components/Inputs/Dropdown.d.ts +117 -0
  55. package/dist/Components/Inputs/Dropdown.js +839 -0
  56. package/dist/Components/Inputs/DropdownParts.d.ts +84 -0
  57. package/dist/Components/Inputs/DropdownParts.js +102 -0
  58. package/dist/Components/Inputs/EditorShell.d.ts +45 -0
  59. package/dist/Components/Inputs/EditorShell.js +214 -0
  60. package/dist/Components/Inputs/Field.d.ts +53 -0
  61. package/dist/Components/Inputs/Field.js +16 -0
  62. package/dist/Components/Inputs/GroupForm.d.ts +20 -0
  63. package/dist/Components/Inputs/GroupForm.js +172 -0
  64. package/dist/Components/Inputs/InputField.d.ts +59 -0
  65. package/dist/Components/Inputs/InputField.js +169 -0
  66. package/dist/Components/Inputs/InputRenderer.d.ts +37 -0
  67. package/dist/Components/Inputs/InputRenderer.js +99 -0
  68. package/dist/Components/Inputs/MarkdownEditor.d.ts +67 -0
  69. package/dist/Components/Inputs/MarkdownEditor.js +289 -0
  70. package/dist/Components/Inputs/NumberBox.d.ts +53 -0
  71. package/dist/Components/Inputs/NumberBox.js +228 -0
  72. package/dist/Components/Inputs/RadioGroup.d.ts +20 -0
  73. package/dist/Components/Inputs/RadioGroup.js +43 -0
  74. package/dist/Components/Inputs/ReadOnlyNotice.d.ts +36 -0
  75. package/dist/Components/Inputs/ReadOnlyNotice.js +117 -0
  76. package/dist/Components/Inputs/RichTextEditor.d.ts +103 -0
  77. package/dist/Components/Inputs/RichTextEditor.js +1170 -0
  78. package/dist/Components/Inputs/RichTextParts.d.ts +63 -0
  79. package/dist/Components/Inputs/RichTextParts.js +157 -0
  80. package/dist/Components/Inputs/RowsInput.d.ts +115 -0
  81. package/dist/Components/Inputs/RowsInput.js +308 -0
  82. package/dist/Components/Inputs/Slider.d.ts +87 -0
  83. package/dist/Components/Inputs/Slider.js +216 -0
  84. package/dist/Components/Inputs/TabularForm.d.ts +27 -0
  85. package/dist/Components/Inputs/TabularForm.js +348 -0
  86. package/dist/Components/Inputs/TextArea.d.ts +43 -0
  87. package/dist/Components/Inputs/TextArea.js +31 -0
  88. package/dist/Components/Inputs/TextBox.d.ts +52 -0
  89. package/dist/Components/Inputs/TextBox.js +58 -0
  90. package/dist/Components/Inputs/TextField.d.ts +31 -0
  91. package/dist/Components/Inputs/TextField.js +35 -0
  92. package/dist/Components/Inputs/TimePanel.d.ts +34 -0
  93. package/dist/Components/Inputs/TimePanel.js +288 -0
  94. package/dist/Components/Inputs/TimePicker.d.ts +54 -0
  95. package/dist/Components/Inputs/TimePicker.js +240 -0
  96. package/dist/Components/Inputs/TreeView.d.ts +160 -0
  97. package/dist/Components/Inputs/TreeView.js +947 -0
  98. package/dist/Components/Layouts/MessageBox.d.ts +71 -0
  99. package/dist/Components/Layouts/MessageBox.js +104 -0
  100. package/dist/Components/Layouts/Popup.d.ts +92 -0
  101. package/dist/Components/Layouts/Popup.js +376 -0
  102. package/dist/Components/Layouts/PopupContext.d.ts +2 -0
  103. package/dist/Components/Layouts/PopupContext.js +4 -0
  104. package/dist/Components/Layouts/PopupDock.d.ts +22 -0
  105. package/dist/Components/Layouts/PopupDock.js +121 -0
  106. package/dist/Components/Layouts/PopupHost.d.ts +56 -0
  107. package/dist/Components/Layouts/PopupHost.js +163 -0
  108. package/dist/Components/Layouts/PopupRules.d.ts +30 -0
  109. package/dist/Components/Layouts/PopupRules.js +63 -0
  110. package/dist/Components/Layouts/ThemePicker.d.ts +13 -0
  111. package/dist/Components/Layouts/ThemePicker.js +22 -0
  112. package/dist/Components/Layouts/ThemeScript.d.ts +14 -0
  113. package/dist/Components/Layouts/ThemeScript.js +13 -0
  114. package/dist/Components/Layouts/ThemeSwitcher.d.ts +13 -0
  115. package/dist/Components/Layouts/ThemeSwitcher.js +49 -0
  116. package/dist/Components/Layouts/Toaster.d.ts +76 -0
  117. package/dist/Components/Layouts/Toaster.js +172 -0
  118. package/dist/Components/Viewers/DataTable.d.ts +25 -0
  119. package/dist/Components/Viewers/DataTable.js +596 -0
  120. package/dist/Components/Viewers/DataTableColumns.d.ts +28 -0
  121. package/dist/Components/Viewers/DataTableColumns.js +243 -0
  122. package/dist/Components/Viewers/DataTableParts.d.ts +138 -0
  123. package/dist/Components/Viewers/DataTableParts.js +157 -0
  124. package/dist/Components/Viewers/MarkdownView.d.ts +26 -0
  125. package/dist/Components/Viewers/MarkdownView.js +79 -0
  126. package/dist/Components/Viewers/RichTextView.d.ts +18 -0
  127. package/dist/Components/Viewers/RichTextView.js +17 -0
  128. package/dist/Helpers/AnimationHelpers.d.ts +6 -0
  129. package/dist/Helpers/AnimationHelpers.js +35 -0
  130. package/dist/Helpers/ApiClient.d.ts +96 -0
  131. package/dist/Helpers/ApiClient.js +200 -0
  132. package/dist/Helpers/ApiFormHelpers.d.ts +49 -0
  133. package/dist/Helpers/ApiFormHelpers.js +120 -0
  134. package/dist/Helpers/ApiModules.d.ts +131 -0
  135. package/dist/Helpers/ApiModules.js +195 -0
  136. package/dist/Helpers/ApiResponses.d.ts +51 -0
  137. package/dist/Helpers/ApiResponses.js +250 -0
  138. package/dist/Helpers/ApiRoutes.d.ts +140 -0
  139. package/dist/Helpers/ApiRoutes.js +183 -0
  140. package/dist/Helpers/ApiToasts.d.ts +21 -0
  141. package/dist/Helpers/ApiToasts.js +22 -0
  142. package/dist/Helpers/ChatBackend.d.ts +134 -0
  143. package/dist/Helpers/ChatBackend.js +332 -0
  144. package/dist/Helpers/ChatHelpers.d.ts +189 -0
  145. package/dist/Helpers/ChatHelpers.js +486 -0
  146. package/dist/Helpers/ChatHooks.d.ts +81 -0
  147. package/dist/Helpers/ChatHooks.js +175 -0
  148. package/dist/Helpers/ChatStore.d.ts +132 -0
  149. package/dist/Helpers/ChatStore.js +394 -0
  150. package/dist/Helpers/ChatSummaries.d.ts +39 -0
  151. package/dist/Helpers/ChatSummaries.js +118 -0
  152. package/dist/Helpers/ClassHelpers.d.ts +3 -0
  153. package/dist/Helpers/ClassHelpers.js +4 -0
  154. package/dist/Helpers/CrudBackend.d.ts +98 -0
  155. package/dist/Helpers/CrudBackend.js +214 -0
  156. package/dist/Helpers/CrudHelpers.d.ts +111 -0
  157. package/dist/Helpers/CrudHelpers.js +267 -0
  158. package/dist/Helpers/DateHelpers.d.ts +88 -0
  159. package/dist/Helpers/DateHelpers.js +363 -0
  160. package/dist/Helpers/DatePreferences.d.ts +14 -0
  161. package/dist/Helpers/DatePreferences.js +94 -0
  162. package/dist/Helpers/DateTimeHelpers.d.ts +87 -0
  163. package/dist/Helpers/DateTimeHelpers.js +286 -0
  164. package/dist/Helpers/DragHelpers.d.ts +129 -0
  165. package/dist/Helpers/DragHelpers.js +281 -0
  166. package/dist/Helpers/DropdownHelpers.d.ts +56 -0
  167. package/dist/Helpers/DropdownHelpers.js +180 -0
  168. package/dist/Helpers/ExcelBackend.d.ts +106 -0
  169. package/dist/Helpers/ExcelBackend.js +290 -0
  170. package/dist/Helpers/ExcelHelpers.d.ts +98 -0
  171. package/dist/Helpers/ExcelHelpers.js +302 -0
  172. package/dist/Helpers/FormDrafts.d.ts +18 -0
  173. package/dist/Helpers/FormDrafts.js +76 -0
  174. package/dist/Helpers/FormStore.d.ts +233 -0
  175. package/dist/Helpers/FormStore.js +752 -0
  176. package/dist/Helpers/InputParamsHelpers.d.ts +79 -0
  177. package/dist/Helpers/InputParamsHelpers.js +388 -0
  178. package/dist/Helpers/MarkdownEditing.d.ts +27 -0
  179. package/dist/Helpers/MarkdownEditing.js +250 -0
  180. package/dist/Helpers/MarkdownHelpers.d.ts +82 -0
  181. package/dist/Helpers/MarkdownHelpers.js +775 -0
  182. package/dist/Helpers/MessageBuilder.d.ts +74 -0
  183. package/dist/Helpers/MessageBuilder.js +252 -0
  184. package/dist/Helpers/NepaliCalendar.d.ts +25 -0
  185. package/dist/Helpers/NepaliCalendar.js +107 -0
  186. package/dist/Helpers/NumberHelpers.d.ts +71 -0
  187. package/dist/Helpers/NumberHelpers.js +202 -0
  188. package/dist/Helpers/Permissions.d.ts +62 -0
  189. package/dist/Helpers/Permissions.js +133 -0
  190. package/dist/Helpers/PopoverHelpers.d.ts +68 -0
  191. package/dist/Helpers/PopoverHelpers.js +195 -0
  192. package/dist/Helpers/RichTextHelpers.d.ts +77 -0
  193. package/dist/Helpers/RichTextHelpers.js +1072 -0
  194. package/dist/Helpers/RowsStore.d.ts +166 -0
  195. package/dist/Helpers/RowsStore.js +606 -0
  196. package/dist/Helpers/TableColumns.d.ts +47 -0
  197. package/dist/Helpers/TableColumns.js +282 -0
  198. package/dist/Helpers/TableExport.d.ts +30 -0
  199. package/dist/Helpers/TableExport.js +97 -0
  200. package/dist/Helpers/TableHelpers.d.ts +110 -0
  201. package/dist/Helpers/TableHelpers.js +301 -0
  202. package/dist/Helpers/TableStore.d.ts +142 -0
  203. package/dist/Helpers/TableStore.js +530 -0
  204. package/dist/Helpers/ThemeHelpers.d.ts +15 -0
  205. package/dist/Helpers/ThemeHelpers.js +16 -0
  206. package/dist/Helpers/TimeHelpers.d.ts +73 -0
  207. package/dist/Helpers/TimeHelpers.js +253 -0
  208. package/dist/Helpers/TreeStore.d.ts +188 -0
  209. package/dist/Helpers/TreeStore.js +577 -0
  210. package/dist/Helpers/ValidationHelpers.d.ts +124 -0
  211. package/dist/Helpers/ValidationHelpers.js +301 -0
  212. package/dist/Interfaces/ApiInterfaces.d.ts +174 -0
  213. package/dist/Interfaces/ApiInterfaces.js +30 -0
  214. package/dist/Interfaces/ChatInterfaces.d.ts +240 -0
  215. package/{src/sso-client.tsx → dist/Interfaces/ChatInterfaces.js} +1 -1
  216. package/dist/Interfaces/CrudInterfaces.d.ts +232 -0
  217. package/dist/Interfaces/CrudInterfaces.js +1 -0
  218. package/dist/Interfaces/DateInterfaces.d.ts +154 -0
  219. package/dist/Interfaces/DateInterfaces.js +29 -0
  220. package/dist/Interfaces/ExcelInterfaces.d.ts +215 -0
  221. package/dist/Interfaces/ExcelInterfaces.js +45 -0
  222. package/dist/Interfaces/FormInterfaces.d.ts +402 -0
  223. package/dist/Interfaces/FormInterfaces.js +1 -0
  224. package/dist/Interfaces/InputInterfaces.d.ts +141 -0
  225. package/dist/Interfaces/InputInterfaces.js +1 -0
  226. package/dist/Interfaces/MessageInterfaces.d.ts +111 -0
  227. package/dist/Interfaces/MessageInterfaces.js +5 -0
  228. package/dist/Interfaces/TableInterfaces.d.ts +351 -0
  229. package/dist/Interfaces/TableInterfaces.js +1 -0
  230. package/dist/Interfaces/ThemeInterfaces.d.ts +17 -0
  231. package/dist/Interfaces/ThemeInterfaces.js +17 -0
  232. package/dist/Interfaces/TypeInterfaces.d.ts +4 -0
  233. package/dist/Interfaces/TypeInterfaces.js +1 -0
  234. package/dist/Server.Index.d.ts +2 -0
  235. package/dist/Server.Index.js +5 -0
  236. package/dist/Services/ApiProxy.d.ts +32 -0
  237. package/dist/Services/ApiProxy.js +111 -0
  238. package/dist/Services/BrowserApi.d.ts +95 -0
  239. package/dist/Services/BrowserApi.js +129 -0
  240. package/dist/Services/ChatApi.d.ts +37 -0
  241. package/dist/Services/ChatApi.js +98 -0
  242. package/dist/Services/ExcelApi.d.ts +46 -0
  243. package/dist/Services/ExcelApi.js +196 -0
  244. package/dist/Services/ServerApi.d.ts +54 -0
  245. package/dist/Services/ServerApi.js +78 -0
  246. package/dist/Services/ThemeService.d.ts +17 -0
  247. package/dist/Services/ThemeService.js +83 -0
  248. package/dist/Shared.Index.d.ts +51 -0
  249. package/dist/Shared.Index.js +55 -0
  250. package/package.json +85 -33
  251. package/src/Styles/Nexus.Base.css +70 -0
  252. package/src/Styles/Nexus.Button.css +153 -0
  253. package/src/Styles/Nexus.Calendar.css +275 -0
  254. package/src/Styles/Nexus.Chat.css +1489 -0
  255. package/src/Styles/Nexus.Choice.css +345 -0
  256. package/src/Styles/Nexus.Crud.css +161 -0
  257. package/src/Styles/Nexus.DateTime.css +81 -0
  258. package/src/Styles/Nexus.Dropdown.css +774 -0
  259. package/src/Styles/Nexus.Editor.css +297 -0
  260. package/src/Styles/Nexus.Excel.css +370 -0
  261. package/src/Styles/Nexus.Form.css +321 -0
  262. package/src/Styles/Nexus.Index.css +36 -0
  263. package/src/Styles/Nexus.Input.css +637 -0
  264. package/src/Styles/Nexus.Markdown.css +265 -0
  265. package/src/Styles/Nexus.Menu.css +259 -0
  266. package/src/Styles/Nexus.Popup.css +731 -0
  267. package/src/Styles/Nexus.RichText.css +463 -0
  268. package/src/Styles/Nexus.Rows.css +596 -0
  269. package/src/Styles/Nexus.Slider.css +278 -0
  270. package/src/Styles/Nexus.Tab.Buttons.css +419 -0
  271. package/src/Styles/Nexus.Table.css +1296 -0
  272. package/src/Styles/Nexus.Theme.Picker.css +232 -0
  273. package/src/Styles/Nexus.Themes.css +194 -0
  274. package/src/Styles/Nexus.Time.css +147 -0
  275. package/src/Styles/Nexus.Toast.css +265 -0
  276. package/src/Styles/Nexus.Tokens.css +72 -0
  277. package/src/Styles/Nexus.Tree.css +435 -0
  278. package/src/api-services/authentication-service.tsx +0 -23
  279. package/src/api-services/preference-service.tsx +0 -5
  280. package/src/api-services/system-service.tsx +0 -29
  281. package/src/client.ts +0 -31
  282. package/src/components/documents/button.tsx +0 -133
  283. package/src/components/documents/icon-box.tsx +0 -93
  284. package/src/components/documents/page-title.tsx +0 -7
  285. package/src/components/documents/tab-button.tsx +0 -172
  286. package/src/components/documents/tag.tsx +0 -30
  287. package/src/components/index.js +0 -0
  288. package/src/components/inputs/checkbox-input.tsx +0 -66
  289. package/src/components/inputs/input-box.tsx +0 -48
  290. package/src/components/inputs/input-element.tsx +0 -65
  291. package/src/components/inputs/input-form.tsx +0 -164
  292. package/src/components/inputs/input.tsx +0 -181
  293. package/src/components/inputs/number-input.tsx +0 -108
  294. package/src/components/inputs/radiobox-input.tsx +0 -53
  295. package/src/components/inputs/textarea-input.tsx +0 -47
  296. package/src/components/inputs/textbox-input.tsx +0 -45
  297. package/src/components/layouts/global-dialogbox.tsx +0 -431
  298. package/src/components/layouts/global-layout.tsx +0 -64
  299. package/src/components/layouts/layout-helpers.tsx +0 -20
  300. package/src/components/layouts/panels/user-panel.tsx +0 -112
  301. package/src/components/layouts/utility-menu.tsx +0 -49
  302. package/src/components/panels/theme-panel.tsx +0 -46
  303. package/src/helpers/bitwise-helpers.tsx +0 -11
  304. package/src/helpers/browser-helpers.tsx +0 -156
  305. package/src/helpers/datasource-helpers.tsx +0 -99
  306. package/src/helpers/element-helpers.tsx +0 -123
  307. package/src/helpers/input-helpers.tsx +0 -74
  308. package/src/helpers/string-helpers.tsx +0 -28
  309. package/src/helpers/utility-helpers.tsx +0 -45
  310. package/src/helpers/validation-helpers.tsx +0 -302
  311. package/src/index.ts +0 -26
  312. package/src/interface.ts +0 -19
  313. package/src/interfaces/auth-token-interfaces.tsx +0 -6
  314. package/src/interfaces/browser-interfaces.tsx +0 -36
  315. package/src/interfaces/button-interfaces.tsx +0 -63
  316. package/src/interfaces/datasource-interfaces.tsx +0 -22
  317. package/src/interfaces/datatable-interfaces.tsx +0 -25
  318. package/src/interfaces/dialogbox-interfaces.tsx +0 -5
  319. package/src/interfaces/exception-interfaces.tsx +0 -99
  320. package/src/interfaces/http-interfaces.tsx +0 -129
  321. package/src/interfaces/icon-interfaces.tsx +0 -129
  322. package/src/interfaces/input-interfaces.tsx +0 -410
  323. package/src/interfaces/layout-interfaces.tsx +0 -191
  324. package/src/interfaces/menu-interfaces.tsx +0 -53
  325. package/src/interfaces/message-interfaces.tsx +0 -32
  326. package/src/interfaces/permission-interfaces.tsx +0 -9
  327. package/src/interfaces/storage-interfaces.tsx +0 -5
  328. package/src/interfaces/system-interfaces.tsx +0 -22
  329. package/src/interfaces/theme-interfaces.tsx +0 -123
  330. package/src/interfaces/type-interfaces.tsx +0 -28
  331. package/src/interfaces/user-interfaces.tsx +0 -47
  332. package/src/nexus-client.tsx +0 -21
  333. package/src/nexus.environments.tsx +0 -66
  334. package/src/proxy-api/proxy-backend.tsx +0 -60
  335. package/src/proxy-api/proxy-constants.tsx +0 -28
  336. package/src/proxy-api/proxy-helpers.tsx +0 -91
  337. package/src/proxy-api-client.tsx +0 -1
  338. package/src/proxy-api-server.tsx +0 -2
  339. package/src/services/http-client-services.tsx +0 -75
  340. package/src/services/http-services.tsx +0 -158
  341. package/src/services/loader-service.tsx +0 -185
  342. package/src/services/localstorage-service.tsx +0 -119
  343. package/src/services/message-services.tsx +0 -383
  344. package/src/services/theme-service.tsx +0 -163
  345. package/src/services/user-services.tsx +0 -10
  346. package/src/sso-config/auth-token-validation.ts +0 -16
  347. package/src/sso-config/callback-route.tsx +0 -35
  348. package/src/sso-config/cookie-encryption.ts +0 -51
  349. package/src/sso-config/cookie-helpers.tsx +0 -102
  350. package/src/sso-config/forgot-password-route.tsx +0 -36
  351. package/src/sso-config/oauth-callback-state.ts +0 -61
  352. package/src/sso-config/pkce-helpers.ts +0 -9
  353. package/src/sso-config/provider-complete-route.tsx +0 -18
  354. package/src/sso-config/redirect-context-actions.tsx +0 -45
  355. package/src/sso-config/redirect-context-helpers.tsx +0 -159
  356. package/src/sso-config/redirect-context-persist.tsx +0 -18
  357. package/src/sso-config/redirect-context-route.tsx +0 -45
  358. package/src/sso-config/refresh-route.tsx +0 -23
  359. package/src/sso-config/sign-in-route.tsx +0 -74
  360. package/src/sso-config/sign-out-route.tsx +0 -57
  361. package/src/sso-config/sign-up-route.tsx +0 -57
  362. package/src/sso-config/sso-backend-flow.ts +0 -38
  363. package/src/sso-config/sso-complete-route.tsx +0 -50
  364. package/src/sso-config/sso-config.ts +0 -59
  365. package/src/sso-config/sso-interfaces.tsx +0 -99
  366. package/src/sso-config/sso-response-helpers.tsx +0 -20
  367. package/src/sso-server.tsx +0 -21
  368. package/src/styles/nexus.animation.css +0 -269
  369. package/src/styles/nexus.core.css +0 -119
  370. package/src/styles/nexus.dialog.css +0 -144
  371. package/src/styles/nexus.grid-view.css +0 -42
  372. package/src/styles/nexus.icon.css +0 -51
  373. package/src/styles/nexus.input.css +0 -207
  374. package/src/styles/nexus.loader.css +0 -11
  375. package/src/styles/nexus.logic.css +0 -47
  376. package/src/styles/nexus.utility.css +0 -347
@@ -1,93 +0,0 @@
1
- import React, { JSX } from "react";
2
- import { SetElementStyles } from "../../helpers/element-helpers";
3
- import { DEFAULT_ICON_ELEMENT_NAME, EIcons, EIconTypes } from "../../interfaces/icon-interfaces";
4
- import { EBadgeTypes, EOpacity, ESizes } from "../../interfaces/layout-interfaces";
5
- import { EBackgrounds } from "../../interfaces/theme-interfaces";
6
- import { ClickHandler, UN } from "../../interfaces/type-interfaces";
7
- import { NEXUS_CONFIG } from "../../nexus.environments";
8
-
9
- interface IIconBoxProps {
10
- icon: EIcons;
11
- children?: React.ReactNode | UN;
12
- id?: string | UN;
13
- iconType?: EIconTypes | UN;
14
- iconSize?: ESizes | UN;
15
- boxSize?: ESizes | UN;
16
- background?: EBackgrounds | UN;
17
- defaultClass?: string | UN;
18
- iconDefaultClass?: string | UN;
19
- badgeType?: EBadgeTypes | UN;
20
- badgeCount?: number | UN;
21
- iconOpacity?: EOpacity;
22
- title?: string | UN;
23
- dataKeys?: { key: string; val: string }[] | UN;
24
- makeRound?: boolean | UN;
25
- boxStyle?: React.CSSProperties | UN;
26
- onClicked?: ClickHandler | UN;
27
- onMouseEnter?: ClickHandler | UN;
28
- disabledHoverEffect?: boolean | UN;
29
- }
30
- interface IIconProps {
31
- icon: EIcons;
32
- type?: EIconTypes | UN;
33
- size?: ESizes | UN;
34
- defaultClass?: string | UN;
35
- opacity?: EOpacity | UN;
36
- style?: React.CSSProperties | UN;
37
- }
38
-
39
- const _getIconClass = (size?: ESizes | UN, defaultClass?: string | UN, opacity?: EOpacity | UN) => `icon ${size ?? ESizes.Normal} ${defaultClass ?? ""} ${opacity ?? EOpacity.O08}`;
40
-
41
- export const Icon = ({ icon, type, size, style, defaultClass, opacity }: IIconProps): JSX.Element => {
42
- const c = _getIconClass(size, defaultClass, opacity ?? EOpacity.O06);
43
- return React.createElement(DEFAULT_ICON_ELEMENT_NAME, {
44
- name: `${icon ?? EIcons.HOME}${type ?? EIconTypes.OUTLINED}`,
45
- style: style ?? undefined,
46
- className: c,
47
- });
48
- };
49
- export const CreateIcon = (icon: EIcons, parent?: HTMLElement | UN, type?: EIconTypes | UN, size?: ESizes | UN, defaultClass?: string | UN, opacity?: EOpacity | UN, style?: React.CSSProperties | UN) => {
50
- const iconElement = document.createElement(DEFAULT_ICON_ELEMENT_NAME);
51
- (iconElement as any).name = `${icon ?? EIcons.HOME}${type ?? EIconTypes.OUTLINED}` as string;
52
- SetElementStyles(iconElement, style);
53
- (iconElement as any).className = _getIconClass(size, defaultClass, opacity) as string;
54
- if (parent) parent.appendChild(iconElement);
55
- return iconElement;
56
- };
57
-
58
- const _getBoxClass = (background?: EBackgrounds | UN, makeRound?: boolean | UN, defaultClass?: string | UN, boxSize?: ESizes | UN, isNeedHover?: boolean | UN) => `ib ${background} ${makeRound !== false ? "r" : ""} r item ${defaultClass ?? ""} ${boxSize ?? ESizes.Normal} ${isNeedHover ? "h" : ""}`;
59
-
60
- export const Iconbox = ({ children, id, icon, iconType, iconSize, boxSize, background, defaultClass, iconDefaultClass, badgeType, badgeCount, iconOpacity, title, dataKeys, makeRound, boxStyle, onClicked, onMouseEnter, disabledHoverEffect }: Readonly<IIconBoxProps>): JSX.Element => {
61
- background = background ?? EBackgrounds.Background1;
62
- const isNeedHover = disabledHoverEffect !== false;
63
- const c = _getBoxClass(background, makeRound, defaultClass, boxSize, isNeedHover);
64
- const dataAttributes = (dataKeys ?? []).reduce((acc, { key, val }) => {
65
- (acc as any)[`data-${key}`] = val;
66
- return acc;
67
- }, {});
68
-
69
- return (
70
- <div {...dataAttributes} id={id ?? undefined} style={boxStyle ?? undefined} className={c} onClick={onClicked ?? undefined} onMouseEnter={onMouseEnter ?? undefined}>
71
- {title && <span className="title nw">{title}</span>}
72
- <Icon icon={icon} opacity={iconOpacity} type={iconType} size={iconSize} defaultClass={iconDefaultClass} />
73
- {children}
74
- </div>
75
- );
76
- };
77
- export const CreateIconBox = (icon: EIcons, parent?: HTMLElement | UN, children?: HTMLElement | UN, id?: string | UN, iconType?: EIconTypes | UN, background?: EBackgrounds | UN, boxSize?: ESizes | UN, iconSize?: ESizes | UN, defaultClass?: string | UN, iconDefaultClass?: string | UN, badgeType?: EBadgeTypes | UN, badgeCount?: number | UN, iconOpacity?: EOpacity | UN, title?: string | UN, dataKeys?: { key: string; val: string }[] | UN, makeRound?: boolean | UN, boxStyle?: React.CSSProperties | UN, onClicked?: ClickHandler | UN, onMouseEnter?: ClickHandler | UN, disabledHoverEffect?: boolean | UN): HTMLElement => {
78
- background = background ?? EBackgrounds.Background1;
79
- const isNeedHover = disabledHoverEffect !== false;
80
- const iconBox = document.createElement("div");
81
- iconBox.className = _getBoxClass(background, makeRound, defaultClass, boxSize, isNeedHover);
82
- SetElementStyles(iconBox, boxStyle);
83
-
84
- if (onClicked) iconBox.onclick = onClicked;
85
- if (onMouseEnter) iconBox.onmouseenter = onMouseEnter;
86
- if (parent) parent.appendChild(iconBox);
87
-
88
- CreateIcon(icon, iconBox, iconType, iconSize, iconDefaultClass, iconOpacity);
89
- if (children) iconBox.appendChild(children as HTMLElement);
90
- return iconBox;
91
- };
92
-
93
- export const CreateToggleButton = (parentElement?: HTMLElement | null, children?: HTMLElement | UN, id?: string | UN, boxSize?: ESizes | null, iconSize?: ESizes | null, opacity?: EOpacity | UN, iconType?: EIconTypes | null, boxBackground?: EBackgrounds) => CreateIconBox(EIcons.ELLIPSIS_HORIZONTAL, parentElement, children, id, iconType, boxBackground, boxSize, iconSize, `h ${boxBackground ?? NEXUS_CONFIG.DEFAULT_BACKGROUND} ml5`, "r90");
@@ -1,7 +0,0 @@
1
- import React from "react";
2
-
3
- export const GLOBAL_PAGE_TITLE_CLASS = (defaultClass?: string, borderBottom?: number, marginBottom?: number, paddingBottom?: number) => `fs-12 o09 fw600 ${defaultClass ?? ""} bb${borderBottom ?? 0} mb${marginBottom ?? 0} pb${paddingBottom ?? 0}`;
4
-
5
- export const PageTitle = ({ title, defaultClass, borderBottom, marginBottom }: { title: string; defaultClass?: string; borderBottom?: number; marginBottom?: number }) => {
6
- return <h6 className={GLOBAL_PAGE_TITLE_CLASS(defaultClass, borderBottom, marginBottom, borderBottom ? 2 : 0)}>{title}</h6>;
7
- };
@@ -1,172 +0,0 @@
1
- "use client";
2
-
3
- import React, { useEffect, useState } from "react";
4
- import { CreateClone, DynamicSorting, GetVisibleAndHiddenItems } from "../../helpers/datasource-helpers";
5
- import { RenderChildren } from "../../helpers/element-helpers";
6
- import { IButton } from "../../interfaces/button-interfaces";
7
- import { IDialogboxResults } from "../../interfaces/dialogbox-interfaces";
8
- import { DEFAULT_ICON_ELEMENT_NAME, EIcons, EIconTypes } from "../../interfaces/icon-interfaces";
9
- import { EPositions } from "../../interfaces/layout-interfaces";
10
- import { ClickHandler, UN } from "../../interfaces/type-interfaces";
11
- import { NEXUS_CONFIG } from "../../nexus.environments";
12
- import { GlobalDialogbox, InitializeDialogbox } from "./../layouts/global-dialogbox";
13
- import { Button, Buttons, CreateButton, CreateButtons, SET_BUTTON_ACTIVE_CLASS } from "./button";
14
- import { CreateToggleButton, Iconbox } from "./icon-box";
15
-
16
- export const THEME_MENU_ELIPSE_BTN_ID = "theme-menu-ellipse-btn";
17
-
18
- const GetMaxVisibleButtons = (parentWidth: number) => (parentWidth > 1400 ? 8 : parentWidth > 1200 ? 7 : parentWidth > 1000 ? 6 : parentWidth > 950 ? 5 : parentWidth > 750 ? 4 : parentWidth > 600 ? 3 : 2);
19
-
20
- export function CreateTabButtons<T>(buttons: IButton[], parent: HTMLElement | null, activeButton?: IButton | null, onClicked?: ClickHandler): HTMLElement | null {
21
- if (!buttons || buttons.length === 0) return null;
22
- const elementList: HTMLElement[] = [];
23
- const toggleButton = CreateToggleButton();
24
- const themeContainer = document.createElement("div");
25
- const visibleItems: IButton[] = [];
26
- const hiddenItems: IButton[] = [];
27
- const dataKey = "code";
28
- const dataAttributeKey = "data-menu-code";
29
- let dialogBoxObject: IDialogboxResults | null = null;
30
- let maxVisible = 6;
31
- let activeItem = activeButton ?? buttons[0];
32
- let linkButtons: HTMLElement | undefined = undefined;
33
-
34
- toggleButton.appendChild(themeContainer);
35
-
36
- const buttonContainer = document.createElement("div");
37
- buttonContainer.className = "df ac jc r";
38
- if (parent) parent.appendChild(buttonContainer);
39
-
40
- const onButtonClicked: ClickHandler = (event, element, button, index) => {
41
- if (button === activeItem) return;
42
- activeItem = button;
43
- if (onClicked) onClicked(event, element, button, index);
44
-
45
- const isHiddenItemClicked = hiddenItems.some((item) => item === button);
46
- GetVisibleAndHiddenItems(buttons, visibleItems, hiddenItems, activeItem, maxVisible);
47
- RenderChildren(buttonContainer, elementList, toggleButton, activeItem, visibleItems, hiddenItems, createButton, refreshElementClass, false, isHiddenItemClicked, dataKey, dataAttributeKey);
48
- };
49
- for (const button of buttons) button.onClick = (event, element, data, index) => onButtonClicked(event as Event, element, button);
50
-
51
- const createButton = (button: IButton) => {
52
- const btn = CreateButton(button, buttonContainer, null, false);
53
- if (button.id) {
54
- btn.setAttribute(dataAttributeKey, `btn-code-${button.id}`);
55
- btn.id = button.id;
56
- }
57
-
58
- btn.classList.add("jc");
59
- btn.style.height = "var(--IW)";
60
-
61
- refreshElementClass(btn, activeItem);
62
- return btn;
63
- };
64
-
65
- const refreshElementClass = (element: HTMLElement, activeItem: IButton | UN) => {
66
- const menuCode = element?.getAttribute(dataAttributeKey);
67
- const isActive = activeItem?.id && `btn-code-${activeItem?.id}` === menuCode;
68
- SET_BUTTON_ACTIVE_CLASS(isActive as boolean, element);
69
- const icon = element.querySelector(DEFAULT_ICON_ELEMENT_NAME);
70
- if (isActive) {
71
- element.classList.add("active");
72
- if (document.activeElement) (document.activeElement as HTMLElement).blur();
73
- if (icon) icon.setAttribute("name", activeItem.icon ?? "");
74
- } else {
75
- element.classList.remove("active");
76
- if (activeItem)
77
- if (icon) {
78
- let iconName = icon.getAttribute("name");
79
- if (iconName && !iconName.endsWith("-outline")) iconName += "-outline";
80
- icon.setAttribute("name", iconName ?? "");
81
- }
82
- }
83
- };
84
- const onVisibility = () => {
85
- if (linkButtons) linkButtons.remove();
86
- linkButtons = CreateButtons(hiddenItems, themeContainer, null, 6, 0);
87
- };
88
- const parentBound = parent?.getBoundingClientRect();
89
- const parentWidth = parentBound ? parentBound.width : 1000;
90
- maxVisible = GetMaxVisibleButtons(parentWidth);
91
- GetVisibleAndHiddenItems(buttons, visibleItems, hiddenItems, activeItem, maxVisible);
92
- RenderChildren(buttonContainer, elementList, toggleButton, activeItem, visibleItems, hiddenItems, createButton, refreshElementClass, true, false, dataKey, dataAttributeKey);
93
-
94
- if (hiddenItems.length > 0) {
95
- linkButtons = CreateButtons(hiddenItems, themeContainer, null, 6, 0);
96
- dialogBoxObject = InitializeDialogbox(toggleButton, themeContainer, true, undefined, undefined, 40, undefined, onVisibility, undefined, false, EPositions.Right, undefined, undefined, undefined, true);
97
- dialogBoxObject?.visibility(false, true);
98
- }
99
-
100
- return buttonContainer;
101
- }
102
- export const TabButtons = ({ buttons, activeButton, onClicked }: { buttons: IButton[]; activeButton?: string | null | Function; onClicked?: ClickHandler }) => {
103
- const [tabButtons, setTabButtons] = useState<ITab>({ visibleButtons: null, hiddenButtons: null });
104
- const [activeItem, setActiveItem] = useState<string | null>(null);
105
- const tabContainerRef = React.useRef<HTMLDivElement>(null);
106
-
107
- useEffect(() => {
108
- const timeout = setTimeout(() => {
109
- clearTimeout(timeout);
110
-
111
- const tabContainer = tabContainerRef.current;
112
- if (!tabContainer || !buttons || buttons.length === 0) return;
113
-
114
- const sortingButtons = DynamicSorting<IButton>(buttons, "displayOrder", true);
115
- const newButtons = CreateClone(sortingButtons) as IButton[];
116
- const parentBound = tabContainer.getBoundingClientRect();
117
- const parentWidth = parentBound.width;
118
- const maxVisible = GetMaxVisibleButtons(parentWidth);
119
- const visibleItems: IButton[] = [];
120
- const hiddenItems: IButton[] = [];
121
- const active = typeof activeButton === "function" ? (newButtons.find((btn) => btn.id === activeButton()) ?? newButtons[0]) : (newButtons.find((btn) => btn.id === (activeItem ?? activeButton)) ?? newButtons[0]);
122
- GetVisibleAndHiddenItems(newButtons, visibleItems, hiddenItems, active, maxVisible);
123
-
124
- for (const btn of visibleItems) {
125
- if (active && active.id && btn.id === active.id) {
126
- btn.iconType = EIconTypes.OUTLINED;
127
- btn.defaultClass = "btn active jc r";
128
- } else btn.defaultClass = `jc r ${NEXUS_CONFIG.DEFAULT_BACKGROUND}`;
129
- }
130
-
131
- for (const btn of hiddenItems) btn.defaultClass = NEXUS_CONFIG.DEFAULT_BACKGROUND;
132
-
133
- for (const btn of newButtons) {
134
- btn.onClick = (event, element, data, index) => {
135
- if (btn.id === activeItem) return;
136
- if (onClicked) onClicked(event, element, btn, index);
137
- setActiveItem(btn.id ?? null);
138
- };
139
- }
140
-
141
- setTabButtons({ visibleButtons: visibleItems, hiddenButtons: hiddenItems.length > 0 ? hiddenItems : null });
142
- }, 0);
143
- return () => clearTimeout(timeout);
144
- }, [buttons, activeItem, onClicked]);
145
-
146
- /* ---------------- render ---------------- */
147
- return (
148
- <div ref={tabContainerRef} className="df ac jc r">
149
- {tabButtons.visibleButtons?.map((btn) => (
150
- <Button
151
- styles={{
152
- height: "var(--IW)",
153
- }}
154
- key={btn.id}
155
- button={btn}
156
- />
157
- ))}
158
-
159
- {tabButtons.hiddenButtons && (
160
- <Iconbox defaultClass="ml5" icon={EIcons.ELLIPSIS_HORIZONTAL} iconType={EIconTypes.OUTLINED} iconDefaultClass="r90" id={THEME_MENU_ELIPSE_BTN_ID}>
161
- <GlobalDialogbox defaultPadding={0} iggnoreChildClick={false} buttonIdentity={THEME_MENU_ELIPSE_BTN_ID} position={EPositions.Right}>
162
- <Buttons buttons={tabButtons.hiddenButtons} />
163
- </GlobalDialogbox>
164
- </Iconbox>
165
- )}
166
- </div>
167
- );
168
- };
169
- interface ITab {
170
- visibleButtons: IButton[] | null;
171
- hiddenButtons: IButton[] | null;
172
- }
@@ -1,30 +0,0 @@
1
- import { CSSProperties } from "react";
2
- import { EBackgrounds, EOpacity, EUserRoles, UN } from "../../interface";
3
-
4
- export const GlobalTag = ({ value, background, isSmall, defaultClass, fontOpacity }: { value: string; background?: EBackgrounds; isSmall?: boolean; defaultClass?: string; fontOpacity?: EOpacity }) => {
5
- isSmall = isSmall ?? true;
6
- const style = { width: "fit-content" } as CSSProperties;
7
- if (isSmall) style.minHeight = "1.2rem";
8
- return (
9
- <small style={style} className={`pr3 pl3 r pr item nw ${fontOpacity ?? EOpacity.O08} ${isSmall ? "fs-07" : "p1"} ${defaultClass ?? ""} df ac jc ${background ?? EBackgrounds.ThemeColor600}`}>
10
- {value}
11
- </small>
12
- );
13
- };
14
- export function GetUserRoleTag(role: string | EUserRoles | UN, isShort?: boolean, defaultClass?: string): React.JSX.Element {
15
- const status = role?.toString();
16
-
17
- switch (status) {
18
- case "3":
19
- case "SuperAdmin":
20
- return <GlobalTag isSmall={true} value={isShort ? "SA" : "Super"} defaultClass={defaultClass} />;
21
- case "2":
22
- case "Admin":
23
- return <GlobalTag isSmall={true} value={isShort ? "A" : "Admin"} defaultClass={defaultClass} />;
24
- case "1":
25
- case "User":
26
- return <GlobalTag isSmall={true} value={isShort ? "U" : "User"} defaultClass={defaultClass} />;
27
- default:
28
- return <GlobalTag isSmall={true} value={isShort ? "G" : "Guest"} defaultClass={defaultClass} />;
29
- }
30
- }
File without changes
@@ -1,66 +0,0 @@
1
- import { GetInputId, SetHaveValueClass } from "../../helpers/input-helpers";
2
- import { EValueChangeTypes, ICheckbox, IInputCreateResults } from "../../interfaces/input-interfaces";
3
- import { CreateInput } from "./input";
4
- import { CreateInputBox, CreateInputWrapper } from "./input-box";
5
- import { CreateRadiobox } from "./radiobox-input";
6
-
7
- export const CreateCheckbox = (param: ICheckbox, parentElement: HTMLElement | null, isTabular: boolean) => {
8
- if (param.groupId) return CreateRadiobox(param, parentElement, isTabular, true);
9
-
10
- const input = CreateInput(param) as HTMLInputElement;
11
- const ELEMENT_ID = GetInputId(param);
12
-
13
- input.classList.add("pr");
14
- input.classList.remove("ipt");
15
- input.defaultChecked = param.defaultValue ?? false;
16
-
17
- const box = CreateInputBox(param, input, null, isTabular);
18
- const label = box.querySelector("label") as HTMLLabelElement;
19
- if (label) label.className = "p2 ilb hc o08";
20
- const wrapper = isTabular ? box : CreateInputWrapper(param, box, parentElement);
21
-
22
- box.classList.add("df", "ac", "pl3", "ipt-bxh");
23
- box.classList.remove("ipt-bx");
24
-
25
- function notifyChanged(val: boolean, isInit: boolean, isForced: boolean, isDisposed: boolean) {
26
- if (!param.checkedValue) param.onChanged?.(val, isInit, isForced, isDisposed, ELEMENT_ID, undefined);
27
- else param.onChanged?.(val ? param.checkedValue : null, isInit, isForced, isDisposed, ELEMENT_ID, undefined);
28
- }
29
-
30
- function handleChanged(val: boolean, isInit: boolean, isForced: boolean, isDisposed: boolean, type?: EValueChangeTypes, invokeOnChanged?: boolean) {
31
- SetHaveValueClass(input, val);
32
- if (invokeOnChanged === false) return;
33
- // Group members share one form key; only the checked member should report on init.
34
- if (isInit && param.groupId && !val) return;
35
- notifyChanged(val, isInit, isForced, isDisposed);
36
- }
37
-
38
- function forceChangeDefaultValue(defaultValue: boolean, type?: EValueChangeTypes, invokeOnChanged?: boolean): boolean {
39
- input.checked = defaultValue;
40
- handleChanged(defaultValue, false, true, false, type, invokeOnChanged);
41
- return true;
42
- }
43
-
44
- function onInputChanged() {
45
- handleChanged(input.checked, false, false, false);
46
- }
47
-
48
- input.addEventListener("input", onInputChanged);
49
-
50
- input.checked = param.defaultValue ?? false;
51
- handleChanged(input.checked, true, false, false);
52
-
53
- return {
54
- input: param,
55
- inputElement: input,
56
- rootElement: wrapper,
57
- forceChangeDefaultValue: forceChangeDefaultValue,
58
- dispose: function (invokeOnChanged?: boolean) {
59
- if (invokeOnChanged !== false) handleChanged(param.defaultValue ?? false, false, true, true);
60
- input.removeEventListener("input", onInputChanged);
61
- input.remove();
62
- box.remove();
63
- wrapper.remove();
64
- },
65
- } as IInputCreateResults;
66
- };
@@ -1,48 +0,0 @@
1
- import { INPUT_ICON_BOX_CLASS } from "../../helpers/input-helpers";
2
- import { DEFAULT_INPUT_BORDER_SIZE, IInputRootParameters, REQUIRED_TEXT1 } from "../../interfaces/input-interfaces";
3
- import { EBackgrounds } from "../../interfaces/theme-interfaces";
4
- import { NEXUS_CONFIG } from "../../nexus.environments";
5
- import { CreateIconBox } from "../documents/icon-box";
6
-
7
- export const CreateInputBox = (param: IInputRootParameters<any>, child: HTMLElement | null, parent: HTMLElement | null, isTabular: boolean) => {
8
- const bg = param.background ?? NEXUS_CONFIG.DEFAULT_BACKGROUND;
9
-
10
- const BORDER_SIZE = param.borderSize ?? DEFAULT_INPUT_BORDER_SIZE;
11
-
12
- const border = BORDER_SIZE > 0 ? `b${BORDER_SIZE}` : "bat1";
13
- const box = document.createElement("div");
14
- box.className = `ipt-bx ${param.inputSize ?? ""} db bb anim ${border} pr r ${bg}`;
15
- if (child) box.appendChild(child);
16
-
17
- if (param.label && !isTabular) {
18
- const label = document.createElement("label");
19
- label.className = "pa t50 ty50 left ilb en anim ml2";
20
- label.innerHTML = param.label + ((param as any).isRequired ? `<span style="color: var(--B13)" class="fs-08 ml1">${REQUIRED_TEXT1}</span>` : "");
21
- label.htmlFor = param.id;
22
- box.appendChild(label);
23
- }
24
-
25
- if (param.icon) {
26
- box.classList.add("df", "ac");
27
- const I = param.icon;
28
- const iconBox = CreateIconBox(I.icon, box, null, null, I.type, I.background ?? param.background ?? EBackgrounds.None, I.boxSize, I.iconSize, null, null, null, null, I.opacity, null, null, null, null, I.onClicked, I.onMouseEnter, (I.onClicked || I.onMouseEnter) !== undefined);
29
- iconBox.classList.add(INPUT_ICON_BOX_CLASS);
30
- }
31
-
32
- if (parent) parent.appendChild(box);
33
- return box;
34
- };
35
- export const CreateInputWrapper = (param: IInputRootParameters<any>, child: HTMLElement | null, parent: HTMLElement | null) => {
36
- const col = document.createElement("div");
37
- const wp = document.createElement("div");
38
- const smb = document.createElement("div");
39
- col.className = !param.columnSize || param.columnSize === 12 ? "col-12" : `col-${param.columnSize}`;
40
- if (param.autoAdjustColumn !== false) col.classList.add("col-sm-12");
41
- wp.className = "ipt-wp";
42
- smb.className = "smb";
43
- if (child) wp.appendChild(child);
44
- wp.appendChild(smb);
45
- col.appendChild(wp);
46
- if (parent) parent.appendChild(col);
47
- return wp;
48
- };
@@ -1,65 +0,0 @@
1
- import { GetInputId } from "../../helpers/input-helpers";
2
- import { EButtonTypes } from "../../interfaces/button-interfaces";
3
- import { EIconTypes } from "../../interfaces/icon-interfaces";
4
- import { IElement, IInputCreateResults, ILinkbutton, ISubmitbutton } from "../../interfaces/input-interfaces";
5
- import { EBackgrounds } from "../../interfaces/theme-interfaces";
6
- import { CreateLinkButton } from "../documents/button";
7
- import { CreateIconBox } from "../documents/icon-box";
8
- import { CreateInputBox, CreateInputWrapper } from "./input-box";
9
-
10
- export const CreateElement = (param: IElement, parentElement: HTMLElement | null, isTabular: boolean): IInputCreateResults => {
11
- const ELEMENT_ID = GetInputId(param);
12
- const box = CreateInputBox(param, null, null, isTabular);
13
- const label = box.querySelector("label") as HTMLLabelElement;
14
- if (label) label.remove();
15
- const wrapper = isTabular ? box : CreateInputWrapper(param, box, parentElement);
16
-
17
- return {
18
- input: param,
19
- inputElement: box as HTMLInputElement,
20
- rootElement: wrapper,
21
- forceChangeDefaultValue: null,
22
- dispose: function (invokeOnChanged?: boolean) {
23
- if (invokeOnChanged !== false) param.onLoad?.(null, null, false, false, true, ELEMENT_ID, 0);
24
- box.remove();
25
- wrapper.remove();
26
- },
27
- } as IInputCreateResults;
28
- };
29
-
30
- export const CreateInputLink = (param: ILinkbutton, parentElement: HTMLElement | null, isTabular: boolean): IInputCreateResults => {
31
- const elementObject = CreateElement(param, parentElement, isTabular);
32
- const box = elementObject.inputElement as HTMLDivElement;
33
- box.classList.add("bat1", "df", "ac", "ipt-bxh");
34
- box.classList.remove("ipt-bx");
35
- const link = CreateLinkButton(box, param.href, param.label ?? "Nexus Link", param.onClicked, param.defaultClass, null, param.borderBottom, param.background, param.target, param.position);
36
-
37
- link.classList.add("w100");
38
-
39
- box.appendChild(link);
40
- return elementObject;
41
- };
42
- export const CreateInputButton = (param: ISubmitbutton, parentElement: HTMLElement | null, isTabular: boolean): IInputCreateResults => {
43
- const iconParam = param.icon;
44
- const button = document.createElement("button");
45
- param.icon = undefined;
46
- const elementObject = CreateElement(param, parentElement, isTabular);
47
- const box = elementObject.inputElement as HTMLDivElement;
48
- box.appendChild(button);
49
- box.classList.add("h");
50
- button.type = param.type ?? EButtonTypes.SUBMIT;
51
-
52
- button.classList.add("h", "df", "ac", "jc", "ipt", "h100", "sn", "w100", "r", param.background ?? EBackgrounds.PrimaryColor);
53
- const value = param.placeholder ?? param.label ?? "Submit";
54
-
55
- if (iconParam) {
56
- const span = document.createElement("span");
57
- span.textContent = value;
58
- span.classList.add("nw", "toh", "fs-10", "fw-600");
59
- const icon = CreateIconBox(iconParam.icon, button, null, null, iconParam.type ?? EIconTypes.OUTLINED, iconParam.background ?? param.background ?? EBackgrounds.None, iconParam.boxSize, iconParam.iconSize, null, null, null, null, iconParam.opacity, null, null, null, null, iconParam.onClicked, iconParam.onMouseEnter);
60
- icon.classList.add("mr3");
61
- button.appendChild(span);
62
- } else button.innerText = value;
63
-
64
- return elementObject;
65
- };
@@ -1,164 +0,0 @@
1
- "use client";
2
-
3
- import React, { useEffect } from "react";
4
- import { HideLoader, ShowLoader, SubmitApi, WarningMessage } from "../../client";
5
- import { GetInputId, SetResponseErrorMessage } from "../../helpers/input-helpers";
6
- import { IsValidInputs } from "../../helpers/validation-helpers";
7
- import { EActions, EAnimationClasses, EBackgrounds, EButtonTypes, EFlexPositions, EIcons, EIconTypes, ESizes, GetApiInformations, GetButton, UN, VoidCallbackHandler } from "../../interface";
8
- import { DEFAULT_ROW_GAP, EInputTypes, GetForms, IApiForm, IForm, IFormCreateResults, IInputCreateResults, ISubmitForm, ISubmitFormCreateResults, OnFormChangeHandler, OnFormSubmitHandler } from "../../interfaces/input-interfaces";
9
- import { GetFormButtonPosition } from "../../services/localstorage-service";
10
- import { CreateButton } from "../documents/button";
11
- import { CreateInputs, DisposeInputs } from "./input";
12
-
13
- const forceChangeDefaultValue = (inputResults: IInputCreateResults[], newDefaultValue: any): boolean => {
14
- let isChanged = true;
15
- for (const inputResult of inputResults) {
16
- if (inputResult.forceChangeDefaultValue) {
17
- const value = newDefaultValue ? (newDefaultValue[GetInputId(inputResult.input)] ?? null) : undefined;
18
- const success = inputResult.forceChangeDefaultValue(value);
19
- if (isChanged) isChanged = success;
20
- }
21
- }
22
- return isChanged;
23
- };
24
- export const CreateForm = (param: IForm, parentIdentifier: HTMLElement | string | UN, rowGap?: number, onFormRendered?: VoidCallbackHandler): IFormCreateResults | null => {
25
- const { inputs, onChanged, index, isTabularForm, defaultValue } = param;
26
- const parentElement = typeof parentIdentifier === "string" ? document.getElementById(parentIdentifier) : parentIdentifier;
27
-
28
- if (!parentElement || inputs.length === 0 || !onChanged) {
29
- //TODO: WarningMessage("Invalid Inputs", "Please provide valid inputs, onChanged function and parent element.");
30
- return null;
31
- }
32
- const rowElement = document.createElement("div");
33
- if (parentElement) parentElement.appendChild(rowElement);
34
-
35
- rowElement.className = `row g${rowGap ?? DEFAULT_ROW_GAP} sb fg`;
36
- rowElement.style.paddingTop = "var(--IEM)";
37
-
38
- const inputResults = CreateInputs(inputs, onChanged, index, isTabularForm, rowElement, defaultValue);
39
-
40
- onFormRendered?.(inputResults);
41
-
42
- return {
43
- inputResults: inputResults,
44
- formElement: rowElement,
45
- dispose: (invokeOnChanged?: boolean) => {
46
- DisposeInputs(inputResults, invokeOnChanged);
47
- rowElement.remove();
48
- },
49
- forceChangeDefaultValue: (newDefaultValue: any) => forceChangeDefaultValue(inputResults, newDefaultValue),
50
- } as IFormCreateResults;
51
- };
52
-
53
- export const Form = ({ param, parentIdentifier, rowGap, onFormRendered }: { param: IForm; parentIdentifier: HTMLElement | string | UN; rowGap?: number; onFormRendered?: VoidCallbackHandler }): React.ReactNode => {
54
- useEffect(() => {
55
- const formResults = CreateForm(param, parentIdentifier, rowGap, onFormRendered);
56
- return () => formResults?.dispose();
57
- }, [param, rowGap]);
58
- return <React.Fragment></React.Fragment>;
59
- };
60
-
61
- export const CreateSubmitForm = (param: ISubmitForm, parentIdentifier: HTMLElement | string | UN, rowGap?: number, buttonPosition?: EFlexPositions, formAction?: EActions | UN, onFormRendered?: VoidCallbackHandler): ISubmitFormCreateResults | null => {
62
- const parentElement = typeof parentIdentifier === "string" ? document.getElementById(parentIdentifier) : parentIdentifier;
63
- buttonPosition = buttonPosition ?? GetFormButtonPosition();
64
-
65
- if (!parentElement || !param.inputs || param.inputs.length === 0 || !param.onSubmit) return null;
66
-
67
- let formValue: any | UN;
68
- let defaultValue: any | UN = GetApiInformations.IS_API(param.defaultValue) ? null : param.defaultValue;
69
- const onChangedHandler: OnFormChangeHandler = (currentValue, isInitilizing, isForcedChanged, isDisposed, currentKey, index, type, dataSource) => {
70
- formValue = currentValue;
71
- if (param.onChanged) param.onChanged(currentValue, isInitilizing, isForcedChanged, isDisposed, currentKey, index, type, dataSource);
72
- };
73
- const onFormSubmit = async (event: Event) => {
74
- event.preventDefault();
75
- const isValidForm = IsValidInputs(formResults?.inputResults, formValue, true, true);
76
- const isValid = param.overrideValidation ? await param.overrideValidation(formValue, isValidForm, formResults, formAction) : isValidForm;
77
-
78
- param.onSubmit({ ...formValue }, isValidForm, event, formResults!, defaultValue);
79
- if (!isValid) WarningMessage("Invalid Inputs", "Please fill all required fields correctly.");
80
- };
81
- const formParameters = GetForms.FORM(param.inputs, onChangedHandler, defaultValue);
82
- const formElement = document.createElement("form");
83
- parentElement.appendChild(formElement);
84
- const formResults = CreateForm(formParameters, formElement, rowGap, onFormRendered);
85
- if (!formResults) return null;
86
- formResults.formElement.classList.add("h100", "fg");
87
-
88
- const submitButton = param.inputs.find((input) => input.inputType === EInputTypes.SubmitButton);
89
- if (!submitButton) {
90
- const buttonStyle: React.CSSProperties = {
91
- width: "fit-content",
92
- };
93
- const DEFAULT_BUTTON_CLASS = "col- jc r";
94
- rowGap = rowGap ?? DEFAULT_ROW_GAP;
95
- const PADDING = rowGap * 2;
96
-
97
- const buttonParam = GetButton("Submit", null, null, EIcons.SAVE, null, null, EBackgrounds.PrimaryColor, DEFAULT_BUTTON_CLASS, null, EIconTypes.OUTLINED, null, 0, null, EButtonTypes.SUBMIT);
98
- const buttonContainer = document.createElement("div");
99
- buttonContainer.className = `df ac pt1 pb5 ${buttonPosition} bb pr${PADDING} pl${PADDING}`;
100
- buttonContainer.style.minHeight = "calc(var(--IH) * 1.5)";
101
-
102
- formElement.appendChild(buttonContainer);
103
- CreateButton(buttonParam, buttonContainer, buttonStyle, false);
104
-
105
- if (param.onCancelClick) {
106
- const buttonParam = GetButton("Cancel", null, null, EIcons.CLOSE, param.onCancelClick, null, EBackgrounds.ErrorColor, DEFAULT_BUTTON_CLASS + ` ml${PADDING}`, null, EIconTypes.OUTLINED, null, 0, null, EButtonTypes.BUTTON);
107
- CreateButton(buttonParam, buttonContainer, buttonStyle, false);
108
- }
109
- }
110
-
111
- formElement.className = `df ddc w100 h100 oh fg pr`;
112
- formElement.addEventListener("submit", onFormSubmit);
113
-
114
- const onDispose = () => {
115
- formResults?.dispose();
116
- formElement.remove();
117
- };
118
-
119
- return {
120
- formElement: formElement,
121
- dispose: () => onDispose(),
122
- formObject: formResults,
123
- };
124
- };
125
-
126
- export const SubmitForm = ({ param, parentIdentifier, rowGap, buttonPosition, formAction, onFormRendered }: { param: ISubmitForm; parentIdentifier: HTMLElement | string | UN; rowGap?: number; buttonPosition?: EFlexPositions; formAction?: EActions | UN; onFormRendered?: VoidCallbackHandler }): React.ReactNode => {
127
- useEffect(() => {
128
- const submitForm = CreateSubmitForm(param, parentIdentifier, rowGap, buttonPosition, formAction, onFormRendered);
129
- return () => submitForm?.dispose();
130
- }, [param, parentIdentifier, rowGap, buttonPosition, formAction]);
131
- return <React.Fragment></React.Fragment>;
132
- };
133
-
134
- export const CreateApiForm = (param: IApiForm, parentIdentifier: HTMLElement | string | UN, rowGap?: number, buttonPosition?: EFlexPositions, formAction?: EActions | UN, overrideLoaderParend?: HTMLElement | string | UN, successMessage?: boolean | UN, errorMessage?: boolean | UN, onFormRendered?: VoidCallbackHandler): ISubmitFormCreateResults | null => {
135
- let isLoading = false;
136
- const onFormSubmit: OnFormSubmitHandler = async (currentValue, isValidForm, event, form, defaultValue) => {
137
- if (isLoading) return;
138
- isLoading = true;
139
-
140
- if (param.onSubmit) param.onSubmit(currentValue, isValidForm, event, form, defaultValue);
141
- if (!isValidForm) return;
142
-
143
- const loaderParent = overrideLoaderParend ?? submitForm?.formElement ?? parentIdentifier;
144
- ShowLoader(loaderParent, EAnimationClasses.SPIN, true, ESizes.Normal, null, null, null, "r");
145
- const apiResponse = await SubmitApi(param.api, currentValue, successMessage, errorMessage);
146
- if (!apiResponse.isSuccess) SetResponseErrorMessage(apiResponse, submitForm?.formObject.inputResults);
147
- HideLoader(loaderParent);
148
- param.onApiSubmit(currentValue, apiResponse, submitForm!, defaultValue);
149
- isLoading = false;
150
- };
151
- const submitFormParam = GetForms.SUBMITFORM(param?.inputs, onFormSubmit, param?.defaultValue, param?.overrideValidation, param?.onChanged, param?.onCancelClick);
152
- const submitForm = CreateSubmitForm(submitFormParam, parentIdentifier, rowGap, buttonPosition, formAction, onFormRendered);
153
- if (!submitForm) return null;
154
-
155
- return submitForm;
156
- };
157
-
158
- export const ApiForm = ({ param, parentIdentifier, rowGap, buttonPosition, formAction, overrideLoaderParend, successMessage, errorMessage, onFormRendered }: { param: IApiForm; parentIdentifier: HTMLElement | string | UN; rowGap?: number; buttonPosition?: EFlexPositions; formAction?: EActions | UN; overrideLoaderParend?: HTMLElement | string | UN; successMessage?: boolean | UN; errorMessage?: boolean | UN; onFormRendered?: VoidCallbackHandler }): React.ReactNode => {
159
- useEffect(() => {
160
- const apiForm = CreateApiForm(param, parentIdentifier, rowGap, buttonPosition, formAction, overrideLoaderParend, successMessage, errorMessage, onFormRendered);
161
- return () => apiForm?.dispose();
162
- }, [param, parentIdentifier, rowGap, buttonPosition, formAction, overrideLoaderParend, successMessage, errorMessage]);
163
- return <React.Fragment></React.Fragment>;
164
- };