form-craft-package 1.7.9-dev.0 → 1.7.9-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +3 -2
  2. package/src/api/client.ts +1 -1
  3. package/src/api/user.ts +7 -8
  4. package/src/components/common/custom-hooks/use-breadcrumb.hook.ts +90 -0
  5. package/src/components/common/custom-hooks/use-check-element-conditions.hook.ts +3 -3
  6. package/src/components/common/custom-hooks/use-find-dynamic-form.hook.ts +30 -11
  7. package/src/components/common/custom-hooks/use-login-handler.ts +81 -4
  8. package/src/components/common/custom-hooks/use-many-to-many-connector.hook.ts +30 -0
  9. package/src/components/common/not-found.tsx +21 -0
  10. package/src/components/common/section-panel.tsx +42 -0
  11. package/src/components/companies/1-authenticated/change-password.tsx +110 -0
  12. package/src/components/companies/2-unauthenticated/reset-password.tsx +128 -0
  13. package/src/components/companies/index.tsx +2 -0
  14. package/src/components/form/1-list/index.tsx +37 -38
  15. package/src/components/form/1-list/table-header.tsx +6 -6
  16. package/src/components/form/1-list/table.tsx +10 -12
  17. package/src/components/form/2-details/index.tsx +63 -41
  18. package/src/components/form/layout-renderer/1-row/index.tsx +12 -5
  19. package/src/components/form/layout-renderer/3-element/1-dynamic-button/index.tsx +59 -89
  20. package/src/components/form/layout-renderer/3-element/1-dynamic-button/use-button-navigate.hook.tsx +88 -0
  21. package/src/components/form/layout-renderer/3-element/1-dynamic-button/use-create-data.hook.ts +22 -23
  22. package/src/components/form/layout-renderer/3-element/1-dynamic-button/use-generate-report.hook.tsx +3 -4
  23. package/src/components/form/layout-renderer/3-element/1-dynamic-button/use-save-data.hook.ts +2 -2
  24. package/src/components/form/layout-renderer/3-element/11-breadcrumb.tsx +30 -0
  25. package/src/components/form/layout-renderer/3-element/2-field-element.tsx +4 -1
  26. package/src/components/form/layout-renderer/3-element/4-rich-text-editor.tsx +27 -2
  27. package/src/components/form/layout-renderer/3-element/6-signature.tsx +5 -1
  28. package/src/components/form/layout-renderer/3-element/8-fields-with-options.tsx +115 -74
  29. package/src/components/form/layout-renderer/3-element/9-form-data-render.tsx +50 -110
  30. package/src/components/form/layout-renderer/3-element/index.tsx +27 -9
  31. package/src/components/modals/report-filters.modal/helper-functions.ts +3 -6
  32. package/src/constants.ts +62 -45
  33. package/src/enums/form.enum.ts +5 -3
  34. package/src/enums/index.ts +9 -3
  35. package/src/{global-helpers → functions}/cookie-handler.ts +9 -10
  36. package/src/functions/forms/breadcrumb-handlers.ts +21 -0
  37. package/src/functions/forms/create-form-rules.ts +4 -1
  38. package/src/functions/forms/data-render-functions.tsx +5 -4
  39. package/src/functions/forms/extended-json-handlers.ts +56 -0
  40. package/src/functions/forms/index.ts +17 -11
  41. package/src/functions/index.ts +2 -1
  42. package/src/functions/reports/index.tsx +2 -1
  43. package/src/types/companies/site-layout/authenticated/index.tsx +23 -14
  44. package/src/types/forms/data-list/index.ts +0 -7
  45. package/src/types/forms/index.ts +1 -0
  46. package/src/types/forms/layout-elements/button.ts +11 -3
  47. package/src/types/forms/layout-elements/data-render-config.ts +1 -0
  48. package/src/types/forms/layout-elements/index.ts +12 -2
  49. package/src/types/forms/layout-elements/sanitization.ts +6 -1
  50. package/src/types/forms/relationship/index.ts +12 -1
  51. package/src/types/index.ts +2 -0
  52. package/src/functions/forms/json-handlers.ts +0 -19
  53. package/src/global-helpers/constants.ts +0 -2
  54. package/src/global-helpers/enums.ts +0 -12
