mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 12:50:38 +00:00
style: for utils
This commit is contained in:
parent
cdad47fc94
commit
bd1921df55
@ -100,7 +100,11 @@ export class StylePoint {
|
||||
|
||||
private placeholder: Element | Text;
|
||||
|
||||
constructor(readonly level: number, readonly id?: string) {
|
||||
readonly level: number;
|
||||
|
||||
readonly id: string;
|
||||
|
||||
constructor(level: number, id?: string) {
|
||||
let placeholder: any;
|
||||
if (id) {
|
||||
placeholder = document.head.querySelector(`style[data-id="${id}"]`);
|
||||
|
||||
@ -7,7 +7,7 @@ interface LibraryMap {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
function accessLibrary(library: string | object) {
|
||||
function accessLibrary(library: string | Record<string, unknown>) {
|
||||
if (typeof library !== 'string') {
|
||||
return library;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ export function cloneDeep(src: any): any {
|
||||
} else if (type === 'object' && isPlainObject(src)) {
|
||||
data = {};
|
||||
for (const key in src) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (src.hasOwnProperty(key)) {
|
||||
data[key] = cloneDeep(src[key]);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ReactNode, ComponentType, isValidElement, cloneElement, createElement } from 'react';
|
||||
import { isReactComponent } from './is-react';
|
||||
|
||||
export function createContent(content: ReactNode | ComponentType<any>, props?: object): ReactNode {
|
||||
export function createContent(content: ReactNode | ComponentType<any>, props?: Record<string, unknown>): ReactNode {
|
||||
if (isValidElement(content)) {
|
||||
return props ? cloneElement(content, props) : content;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { isReactComponent } from './is-react';
|
||||
|
||||
const URL_RE = /^(https?:)\/\//i;
|
||||
|
||||
export function createIcon(icon?: IconType | null, props?: object): ReactNode {
|
||||
export function createIcon(icon?: IconType | null, props?: Record<string, unknown>): ReactNode {
|
||||
if (!icon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -3,5 +3,6 @@ export function getPrototypeOf(target: any) {
|
||||
return Object.getPrototypeOf(target);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-proto
|
||||
return target.__proto__;
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export function isObject(value: any): value is object {
|
||||
export function isObject(value: any): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === 'object';
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ export function setPrototypeOf(target: any, proto: any) {
|
||||
if (typeof Object.setPrototypeOf !== 'undefined') {
|
||||
Object.setPrototypeOf(target, proto); // tslint:disable-line
|
||||
} else {
|
||||
// eslint-disable-next-line no-proto
|
||||
target.__proto__ = proto;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ export interface IconProps {
|
||||
fill?: string;
|
||||
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | number;
|
||||
children?: ReactNode;
|
||||
style?: object;
|
||||
style?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export function SVGIcon({
|
||||
@ -26,6 +26,7 @@ export function SVGIcon({
|
||||
}: IconProps & {
|
||||
viewBox: string;
|
||||
}) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (SizePresets.hasOwnProperty(size)) {
|
||||
size = SizePresets[size];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user