UNPKG

@tapie-kr/inspire-react

Version:

React Component Collection for INSPIRE

28 lines (24 loc) 2.45 kB
/* eslint-disable */ /* * INSPIRE : Creative Kit * React Component Collection for INSPIRE * * This file is generated automatically. Do not modify it manually * Generated at : 2025. 3. 4. 오후 6:18:13 * @tapie-kr/inspire-react version: 0.2.15 * * (c) 2025 TAPIE. All rights reserved. * MIT License */ 'use strict'; var jsxRuntime = require('react/jsx-runtime'); var color_css = require('../../../lib/style/contract/color.css.js'); var component_css = require('../../../lib/style/contract/component.css.js'); var index$3 = require('../../atoms/Button/index.js'); var index$1 = require('../../foundations/Typography/index.js'); var index$2 = require('../../miscellaneous/layout/HStack/index.js'); var index = require('../Table/index.js'); var shared$1 = require('../../atoms/Button/shared.js'); var shared = require('../../foundations/Typography/shared.js'); function DataTable(props){const shouldShowActions=props.actions&&props.actions.length>0;return jsxRuntime.jsxs(index.Table,{children:[jsxRuntime.jsxs(index.Table.Head,{children:[props.showIndex&&jsxRuntime.jsx(index.Table.Head.Cell,{width:40,children:"#"}),props.columns.map(c=>jsxRuntime.jsx(index.Table.Head.Cell,{width:c.width,isSortable:c.isSortable,children:c.label},c.key.toString())),shouldShowActions&&jsxRuntime.jsx(index.Table.Head.Cell,{width:100,children:"액션"})]}),jsxRuntime.jsx(index.Table.Body,{children:props.data.map((d,i)=>jsxRuntime.jsxs(index.Table.Body.Row,{children:[props.showIndex&&jsxRuntime.jsx(index.Table.Body.Cell,{children:jsxRuntime.jsx(index$1.Typography.Petite,{weight:shared.TypographyWeight.MEDIUM,color:color_css.colorVars.content.muted,children:i+1})}),props.columns.map(c=>jsxRuntime.jsx(index.Table.Body.Cell,{children:c.cell?c.cell(d[c.key],i+1,d):jsxRuntime.jsx(index$1.Typography.Base,{weight:shared.TypographyWeight.MEDIUM,children:String(d[c.key])})},c.key.toString())),shouldShowActions&&jsxRuntime.jsx(index.Table.Body.Cell,{children:jsxRuntime.jsx(index$2.HStack,{spacing:component_css.spacingVars.base,children:props.actions?.map((a,i)=>{const handleClick=()=>a.onClick(d,props.data,i);return jsxRuntime.jsx(index$3.Button.Icon,{variant:shared$1.ButtonVariant.SECONDARY,size:shared$1.ButtonSize.MEDIUM,icon:typeof a.icon==="function"?a.icon(d):a.icon,disabled:typeof a.disabled==="function"?a.disabled(d):a.disabled,color:color_css.colorVars.content.default,onClick:handleClick},i)})})})]},i))})]})} exports.DataTable = DataTable;