@appcorp/stellar-solutions-modules 0.1.34 → 0.1.36

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 (181) hide show
  1. package/README.md +128 -19
  2. package/components/theme-provider.d.ts +9 -0
  3. package/components/theme-provider.js +122 -0
  4. package/components/theme-switcher.d.ts +4 -0
  5. package/components/theme-switcher.js +60 -0
  6. package/components/ui/badge.d.ts +9 -0
  7. package/components/ui/badge.js +82 -0
  8. package/components/ui/button.d.ts +10 -0
  9. package/components/ui/button.js +91 -0
  10. package/components/ui/card.d.ts +9 -0
  11. package/components/ui/card.js +94 -0
  12. package/components/ui/checkbox.d.ts +9 -0
  13. package/components/ui/checkbox.js +87 -0
  14. package/components/ui/combobox.d.ts +70 -0
  15. package/components/ui/combobox.js +315 -0
  16. package/components/ui/command.d.ts +18 -0
  17. package/components/ui/command.js +115 -0
  18. package/components/ui/dialog.d.ts +15 -0
  19. package/components/ui/dialog.js +118 -0
  20. package/components/ui/drawer.d.ts +13 -0
  21. package/components/ui/drawer.js +115 -0
  22. package/components/ui/dropdown-menu.d.ts +25 -0
  23. package/components/ui/dropdown-menu.js +148 -0
  24. package/components/ui/enhanced-table-footer-action.d.ts +34 -0
  25. package/components/ui/enhanced-table-footer-action.js +117 -0
  26. package/components/ui/enhanced-table-footer-page.d.ts +32 -0
  27. package/components/ui/enhanced-table-footer-page.js +140 -0
  28. package/components/ui/enhanced-table-footer-pagination.d.ts +36 -0
  29. package/components/ui/enhanced-table-footer-pagination.js +122 -0
  30. package/components/ui/enhanced-table-header-action.d.ts +7 -0
  31. package/components/ui/enhanced-table-header-action.js +21 -0
  32. package/components/ui/enhanced-table-header-search.d.ts +12 -0
  33. package/components/ui/enhanced-table-header-search.js +17 -0
  34. package/components/ui/enhanced-table.d.ts +65 -0
  35. package/components/ui/enhanced-table.js +87 -0
  36. package/components/ui/form.d.ts +24 -0
  37. package/components/ui/form.js +125 -0
  38. package/components/ui/input.d.ts +8 -0
  39. package/components/ui/input.js +86 -0
  40. package/components/ui/label.d.ts +7 -0
  41. package/components/ui/label.js +68 -0
  42. package/components/ui/popover.d.ts +7 -0
  43. package/components/ui/popover.js +82 -0
  44. package/components/ui/select.d.ts +15 -0
  45. package/components/ui/select.js +127 -0
  46. package/components/ui/separator.d.ts +4 -0
  47. package/components/ui/separator.js +66 -0
  48. package/components/ui/sonner.d.ts +4 -0
  49. package/components/ui/sonner.js +54 -0
  50. package/components/ui/switch.d.ts +9 -0
  51. package/components/ui/switch.js +89 -0
  52. package/components/ui/table.d.ts +10 -0
  53. package/components/ui/table.js +101 -0
  54. package/components/ui/textarea.d.ts +8 -0
  55. package/components/ui/textarea.js +86 -0
  56. package/global-modules/bank/actions.d.ts +200 -0
  57. package/global-modules/bank/actions.js +124 -0
  58. package/global-modules/bank/bank.d.ts +2 -0
  59. package/global-modules/bank/bank.js +87 -0
  60. package/global-modules/bank/constants.d.ts +45 -0
  61. package/global-modules/bank/constants.js +98 -0
  62. package/global-modules/bank/context.d.ts +41 -0
  63. package/global-modules/bank/context.js +419 -0
  64. package/global-modules/bank/drawer.d.ts +31 -0
  65. package/global-modules/bank/drawer.js +114 -0
  66. package/global-modules/bank/form.d.ts +22 -0
  67. package/global-modules/bank/form.js +68 -0
  68. package/global-modules/bank/reducer.d.ts +25 -0
  69. package/global-modules/bank/reducer.js +161 -0
  70. package/global-modules/bank/types.d.ts +217 -0
  71. package/global-modules/bank/types.js +81 -0
  72. package/global-modules/bank/validate.d.ts +13 -0
  73. package/global-modules/bank/validate.js +22 -0
  74. package/global-modules/branch/actions.d.ts +154 -37
  75. package/global-modules/branch/actions.js +148 -6
  76. package/global-modules/branch/branch.d.ts +2 -2
  77. package/global-modules/branch/branch.js +46 -32
  78. package/global-modules/branch/constants.d.ts +34 -24
  79. package/global-modules/branch/constants.js +101 -122
  80. package/global-modules/branch/context.d.ts +33 -2
  81. package/global-modules/branch/context.js +195 -164
  82. package/global-modules/branch/drawer.d.ts +26 -3
  83. package/global-modules/branch/drawer.js +101 -6
  84. package/global-modules/branch/form.d.ts +15 -1
  85. package/global-modules/branch/form.js +54 -71
  86. package/global-modules/branch/reducer.d.ts +23 -2
  87. package/global-modules/branch/reducer.js +148 -118
  88. package/global-modules/branch/types.d.ts +196 -69
  89. package/global-modules/branch/types.js +66 -7
  90. package/global-modules/branch/validate.d.ts +1 -1
  91. package/global-modules/branch/validate.js +15 -11
  92. package/global-modules/payment-mode/actions.d.ts +154 -37
  93. package/global-modules/payment-mode/actions.js +148 -6
  94. package/global-modules/payment-mode/constants.d.ts +34 -17
  95. package/global-modules/payment-mode/constants.js +90 -66
  96. package/global-modules/payment-mode/context.d.ts +33 -2
  97. package/global-modules/payment-mode/context.js +185 -163
  98. package/global-modules/payment-mode/drawer.d.ts +26 -3
  99. package/global-modules/payment-mode/drawer.js +104 -9
  100. package/global-modules/payment-mode/form.d.ts +16 -2
  101. package/global-modules/payment-mode/form.js +45 -74
  102. package/global-modules/payment-mode/payment-mode.d.ts +25 -2
  103. package/global-modules/payment-mode/payment-mode.js +90 -23
  104. package/global-modules/payment-mode/reducer.d.ts +23 -2
  105. package/global-modules/payment-mode/reducer.js +140 -114
  106. package/global-modules/payment-mode/types.d.ts +327 -112
  107. package/global-modules/payment-mode/types.js +162 -11
  108. package/global-modules/payment-mode/validate.d.ts +1 -1
  109. package/global-modules/payment-mode/validate.js +7 -5
  110. package/global-modules/preferences/actions.d.ts +126 -27
  111. package/global-modules/preferences/actions.js +128 -4
  112. package/global-modules/preferences/constants.d.ts +46 -31
  113. package/global-modules/preferences/constants.js +129 -66
  114. package/global-modules/preferences/context.d.ts +2 -2
  115. package/global-modules/preferences/context.js +43 -43
  116. package/global-modules/preferences/currency.js +15 -10
  117. package/global-modules/preferences/preferences.d.ts +2 -2
  118. package/global-modules/preferences/preferences.js +3 -5
  119. package/global-modules/preferences/validate.d.ts +1 -1
  120. package/global-modules/preferences/validate.js +7 -7
  121. package/global-modules/tax/actions.d.ts +155 -38
  122. package/global-modules/tax/actions.js +149 -7
  123. package/global-modules/tax/constants.d.ts +31 -39
  124. package/global-modules/tax/constants.js +83 -114
  125. package/global-modules/tax/context.d.ts +33 -2
  126. package/global-modules/tax/context.js +146 -132
  127. package/global-modules/tax/drawer.d.ts +26 -3
  128. package/global-modules/tax/drawer.js +101 -6
  129. package/global-modules/tax/form.d.ts +20 -3
  130. package/global-modules/tax/form.js +101 -74
  131. package/global-modules/tax/reducer.d.ts +23 -2
  132. package/global-modules/tax/reducer.js +143 -24
  133. package/global-modules/tax/tax.d.ts +25 -2
  134. package/global-modules/tax/tax.js +92 -28
  135. package/global-modules/tax/types.d.ts +332 -102
  136. package/global-modules/tax/types.js +179 -11
  137. package/global-modules/tax/validate.d.ts +1 -1
  138. package/global-modules/tax/validate.js +9 -8
  139. package/hooks/use-rtl.d.ts +44 -0
  140. package/hooks/use-rtl.js +75 -0
  141. package/i18n/navigation.d.ts +340 -0
  142. package/i18n/navigation.js +9 -0
  143. package/i18n/request.d.ts +2 -0
  144. package/i18n/request.js +95 -0
  145. package/i18n/routing.d.ts +18 -0
  146. package/i18n/routing.js +9 -0
  147. package/index.d.ts +26 -0
  148. package/index.js +42 -0
  149. package/lib/themes.d.ts +147 -0
  150. package/lib/themes.js +150 -0
  151. package/lib/toast-utils.d.ts +44 -0
  152. package/lib/toast-utils.js +212 -0
  153. package/lib/utils.d.ts +2 -0
  154. package/lib/utils.js +12 -0
  155. package/package.json +21 -3
  156. package/supabase/supabase.d.ts +80 -1
  157. package/supabase/supabase.js +281 -6
  158. package/global-modules/branch/form-elements.d.ts +0 -3
  159. package/global-modules/branch/form-elements.js +0 -41
  160. package/global-modules/payment-mode/form-elements.d.ts +0 -3
  161. package/global-modules/payment-mode/form-elements.js +0 -41
  162. package/global-modules/preferences/bank.d.ts +0 -2
  163. package/global-modules/preferences/bank.js +0 -11
  164. package/global-modules/preferences/branch-drawer.js +0 -36
  165. package/global-modules/preferences/branch-form-elements.js +0 -30
  166. package/global-modules/preferences/branch-form.d.ts +0 -0
  167. package/global-modules/preferences/branch-form.js +0 -33
  168. package/global-modules/preferences/branch.d.ts +0 -0
  169. package/global-modules/preferences/branch.js +0 -106
  170. package/global-modules/preferences/payment-mode-drawer.d.ts +0 -0
  171. package/global-modules/preferences/payment-mode-drawer.js +0 -36
  172. package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -0
  173. package/global-modules/preferences/payment-mode-form-elements.js +0 -30
  174. package/global-modules/preferences/payment-mode-form.d.ts +0 -0
  175. package/global-modules/preferences/payment-mode-form.js +0 -33
  176. package/global-modules/preferences/payment-mode.d.ts +0 -0
  177. package/global-modules/preferences/payment-mode.js +0 -94
  178. package/global-modules/tax/form-elements.d.ts +0 -3
  179. package/global-modules/tax/form-elements.js +0 -41
  180. /package/{global-modules/preferences/branch-drawer.d.ts → constants.d.ts} +0 -0
  181. /package/{global-modules/preferences/branch-form-elements.d.ts → constants.js} +0 -0
@@ -1,106 +0,0 @@
1
- // import React from "react";
2
- // import { VistaTableV1 } from "@appcorp/app-corp-vista/organisms/vista-table-v1/vista-table-v1";
3
- // import { PaymentModeDrawer } from "./payment-mode-drawer";
4
- // import { VistaToaster } from "@appcorp/app-corp-vista/utils/generate-toast";
5
- // import { useTranslations } from "next-intl";
6
- // import { usePreferenceStateContext } from "./context";
7
- // import {
8
- // calculatePages,
9
- // getAvailablePageLimits,
10
- // isNextButtonDisabled,
11
- // isPreviousButtonDisabled,
12
- // } from "@react-pakistan/util-functions";
13
- // import { branchTableBodyCols } from "./constants";
14
- // export const Branch = () => {
15
- // const {
16
- // branchCount,
17
- // branchPageLimit,
18
- // branchSearchQuery,
19
- // branches,
20
- // branchListLoading,
21
- // branchHeaderActions,
22
- // branchRowActions,
23
- // branchCurrentPage,
24
- // } = usePreferenceStateContext();
25
- // const t = useTranslations('branchPage');
26
- // const translationMap = {
27
- // formLabelName: t('formLabelName'),
28
- // formLabelCountry: t('formLabelCountry'),
29
- // formLabelPhone: t('formLabelPhone'),
30
- // formLabelWebsite: t('formLabelWebsite'),
31
- // formLabelEmail: t('formLabelEmail'),
32
- // };
33
- // const tableHeadItems = [
34
- // {
35
- // label: t('tableColumnHeaderId'),
36
- // width: '5%',
37
- // },
38
- // {
39
- // label: t('tableColumnHeaderBranchName'),
40
- // width: '15%',
41
- // },
42
- // {
43
- // label: t('tableColumnHeaderBranchAddress'),
44
- // width: '15%',
45
- // },
46
- // {
47
- // label: t('tableColumnHeaderEnabled'),
48
- // width: '10%',
49
- // },
50
- // {
51
- // label: t('tableColumnHeaderIsDefault'),
52
- // width: '10%',
53
- // },
54
- // {
55
- // label: t('tableColumnHeaderPersonName'),
56
- // width: '20%',
57
- // },
58
- // {
59
- // label: t('tableColumnHeaderEmailPhone'),
60
- // width: '10%',
61
- // },
62
- // {
63
- // label: t('tableColumnHeaderActivity'),
64
- // width: '10%',
65
- // },
66
- // {
67
- // label: t('tableColumnHeaderActions'),
68
- // width: '5%',
69
- // },
70
- // ];
71
- // const totalPages = calculatePages(branchCount, branchPageLimit);
72
- // return (
73
- // <>
74
- // <VistaTableV1
75
- // currentPage={branchCount}
76
- // handleNextOnClick={() => void 0}
77
- // handleOnSelect={() => void 0}
78
- // handlePreviousOnClick={() => void 0}
79
- // handleSearchInput={() => void 0}
80
- // headerActions={branchHeaderActions}
81
- // isNextDisabled={isNextButtonDisabled(branchCurrentPage, totalPages)}
82
- // isPreviousDisabled={isPreviousButtonDisabled(branchCurrentPage)}
83
- // listOptions={getAvailablePageLimits(branchCount)}
84
- // loading={branchListLoading}
85
- // nodeSelectKey="branchPageLimit"
86
- // pageLimit={branchPageLimit}
87
- // rowActions={branchRowActions}
88
- // searchDisabled={false}
89
- // searchEnabled
90
- // searchId="branch-search"
91
- // searchPlaceholder={t('tableHeaderSearchPlaceholder')}
92
- // searchValue={branchSearchQuery}
93
- // selectKey1="option"
94
- // selectedItem={{ option: String(branchPageLimit) }}
95
- // tableBodyCols={branchTableBodyCols}
96
- // tableBodyRows={branches}
97
- // tableDescription={t('tableDescription')}
98
- // tableHeadItems={tableHeadItems}
99
- // tableHeading={t('tableTitle')}
100
- // totalPages={totalPages}
101
- // />
102
- // <PaymentModeDrawer translationMap={translationMap} />
103
- // <VistaToaster />
104
- // </>
105
- // );
106
- // };
@@ -1,36 +0,0 @@
1
- // import React, { FC } from 'react';
2
- // import { VistaDrawerV1 } from '@appcorp/app-corp-vista/molecules/vista-drawer-v1/vista-drawer-v1';
3
- // import { VISTA_DRAWER_SIZE } from '@appcorp/app-corp-vista/type/vista-drawer-type';
4
- // import { VISTA_BUTTON_ROUNDED, VISTA_BUTTON_SIZE } from '@appcorp/app-corp-vista/type/vista-button-type';
5
- // import { usePreferenceStateContext } from './context';
6
- // import { PaymentModeForm } from './payment-mode-form';
7
- // interface Props {
8
- // translationMap: { [key: string]: string };
9
- // }
10
- // export const PaymentModeDrawer: FC<Props> = ({ translationMap }) => {
11
- // const {
12
- // closeDrawer,
13
- // paymentModeDisableSaveButton,
14
- // paymentModeDrawer,
15
- // handlePaymentModeSubmit,
16
- // } = usePreferenceStateContext();
17
- // return (
18
- // <VistaDrawerV1
19
- // cancelLabel="Cancel"
20
- // cancelRounded={VISTA_BUTTON_ROUNDED.MD}
21
- // cancelSize={VISTA_BUTTON_SIZE.LG}
22
- // handleCancelOnClick={closeDrawer}
23
- // handleSaveOnClick={handlePaymentModeSubmit}
24
- // handleSetIsOpen={closeDrawer}
25
- // isOpen={!!paymentModeDrawer}
26
- // saveDisabled={paymentModeDisableSaveButton}
27
- // saveLabel='Save'
28
- // saveRounded={VISTA_BUTTON_ROUNDED.MD}
29
- // saveSize={VISTA_BUTTON_SIZE.LG}
30
- // size={VISTA_DRAWER_SIZE.MD}
31
- // title='Payment Mode'
32
- // >
33
- // <PaymentModeForm translationMap={translationMap} />
34
- // </VistaDrawerV1>
35
- // );
36
- // };
@@ -1,30 +0,0 @@
1
- // /* eslint-disable */
2
- // import React from 'react';
3
- // import { vistaFormSchema } from '@appcorp/app-corp-vista/utils/form-schema';
4
- // import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
5
- // export const renderPaymentModeFormElements = (
6
- // elementProps: VistaFormElements,
7
- // ) => {
8
- // const elementsArray = Object.entries(vistaFormSchema)
9
- // .flatMap(([key, config]) => {
10
- // const Component = config;
11
- // return (elementProps[key as keyof VistaFormElements] || [])
12
- // ?.filter((props: any) => props.enabled)
13
- // ?.map((props: any) => ({
14
- // Component,
15
- // key,
16
- // order: props.order,
17
- // props,
18
- // }));
19
- // })
20
- // ?.sort((a, b) => a.order - b.order);
21
- // return (
22
- // <div className="grid grid-cols-1 gap-4">
23
- // {elementsArray?.map(({ key, Component, props }, index) => (
24
- // <div key={`${key}-${index}`}>
25
- // <Component {...props} />
26
- // </div>
27
- // ))}
28
- // </div>
29
- // );
30
- // };
File without changes
@@ -1,33 +0,0 @@
1
- // import React, { FC, useMemo } from 'react';
2
- // import { VistaTextInputV1Props } from '@appcorp/app-corp-vista/type/vista-text-input-type';
3
- // import { VISTA_FORM_ELEMENTS } from '@appcorp/app-corp-vista/utils/form-schema';
4
- // import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
5
- // import { usePreferenceStateContext } from './context';
6
- // import { renderPaymentModeFormElements } from './payment-mode-form-elements';
7
- // import { VistaComboboxV1Props } from '@appcorp/app-corp-vista/type/vista-combobox-type';
8
- // interface Props {
9
- // translationMap: {[key: string]: string};
10
- // }
11
- // export const PaymentModeForm: FC<Props> = ({ translationMap }) => {
12
- // const { paymentModeDynamicFormElements } = usePreferenceStateContext();
13
- // const updated = useMemo(() => {
14
- // const elements: VistaFormElements = { ...paymentModeDynamicFormElements };
15
- // const textInputElements: VistaTextInputV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]?.sort((a, b) => a.order - b.order);
16
- // if (textInputElements) {
17
- // textInputElements?.forEach(({ label }, i) => {
18
- // if (translationMap[label as string] === undefined) return label;
19
- // textInputElements[i].label = translationMap[label as string];
20
- // });
21
- // }
22
- // const comboboxElements: VistaComboboxV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.COMBOBOX_V1]?.sort((a, b) => a.order - b.order);
23
- // if (comboboxElements) {
24
- // comboboxElements?.forEach(({ label }, i) => {
25
- // if (translationMap[label as string] === undefined) return label;
26
- // comboboxElements[i].label = translationMap[label];
27
- // });
28
- // }
29
- // return elements;
30
- // // eslint-disable-next-line
31
- // }, []);
32
- // return <>{renderPaymentModeFormElements(updated)}</>;
33
- // };
File without changes
@@ -1,94 +0,0 @@
1
- // import React from "react";
2
- // import { VistaTableV1 } from "@appcorp/app-corp-vista/organisms/vista-table-v1/vista-table-v1";
3
- // import { PaymentModeDrawer } from "./payment-mode-drawer";
4
- // import { VistaToaster } from "@appcorp/app-corp-vista/utils/generate-toast";
5
- // import { useTranslations } from "next-intl";
6
- // import { usePreferenceStateContext } from "./context";
7
- // import {
8
- // calculatePages,
9
- // getAvailablePageLimits,
10
- // isNextButtonDisabled,
11
- // isPreviousButtonDisabled,
12
- // } from "@react-pakistan/util-functions";
13
- // import { paymentModeTableBodyCols } from "./constants";
14
- // export const PaymentMode = () => {
15
- // const {
16
- // paymentModeCount,
17
- // paymentModePageLimit,
18
- // paymentModeSearchQuery,
19
- // paymentModes,
20
- // paymentModeListLoading,
21
- // paymentModeHeaderActions,
22
- // paymentModeRowActions,
23
- // paymentModeCurrentPage,
24
- // } = usePreferenceStateContext();
25
- // const t = useTranslations('paymentModePage');
26
- // const translationMap = {
27
- // formLabelName: t('formLabelName'),
28
- // formLabelCountry: t('formLabelCountry'),
29
- // formLabelPhone: t('formLabelPhone'),
30
- // formLabelWebsite: t('formLabelWebsite'),
31
- // formLabelEmail: t('formLabelEmail'),
32
- // };
33
- // const tableHeadItems = [
34
- // {
35
- // label: t('tableColumnHeaderId'),
36
- // width: '5%',
37
- // },
38
- // {
39
- // label: t('tableColumnHeaderLabel'),
40
- // width: '30%',
41
- // },
42
- // {
43
- // label: t('tableColumnHeaderEnabled'),
44
- // width: '20%',
45
- // },
46
- // {
47
- // label: t('tableColumnHeaderIsDefault'),
48
- // width: '20%',
49
- // },
50
- // {
51
- // label: t('tableColumnHeaderActivity'),
52
- // width: '20%',
53
- // },
54
- // {
55
- // label: t('tableColumnHeaderActions'),
56
- // width: '5%',
57
- // },
58
- // ];
59
- // const totalPages = calculatePages(paymentModeCount, paymentModePageLimit);
60
- // return (
61
- // <>
62
- // <VistaTableV1
63
- // currentPage={paymentModeCount}
64
- // handleNextOnClick={() => void 0}
65
- // handleOnSelect={() => void 0}
66
- // handlePreviousOnClick={() => void 0}
67
- // handleSearchInput={() => void 0}
68
- // headerActions={paymentModeHeaderActions}
69
- // isNextDisabled={isNextButtonDisabled(paymentModeCurrentPage, totalPages)}
70
- // isPreviousDisabled={isPreviousButtonDisabled(paymentModeCurrentPage)}
71
- // listOptions={getAvailablePageLimits(paymentModeCount)}
72
- // loading={paymentModeListLoading}
73
- // nodeSelectKey="paymentModePageLimit"
74
- // pageLimit={paymentModePageLimit}
75
- // rowActions={paymentModeRowActions}
76
- // searchDisabled={false}
77
- // searchEnabled
78
- // searchId="payment-mode-search"
79
- // searchPlaceholder={t('tableHeaderSearchPlaceholder')}
80
- // searchValue={paymentModeSearchQuery}
81
- // selectKey1="option"
82
- // selectedItem={{ option: String(paymentModePageLimit) }}
83
- // tableBodyCols={paymentModeTableBodyCols}
84
- // tableBodyRows={paymentModes}
85
- // tableDescription={t('tableDescription')}
86
- // tableHeadItems={tableHeadItems}
87
- // tableHeading={t('tableTitle')}
88
- // totalPages={totalPages}
89
- // />
90
- // <PaymentModeDrawer translationMap={translationMap} />
91
- // <VistaToaster />
92
- // </>
93
- // );
94
- // };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
3
- export declare const renderFormElements: (elementProps: VistaFormElements) => React.JSX.Element;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.renderFormElements = void 0;
19
- var react_1 = __importDefault(require("react"));
20
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
21
- var renderFormElements = function (elementProps) {
22
- var _a;
23
- var elementsArray = (_a = Object.entries(form_schema_1.vistaFormSchema)
24
- .flatMap(function (_a) {
25
- var _b, _c;
26
- var key = _a[0], config = _a[1];
27
- var Component = config;
28
- return (_c = (_b = (elementProps[key] || [])) === null || _b === void 0 ? void 0 : _b.filter(function (props) { return props.enabled; })) === null || _c === void 0 ? void 0 : _c.map(function (props) { return ({
29
- Component: Component,
30
- key: key,
31
- order: props.order,
32
- props: props,
33
- }); });
34
- })) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
35
- return (react_1.default.createElement("div", { className: "grid grid-cols-1 gap-4" }, elementsArray === null || elementsArray === void 0 ? void 0 : elementsArray.map(function (_a, index) {
36
- var key = _a.key, Component = _a.Component, props = _a.props;
37
- return (react_1.default.createElement("div", { key: "".concat(key, "-").concat(index) },
38
- react_1.default.createElement(Component, __assign({}, props))));
39
- })));
40
- };
41
- exports.renderFormElements = renderFormElements;