Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React from 'react';
import type { CollapseProps } from 'antd/lib/collapse';

export interface EditorListChangeState {
/**
* parent selectors
*/
parentClassName: string;

/**
* edit css value
*/
cssValue: any;

/**
* edit className
*/
cssName: string;

/**
* Selectors replace(/[^a-z]/ig, ''), render style id
*/
id: string;

/**
* edit random id
*/
editClassName: string;

/**
* all css string, including events and terminals
*/
allCssString: string;

/**
* current css string
*/
currentEditCssString: string;

/**
* Is the color or slider changed by dragging
*/
isDrag: boolean;
}

export interface EditorListProps extends Omit<CollapseProps, 'onChange'> {
/**
* editor dom
*/
editorElem: HTMLElement;

/**
* change callback(e: changeCallBack)
*/
onChange?: (state: EditorListChangeState) => void;

/**
* use className or style
*/
useClassName?: boolean;

/**
* edit mobile style
*/
isMobile?: boolean;

/**
* default editor class name, Cannot with current className
*/
editorDefaultClassName?: string;

/**
* parent can use tag name
*/
parentClassNameCanUseTagName?: boolean;

/**
* parent class name length
*/
parentClassNameLength?: number;

/**
* root class name
*/
rootSelector?: string;

/**
* insert css into dom
*/
cssToDom?: boolean;
}

/**
* React EditorList Component
*/
export default class EditorList extends React.Component<EditorListProps> {}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
"lib",
"assets/*.css",
"dist",
"es"
"es",
"index.d.ts"
],
"licenses": "MIT",
"main": "./lib/index",
"module": "./es/index",
"types": "./index.d.ts",
"config": {
"port": 8022,
"entry": {
Expand All @@ -50,6 +52,7 @@
"coverage": "rc-tools run coverage"
},
"devDependencies": {
"@types/react": "16.x",
"expect.js": "0.3.x",
"pre-commit": "1.x",
"precommit-hook": "1.x",
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"noImplicitAny": true,
"strict": true
},
"exclude": [
"node_modules"
]
}