Browse Source
Allow dynamic boxRect for CanvasSpot (#6744)
* Allow dynamic boxRect for CanvasSpot
* Switch to ORG_NPM_TOKEN
release-v0.22.15
Artur Arseniev
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
7 additions and
6 deletions
-
.github/workflows/publish-core-latest.yml
-
.github/workflows/publish-core-rc.yml
-
.github/workflows/publish.yml
-
packages/core/src/canvas/model/CanvasSpot.ts
|
|
|
@ -20,7 +20,7 @@ jobs: |
|
|
|
run: pnpm run ts:check |
|
|
|
- name: Publish to npm |
|
|
|
env: |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} |
|
|
|
run: | |
|
|
|
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ./packages/core/.npmrc |
|
|
|
pnpm publish:core:latest |
|
|
|
|
|
|
|
@ -20,7 +20,7 @@ jobs: |
|
|
|
run: pnpm run ts:check |
|
|
|
- name: Publish to npm |
|
|
|
env: |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} |
|
|
|
run: | |
|
|
|
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ./packages/core/.npmrc |
|
|
|
pnpm publish:core:rc |
|
|
|
|
|
|
|
@ -19,4 +19,4 @@ jobs: |
|
|
|
- run: yarn build |
|
|
|
- run: npm publish |
|
|
|
env: |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} |
|
|
|
|
|
|
|
@ -1,3 +1,4 @@ |
|
|
|
import { isFunction } from 'underscore'; |
|
|
|
import CanvasModule from '..'; |
|
|
|
import { ModuleModel } from '../../abstract'; |
|
|
|
import { BoxRect, LiteralUnion } from '../../common'; |
|
|
|
@ -31,7 +32,7 @@ export interface CanvasSpotBase<T extends CanvasSpotType> { |
|
|
|
/** |
|
|
|
* Fixed box rect of the spot, eg. `{ width: 100, height: 100, x: 0, y: 0 }`. |
|
|
|
*/ |
|
|
|
boxRect?: BoxRect; |
|
|
|
boxRect?: BoxRect | (() => BoxRect); |
|
|
|
/** |
|
|
|
* Component to which the spot will be attached. |
|
|
|
*/ |
|
|
|
@ -97,10 +98,10 @@ export default class CanvasSpot<T extends CanvasSpotProps = CanvasSpotProps> ext |
|
|
|
getBoxRect(opts?: GetBoxRectOptions) { |
|
|
|
const { el, em } = this; |
|
|
|
const cvView = em.Canvas.getCanvasView(); |
|
|
|
const boxRect = this.get('boxRect'); |
|
|
|
const boxRect = this.attributes.boxRect; |
|
|
|
|
|
|
|
if (boxRect) { |
|
|
|
return boxRect; |
|
|
|
return isFunction(boxRect) ? boxRect() : (boxRect as BoxRect); |
|
|
|
} else if (el && cvView) { |
|
|
|
return cvView.getElBoxRect(el, opts); |
|
|
|
} |
|
|
|
|