halo/ui
Takagi 3be91fcb6f
refactor: enhance formkit select component to support additional features (#6473)
#### What type of PR is this?

/kind feature
/area ui
/milestone 2.19.x

#### What this PR does / why we need it:

此 PR 使用自定义的 Select 组件替换了原有的 Formkit Select 组件,原 Select 组件类型变为 `nativeSelect`。

新的 Select 组件具有如下功能:
- 增加多选、单选两种模式。
- 支持对内容进行搜索、过滤。
- 可使用接口远程加载,并可自定义数据获取。
- 支持扩展远程加载方式。
- 可创建新选项。
- 支持清空所有已选择项。
- 多选状态下可控制最大选择数量。
- 多选状态下可进行排序。

重构后的 Select 组件将自动兼容旧版组件。

使用方式如下:

```vue
<FormKit
  type="select"
  label="What country makes the best food?"
  name="countries"
  placeholder="Select a country"
  allow-create
  clearable
  sortable
  multiple
  searchable
  :max-count="3"
  :options="[
    { label: 'France', value: 'fr'},
    { label: 'Germany', value: 'de'},
    { label: 'Spain', value: 'es'},
    { label: 'Italy', value: 'ie' },
    { label: 'Greece', value: 'gr'},
  ]"
  help="Don’t worry, you can’t get this one wrong."
/>
```

#### How to test it?

1. 需要测试已使用的 Select 组件功能是否发生了变化。

测试在多选、单选状态下,Select 组件的功能是否可以正常使用。

测试在远程加载时,数据获取是否正常,是否可正常分页,加载状态是否显示。

#### Which issue(s) this PR fixes:

see https://github.com/halo-dev/halo/issues/4931#issuecomment-2060637101
see #6369 

#### Does this PR introduce a user-facing change?
```release-note
重构 FormKit 选择器组件以支持更多功能
```
2024-08-26 09:03:14 +00:00
..
.changeset Move folder console to ui 2024-02-02 22:22:51 +08:00
.husky Fix the problem of being unable to commit (#5362) 2024-02-18 08:00:16 +00:00
.vscode chore: add vscode settings.json (#6151) 2024-06-26 18:07:53 +08:00
console-src feat: add H2 database usage warning to setup page (#6502) 2024-08-26 02:29:12 +00:00
cypress Move folder console to ui 2024-02-02 22:22:51 +08:00
docs refactor: enhance formkit select component to support additional features (#6473) 2024-08-26 09:03:14 +00:00
packages chore: update Halo official website URL (#6514) 2024-08-26 15:53:04 +08:00
public Move folder console to ui 2024-02-02 22:22:51 +08:00
src refactor: enhance formkit select component to support additional features (#6473) 2024-08-26 09:03:14 +00:00
uc-src feat: add prompt for users to reload page after plugin update 2024-08-15 17:30:01 +08:00
.editorconfig Move folder console to ui 2024-02-02 22:22:51 +08:00
.env.development chore: remove unnecessary env (#6022) 2024-05-30 08:31:16 +00:00
.env.production chore: remove unnecessary env (#6022) 2024-05-30 08:31:16 +00:00
.eslintrc.cjs Generate API docs and regenerate API client (#5742) 2024-04-19 02:34:07 +00:00
.gitignore Move folder console to ui 2024-02-02 22:22:51 +08:00
.gitpod.yml Move folder console to ui 2024-02-02 22:22:51 +08:00
.npmignore Move folder console to ui 2024-02-02 22:22:51 +08:00
.npmrc Move folder console to ui 2024-02-02 22:22:51 +08:00
.prettierignore Generate API docs and regenerate API client (#5742) 2024-04-19 02:34:07 +00:00
Makefile Move folder console to ui 2024-02-02 22:22:51 +08:00
OWNERS Move folder console to ui 2024-02-02 22:22:51 +08:00
README.md chore: update Halo official website URL (#6514) 2024-08-26 15:53:04 +08:00
build.gradle Refactor api client using separated OpenAPI groups 2024-06-25 12:31:25 +08:00
cypress.json Move folder console to ui 2024-02-02 22:22:51 +08:00
env.d.ts feat: add support for setting an owner for posts (#6178) 2024-06-27 10:10:55 +00:00
index.html refactor: implementation of browser tab title (#5794) 2024-04-25 03:43:10 +00:00
package.json refactor: enhance formkit select component to support additional features (#6473) 2024-08-26 09:03:14 +00:00
pnpm-lock.yaml refactor: enhance formkit select component to support additional features (#6473) 2024-08-26 09:03:14 +00:00
pnpm-workspace.yaml Move folder console to ui 2024-02-02 22:22:51 +08:00
postcss.config.cjs chore: bump vite to 5.x (#5920) 2024-05-16 06:18:36 +00:00
prettier.config.cjs chore: bump vite to 5.x (#5920) 2024-05-16 06:18:36 +00:00
tailwind.config.cjs chore: bump vite to 5.x (#5920) 2024-05-16 06:18:36 +00:00
tsconfig.app.json chore: bump vue related packages version (#5384) 2024-02-22 03:12:07 +00:00
tsconfig.json Move folder console to ui 2024-02-02 22:22:51 +08:00
tsconfig.node.json chore: bump vite to 5.x (#5920) 2024-05-16 06:18:36 +00:00
tsconfig.vitest.json Move folder console to ui 2024-02-02 22:22:51 +08:00
vite.config.ts chore: organize and fix imports (#6152) 2024-06-26 10:42:50 +00:00
vite.uc.config.ts chore: organize and fix imports (#6152) 2024-06-26 10:42:50 +00:00
vitest.config.ts chore: organize and fix imports (#6152) 2024-06-26 10:42:50 +00:00

README.md

README

Halo logo

Halo 2.0 的管理端项目(原 halo-admin

GitHub release GitHub GitHub last commit GitHub Workflow Status Gitpod ready-to-code


当前仓库已经将 halo-admin 改为了 console。但对于 Halo 1.x 版本,依旧保持 halo-admin 的概念。

开发环境运行

npm install -g pnpm@9
pnpm install 
pnpm build:packages
pnpm dev

生产构建

pnpm build

状态

Repobeats analytics