@appcorp/stellar-solutions-modules 0.1.15 → 0.1.16

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 (28) hide show
  1. package/global-modules/branch/context.js +7 -7
  2. package/global-modules/payment-mode/context.js +7 -7
  3. package/global-modules/preferences/actions.d.ts +2 -141
  4. package/global-modules/preferences/actions.js +0 -22
  5. package/global-modules/preferences/branch-drawer.d.ts +0 -8
  6. package/global-modules/preferences/branch-drawer.js +36 -19
  7. package/global-modules/preferences/branch-form-elements.d.ts +0 -3
  8. package/global-modules/preferences/branch-form-elements.js +30 -41
  9. package/global-modules/preferences/branch-form.d.ts +0 -8
  10. package/global-modules/preferences/branch-form.js +33 -81
  11. package/global-modules/preferences/branch.d.ts +0 -2
  12. package/global-modules/preferences/branch.js +106 -69
  13. package/global-modules/preferences/constants.d.ts +0 -29
  14. package/global-modules/preferences/constants.js +1 -302
  15. package/global-modules/preferences/context.js +5 -582
  16. package/global-modules/preferences/payment-mode-drawer.d.ts +0 -8
  17. package/global-modules/preferences/payment-mode-drawer.js +36 -19
  18. package/global-modules/preferences/payment-mode-form-elements.d.ts +0 -3
  19. package/global-modules/preferences/payment-mode-form-elements.js +30 -41
  20. package/global-modules/preferences/payment-mode-form.d.ts +0 -8
  21. package/global-modules/preferences/payment-mode-form.js +33 -81
  22. package/global-modules/preferences/payment-mode.d.ts +0 -2
  23. package/global-modules/preferences/payment-mode.js +94 -57
  24. package/global-modules/preferences/preferences.js +2 -1
  25. package/global-modules/preferences/reducer.js +6 -162
  26. package/global-modules/preferences/types.d.ts +0 -46
  27. package/global-modules/tax/context.js +7 -11
  28. package/package.json +1 -1
@@ -102,7 +102,7 @@ var validate_1 = require("./validate");
102
102
  var context_1 = require("../preferences/context");
103
103
  var useBranchState = function () {
104
104
  var _a = (0, react_1.useReducer)(reducer_1.branchReducer, reducer_1.initialBranchState), state = _a[0], dispatch = _a[1];
105
- var preferences = (0, context_1.usePreferenceStateContext)().preferences;
105
+ var _b = (0, context_1.usePreferenceStateContext)(), preferences = _b.preferences, activeTab = _b.activeTab;
106
106
  // const { products } = useProductStateContext();
107
107
  // const { companies } = useCompanyStateContext();
108
108
  var debouncedQuery = (0, util_functions_1.useDebounce)(state.searchQuery, 800);
@@ -211,7 +211,7 @@ var useBranchState = function () {
211
211
  listFetchNow();
212
212
  }
213
213
  };
