@megha-ui/react 1.2.481 → 1.2.483

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.
@@ -36,7 +36,7 @@ import { TbCopy, TbCopyOff } from "react-icons/tb";
36
36
  import { formatValue } from "../../services/commonService";
37
37
  const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable = true, paginate, rowsPerPageOptions = [10, 20, 50, 100], defaultRowsPerPage = 100, widthMode = "custom", bulkSelect = false, cellBorder = false, rowHeight = 38, onRowClick, rowCount = false, rowBorder = true, showMenu = false, search = false, defaultSearchOperation = "contains", gridBorder = false, isLoading = false, rowTopBorder, rowBottomBorder, rowLeftBorder, rowRightBorder, headerBackground = "var(--row-header-bg)", headerTopBorder = "none", headerBottomBorder = "none", SettingIcon, ExportIcon, ignoredExportItems = ["action", "actions"], borderColor = "#dbdfe9", updateColumns, showHideAvailable = false, columnSearchOutside = false, multiSorting = false, exportAvailable = false, exportableFileName = "", groupBy, updateGroupBy, rowKey = "id", hlBorderColor = "black", selectedRow, selectedRowStyle = {
38
38
  borderLeft: "0.5rem solid #d9d9d9",
39
- }, defaultSort, noKeyEvents = true, customOperation, hasCustomOperation, globalSearch, headerDropdownIndex, draggable = false, resizable = false, updateGridData, widthUnits, checkboxWrapper, ignoreHugContent = false, isSummarise = false, isHideDups = false, fullScreenAvailable = true, defaultGroupOpen, alternateRowColor = true, activeCalculateColor = "#2377BA", calculatetextColor = "#fff", actionsKey = "actions", saveAsNewView = false, handleSaveAsView, saveAsViewIcon, filterData, chipColor = "#ccc", withAscii = false, propSummariseKeys, SummariseIcon, summarizeColor = "black", isExpandable = false, expandedRow, extraRow, selectedCheckBox, setSelectedCheckbox, ignoreRowSelect, setOpenedRows, openedRows, getLoadingState, globalSearchOpen = false, updateFixedFilterValues = (fixedFilterValues) => {
39
+ }, defaultSort, noKeyEvents = true, customOperation, hasCustomOperation, globalSearch, headerDropdownIndex, draggable = false, resizable = false, updateGridData, widthUnits, checkboxWrapper, ignoreHugContent = false, isSummarise = false, isHideDups = false, isMultipleChips = false, fullScreenAvailable = true, defaultGroupOpen, alternateRowColor = true, activeCalculateColor = "#2377BA", calculatetextColor = "#fff", actionsKey = "actions", saveAsNewView = false, handleSaveAsView, saveAsViewIcon, filterData, chipColor = "#ccc", withAscii = false, propSummariseKeys, SummariseIcon, summarizeColor = "black", isExpandable = false, expandedRow, extraRow, selectedCheckBox, setSelectedCheckbox, ignoreRowSelect, setOpenedRows, openedRows, getLoadingState, globalSearchOpen = false, updateFixedFilterValues = (fixedFilterValues) => {
40
40
  console.log("Update fixed filter values not implemented", fixedFilterValues);
41
41
  }, locale, formatOptions, exportOptions,
42
42
  // Card wrapper props
@@ -126,11 +126,11 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
126
126
  }, {});
127
127
  _columns = _columns.map((item) => {
128
128
  var _a, _b;
129
- return (Object.assign(Object.assign({}, item), { dataType: (_b = (_a = item.dataType) !== null && _a !== void 0 ? _a : columnData === null || columnData === void 0 ? void 0 : columnData[item.key]) !== null && _b !== void 0 ? _b : "string" }));
129
+ return (Object.assign(Object.assign({}, item), { isArrayString: isMultipleChips, dataType: (_b = (_a = item.dataType) !== null && _a !== void 0 ? _a : columnData === null || columnData === void 0 ? void 0 : columnData[item.key]) !== null && _b !== void 0 ? _b : "string" }));
130
130
  });
131
131
  }
132
132
  setGridColumns(_columns);
133
- }, [columns, data]);
133
+ }, [columns, data, isMultipleChips]);
134
134
  useEffect(() => {
135
135
  if (globalSearchOpen) {
136
136
  setExpandedGI(true);
@@ -24,6 +24,7 @@ export interface Column {
24
24
  action: () => void;
25
25
  }>;
26
26
  renderer?: (item: any) => JSX.Element;
27
+ isArrayString?: boolean;
27
28
  }
28
29
  export interface DataRow {
29
30
  [key: string]: {
@@ -128,6 +129,7 @@ export interface OjasGridProps {
128
129
  }) => void;
129
130
  isSummarise?: boolean;
130
131
  isHideDups?: boolean;
132
+ isMultipleChips?: boolean;
131
133
  defaultGroupOpen?: boolean;
132
134
  alternateRowColor?: boolean;
133
135
  activeCalculateColor?: string;
@@ -131,7 +131,10 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
131
131
  .toString()
132
132
  .split(">>")
133
133
  .map((item) => `<div>${item}</div>`)
134
- .join("")}</div>`, children: cellData.value.toString().split(">>").length > 1 ? (_jsxs(_Fragment, { children: [_jsxs("span", { children: ["Multiple ", `(${cellData.value.toString().split(">>").length})`] }), _jsx(Tooltip, { className: "custom-tooltip", id: (_b = item.id.value.toString()) !== null && _b !== void 0 ? _b : colIndex.toString(), place: "top" })] })) : (_jsx("span", { children: cellData.value })) })) : cellData && Object.keys(cellData).includes("html") ? (cellData === null || cellData === void 0 ? void 0 : cellData.html) : cellData && Object.keys(cellData).includes("value") ? (formatValue(cellData === null || cellData === void 0 ? void 0 : cellData.value, (_c = column.dataType) !== null && _c !== void 0 ? _c : "string", locale, formatOptions)) : cellData ? (cellData) : ("");
134
+ .join("")}</div>`, children: cellData.value.toString().split(">>").length > 1 ? (_jsx(_Fragment, { children: column.isArrayString ?
135
+ _jsx("div", { className: "flex items-center", children: cellData.value.toString().split(">>").map(item => (_jsx("div", { className: "text-[var(--foreground)] rounded-lg bg-[var(--brand)]", children: item }))) })
136
+ :
137
+ _jsxs(_Fragment, { children: [_jsxs("span", { children: ["Multiple ", `(${cellData.value.toString().split(">>").length})`] }), _jsx(Tooltip, { className: "custom-tooltip", id: (_b = item.id.value.toString()) !== null && _b !== void 0 ? _b : colIndex.toString(), place: "top" })] }) })) : (_jsx("span", { children: cellData.value })) })) : cellData && Object.keys(cellData).includes("html") ? (cellData === null || cellData === void 0 ? void 0 : cellData.html) : cellData && Object.keys(cellData).includes("value") ? (formatValue(cellData === null || cellData === void 0 ? void 0 : cellData.value, (_c = column.dataType) !== null && _c !== void 0 ? _c : "string", locale, formatOptions)) : cellData ? (cellData) : ("");
135
138
  const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
136
139
  const isHidden = column.overflowHidden;
137
140
  if (!column.hidden && !groupByKeys.includes(column.key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.481",
3
+ "version": "1.2.483",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",