Skip to content

Commit

Permalink
docs(sheet.md): filter
Browse files Browse the repository at this point in the history
1.protection doc 2.filter doc
  • Loading branch information
Dushusir committed Oct 16, 2020
1 parent cba44ea commit 464a4ab
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 56 deletions.
138 changes: 104 additions & 34 deletions docs/guide/sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ eg: options.data:
"rowhidden":{}, //hidden rows
"colhidden":{}, //hidden columns
"borderInfo":{}, //borders
"authority":{}, //Worksheet protection
},
"scrollLeft": 0, //Left and right scroll bar position
"scrollTop": 315, //Up and down scroll bar position
Expand Down Expand Up @@ -358,6 +359,44 @@ eg: options.data:
```
Means to set the cell `"D4"`, the upper border/lower border/left border/right border are all border thicknesses `"MediumDashDot"`, color is `"rgb(255, 0, 0)"`

#### config.authority
- type:Object
- default:{}
- usage:Worksheet protection, you can set that the entire worksheet is not allowed to be edited or some areas are not editable. If you want to apply for editing permission, you need to enter a password, and customize the types of operations that users can operate.
- example:
```js
"authority":{//Permission configuration of the current worksheet
    selectLockedCells:1, //Select locked cells
    selectunLockedCells:1, //Select unlocked cells
    formatCells:1, //Format cells
    formatColumns:1, //Format columns
    formatRows:1, //Format rows
    insertColumns:1, //Insert columns
    insertRows:1, //Insert rows
    insertHyperlinks:1, //Insert hyperlinks
    deleteColumns:1, //Delete columns
    deleteRows:1, //Delete rows
    sort:1, //Sort
    filter:1, //Filter
    usePivotTablereports:1, //Use Pivot Table reports
    editObjects:1, //Edit objects
    editScenarios:1, //Edit scenarios   
    sheet:1, //If it is 1 or true, the worksheet is protected; if it is 0 or false, the worksheet is not protected.
    hintText:"", //The text of the pop-up prompt
    algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
    saltValue:null, //The salt parameter for password decryption is a random value set by yourself
    
    allowRangeList:[{ //Range protection
        name:"area", //Name
        password:"1", //Password
        hintText:"", //Prompt text
        algorithmName:"None",//Encryption scheme: MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
        saltValue:null, //The salt parameter for password decryption is a random value set by yourself
        sqref:"$C$1:$D$5" //Protected range
    }],
},
```

------------
### scrollLeft
- type:Number
Expand Down Expand Up @@ -475,7 +514,7 @@ eg: options.data:
### filter_select
- type:Object
- default:{}
- usage: Filter range, a selection area, a sheet has only one filter range, similar to the `luckysheet_select_save`
- usage:Filter range. A selection and a sheet have only one filter range, similar to `luckysheet_select_save`. If you just create a selection to turn on the filter function, you can configure this range. If you need to set further detailed filter conditions, you need to configure the [filter](#filter) property of the same level.
- example:
```js
{
Expand All @@ -489,36 +528,64 @@ eg: options.data:
### filter
- type:Object
- default:{}
- usage: filter settings
- example:
- usage:The specific settings of the filter match with the filter range of `filter_select`. When you create a filter area on the first sheet, you can also see the filter configuration information of the first sheet through `luckysheet.getLuckysheetfile()[0].filter`.

The following is a complete filter configuration example
```js
{
{
//"0" means the first column
"0": {
"caljs": { // filter type
"value": "cellnull",
"text": "Is empty",
"type": "0"
"caljs": { // Filter by condition
"value": "cellnull", // Filter type
"text": "Is empty", // Type description
"type": "0" // Filter categories
},
"rowhidden": { "3": 0, "4": 0 }, // the hidden rows
"optionstate": true, //is config active
"str": 2, // the index of start row
"edr": 6, // the index of end row
"cindex": 1, // Current range column index
"stc": 1, // the index of start column
"edc": 3 // the index of end column
"rowhidden": { "3": 0, "4": 0 }, // Hidden row information
"optionstate": true, // Whether to enable configuration
"cindex": 1, // The current range column order, here is the first column
"str": 2, // Range, start row
"edr": 6, // Range, end row
"stc": 1, // Range, start column
"edc": 3 // Range, end column
},
//"1" means the second column
"1": {
"caljs": {},
"rowhidden": { "6": 0 },
"rowhidden": { "1": 0},
"optionstate": true,
"cindex": 2, // The current range column order, here is the second column
"str": 2,
"edr": 6,
"cindex": 2,
"stc": 1,
"edc": 3
}
}
```
1. The `key` value of `filter[key]` means the column index, starting from 0, the `cindex` in the specific setting item starts from 1, which has the same meaning as the `key` here.
2. `caljs` is used to set the filter type and the corresponding value. After the setting takes effect, the hidden row information will be calculated and stored in `rowhidden`. The following are all the types that can be set, among which `value1` and `value2` are the text information filled in by the user:
+ `caljs:{value: null, text: "None", type: "0"}`
+ `caljs:{value: "cellnull", text: "Is empty", type: "0"}`
+ `caljs:{value: "cellnonull", text: "Is not empty", type: "0"}`
+ `caljs:{value: "textinclude", text: "Text contains", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textnotinclude", text: "Text does not contain", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textstart", text: "Text starts with", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textend", text: "Text ends with", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textequal", text: "Text is exactly", type: "1", value1: "Lucky"}`
+ `caljs:{value: "dateequal", text: "Date is", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "datelessthan", text: "Date is before", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "datemorethan", text: "Date is after", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "morethan", text: "Greater than", type: "1", value1: "10"}`
+ `caljs:{value: "moreequalthan", text: "Greater than or equal to", type: "1", value1: "10"}`
+ `caljs:{value: "lessthan", text: "Less than", type: "1", value1: "10"}`
+ `caljs:{value: "lessequalthan", text: "Less than or equal to", type: "1", value1: "10"}`
+ `caljs:{value: "equal", text: "Is equal to", type: "1", value1: "10"}`
+ `caljs:{value: "noequal", text: "Is not equal to", type: "1", value1: "10"}`
+ `caljs:{value: "include", text: "Is between", type: "2", value1: "15", value2: "25"}`
+ `caljs:{value: "noinclude", text: "Is not between", type: "2", value1: "15", value2: "25"}`
3. `rowhidden` is stored hidden row information, but if `caljs` is not set to filter by conditions, it means that color filtering (if there is a color distinction between the rows) and filtering by value are set. So it can be seen that the priority of `caljs` is greater than that of `rowhidden`.
4. `optionstate` indicates whether to enable the configuration, this is an internal flag, just set `true` directly.
5. `cindex` represents the column order currently set, counting from 1 and corresponding to the `key` value of `filter[key]`, and the result is `key`+1.
6. `str` is the start row, `edr` is the end row, `stc` is the start column, and `edc` is the end column. The four numbers represent the entire filter range, which should be consistent with the content of `filter_select`.

------------
### luckysheet_alternateformat_save
Expand Down Expand Up @@ -1282,41 +1349,44 @@ At this point, the lucky sheet file contains many local parameters that are not
"status": 1, //Worksheet active status
"order": 0, //The order of the worksheet
"hide": 0,//Whether worksheet hide
"row": 36, //the number of rows in a sheet
"column": 18, //the number of columns in a sheet
"row": 36, //The number of rows in a sheet
"column": 18, //The number of columns in a sheet
"celldata": [], //Initial the cell data
"config": {
"merge":{}, //merged cells
"merge":{}, //Merged cells
"rowlen":{}, //Table row height
"columnlen":{}, //Table column width
"rowhidden":{}, //hidden rows
"colhidden":{}, //hidden columns
"borderInfo":{}, //borders
"rowhidden":{}, //Hidden rows
"colhidden":{}, //Hidden columns
"borderInfo":{}, //Borders
"authority":{}, //Worksheet protection
},
"scrollLeft": 0, //Left and right scroll bar position
"scrollTop": 315, //Up and down scroll bar position
"luckysheet_select_save": [], //selected area
"luckysheet_select_save": [], //Selected area
"calcChain": [],//Formula chain
"isPivotTable":false,//Whether is pivot table
"pivotTable":{},//Pivot table settings
"filter_select": {},//Filter range
"filter": null,//Filter configuration
"luckysheet_alternateformat_save": [], //Alternate colors
"luckysheet_alternateformat_save_modelCustom": [], //Customize alternate colors
"luckysheet_conditionformat_save": {},//condition format
"frozen": {}, //freeze row and column configuration
"freezen": {}, //storage freeze row and column rendering data
"luckysheet_conditionformat_save": {},//Condition format
"frozen": {}, //Freeze row and column configuration
"freezen": {}, //Storage freeze row and column rendering data
"chart": [], //Chart configuration
"allowEdit": true, //is editable
"zoomRatio":1, // zoom ratio
"allowEdit": true, //Editable
"zoomRatio":1, // Zoom ratio
"image":[], //image
"showGridLines": 1, //Whether to show grid lines
"visibledatarow": [], //positions of all rows
"visibledatacolumn": [], //positions of all columns
"visibledatarow": [], //Positions of all rows
"visibledatacolumn": [], //Positions of all columns
"ch_width": 2322, //The width of a sheet
"rh_height": 949, //The height of a sheet
"load": "1", //check whether this sheed has been loaded
"data": [], // store and update the cell data
"rh_height": 949, //The heighSt of a sheet
"load": "1", //Check whether this sheed has been loaded
"data": [], // Store and update the cell data
},
{
"name": "Sheet2",
Expand Down
9 changes: 0 additions & 9 deletions docs/zh/guide/cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,6 @@
</td>
<td></td>
</tr>
<tr>
<td>ae</td>
<td>allowEdit</td>
<td>是否允许编辑[暂未实现]</td>
<td>
0: 只读,不可编辑 1:可以编辑,默认为 1
</td>
<td></td>
</tr>
</table>

一个规范的单元格对象如下:
Expand Down
97 changes: 84 additions & 13 deletions docs/zh/guide/sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ options.data示例如下:
"rowhidden":{}, //隐藏行
"colhidden":{}, //隐藏列
"borderInfo":{}, //边框
"authority":{}, //工作表保护

},
"scrollLeft": 0, //左右滚动条位置
"scrollTop": 315, //上下滚动条位置
Expand Down Expand Up @@ -358,6 +360,44 @@ options.data示例如下:
```
表示设置单元格`"D4"`,上边框/下边框/左边框/右边框都是边框粗细为`"MediumDashDot"`,颜色为`"rgb(255, 0, 0)"`

#### config.authority
- 类型:Object
- 默认值:{}
- 作用:工作表保护,可以设置当前整个工作表不允许编辑或者部分区域不可编辑,如果要申请编辑权限需要输入密码,自定义配置用户可以操作的类型等。
- 示例:
```js
"authority":{//当前工作表的权限配置
    selectLockedCells:1, //选定锁定单元格
    selectunLockedCells:1, //选定解除锁定的单元格
    formatCells:1, //设置单元格格式
    formatColumns:1, //设置列格式
    formatRows:1, //设置行格式
    insertColumns:1, //插入列
    insertRows:1, //插入行
    insertHyperlinks:1, //插入超链接
    deleteColumns:1, //删除列
    deleteRows:1, //删除行
    sort:1, //排序
    filter:1, //使用自动筛选
    usePivotTablereports:1, //使用数据透视表和报表
    editObjects:1, //编辑对象
    editScenarios:1, //编辑方案    
    sheet:1, //如果为1或true,则该工作表受到保护;如果为0或false,则该工作表不受保护。
    hintText:"", //弹窗提示的文字
    algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
    saltValue:null, //密码解密的盐参数,为一个自己定的随机数值
    
    allowRangeList:[{ //区域保护
        name:"area", //名称
        password:"1", //密码
        hintText:"", //提示文字
        algorithmName:"None",//加密方案:MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
        saltValue:null, //密码解密的盐参数,为一个自己定的随机数值
        sqref:"$C$1:$D$5" //区域范围
    }],
},
```

------------
### scrollLeft
- 类型:Number
Expand Down Expand Up @@ -478,7 +518,7 @@ options.data示例如下:
### filter_select
- 类型:Object
- 默认值:{}
- 作用: 筛选范围一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`
- 作用: 筛选范围一个选区,一个sheet只有一个筛选范围,类似`luckysheet_select_save`。如果仅仅只是创建一个选区打开筛选功能,则配置这个范围即可,如果还需要进一步设置详细的筛选条件,则需要另外配置同级的 [filter](#filter) 属性。
- 示例:
```js
{
Expand All @@ -492,36 +532,64 @@ options.data示例如下:
### filter
- 类型:Object
- 默认值:{}
- 作用: 筛选的具体设置
- 示例:
- 作用: 筛选的具体设置,跟`filter_select`筛选范围是互相搭配的。当你在第一个sheet页创建了一个筛选区域,通过`luckysheet.getLuckysheetfile()[0].filter`也可以看到第一个sheet的筛选配置信息。

以下是一个完整的筛选配置案例
```js
{
{
//"0"表示第一列
"0": {
"caljs": { // 条件筛选类型
"value": "cellnull",
"text": "Is empty",
"type": "0"
"caljs": { // 按条件筛选
"value": "cellnull", // 筛选类型
"text": "Is empty", // 类型说明
"type": "0" // 筛选大类
},
"rowhidden": { "3": 0, "4": 0 }, // 隐藏行
"optionstate": true, //是否开启配置
"rowhidden": { "3": 0, "4": 0 }, // 隐藏行信息
"optionstate": true, // 是否开启配置
"cindex": 1, // 当前范围列顺序,这里表示第一列
"str": 2, // 范围,起始行
"edr": 6, // 范围,结束行
"cindex": 1, // 当前范围列索引
"stc": 1, // 范围,起始列
"edc": 3 // 范围,结束列
},
//"1"表示第二列
"1": {
"caljs": {},
"rowhidden": { "6": 0 },
"rowhidden": { "1": 0},
"optionstate": true,
"cindex": 2, // 当前范围列顺序,这里表示第二列
"str": 2,
"edr": 6,
"cindex": 2,
"stc": 1,
"edc": 3
}
}
```
1. `filter[key]``key`值,表示是列索引,从0开始,具体设置项中的`cindex`是从1开始,和这里的`key`是同一个意思。
2. `caljs`用来设置按条件筛选的类型和对应的值,设置生效后,会计算隐藏行信息存储在`rowhidden`中。以下是全部的可设置的类型,其中`value1``value2`就是用户自己填的文本信息:
+ `caljs:{value: null, text: "无", type: "0"}`
+ `caljs:{value: "cellnull", text: "单元格为空", type: "0"}`
+ `caljs:{value: "cellnonull", text: "单元格有数据", type: "0"}`
+ `caljs:{value: "textinclude", text: "文本包含", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textnotinclude", text: "文本不包含", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textstart", text: "文本开头为", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textend", text: "文本结尾为", type: "1", value1: "Lucky"}`
+ `caljs:{value: "textequal", text: "文本等于", type: "1", value1: "Lucky"}`
+ `caljs:{value: "dateequal", text: "日期等于", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "datelessthan", text: "日期早于", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "datemorethan", text: "日期晚于", type: "1", value1: "2020-10-16"}`
+ `caljs:{value: "morethan", text: "大于", type: "1", value1: "10"}`
+ `caljs:{value: "moreequalthan", text: "大于等于", type: "1", value1: "10"}`
+ `caljs:{value: "lessthan", text: "小于", type: "1", value1: "10"}`
+ `caljs:{value: "lessequalthan", text: "小于等于", type: "1", value1: "10"}`
+ `caljs:{value: "equal", text: "等于", type: "1", value1: "10"}`
+ `caljs:{value: "noequal", text: "不等于", type: "1", value1: "10"}`
+ `caljs:{value: "include", text: "介于", type: "2", value1: "15", value2: "25"}`
+ `caljs:{value: "noinclude", text: "不在其中", type: "2", value1: "15", value2: "25"}`
3. `rowhidden`是存储的隐藏行信息,但是如果没有设置`caljs`按条件筛选,则表明是设置了按颜色筛选(如果行之间有颜色区分的话)和按值进行筛选。所以可以看出,`caljs`的优先级大于`rowhidden`
4. `optionstate`表示是否开启配置,这是一个内部标识,直接设置`true`即可。
5. `cindex`表示当前设置的列顺序,从1开始计数,和`filter[key]``key`值形成对应,结果是`key`+1
6. `str`是起始行,`edr`是结束行,`stc`是起始列,`edc`是结束列,四个数字代表整个筛选范围,与`filter_select`的内容保持一致即可。

------------
### luckysheet_alternateformat_save
Expand Down Expand Up @@ -1295,6 +1363,7 @@ Luckysheet在初始化完成之后进行的一系列操作,会将更多本地
"rowhidden":{}, //隐藏行
"colhidden":{}, //隐藏列
"borderInfo":{}, //边框
"authority":{}, //工作表保护
},
"scrollLeft": 0, //左右滚动条位置
"scrollTop": 315, //上下滚动条位置
Expand All @@ -1312,6 +1381,8 @@ Luckysheet在初始化完成之后进行的一系列操作,会将更多本地
"chart": [], //图表配置
"allowEdit": true, //是否允许编辑
"zoomRatio":1, // 缩放比例
"image":[], //图片
"showGridLines": 1, //是否显示网格线
"visibledatarow": [], //所有行的位置
Expand Down

0 comments on commit 464a4ab

Please sign in to comment.