plain-design 1.0.0-beta.146 → 1.0.0-beta.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plain-design.commonjs.min.js +1 -1
- package/dist/plain-design.min.css +2 -1
- package/dist/plain-design.min.js +1 -1
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/$ai/index.tsx +227 -227
- package/src/packages/components/ColorPicker/ColorPanel.tsx +146 -125
- package/src/packages/components/ColorPicker/color-panel.scss +117 -97
- package/src/packages/components/ColorPicker/index.tsx +144 -131
- package/src/packages/components/Icon/icon.external.tsx +6 -0
- package/src/packages/components/IconPicker/DefaultIcons.ts +7 -0
- package/src/packages/components/IconPicker/icon-picker.scss +43 -0
- package/src/packages/components/IconPicker/index.tsx +189 -0
- package/src/packages/components/VirtualList/useVirtualList.tsx +1 -1
- package/src/packages/entry.tsx +323 -322
- package/src/packages/i18n/lang/en-us.ts +7 -0
- package/src/packages/i18n/lang/zh-cn.ts +7 -0
- package/src/packages/uses/createInputPopperAttrs.ts +9 -2
- package/src/packages/utils/installAllIcons.ts +20 -19
|
@@ -325,6 +325,13 @@ export const EnUsLocale: tZhCnLocale = {
|
|
|
325
325
|
searchHistory: 'Search History',
|
|
326
326
|
favorite: 'Favorite'
|
|
327
327
|
},
|
|
328
|
+
colorPicker: {
|
|
329
|
+
notSupportDropper: 'Your browser does not support color pickers. It is recommended to use Google Chrome',
|
|
330
|
+
exitDropperMode: 'Press the ESC key to close the color suction tube',
|
|
331
|
+
},
|
|
332
|
+
iconPicker: {
|
|
333
|
+
placeholder: 'Please select or input icon name',
|
|
334
|
+
},
|
|
328
335
|
ai: {
|
|
329
336
|
placeholder: 'Please enter the content to be sent to the AI, such as: Who are you?',
|
|
330
337
|
require: 'The content of the question cannot be empty',
|
|
@@ -323,6 +323,13 @@ export const ZhCnLocale = {
|
|
|
323
323
|
searchHistory: '搜索历史',
|
|
324
324
|
favorite: '收藏'
|
|
325
325
|
},
|
|
326
|
+
colorPicker: {
|
|
327
|
+
notSupportDropper: '您的浏览器不支持颜色拾取器,推荐使用谷歌浏览器',
|
|
328
|
+
exitDropperMode: '按 ESC 键关闭取色吸管',
|
|
329
|
+
},
|
|
330
|
+
iconPicker: {
|
|
331
|
+
placeholder: '请选择或者输入图标',
|
|
332
|
+
},
|
|
326
333
|
ai: {
|
|
327
334
|
placeholder: '请输入要发送给ai的内容如:你是谁',
|
|
328
335
|
require: '提问的内容不能为空',
|
|
@@ -8,10 +8,11 @@ export function createInputPopperAttrs<T>(
|
|
|
8
8
|
emit,
|
|
9
9
|
popper,
|
|
10
10
|
disableHideOnBlur,
|
|
11
|
+
handleInputChange,
|
|
11
12
|
}: {
|
|
12
13
|
getValue: () => T,
|
|
13
14
|
emitChange: (val: T) => void,
|
|
14
|
-
isValidInputValue
|
|
15
|
+
isValidInputValue?: (val: any) => boolean,
|
|
15
16
|
emit: {
|
|
16
17
|
onFocus: (e: FocusEvent) => void,
|
|
17
18
|
onBlur: (e: FocusEvent) => void,
|
|
@@ -24,6 +25,7 @@ export function createInputPopperAttrs<T>(
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
disableHideOnBlur?: boolean,
|
|
28
|
+
handleInputChange?: (val: string | null | undefined) => void,
|
|
27
29
|
}) {
|
|
28
30
|
|
|
29
31
|
const model = useModel(getValue, emitChange, { onChange: (val: any) => {state.inputValue = val;} });
|
|
@@ -33,9 +35,14 @@ export function createInputPopperAttrs<T>(
|
|
|
33
35
|
const handler = {
|
|
34
36
|
onInputChange: (val: any) => {
|
|
35
37
|
state.inputValue = val;
|
|
36
|
-
if (isValidInputValue
|
|
38
|
+
if (!isValidInputValue) {
|
|
37
39
|
model.value = val;
|
|
40
|
+
} else {
|
|
41
|
+
if (isValidInputValue(val)) {
|
|
42
|
+
model.value = val;
|
|
43
|
+
}
|
|
38
44
|
}
|
|
45
|
+
handleInputChange?.(val);
|
|
39
46
|
},
|
|
40
47
|
onInputFocus: (e: FocusEvent) => {emit.onFocus(e);},
|
|
41
48
|
onInputBlur: (e: FocusEvent) => {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import allIcons from '@peryl/icon/dist/icons.js';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import {Icon} from 'plain-design';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 一次性加载所有的图标
|
|
8
|
-
* @author 韦胜健
|
|
9
|
-
* @date 2023.2.25 13:25
|
|
10
|
-
*/
|
|
11
|
-
export function installAllIcon() {
|
|
12
|
-
Icon.PlainIcon.options.props.getIcon.default = (icon: string) => {
|
|
13
|
-
const iconMeta = (allIcons as any)[icon];
|
|
14
|
-
if (!iconMeta) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import allIcons from '@peryl/icon/dist/icons.js';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import {Icon} from 'plain-design';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 一次性加载所有的图标
|
|
8
|
+
* @author 韦胜健
|
|
9
|
+
* @date 2023.2.25 13:25
|
|
10
|
+
*/
|
|
11
|
+
export function installAllIcon() {
|
|
12
|
+
Icon.PlainIcon.options.props.getIcon.default = (icon: string) => {
|
|
13
|
+
const iconMeta = (allIcons as any)[icon];
|
|
14
|
+
if (!iconMeta) {
|
|
15
|
+
console.warn(`getIcon: can't find icon match ${icon}`);
|
|
16
|
+
return document.createElement('div');
|
|
17
|
+
}
|
|
18
|
+
return iconMeta;
|
|
19
|
+
};
|
|
20
|
+
}
|