Files
bytedance--flowgram.ai/packages/plugins/select-box-plugin/src/create-select-box-plugin.ts
T
wehub-resource-sync 0232b4e2bb
CI / build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:09:51 +08:00

35 lines
997 B
TypeScript

/**
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
* SPDX-License-Identifier: MIT
*/
import {
FlowSelectorBoundsLayer,
FlowSelectorBoundsLayerOptions,
FlowSelectorBoxLayer,
FlowSelectorBoxOptions,
type SelectorBoxPopoverProps,
} from '@flowgram.ai/renderer';
import { definePluginCreator } from '@flowgram.ai/core';
// import { SelectorBounds } from './selector-bounds';
export { type SelectorBoxPopoverProps };
export interface SelectBoxPluginOptions
extends FlowSelectorBoundsLayerOptions,
FlowSelectorBoxOptions {
enable?: boolean;
}
export const createSelectBoxPlugin = definePluginCreator<SelectBoxPluginOptions>({
onInit(ctx, opts): void {
// 默认可用,所以强制判断 false
if (opts.enable !== false) {
ctx.playground.registerLayer<FlowSelectorBoundsLayer>(FlowSelectorBoundsLayer, opts);
ctx.playground.registerLayer<FlowSelectorBoxLayer>(FlowSelectorBoxLayer, {
canSelect: opts.canSelect,
});
}
},
});