Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(numeral): userInfo
Browse files Browse the repository at this point in the history
fix #338
  • Loading branch information
mengshukeji committed Dec 17, 2020
1 parent 8918561 commit 871d381
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 40 deletions.
4 changes: 4 additions & 0 deletions deploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ git push -f origin master:gh-pages

# ===============================================

# add a tags
git tag -a doc -m "doc"


# replease
npm run build
npm run release -- --release-as patch
Expand Down
51 changes: 48 additions & 3 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,54 @@ Note that you also need to configure `loadUrl` and `loadSheetUrl` to take effect

------------
### userInfo
- Type: String
- Default: `'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit'`
- Usage: User information display style in the upper right corner
- Type: String | Boolean | Object
- Default: false
- Usage: User information display style in the upper right corner,Support the following three formats
1. HTML template string, such as:

```js
options:{
// Other configuration
userInfo:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky',
}
```

Or an ordinary string, such as:

```js
options:{
// Other configuration
userInfo:'Lucky',
}
```

2. Boolean type, such as:

`false`: Do not show
```js
options:{
// Other configuration
userInfo:false, // Do not display user information
}

```
`ture`: Show the default string
```js
options:{
// Other configuration
userInfo:true, // Show HTML:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky'
}

```
3. Object format, set `userImage`: user avatar address and `userName`: user name, such as:
```js
options:{
// Other configuration
userImage:'https://cdn.jsdelivr.net/npm/[email protected]/assets/img/logo/logo.png', // Avatar url
userName:'Lucky', // username
}
```
4. Note that if set to `undefined` or not set, the same as setting `false`

------------
### userMenuItem
Expand Down
52 changes: 49 additions & 3 deletions docs/zh/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,55 @@ Luckysheet开放了更细致的自定义配置选项,分别有

------------
### userInfo
- 类型:String
- 默认值:`'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit'`
- 作用:右上角的用户信息展示样式
- 类型:String | Boolean | Object
- 默认值:false
- 作用:右上角的用户信息展示样式,支持以下三种形式
1. HTML模板字符串,如:

```js
options:{
// 其他配置
userInfo:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky',
}
```

或者一个普通字符串,如:

```js
options:{
// 其他配置
userInfo:'Lucky',
}
```

2. Boolean类型,如:

`false`:不展示
```js
options:{
// 其他配置
userInfo:false, // 不展示用户信息
}

```
`ture`:展示默认的字符串
```js
options:{
// 其他配置
userInfo:true, // 展示HTML:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky'
}

```
3. 对象格式,设置 `userImage`:用户头像地址 和 `userName`:用户名,如:
```js
options:{
// 其他配置
userImage:'https://cdn.jsdelivr.net/npm/[email protected]/assets/img/logo/logo.png', // 头像url
userName:'Lucky', // 用户名
}
```

4. 注意,设置为`undefined`或者不设置,同设置`false`

