@sarafapp/iron_core 1.0.64 → 1.0.66

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 (307) hide show
  1. package/package.json +2 -2
  2. package/dist/core/src/BaseModel.d.ts +0 -45
  3. package/dist/core/src/Utils.d.ts +0 -4
  4. package/dist/core/src/accessHandling/AccessControl.d.ts +0 -10
  5. package/dist/core/src/accessHandling/AccessLevel.d.ts +0 -13
  6. package/dist/core/src/accessHandling/Accessible.d.ts +0 -3
  7. package/dist/core/src/accessHandling/EveryDirectiveAccess.d.ts +0 -4
  8. package/dist/core/src/accessHandling/SSO/AuthorizationDirective.d.ts +0 -17
  9. package/dist/core/src/accessHandling/SSO/AuthorizationService.d.ts +0 -17
  10. package/dist/core/src/accessHandling/SSO/EveryLevelAuthorizationDirective.d.ts +0 -4
  11. package/dist/core/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.d.ts +0 -4
  12. package/dist/core/src/accessHandling/SomeDirectiveAccess.d.ts +0 -4
  13. package/dist/core/src/accessHandling/index.d.ts +0 -9
  14. package/dist/core/src/baseDirective/BeforeMountDirective.d.ts +0 -3
  15. package/dist/core/src/baseDirective/BeforeUnMountDirective.d.ts +0 -3
  16. package/dist/core/src/baseDirective/BeforeUpdateDirective.d.ts +0 -3
  17. package/dist/core/src/baseDirective/CreatedDirective.d.ts +0 -3
  18. package/dist/core/src/baseDirective/MountedDirective.d.ts +0 -3
  19. package/dist/core/src/baseDirective/UnMountedDirective.d.ts +0 -3
  20. package/dist/core/src/baseDirective/UpdateDirective.d.ts +0 -3
  21. package/dist/core/src/baseDirective/index.d.ts +0 -7
  22. package/dist/core/src/baseForm/BaseRequestBodyFilter.d.ts +0 -4
  23. package/dist/core/src/baseForm/FormManager.d.ts +0 -18
  24. package/dist/core/src/baseForm/InputControl.d.ts +0 -40
  25. package/dist/core/src/baseForm/InputControlBuilder.d.ts +0 -16
  26. package/dist/core/src/baseForm/InputControlData.d.ts +0 -15
  27. package/dist/core/src/baseForm/RequestBodyFilter.d.ts +0 -3
  28. package/dist/core/src/baseForm/TouchSensitiveForm.d.ts +0 -9
  29. package/dist/core/src/baseForm/UseForm.d.ts +0 -18
  30. package/dist/core/src/baseForm/index.d.ts +0 -8
  31. package/dist/core/src/baseSchedule/Schedule.d.ts +0 -3
  32. package/dist/core/src/baseSchedule/Scheduler.d.ts +0 -8
  33. package/dist/core/src/baseSchedule/index.d.ts +0 -2
  34. package/dist/core/src/baseTable/BaseTable.d.ts +0 -47
  35. package/dist/core/src/baseTable/Constants.d.ts +0 -13
  36. package/dist/core/src/baseTable/OnDestory.d.ts +0 -3
  37. package/dist/core/src/baseTable/RowActionSource.d.ts +0 -4
  38. package/dist/core/src/baseTable/RowClick.d.ts +0 -3
  39. package/dist/core/src/baseTable/RowDoubleClick.d.ts +0 -3
  40. package/dist/core/src/baseTable/RowMetaClick.d.ts +0 -3
  41. package/dist/core/src/baseTable/SelectableTable.d.ts +0 -19
  42. package/dist/core/src/baseTable/TableAction.d.ts +0 -8
  43. package/dist/core/src/baseTable/TableHeaderSchema.d.ts +0 -27
  44. package/dist/core/src/baseTable/TableLoader.d.ts +0 -3
  45. package/dist/core/src/baseTable/TablePaginate.d.ts +0 -3
  46. package/dist/core/src/baseTable/TableService.d.ts +0 -9
  47. package/dist/core/src/baseTable/TableSort.d.ts +0 -4
  48. package/dist/core/src/baseTable/TableSummarySchema.d.ts +0 -9
  49. package/dist/core/src/baseTable/generator/SelectableTableGenerator.d.ts +0 -14
  50. package/dist/core/src/baseTable/generator/TableCellComponentRegistry.d.ts +0 -7
  51. package/dist/core/src/baseTable/generator/TableConfig.d.ts +0 -7
  52. package/dist/core/src/baseTable/generator/TableGenerator.d.ts +0 -37
  53. package/dist/core/src/baseTable/generator/TableSource.d.ts +0 -24
  54. package/dist/core/src/baseTable/index.d.ts +0 -23
  55. package/dist/core/src/baseTable/moduleConnection/Action.d.ts +0 -3
  56. package/dist/core/src/baseTable/moduleConnection/Column.d.ts +0 -3
  57. package/dist/core/src/baseTable/moduleConnection/Table.d.ts +0 -4
  58. package/dist/core/src/baseTable/moduleConnection/TableDestroy.d.ts +0 -2
  59. package/dist/core/src/baseTable/moduleConnection/TableRowClick.d.ts +0 -2
  60. package/dist/core/src/baseTable/moduleConnection/generator/GColumn.d.ts +0 -2
  61. package/dist/core/src/baseTable/moduleConnection/generator/GTable.d.ts +0 -2
  62. package/dist/core/src/composables/UseCrud.d.ts +0 -10
  63. package/dist/core/src/composables/UseData.d.ts +0 -15
  64. package/dist/core/src/composables/UseLoadingStatus.d.ts +0 -15
  65. package/dist/core/src/composables/UseParams.d.ts +0 -17
  66. package/dist/core/src/composables/UseRepository.d.ts +0 -67
  67. package/dist/core/src/composables/UseState.d.ts +0 -2
  68. package/dist/core/src/composables/UseStaticTableService.d.ts +0 -5
  69. package/dist/core/src/composables/index.d.ts +0 -7
  70. package/dist/core/src/constants/Constants.d.ts +0 -108
  71. package/dist/core/src/constants/index.d.ts +0 -1
  72. package/dist/core/src/crudService/CrudService.d.ts +0 -22
  73. package/dist/core/src/crudService/index.d.ts +0 -1
  74. package/dist/core/src/dateHandling/Constants.d.ts +0 -5
  75. package/dist/core/src/dateHandling/Converter.d.ts +0 -5
  76. package/dist/core/src/dateHandling/JalaliDateSetup.d.ts +0 -1
  77. package/dist/core/src/dateHandling/Model.d.ts +0 -12
  78. package/dist/core/src/dateHandling/Utils.d.ts +0 -8
  79. package/dist/core/src/dateHandling/index.d.ts +0 -5
  80. package/dist/core/src/debounce/DebounceAction.d.ts +0 -4
  81. package/dist/core/src/debounce/DebounceService.d.ts +0 -9
  82. package/dist/core/src/debounce/index.d.ts +0 -2
  83. package/dist/core/src/deviceManagement/Constants.d.ts +0 -4
  84. package/dist/core/src/deviceManagement/Visibility.d.ts +0 -4
  85. package/dist/core/src/deviceManagement/VisibilityManager.d.ts +0 -6
  86. package/dist/core/src/deviceManagement/index.d.ts +0 -3
  87. package/dist/core/src/errorHandling/ErrorHandler.d.ts +0 -3
  88. package/dist/core/src/errorHandling/HandleError.d.ts +0 -2
  89. package/dist/core/src/errorHandling/index.d.ts +0 -2
  90. package/dist/core/src/eventSystem/CustomEventDispatcher.d.ts +0 -5
  91. package/dist/core/src/eventSystem/Model.d.ts +0 -8
  92. package/dist/core/src/eventSystem/OnEvent.d.ts +0 -1
  93. package/dist/core/src/eventSystem/index.d.ts +0 -3
  94. package/dist/core/src/feedbackHandling/FailureFeedback.d.ts +0 -3
  95. package/dist/core/src/feedbackHandling/Feedback.d.ts +0 -11
  96. package/dist/core/src/feedbackHandling/HandleFeedback.d.ts +0 -2
  97. package/dist/core/src/feedbackHandling/InfoFeedback.d.ts +0 -3
  98. package/dist/core/src/feedbackHandling/SuccessFeedback.d.ts +0 -3
  99. package/dist/core/src/feedbackHandling/WarningFeedback.d.ts +0 -3
  100. package/dist/core/src/feedbackHandling/index.d.ts +0 -6
  101. package/dist/core/src/httpClient/ApiBuilder.d.ts +0 -14
  102. package/dist/core/src/httpClient/ErrorHandlerRegistry.d.ts +0 -10
  103. package/dist/core/src/httpClient/HttpClient.d.ts +0 -14
  104. package/dist/core/src/httpClient/Interceptor.d.ts +0 -4
  105. package/dist/core/src/httpClient/index.d.ts +0 -4
  106. package/dist/core/src/initializer/ApplicationInitializer.d.ts +0 -6
  107. package/dist/core/src/initializer/Initializer.d.ts +0 -3
  108. package/dist/core/src/initializer/index.d.ts +0 -2
  109. package/dist/core/src/json/JsonMapper.d.ts +0 -18
  110. package/dist/core/src/json/index.d.ts +0 -1
  111. package/dist/core/src/layout/Constants.d.ts +0 -10
  112. package/dist/core/src/layout/DialogService.d.ts +0 -406
  113. package/dist/core/src/layout/DrawerService.d.ts +0 -14
  114. package/dist/core/src/layout/Toast.d.ts +0 -8
  115. package/dist/core/src/layout/index.d.ts +0 -4
  116. package/dist/core/src/lib/Constants.d.ts +0 -20
  117. package/dist/core/src/lib/Formatter.d.ts +0 -10
  118. package/dist/core/src/lib/Util.d.ts +0 -12
  119. package/dist/core/src/lib/index.d.ts +0 -3
  120. package/dist/core/src/observables/AbstractSubject.d.ts +0 -7
  121. package/dist/core/src/observables/BehaviorSubject.d.ts +0 -16
  122. package/dist/core/src/observables/Observer.d.ts +0 -3
  123. package/dist/core/src/observables/Subject.d.ts +0 -6
  124. package/dist/core/src/observables/index.d.ts +0 -4
  125. package/dist/core/src/process/Proccess.d.ts +0 -9
  126. package/dist/core/src/process/ProcessManager.d.ts +0 -10
  127. package/dist/core/src/process/index.d.ts +0 -2
  128. package/dist/core/src/repository/Params.d.ts +0 -11
  129. package/dist/core/src/repository/Repository.d.ts +0 -38
  130. package/dist/core/src/repository/SyncDetail.d.ts +0 -5
  131. package/dist/core/src/repository/index.d.ts +0 -4
  132. package/dist/core/src/repository/model.d.ts +0 -5
  133. package/dist/core/src/routeGuard/RouteGuard.d.ts +0 -7
  134. package/dist/core/src/routeGuard/index.d.ts +0 -1
  135. package/dist/core/src/search/client/ClientArraySearch.d.ts +0 -4
  136. package/dist/core/src/search/client/ClientSearch.d.ts +0 -3
  137. package/dist/core/src/search/index.d.ts +0 -2
  138. package/dist/core/src/sort/SortDetail.d.ts +0 -6
  139. package/dist/core/src/sort/client/Sorter.d.ts +0 -6
  140. package/dist/core/src/sort/index.d.ts +0 -4
  141. package/dist/core/src/sort/strategies/SimpleSort.d.ts +0 -5
  142. package/dist/core/src/sort/strategies/SortStrategy.d.ts +0 -4
  143. package/dist/core/src/types/Global.d.ts +0 -1
  144. package/dist/core/src/types/index.d.ts +0 -1
  145. package/dist/core/src/validators/Validator.d.ts +0 -4
  146. package/dist/core/src/validators/index.d.ts +0 -1
  147. package/dist/core/src/webSocket/Constants.d.ts +0 -6
  148. package/dist/core/src/webSocket/Model.d.ts +0 -6
  149. package/dist/core/src/webSocket/WebSocketService.d.ts +0 -30
  150. package/dist/core/src/webSocket/index.d.ts +0 -3
  151. package/dist/example-vue/src/AntTableConfig.d.ts +0 -6
  152. package/dist/example-vue/src/TableService.d.ts +0 -12
  153. package/dist/example-vue/src/TextCell.vue.d.ts +0 -5
  154. package/dist/example-vue/src/app/App.vue.d.ts +0 -2
  155. package/dist/example-vue/src/app/router/index.d.ts +0 -1
  156. package/dist/example-vue/src/app/screens/Index.vue.d.ts +0 -2
  157. package/dist/example-vue/src/main.d.ts +0 -0
  158. package/src/BaseModel.ts +0 -127
  159. package/src/Utils.ts +0 -16
  160. package/src/accessHandling/AccessControl.ts +0 -33
  161. package/src/accessHandling/AccessLevel.ts +0 -52
  162. package/src/accessHandling/Accessible.ts +0 -3
  163. package/src/accessHandling/EveryDirectiveAccess.ts +0 -7
  164. package/src/accessHandling/SSO/AuthorizationDirective.ts +0 -65
  165. package/src/accessHandling/SSO/AuthorizationService.ts +0 -74
  166. package/src/accessHandling/SSO/EveryLevelAuthorizationDirective.ts +0 -7
  167. package/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.ts +0 -7
  168. package/src/accessHandling/SomeDirectiveAccess.ts +0 -7
  169. package/src/accessHandling/index.ts +0 -9
  170. package/src/baseDirective/BeforeMountDirective.ts +0 -3
  171. package/src/baseDirective/BeforeUnMountDirective.ts +0 -3
  172. package/src/baseDirective/BeforeUpdateDirective.ts +0 -3
  173. package/src/baseDirective/CreatedDirective.ts +0 -3
  174. package/src/baseDirective/MountedDirective.ts +0 -3
  175. package/src/baseDirective/UnMountedDirective.ts +0 -3
  176. package/src/baseDirective/UpdateDirective.ts +0 -3
  177. package/src/baseDirective/index.ts +0 -7
  178. package/src/baseForm/BaseRequestBodyFilter.ts +0 -7
  179. package/src/baseForm/FormManager.ts +0 -95
  180. package/src/baseForm/InputControl.ts +0 -182
  181. package/src/baseForm/InputControlBuilder.ts +0 -59
  182. package/src/baseForm/InputControlData.ts +0 -16
  183. package/src/baseForm/RequestBodyFilter.ts +0 -3
  184. package/src/baseForm/TouchSensitiveForm.ts +0 -47
  185. package/src/baseForm/UseForm.ts +0 -32
  186. package/src/baseForm/index.ts +0 -8
  187. package/src/baseSchedule/Schedule.ts +0 -3
  188. package/src/baseSchedule/Scheduler.ts +0 -29
  189. package/src/baseSchedule/index.ts +0 -2
  190. package/src/baseTable/BaseTable.ts +0 -162
  191. package/src/baseTable/Constants.ts +0 -26
  192. package/src/baseTable/OnDestory.ts +0 -3
  193. package/src/baseTable/RowActionSource.ts +0 -5
  194. package/src/baseTable/RowClick.ts +0 -3
  195. package/src/baseTable/RowDoubleClick.ts +0 -3
  196. package/src/baseTable/RowMetaClick.ts +0 -3
  197. package/src/baseTable/SelectableTable.ts +0 -86
  198. package/src/baseTable/TableAction.ts +0 -10
  199. package/src/baseTable/TableHeaderSchema.ts +0 -44
  200. package/src/baseTable/TableLoader.ts +0 -3
  201. package/src/baseTable/TablePaginate.ts +0 -3
  202. package/src/baseTable/TableService.ts +0 -10
  203. package/src/baseTable/TableSort.ts +0 -5
  204. package/src/baseTable/TableSummarySchema.ts +0 -11
  205. package/src/baseTable/generator/SelectableTableGenerator.ts +0 -65
  206. package/src/baseTable/generator/TableCellComponentRegistry.ts +0 -15
  207. package/src/baseTable/generator/TableConfig.ts +0 -18
  208. package/src/baseTable/generator/TableGenerator.ts +0 -147
  209. package/src/baseTable/generator/TableSource.ts +0 -34
  210. package/src/baseTable/index.ts +0 -43
  211. package/src/baseTable/moduleConnection/Action.ts +0 -12
  212. package/src/baseTable/moduleConnection/Column.ts +0 -11
  213. package/src/baseTable/moduleConnection/Table.ts +0 -49
  214. package/src/baseTable/moduleConnection/TableDestroy.ts +0 -7
  215. package/src/baseTable/moduleConnection/TableRowClick.ts +0 -7
  216. package/src/baseTable/moduleConnection/generator/GColumn.ts +0 -10
  217. package/src/baseTable/moduleConnection/generator/GTable.ts +0 -11
  218. package/src/composables/UseCrud.ts +0 -53
  219. package/src/composables/UseData.ts +0 -70
  220. package/src/composables/UseLoadingStatus.ts +0 -65
  221. package/src/composables/UseParams.ts +0 -93
  222. package/src/composables/UseRepository.ts +0 -207
  223. package/src/composables/UseState.ts +0 -30
  224. package/src/composables/UseStaticTableService.ts +0 -45
  225. package/src/composables/index.ts +0 -7
  226. package/src/constants/Constants.ts +0 -126
  227. package/src/constants/index.ts +0 -19
  228. package/src/crudService/CrudService.ts +0 -121
  229. package/src/crudService/index.ts +0 -1
  230. package/src/dateHandling/Constants.ts +0 -5
  231. package/src/dateHandling/Converter.ts +0 -15
  232. package/src/dateHandling/JalaliDateSetup.ts +0 -42
  233. package/src/dateHandling/Model.ts +0 -27
  234. package/src/dateHandling/Utils.ts +0 -49
  235. package/src/dateHandling/index.ts +0 -5
  236. package/src/debounce/DebounceAction.ts +0 -4
  237. package/src/debounce/DebounceService.ts +0 -27
  238. package/src/debounce/index.ts +0 -2
  239. package/src/deviceManagement/Constants.ts +0 -4
  240. package/src/deviceManagement/Visibility.ts +0 -4
  241. package/src/deviceManagement/VisibilityManager.ts +0 -18
  242. package/src/deviceManagement/index.ts +0 -3
  243. package/src/errorHandling/ErrorHandler.ts +0 -3
  244. package/src/errorHandling/HandleError.ts +0 -20
  245. package/src/errorHandling/index.ts +0 -2
  246. package/src/eventSystem/CustomEventDispatcher.ts +0 -13
  247. package/src/eventSystem/Model.ts +0 -29
  248. package/src/eventSystem/OnEvent.ts +0 -25
  249. package/src/eventSystem/index.ts +0 -3
  250. package/src/feedbackHandling/FailureFeedback.ts +0 -3
  251. package/src/feedbackHandling/Feedback.ts +0 -34
  252. package/src/feedbackHandling/HandleFeedback.ts +0 -28
  253. package/src/feedbackHandling/InfoFeedback.ts +0 -3
  254. package/src/feedbackHandling/SuccessFeedback.ts +0 -3
  255. package/src/feedbackHandling/WarningFeedback.ts +0 -3
  256. package/src/feedbackHandling/index.ts +0 -6
  257. package/src/httpClient/ApiBuilder.ts +0 -57
  258. package/src/httpClient/ErrorHandlerRegistry.ts +0 -29
  259. package/src/httpClient/HttpClient.ts +0 -77
  260. package/src/httpClient/Interceptor.ts +0 -5
  261. package/src/httpClient/index.ts +0 -4
  262. package/src/initializer/ApplicationInitializer.ts +0 -15
  263. package/src/initializer/Initializer.ts +0 -3
  264. package/src/initializer/index.ts +0 -2
  265. package/src/json/JsonMapper.ts +0 -48
  266. package/src/json/index.ts +0 -1
  267. package/src/layout/Constants.ts +0 -11
  268. package/src/layout/DialogService.ts +0 -75
  269. package/src/layout/DrawerService.ts +0 -25
  270. package/src/layout/Toast.ts +0 -14
  271. package/src/layout/index.ts +0 -4
  272. package/src/lib/Constants.ts +0 -433
  273. package/src/lib/Formatter.ts +0 -68
  274. package/src/lib/Util.ts +0 -113
  275. package/src/lib/index.ts +0 -3
  276. package/src/observables/AbstractSubject.ts +0 -21
  277. package/src/observables/BehaviorSubject.ts +0 -58
  278. package/src/observables/Observer.ts +0 -3
  279. package/src/observables/Subject.ts +0 -9
  280. package/src/observables/index.ts +0 -4
  281. package/src/process/Proccess.ts +0 -21
  282. package/src/process/ProcessManager.ts +0 -31
  283. package/src/process/index.ts +0 -2
  284. package/src/repository/Params.ts +0 -10
  285. package/src/repository/Repository.ts +0 -44
  286. package/src/repository/SyncDetail.ts +0 -8
  287. package/src/repository/index.ts +0 -4
  288. package/src/repository/model.ts +0 -9
  289. package/src/routeGuard/RouteGuard.ts +0 -38
  290. package/src/routeGuard/index.ts +0 -1
  291. package/src/search/client/ClientArraySearch.ts +0 -25
  292. package/src/search/client/ClientSearch.ts +0 -3
  293. package/src/search/index.ts +0 -2
  294. package/src/sort/SortDetail.ts +0 -11
  295. package/src/sort/client/Sorter.ts +0 -28
  296. package/src/sort/index.ts +0 -4
  297. package/src/sort/strategies/SimpleSort.ts +0 -35
  298. package/src/sort/strategies/SortStrategy.ts +0 -4
  299. package/src/types/Global.ts +0 -1
  300. package/src/types/index.ts +0 -1
  301. package/src/validators/Validator.ts +0 -5
  302. package/src/validators/index.ts +0 -1
  303. package/src/webSocket/Constants.ts +0 -6
  304. package/src/webSocket/Model.ts +0 -16
  305. package/src/webSocket/WebSocketService.ts +0 -153
  306. package/src/webSocket/index.ts +0 -3
  307. package/vite.config.ts +0 -55
