From 21d2a5d84fd62b92d1cd49b7dfc8a451ec880603 Mon Sep 17 00:00:00 2001 From: SpikeMeow <5637753+colisys@user.noreply.gitee.com> Date: Wed, 2 Oct 2024 16:02:27 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat(component/iconPicker):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9B=BE=E6=A0=87=E9=9B=86=EF=BC=8C=E5=8F=AF=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../document/zh-CN/components/iconPicker.md | 196 ++++++++++++- .../component/component/iconPicker/index.vue | 269 +++++++----------- .../component/iconPicker/wrapper.vue | 152 ++++++++++ packages/icons/src/iconfont/iconfont.ts | 6 +- 4 files changed, 451 insertions(+), 172 deletions(-) create mode 100644 packages/component/component/iconPicker/wrapper.vue diff --git a/docs/src/document/zh-CN/components/iconPicker.md b/docs/src/document/zh-CN/components/iconPicker.md index 08650375..7ffb7320 100644 --- a/docs/src/document/zh-CN/components/iconPicker.md +++ b/docs/src/document/zh-CN/components/iconPicker.md @@ -137,23 +137,195 @@ export default { ::: -::: title icon-picker 属性 +::: title 自定义图标集 +::: + +::: demo 通过 `icon-sets` 属性传入注册自定义图标集,传入 `show-icon-sets` 可以展示图标集选择器,传入 `current-icon-set` 可以设置默认图标集(只有注册的图标集才可指定默认图标集) + + + + + + + +::: + +::: quote 目前内置了 Layui 图标集 +未指定 `iconSet` 时,默认使用 Layui 图标集 +::: + +::: title Property 属性 ::: ::: table -| 属性 | 说明 | 类型 | 默认值 | 可选值 | -| ---------- | -------- | --- |--- |--- | -| v-model | 默认值 | -- |-- |-- | -| page | 开启分页 | -- |-- |-- | -| size | 尺寸 | -- |-- |-- | -| showSearch | 启用搜索 | -- |-- |-- | -| disabled | 禁用 | `boolean` |-- |-- | -| allow-clear | 允许清空 | `boolean` |-- |-- | -| contentStyle | 内容自定义样式 | `StyleValue` | -- | -- | -| contentClass | 内容自定义Class | `string` `Array` `object` | -- | -- | +| 属性 | 说明 | 类型 | 默认值 | 可选值 | 版本 | +| ---------------- | ---------------- | ------------------------------------------- | ----------- | ------ | -------- | +| v-model | 默认值 | -- | -- | -- | | +| page | 开启分页 | `boolean` | -- | -- | | +| size | 尺寸 | `"lg"`\|`"md"`\|`"sm"`\|`"xs"` | -- | -- | | +| show-search | 启用搜索 | `boolean` | -- | -- | | +| disabled | 禁用 | `boolean` | -- | -- | | +| allow-clear | 允许清空 | `boolean` | -- | -- | | +| content-style | 内容自定义样式 | `StyleValue` | -- | -- | | +| content-class | 内容自定义 Class | `string` `Array` `object` | -- | -- | | +| icon-sets | 图标集 | `Array` | `["layui"]` | -- | `2.19.0` | +| show-icon-sets | 显示图标集切换器 | `boolean` | `false` | -- | `2.19.0` | +| current-icon-set | 当前图标集 | `string` | `"layui"` | -- | `2.19.0` | ::: +::: title Types +::: + +```typescript +export interface IconProp { + name: string; + class: string; + prefix?: string; +} + +export interface IconSets { + name: string; + title?: string; + prefix?: string; + icons: IconProp[]; +} +``` + ::: previousNext iconPicker -::: \ No newline at end of file +::: diff --git a/packages/component/component/iconPicker/index.vue b/packages/component/component/iconPicker/index.vue index c54c6da6..bbc3aa2d 100644 --- a/packages/component/component/iconPicker/index.vue +++ b/packages/component/component/iconPicker/index.vue @@ -1,14 +1,31 @@ @@ -184,61 +189,7 @@ const searchList = (str: string, container: any) => { > diff --git a/packages/component/component/iconPicker/wrapper.vue b/packages/component/component/iconPicker/wrapper.vue new file mode 100644 index 00000000..0ad762c5 --- /dev/null +++ b/packages/component/component/iconPicker/wrapper.vue @@ -0,0 +1,152 @@ + + + diff --git a/packages/icons/src/iconfont/iconfont.ts b/packages/icons/src/iconfont/iconfont.ts index 234432be..45060555 100644 --- a/packages/icons/src/iconfont/iconfont.ts +++ b/packages/icons/src/iconfont/iconfont.ts @@ -1,4 +1,6 @@ -export default [ +import { IconProp } from "../../../component/component/iconPicker/index.vue"; + +const LayuiIconList: IconProp[] = [ { name: "实心", class: "layui-icon-heart-fill" }, { name: "空心", class: "layui-icon-heart" }, { name: "亮度/晴", class: "layui-icon-light" }, @@ -187,3 +189,5 @@ export default [ { name: "闭眼", class: "layui-icon-eye-invisible" }, { name: "眼睛", class: "layui-icon-eye" }, ]; + +export default LayuiIconList; -- Gitee From c6e56bc586ddab307f0fc6589c586c120e440c14 Mon Sep 17 00:00:00 2001 From: SpikeMeow <5637753+colisys@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 17:36:49 +0800 Subject: [PATCH 2/5] chore: code update --- .../document/zh-CN/components/iconPicker.md | 22 +++++++++++++------ .../component/component/iconPicker/index.vue | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/src/document/zh-CN/components/iconPicker.md b/docs/src/document/zh-CN/components/iconPicker.md index 758e27b8..b7c69913 100644 --- a/docs/src/document/zh-CN/components/iconPicker.md +++ b/docs/src/document/zh-CN/components/iconPicker.md @@ -10,7 +10,7 @@ ::: title 基础使用 ::: -::: demo 使用 lay-icon-picker 标签, 创建图标选择器 +::: demo 使用 `lay-icon-picker` 标签, 创建图标选择器