Socket
Book a DemoInstallSign in
Socket

yu-vue-pivottable

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yu-vue-pivottable

yu-vue-pivottable

0.8.0
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

yu-pivottable

  • pivottable的简单实现
  • 目前只有组件 PivotTable 实现
  • PivotTableUI 组件暂未实现
  • 参考 PivotTable.js
  • 参考 react-pivottable
  • js 文件小于10kb

使用方法

preact

import { render } from 'preact';
import { createPivotData, PivotTable, pivotAggregators, PivotCellClick } from 'yu-pivottable';
import 'yu-pivottable/preact/pivot.css';

const mps = await import('./mps.json').then(r => r.default);
const pivotData = createPivotData<Record<string, any>>(mps as any, {
  rows: ['book'],
  cols: ['market', 'product'],
  vals: ['lot'],
  aggregator: pivotAggregators.Sum,
});
const handleCellClick: PivotCellClick = (e, value, filters) => {
  console.log(e, value, filters);
};
render(
  <PivotTable pivotData={pivotData} onCellClick={handleCellClick} />,
  document.getElementById('app') as HTMLElement
);

vue

import { createApp } from 'vue';
import { createPivotData, pivotAggregators, PivotCellClick, PivotTable } from 'yu-vue-pivottable';
import 'yu-pivottable/vue/pivot.css';

const mps = await import('./mps.json').then(r => r.default);
const pivotData = createPivotData<Record<string, any>>(mps as any, {
  rows: ['book'],
  cols: ['market', 'product'],
  vals: ['lot'],
  aggregator: pivotAggregators.Sum,
});
const handleCellClick: PivotCellClick = (e, value, filters) => {
  console.log(e, value, filters);
};
const app = createApp({
  render() {
    return <PivotTable pivotData={pivotData} onCellClick={handleCellClick} />;
  },
});
app.mount('#app__vue');

Keywords

pivot

FAQs

Package last updated on 24 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.