@@ -1,3 +0,0 @@
1
- export interface BeforeUnMountDirective {
2
- beforeUnMount(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,3 +0,0 @@
1
- export interface BeforeUpdateDirective {
2
- beforeUpdate(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,3 +0,0 @@
1
- export interface CreatedDirective {
2
- created(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,3 +0,0 @@
1
- export interface MountedDirective {
2
- mounted(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,3 +0,0 @@
1
- export interface UnMountedDirective {
2
- unMounted(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,3 +0,0 @@
1
- export interface UpdateDirective {
2
- updated(element: unknown, binding: unknown, vnode: unknown): void;
3
- }
@@ -1,7 +0,0 @@
1
- export type { BeforeMountDirective } from "./BeforeMountDirective";
2
- export type { BeforeUnMountDirective } from "./BeforeUnMountDirective";
3
- export type { BeforeUpdateDirective } from "./BeforeUpdateDirective";
4
- export type { CreatedDirective } from "./CreatedDirective";
5
- export type { MountedDirective } from "./MountedDirective";
6
- export type { UnMountedDirective } from "./UnMountedDirective";
7
- export type { UpdateDirective } from "./UpdateDirective";
@@ -1,7 +0,0 @@
1
- import { RequestBodyFilter } from "./RequestBodyFilter";
2
-
3
- export class BaseRequestBodyFilter implements RequestBodyFilter<unknown> {
4
- public shouldBeInRequestBody(_value: unknown): boolean {
5
- return true;
6
- }
7
- }
@@ -1,95 +0,0 @@
1
- import { InputControl } from "./InputControl";
2
- import { BaseRequestBodyFilter } from "./BaseRequestBodyFilter";
3
-
4
- export class FormManager {
5
- private _inputControls = new Map<string, InputControl<unknown>>();
6
- private _isValid: boolean = false;
7
- private _id: number = Math.random();
8
-
9
- public getInputControlsAsArray(): InputControl<unknown>[] {
10
- return Array.from(this._inputControls.values());
11
- }
12
-
13
- public async runValidation(shouldValidateInputControls?: boolean) {
14
- let isValid = true;
15
-
16
- for (const inputControl of this.getInputControlsAsArray()) {
17
- if (shouldValidateInputControls) {
18
- await inputControl.runValidation(true);
19
- }
20
- const isInputValid = inputControl.getIsValid();
21
- if (!isInputValid) {
22
- isValid = false;
23
- if (!shouldValidateInputControls) {
24
- this._isValid = false;
25
- return;
26
- }
27
- }
28
- }
29
- this._isValid = isValid;
30
- }
31
-
32
- public addInputControls(inputControls: InputControl<unknown>[]) {
33
- for (const inputControl of inputControls) {
34
- this._inputControls.set(inputControl.getName(), inputControl);
35
- }
36
- }
37
-
38
- public getInputControl<T>(inputControlName: string) {
39
- const inputControl = this._inputControls.get(inputControlName);
40
- if (!inputControl) {
41
- throw new Error(
42
- `The provided input name (${inputControlName}}) has no controls.`,
43
- );
44
- }
45
- return inputControl as InputControl<T>;
46
- }
47
-
48
- public resetControls(inputControlNames: string[]) {
49
- for (const inputName of inputControlNames) {
50
- const inputToReset = this._inputControls.get(inputName);
51
- if (inputToReset) {
52
- inputToReset.reset();
53
- } else {
54
- console.warn(
55
- `Provided input name ${inputName} has no controllers in this form`,
56
- );
57
- }
58
- }
59
- }
60
-
61
- public resetAll() {
62
- for (const inputControl of this.getInputControlsAsArray()) {
63
- inputControl.reset();
64
- }
65
- }
66
-
67
- public createRequestBody<T>(requestBodyFilter = new BaseRequestBodyFilter()) {
68
- const requestBody: Record<string, unknown> = {};
69
-
70
- for (const inputControl of this.getInputControlsAsArray()) {
71
- if (
72
- inputControl.getIsIncludeInRequestBody() &&
73
- requestBodyFilter.shouldBeInRequestBody(inputControl.value)
74
- ) {
75
- requestBody[inputControl.getName()] = inputControl.value;
76
- }
77
- }
78
-
79
- return requestBody as T;
80
- }
81
-
82
- public setIsValid(isValid: boolean): void {
83
- this._isValid = isValid;
84
- }
85
- public getIsValid() {
86
- return this._isValid;
87
- }
88
-
89
- public setId(id: number) {
90
- this._id = id;
91
- }
92
- public getId() {
93
- return this._id;
94
- }
95
- }
@@ -1,182 +0,0 @@
1
- import { toRaw } from "vue";
2
- import type { Nullable } from "../types";
3
- import { InputControlData } from "./InputControlData";
4
- import { isEmpty } from "../Utils";
5
- import { type Validator } from "../validators";
6
-
7
- export class InputControl<T> {
8
- private initialData: Nullable<InputControlData<T>> = null;
9
- private data = new InputControlData<T>();
10
- private _validators: Validator<T>[] = [];
11
- private _id = Math.random();
12
-
13
- constructor(name: string, value: Nullable<T>) {
14
- this.data.value = value;
15
- this.data.name = name;
16
- if (this.shouldRunValidation()) {
17
- this.runValidation(true);
18
- }
19
- }
20
-
21
- private shouldRunValidation(): boolean {
22
- if (this.data.hasCustomValidationCheck) return false;
23
- if (this.data.isRequired) return true;
24
- return !isEmpty(this.data.value);
25
- }
26
-
27
- public async runValidation(isBlur: boolean = false) {
28
- for (const validator of this._validators) {
29
- const validationMessage = await validator.validate(this.data.value);
30
- if (validationMessage) {
31
- this.setFormToInvalidState(isBlur, validationMessage);
32
- return;
33
- }
34
- }
35
- this.setFormToValidState();
36
- }
37
-
38
- private setFormToInvalidState(
39
- isBlur: boolean,
40
- validationMessage: string,
41
- ) {
42
- this.data.isValid = false;
43
- if (this.data.isChangeSensitive || isBlur) {
44
- this.setNotValidMessage(validationMessage);
45
- }
46
- }
47
-
48
- private setFormToValidState() {
49
- this.data.isValid = true;
50
- this.setNotValidMessage('');
51
- }
52
-
53
- public reset() {
54
- if (this.initialData) {
55
- this.data = structuredClone(toRaw(this.initialData));
56
- } else {
57
- console.warn(
58
- "The " +
59
- this.data.name +
60
- `input control has no initial data,
61
- the initial data will be available after calling the [markAsInitial] method on this instance`,
62
- );
63
- }
64
- }
65
-
66
- public markAsInitial() {
67
- this.initialData = structuredClone(toRaw(this.data));
68
- }
69
-
70
- public setValidators(validators: Validator<T>[]) {
71
- this._validators = validators;
72
- }
73
-
74
- public getChangeSensitive() {
75
- return this.data.isChangeSensitive;
76
- }
77
-
78
- public setChangeSensitive(isChangeSensitive: boolean) {
79
- if (isChangeSensitive && this.data.shouldRemoveValidationMessageOnInteract) {
80
- throw new Error("Input control " + this.getName() + " can not be both change sensitive and remove validation meessage on interact");
81
- }
82
-
83
- this.data.isChangeSensitive = isChangeSensitive;
84
- }
85
-
86
- public getIsBlurSensitive(): boolean {
87
- return this.data.isBlurSensitive;
88
- }
89
-
90
- public setIsBlurSensitive(isBlurSensitive: boolean) {
91
- this.data.isBlurSensitive = isBlurSensitive;
92
- }
93
-
94
- public getIsRequired(): boolean {
95
- return this.data.isRequired;
96
- }
97
-
98
- public setIsRequired(isRequired: boolean) {
99
- this.data.isRequired = isRequired;
100
- }
101
-
102
- public getIsValid() {
103
- return this.data.isValid;
104
- }
105
-
106
- public setIsValid(isValid: boolean) {
107
- this.data.isValid = isValid;
108
- }
109
-
110
- public getIsIncludeInRequestBody(): boolean {
111
- return this.data.isIncludeInRequestBody;
112
- }
113
-
114
- public setIsIncludeInRequestBody(isIncludeInRequestBody: boolean) {
115
- this.data.isIncludeInRequestBody = isIncludeInRequestBody;
116
- }
117
-
118
- public getNotValidMessage() {
119
- return this.data.notValidMessage;
120
- }
121
-
122
- public setNotValidMessage(notValidMessage: string) {
123
- this.data.notValidMessage = notValidMessage;
124
- }
125
-
126
- public getName() {
127
- return this.data.name;
128
- }
129
-
130
- public setName(name: string) {
131
- this.data.name = name;
132
- }
133
-
134
- public setId(id: number) {
135
- this._id = id;
136
- }
137
-
138
- public getId(): number {
139
- return this._id;
140
- }
141
-
142
- public getIsEmptySensitive(): boolean {
143
- return this.data.isEmptySensitive;
144
- }
145
-
146
- public setIsEmptySensitive(value: boolean) {
147
- this.data.isEmptySensitive = value;
148
- }
149
-
150
- public setHasCustomValidationCheck(hasCustomCheck: boolean) {
151
- this.data.hasCustomValidationCheck = hasCustomCheck;
152
- }
153
-
154
- public setShouldRemoveValidationOnInteract(value: boolean) {
155
- if (value && this.data.isChangeSensitive) {
156
- throw new Error("Input control " + this.getName() + " can not be both change sensitive and remove validation meessage on interact");
157
- }
158
- this.data.shouldRemoveValidationMessageOnInteract = value;
159
- }
160
-
161
- public getShouldRemoveValidationOnInteract() {
162
- return this.data.shouldRemoveValidationMessageOnInteract;
163
- }
164
-
165
- public hasCustomValidationCheck() {
166
- return this.data.hasCustomValidationCheck;
167
- }
168
-
169
- public set value(value: Nullable<T>) {
170
- this.data.value = value;
171
- if (this.shouldRunValidation()) {
172
- this.runValidation();
173
- }
174
- if (this.getShouldRemoveValidationOnInteract()) {
175
- this.setNotValidMessage("");
176
- }
177
- }
178
-
179
- public get value() {
180
- return this.data.value;
181
- }
182
- }
@@ -1,59 +0,0 @@
1
- import { InputControl } from "./InputControl";
2
- import type { Validator } from "../validators";
3
-
4
- export class InputControlBuilder<T> {
5
- private _inputControl: InputControl<T>;
6
-
7
- constructor(inputControl: InputControl<T>) {
8
- this._inputControl = inputControl;
9
- }
10
-
11
- public setValidators(validators: Validator<T>[]) {
12
- this._inputControl.setValidators(validators);
13
- return this;
14
- }
15
-
16
- public setChangeSensitive() {
17
- this._inputControl.setChangeSensitive(true);
18
- return this;
19
- }
20
-
21
- public setRequired() {
22
- this._inputControl.setIsRequired(true);
23
- return this;
24
- }
25
-
26
- public setValid() {
27
- this._inputControl.setIsValid(true);
28
- return this;
29
- }
30
-
31
- public setBlurSensitive() {
32
- this._inputControl.setIsBlurSensitive(true);
33
- return this;
34
- }
35
-
36
- public setId(id: number) {
37
- this._inputControl.setId(id);
38
- return this;
39
- }
40
-
41
- public removeEmptySensitive() {
42
- this._inputControl.setIsEmptySensitive(false);
43
- return this;
44
- }
45
-
46
- public setHasCustomValidationCheck() {
47
- this._inputControl.setHasCustomValidationCheck(true);
48
- return this;
49
- }
50
-
51
- public removeErrorOnInteract() {
52
- this._inputControl.setShouldRemoveValidationOnInteract(true);
53
- return this;
54
- }
55
-
56
- public build(): InputControl<T> {
57
- return this._inputControl;
58
- }
59
- }
@@ -1,16 +0,0 @@
1
- import type { Nullable } from '../types'
2
-
3
- export class InputControlData<T> {
4
- public value: Nullable<T> = null
5
- public initialValue: Nullable<T> = null
6
- public name: string = ''
7
- public isValid: boolean = false
8
- public isBlurSensitive: boolean = false
9
- public isRequired: boolean = false
10
- public isIncludeInRequestBody: boolean = true
11
- public isChangeSensitive: boolean = false
12
- public notValidMessage: string = ''
13
- public isEmptySensitive: boolean = true;
14
- public hasCustomValidationCheck: boolean = false;
15
- public shouldRemoveValidationMessageOnInteract = false;
16
- }
@@ -1,3 +0,0 @@
1
- export interface RequestBodyFilter<T> {
2
- shouldBeInRequestBody(value: T): boolean
3
- }
@@ -1,47 +0,0 @@
1
- import type { DirectiveBinding } from "vue";
2
- import type { MountedDirective } from "../baseDirective";
3
- import type { BeforeUnMountDirective } from "../baseDirective";
4
- import { InputControl } from "./InputControl";
5
-
6
- export class TouchSensitiveControl
7
- implements MountedDirective, BeforeUnMountDirective
8
- {
9
-
10
- public mounted = (
11
- element: HTMLInputElement,
12
- binding: DirectiveBinding<InputControl<unknown>>,
13
- ) => {
14
- if (!binding.value) return;
15
-
16
- if (!binding.value.getIsBlurSensitive()) return;
17
-
18
- element.addEventListener('click', this.handleFocus.bind(this, binding.value))
19
-
20
- element.addEventListener(
21
- "blur",
22
- this.handleBlur.bind(this, binding.value),
23
- true,
24
- );
25
- };
26
-
27
- public beforeUnMount = (
28
- element: HTMLInputElement,
29
- binding: DirectiveBinding<InputControl<unknown>>,
30
- ) => {
31
- element!.removeEventListener(
32
- "blur",
33
- this.handleBlur.bind(this, binding.value),
34
- );
35
- element!.removeEventListener('click', this.handleFocus.bind(this, binding.value))
36
- };
37
-
38
- private handleBlur(inputControl: InputControl<unknown>) {
39
- inputControl!.runValidation(true);
40
- }
41
-
42
- private handleFocus(inputControl: InputControl<unknown>) {
43
- if (inputControl.value || inputControl.getIsEmptySensitive()) return;
44
-
45
- inputControl.setNotValidMessage('');
46
- }
47
- }
@@ -1,32 +0,0 @@
1
- import { reactive, ref, watch } from "vue";
2
- import { FormManager } from "./FormManager";
3
- import { FormValidationStatus } from "../constants";
4
-
5
- export function useForm(form: FormManager, hasCustomValidation = false) {
6
- const reactiveForm = reactive<FormManager>(form);
7
- const validationStatus = ref<FormValidationStatus>(
8
- FormValidationStatus.Invalid,
9
- );
10
-
11
- watch(
12
- () => reactiveForm.getInputControlsAsArray(),
13
- () => {
14
- if (hasCustomValidation) return;
15
- reactiveForm.runValidation();
16
- if (reactiveForm.getIsValid()) {
17
- validationStatus.value = FormValidationStatus.Valid;
18
- } else {
19
- validationStatus.value = FormValidationStatus.Invalid;
20
- }
21
- },
22
- {
23
- immediate: true,
24
- deep: true,
25
- },
26
- );
27
-
28
- return {
29
- reactiveForm,
30
- validationStatus,
31
- };
32
- }
@@ -1,8 +0,0 @@
1
- export { InputControl } from "./InputControl";
2
- export { InputControlBuilder } from "./InputControlBuilder";
3
- export { InputControlData } from "./InputControlData";
4
- export { TouchSensitiveControl } from "./TouchSensitiveForm";
5
- export { FormManager } from "./FormManager";
6
- export { useForm } from "./UseForm";
7
- export { BaseRequestBodyFilter } from "./BaseRequestBodyFilter"
8
- export { type RequestBodyFilter } from "./RequestBodyFilter"
@@ -1,3 +0,0 @@
1
- export interface Schedule {
2
- runAction: () => Promise<unknown>
3
- }
@@ -1,29 +0,0 @@
1
- import type { Nullable } from '../types'
2
- import type { Schedule } from './Schedule'
3
-
4
- export class Scheduler {
5
- private timerId: Nullable<ReturnType<typeof setTimeout>> = null
6
- private readonly schedule: Schedule;
7
-
8
- constructor(scheduler: Schedule) {
9
- this.setupInterval = this.setupInterval.bind(this);
10
- this.schedule = scheduler;
11
- }
12
-
13
- public setupInterval(intervalInMilliseconds: number) {
14
- // eslint-disable-next-line @typescript-eslint/no-this-alias
15
- const thisReference = this;
16
- this.timerId = setTimeout(async function autoRefresh() {
17
- await thisReference.schedule.runAction()
18
- thisReference.timerId = setTimeout(() => {
19
- autoRefresh()
20
- }, intervalInMilliseconds);
21
- }, intervalInMilliseconds);
22
- }
23
-
24
- public clearInterval() {
25
- if (this.timerId) {
26
- clearInterval(this.timerId);
27
- }
28
- }
29
- }
@@ -1,2 +0,0 @@
1
- export { type Schedule } from './Schedule'
2
- export { Scheduler } from './Scheduler'
@@ -1,162 +0,0 @@
1
- import { SortDetail } from "../sort";
2
- import { BaseModel } from "../BaseModel";
3
- import { LoadingStatus, SortOrder, TableConstants } from "../constants";
4
- import { type Accessible, AccessLevel } from "../accessHandling";
5
- import type { TableHeaderSchema } from "./TableHeaderSchema";
6
- import type { TableService } from "./TableService";
7
- import type { TableAction } from "./TableAction";
8
- import type { Nullable } from "../types";
9
- import type { TableSummarySchema } from "./TableSummarySchema.ts";
10
-
11
- export abstract class BaseTable<Model extends BaseModel> {
12
- protected service: TableService<Model>;
13
- private accessService: AccessLevel;
14
- protected currentPage: number = 1;
15
- protected currentPageSize: number = 20;
16
- private currentSortDetail: SortDetail<Model> = new SortDetail(
17
- "id",
18
- SortOrder.DESC,
19
- );
20
- protected loadedRows: Model[] = [];
21
- public headerSchema: TableHeaderSchema<Model>[] = [];
22
-
23
- protected constructor(service: TableService<Model>) {
24
- this.service = service;
25
- this.accessService = AccessLevel.GetInstance();
26
- }
27
-
28
- public addHeader(schema: TableHeaderSchema<Model>) {
29
- this.headerSchema.push(schema);
30
- }
31
-
32
- public async load() {
33
- this.headerSchema = this.filterItemsBaseOnAccessLevel(
34
- await this.loadHeader(),
35
- );
36
- await this.loadRows();
37
- }
38
-
39
- protected filterItemsBaseOnAccessLevel<T>(items: Accessible[]): T[] {
40
- return items.filter((item) => {
41
- if (item.hasAccess) {
42
- return item.hasAccess();
43
- }
44
- return true;
45
- }) as T[];
46
- }
47
-
48
- public async sort(sortDetail: SortDetail<Model>) {
49
- if (!this.shouldSendSortRequest(sortDetail)) return;
50
- this.currentSortDetail = sortDetail;
51
- this.loadedRows = (await this.handleSort(this.currentSortDetail)).items;
52
- }
53
-
54
- private shouldSendSortRequest(sortDetail: SortDetail<Model>): boolean {
55
- return (
56
- sortDetail.key !== this.currentSortDetail.key ||
57
- sortDetail.order !== this.currentSortDetail.order
58
- );
59
- }
60
-
61
- public async paginate(nextPage: number, pageSize: number) {
62
- if (!this.shouldSendPaginationRequest(nextPage, pageSize)) return;
63
- this.currentPage = nextPage;
64
- this.currentPageSize = pageSize;
65
- this.loadedRows = (
66
- await this.handlePagination(this.currentPage, this.currentPageSize)
67
- ).items;
68
- }
69
-
70
- private shouldSendPaginationRequest(
71
- nextPage: number,
72
- pageSize: number,
73
- ): boolean {
74
- return this.currentPage !== nextPage || this.currentPageSize !== pageSize;
75
- }
76
-
77
- protected async loadRows() {
78
- this.loadedRows = (await this.service.fetchRows()).items;
79
- return this.loadedRows;
80
- }
81
-
82
- public getData() {
83
- return this.service.getData();
84
- }
85
-
86
- protected async handleSort(sortDetail: SortDetail<Model>) {
87
- return await this.service.sort(sortDetail);
88
- }
89
-
90
- protected async handlePagination(nextPage: number, pageSize: number) {
91
- return await this.service.paginate(nextPage, pageSize);
92
- }
93
-
94
- public getItemCountPerPage(): number {
95
- return TableConstants.DEFAULT_ITEM_COUNT_PER_PAGE;
96
- }
97
-
98
- public isLoading() {
99
- const loadingStatuses = this.getLoadingStatuses();
100
- return (
101
- loadingStatuses.has(LoadingStatus.Search) ||
102
- loadingStatuses.has(LoadingStatus.FetchList) ||
103
- loadingStatuses.has(LoadingStatus.Sort) ||
104
- loadingStatuses.has(LoadingStatus.FetchLastItems) ||
105
- loadingStatuses.has(LoadingStatus.FetchPreviousItems)
106
- );
107
- }
108
-
109
- protected getLoadingStatuses() {
110
- return this.getData().loadingStatus;
111
- }
112
-
113
- public hasAnyAction() {
114
- for (const row of this.loadedRows) {
115
- if (this.getAccessedActions(row).length) return true;
116
- }
117
- return false;
118
- }
119
-
120
- public getAccessedActions(row: Model): TableAction<Model>[] {
121
- return this.filterItemsBaseOnAccessLevel(this.getActions(row));
122
- }
123
-
124
- protected getActions(row: Model): TableAction<Model>[] {
125
- return [];
126
- }
127
-
128
- public getScrollDetail(): Nullable<boolean | { x?: number; y?: number }> {
129
- return null;
130
- }
131
-
132
- public isExpandable() {
133
- return false;
134
- }
135
-
136
- public async handleClick(row: Model) {
137
- return;
138
- }
139
-
140
- public async handleMetaClick(row: Model) {
141
- return;
142
- }
143
-
144
- public async handleDoubleClick(row: Model) {
145
- return;
146
- }
147
-
148
- public async onDestroy() {
149
- return;
150
- }
151
-
152
- public async loadHeader(): Promise<TableHeaderSchema<Model>[]> {
153
- throw new Error("No header provided for the table.");
154
- }
155
-
156
- public loadSummarySchema(): TableSummarySchema {
157
- return {
158
- summaryTitle: "",
159
- summaryItems: [],
160
- };
161
- }
162
- }