UNPKG

sccoreui

Version:

ui-sccore

34 lines (33 loc) 3.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.skeletonLoding = exports.GridHeaderComponent = exports.GroupHeader = exports.dataCellRenderer = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); // import Checkbox from "./grid-checkbox"; const react_1 = require("react"); const context_provider_1 = require("./context-provider"); // Render checkbox as well as initial component/data from props const dataCellRenderer = (cellRendererParams, column, props) => { var _a, _b, _c; const { initialRenderer, cellCheckBoxRenderer } = cellRendererParams; return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "inline-flex w-full h-full" }, { children: ((_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.displayCheckboxOnRight) ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "custom_class_name flex w-full justify-content-between" }, { children: [typeof initialRenderer === "function" ? (initialRenderer(cellRendererParams)) : ((0, jsx_runtime_1.jsx)("div", { children: (_b = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.data) === null || _b === void 0 ? void 0 : _b[column === null || column === void 0 ? void 0 : column.field] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex align-items-center" }, { children: cellCheckBoxRenderer(cellRendererParams) }))] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex align-items-center " }, { children: cellCheckBoxRenderer(cellRendererParams) })), typeof initialRenderer === "function" ? (initialRenderer(cellRendererParams)) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "px-3" }, { children: (_c = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.data) === null || _c === void 0 ? void 0 : _c[column === null || column === void 0 ? void 0 : column.field] })))] })) }))); }; exports.dataCellRenderer = dataCellRenderer; //Get this compnent from products const GroupHeader = (params) => { console.log(params, "params"); return (0, jsx_runtime_1.jsx)("p", { children: "My Custom Group" }); }; exports.GroupHeader = GroupHeader; const GridHeaderComponent = (props) => { if (props === null || props === void 0 ? void 0 : props.GroupHeaderComponent) return props === null || props === void 0 ? void 0 : props.GroupHeaderComponent; return (0, jsx_runtime_1.jsx)("span", { children: "Group" }); }; exports.GridHeaderComponent = GridHeaderComponent; const skeletonLoding = () => { var _a; const { gridData } = (0, react_1.useContext)(context_provider_1.FeatureContext); const columnsData = ((_a = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _a === void 0 ? void 0 : _a.length) > 0; return !columnsData; }; exports.skeletonLoding = skeletonLoding;