Commit b494136c authored by Дмитрий Малюгин's avatar Дмитрий Малюгин 🕓
Browse files

fix: some bugs

parent 556b7d76
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
  "name": "@d.malygin/UI_storybook",
  "version": "1.0.19",
  "version": "1.0.20",
  "type": "module",
  "scripts": {
    "dev": "vite",
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ export interface ITableColumn {

export interface ITableColumnOptions
  extends ICheckboxProps,
    ITagProps,
    Omit<ITagProps, 'background' | 'value'>,
    ISelectProps,
    IRatingProps,
    IProgressBarProps,
+3 −3
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import Rating from '../../Rating/Rating.vue';
import ProgressBar from '../../ProgressBar/ProgressBar.vue';
import Knob from '../../Knob/Knob.vue';
import type { TThemeColor } from '../../../common/interfaces/common';
import type { ITagProps } from '@interfaces/componentsProps';

interface IProps {
  item: unknown;
@@ -60,7 +61,7 @@ defineEmits(['updateData']);
      />
      <Tag
        v-if="types[columnIndex] === 'tag'"
        v-bind="column.options"
        v-bind="column.options as ITagProps"
        :value="item as string"
        @update="$emit('updateData', $event, rowIndex, columnIndex)"
      />
@@ -68,9 +69,8 @@ defineEmits(['updateData']);
        v-else-if="types[columnIndex] === 'select'"
        noBorder
        noSelectedBackground
        v-bind="filterSelectProps(column.options)"
        v-bind="filterSelectProps(column.options, theme)"
        width="150px"
        :theme="theme"
        :selected="item as string"
        @update="$emit('updateData', $event, rowIndex, columnIndex)"
      />
+5 −4
Original line number Diff line number Diff line
import type { ITableColumn, TTableColumnType } from '../../common/interfaces/componentsProp';
import type { TSize } from '../../common/interfaces/common';
import type { TSize, TThemeColor } from '../../common/interfaces/common';
import type { ICheckboxProps, ISelectProps } from '../../common/interfaces/componentsProps';

export const calcRows = (
@@ -90,10 +90,11 @@ export const filterCheckboxProps = (props: ICheckboxProps | undefined) => {
  return res;
};

export const filterSelectProps = (props: ISelectProps | undefined) => {
  if (!props || !props.options)
export const filterSelectProps = (props: ISelectProps | undefined, theme: TThemeColor) => {
  if (!props || !props.options || !props.theme)
    return {
      options: [{ value: 'One' }, { value: 'Two' }],
      options: props?.options ?? [{ value: 'One' }, { value: 'Two' }],
      theme: props?.theme ?? theme,
    };
  return props;
};