@@ -7,12 +7,14 @@ import {
7
7
  } from '../../../enums'
8
8
 
9
9
  interface IButtonPropsBase {
10
+ formId?: number
10
11
  hasNoLabel?: boolean
11
12
  label?: string
12
13
  buttonType?: ButtonElementTypeEnum
13
14
  className?: string
14
15
  size?: ButtonElementSizeEnum
15
16
  order?: number
17
+ secondaryAction?: IButtonProps_Navigate | IButtonProps_CustomFunctionCall
16
18
  confirmation?: {
17
19
  enabled: boolean
18
20
  message?: string
@@ -24,16 +26,19 @@ interface IButtonPropsBase {
24
26
  error?: string
25
27
  }
26
28
  }
27
- export interface IButtonProps_Navigate extends IButtonPropsBase {
29
+ export interface IButtonProps_Navigate {
28
30
  category: ButtonActionCategoryEnum.Navigate
29
31
  navigateType: NavigateButtonTypesEnum
32
+ navigateBackCount?: number
30
33
  urlComponents?: IButtonProps_NavigateCustomComponents[]
34
+ customUrl?: string
35
+ formId?: number
31
36
  }
32
37
  export interface IButtonProps_NavigateCustomComponents {
33
38
  type: NavigateButtonCustomComponentType
34
39
  value: string
35
40
  }
36
- export interface IButtonProps_CustomFunctionCall extends IButtonPropsBase {
41
+ export interface IButtonProps_CustomFunctionCall {
37
42
  category: ButtonActionCategoryEnum.CustomFunction
38
43
  functionName: string
39
44
  }
@@ -46,4 +51,7 @@ export interface IButtonProps_Other extends IButtonPropsBase {
46
51
  | ButtonActionCategoryEnum.SaveDataChanges
47
52
  | ButtonActionCategoryEnum.ViewDataVersions
48
53
  }
49
- export type IButtonElementProps = IButtonProps_Navigate | IButtonProps_CustomFunctionCall | IButtonProps_Other
54
+ export type IButtonElementProps =
55
+ | (IButtonProps_Navigate & IButtonPropsBase)
56
+ | (IButtonProps_CustomFunctionCall & IButtonPropsBase)
57
+ | IButtonProps_Other
@@ -60,5 +60,6 @@ export type IDataRender_ConditionalResult = {
60
60
 
61
61
  export interface IDataRender_Buttons {
62
62
  type: DataRenderTypeEnum.Buttons
63
+ groupName?: string
63
64
  buttons: IButtonElementProps[]
64
65
  }
@@ -19,8 +19,8 @@ import {
19
19
  ICssStylePerBreakpoint,
20
20
  IEvaluationConfig,
21
21
  IFilterConfig,
22
+ IFormJoin,
22
23
  IReadFieldDataElementProps,
23
- IRelationshipForm,
24
24
  IReportTableElementProps,
25
25
  } from '..'
26
26
  import {
@@ -288,7 +288,11 @@ export interface IFormDataLoadElement extends BaseFormLayoutElement {
288
288
  }
289
289
  export interface IFormDataLoadElementProps {
290
290
  hasNoLabel?: boolean
291
- joins: IRelationshipForm[]
291
+ baseFormId: number
292
+ displayConfigFormId: number
293
+ displayConfigId: string
294
+ joins: IFormJoin[]
295
+ filter?: IFilterConfig
292
296
  name: string
293
297
  pageBreak?: ReportPageBreakEnum // used for report
294
298
  }
@@ -325,3 +329,9 @@ export interface IImageElement extends BaseFormLayoutElement {
325
329
  }
326
330
 
327
331
  /** -------------------------------------------------------------------------------------------- */
332
+
333
+ export interface IBreadcrumbElement extends BaseFormLayoutElement {
334
+ elementType: ElementTypeEnum.Breadcrumb
335
+ }
336
+
337
+ /** -------------------------------------------------------------------------------------------- */
@@ -1,11 +1,16 @@
1
1
  import { DataSanitizationTypeEnum } from '../../../enums'
2
2
 
3
- export type IDataSanitization = IDataSanitization_Default | IDataSanitization_Custom
3
+ export type IDataSanitization = IDataSanitization_Default | IDataSanitization_Predefined | IDataSanitization_Custom
4
4
 
5
5
  interface IDataSanitization_Default {
6
6
  type: DataSanitizationTypeEnum.Default
7
7
  }
8
8
 
9
+ export interface IDataSanitization_Predefined {
10
+ type: DataSanitizationTypeEnum.Predefined
11
+ pattern?: string
12
+ }
13
+
9
14
  export interface IDataSanitization_Custom {
10
15
  type: DataSanitizationTypeEnum.Custom
11
16
  pattern: string
@@ -1,13 +1,24 @@
1
1
  import { IDataListSorter, IFilterConfig, IFormDataListConfig } from '..'
2
2
  import { FormRelationshipEnum, NewFormViewTypeEnum } from '../../../enums'
3
3
 
4
- export type IFormRelationshipConfig = {
4
+ export type IFormRelationshipConfig = IFormRelationshipConfig_ManyToMany | IFormRelationshipConfig_Others
5
+
6
+ interface IFormRelationshipConfig_Base {
5
7
  formId: number
6
8
  type: FormRelationshipEnum
7
9
  foreignKey: string
8
10
  viewType?: NewFormViewTypeEnum
9
11
  displayConfigs?: IRelationshipDisplayConfig[]
10
12
  }
13
+ export interface IFormRelationshipConfig_ManyToMany extends IFormRelationshipConfig_Base {
14
+ type: FormRelationshipEnum.ManyToMany
15
+ foreignKey2: string
16
+ relationshipFormId: number
17
+ }
18
+
19
+ export interface IFormRelationshipConfig_Others extends IFormRelationshipConfig_Base {
20
+ type: FormRelationshipEnum.ManyToOne | FormRelationshipEnum.OneToMany | FormRelationshipEnum.OneToOne
21
+ }
11
22
 
12
23
  export type IRelationshipDisplayConfig = {
13
24
  id: string
@@ -1,6 +1,7 @@
1
1
  import { DeviceBreakpointEnum, DndLayoutNodeEnum } from '../enums'
2
2
  import {
3
3
  IBooleanElement,
4
+ IBreadcrumbElement,
4
5
  IButtonElement,
5
6
  IColorPickerElement,
6
7
  ICssStyle,
@@ -78,3 +79,4 @@ export type IDndLayoutElement =
78
79
  | IReportTableElement
79
80
  | IListElement
80
81
  | IImageElement
82
+ | IBreadcrumbElement
@@ -1,19 +0,0 @@
1
- // TODO: add json validator
2
- // TODO: pass the T and validate with it?
3
-
4
- export const parseJSON = <T extends any>(jsonString: string): T | null => {
5
- try {
6
- return JSON.parse(jsonString) as T
7
- } catch (error) {
8
- console.error('Invalid JSON string:', error)
9
- return null
10
- }
11
- }
12
- export const stringifyJSON = (jsonObject: any): string => {
13
- try {
14
- return JSON.stringify(jsonObject)
15
- } catch (error) {
16
- console.error('Unable to stringify JSON:', error)
17
- return ''
18
- }
19
- }
@@ -1,2 +0,0 @@
1
- export const CLIENT_ID = 'admin'
2
- export const CLIENT_SECRET = '3e9e418c-8bd7-4128-90c2-8db3e586a283'
@@ -1,12 +0,0 @@
1
- // openssl rand -hex 16
2
- export enum CookieKeysEnum {
3
- UserEmail = '39a1b9db6cbcc44349b73fbef45aec2f',
4
- FullName = 'f62a65732cb65c25cffc21365d2a7ca3',
5
- UserId = '46b3da3c19e56f0866b05bfbf1a3cae1',
6
- B = 'abc493d1ed0f148f58cd5bb8590afd45',
7
- C = 'b47a75cac8cca14d1855e3d826cbd8e4',
8
- D = '32659d819d745385b69bbb40bf7398bf',
9
- }
10
- export enum LocalStorageKeysEnum {
11
- DynamicForms = '38be231fe41c169037ed04c267ebe070',
12
- }