------------
### userMenuItem
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const paths = {
'src/plugins/js/spectrum.min.js',
'src/plugins/js/jquery-ui.min.js',
'src/plugins/js/jquery.mousewheel.min.js',
'src/plugins/js/numeral.min.js',
// 'src/plugins/js/numeral.min.js',
'src/plugins/js/html2canvas.min.js',
'src/plugins/js/localforage.min.js',
'src/plugins/js/lodash.min.js',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"dayjs": "^1.9.6",
"flatpickr": "^4.6.6",
"jquery": "^2.2.4",
"numeral": "^2.0.6",
"pako": "^1.0.11"
},
"scripts": {
Expand Down
8 changes: 1 addition & 7 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ export default {
// menu: "undo|redo|freezenrow|freezencolumn|download|share|chart|pivot",
data: [{ "name": "Sheet1", color: "", "status": "1", "order": "0", "data": [], "config": {}, "index":0 }, { "name": "Sheet2", color: "", "status": "0", "order": "1", "data": [], "config": {}, "index":1 }, { "name": "Sheet3", color: "", "status": "0", "order": "2", "data": [], "config": {}, "index":2 }], //客户端sheet数据[shee1, sheet2, sheet3]
title: "Luckysheet Demo", //表格的名称
// userInfo: '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit'
userInfo:{
isShow:false,
str:'',
url:'',
username:'',
},//右上角的用户信息展示样式
userInfo:false,// 右上角的用户信息展示样式,支持 1. boolean类型:false:不展示,ture:展示默认 '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit' ,2. HTML模板字符串或者普通字符串,如:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky'或者'用户名', 3. 对象格式,设置 userImage:用户头像地址 和 userName:用户名 4. 不设置或者设置undefined同设置false
userMenuItem: [{url:"www.baidu.com", "icon":'<i class="fa fa-folder" aria-hidden="true"></i>', "name":"我的表格"}, {url:"www.baidu.com", "icon":'<i class="fa fa-sign-out" aria-hidden="true"></i>', "name":"退出登陆"}], //点击右上角的用户信息弹出的菜单
myFolderUrl: "www.baidu.com", //左上角<返回按钮的链接
config: {}, //表格行高、列宽、合并单元格、公式等设置
Expand Down
17 changes: 12 additions & 5 deletions src/controllers/constant.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/controllers/luckysheetConfigsetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const luckysheetConfigsetting = {
pointEditUpdate: null,
pointEditZoom: 1,

userInfo: {},
userInfo: false,
userMenuItem: [],
myFolderUrl: null,
functionButton: null,
Expand Down
1 change: 1 addition & 0 deletions src/controllers/pivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import server from './server';
import {checkProtectionAuthorityNormal} from './protection';
import Store from '../store';
import locale from '../locale/locale';
import numeral from 'numeral';

const pivotTable = {
pivotDatas: null,
Expand Down
4 changes: 2 additions & 2 deletions src/css/luckysheet-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
}
#luckysheet_info_detail_user_img {
vertical-align: middle;
height: 30px;
line-height: 30px;
height: 20px;
line-height: 20px;
border-radius: 50%;
object-fit: cover;
}
Expand Down
1 change: 1 addition & 0 deletions src/function/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { inverse } from '../function/matrix_methods';
import { getSheetIndex, getluckysheetfile, getRangetxt } from '../methods/get';
import { getObjType, ABCatNum } from '../utils/util';
import Store from '../store';
import numeral from 'numeral';

//函数功能:比较或运算
function luckysheet_compareWith() {
Expand Down
3 changes: 2 additions & 1 deletion src/function/functionImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { orderbydata } from '../global/sort';
import { getcellvalue } from '../global/getdata';
import { getObjType, ABCatNum, chatatABC, numFormat } from '../utils/util';
import Store from '../store';
import dayjs from 'dayjs'
import dayjs from 'dayjs';
import numeral from 'numeral';

//公式函数计算
const functionImplementation = {
Expand Down
7 changes: 5 additions & 2 deletions src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6260,8 +6260,11 @@ export function toJson(){
// row and column
getluckysheetfile().forEach((file,index)=>{

toJsonOptions.data[index].row = file.data.length;
toJsonOptions.data[index].column = getObjType(file.data[0]) === 'array' ? file.data[0].length : 0;
if(file.data == undefined){
return;
}
toJsonOptions.data[index].row = getObjType(file.data) === 'array' ? file.data.length : 0;
toJsonOptions.data[index].column = getObjType(file.data[0]) === 'array' ? file.data[0].length : 0;

})

Expand Down
1 change: 1 addition & 0 deletions src/global/format.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isRealNum, valueIsError } from './validate';
import { isdatetime } from './datecontroll';
import { getcellvalue } from './getdata';
import numeral from 'numeral';

var SSF = ({});
var make_ssf = function make_ssf(SSF) {
Expand Down
1 change: 1 addition & 0 deletions src/global/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { rowlenByRange } from './getRowlen';
import { jfrefreshgrid } from './refresh';
import {checkProtectionAuthorityNormal} from '../controllers/protection';
import Store from '../store';
import numeral from 'numeral';

//数据排序方法
function orderbydata(data, index, isAsc) {
Expand Down
6 changes: 0 additions & 6 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@
container: 'luckysheet',
lang: lang,
forceCalculation:false,
userInfo: {
isShow:true,
str:'<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> rabbit',
url:'https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1490464830,1853038030&fm=26&gp=0.jpg',
username:'lucky'
},
plugins: ['chart'],
fontList:[
{
Expand Down
Loading

0 comments on commit 871d381

Please sign in to comment.