zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
{"version":3,"file":"props.mjs","sources":["../../../../../../packages/components/virtual-list/src/props.ts"],"sourcesContent":["import {\n  buildProp,\n  buildProps,\n  definePropType,\n  mutable,\n} from '@element-plus/utils'\nimport { VERTICAL } from './defaults'\n\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type { GridItemKeyGetter, ItemSize } from './types'\n\nconst itemSize = buildProp({\n  type: definePropType<number | ItemSize>([Number, Function]),\n  required: true,\n} as const)\n\nconst estimatedItemSize = buildProp({\n  type: Number,\n} as const)\n\nconst cache = buildProp({\n  type: Number,\n  default: 2,\n} as const)\n\nconst direction = buildProp({\n  type: String,\n  values: ['ltr', 'rtl'],\n  default: 'ltr',\n} as const)\n\nconst initScrollOffset = buildProp({\n  type: Number,\n  default: 0,\n} as const)\n\nconst total = buildProp({\n  type: Number,\n  required: true,\n} as const)\n\nconst layout = buildProp({\n  type: String,\n  values: ['horizontal', 'vertical'],\n  default: VERTICAL,\n} as const)\n\nexport const virtualizedProps = buildProps({\n  className: {\n    type: String,\n    default: '',\n  },\n\n  containerElement: {\n    type: definePropType<string | Element>([String, Object]),\n    default: 'div',\n  },\n\n  data: {\n    type: definePropType<any[]>(Array),\n    default: () => mutable([] as const),\n  },\n\n  /**\n   * @description controls the horizontal direction.\n   */\n  direction,\n\n  height: {\n    type: [String, Number],\n    required: true,\n  },\n\n  innerElement: {\n    type: [String, Object],\n    default: 'div',\n  },\n\n  style: {\n    type: definePropType<StyleValue>([Object, String, Array]),\n  },\n\n  useIsScrolling: {\n    type: Boolean,\n    default: false,\n  },\n\n  width: {\n    type: [Number, String],\n    required: false,\n  },\n\n  perfMode: {\n    type: Boolean,\n    default: true,\n  },\n  scrollbarAlwaysOn: {\n    type: Boolean,\n    default: false,\n  },\n} as const)\n\nexport const virtualizedListProps = buildProps({\n  /**\n   * @description describes how many items should be pre rendered to the head\n   * and the tail of the window\n   */\n  cache,\n\n  estimatedItemSize,\n\n  /**\n   * @description controls the list's orientation\n   */\n  layout,\n\n  initScrollOffset,\n\n  /**\n   * @description describes the total number of the list.\n   */\n  total,\n\n  itemSize,\n  ...virtualizedProps,\n} as const)\n\nconst scrollbarSize = {\n  type: Number,\n  default: 6,\n} as const\n\nconst startGap = { type: Number, default: 0 } as const\nconst endGap = { type: Number, default: 2 } as const\n\nexport const virtualizedGridProps = buildProps({\n  columnCache: cache,\n  columnWidth: itemSize,\n  estimatedColumnWidth: estimatedItemSize,\n  estimatedRowHeight: estimatedItemSize,\n  initScrollLeft: initScrollOffset,\n  initScrollTop: initScrollOffset,\n  itemKey: {\n    type: definePropType<GridItemKeyGetter>(Function),\n    default: ({\n      columnIndex,\n      rowIndex,\n    }: {\n      columnIndex: number\n      rowIndex: number\n    }) => `${rowIndex}:${columnIndex}`,\n  },\n  rowCache: cache,\n  rowHeight: itemSize,\n  totalColumn: total,\n  totalRow: total,\n  hScrollbarSize: scrollbarSize,\n  vScrollbarSize: scrollbarSize,\n  scrollbarStartGap: startGap,\n  scrollbarEndGap: endGap,\n  role: String,\n  ...virtualizedProps,\n} as const)\n\nexport const virtualizedScrollbarProps = buildProps({\n  alwaysOn: Boolean,\n  class: String,\n  layout,\n  total,\n  ratio: {\n    type: Number,\n    required: true,\n  },\n  clientSize: {\n    type: Number,\n    required: true,\n  },\n  scrollFrom: {\n    type: Number,\n    required: true,\n  },\n  scrollbarSize,\n  startGap,\n  endGap,\n\n  visible: Boolean,\n} as const)\n\nexport type VirtualizedProps = ExtractPropTypes<typeof virtualizedProps>\nexport type VirtualizedListProps = ExtractPropTypes<typeof virtualizedListProps>\nexport type VirtualizedGridProps = ExtractPropTypes<typeof virtualizedGridProps>\n\nexport type VirtualizedScrollbarProps = ExtractPropTypes<\n  typeof virtualizedScrollbarProps\n>\n"],"names":[],"mappings":";;;;;AAOA,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,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