diff --git a/docs/guide/README.md b/docs/guide/README.md index 272dcb4..9e8f407 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -136,6 +136,7 @@ After `npm run build`, all files in the `dist` folder are copied to the project + ``` diff --git a/docs/guide/api.md b/docs/guide/api.md index 927b12b..f9a95c9 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -541,6 +541,54 @@ Use note: ------------ +### setRowHeight(rowInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Object} [rowInfo]: Correspondence between number of rows and height + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the height of the specified ~~row~~ + +- **Usage**: + + - Set the height of the first row to 50px and the height of the second row to 60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Number} [columnInfo]: Correspondence between the number of columns and the width + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the width of the specified column + +- **Usage**: + + - Set the width of the first column to 50px and the width of the second column to 60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + ## Selection operation ### getRange() @@ -2013,6 +2061,32 @@ Use note: ------------ +### setSheetZoom(zoom [,setting]) + +[todo] + + +- **Parameter**: + + - {Number} [zoom]: Worksheet zoom ratio + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set worksheet zoom ratio + + +- **Usage**: + + - Set the current worksheet zoom ratio to 0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + ### showGridLines([setting]) - **Parameter**: @@ -2295,6 +2369,63 @@ Use note: ------------ +## Data Verification + +### setDataVerification(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for data verification + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to set the data verification function and set the parameters + +------------ + +### deleteDataVerification([setting]) + +[todo, to be confirmed whether it is reasonable] + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to delete the data verification function + +------------ + +## Worksheet Protection + + +### setProtection(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for worksheet protection + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet to set the worksheet protection + +------------ + ## Public method ### transToCellData(data [,setting])
diff --git a/docs/guide/config.md b/docs/guide/config.md index a1c016c..4d9e44d 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -743,6 +743,25 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura - {String} [oldColor]: Before modification, the current worksheet color - {String} [newColor]: After modification, the current worksheet color +------------ +### sheetZoomBefore +- Type: Function +- Default: null +- Usage: Before worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [zoom]: Current worksheet zoom ratio + +------------ +### sheetZoomAfter +- Type: Function +- Default: null +- Usage: After worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [oldZoom]: Before modification, the current worksheet zoom ratio + - {String} [newZoom]: After modification, the current worksheet zoom ratio + ------------ ## Workbook diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md index 950d613..0659af5 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/guide/README.md @@ -137,6 +137,7 @@ npm run build + ``` diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 9bb9790..9fed4d3 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -542,6 +542,54 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +### setRowHeight(rowInfo [,setting]) + +(TODO) + +- **参数**: + + - {Object} [rowInfo]: 行数和高度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定行的高度 + +- **示例**: + + - 设置第一行高度为50px,第二行高度为60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +(TODO) + +- **参数**: + + - {Number} [columnInfo]: 列数和宽度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定列的宽度 + +- **示例**: + + - 设置第一列宽度为50px,第二列宽度为60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + ## 选区操作 ### getRange() @@ -1954,6 +2002,32 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +### setSheetZoom(zoom [,setting]) + +[todo] + + +- **参数**: + + - {Number} [zoom]: 工作表缩放比例 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置工作表缩放比例 + + +- **示例**: + + - 设置当前工作表缩放比例为0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + ### showGridLines([setting]) - **参数**: @@ -2219,6 +2293,63 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +## 数据验证 + +### setDataVerification(option, [setting]) + +[todo] + +- **参数**: + + - {Object} [option]: 数据验证的配置信息 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围设置数据验证功能,并设置参数 + +------------ + +### deleteDataVerification([setting]) + +[todo,待确认是否合理] + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围删除数据验证功能 + +------------ + +## 工作表保护 + + +### setProtection(option, [setting]) + +[todo] + +- **参数**: + + - {Object} [option]: 工作表保护的配置信息 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表设置工作表保护功能 + +------------ + ## 公共方法 ### transToCellData(data [,setting]) @@ -2261,6 +2392,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ + ## 旧版API ::: warning diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index 0d804e0..b3d54bd 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -744,6 +744,25 @@ Luckysheet开放了更细致的自定义配置选项,分别有 - {String} [oldColor]: 修改前当前sheet页颜色 - {String} [newColor]: 修改后当前sheet页颜色 +------------ +### sheetZoomBefore +- 类型:Function +- 默认值:null +- 作用:sheet缩放前 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [zoom]: 当前sheet页缩放比例 + +------------ +### sheetZoomAfter +- 类型:Function +- 默认值:null +- 作用:sheet缩放后 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [oldZoom]: 修改前当前sheet页缩放比例 + - {String} [newZoom]: 修改后当前sheet页缩放比例 + ------------ ## 工作簿 diff --git a/src/controllers/imageCtrl.js b/src/controllers/imageCtrl.js index 3144047..eb31e58 100644 --- a/src/controllers/imageCtrl.js +++ b/src/controllers/imageCtrl.js @@ -97,19 +97,19 @@ const imageCtrl = { let src = imgItem.src; let imgItemParam = _this.getImgItemParam(imgItem); - let width = imgItemParam.width*Store.zoomRatio; - let height = imgItemParam.height*Store.zoomRatio; - let left = imgItemParam.left*Store.zoomRatio; - let top = imgItemParam.top*Store.zoomRatio; + let width = imgItemParam.width * Store.zoomRatio; + let height = imgItemParam.height * Store.zoomRatio; + let left = imgItemParam.left * Store.zoomRatio; + let top = imgItemParam.top * Store.zoomRatio; let position = imgItemParam.position; let borderWidth = imgItem.border.width; return `