-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from liuxian496/developer
Developer
- Loading branch information
Showing
8 changed files
with
132 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import "litten/dist/assets/summary.css"; | ||
|
||
import { | ||
Meta, | ||
Source, | ||
} from "@storybook/blocks"; | ||
|
||
import * as Stories from "./util.stories.tsx"; | ||
|
||
import { Summary } from "litten/dist/summary"; | ||
import { Color } from "litten/dist/global"; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# Util | ||
|
||
## getPrefixNs | ||
<Summary> | ||
<Source code={ | ||
` | ||
/** | ||
* 获取控件css前缀 | ||
* @param componentName 控件名称 {string} | ||
* @param customizePrefix 用户自定义前缀 {string} | ||
* @param defaultPrefix 默认前缀 {string} | ||
* @returns prefix 控件css类前缀 {string} | ||
*/ | ||
export declare function getPrefixNs(componentName: string, customizePrefix?: string, defaultPrefix?: string): string; | ||
` | ||
} language="tsx" /> | ||
</Summary> | ||
|
||
## isEmptyString | ||
<Summary> | ||
<Source code={ | ||
` | ||
/** | ||
* 检测是否是空字符串 | ||
* @param 需要判断的值 {any} | ||
* @returns isString 是否是空字符串 {boolean} | ||
*/ | ||
export declare function isEmptyString(str: unknown): boolean; | ||
` | ||
} language="tsx" /> | ||
</Summary> | ||
|
||
## printArrayItem | ||
<Summary> | ||
<Source code={ | ||
` | ||
/** | ||
* 遍历对象数组,将对象的每个属性输出成字符串,不递归遍历对象属性的子属性 | ||
* @param list 待遍历的数组 | ||
* @returns 遍历后拼装的字符串 | ||
*/ | ||
export declare function printArrayItem(list?: object[]): string; | ||
` | ||
} language="tsx" /> | ||
</Summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import isString from "lodash/isString"; | ||
import isString from "lodash/isString"; | ||
import { isEmptyString } from "./isEmptyString"; | ||
|
||
/** | ||
* 获取控件css前缀 | ||
* @param componentName 控件名称 {string} | ||
* @param customizePrefix 用户自定义前缀 {string} | ||
* @param defaultPrefix 默认前缀 {string} | ||
* @returns prefix 控件css类前缀 {string} | ||
*/ | ||
export function getPrefixNs( | ||
componentName: string, | ||
customizePrefix?: string | ||
componentName: string, | ||
customizePrefix?: string, | ||
defaultPrefix = "cyndi" | ||
): string { | ||
return isString(customizePrefix) && !isEmptyString(customizePrefix) | ||
? customizePrefix + "-" + componentName | ||
: `cyndi-${componentName}`; | ||
} | ||
return isString(customizePrefix) && !isEmptyString(customizePrefix) | ||
? customizePrefix + "-" + componentName | ||
: `${defaultPrefix}-${componentName}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters