Socket
Socket
Sign inDemoInstall

yu-pivottable

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yu-pivottable

yu-pivottable


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 24 Aug 2022

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc