import React from 'react' import { type INotSlot, LxItem } from '../lxItem' import type { BorderRadiusProps, SpaceProps, ColorProps } from '@lx-react-materiel/shared' import { commonStyleFn } from '@lx-react-materiel/shared' import type { ViewProps } from '@tarojs/components' import { View } from '@tarojs/components' import type { Required as IRequired } from 'utility-types' import './index.less' type IItem = Pick export interface LxItemGroupBasicProps extends BorderRadiusProps, SpaceProps, ColorProps, Pick { items: IItem[] options?: Omit // 剩余配置 } /** * 这里必备 className 是为了循环得到唯一 key */ export type LxItemGroupProps = IRequired /** * 用于展示 label-value 分组数据 * * @param props * @constructor * * @example * * // 用法1 * * * * // 用法2:传入子项 options 配置 * * */ export function LxItemGroup (props: LxItemGroupProps) { const { className = '', items, options, style = commonStyleFn(props), ...groupRest } = props // 获取子项 lxItem 配置 const { borderRadius = 0, background = '#fff', leftColor = '#989EA9', rightColor = '#141E33', ...rest } = options ?? {} // 单项 LxItem 属性 const mergeItem = (item: IItem) => ({ ...item, ...rest, leftColor, rightColor, background, // group下 Item 不需要有圆角 borderRadius }) const mergeProps = { ...groupRest, className: `lx-item__group ${className ?? ''}`, style } return ( { items.map((item, index) => ) } ) } export default LxItemGroup