import * as React from 'react'; import { storiesOf } from '@storybook/react'; import SpreadSheetProvider from '../SpreadSheetProvider'; import { Props, IRowWithCell } from '../SpreadSheetProvider/index.data'; import * as R from 'rambda'; // 第2行 const headerBottomCellStyles = { borderLeftWidth: 0, borderTopWidth: 0, borderRightWidth: 0, }; storiesOf('sheet', module).add('base', () => { const sheet: Props = { usage: 'editor', columns: [ { width: 90, type: 'row-no' }, { width: 280, type: 'text' }, { width: 90, type: 'numeric' }, { width: 90, type: 'numeric' }, { width: 90, type: 'numeric' }, { width: 90, type: 'numeric' }, { width: 90, type: 'numeric' }, { width: 60, type: 'numeric' }, { width: 90, type: 'numeric' }, { width: 120, type: 'numeric' }, { width: 250, type: 'text' }, { width: 60, type: 'numeric' }, ], rows: [ { id: 1, type: 'header', level: 1, cells: [ { id: 101, value: '四川华西医科大学建设工程\n投资估算表', colspan: 12, style: { fontSize: 30, fontWeight: 'bold', borderWidth: 0, textAlign: 'center', }, }, ...R.repeat(null, 11), ], }, { id: 2, type: 'header', level: 1, cells: [ { id: 201, value: '附表1-1', style: headerBottomCellStyles, colspan: 3, }, ...R.repeat(null, 2), { id: 204, value: '', style: headerBottomCellStyles }, { id: 205, value: '', style: headerBottomCellStyles }, { id: 206, value: '', style: headerBottomCellStyles }, { id: 207, value: '', style: headerBottomCellStyles }, { id: 208, value: '', style: headerBottomCellStyles }, { id: 209, value: '', style: headerBottomCellStyles }, { id: 210, value: '', style: headerBottomCellStyles }, { id: 212, value: '单位: 万元', style: { ...headerBottomCellStyles, textAlign: 'right' }, colspan: 2, }, ...R.repeat(null, 1), ], }, { id: 3, type: 'header', level: 1, cells: [ { id: 301, value: '序号', rowspan: 2, style: { textAlign: 'center' } }, { id: 302, value: '项目与费用名称', rowspan: 2, style: { textAlign: 'center' } }, { id: 303, value: '估算金额(万元)', colspan: 5, style: { textAlign: 'center' } }, ...R.repeat(null, 4), { id: 308, value: '技术经济指标', colspan: 3, style: { textAlign: 'center' } }, ...R.repeat(null, 2), { id: 3011, value: '备注', rowspan: 2, style: { textAlign: 'center' } }, { id: 3012, value: '比例(%)', rowspan: 2, style: { textAlign: 'center' } }, ], }, { id: 4, type: 'header', level: 1, cells: [ ...R.repeat(null, 2), { id: 403, value: '建筑工程', style: { textAlign: 'center' } }, { id: 404, value: '安装工程', style: { textAlign: 'center' } }, { id: 405, value: '设备购置', style: { textAlign: 'center' } }, { id: 406, value: '其它费用', style: { textAlign: 'center' } }, { id: 407, value: '合计', style: { textAlign: 'center' } }, { id: 408, value: '单位', style: { textAlign: 'center' } }, { id: 409, value: '工程量', style: { textAlign: 'center' } }, { id: 410, value: '指标(元/单位)', style: { textAlign: 'center' } }, ...R.repeat(null, 2), ], }, { id: 500, type: 'body', level: 1, cells: [ { id: 50001, value: '一' }, { id: 50002, value: '工程费用' }, { id: 50003, value: 0, locked: true, formula: '1+1', }, { id: 50004, value: 0, locked: true }, { id: 50005, value: 0, locked: true }, { id: 50006, value: 0, locked: true }, { id: 50007, value: 0 }, { id: 50008, value: 0 }, { id: 50009, value: 0 }, { id: 50010, value: 0 }, { id: 50011, value: '我是备注' }, { id: 50012, value: 0 }, ], }, { id: 510, type: 'body', level: 2, cells: [ { id: 50101, value: '一' }, { id: 50102, value: '1级' }, { id: 50103, value: 0, locked: true, formula: '1+1', }, { id: 50104, value: 0, locked: true, }, { id: 50105, value: 0, locked: true }, { id: 50106, value: 0, locked: true }, { id: 50107, value: 0 }, { id: 50108, value: 0 }, { id: 50109, value: 0 }, { id: 50110, value: 0 }, { id: 50111, value: '我是备注' }, { id: 50112, value: 0 }, ], }, { id: 600, type: 'body', level: 1, cells: [ { id: 60001, value: '二' }, { id: 60002, value: '工程建设其它费用' }, { id: 60003, value: 0, locked: true }, { id: 60004, value: 0, locked: true }, { id: 60005, value: 0, locked: true }, { id: 60006, value: 0, locked: true }, { id: 60007, value: 0 }, { id: 60008, value: 0 }, { id: 60009, value: 0 }, { id: 60010, value: 0 }, { id: 60011, value: '我是其它费用的备注' }, { id: 60012, value: 0 }, ], }, { id: 700, type: 'body', area: 'flatten', cells: [ { id: 70001, value: '平面1' }, { id: 70002, value: '随机2' }, { id: 70003, value: 0 }, { id: 70004, value: 0, locked: true }, { id: 70005, value: 0, locked: true }, { id: 70006, value: 0, locked: true }, { id: 70007, value: 0 }, { id: 70008, value: 0 }, { id: 70009, value: 0 }, { id: 70010, value: 0 }, { id: 70011, value: '我是平面表' }, { id: 70012, value: 0 }, ], }, ], }; return ; });