214
- var _b = (0, util_functions_1.useModuleEntity)({
214
+ var _c = (0, util_functions_1.useModuleEntity)({
215
215
  byIdCallback: byIdCallback,
216
216
  byIdParams: byIdParams,
217
217
  deleteCallback: deleteCallback,
@@ -225,21 +225,21 @@ var useBranchState = function () {
225
225
  updateCallback: updateCallback,
226
226
  updateDeps: [state],
227
227
  updateParams: updateParams,
228
- }), byIdError = _b.byIdError, byIdFetchNow = _b.byIdFetchNow, byIdLoading = _b.byIdLoading, deleteError = _b.deleteError, deleteFetchNow = _b.deleteFetchNow, deleteLoading = _b.deleteLoading, listError = _b.listError, listFetchNow = _b.listFetchNow, listLoading = _b.listLoading, updateError = _b.updateError, updateFetchNow = _b.updateFetchNow, updateLoading = _b.updateLoading;
228
+ }), byIdError = _c.byIdError, byIdFetchNow = _c.byIdFetchNow, byIdLoading = _c.byIdLoading, deleteError = _c.deleteError, deleteFetchNow = _c.deleteFetchNow, deleteLoading = _c.deleteLoading, listError = _c.listError, listFetchNow = _c.listFetchNow, listLoading = _c.listLoading, updateError = _c.updateError, updateFetchNow = _c.updateFetchNow, updateLoading = _c.updateLoading;
229
229
  (0, react_1.useEffect)(function () {
230
230
  // listFetchNow();
231
231
  // currencyListFetchNow();
232
232
  // paymentModeListFetchNow();
233
233
  // branchListFetchNow();
234
- // if (state.activeTab === 'Tax') {
235
- listFetchNow();
236
- // }
234
+ if (activeTab === 'Branch') {
235
+ listFetchNow();
236
+ }
237
237
  // eslint-disable-next-line
238
238
  }, [
239
239
  debouncedQuery,
240
240
  state.currentPage,
241
241
  state.pageLimit,
242
- // state.activeTab,
242
+ activeTab,
243
243
  ]);
244
244
  var searchOnChange = function (k, v) {
245
245
  dispatch({
@@ -102,7 +102,7 @@ var validate_1 = require("./validate");
102
102
  var context_1 = require("../preferences/context");
103
103
  var usePaymentModeState = function () {
104
104
  var _a = (0, react_1.useReducer)(reducer_1.paymentModeReducer, reducer_1.initialPaymentModeState), state = _a[0], dispatch = _a[1];
105
- var preferences = (0, context_1.usePreferenceStateContext)().preferences;
105
+ var _b = (0, context_1.usePreferenceStateContext)(), preferences = _b.preferences, activeTab = _b.activeTab;
106
106
  // const { products } = useProductStateContext();
107
107
  // const { companies } = useCompanyStateContext();
108
108
  var debouncedQuery = (0, util_functions_1.useDebounce)(state.searchQuery, 800);
@@ -207,7 +207,7 @@ var usePaymentModeState = function () {
207
207
  listFetchNow();
208
208
  }
209
209
  };
210
- var _b = (0, util_functions_1.useModuleEntity)({
210
+ var _c = (0, util_functions_1.useModuleEntity)({
211
211
  byIdCallback: byIdCallback,
212
212
  byIdParams: byIdParams,
213
213
  deleteCallback: deleteCallback,
@@ -221,21 +221,21 @@ var usePaymentModeState = function () {
221
221
  updateCallback: updateCallback,
222
222
  updateDeps: [state],
223
223
  updateParams: updateParams,
224
- }), byIdError = _b.byIdError, byIdFetchNow = _b.byIdFetchNow, byIdLoading = _b.byIdLoading, deleteError = _b.deleteError, deleteFetchNow = _b.deleteFetchNow, deleteLoading = _b.deleteLoading, listError = _b.listError, listFetchNow = _b.listFetchNow, listLoading = _b.listLoading, updateError = _b.updateError, updateFetchNow = _b.updateFetchNow, updateLoading = _b.updateLoading;
224
+ }), byIdError = _c.byIdError, byIdFetchNow = _c.byIdFetchNow, byIdLoading = _c.byIdLoading, deleteError = _c.deleteError, deleteFetchNow = _c.deleteFetchNow, deleteLoading = _c.deleteLoading, listError = _c.listError, listFetchNow = _c.listFetchNow, listLoading = _c.listLoading, updateError = _c.updateError, updateFetchNow = _c.updateFetchNow, updateLoading = _c.updateLoading;
225
225
  (0, react_1.useEffect)(function () {
226
226
  // listFetchNow();
227
227
  // currencyListFetchNow();
228
228
  // paymentModeListFetchNow();
229
229
  // branchListFetchNow();
230
- // if (state.activeTab === 'Tax') {
231
- listFetchNow();
232
- // }
230
+ if (activeTab === 'Tax') {
231
+ listFetchNow();
232
+ }
233
233
  // eslint-disable-next-line
234
234
  }, [
235
235
  debouncedQuery,
236
236
  state.currentPage,
237
237
  state.pageLimit,
238
- // state.activeTab,
238
+ activeTab,
239
239
  ]);
240
240
  var searchOnChange = function (k, v) {
241
241
  dispatch({
@@ -1,34 +1,13 @@
1
- import { BankDetails, Branches, CurrencyTypeBE, PreferenceState, PaymentModeTypeBE, Tax, BranchTypeBE, TaxTypeBE, PREFERENCE_DRAWER, PreferenceTypeBE } from './types';
1
+ import { CurrencyTypeBE, PreferenceState, PreferenceTypeBE } from './types';
2
2
  export declare enum PREFERENCE_ACTION_TYPES {
3
- CLEAR_BANK_DETAILS = "CLEAR_BANK_DETAILS",
4
- CLEAR_BRANCHES = "CLEAR_BRANCHES",
5
3
  CLEAR_ERRORS = "CLEAR_ERRORS",
6
- CLEAR_TAXES = "CLEAR_TAXES",
7
4
  RESET_FORM = "RESET_FORM",
8
5
  SET_ACTIVE_TAB = "SET_ACTIVE_TAB",
9
- SET_BRANCHES = "SET_BRANCHES",
10
- SET_BRANCH_BTN_DISABLE = "SET_BRANCH_BTN_DISABLE",
11
- SET_BRANCH_COUNT = "SET_BRANCH_COUNT",
12
6
  SET_CURRENCIES = "SET_CURRENCIES",
13
7
  SET_CURRENCY_UPDATE_ID = "SET_CURRENCY_UPDATE_ID",
14
- SET_DISABLE_TAX_SAVE_BUTTON = "SET_DISABLE_TAX_SAVE_BUTTON",
15
8
  SET_ERRORS = "SET_ERRORS",
16
- SET_PAYMENT_MODES = "SET_PAYMENT_MODES",
17
- SET_PAYMENT_MODE_COUNT = "SET_PAYMENT_MODE_COUNT",
18
9
  SET_PREFERENCE = "SET_PREFERENCE",
19
10
  SET_PREFERENCES = "SET_PREFERENCES",
20
- SET_TAXES = "SET_TAXES",
21
- SET_TAX_BTN_DISABLE = "SET_TAX_BTN_DISABLE",
22
- SET_TAX_COUNT = "SET_TAX_COUNT",
23
- SET_TAX_CURRENT_PAGE = "SET_TAX_CURRENT_PAGE",
24
- SET_TAX_PAGE_LIMIT = "SET_TAX_PAGE_LIMIT",
25
- SET_TAX_DRAWER = "SET_TAX_DRAWER",
26
- SET_TAX_FORM = "SET_TAX_FORM",
27
- SET_TAX_INPUT_FIELD = "SET_TAX_INPUT_FIELD",
28
- UPDATE_BANK_FIELDS = "UPDATE_BANK_FIELDS",
29
- UPDATE_BRANCH_FIELDS = "UPDATE_BRANCH_FIELDS",
30
- UPDATE_PREFERENCE_FIELDS = "UPDATE_PREFERENCE_FIELDS",
31
- UPDATE_TAX_FIELDS = "UPDATE_TAX_FIELDS",
32
11
  SET_COUNT = "SET_COUNT"
33
12
  }
34
13
  export type PreferenceSetPreferencesAction = {
@@ -43,63 +22,12 @@ export type PreferenceSetCountAction = {
43
22
  count: number;
44
23
  };
45
24
  };
46
- export type PreferenceSetPaymentModeAction = {
47
- type: PREFERENCE_ACTION_TYPES.SET_PAYMENT_MODES;
48
- payload: {
49
- paymentModes: PaymentModeTypeBE[];
50
- };
51
- };
52
25
  export type PreferenceSetCurrenciesAction = {
53
26
  type: PREFERENCE_ACTION_TYPES.SET_CURRENCIES;
54
27
  payload: {
55
28
  currencies: CurrencyTypeBE[];
56
29
  };
57
30
  };
58
- export type PreferenceTaxButtonAction = {
59
- type: PREFERENCE_ACTION_TYPES.SET_TAX_BTN_DISABLE;
60
- payload: boolean;
61
- };
62
- export type PreferenceBranchButtonAction = {
63
- type: PREFERENCE_ACTION_TYPES.SET_BRANCH_BTN_DISABLE;
64
- payload: boolean;
65
- };
66
- export type PreferenceClearFieldTaxAction = {
67
- type: PREFERENCE_ACTION_TYPES.CLEAR_TAXES;
68
- };
69
- export type PreferenceClearFieldBankAction = {
70
- type: PREFERENCE_ACTION_TYPES.CLEAR_BANK_DETAILS;
71
- };
72
- export type PreferenceClearFieldBranchAction = {
73
- type: PREFERENCE_ACTION_TYPES.CLEAR_BRANCHES;
74
- };
75
- export type PreferenceSetUpdateFieldAction = {
76
- type: PREFERENCE_ACTION_TYPES.UPDATE_PREFERENCE_FIELDS;
77
- payload: {
78
- field: keyof PreferenceState;
79
- value: string | string[] | boolean | number;
80
- };
81
- };
82
- export type PreferenceSetUpdateBankFieldAction = {
83
- type: PREFERENCE_ACTION_TYPES.UPDATE_BANK_FIELDS;
84
- payload: {
85
- field: keyof BankDetails;
86
- value: string | string[] | boolean | number;
87
- };
88
- };
89
- export type PreferenceSetUpdateBranchFieldAction = {
90
- type: PREFERENCE_ACTION_TYPES.UPDATE_BRANCH_FIELDS;
91
- payload: {
92
- field: keyof Branches;
93
- value: string | string[] | boolean | number;
94
- };
95
- };
96
- export type PreferenceSetUpdateTaxFieldAction = {
97
- type: PREFERENCE_ACTION_TYPES.UPDATE_TAX_FIELDS;
98
- payload: {
99
- field: keyof Tax;
100
- value: string | string[] | boolean | number;
101
- };
102
- };
103
31
  export type PreferenceSetErrorsAction = {
104
32
  type: PREFERENCE_ACTION_TYPES.SET_ERRORS;
105
33
  payload: {
@@ -127,74 +55,7 @@ export type PreferenceCurrencyUpdateIdAction = {
127
55
  currencyUpdateId: string;
128
56
  };
129
57
  };
130
- export type PreferencePaymentModeCountAction = {
131
- type: PREFERENCE_ACTION_TYPES.SET_PAYMENT_MODE_COUNT;
132
- payload: {
133
- paymentModeCount: number;
134
- };
135
- };
136
- export type PreferenceSetBranchesAction = {
137
- type: PREFERENCE_ACTION_TYPES.SET_BRANCHES;
138
- payload: {
139
- branches: BranchTypeBE[];
140
- };
141
- };
142
- export type PreferenceBranchCountAction = {
143
- type: PREFERENCE_ACTION_TYPES.SET_BRANCH_COUNT;
144
- payload: {
145
- branchCount: number;
146
- };
147
- };
148
- export type PreferenceSetTaxCountAction = {
149
- type: PREFERENCE_ACTION_TYPES.SET_TAX_COUNT;
150
- payload: {
151
- taxCount: number;
152
- };
153
- };
154
- export type PreferenceSetTaxesAction = {
155
- type: PREFERENCE_ACTION_TYPES.SET_TAXES;
156
- payload: {
157
- taxes: TaxTypeBE[];
158
- };
159
- };
160
- export type PreferenceSetTaxFormAction = {
161
- type: PREFERENCE_ACTION_TYPES.SET_TAX_FORM;
162
- payload: {
163
- taxForm: TaxTypeBE;
164
- };
165
- };
166
- export type PreferenceSetTaxDrawerAction = {
167
- type: PREFERENCE_ACTION_TYPES.SET_TAX_DRAWER;
168
- payload: {
169
- taxDrawer: null | PREFERENCE_DRAWER;
170
- };
171
- };
172
- export type PreferenceSetTaxInputFieldAction = {
173
- type: PREFERENCE_ACTION_TYPES.SET_TAX_INPUT_FIELD;
174
- payload: {
175
- key: keyof TaxTypeBE;
176
- value: string | string[] | boolean | number | number[];
177
- };
178
- };
179
- export type PreferenceSetDisableTaxSaveButtonAction = {
180
- type: PREFERENCE_ACTION_TYPES.SET_DISABLE_TAX_SAVE_BUTTON;
181
- payload: {
182
- disableTaxSaveButton: boolean;
183
- };
184
- };
185
58
  export type PreferenceClearErrorsAction = {
186
59
  type: PREFERENCE_ACTION_TYPES.CLEAR_ERRORS;
187
60
  };
188
- export type PreferenceSetTaxCurrentPageAction = {
189
- type: PREFERENCE_ACTION_TYPES.SET_TAX_CURRENT_PAGE;
190
- payload: {
191
- taxCurrentPage: number;
192
- };
193
- };
194
- export type PreferenceSetTaxPageLimitAction = {
195
- type: PREFERENCE_ACTION_TYPES.SET_TAX_PAGE_LIMIT;
196
- payload: {
197
- taxPageLimit: number;
198
- };
199
- };
200
- export type PreferenceActions = PreferenceSetUpdateBranchFieldAction | PreferenceSetUpdateTaxFieldAction | PreferenceSetUpdateBankFieldAction | PreferenceSetPreferenceDataAction | PreferenceSetPaymentModeAction | PreferenceSetCurrenciesAction | PreferenceTaxButtonAction | PreferenceSetErrorsAction | PreferenceBranchButtonAction | PreferenceClearFieldTaxAction | PreferenceClearFieldBankAction | PreferenceClearFieldBranchAction | PreferenceSetUpdateFieldAction | PreferenceSetActiveTabAction | PreferenceResetStateAction | PreferenceCurrencyUpdateIdAction | PreferencePaymentModeCountAction | PreferenceSetBranchesAction | PreferenceBranchCountAction | PreferenceSetTaxCountAction | PreferenceSetTaxesAction | PreferenceSetTaxFormAction | PreferenceSetTaxDrawerAction | PreferenceSetTaxInputFieldAction | PreferenceSetDisableTaxSaveButtonAction | PreferenceClearErrorsAction | PreferenceSetTaxCurrentPageAction | PreferenceSetTaxPageLimitAction | PreferenceSetPreferencesAction | PreferenceSetCountAction;
61
+ export type PreferenceActions = PreferenceSetPreferenceDataAction | PreferenceSetCurrenciesAction | PreferenceSetErrorsAction | PreferenceSetActiveTabAction | PreferenceResetStateAction | PreferenceCurrencyUpdateIdAction | PreferenceClearErrorsAction | PreferenceSetPreferencesAction | PreferenceSetCountAction;
@@ -3,35 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PREFERENCE_ACTION_TYPES = void 0;
4
4
  var PREFERENCE_ACTION_TYPES;
5
5
  (function (PREFERENCE_ACTION_TYPES) {
6
- // SET_BANK_BTN_DISABLE = 'SET_BANK_BTN_DISABLE',
7
- PREFERENCE_ACTION_TYPES["CLEAR_BANK_DETAILS"] = "CLEAR_BANK_DETAILS";
8
- PREFERENCE_ACTION_TYPES["CLEAR_BRANCHES"] = "CLEAR_BRANCHES";
9
6
  PREFERENCE_ACTION_TYPES["CLEAR_ERRORS"] = "CLEAR_ERRORS";
10
- PREFERENCE_ACTION_TYPES["CLEAR_TAXES"] = "CLEAR_TAXES";
11
7
  PREFERENCE_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
12
8
  PREFERENCE_ACTION_TYPES["SET_ACTIVE_TAB"] = "SET_ACTIVE_TAB";
13
- PREFERENCE_ACTION_TYPES["SET_BRANCHES"] = "SET_BRANCHES";
14
- PREFERENCE_ACTION_TYPES["SET_BRANCH_BTN_DISABLE"] = "SET_BRANCH_BTN_DISABLE";
15
- PREFERENCE_ACTION_TYPES["SET_BRANCH_COUNT"] = "SET_BRANCH_COUNT";
16
9
  PREFERENCE_ACTION_TYPES["SET_CURRENCIES"] = "SET_CURRENCIES";
17
10
  PREFERENCE_ACTION_TYPES["SET_CURRENCY_UPDATE_ID"] = "SET_CURRENCY_UPDATE_ID";
18
- PREFERENCE_ACTION_TYPES["SET_DISABLE_TAX_SAVE_BUTTON"] = "SET_DISABLE_TAX_SAVE_BUTTON";
19
11
  PREFERENCE_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
20
- PREFERENCE_ACTION_TYPES["SET_PAYMENT_MODES"] = "SET_PAYMENT_MODES";
21
- PREFERENCE_ACTION_TYPES["SET_PAYMENT_MODE_COUNT"] = "SET_PAYMENT_MODE_COUNT";
22
12
  PREFERENCE_ACTION_TYPES["SET_PREFERENCE"] = "SET_PREFERENCE";
23
13
  PREFERENCE_ACTION_TYPES["SET_PREFERENCES"] = "SET_PREFERENCES";
24
- PREFERENCE_ACTION_TYPES["SET_TAXES"] = "SET_TAXES";
25
- PREFERENCE_ACTION_TYPES["SET_TAX_BTN_DISABLE"] = "SET_TAX_BTN_DISABLE";
26
- PREFERENCE_ACTION_TYPES["SET_TAX_COUNT"] = "SET_TAX_COUNT";
27
- PREFERENCE_ACTION_TYPES["SET_TAX_CURRENT_PAGE"] = "SET_TAX_CURRENT_PAGE";
28
- PREFERENCE_ACTION_TYPES["SET_TAX_PAGE_LIMIT"] = "SET_TAX_PAGE_LIMIT";
29
- PREFERENCE_ACTION_TYPES["SET_TAX_DRAWER"] = "SET_TAX_DRAWER";
30
- PREFERENCE_ACTION_TYPES["SET_TAX_FORM"] = "SET_TAX_FORM";
31
- PREFERENCE_ACTION_TYPES["SET_TAX_INPUT_FIELD"] = "SET_TAX_INPUT_FIELD";
32
- PREFERENCE_ACTION_TYPES["UPDATE_BANK_FIELDS"] = "UPDATE_BANK_FIELDS";
33
- PREFERENCE_ACTION_TYPES["UPDATE_BRANCH_FIELDS"] = "UPDATE_BRANCH_FIELDS";
34
- PREFERENCE_ACTION_TYPES["UPDATE_PREFERENCE_FIELDS"] = "UPDATE_PREFERENCE_FIELDS";
35
- PREFERENCE_ACTION_TYPES["UPDATE_TAX_FIELDS"] = "UPDATE_TAX_FIELDS";
36
14
  PREFERENCE_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
37
15
  })(PREFERENCE_ACTION_TYPES || (exports.PREFERENCE_ACTION_TYPES = PREFERENCE_ACTION_TYPES = {}));
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- interface Props {
3
- translationMap: {
4
- [key: string]: string;
5
- };
6
- }
7
- export declare const BranchDrawer: FC<Props>;
8
- export {};
@@ -1,19 +1,36 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BranchDrawer = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- var vista_drawer_v1_1 = require("@appcorp/app-corp-vista/molecules/vista-drawer-v1/vista-drawer-v1");
9
- var vista_drawer_type_1 = require("@appcorp/app-corp-vista/type/vista-drawer-type");
10
- var vista_button_type_1 = require("@appcorp/app-corp-vista/type/vista-button-type");
11
- var context_1 = require("./context");
12
- var branch_form_1 = require("./branch-form");
13
- var BranchDrawer = function (_a) {
14
- var translationMap = _a.translationMap;
15
- var _b = (0, context_1.usePreferenceStateContext)(), closeDrawer = _b.closeDrawer, branchDisableSaveButton = _b.branchDisableSaveButton, branchDrawer = _b.branchDrawer, handleBranchSubmit = _b.handleBranchSubmit;
16
- return (react_1.default.createElement(vista_drawer_v1_1.VistaDrawerV1, { cancelLabel: "Cancel", cancelRounded: vista_button_type_1.VISTA_BUTTON_ROUNDED.MD, cancelSize: vista_button_type_1.VISTA_BUTTON_SIZE.LG, handleCancelOnClick: closeDrawer, handleSaveOnClick: handleBranchSubmit, handleSetIsOpen: closeDrawer, isOpen: !!branchDrawer, saveDisabled: branchDisableSaveButton, saveLabel: 'Save', saveRounded: vista_button_type_1.VISTA_BUTTON_ROUNDED.MD, saveSize: vista_button_type_1.VISTA_BUTTON_SIZE.LG, size: vista_drawer_type_1.VISTA_DRAWER_SIZE.MD, title: 'Branch' },
17
- react_1.default.createElement(branch_form_1.BranchForm, { translationMap: translationMap })));
18
- };
19
- exports.BranchDrawer = BranchDrawer;
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 { BranchForm } from './branch-form';
7
+ // interface Props {
8
+ // translationMap: { [key: string]: string };
9
+ // }
10
+ // export const BranchDrawer: FC<Props> = ({ translationMap }) => {
11
+ // const {
12
+ // closeDrawer,
13
+ // branchDisableSaveButton,
14
+ // branchDrawer,
15
+ // handleBranchSubmit,
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={handleBranchSubmit}
24
+ // handleSetIsOpen={closeDrawer}
25
+ // isOpen={!!branchDrawer}
26
+ // saveDisabled={branchDisableSaveButton}
27
+ // saveLabel='Save'
28
+ // saveRounded={VISTA_BUTTON_ROUNDED.MD}
29
+ // saveSize={VISTA_BUTTON_SIZE.LG}
30
+ // size={VISTA_DRAWER_SIZE.MD}
31
+ // title='Branch'
32
+ // >
33
+ // <BranchForm translationMap={translationMap} />
34
+ // </VistaDrawerV1>
35
+ // );
36
+ // };
@@ -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 renderBranchFormElements: (elementProps: VistaFormElements) => React.JSX.Element;
@@ -1,41 +1,30 @@
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.renderBranchFormElements = void 0;
19
- var react_1 = __importDefault(require("react"));
20
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
21
- var renderBranchFormElements = 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.renderBranchFormElements = renderBranchFormElements;
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 renderBranchFormElements = (
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
+ // };
@@ -1,8 +0,0 @@
1
- import { FC } from 'react';
2
- interface Props {
3
- translationMap: {
4
- [key: string]: string;
5
- };
6
- }
7
- export declare const BranchForm: FC<Props>;
8
- export {};
@@ -1,81 +1,33 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || (function () {
30
- var ownKeys = function(o) {
31
- ownKeys = Object.getOwnPropertyNames || function (o) {
32
- var ar = [];
33
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
- return ar;
35
- };
36
- return ownKeys(o);
37
- };
38
- return function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
45
- })();
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.BranchForm = void 0;
48
- var react_1 = __importStar(require("react"));
49
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
50
- var context_1 = require("./context");
51
- var branch_form_elements_1 = require("./branch-form-elements");
52
- var BranchForm = function (_a) {
53
- var translationMap = _a.translationMap;
54
- var branchDynamicFormElements = (0, context_1.usePreferenceStateContext)().branchDynamicFormElements;
55
- var updated = (0, react_1.useMemo)(function () {
56
- var _a, _b;
57
- var elements = __assign({}, branchDynamicFormElements);
58
- var textInputElements = (_a = elements[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
59
- if (textInputElements) {
60
- textInputElements === null || textInputElements === void 0 ? void 0 : textInputElements.forEach(function (_a, i) {
61
- var label = _a.label;
62
- if (translationMap[label] === undefined)
63
- return label;
64
- textInputElements[i].label = translationMap[label];
65
- });
66
- }
67
- var comboboxElements = (_b = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return a.order - b.order; });
68
- if (comboboxElements) {
69
- comboboxElements === null || comboboxElements === void 0 ? void 0 : comboboxElements.forEach(function (_a, i) {
70
- var label = _a.label;
71
- if (translationMap[label] === undefined)
72
- return label;
73
- comboboxElements[i].label = translationMap[label];
74
- });
75
- }
76
- return elements;
77
- // eslint-disable-next-line
78
- }, []);
79
- return react_1.default.createElement(react_1.default.Fragment, null, (0, branch_form_elements_1.renderBranchFormElements)(updated));
80
- };
81
- exports.BranchForm = BranchForm;
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 { renderBranchFormElements } from './branch-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 BranchForm: FC<Props> = ({ translationMap }) => {
12
+ // const { branchDynamicFormElements } = usePreferenceStateContext();
13
+ // const updated = useMemo(() => {
14
+ // const elements: VistaFormElements = { ...branchDynamicFormElements };
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 <>{renderBranchFormElements(updated)}</>;
33
+ // };
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const Branch: () => React.JSX.Element;