diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3d0b88d..03305e8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} + cache: false - name: Checkout code uses: actions/checkout@v4 @@ -40,6 +41,8 @@ jobs: - name: Codecov uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: directory: ./cmd file: coverage.txt @@ -67,7 +70,7 @@ jobs: cp src/index.d.ts ./dist - name: NPM Publish - uses: JS-DevTools/npm-publish@v2 + uses: JS-DevTools/npm-publish@v3 with: - token: ${{secrets.NPM_TOKEN}} + token: ${{ secrets.NPM_TOKEN }} package: ./dist/package.json diff --git a/LICENSE b/LICENSE index 27dbcb9..84e2e77 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2022 - 2023 The excelize-wasm Authors. +Copyright (c) 2022 - 2024 The excelize-wasm Authors. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/cmd/go.mod b/cmd/go.mod index e34cf6d..763de51 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.4 - github.com/xuri/excelize/v2 v2.8.2-0.20240328083735-ffad7aecb5b9 + github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3 golang.org/x/image v0.15.0 ) @@ -16,8 +16,8 @@ require ( github.com/richardlehane/msoleps v1.0.3 // indirect github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/text v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/cmd/go.sum b/cmd/go.sum index bf6addc..e607fe3 100644 --- a/cmd/go.sum +++ b/cmd/go.sum @@ -13,18 +13,18 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY= github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= -github.com/xuri/excelize/v2 v2.8.2-0.20240328083735-ffad7aecb5b9 h1:E5SrkqbATPg8t3kj5f8k/o48FM0FZio8Beng3rGdQYI= -github.com/xuri/excelize/v2 v2.8.2-0.20240328083735-ffad7aecb5b9/go.mod h1:now5ovRPu2yX3nl7XR6yhLgNVGtFh2IM02YbKccI4L8= +github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3 h1:BmS5KxI0igAy1uF7YVLT5X03Omx9BPSffsxXdkrl6/A= +github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3/go.mod h1:V3gxebTnbQrNjSPmqW574uhxzXqzSgjNU4iyusK8WoA= github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 h1:hPVCafDV85blFTabnqKgNhDCkJX25eik94Si9cTER4A= github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/cmd/main.go b/cmd/main.go index 75427c5..876217f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,4 +1,4 @@ -// Copyright 2022 - 2023 The excelize-wasm Authors. All rights reserved. Use of +// Copyright 2022 - 2024 The excelize-wasm Authors. All rights reserved. Use of // this source code is governed by a BSD-style license that can be found in // the LICENSE file. // diff --git a/src/index.d.ts b/src/index.d.ts index 20968d8..8d8507b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,4 @@ -// Copyright 2022 - 2023 The excelize-wasm Authors. All rights reserved. Use of +// Copyright 2022 - 2024 The excelize-wasm Authors. All rights reserved. Use of // this source code is governed by a BSD-style license that can be found in // the LICENSE file. // @@ -329,18 +329,19 @@ declare module 'excelize-wasm' { * GraphicOptions directly maps the format settings of the picture. */ export type GraphicOptions = { - AltText?: string; - PrintObject?: boolean; - Locked?: boolean; - LockAspectRatio?: boolean; - AutoFit?: boolean; - OffsetX?: number; - OffsetY?: number; - ScaleX?: number; - ScaleY?: number; - Hyperlink?: string; - HyperlinkType?: string; - Positioning?: string; + AltText?: string; + PrintObject?: boolean; + Locked?: boolean; + LockAspectRatio?: boolean; + AutoFit?: boolean; + AutoFitIgnoreAspect?: boolean; + OffsetX?: number; + OffsetY?: number; + ScaleX?: number; + ScaleY?: number; + Hyperlink?: string; + HyperlinkType?: string; + Positioning?: string; }; /** @@ -1582,12 +1583,55 @@ declare module 'excelize-wasm' { * that this function only supports adding pictures placed over the cells * currently, and doesn't support adding pictures placed in cells or * creating the Kingsoft WPS Office embedded image cells. + * + * The optional parameter "AltText" is used to add alternative text to a + * graph object. + * + * The optional parameter "PrintObject" indicates whether the graph object + * is printed when the worksheet is printed, the default value of that is + * 'true'. + * + * The optional parameter "Locked" indicates whether lock the graph object. + * Locking an object has no effect unless the sheet is protected. + * + * The optional parameter "LockAspectRatio" indicates whether lock aspect + * ratio for the graph object, the default value of that is 'false'. + * + * The optional parameter "AutoFit" specifies if you make graph object size + * auto-fits the cell, the default value of that is 'false'. + * + * The optional parameter "AutoFitIgnoreAspect" specifies if fill the cell + * with the image and ignore its aspect ratio, the default value of that is + * 'false'. This option only works when the "AutoFit" is enabled. + * + * The optional parameter "OffsetX" specifies the horizontal offset of the + * graph object with the cell, the default value of that is 0. + * + * The optional parameter "OffsetY" specifies the vertical offset of the + * graph object with the cell, the default value of that is 0. + * + * The optional parameter "ScaleX" specifies the horizontal scale of graph + * object, the default value of that is 1.0 which presents 100%. + * + * The optional parameter "ScaleY" specifies the vertical scale of graph + * object, the default value of that is 1.0 which presents 100%. + * + * The optional parameter "Hyperlink" specifies the hyperlink of the graph + * object. + * + * The optional parameter "HyperlinkType" defines two types of + * hyperlink "External" for website or "Location" for moving to one of the + * cells in this workbook. When the "HyperlinkType" is "Location", + * coordinates need to start with "#". + * + * The optional parameter "Positioning" defines 3 types of the position of a + * graph object in a spreadsheet: "oneCell" (Move but don't size with + * cells), "twoCell" (Move and size with cells), and "absolute" (Don't move + * or size with cells). If you don't set this parameter, the default + * positioning is to move and size with cells. * @param sheet The worksheet name * @param cell The cell reference - * @param name The picture name - * @param extension The extension name - * @param file The contents buffer of the file - * @param opts The graphic options + * @param pic The picture format options */ AddPictureFromBytes(sheet: string, cell: string, pic: Picture): { error: string | null }