Skip to content

Commit

Permalink
cache
Browse files Browse the repository at this point in the history
  • Loading branch information
光弘 committed May 8, 2018
1 parent 9dad00f commit 05d706f
Show file tree
Hide file tree
Showing 15 changed files with 1,031 additions and 0 deletions.
Empty file added postinstall.js
Empty file.
94 changes: 94 additions & 0 deletions site/components/table/demo/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# 页底

- order: 13

提供一个空白行供自定义渲染,适用于 合计 等场景,同时支持行分组 Footer,可选择性关闭。

---

````jsx

import { Table } from 'uxcore';
import { Formatter } from 'uxcore';

const commonData = {
title: '一级标题',
entity: '蚂蚁金服(中国)',
institution: '招商银行丨杭州分行',
money: '60000',
};

const companyData = [
{ company: '阿里巴巴网络技术有限公司' },
{ company: '蚂蚁金服有限公司' },
{},
];

const personData = [
{ person: 'Vernon Norman' },
{ person: 'David Hammond' },
];

const mixArray = (arr1, arr2) => {
const twoArray = arr1.map(item => arr2.map(i => ({ ...item, ...i })));
const result = [];
twoArray.forEach((item) => {
item.forEach((i) => {
result.push(i);
});
});
return result;
};

class Demo extends React.Component {
render() {
const tableProps = {
jsxcolumns: [
{ dataKey: 'company', title: '公司', width: '20%' },
{ dataKey: 'title', title: '标题', width: '20%', fixed: true },
{ dataKey: 'money', title: '金额', width: '20%', type: 'money' },
{ dataKey: 'entity', title: '支付实体', width: '50%' },
{ dataKey: 'institution', title: '金融机构', width: '20%' },
{ dataKey: 'person', title: '申请人', width: '20%' },
],
jsxdata: {
data: mixArray(personData, companyData).map(item => ({ ...item, ...commonData })),
},
className: 'kuma-uxtable-split-line',
rowGroupKey: 'company',
footer: ({ data, column, from, rowGroupData = [] }) => {
if (column.dataKey === 'title') {
return '合计';
}
if (column.dataKey === 'money') {
let total = 0;
if (from === 'rowGroup') {
rowGroupData.forEach((rowData) => {
total += parseInt(rowData.money, 10);
});
} else {
data.forEach((rowData) => {
total += parseInt(rowData.money, 10);
});
}

return Formatter.money(total.toString(), ',');
}
return null;
},
// width: 600,
size: 'small',
showRowGroupFooter: true,
// height: 300,
};
return (
<Table {...tableProps} />
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-table-demo-footer'));
````

````css
````
70 changes: 70 additions & 0 deletions site/components/table/demo/row-group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 行分组

- order: 12

根据某列的值进行行分组


---

````jsx

import { Table } from 'uxcore';

const commonData = {
title: '一级标题',
entity: '蚂蚁金服(中国)',
institution: '招商银行丨杭州分行',
};

const companyData = [
{ company: '阿里巴巴网络技术有限公司' },
{ company: '蚂蚁金服有限公司' },
{},
];

const personData = [
{ person: 'Vernon Norman' },
{ person: 'David Hammond' },
];

const mixArray = (arr1, arr2) => {
const twoArray = arr1.map(item => arr2.map(i => ({ ...item, ...i })));
const result = [];
twoArray.forEach((item) => {
item.forEach((i) => {
result.push(i);
});
});
return result;
};

//* 第一列为radio的demo
class Demo extends React.Component {
render() {
const tableProps = {
jsxcolumns: [
{ dataKey: 'company', title: '公司', width: 200 },
{ dataKey: 'title', title: '标题', width: 200 },
{ dataKey: 'entity', title: '支付实体', width: 200 },
{ dataKey: 'institution', title: '金融机构', width: 200 },
{ dataKey: 'person', title: '申请人', width: 200 },
],
jsxdata: {
data: mixArray(personData, companyData).map(item => ({ ...item, ...commonData })),
},
className: 'kuma-uxtable-split-line',
rowGroupKey: 'company',
showColumnPicker: true,
};
return (
<Table {...tableProps} />
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-table-demo-row-group'));
````

````css
````
20 changes: 20 additions & 0 deletions site/components/time-picker/demo/12h.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 12 小时制

- order: 3

---

````jsx

import { TimePicker } from 'uxcore';

class Demo extends React.Component {
render() {
return (
<TimePicker use12Hours />
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-time-picker-demo-12h'));
````
22 changes: 22 additions & 0 deletions site/components/time-picker/demo/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 基本使用

- order: 0

基本使用

---

````jsx

import { TimePicker } from 'uxcore';

class Demo extends React.Component {
render() {
return (
<TimePicker />
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-time-picker-demo-basic'));
````
34 changes: 34 additions & 0 deletions site/components/time-picker/demo/control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 受控模式

- order: 1

通过 value 和 onChange 进入受控模式

---

````jsx

import { TimePicker } from 'uxcore';

class Demo extends React.Component {
constructor(props) {
super(props);
this.state = {
value: new Date().getTime(),
};
}
render() {
return (
<TimePicker
value={this.state.value}
onChange={(value) => {
console.log(value);
this.setState({ value });
}}
/>
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-time-picker-demo-control'));
````
21 changes: 21 additions & 0 deletions site/components/time-picker/demo/hm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 选择时分

- order: 2


---

````jsx

import { TimePicker } from 'uxcore';

class Demo extends React.Component {
render() {
return (
<TimePicker showSecond={false} />
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-time-picker-demo-hm'));
````
26 changes: 26 additions & 0 deletions site/components/time-picker/demo/size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 尺寸

- order: 4

提供大中小三种尺寸

---

````jsx

import { TimePicker } from 'uxcore';

class Demo extends React.Component {
render() {
return (
<div>
<TimePicker />
<TimePicker size="middle" style={{ marginTop: 10 }} />
<TimePicker size="small" style={{ marginTop: 10 }} />
</div>
);
}
}

ReactDOM.render(<Demo />, document.getElementById('components-time-picker-demo-size'));
````
45 changes: 45 additions & 0 deletions site/components/time-picker/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# TimePicker

- category: Components
- subtype: Form Control
- chinese: 时间选择器

---

## Props

| Name | Type | Required | Default | Comments |
|---|---|---|---|---|
| locale | String | No | 'zh-cn' | 国际化,枚举值 zh-cn/en-us |
| clearText | String | No | 'clear' | 清除按钮的文字提示 |
| disabled | Boolean | No | false | 是否禁用 |
| allowEmpty | Boolean | No | true | 允许清空 |
| open | Boolean | No | false | 当前下拉展开的状态,受控属性 |
| defaultValue | moment | No | null | 默认初始值,非受控属性 |
| defaultOpenValue | moment | No | moment() | 默认面板值,用于没有设置 value/defaultValue 时,设置时区、语言 |
| value | moment | No | null | 当前值 |
| placeholder | String | No | '' | 输入框占位符 |
| className | String | No | '' | 触发区域的 className|
| id | String | No | '' | 触发区域的 id |
| popupClassName | String | No | '' | 面板的 className |
| showHour | Boolean | No | true | 是否显示小时 |
| showMinute | Boolean | No | true | 是否显示分钟 |
| showSecond | Boolean | No | true | 是否显示秒 |
| format | String | No | - | moment format |
| disabledHours | Function | No | - | 禁用小时回调 |
| disabledMinutes | Function | No | - | 禁用分钟回调 |
| disabledSeconds | Function | No | - | 禁用秒回调 |
| use12Hours | Boolean | No | false | 12 小时显示模式 |
| hideDisabledOptions | Boolean | No | false | 是否隐藏被禁用的选项 |
| onChange | Function | No | null | 选择不同的值触发 |
| addon | Function | No | - | 面板的渲染回调,用于在面板底部渲染一些其他元素,例如确认按钮,接受 panel 实例作为参数,可以使用 `panel.close()` 来关闭 panel|
| placement | String | No | bottomLeft | one of ['left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'] |
| transitionName | String | No | '' | |
| name | String | No | - | 设置输入框的 name 属性 |
| onOpen | Function({ open }) | No | | 在面板展开时调用 |
| onClose | Function({ open }) | No | | 在面板收起时调用 |
| hourStep | Number | No | 1 | 小时选项间隔 |
| minuteStep | Number | No | 1 | 分钟选项间隔 |
| secondStep | Number | No | 1 | 秒选项间隔 |
| focusOnOpen | Boolean | No | false | 面板展开时自动聚焦到输入框 |
| inputReadOnly | Boolean | No | false | 输入框只读 |
23 changes: 23 additions & 0 deletions tools/gulp-gh-pages/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright

2014 Micheal Benedict (@micheal)
2015 Shinnosuke Watanabe (@shinnn)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 05d706f

Please sign in to comment.