refactor: accessLibrary 使用 utils 版本

This commit is contained in:
mario.gk 2020-09-22 14:26:30 +08:00
parent 58b8200fb2
commit 094c6b8dce
3 changed files with 3 additions and 10 deletions

View File

@ -20,6 +20,7 @@
"@ali/lowcode-editor-skeleton": "^1.0.9-6",
"@ali/lowcode-plugin-designer": "^1.0.9-6",
"@ali/lowcode-plugin-outline-pane": "^1.0.9-6",
"@ali/lowcode-utils": "^1.0.9-7",
"@ali/ve-i18n-util": "^2.0.0",
"@ali/ve-icons": "^4.1.9",
"@ali/ve-less-variables": "2.0.3",

View File

@ -16,6 +16,7 @@ import {
upgradePropConfig,
upgradeConfigure,
} from './upgrade-metadata';
import { accessLibrary } from '@ali/lowcode-utils';
import { designer } from '../editor';
@ -166,15 +167,6 @@ export interface OldGlobalPropConfig extends OldPropConfig {
const packageMaps: any = {};
function accessLibrary(library: string | object) {
if (typeof library !== 'string') {
return library;
}
// TODO: enhance logic
return (window as any)[library];
}
export function setPackages(packages: Array<{ package: string; library: object | string }>) {
packages.forEach((item) => {
let lib: any;

View File

@ -9,7 +9,7 @@ interface LibraryMap {
[key: string]: string;
}
function accessLibrary(library: string | Record<string, unknown>) {
export function accessLibrary(library: string | Record<string, unknown>) {
if (typeof library !== 'string') {
return library;
}