Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecdb1a4948 | ||
|
|
71fca76412 | ||
|
|
3f4c98fbf3 | ||
|
|
d8487807cd | ||
|
|
7349bb3429 | ||
|
|
0796e73ab1 |
@@ -72,8 +72,8 @@ jobs:
|
||||
- name: Ensure version not published
|
||||
if: ${{ steps.version.outputs.publish == 'true' }}
|
||||
run: |
|
||||
if npm view "timi-tdesign-mobile@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
|
||||
echo "FAIL: timi-tdesign-mobile@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
|
||||
if npm view "@timi/tdesign-mobile@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
|
||||
echo "FAIL: @timi/tdesign-mobile@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
|
||||
exit 1
|
||||
fi
|
||||
echo "OK: 版本未占用"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# timi-tdesign-mobile
|
||||
# @timi/tdesign-mobile
|
||||
|
||||
Vue 3 移动端通用组件库,依赖 `timi-web` 提供基础组件和编辑器能力。
|
||||
Vue 3 移动端通用组件库,依赖 `@timi/web` 提供基础组件和编辑器能力。
|
||||
|
||||
本包不依赖 `timi-web-api`。业务项目可以只安装本包使用通用组件;需要业务接口、领域类型或用户状态时,再单独安装 `timi-web-api`。
|
||||
本包不绑定业务 API 包。业务项目可以只安装本包使用通用组件;业务接口、领域类型和用户状态由应用层自行提供。
|
||||
|
||||
## 文章和通知组件
|
||||
|
||||
`ArticleEditor`、`ArticleView`、`NotifyEditor`、`NotifyView` 只约束对象的最小字段。`Article`、`Attachment` 和 `NotifyDetail` 支持携带业务自定义字段,不要求对象来自 `timi-web-api`。
|
||||
`ArticleEditor`、`ArticleView`、`NotifyEditor`、`NotifyView` 只约束对象的最小字段。`Article`、`Attachment` 和 `NotifyDetail` 支持携带业务自定义字段,不要求对象来自特定 API 包。
|
||||
|
||||
上传和附件地址由业务项目通过回调注入:
|
||||
|
||||
|
||||
Vendored
+3
@@ -22,8 +22,10 @@ declare module 'vue' {
|
||||
BottomPopup: typeof import('./src/components/bottom-popup/index.vue')['default']
|
||||
CardContainer: typeof import('./src/components/card-container/index.vue')['default']
|
||||
CodeEditor: typeof import('./src/components/code-editor/index.vue')['default']
|
||||
DropdownFilter: typeof import('./src/components/dropdown-filter/index.vue')['default']
|
||||
DurationPicker: typeof import('./src/components/duration-picker/index.vue')['default']
|
||||
EditorSearch: typeof import('./src/components/editor-search/index.vue')['default']
|
||||
Item: typeof import('./src/components/timeline/item.vue')['default']
|
||||
MasterDetail: typeof import('./src/components/master-detail/index.vue')['default']
|
||||
MasterDetailPage: typeof import('./src/components/master-detail-page/index.vue')['default']
|
||||
NotifyEditor: typeof import('./src/components/notify-editor/index.vue')['default']
|
||||
@@ -44,6 +46,7 @@ declare module 'vue' {
|
||||
TIcon: typeof import('tdesign-mobile-vue')['Icon']
|
||||
TImage: typeof import('tdesign-mobile-vue')['Image']
|
||||
TImageViewer: typeof import('tdesign-mobile-vue')['ImageViewer']
|
||||
Timeline: typeof import('./src/components/timeline/index.vue')['default']
|
||||
TInput: typeof import('tdesign-mobile-vue')['Input']
|
||||
TiptapCodeBlockButton: typeof import('./src/components/tiptap-editor/TiptapCodeBlockButton.vue')['default']
|
||||
TiptapEditor: typeof import('./src/components/tiptap-editor/index.vue')['default']
|
||||
|
||||
@@ -93,6 +93,13 @@ export const COMPONENT_LIST: ComponentMeta[] = [
|
||||
category: "布局组件",
|
||||
entry: "src/components/master-detail-page/index.vue"
|
||||
},
|
||||
{
|
||||
name: "DropdownFilter",
|
||||
title: "DropdownFilter 筛选栏",
|
||||
description: "列表页顶部的搜索框与下拉筛选,取值和事件统一收口。",
|
||||
category: "布局组件",
|
||||
entry: "src/components/dropdown-filter/index.vue"
|
||||
},
|
||||
|
||||
// ---------- 编辑器组件 ----------
|
||||
{
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
# DropdownFilter 筛选栏
|
||||
|
||||
列表页顶部的「搜索框 + 下拉筛选」。结构、取值和事件统一收在组件里,
|
||||
数据从哪来、什么时候发请求、怎么同步到 URL,仍归业务。
|
||||
|
||||
外观不写在组件里,而是由 `page-layout.less` 的 `.tui-filters` 提供——
|
||||
手写同样结构(`.tui-filters` 包住 `.t-input` 和 `.menus`)会得到同一套样式,
|
||||
从旧项目搬过来的筛选栏只需要换一个根类名。
|
||||
|
||||
## 基础用法
|
||||
|
||||
:::preview 搜索 + 下拉筛选 || 输入关键词、切换品类或状态,观察筛选栏与列表的联动
|
||||
|
||||
demo-preview=../demos/dropdown-filter/basic.vue
|
||||
|
||||
:::
|
||||
|
||||
```vue
|
||||
<dropdown-filter
|
||||
v-model="keyword"
|
||||
:filters="filters"
|
||||
placeholder="搜索产品名称或编码"
|
||||
@filter-change="handleFilterChange"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button size="extra-small" theme="primary" variant="outline" content="选择" />
|
||||
</template>
|
||||
</dropdown-filter>
|
||||
```
|
||||
|
||||
`filters` 的每一项对应一个 `t-dropdown-item`,`label` 由业务算好——
|
||||
组件不会根据 `value` 反查选项文本:
|
||||
|
||||
```ts
|
||||
const filters = computed<DropdownFilterItem[]>(() => [
|
||||
{
|
||||
key: "category",
|
||||
label: categoryOptions.find(item => item.value === category.value)?.label || "全部品类",
|
||||
value: category.value,
|
||||
options: categoryOptions
|
||||
}
|
||||
]);
|
||||
```
|
||||
|
||||
## 一个事件管全部筛选
|
||||
|
||||
`filter-change` 同时承载搜索框和下拉项,业务只接一个口:
|
||||
|
||||
| 来源 | `key` | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 搜索框 | `keyword` | 固定值,值已转成字符串 |
|
||||
| 下拉项 | 配置里的 `key` | 值原样来自 TDesign DropdownItem |
|
||||
|
||||
`v-model` 照常可用,用来读搜索框内容;只接 `filter-change` 也能跑通。
|
||||
|
||||
```ts
|
||||
function handleFilterChange(change: DropdownFilterChange): void {
|
||||
if (change.key === "keyword") {
|
||||
// 这里做防抖,组件不管节流
|
||||
return;
|
||||
}
|
||||
// 其余 key 直接写回对应的 ref,再重新拉数据
|
||||
}
|
||||
```
|
||||
|
||||
搜索框每次输入都会触发事件,防抖放在业务侧——不同页面的输入成本差别很大,
|
||||
组件里定一个固定间隔只会在某些页面上变成累赘。
|
||||
|
||||
## 放进列表页骨架
|
||||
|
||||
筛选栏要贴在内容区顶部、滚上去被毛玻璃盖住,需要页面骨架配合:
|
||||
|
||||
- 页面根节点:`tui-page-layout` + `tui-navbar`
|
||||
- 内容区(`MasterDetailPage` 自带,或者手写 `main`):追加 `list`
|
||||
- 滚动容器:`t-pull-down-refresh` 加 `pull-refresh`
|
||||
- 筛选栏:`DropdownFilter`,或者手写 `.tui-filters`
|
||||
|
||||
```vue
|
||||
<div class="tui-page-layout tui-navbar">
|
||||
<t-navbar fixed title="库存流水" left-arrow @left-click="$router.back()" />
|
||||
<master-detail-page class="list" :split="isWide" :selected="!!selectedId">
|
||||
<template #master>
|
||||
<t-pull-down-refresh class="pull-refresh" v-model="isRefreshing" @refresh="reload">
|
||||
<dropdown-filter v-model="keyword" :filters="filters" @filter-change="handleFilterChange" />
|
||||
<t-cell-group theme="card">
|
||||
<!-- 列表 -->
|
||||
</t-cell-group>
|
||||
</t-pull-down-refresh>
|
||||
</template>
|
||||
</master-detail-page>
|
||||
</div>
|
||||
```
|
||||
|
||||
这三层各管一件事,缺一层都会露馅:
|
||||
|
||||
| 位置 | 类名 | 作用 |
|
||||
| --- | --- | --- |
|
||||
| 内容区 | `list` | 清掉内容区自己的上下内边距,间距改由滚动容器承担 |
|
||||
| 滚动容器 | `pull-refresh` | 接管滚动,撑满剩余高度,底部让出安全区 |
|
||||
| 筛选栏 | `tui-filters` | 吸顶、毛玻璃、搜索框与菜单连成一块 |
|
||||
|
||||
### 菜单展开时筛选栏被滚走
|
||||
|
||||
TDesign 展开下拉菜单时会往 `.t-pull-down-refresh__track` 写 `overflow: hidden`,
|
||||
track 一旦成为滚动容器,`sticky` 就失效。骨架里已经处理了两条路:
|
||||
|
||||
- 浏览器支持 `:has()`:滚动容器里出现 `.tui-filters` 就自动放开 `overflow`
|
||||
- 不支持,或者筛选栏被别的元素包了一层:给滚动容器加 `has-dropdown-filter`
|
||||
|
||||
```vue
|
||||
<t-pull-down-refresh class="pull-refresh has-dropdown-filter" v-model="isRefreshing" @refresh="reload">
|
||||
```
|
||||
|
||||
## 深色模式
|
||||
|
||||
筛选栏只用 TDesign 语义变量(`--td-bg-color-container`、`--td-component-border`),
|
||||
深色主题下由 TDesign 的变量切换接管,不需要额外写一套。
|
||||
|
||||
## API
|
||||
|
||||
<api-table name="DropdownFilter" />
|
||||
@@ -1,6 +1,6 @@
|
||||
# 组件总览
|
||||
|
||||
共 21 个组件,分为布局、编辑器、交互与 AI 对话四类。
|
||||
共 22 个组件,分为布局、编辑器、交互与 AI 对话四类。
|
||||
|
||||
## 布局组件
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
| [MasterDetail](/components/master-detail) | 宽屏下列表与详情并排,窄屏只渲染列表。 |
|
||||
| [PaneTransition](/components/pane-transition) | 与路由无关的左右推入效果,用于栏位内部的视图切换。 |
|
||||
| [MasterDetailPage](/components/master-detail-page) | 把列表页骨架、主从分栏与栏内过渡打包成一个组件,列表页不再手写 master-detail。 |
|
||||
| [DropdownFilter](/components/dropdown-filter) | 列表页顶部的搜索框与下拉筛选,取值和事件统一收口。 |
|
||||
|
||||
## 编辑器组件
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div class="demo">
|
||||
<div class="stage">
|
||||
<div class="tui-page-content list">
|
||||
<t-pull-down-refresh class="pull-refresh" :value="false">
|
||||
<dropdown-filter
|
||||
v-model="keyword"
|
||||
:filters="filters"
|
||||
placeholder="搜索产品名称或编码"
|
||||
@filter-change="handleFilterChange"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button size="extra-small" theme="primary" variant="outline" content="选择" />
|
||||
</template>
|
||||
</dropdown-filter>
|
||||
<div class="list-body">
|
||||
<t-cell-group v-if="visibleList.length" theme="card">
|
||||
<t-cell
|
||||
v-for="item in visibleList"
|
||||
:key="item.id"
|
||||
:title="item.name"
|
||||
:description="item.code"
|
||||
:note="item.status === 'on' ? '在售' : '停售'"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<p v-else class="empty" v-text="'没有匹配的产品'" />
|
||||
</div>
|
||||
</t-pull-down-refresh>
|
||||
</div>
|
||||
</div>
|
||||
<p class="log">
|
||||
<span v-text="'最近一次 filter-change:'" />
|
||||
<code v-text="lastChange" />
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref } from "vue";
|
||||
import {
|
||||
DropdownFilter,
|
||||
type DropdownFilterChange,
|
||||
type DropdownFilterItem,
|
||||
type DropdownFilterOption
|
||||
} from "timi-tdesign-mobile";
|
||||
|
||||
const keyword = ref("");
|
||||
const category = ref("all");
|
||||
const status = ref("all");
|
||||
const lastChange = ref("—");
|
||||
|
||||
const productList = [
|
||||
{ id: "p1", name: "氨基酸洁面慕斯", code: "P-1001", category: "cleanser", status: "on" },
|
||||
{ id: "p2", name: "玻尿酸精华液", code: "P-1002", category: "serum", status: "on" },
|
||||
{ id: "p3", name: "烟酰胺原液", code: "P-1003", category: "serum", status: "off" },
|
||||
{ id: "p4", name: "舒缓修护面霜", code: "P-1004", category: "cream", status: "on" },
|
||||
{ id: "p5", name: "清透防晒乳", code: "P-1005", category: "cream", status: "off" },
|
||||
{ id: "p6", name: "氨基酸洗发水", code: "P-1006", category: "body", status: "on" }
|
||||
];
|
||||
|
||||
const categoryOptions: DropdownFilterOption[] = [
|
||||
{ label: "全部品类", value: "all" },
|
||||
{ label: "洁面", value: "cleanser" },
|
||||
{ label: "精华", value: "serum" },
|
||||
{ label: "面霜", value: "cream" },
|
||||
{ label: "身体护理", value: "body" }
|
||||
];
|
||||
|
||||
const statusOptions: DropdownFilterOption[] = [
|
||||
{ label: "全部状态", value: "all" },
|
||||
{ label: "在售", value: "on" },
|
||||
{ label: "停售", value: "off" }
|
||||
];
|
||||
|
||||
const filters = computed<DropdownFilterItem[]>(() => [
|
||||
{
|
||||
key: "category",
|
||||
label: categoryOptions.find(item => item.value === category.value)?.label || "全部品类",
|
||||
value: category.value,
|
||||
options: categoryOptions
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
label: statusOptions.find(item => item.value === status.value)?.label || "全部状态",
|
||||
value: status.value,
|
||||
options: statusOptions
|
||||
}
|
||||
]);
|
||||
|
||||
const visibleList = computed(() => {
|
||||
const text = keyword.value.trim().toLowerCase();
|
||||
return productList.filter(item => {
|
||||
const matchedText = !text || `${item.name}${item.code}`.toLowerCase().includes(text);
|
||||
const matchedCategory = category.value === "all" || item.category === category.value;
|
||||
const matchedStatus = status.value === "all" || item.status === status.value;
|
||||
return matchedText && matchedCategory && matchedStatus;
|
||||
});
|
||||
});
|
||||
|
||||
function handleFilterChange(change: DropdownFilterChange): void {
|
||||
lastChange.value = `${change.key} = ${String(change.value)}`;
|
||||
if (change.key === "category") {
|
||||
category.value = String(change.value);
|
||||
}
|
||||
if (change.key === "status") {
|
||||
status.value = String(change.value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.demo {
|
||||
.stage {
|
||||
height: 20rem;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: .75rem;
|
||||
background: var(--vp-c-bg-alt);
|
||||
|
||||
.tui-page-content {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.pull-refresh {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.list-body {
|
||||
margin: 0 1rem 1rem;
|
||||
|
||||
.empty {
|
||||
margin: 0;
|
||||
padding: 2rem 0;
|
||||
font-size: .8125rem;
|
||||
text-align: center;
|
||||
color: var(--vp-c-text-3);
|
||||
}
|
||||
}
|
||||
|
||||
.log {
|
||||
margin: .75rem 0 0;
|
||||
font-size: .8125rem;
|
||||
color: var(--vp-c-text-3);
|
||||
|
||||
code {
|
||||
font-weight: 600;
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+27
-8
@@ -1,11 +1,15 @@
|
||||
{
|
||||
"name": "timi-tdesign-mobile",
|
||||
"main": "./dist/timi-tdesign-mobile.umd.js",
|
||||
"name": "@timi/tdesign-mobile",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/timi-tdesign-mobile.mjs",
|
||||
"module": "./dist/index.js",
|
||||
"style": "./dist/timi-tdesign-mobile.css",
|
||||
"sideEffects": [
|
||||
"**/*.css"
|
||||
],
|
||||
"private": false,
|
||||
"version": "1.4.0",
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "pnpm run -C docs dev",
|
||||
@@ -25,8 +29,23 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/timi-tdesign-mobile.mjs",
|
||||
"require": "./dist/timi-tdesign-mobile.umd.js"
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./components": {
|
||||
"types": "./dist/components/index.d.ts",
|
||||
"import": "./dist/components/index.js"
|
||||
},
|
||||
"./components/*": {
|
||||
"types": "./dist/components/*/index.d.ts",
|
||||
"import": "./dist/components/*/index.js"
|
||||
},
|
||||
"./directives": {
|
||||
"types": "./dist/directives/index.d.ts",
|
||||
"import": "./dist/directives/index.js"
|
||||
},
|
||||
"./utils/message": {
|
||||
"types": "./dist/utils/message.d.ts",
|
||||
"import": "./dist/utils/message.js"
|
||||
},
|
||||
"./style.css": "./dist/timi-tdesign-mobile.css",
|
||||
"./src/*": "./src/*"
|
||||
@@ -35,8 +54,8 @@
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tdesign-mobile-vue": "^1.17.1",
|
||||
"timi-web": "^1.0.2"
|
||||
"tdesign-mobile-vue": "^1.17.2",
|
||||
"@timi/web": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.5.0",
|
||||
|
||||
Generated
+61
-54
@@ -8,12 +8,12 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@timi/web':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.26(typescript@5.8.3))
|
||||
tdesign-mobile-vue:
|
||||
specifier: ^1.17.1
|
||||
version: 1.17.1(vue@3.5.26(typescript@5.8.3))
|
||||
timi-web:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.26(typescript@5.8.3))
|
||||
specifier: ^1.17.2
|
||||
version: 1.17.2(vue@3.5.26(typescript@5.8.3))
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^22.13.5
|
||||
@@ -1152,6 +1152,14 @@ packages:
|
||||
'@soda/get-current-script@1.0.2':
|
||||
resolution: {integrity: sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==}
|
||||
|
||||
'@timi/ts@1.0.0':
|
||||
resolution: {integrity: sha512-0NFi1+CnonZTcf73IeDdcd5Qoqnt/EdESI448wHfdbd5mk6gRqJNzb82z03SHOCJlIOiLUPvBgctAVLbB58V1A==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
'@timi/web@2.0.0':
|
||||
resolution: {integrity: sha512-Qp/jvLpRbmPCK6jO70cHuefHdw8qw4l90GjPRFpo0ZB8CpIYmwcqHffcDS61p59z1GqsDP6BGT1kEPHDGxDsGg==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
'@tiptap/core@3.33.0':
|
||||
resolution: {integrity: sha512-sZjBCwK9+h0kbc/CZvkepX6RTJ2jOfeWY1aId9O3YnG0CAiOs/4DbqFmpcmv5BQAGPA6gC96gqdafa/9Dpg0tw==}
|
||||
peerDependencies:
|
||||
@@ -3271,6 +3279,7 @@ packages:
|
||||
image-size@0.5.5:
|
||||
resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
deprecated: Please migrate to image-size@2.x
|
||||
hasBin: true
|
||||
|
||||
import-fresh@3.3.1:
|
||||
@@ -4675,6 +4684,9 @@ packages:
|
||||
sockjs@0.3.24:
|
||||
resolution: {integrity: sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==}
|
||||
|
||||
sortablejs@1.15.7:
|
||||
resolution: {integrity: sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==}
|
||||
|
||||
source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -4822,8 +4834,8 @@ packages:
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
|
||||
tdesign-mobile-vue@1.17.1:
|
||||
resolution: {integrity: sha512-gCmhaNCc2xhSkbITHiXnE/UGs6GHLe9LTE7T26ELOENC5Cqpa+j4KYU9wz6uqFV+Ro10RkG3DFikYHnq0gNN0A==}
|
||||
tdesign-mobile-vue@1.17.2:
|
||||
resolution: {integrity: sha512-/MH+eNnySvMlEMwIlG0sMPOuwUuhWyOHn6HdS79ct9/+ZP+gCDzGH/usgcahZHM1l0ulY2NTlUp32opimlSZkQ==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
peerDependencies:
|
||||
vue: ^3.2.6
|
||||
@@ -4865,14 +4877,6 @@ packages:
|
||||
thunky@1.1.0:
|
||||
resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==}
|
||||
|
||||
timi-ts@1.0.0:
|
||||
resolution: {integrity: sha512-MR9LJGH4/UEgzzrc1yVdxypTcoQRASt8xns2z5xNyoXr2e0kdXv8sjnuRshp3uZnOCU/pSks1LeLi9OvC2U/7g==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
timi-web@1.0.2:
|
||||
resolution: {integrity: sha512-CXyWEeGTjrExnrAwstdWPc3qK5Lfyp7ipD8p7+WYcm4mcnJOS48k6SkVnrAIADAImeJAr/1e5JEV8wk+8AcvxQ==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
tinycolor2@1.6.0:
|
||||
resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==}
|
||||
|
||||
@@ -6556,6 +6560,44 @@ snapshots:
|
||||
|
||||
'@soda/get-current-script@1.0.2': {}
|
||||
|
||||
'@timi/ts@1.0.0': {}
|
||||
|
||||
'@timi/web@2.0.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.26(typescript@5.8.3))':
|
||||
dependencies:
|
||||
'@marsio/vue-split-pane': 1.0.0(typescript@5.8.3)
|
||||
'@timi/ts': 1.0.0
|
||||
'@tiptap/extension-code-block': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-color': 3.33.0(@tiptap/extension-text-style@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0)))
|
||||
'@tiptap/extension-image': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-link': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-placeholder': 3.33.0(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-subscript': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-superscript': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-table': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-table-cell': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-table-header': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-table-row': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-text-align': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-text-style': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-underline': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/pm': 3.33.0
|
||||
'@tiptap/starter-kit': 3.33.0
|
||||
'@tiptap/vue-3': 3.33.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)(vue@3.5.26(typescript@5.8.3))
|
||||
less: 4.5.1
|
||||
marked: 17.0.6
|
||||
marked-gfm-heading-id: 4.1.4(marked@17.0.6)
|
||||
marked-highlight: 2.2.4(marked@17.0.6)
|
||||
marked-mangle: 1.1.14(marked@17.0.6)
|
||||
prismjs: 1.30.0
|
||||
terser: 5.46.0
|
||||
transitivePeerDependencies:
|
||||
- '@floating-ui/dom'
|
||||
- '@tiptap/core'
|
||||
- '@tiptap/extensions'
|
||||
- supports-color
|
||||
- typescript
|
||||
- vue
|
||||
|
||||
'@tiptap/core@3.33.0(@tiptap/pm@3.33.0)':
|
||||
dependencies:
|
||||
'@tiptap/pm': 3.33.0
|
||||
@@ -10443,6 +10485,8 @@ snapshots:
|
||||
uuid: 8.3.2
|
||||
websocket-driver: 0.7.4
|
||||
|
||||
sortablejs@1.15.7: {}
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
source-map-support@0.5.21:
|
||||
@@ -10590,13 +10634,14 @@ snapshots:
|
||||
'@babel/runtime': 7.26.9
|
||||
vue: 3.5.26(typescript@5.8.3)
|
||||
|
||||
tdesign-mobile-vue@1.17.1(vue@3.5.26(typescript@5.8.3)):
|
||||
tdesign-mobile-vue@1.17.2(vue@3.5.26(typescript@5.8.3)):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.26.9
|
||||
'@use-gesture/vanilla': 10.3.1
|
||||
'@vueuse/core': 10.7.0(vue@3.5.26(typescript@5.8.3))
|
||||
dayjs: 1.11.13
|
||||
lodash-es: 4.17.21
|
||||
sortablejs: 1.15.7
|
||||
tdesign-icons-vue-next: 0.4.11(vue@3.5.26(typescript@5.8.3))
|
||||
tinycolor2: 1.6.0
|
||||
validator: 13.12.0
|
||||
@@ -10639,44 +10684,6 @@ snapshots:
|
||||
|
||||
thunky@1.1.0: {}
|
||||
|
||||
timi-ts@1.0.0: {}
|
||||
|
||||
timi-web@1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.26(typescript@5.8.3)):
|
||||
dependencies:
|
||||
'@marsio/vue-split-pane': 1.0.0(typescript@5.8.3)
|
||||
'@tiptap/extension-code-block': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-color': 3.33.0(@tiptap/extension-text-style@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0)))
|
||||
'@tiptap/extension-image': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-link': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-placeholder': 3.33.0(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-subscript': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-superscript': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-table': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
|
||||
'@tiptap/extension-table-cell': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-table-header': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-table-row': 3.33.0(@tiptap/extension-table@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-text-align': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-text-style': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/extension-underline': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))
|
||||
'@tiptap/pm': 3.33.0
|
||||
'@tiptap/starter-kit': 3.33.0
|
||||
'@tiptap/vue-3': 3.33.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)(vue@3.5.26(typescript@5.8.3))
|
||||
less: 4.5.1
|
||||
marked: 17.0.6
|
||||
marked-gfm-heading-id: 4.1.4(marked@17.0.6)
|
||||
marked-highlight: 2.2.4(marked@17.0.6)
|
||||
marked-mangle: 1.1.14(marked@17.0.6)
|
||||
prismjs: 1.30.0
|
||||
terser: 5.46.0
|
||||
timi-ts: 1.0.0
|
||||
transitivePeerDependencies:
|
||||
- '@floating-ui/dom'
|
||||
- '@tiptap/core'
|
||||
- '@tiptap/extensions'
|
||||
- supports-color
|
||||
- typescript
|
||||
- vue
|
||||
|
||||
tinycolor2@1.6.0: {}
|
||||
|
||||
tinyglobby@0.2.12:
|
||||
|
||||
@@ -57,6 +57,63 @@
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表页顶部的筛选栏:搜索框 + 下拉菜单贴在内容区顶部,展开的菜单和搜索框连成一块。
|
||||
*
|
||||
* 由 `DropdownFilter` 使用,也接受手写结构——只要根节点挂上这个类,
|
||||
* 内部的 `.t-input` / `.menus` 就按同一套样式渲染。`z-index` 让整条栏浮在列表之上,
|
||||
* 毛玻璃背景用 `::after` 单独一层,往下渐隐,内容滚过去才有层次感。
|
||||
*/
|
||||
.tui-filters {
|
||||
top: -1rem;
|
||||
margin: -1rem 0 0;
|
||||
padding: 1rem 1rem 0;
|
||||
z-index: 10;
|
||||
position: sticky;
|
||||
|
||||
&::after {
|
||||
top: 0;
|
||||
left: 0;
|
||||
mask: linear-gradient(to top, transparent 0%, #000 60%);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
content: "";
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||
-webkit-mask: linear-gradient(to top, transparent 0%, #000 60%);
|
||||
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
|
||||
}
|
||||
|
||||
.t-input {
|
||||
--td-button-border-radius: 99rem;
|
||||
|
||||
border: 1px solid var(--td-component-border);
|
||||
height: 2.25rem;
|
||||
padding: .25rem .25rem .25rem .75rem;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
--td-tab-item-height: 32px;
|
||||
}
|
||||
|
||||
.menus {
|
||||
--td-spacer-1: 6px;
|
||||
|
||||
width: 100%;
|
||||
border: 1px solid rgba(148, 163, 184, .18);
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
margin-top: -1rem;
|
||||
border-top: none;
|
||||
padding-top: .8rem;
|
||||
border-radius: 0 0 1rem 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.tui-page-layout {
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
@@ -90,6 +147,48 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页的滚动容器。
|
||||
*
|
||||
* 内容区自己不滚动(`tui-page-content` 默认 `overflow: hidden`),
|
||||
* 列表页把滚动权交给这个容器:外层只分配高度,`t-pull-down-refresh` 负责滚。
|
||||
* track 撑满高度并纵向排列,空态才能垂直居中。
|
||||
*/
|
||||
.pull-refresh {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding-bottom: calc(var(--tui-safe-bottom, 0px) + 1rem);
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
.t-pull-down-refresh__track {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选菜单展开时 TDesign 会给 track 写 `overflow: hidden`,
|
||||
* 那会让 track 变成 sticky 的滚动容器,筛选栏跟着整条滚走。
|
||||
* 有 `:has()` 时自动识别,没有时由 `.has-dropdown-filter` 兜底。
|
||||
*/
|
||||
@supports selector(:has(*)) {
|
||||
&:has(.tui-filters) .t-pull-down-refresh__track {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.has-dropdown-filter {
|
||||
|
||||
.t-pull-down-refresh__track {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.tui-navbar {
|
||||
@@ -119,6 +218,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页的顶部间距必须落在真正的滚动容器上,内容才能穿进导航栏的毛玻璃层。
|
||||
* 分栏形态下内容区不滚动、滚动的是主栏里的列表容器,间距的落点一样,
|
||||
* 所以两种形态共用这一条。
|
||||
*/
|
||||
&.tui-navbar .tui-page-content.list {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
.pull-refresh {
|
||||
padding-top: calc(var(--tui-nav-height) + 1rem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, useTemplateRef } from "vue";
|
||||
import { MarkdownView } from "timi-web";
|
||||
import { MarkdownView } from "@timi/web/components/markdown-view";
|
||||
import AiChatThinking from "./AiChatThinking.vue";
|
||||
import type {
|
||||
AiChatMessage,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import AiChatComposerView from "./AiChatComposer.vue";
|
||||
import AiChatMessageListView from "./AiChatMessageList.vue";
|
||||
import AiChatPanelView from "./AiChatPanel.vue";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const AppShell = WebToolkit.withInstall(view);
|
||||
export default AppShell;
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
TEMP_FILE_ID_ATTR,
|
||||
isLocalMediaId,
|
||||
normalizeContent
|
||||
} from "timi-web/editor";
|
||||
} from "@timi/web/editor";
|
||||
import type { ArticleContentType, Attachment } from "./types";
|
||||
|
||||
/** 文章内容中附件和临时文件的标识前缀。 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import type { Article } from "./types";
|
||||
|
||||
export type {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Article, ArticleContentType, Attachment, UploadResult } from "./types";
|
||||
import { MarkdownEditor } from "timi-web";
|
||||
import { MarkdownEditor } from "@timi/web/components/markdown-editor";
|
||||
import { TiptapEditor } from "../tiptap-editor";
|
||||
import type { TiptapEditorExpose } from "../tiptap-editor";
|
||||
import {
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
ATTACHMENT_ID_ATTR,
|
||||
TEMP_FILE_ID_ATTR,
|
||||
normalizeContent
|
||||
} from "timi-web/editor";
|
||||
} from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "ArticleEditor"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UploadResult as EditorUploadResult } from "timi-web/editor";
|
||||
import type { UploadResult as EditorUploadResult } from "@timi/web/editor";
|
||||
|
||||
/** 文章编辑器支持的正文类型。 */
|
||||
export type ArticleContentType = "TEXT" | "MARKDOWN" | "TIP_TAP";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const ArticleView = WebToolkit.withInstall(view);
|
||||
export default ArticleView;
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Article, Attachment } from "../article-editor/types";
|
||||
import { MarkdownView } from "timi-web";
|
||||
import { MarkdownView } from "@timi/web/components/markdown-view";
|
||||
import { TiptapView } from "../tiptap-view";
|
||||
import {
|
||||
getAttachmentIdFromSrc,
|
||||
normalizeArticleContentType,
|
||||
normalizeRawArticleContent
|
||||
} from "../article-editor/content";
|
||||
import { ATTACHMENT_ID_ATTR, normalizeContent } from "timi-web/editor";
|
||||
import { ATTACHMENT_ID_ATTR, normalizeContent } from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "ArticleView"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export type {
|
||||
AttachmentSelectorItem,
|
||||
|
||||
@@ -63,7 +63,7 @@ import type {
|
||||
AttachmentSelectorViewerItem
|
||||
} from "./types";
|
||||
import { getMediaKind, getMediaPreviewURL } from "./utils";
|
||||
import { CenterTips } from "timi-web";
|
||||
import { CenterTips } from "@timi/web/components/center-tips";
|
||||
|
||||
defineOptions({
|
||||
name: "AttachmentSelector",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const BottomPopup = WebToolkit.withInstall(view);
|
||||
export default BottomPopup;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const CardContainer = WebToolkit.withInstall(view);
|
||||
export default CardContainer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import "./style.less";
|
||||
|
||||
export type CodeEditorScrollState = {
|
||||
|
||||
@@ -65,8 +65,8 @@ import {
|
||||
replaceMatchText,
|
||||
type TextSearchMatch,
|
||||
type TextSearchOptions
|
||||
} from "timi-web/editor";
|
||||
import { highlightCode, resolveCodeEditorKeydown, resolvePrismLanguage } from "timi-web/editor";
|
||||
} from "@timi/web/editor";
|
||||
import { highlightCode, resolveCodeEditorKeydown, resolvePrismLanguage } from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "CodeEditor"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const DropdownFilter = WebToolkit.withInstall(view);
|
||||
export default DropdownFilter;
|
||||
|
||||
export type {
|
||||
DropdownFilterChange,
|
||||
DropdownFilterItem,
|
||||
DropdownFilterOption,
|
||||
DropdownFilterProps
|
||||
} from "./type";
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div class="tui-filters dropdown-filter">
|
||||
<t-input
|
||||
:model-value="props.modelValue"
|
||||
class="search-input"
|
||||
type="search"
|
||||
borderless
|
||||
clearable
|
||||
:placeholder="props.placeholder"
|
||||
@update:model-value="handleKeywordChange"
|
||||
>
|
||||
<template v-if="$slots['suffix-icon']" #suffix-icon>
|
||||
<slot name="suffix-icon" />
|
||||
</template>
|
||||
</t-input>
|
||||
<configured-dropdown-menu
|
||||
:filters="props.filters"
|
||||
:menu-props="props.menuProps"
|
||||
@filter-change="handleDropdownChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, h, type PropType } from "vue";
|
||||
import { DropdownItem, DropdownMenu } from "tdesign-mobile-vue";
|
||||
import type { DropdownMenuProps, DropdownValue } from "tdesign-mobile-vue";
|
||||
import type { DropdownFilterChange, DropdownFilterItem, DropdownFilterProps } from "./type";
|
||||
|
||||
defineOptions({ name: "DropdownFilter" });
|
||||
|
||||
const props = withDefaults(defineProps<DropdownFilterProps>(), {
|
||||
modelValue: "",
|
||||
placeholder: "搜索"
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: string];
|
||||
"filter-change": [change: DropdownFilterChange];
|
||||
}>();
|
||||
|
||||
/**
|
||||
* TDesign 的 DropdownMenu 只收直接子节点里的 TDropdownItem——它在内部遍历
|
||||
* `slots.default()` 并比对组件名。模板里写 `v-for` 会被编译成一个 Fragment,
|
||||
* 比对失败,整条菜单就是空的;渲染函数手动铺平的数组才是它要的形状。
|
||||
*/
|
||||
const ConfiguredDropdownMenu = defineComponent({
|
||||
name: "ConfiguredDropdownMenu",
|
||||
props: {
|
||||
filters: {
|
||||
type: Array as PropType<DropdownFilterItem[]>,
|
||||
required: true
|
||||
},
|
||||
menuProps: {
|
||||
type: Object as PropType<DropdownMenuProps & { class?: string }>,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
emits: ["filter-change"],
|
||||
setup(menu, { emit: emitMenu }) {
|
||||
return () => h(DropdownMenu, {
|
||||
...menu.menuProps,
|
||||
class: ["menus", menu.menuProps?.class]
|
||||
}, {
|
||||
default: () => menu.filters.map(filter => h(DropdownItem, {
|
||||
key: filter.key,
|
||||
modelValue: filter.value,
|
||||
label: filter.label,
|
||||
options: filter.options,
|
||||
multiple: filter.multiple,
|
||||
optionsColumns: filter.optionsColumns,
|
||||
disabled: filter.disabled,
|
||||
onChange: (value: DropdownValue) => emitMenu("filter-change", { key: filter.key, value })
|
||||
}))
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 搜索框的变化同时算一次筛选变化,业务只接 `filter-change` 也能跑通;
|
||||
* key 固定为 `keyword`,免得每个页面再自己起一套约定。
|
||||
*/
|
||||
function handleKeywordChange(value: string | number): void {
|
||||
const keyword = String(value ?? "");
|
||||
emit("update:modelValue", keyword);
|
||||
emit("filter-change", { key: "keyword", value: keyword });
|
||||
}
|
||||
|
||||
function handleDropdownChange(change: DropdownFilterChange): void {
|
||||
emit("filter-change", change);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
import type { DropdownMenuProps, DropdownValue } from "tdesign-mobile-vue";
|
||||
|
||||
/** 下拉筛选里的一个选项。 */
|
||||
export interface DropdownFilterOption {
|
||||
/** 选项文本。 */
|
||||
label: string;
|
||||
/** 选项值,原样交给 TDesign DropdownItem。 */
|
||||
value: DropdownValue;
|
||||
/** 是否禁用。 */
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
/** 一个筛选项的完整配置。 */
|
||||
export interface DropdownFilterItem {
|
||||
/** 筛选项标识,随 `filter-change` 一起抛出。 */
|
||||
key: string;
|
||||
/** 当前值对应的展示文本,由业务算好。 */
|
||||
label: string;
|
||||
/** 当前值,配合 `v-model` 由业务侧回填。 */
|
||||
value: DropdownValue;
|
||||
/** 可选项。 */
|
||||
options: DropdownFilterOption[];
|
||||
/** 是否多选。 */
|
||||
multiple?: boolean;
|
||||
/** 选项列数。 */
|
||||
optionsColumns?: string | number;
|
||||
/** 是否禁用。 */
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
/** `filter-change` 的事件参数。 */
|
||||
export interface DropdownFilterChange {
|
||||
/** 触发变化的筛选项标识;搜索框固定为 `keyword`。 */
|
||||
key: string;
|
||||
/** 变化后的值。 */
|
||||
value: DropdownValue;
|
||||
}
|
||||
|
||||
/** DropdownFilter 的 props。 */
|
||||
export interface DropdownFilterProps {
|
||||
/** 搜索框内容,配合 `v-model` 使用。 */
|
||||
modelValue?: string;
|
||||
/** 搜索框占位文本,默认「搜索」。 */
|
||||
placeholder?: string;
|
||||
/** 下拉筛选项,按数组顺序渲染。 */
|
||||
filters: DropdownFilterItem[];
|
||||
/** 透传给 TDesign DropdownMenu 的属性。 */
|
||||
menuProps?: DropdownMenuProps;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const DurationPicker = WebToolkit.withInstall(view);
|
||||
export default DurationPicker;
|
||||
|
||||
@@ -18,6 +18,7 @@ import AttachmentSelector from "./attachment-selector";
|
||||
import Space from "./space";
|
||||
import { Timeline, TimelineItem } from "./timeline";
|
||||
import CardContainer from "./card-container";
|
||||
import DropdownFilter from "./dropdown-filter";
|
||||
import {
|
||||
AiChatComposer,
|
||||
AiChatMessageList,
|
||||
@@ -46,6 +47,7 @@ export default [
|
||||
Timeline,
|
||||
TimelineItem,
|
||||
CardContainer,
|
||||
DropdownFilter,
|
||||
AiChatComposer,
|
||||
AiChatMessageList,
|
||||
AiChatPanel,
|
||||
@@ -73,6 +75,7 @@ export {
|
||||
Timeline,
|
||||
TimelineItem,
|
||||
CardContainer,
|
||||
DropdownFilter,
|
||||
AiChatComposer,
|
||||
AiChatMessageList,
|
||||
AiChatPanel,
|
||||
@@ -134,6 +137,13 @@ export type {
|
||||
CardContainerProps
|
||||
} from "./card-container";
|
||||
|
||||
export type {
|
||||
DropdownFilterChange,
|
||||
DropdownFilterItem,
|
||||
DropdownFilterOption,
|
||||
DropdownFilterProps
|
||||
} from "./dropdown-filter";
|
||||
|
||||
export type {
|
||||
AttachmentSelectorItem,
|
||||
AttachmentSelectorProps,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const MasterDetailPage = WebToolkit.withInstall(view);
|
||||
export default MasterDetailPage;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const MasterDetail = WebToolkit.withInstall(view);
|
||||
export default MasterDetail;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, type StyleValue } from "vue";
|
||||
import { CenterTips } from "timi-web";
|
||||
import { CenterTips } from "@timi/web/components/center-tips";
|
||||
import { useLayout } from "../../composables/use-layout";
|
||||
import type { MasterDetailProps } from "./type";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import type { NotifyDetail } from "./types";
|
||||
|
||||
export type { NotifyContentType, NotifyDetail } from "./types";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const NotifyView = WebToolkit.withInstall(view);
|
||||
export default NotifyView;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export type {
|
||||
PageTransitionBackground,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const PaneTransition = WebToolkit.withInstall(view);
|
||||
export default PaneTransition;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const RootLayout = WebToolkit.withInstall(view);
|
||||
export default RootLayout;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Copyright } from "timi-web";
|
||||
import { Copyright } from "@timi/web/components/copyright";
|
||||
|
||||
defineOptions({
|
||||
name: "RootLayout"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export type {
|
||||
SpaceAlign,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import timeline from "./index.vue";
|
||||
import item from "./item.vue";
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { PickerValue } from "tdesign-mobile-vue";
|
||||
import { supportedCodeLanguages } from "timi-web/editor";
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import { supportedCodeLanguages } from "@timi/web/editor";
|
||||
import type { TiptapEditorInstance } from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "TiptapCodeBlockButton"
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { showPlatformMessage } from "../message";
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import type { TiptapEditorInstance } from "@timi/web/editor";
|
||||
import BottomPopup from "../bottom-popup/index.vue";
|
||||
|
||||
defineOptions({
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import type { TiptapEditorInstance } from "@timi/web/editor";
|
||||
import BottomPopup from "../bottom-popup/index.vue";
|
||||
|
||||
defineOptions({
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { showPlatformMessage } from "../message";
|
||||
import type { TiptapEditorInstance, UploadResult } from "timi-web/editor";
|
||||
import type { TiptapEditorInstance, UploadResult } from "@timi/web/editor";
|
||||
import BottomPopup from "../bottom-popup/index.vue";
|
||||
|
||||
defineOptions({
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { TABLE_PICKER_SIZE } from "timi-web/editor";
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import { TABLE_PICKER_SIZE } from "@timi/web/editor";
|
||||
import type { TiptapEditorInstance } from "@timi/web/editor";
|
||||
import BottomPopup from "../bottom-popup/index.vue";
|
||||
|
||||
defineOptions({
|
||||
|
||||
@@ -151,8 +151,8 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ColorObject } from "tdesign-mobile-vue";
|
||||
import type { AlignType, UploadResult, TiptapEditorInstance } from "timi-web/editor";
|
||||
import { headingMeta } from "timi-web/editor";
|
||||
import type { AlignType, UploadResult, TiptapEditorInstance } from "@timi/web/editor";
|
||||
import { headingMeta } from "@timi/web/editor";
|
||||
import TiptapCodeBlockButton from "./TiptapCodeBlockButton.vue";
|
||||
import TiptapIframeButton from "./TiptapIframeButton.vue";
|
||||
import TiptapLinkButton from "./TiptapLinkButton.vue";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
import type { TiptapEditorInstance } from "@timi/web/editor";
|
||||
|
||||
export * from "timi-web/editor";
|
||||
export * from "@timi/web/editor";
|
||||
export type TiptapEditorExpose = {
|
||||
submit: () => Promise<string>;
|
||||
getPendingMediaCount: () => number;
|
||||
|
||||
@@ -58,18 +58,18 @@ import {
|
||||
buildSearchRegex,
|
||||
replaceMatchText,
|
||||
type TextSearchOptions
|
||||
} from "timi-web/editor";
|
||||
import { Toolkit } from "timi-web";
|
||||
import type { PendingMediaItem, UploadMediaType, UploadResult } from "timi-web/editor";
|
||||
} from "@timi/web/editor";
|
||||
import { Toolkit } from "@timi/web/utils";
|
||||
import type { PendingMediaItem, UploadMediaType, UploadResult } from "@timi/web/editor";
|
||||
import TiptapToolbar from "./TiptapToolbar.vue";
|
||||
import { useTiptapEditor } from "timi-web/editor";
|
||||
import { useTiptapEditor } from "@timi/web/editor";
|
||||
import {
|
||||
ATTACHMENT_ID_ATTR,
|
||||
LOCAL_MEDIA_ID_PREFIX,
|
||||
TEMP_FILE_ID_ATTR,
|
||||
isLocalMediaId,
|
||||
normalizeContent
|
||||
} from "timi-web/editor";
|
||||
} from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "TiptapEditor"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import view from "./index.vue";
|
||||
import { WebToolkit } from "timi-web";
|
||||
import { WebToolkit } from "@timi/web/utils";
|
||||
|
||||
export const TiptapView = WebToolkit.withInstall(view);
|
||||
export default TiptapView;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { normalizeContent, useTiptapView } from "timi-web/editor";
|
||||
import { normalizeContent, useTiptapView } from "@timi/web/editor";
|
||||
|
||||
defineOptions({
|
||||
name: "TiptapView"
|
||||
|
||||
@@ -2,7 +2,6 @@ import "./assets/style/tdesign-custom.less";
|
||||
import "./assets/style/entrance-transition.less";
|
||||
import "./assets/style/page-layout.less";
|
||||
import "./components/tiptap-content.less";
|
||||
import "timi-web/style.css";
|
||||
|
||||
export * from "./components";
|
||||
export * from "./directives";
|
||||
|
||||
+52
-17
@@ -1,3 +1,4 @@
|
||||
import { existsSync, readdirSync, statSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { Alias, defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
@@ -8,11 +9,44 @@ import dts from "vite-plugin-dts";
|
||||
|
||||
const alias: Alias[] = [
|
||||
{
|
||||
find: /^timi-tdesign-mobile(\/(es|lib))?$/,
|
||||
find: /^@timi\/tdesign-mobile(\/(es|lib))?$/,
|
||||
replacement: resolve(__dirname, "./src/index.ts")
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* 递归收集组件入口,组件目录下存在 index.ts 时即视为一个可独立导出的组件
|
||||
*/
|
||||
function collectComponentEntries(
|
||||
dir: string,
|
||||
prefix: string,
|
||||
entries: Record<string, string>
|
||||
) {
|
||||
for (const name of readdirSync(dir)) {
|
||||
const fullPath = resolve(dir, name);
|
||||
if (!statSync(fullPath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
const entry = resolve(fullPath, "index.ts");
|
||||
if (existsSync(entry)) {
|
||||
entries[`${prefix}/${name}/index`] = entry;
|
||||
}
|
||||
collectComponentEntries(fullPath, `${prefix}/${name}`, entries);
|
||||
}
|
||||
}
|
||||
|
||||
const entries: Record<string, string> = {
|
||||
index: resolve(__dirname, "./src/index.ts"),
|
||||
"components/index": resolve(__dirname, "./src/components/index.ts"),
|
||||
"directives/index": resolve(__dirname, "./src/directives/index.ts"),
|
||||
"utils/message": resolve(__dirname, "./src/utils/message.ts")
|
||||
};
|
||||
collectComponentEntries(
|
||||
resolve(__dirname, "./src/components"),
|
||||
"components",
|
||||
entries
|
||||
);
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 3004,
|
||||
@@ -24,33 +58,34 @@ export default defineConfig({
|
||||
build: {
|
||||
outDir: "dist",
|
||||
lib: {
|
||||
entry: resolve(__dirname, "./src/index.ts"),
|
||||
name: "TimiTDesignMobile",
|
||||
fileName: "timi-tdesign-mobile"
|
||||
entry: entries,
|
||||
formats: ["es"],
|
||||
fileName: (_format, entryName) => `${entryName}.js`,
|
||||
cssFileName: "timi-tdesign-mobile"
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [
|
||||
"vue",
|
||||
"vue-router",
|
||||
"timi-web",
|
||||
"tdesign-mobile-vue"
|
||||
],
|
||||
external: (id) =>
|
||||
id === "vue" ||
|
||||
id === "vue-router" ||
|
||||
id === "@timi/web" ||
|
||||
id.startsWith("@timi/web/") ||
|
||||
id === "tdesign-mobile-vue" ||
|
||||
id.startsWith("tdesign-mobile-vue/"),
|
||||
output: {
|
||||
globals: {
|
||||
vue: "Vue",
|
||||
"timi-web": "TimiWeb"
|
||||
}
|
||||
chunkFileNames: "chunks/[name]-[hash].js"
|
||||
}
|
||||
},
|
||||
minify: "terser"
|
||||
cssCodeSplit: false,
|
||||
minify: "terser",
|
||||
target: "es2017"
|
||||
},
|
||||
plugins: [
|
||||
vue({
|
||||
include: [/\.vue$/, /\.md$/]
|
||||
}),
|
||||
dts({
|
||||
pathsToAliases: false,
|
||||
aliasesExclude: [/^timi-web\/editor$/]
|
||||
entryRoot: "src",
|
||||
pathsToAliases: false
|
||||
}),
|
||||
AutoImport({
|
||||
imports: [
|
||||
|
||||
Reference in New Issue
Block a user