@codezee/sixtify-brahma 0.2.36 → 0.2.37

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -1 +1 @@
1
- {"version":3,"file":"ContentBox.d.ts","sourceRoot":"","sources":["../../src/ContentBox/ContentBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,eAAO,MAAM,UAAU,GAAI,cAAc,iBAAiB,4CAkBzD,CAAC"}
1
+ {"version":3,"file":"ContentBox.d.ts","sourceRoot":"","sources":["../../src/ContentBox/ContentBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,eAAO,MAAM,UAAU,GAAI,cAAc,iBAAiB,4CAkBzD,CAAC"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContentBox = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
- const PadBox_1 = require("../PadBox");
7
6
  const ContentBox = ({ children }) => {
8
7
  const theme = (0, material_1.useTheme)();
9
8
  const { iron, butterflyBlue } = theme.palette.app.color;
@@ -13,6 +12,6 @@ const ContentBox = ({ children }) => {
13
12
  borderRadius: "6px",
14
13
  height: "100%",
15
14
  width: "100%",
16
- }, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: children }) }));
15
+ }, children: children }));
17
16
  };
18
17
  exports.ContentBox = ContentBox;
@@ -1 +1 @@
1
- {"version":3,"file":"FilterList.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterList.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,cAAc,EAAE,CAAC;CACnC,CAAC;AACF,eAAO,MAAM,UAAU,GAAI,qBAAqB,eAAe,4CAkK9D,CAAC"}
1
+ {"version":3,"file":"FilterList.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,cAAc,EAAE,CAAC;CACnC,CAAC;AACF,eAAO,MAAM,UAAU,GAAI,qBAAqB,eAAe,4CAoK9D,CAAC"}
@@ -9,6 +9,7 @@ const Button_1 = require("../Button");
9
9
  const FilterPill_1 = require("../Chips/FilterPill");
10
10
  const SvgFilterList_1 = require("../Svgs/SvgFilterList");
11
11
  const Tooltip_1 = require("../Tooltip");
12
+ const FilterListV2_1 = require("./FilterListV2");
12
13
  const FilterPopup_1 = require("./FilterPopup");
13
14
  const FilterPopupWrapper_1 = require("./FilterPopupWrapper");
14
15
  const FilterTypeWrapper_1 = require("./FilterTypeWrapper");
@@ -27,7 +28,8 @@ const FilterList = ({ filterListItems }) => {
27
28
  setOpenFilterPopup(false);
28
29
  setCurrentFilter(null);
29
30
  handleClose();
30
- setFilterListData(data);
31
+ const filteredData = (0, FilterListV2_1.formatFilterData)(data, filterListItems);
32
+ setFilterListData(filteredData);
31
33
  };
32
34
  const handleClick = (event) => {
33
35
  setAnchorEl(event.currentTarget);
@@ -8,7 +8,7 @@ export type FilterListV2Props = {
8
8
  onChange: (data: FieldValues, isPopup: boolean) => void;
9
9
  onClear: () => void;
10
10
  resetFormBasedOnFields?: string;
11
- dateKeys?: string[];
12
11
  };
13
- export declare const FilterListV2: ({ filterListItems, isDisabled, filterListData, onApply, onClear, onChange, dateKeys, }: FilterListV2Props) => import("react/jsx-runtime").JSX.Element;
12
+ export declare function formatFilterData(data: FieldValues, filterListItems: FilterListType[]): Record<string, FieldValues>;
13
+ export declare const FilterListV2: ({ filterListItems, isDisabled, filterListData, onApply, onClear, onChange, }: FilterListV2Props) => import("react/jsx-runtime").JSX.Element;
14
14
  //# sourceMappingURL=FilterListV2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAenD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,YAAY,GAAI,wFAQ1B,iBAAiB,4CAilBnB,CAAC"}
1
+ {"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAenD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,cAAc,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAiB7B;AAED,eAAO,MAAM,YAAY,GAAI,8EAO1B,iBAAiB,4CAskBnB,CAAC"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FilterListV2 = void 0;
7
+ exports.formatFilterData = formatFilterData;
7
8
  const jsx_runtime_1 = require("react/jsx-runtime");
8
9
  /* eslint-disable sonarjs/no-nested-functions */
9
10
  /* eslint-disable sonarjs/no-nested-conditional */
@@ -14,6 +15,7 @@ const icons_material_1 = require("@mui/icons-material");
14
15
  const material_1 = require("@mui/material");
15
16
  const icons_1 = require("@mui/x-date-pickers/icons");
16
17
  const lodash_1 = require("lodash");
18
+ const isEqual_1 = __importDefault(require("lodash/isEqual"));
17
19
  const luxon_1 = require("luxon");
18
20
  const react_1 = require("react");
19
21
  const react_hook_form_1 = require("react-hook-form");
@@ -29,8 +31,19 @@ const Tooltip_1 = require("../Tooltip");
29
31
  const FilterPopupWrapper_1 = require("./FilterPopupWrapper");
30
32
  const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
31
33
  const getFormData_1 = require("./getFormData");
32
- const isEqual_1 = __importDefault(require("lodash/isEqual"));
33
- const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onApply, onClear, onChange, dateKeys, }) => {
34
+ function formatFilterData(data, filterListItems) {
35
+ return Object.fromEntries(Object.entries(data).flatMap(([key, value]) => {
36
+ if (value) {
37
+ const config = filterListItems.find((item) => item.key === key);
38
+ const formattedValue = config?.monthYearFormat && typeof value === "string"
39
+ ? luxon_1.DateTime.fromISO(value).toFormat("yyyy-MM")
40
+ : value;
41
+ return [[key, formattedValue]];
42
+ }
43
+ return [];
44
+ }));
45
+ }
46
+ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onApply, onClear, onChange, }) => {
34
47
  const theme = (0, material_1.useTheme)();
35
48
  const { iron, slate } = theme.palette.app.color;
36
49
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
@@ -117,7 +130,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
117
130
  const onSubmit = (data) => {
118
131
  setOpenFilterPopup(false);
119
132
  setCurrentFilter(null);
120
- const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value && !(Array.isArray(value) && !value.length)));
133
+ const filteredData = formatFilterData(data, filterListItems);
121
134
  onApply(filteredData, openFilterPopup, currentFilter?.key);
122
135
  handleClose();
123
136
  };
@@ -181,10 +194,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
181
194
  return;
182
195
  }
183
196
  const item = getFilterItem(key);
184
- const keyValue = item &&
185
- (0, getFormData_1.getFormValue)(dateKeys?.includes(item?.key)
186
- ? luxon_1.DateTime.fromISO(value).toFormat(FormFields_1.dateFormats.dateWithEuropean)
187
- : value, item);
197
+ const keyValue = item && (0, getFormData_1.getFormValue)(value, item);
188
198
  if (typeof value !== "boolean" && !keyValue) {
189
199
  return;
190
200
  }
@@ -5,6 +5,8 @@ type Options = readonly {
5
5
  value: string;
6
6
  disabled?: boolean;
7
7
  avatar?: string;
8
+ employee_code?: string;
9
+ punch_code?: string;
8
10
  }[];
9
11
  export type FilterListType = {
10
12
  label: string;
@@ -16,6 +18,8 @@ export type FilterListType = {
16
18
  options?: Options;
17
19
  multiSelect?: boolean;
18
20
  required?: boolean;
21
+ monthYearFormat?: boolean;
22
+ employeeAutocomplete?: boolean;
19
23
  };
20
24
  type FilterTypeWrapperProps = {
21
25
  filter: FilterListType;
@@ -1 +1 @@
1
- {"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,KAAK,OAAO,GAAG,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,EAAE,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,sBAG/B,sBAAsB,4CAqBxB,CAAC"}
1
+ {"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,KAAK,OAAO,GAAG,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EAAE,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AACF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,sBAG/B,sBAAsB,4CAqBxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GetFilterPopupComponent.d.ts","sourceRoot":"","sources":["../../src/FilterList/GetFilterPopupComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,cAAc,EAC9B,SAAS,OAAO,CAAC,WAAW,CAAC,EAC7B,QAAQ,WAAW,CAAC,WAAW,CAAC,KAC/B,wBA4DF,CAAC"}
1
+ {"version":3,"file":"GetFilterPopupComponent.d.ts","sourceRoot":"","sources":["../../src/FilterList/GetFilterPopupComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,cAAc,EAC9B,SAAS,OAAO,CAAC,WAAW,CAAC,EAC7B,QAAQ,WAAW,CAAC,WAAW,CAAC,KAC/B,wBAsGF,CAAC"}
@@ -6,7 +6,7 @@ const material_1 = require("@mui/material");
6
6
  const FormFields_1 = require("../FormFields");
7
7
  const getFilterPopupComponent = (selectedFilter, control, errors) => {
8
8
  const theme = (0, material_1.useTheme)();
9
- const { sapphireBlue, black } = theme.palette.app.color;
9
+ const { iron, sapphireBlue, black } = theme.palette.app.color;
10
10
  const errorSelectedKey = errors[selectedFilter.key];
11
11
  return {
12
12
  autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder: `Select ${selectedFilter.label}`, name: `${selectedFilter.key}`, disabled: selectedFilter.isDisabled, shouldCloseOnSelect: selectedFilter.multiSelect ?? false, control: control, options: selectedFilter.options ?? [], sx: {
@@ -17,9 +17,25 @@ const getFilterPopupComponent = (selectedFilter, control, errors) => {
17
17
  backgroundColor: sapphireBlue[300],
18
18
  color: black[900],
19
19
  },
20
- }, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
20
+ }, ...(selectedFilter.employeeAutocomplete && {
21
+ isShowAvatar: true,
22
+ isShowSelectAll: false,
23
+ renderOption: (props, option) => {
24
+ const { key, ...optionProps } = props;
25
+ return ((0, jsx_runtime_1.jsx)("li", { ...optionProps, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", alignItems: "center", children: [option.avatar && ((0, jsx_runtime_1.jsx)(material_1.Avatar, { sx: { width: 30, height: 30 }, src: option.avatar, alt: option.label })), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: `${option.label} (${option.employee_code})` }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: iron[800], children: option.punch_code })] })] }) }, key));
26
+ },
27
+ getOptionLabel: (option) => {
28
+ if (typeof option === "string") {
29
+ return option;
30
+ }
31
+ return `${option.label} (${option.employee_code}) - ${option.punch_code}`;
32
+ },
33
+ }), error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
21
34
  text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: selectedFilter.label, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
22
- date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
35
+ date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message, ...(selectedFilter.monthYearFormat && {
36
+ format: "MMM yyyy",
37
+ views: ["year", "month"],
38
+ }) })),
23
39
  dateRange: ((0, jsx_runtime_1.jsx)(FormFields_1.DateRangePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
24
40
  };
25
41
  };