@ys-knife-crud/element-plus 0.0.1
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/README.md +252 -0
- package/dist/element-plus/src/advancedFilter/advancedConditionGroup.vue.d.ts +29 -0
- package/dist/element-plus/src/advancedFilter/advancedConditionGroup.vue.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterContext.d.ts +45 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterContext.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterPanel.vue.d.ts +117 -0
- package/dist/element-plus/src/advancedFilter/advancedFilterPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/advancedFilter/advancedValueEditor.vue.d.ts +86 -0
- package/dist/element-plus/src/advancedFilter/advancedValueEditor.vue.d.ts.map +1 -0
- package/dist/element-plus/src/commandBar/commandBar.vue.d.ts +53 -0
- package/dist/element-plus/src/commandBar/commandBar.vue.d.ts.map +1 -0
- package/dist/element-plus/src/commandBar/tableActionMenuButton.vue.d.ts +28 -0
- package/dist/element-plus/src/commandBar/tableActionMenuButton.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/dateFilterItem.vue.d.ts +81 -0
- package/dist/element-plus/src/filter/dateFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/dateRangeFilterItem.vue.d.ts +92 -0
- package/dist/element-plus/src/filter/dateRangeFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/enumFilterItem.vue.d.ts +120 -0
- package/dist/element-plus/src/filter/enumFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/filterItemLayout.vue.d.ts +55 -0
- package/dist/element-plus/src/filter/filterItemLayout.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/filterPanel.vue.d.ts +185 -0
- package/dist/element-plus/src/filter/filterPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/filter/textFilterItem.vue.d.ts +71 -0
- package/dist/element-plus/src/filter/textFilterItem.vue.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/formatCell.d.ts +3 -0
- package/dist/element-plus/src/importExcel/formatCell.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/importExcel.vue.d.ts +59 -0
- package/dist/element-plus/src/importExcel/importExcel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/importExcel/importRowEditDialog.vue.d.ts +28 -0
- package/dist/element-plus/src/importExcel/importRowEditDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/index.d.ts +46 -0
- package/dist/element-plus/src/index.d.ts.map +1 -0
- package/dist/element-plus/src/mainPanel/mainPanel.vue.d.ts +76 -0
- package/dist/element-plus/src/mainPanel/mainPanel.vue.d.ts.map +1 -0
- package/dist/element-plus/src/mainPanel/mainPanelMenuNode.vue.d.ts +7 -0
- package/dist/element-plus/src/mainPanel/mainPanelMenuNode.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/cardView.vue.d.ts +38 -0
- package/dist/element-plus/src/table/cardView.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/columnConfigDialog.vue.d.ts +60 -0
- package/dist/element-plus/src/table/columnConfigDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/contextMenu.vue.d.ts +25 -0
- package/dist/element-plus/src/table/contextMenu.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/exportExcelDialog.vue.d.ts +37 -0
- package/dist/element-plus/src/table/exportExcelDialog.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/listView.vue.d.ts +38 -0
- package/dist/element-plus/src/table/listView.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/rowActionsColumn.vue.d.ts +42 -0
- package/dist/element-plus/src/table/rowActionsColumn.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/selectionBar.vue.d.ts +15 -0
- package/dist/element-plus/src/table/selectionBar.vue.d.ts.map +1 -0
- package/dist/element-plus/src/table/table.vue.d.ts +329 -0
- package/dist/element-plus/src/table/table.vue.d.ts.map +1 -0
- package/dist/element-plus/src/tablepage/tablePage.vue.d.ts +406 -0
- package/dist/element-plus/src/tablepage/tablePage.vue.d.ts.map +1 -0
- package/dist/element-plus/src/tablepage/tablePageTypes.d.ts +9 -0
- package/dist/element-plus/src/tablepage/tablePageTypes.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3545 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @ys-knife-crud/element-plus
|
|
2
|
+
|
|
3
|
+
The **element-plus view layer** for `ys.knife.crud` — a set of Vue 3 + Element Plus components that render a full CRUD table (filter panel, command bar, table, column-settings dialog, Excel export dialog, …). All business logic lives in [`@ys-knife-crud/vue`](../vue); framework-agnostic contracts (`Meta`, `Column`, `Action`, `TableApi`, `ExportApi`, …) live in [`@ys-knife-crud/core`](../core).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# pnpm
|
|
9
|
+
pnpm add @ys-knife-crud/element-plus @ys-knife-crud/core element-plus
|
|
10
|
+
|
|
11
|
+
# npm
|
|
12
|
+
npm install @ys-knife-crud/element-plus @ys-knife-crud/core element-plus
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Registering components
|
|
16
|
+
|
|
17
|
+
Two ways to use the components:
|
|
18
|
+
|
|
19
|
+
**Global registration** (use the whole suite as tags like `<ys-table-page>`):
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { createApp } from "vue";
|
|
23
|
+
import ElementPlus from "element-plus";
|
|
24
|
+
import "element-plus/dist/index.css";
|
|
25
|
+
import YsCrudElementPlus from "@ys-knife-crud/element-plus";
|
|
26
|
+
|
|
27
|
+
const app = createApp(App);
|
|
28
|
+
app.use(ElementPlus);
|
|
29
|
+
app.use(YsCrudElementPlus); // registers YsTable / YsTablePage / YsFilterPanel / ... globally
|
|
30
|
+
app.mount("#app");
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Local import** (tree-shakeable, per-page):
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { YsTablePage, YsTextFilterItem } from "@ys-knife-crud/element-plus";
|
|
37
|
+
// now <ys-table-page> / <YsTablePage> resolves in this SFC's template
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## `YsTablePage`
|
|
43
|
+
|
|
44
|
+
A **three-in-one composition component**: `YsFilterPanel` + `YsCommandBar` + `YsTable`, stacked vertically. It removes the boilerplate of manually wiring the three pieces together and **auto-wires the filter panel's query conditions into the table's data loading** — the most repetitive part of the manual combination.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────────────────┐
|
|
48
|
+
│ YsFilterPanel (filter items + 查询/重置) │ ← default slot
|
|
49
|
+
├─────────────────────────────────────────────┤
|
|
50
|
+
│ YsCommandBar (actions + 选中提示条 + ⋮下拉) │ ← #command-bar slot
|
|
51
|
+
├─────────────────────────────────────────────┤
|
|
52
|
+
│ YsTable (table / card / list + 分页) │ ← #card #list #empty #loading #footer
|
|
53
|
+
└─────────────────────────────────────────────┘
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### How the auto-wiring works
|
|
57
|
+
|
|
58
|
+
`YsTablePage` holds the current `FilterInfo` internally. On `filterPanel @search` it updates that filter and calls `table.reload()` (back to page 1); on `@reset` it clears the filter and reloads. Your `dataFun` therefore receives the **current filter as a parameter** and never has to close over a reactive ref yourself.
|
|
59
|
+
|
|
60
|
+
This means `YsTablePage`'s `dataFun` uses an **augmented signature** (one extra `filter` arg) compared to core's `PageFunc`:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import type { TablePageDataFun } from "@ys-knife-crud/element-plus";
|
|
64
|
+
// TablePageDataFun = (req, filter, signal?) => Promise<PagedList<unknown>>
|
|
65
|
+
|
|
66
|
+
const dataFun: TablePageDataFun = async (req, filter, signal) => {
|
|
67
|
+
// Hand `filter` to your backend, or evaluate it client-side.
|
|
68
|
+
// `req` is { limit, offset }; return a PagedList.
|
|
69
|
+
return await fetchPaged("/api/users", { ...req, filter }, signal);
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`YsTablePage` adapts this to the plain `PageFunc` that `YsTable` expects by binding its internal current filter. The adapted function is recomputed **only** when your `dataFun` reference changes (so pass a stable `const`, see notes below) — the filter is read at call time, and reloads are driven by the explicit `reload()` on search/reset.
|
|
74
|
+
|
|
75
|
+
### Minimal example
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<script setup lang="ts">
|
|
79
|
+
import { constData, Operator } from "@ys-knife-crud/core";
|
|
80
|
+
import { YsTablePage, YsTextFilterItem, type TablePageDataFun } from "@ys-knife-crud/element-plus";
|
|
81
|
+
import { createExcelJsExportApiFunc } from "@ys-knife-crud/export-exceljs";
|
|
82
|
+
import { metaFun, type UserRow } from "./meta"; // your MetaFunc
|
|
83
|
+
import { allRows } from "./data"; // your source rows
|
|
84
|
+
|
|
85
|
+
const exportorFunc = createExcelJsExportApiFunc();
|
|
86
|
+
|
|
87
|
+
// Augmented dataFun: filter comes in as a FilterInfo. Here we evaluate a single
|
|
88
|
+
// "name contains X" condition client-side; in real apps you usually forward
|
|
89
|
+
// `filter` to the backend instead.
|
|
90
|
+
const dataFun: TablePageDataFun = (req, filter) => {
|
|
91
|
+
const rows = applyFilter(allRows, filter); // your filter→rows logic
|
|
92
|
+
return constData(rows)(req);
|
|
93
|
+
};
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<template>
|
|
97
|
+
<ys-table-page
|
|
98
|
+
:meta-fun="metaFun"
|
|
99
|
+
:data-fun="dataFun"
|
|
100
|
+
:page-size="10"
|
|
101
|
+
show-checkbox
|
|
102
|
+
:exportor-func="exportorFunc"
|
|
103
|
+
style="height: 100%"
|
|
104
|
+
>
|
|
105
|
+
<!-- filter items → YsFilterPanel default slot -->
|
|
106
|
+
<ys-text-filter-item label="姓名" property-path="name" :op="Operator.Contains" placeholder="输入姓名片段" />
|
|
107
|
+
|
|
108
|
+
<!-- table view slots are forwarded as-is -->
|
|
109
|
+
<template #card="{ row }">
|
|
110
|
+
<div class="card">{{ row.name }} · {{ row.email }}</div>
|
|
111
|
+
</template>
|
|
112
|
+
</ys-table-page>
|
|
113
|
+
</template>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Props
|
|
117
|
+
|
|
118
|
+
All props of the three wrapped components are **flattened** onto `YsTablePage` (no name collisions). They fall into three groups:
|
|
119
|
+
|
|
120
|
+
#### Table (forwarded to `YsTable`)
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Default | Description |
|
|
123
|
+
| --- | --- | --- | --- |
|
|
124
|
+
| `metaFun` | `MetaFunc` | — **required** | Async column-metadata loader. |
|
|
125
|
+
| `dataFun` | `TablePageDataFun` | — **required** | **Augmented** data loader `(req, filter, signal) => Promise<PagedList>`. The `filter` arg is injected from the filter panel. |
|
|
126
|
+
| `rowActionsFunc` | `RowActionsFunc` | — | Optional per-row action loader. |
|
|
127
|
+
| `pageSize` | `number` | `20` | Initial page size. |
|
|
128
|
+
| `pageSizes` | `number[]` | `[10,20,50,100]` | Page-size dropdown options. |
|
|
129
|
+
| `showCheckbox` | `boolean` | `false` | Show the selection column. `v-model:show-checkbox`. |
|
|
130
|
+
| `columnResizable` | `boolean` | `true` | Allow dragging column borders. `v-model:column-resizable`. |
|
|
131
|
+
| `loadCustomConfigFun` | `loadCustomConfigFunc` | — | Load saved column config / default page size. |
|
|
132
|
+
| `saveCustomConfigFun` | `saveCustomConfigFunc` | — | Persist column config / default page size. |
|
|
133
|
+
| `exportPageSize` | `number` | `1000` | Page size used while streaming "export all". |
|
|
134
|
+
| `exportorFunc` | `ExportApiFunc` | — | Export implementation factory (e.g. `createExcelJsExportApiFunc()`). Falls back to a console stub. |
|
|
135
|
+
| `rowKey` | `string` | `"id"` | Row identity field (drives cross-page selection). |
|
|
136
|
+
| `viewMode` | `"table" \| "card" \| "list"` | `"table"` | Active view. `v-model:view-mode`. |
|
|
137
|
+
|
|
138
|
+
#### Command bar (forwarded to `YsCommandBar`)
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Default | Description |
|
|
141
|
+
| --- | --- | --- | --- |
|
|
142
|
+
| `actions` | `TableAction[]` | `[]` | Table-level commands rendered as buttons on the left (each `execute(table)` receives the internal `TableApi`). |
|
|
143
|
+
| `showActionMenuButton` | `boolean` | `true` | Show the built-in right-aligned ⋮ dropdown (refresh / export / column settings / view switch / select / column resize). |
|
|
144
|
+
|
|
145
|
+
#### Filter panel (forwarded to `YsFilterPanel`)
|
|
146
|
+
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
| --- | --- | --- | --- |
|
|
149
|
+
| `showSearch` | `boolean` | `true` | Render the built-in 查询 button. |
|
|
150
|
+
| `showReset` | `boolean` | `true` | Render the built-in 重置 button. |
|
|
151
|
+
| `searchButtonText` | `string` | `"查询"` | Search button text. |
|
|
152
|
+
| `resetButtonText` | `string` | `"重置"` | Reset button text. |
|
|
153
|
+
| `enableAdvancedFilter` | `boolean` | `false` | Enable switching to the built-in advanced-filter panel. |
|
|
154
|
+
| `advancedColumns` | `Column[]` | `[]` | Fields available to the advanced filter (required when `enableAdvancedFilter`). |
|
|
155
|
+
| `advancedOptionSources` | `Record<string, EnumOptionsSource>` | — | Enum data sources for advanced filter fields, keyed by `propertyPath`. |
|
|
156
|
+
| `showQuickQuery` | `boolean` | `false` | Show saved-query tags in simple mode. |
|
|
157
|
+
| `quickQueries` | `SavedQuery[]` | `undefined` | Saved-query list. `v-model:quick-queries`. |
|
|
158
|
+
| `loadQuickQueryFun` | `() => Promise<SavedQuery[]>` | — | Async loader for saved queries (auto-called on mount). |
|
|
159
|
+
| `saveQuickQueryFun` | `(q: SavedQuery) => Promise<void \| SavedQuery>` | — | Async persister for new saved queries. |
|
|
160
|
+
| `singleLine` | `boolean` | `false` | Collapse overflow filter items into one line with an expand toggle. |
|
|
161
|
+
|
|
162
|
+
### Events
|
|
163
|
+
|
|
164
|
+
All events from the wrapped components are re-emitted, so `v-model` works through `YsTablePage`:
|
|
165
|
+
|
|
166
|
+
| Event | Payload | Description |
|
|
167
|
+
| --- | --- | --- |
|
|
168
|
+
| `search` | `FilterInfo` | Filter panel search submitted. `YsTablePage` has **already** reloaded the table; this is for external awareness only. |
|
|
169
|
+
| `reset` | — | Filter panel reset. `YsTablePage` has **already** cleared + reloaded. |
|
|
170
|
+
| `update:quickQueries` | `SavedQuery[]` | `v-model:quick-queries` update. |
|
|
171
|
+
| `data-loaded` | `PagedList` | Table finished loading a page. |
|
|
172
|
+
| `update:viewMode` | `ViewMode` | `v-model:view-mode` update. |
|
|
173
|
+
| `update:showCheckbox` | `boolean` | `v-model:show-checkbox` update. |
|
|
174
|
+
| `update:columnResizable` | `boolean` | `v-model:column-resizable` update. |
|
|
175
|
+
|
|
176
|
+
### Slots
|
|
177
|
+
|
|
178
|
+
| Slot | Scope | Forwarded to | Description |
|
|
179
|
+
| --- | --- | --- | --- |
|
|
180
|
+
| default | — | `YsFilterPanel` default | Filter items (`YsTextFilterItem` / `YsDateFilterItem` / `YsEnumFilterItem` / …). |
|
|
181
|
+
| `command-bar` | — | `YsCommandBar` default | Extra content appended after the command buttons / selection bar. |
|
|
182
|
+
| `card` | `{ row, index }` | `YsTable #card` | Card-view content per row. |
|
|
183
|
+
| `list` | `{ row, index }` | `YsTable #list` | List-view content per row. |
|
|
184
|
+
| `empty` | — | `YsTable #empty` | Custom empty-state content. |
|
|
185
|
+
| `loading` | — | `YsTable #loading` | Custom loading overlay. |
|
|
186
|
+
| `footer` | — | `YsTable #footer` | Extra footer content (left of the paginator). |
|
|
187
|
+
|
|
188
|
+
### Exposed API
|
|
189
|
+
|
|
190
|
+
Via a template ref, `YsTablePage` exposes the internal instances for advanced external control:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
const pageRef = ref<{
|
|
194
|
+
table: TableApi | null; // the internal YsTable instance
|
|
195
|
+
filterPanel: { // the internal YsFilterPanel instance
|
|
196
|
+
filter: ComputedRef<FilterInfo>;
|
|
197
|
+
reset: () => void;
|
|
198
|
+
mode: Ref<"simple" | "advanced">;
|
|
199
|
+
} | null;
|
|
200
|
+
} | null>(null);
|
|
201
|
+
|
|
202
|
+
pageRef.value?.table?.refresh(); // refresh current page (keeps filter/page)
|
|
203
|
+
pageRef.value?.table?.openConfigDialog(); // open column-settings dialog
|
|
204
|
+
pageRef.value?.filterPanel?.mode.value; // read current filter mode
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
You normally don't need this — `actions` receive the `TableApi` automatically, and search/reset are wired for you. Reach for it only when external code must drive the table or read filter state.
|
|
208
|
+
|
|
209
|
+
### Layout & fill-height
|
|
210
|
+
|
|
211
|
+
`YsTablePage` is a vertical flex column (`display:flex; flex-direction:column`) that fills its parent. The filter panel and command bar are `flex-shrink:0`; the table area is `flex:1; min-height:0` with the inner `YsTable` set to `height:100%`. Give `YsTablePage` a height (e.g. `style="height:100%"` inside a sized parent, or `100vh`) and the table content scrolls while the filter panel, command bar, and paginator stay fixed.
|
|
212
|
+
|
|
213
|
+
### Notes & gotchas
|
|
214
|
+
|
|
215
|
+
- **Keep `dataFun` a stable `const`.** `YsTablePage` adapts it with a `computed` that recomputes when the `dataFun` reference changes; an inline arrow `:data-fun="(req,filter) => …"` recreates every render and reloads the table each time. Declare it as a `const` in `<script setup>` (same convention as `YsTable`).
|
|
216
|
+
- **Search reloads from page 1 via `table.reload()`.** `reload()` re-fetches meta / row actions / column config in addition to data. This is harmless for most apps; if you need a lighter "data-only page-1 reload", call `pageRef.value?.table?.refresh()` after programmatically driving the filter instead.
|
|
217
|
+
- **`FilterInfo` has no public evaluator.** `core` exposes `FilterInfo` with `toString()` / `isEmpty()` / `andAlso` / `orElse` only (its fields are protected). For client-side evaluation you'd parse `filter.toString()` (single-condition format: `"propertyPath op value"`, e.g. `"name contains 张"`). In real apps, forward `filter` to your backend query API rather than evaluating it in the browser.
|
|
218
|
+
- **`dataFun`'s filter is read at call time.** `YsTablePage` stores the current filter in a `shallowRef<FilterInfo>`; the adapted `PageFunc` reads it when the table calls it, so page changes / refreshes always use the latest active filter.
|
|
219
|
+
|
|
220
|
+
### Other components
|
|
221
|
+
|
|
222
|
+
The package also exports the individual building blocks for when you need finer control than `YsTablePage`: `YsTable`, `YsFilterPanel` (+ `YsTextFilterItem` / `YsDateFilterItem` / `YsDateRangeFilterItem` / `YsEnumFilterItem` / `YsFilterItemLayout`), `YsCommandBar`, `YsTableActionMenuButton`, `YsMainPanel`, and the advanced-filter trio (`YsAdvancedFilterPanel` / `YsAdvancedValueEditor` / `YsAdvancedConditionGroup`). `YsTablePage` is the recommended starting point; drop down to the primitives only when its fixed layout doesn't fit.
|
|
223
|
+
|
|
224
|
+
## Relationship to other packages
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
┌─────────────────────────────────────────────┐
|
|
228
|
+
│ your app │
|
|
229
|
+
└───────────────────┬─────────────────────────┘
|
|
230
|
+
│ uses
|
|
231
|
+
▼
|
|
232
|
+
┌─────────────────────────────────────────────┐
|
|
233
|
+
│ @ys-knife-crud/element-plus (.vue) │ ← this package
|
|
234
|
+
└───────────────────┬─────────────────────────┘
|
|
235
|
+
│ consumes
|
|
236
|
+
▼
|
|
237
|
+
┌─────────────────────────────────────────────┐
|
|
238
|
+
│ @ys-knife-crud/vue (composables) │
|
|
239
|
+
└───────────────────┬─────────────────────────┘
|
|
240
|
+
│ depends on
|
|
241
|
+
▼
|
|
242
|
+
┌─────────────────────────────────────────────┐
|
|
243
|
+
│ @ys-knife-crud/core (contracts & types) │
|
|
244
|
+
└─────────────────────────────────────────────┘
|
|
245
|
+
|
|
246
|
+
@ys-knife-crud/export-exceljs
|
|
247
|
+
(ExportApi implementation, injected as exportorFunc)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { AdvancedConditionGroup } from '../../packages/core/src/index.ts';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
/** 本分组节点数据 */
|
|
5
|
+
group: {
|
|
6
|
+
type: PropType<AdvancedConditionGroup>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
/** 嵌套层级;0 = 根(无边框),>=1 = 嵌套(左侧色条 + 缩进) */
|
|
10
|
+
level: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: number;
|
|
13
|
+
};
|
|
14
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
|
+
/** 本分组节点数据 */
|
|
16
|
+
group: {
|
|
17
|
+
type: PropType<AdvancedConditionGroup>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
/** 嵌套层级;0 = 根(无边框),>=1 = 嵌套(左侧色条 + 缩进) */
|
|
21
|
+
level: {
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {
|
|
26
|
+
level: number;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
28
|
+
export default _default;
|
|
29
|
+
//# sourceMappingURL=advancedConditionGroup.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedConditionGroup.vue.d.ts","sourceRoot":"","sources":["../../../../src/advancedFilter/advancedConditionGroup.vue"],"names":[],"mappings":"AAqSA,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAEV,sBAAsB,EAIvB,MAAM,qBAAqB,CAAC;;IAse3B,cAAc;;cACW,QAAQ,CAAC,sBAAsB,CAAC;;;IACzD,0CAA0C;;;;;;IAF1C,cAAc;;cACW,QAAQ,CAAC,sBAAsB,CAAC;;;IACzD,0CAA0C;;;;;;;;AAR5C,wBAWG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { AdvancedConditionGroup, Column, EnumOption } from '../../packages/core/src/index.ts';
|
|
3
|
+
import { useAdvancedFilter } from '../../packages/vue/src/index.ts';
|
|
4
|
+
/**
|
|
5
|
+
* FilterInfo 公共接口的子集类型。跨包 dts 时 FilterInfo 的 protected 字段会被剥离,
|
|
6
|
+
* 导致结构比较失败。SavedQuery.filterInfo 只需要 toString / isEmpty(供简单模式
|
|
7
|
+
* emit('search', sq.filterInfo) 时传给外部),用此类型避免类型不兼容。
|
|
8
|
+
*/
|
|
9
|
+
export interface FilterInfoSnapshot {
|
|
10
|
+
toString(): string;
|
|
11
|
+
isEmpty(): boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* YsAdvancedFilterPanel 顶层 provide 的共享上下文:
|
|
15
|
+
* 递归子组件 YsAdvancedConditionGroup 用 inject 取用,
|
|
16
|
+
* 避免每层显式透传多个 prop。
|
|
17
|
+
*
|
|
18
|
+
* - columns:可查询字段列表(与 panel props.columns 一致)
|
|
19
|
+
* - optionsMap / loadingMap:enum 字段的选项缓存与加载状态
|
|
20
|
+
* - api:useAdvancedFilter 返回对象,含 rootGroup/增删改/聚合 filter
|
|
21
|
+
*
|
|
22
|
+
* 日期字段的 value-format 由 Column.displayFormat 提供(递归子组件按
|
|
23
|
+
* 当前行选中的字段查找 column 取用),无需在 panel 层统一传入。
|
|
24
|
+
*/
|
|
25
|
+
export interface AdvancedFilterContext {
|
|
26
|
+
readonly columns: Column[];
|
|
27
|
+
readonly optionsMap: Ref<Record<string, EnumOption[]>>;
|
|
28
|
+
readonly loadingMap: Ref<Record<string, boolean>>;
|
|
29
|
+
readonly api: ReturnType<typeof useAdvancedFilter>;
|
|
30
|
+
}
|
|
31
|
+
export declare const ADVANCED_FILTER_KEY: InjectionKey<AdvancedFilterContext>;
|
|
32
|
+
/**
|
|
33
|
+
* 已保存的查询预设:深拷贝的条件树快照 + 用户命名的名称/描述。
|
|
34
|
+
* 由 YsAdvancedFilterPanel 内部管理,经 expose 暴露给外部(如 YsFilterPanel
|
|
35
|
+
* 在高级模式下渲染标签列表)。
|
|
36
|
+
*/
|
|
37
|
+
export interface SavedQuery {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
group: AdvancedConditionGroup;
|
|
42
|
+
/** 保存时的聚合 FilterInfo 快照,供简单模式直接 emit('search') 用 */
|
|
43
|
+
filterInfo: FilterInfoSnapshot;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=advancedFilterContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedFilterContext.d.ts","sourceRoot":"","sources":["../../../../src/advancedFilter/advancedFilterContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,IAAI,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,qBAAqB,CACxC,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,oDAAoD;IACpD,UAAU,EAAE,kBAAkB,CAAC;CAChC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Column, EnumOptionsSource, FilterInfo } from '../../packages/core/src/index.ts';
|
|
3
|
+
import { SavedQuery } from './advancedFilterContext';
|
|
4
|
+
declare function onReset(): void;
|
|
5
|
+
/** 打开保存对话框(外部也可经 expose 调用) */
|
|
6
|
+
declare function openSaveDialog(): void;
|
|
7
|
+
/** 应用已存查询:深拷贝保存的 group 覆盖 rootGroup,并立即触发查询 */
|
|
8
|
+
declare function applySavedQuery(sq: SavedQuery): void;
|
|
9
|
+
/** 删除已存查询 */
|
|
10
|
+
declare function removeSavedQuery(id: string): void;
|
|
11
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
12
|
+
/** 可供查询的字段列表(通常直接传 Meta.columns;隐藏列也可查询) */
|
|
13
|
+
columns: {
|
|
14
|
+
type: PropType<Column[]>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
/** 枚举字段数据源,按 propertyPath 映射;命中的字段按 enum 渲染 */
|
|
18
|
+
optionSources: {
|
|
19
|
+
type: PropType<Record<string, EnumOptionsSource>>;
|
|
20
|
+
required: false;
|
|
21
|
+
};
|
|
22
|
+
/** 是否渲染内置「查询」按钮,默认 true */
|
|
23
|
+
showSearch: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** 是否渲染内置「重置」按钮,默认 true */
|
|
28
|
+
showReset: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
/** 查询按钮文案,默认 "查询" */
|
|
33
|
+
searchButtonText: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
/** 重置按钮文案,默认 "重置" */
|
|
38
|
+
resetButtonText: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
/** 是否渲染内置「保存」按钮,默认 true */
|
|
43
|
+
showSaveQuery: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** 已存查询列表(v-model:saved-queries),不传则用内部状态 */
|
|
48
|
+
savedQueries: {
|
|
49
|
+
type: PropType<SavedQuery[]>;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
}>, {
|
|
53
|
+
filter: FilterInfo;
|
|
54
|
+
reset: typeof onReset;
|
|
55
|
+
openSaveDialog: typeof openSaveDialog;
|
|
56
|
+
applySavedQuery: typeof applySavedQuery;
|
|
57
|
+
removeSavedQuery: typeof removeSavedQuery;
|
|
58
|
+
savedQueries: SavedQuery[];
|
|
59
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
60
|
+
reset: () => any;
|
|
61
|
+
search: (filter: FilterInfo) => any;
|
|
62
|
+
"update:savedQueries": (queries: SavedQuery[]) => any;
|
|
63
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
64
|
+
/** 可供查询的字段列表(通常直接传 Meta.columns;隐藏列也可查询) */
|
|
65
|
+
columns: {
|
|
66
|
+
type: PropType<Column[]>;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
/** 枚举字段数据源,按 propertyPath 映射;命中的字段按 enum 渲染 */
|
|
70
|
+
optionSources: {
|
|
71
|
+
type: PropType<Record<string, EnumOptionsSource>>;
|
|
72
|
+
required: false;
|
|
73
|
+
};
|
|
74
|
+
/** 是否渲染内置「查询」按钮,默认 true */
|
|
75
|
+
showSearch: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: boolean;
|
|
78
|
+
};
|
|
79
|
+
/** 是否渲染内置「重置」按钮,默认 true */
|
|
80
|
+
showReset: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
/** 查询按钮文案,默认 "查询" */
|
|
85
|
+
searchButtonText: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
89
|
+
/** 重置按钮文案,默认 "重置" */
|
|
90
|
+
resetButtonText: {
|
|
91
|
+
type: StringConstructor;
|
|
92
|
+
default: string;
|
|
93
|
+
};
|
|
94
|
+
/** 是否渲染内置「保存」按钮,默认 true */
|
|
95
|
+
showSaveQuery: {
|
|
96
|
+
type: BooleanConstructor;
|
|
97
|
+
default: boolean;
|
|
98
|
+
};
|
|
99
|
+
/** 已存查询列表(v-model:saved-queries),不传则用内部状态 */
|
|
100
|
+
savedQueries: {
|
|
101
|
+
type: PropType<SavedQuery[]>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
}>> & Readonly<{
|
|
105
|
+
onReset?: (() => any) | undefined;
|
|
106
|
+
onSearch?: ((filter: FilterInfo) => any) | undefined;
|
|
107
|
+
"onUpdate:savedQueries"?: ((queries: SavedQuery[]) => any) | undefined;
|
|
108
|
+
}>, {
|
|
109
|
+
showSearch: boolean;
|
|
110
|
+
showReset: boolean;
|
|
111
|
+
searchButtonText: string;
|
|
112
|
+
resetButtonText: string;
|
|
113
|
+
showSaveQuery: boolean;
|
|
114
|
+
savedQueries: SavedQuery[];
|
|
115
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
116
|
+
export default _default;
|
|
117
|
+
//# sourceMappingURL=advancedFilterPanel.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedFilterPanel.vue.d.ts","sourceRoot":"","sources":["../../../../src/advancedFilter/advancedFilterPanel.vue"],"names":[],"mappings":"AAgUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,KAAK,EAGV,MAAM,EAEN,iBAAiB,EACjB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AA+HjC,iBAAS,OAAO,IAAI,IAAI,CAGvB;AA2CD,+BAA+B;AAC/B,iBAAS,cAAc,IAAI,IAAI,CAI9B;AAqBD,+CAA+C;AAC/C,iBAAS,eAAe,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAG7C;AAED,aAAa;AACb,iBAAS,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE1C;;IA+SC,4CAA4C;;cAClB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;IAC5C,+CAA+C;;cAE7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;;;IAG7D,2BAA2B;;;;;IAE3B,2BAA2B;;;;;IAE3B,qBAAqB;;;;;IAErB,qBAAqB;;;;;IAErB,2BAA2B;;;;;IAE3B,6CAA6C;;cAE5B,QAAQ,CAAC,UAAU,EAAE,CAAC;;;;YA7TzB,UAAU;;;;;kBAOJ,UAAU,EAAE;;;;;;IAmShC,4CAA4C;;cAClB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;IAC5C,+CAA+C;;cAE7B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;;;IAG7D,2BAA2B;;;;;IAE3B,2BAA2B;;;;;IAE3B,qBAAqB;;;;;IAErB,qBAAqB;;;;;IAErB,2BAA2B;;;;;IAE3B,6CAA6C;;cAE5B,QAAQ,CAAC,UAAU,EAAE,CAAC;;;;;;;;;;;;;;;AA3BzC,wBA+BG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { AdvancedFieldType, AdvancedOperator, EnumOption } from '../../packages/core/src/index.ts';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
/** 字段类型(决定控件种类) */
|
|
5
|
+
fieldType: {
|
|
6
|
+
type: PropType<AdvancedFieldType>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
/** 当前操作符(决定单值/区间/多值/无值形态) */
|
|
10
|
+
op: {
|
|
11
|
+
type: PropType<AdvancedOperator>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 受控值;形态由 fieldType + op 决定(单值/区间数组/多值数组/boolean)。
|
|
16
|
+
* type:null 是 Vue 官方的「任意类型 prop」通路:runtime 跳过构造器校验,
|
|
17
|
+
* 类型映射为 any,父级 row.value 可直接 v-model 透传。
|
|
18
|
+
*/
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: null;
|
|
21
|
+
required: false;
|
|
22
|
+
default: null;
|
|
23
|
+
};
|
|
24
|
+
/** enum 类型的可选项(父组件按字段数据源异步加载后传入) */
|
|
25
|
+
options: {
|
|
26
|
+
type: PropType<EnumOption[]>;
|
|
27
|
+
default: () => never[];
|
|
28
|
+
};
|
|
29
|
+
/** enum 选项加载中(el-select loading) */
|
|
30
|
+
optionsLoading: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** el-date-picker value-format,默认 YYYY-MM-DD */
|
|
35
|
+
valueFormat: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
40
|
+
"update:modelValue": (value: unknown) => any;
|
|
41
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
42
|
+
/** 字段类型(决定控件种类) */
|
|
43
|
+
fieldType: {
|
|
44
|
+
type: PropType<AdvancedFieldType>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
/** 当前操作符(决定单值/区间/多值/无值形态) */
|
|
48
|
+
op: {
|
|
49
|
+
type: PropType<AdvancedOperator>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* 受控值;形态由 fieldType + op 决定(单值/区间数组/多值数组/boolean)。
|
|
54
|
+
* type:null 是 Vue 官方的「任意类型 prop」通路:runtime 跳过构造器校验,
|
|
55
|
+
* 类型映射为 any,父级 row.value 可直接 v-model 透传。
|
|
56
|
+
*/
|
|
57
|
+
modelValue: {
|
|
58
|
+
type: null;
|
|
59
|
+
required: false;
|
|
60
|
+
default: null;
|
|
61
|
+
};
|
|
62
|
+
/** enum 类型的可选项(父组件按字段数据源异步加载后传入) */
|
|
63
|
+
options: {
|
|
64
|
+
type: PropType<EnumOption[]>;
|
|
65
|
+
default: () => never[];
|
|
66
|
+
};
|
|
67
|
+
/** enum 选项加载中(el-select loading) */
|
|
68
|
+
optionsLoading: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
/** el-date-picker value-format,默认 YYYY-MM-DD */
|
|
73
|
+
valueFormat: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
}>> & Readonly<{
|
|
78
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
79
|
+
}>, {
|
|
80
|
+
modelValue: any;
|
|
81
|
+
options: EnumOption[];
|
|
82
|
+
optionsLoading: boolean;
|
|
83
|
+
valueFormat: string;
|
|
84
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
85
|
+
export default _default;
|
|
86
|
+
//# sourceMappingURL=advancedValueEditor.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedValueEditor.vue.d.ts","sourceRoot":"","sources":["../../../../src/advancedFilter/advancedValueEditor.vue"],"names":[],"mappings":"AAmVA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;IA+jBzF,mBAAmB;;cACU,QAAQ,CAAC,iBAAiB,CAAC;;;IACxD,6BAA6B;;cACP,QAAQ,CAAC,gBAAgB,CAAC;;;IAChD;;;;OAIG;;;;;;IAEH,oCAAoC;;cACV,QAAQ,CAAC,UAAU,EAAE,CAAC;;;IAChD,oCAAoC;;;;;IAEpC,gDAAgD;;;;;;;;IAdhD,mBAAmB;;cACU,QAAQ,CAAC,iBAAiB,CAAC;;;IACxD,6BAA6B;;cACP,QAAQ,CAAC,gBAAgB,CAAC;;;IAChD;;;;OAIG;;;;;;IAEH,oCAAoC;;cACV,QAAQ,CAAC,UAAU,EAAE,CAAC;;;IAChD,oCAAoC;;;;;IAEpC,gDAAgD;;;;;;;;;;;;;AArBlD,wBAwBG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { TableAction, TableApi } from '../../packages/core/src/index.ts';
|
|
3
|
+
declare var __VLS_22: {};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
default?: (props: typeof __VLS_22) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
8
|
+
/** 表级命令列表,每条渲染为一个 el-button(type/plain/icon/desc),click 调 execute(table) */
|
|
9
|
+
actions: {
|
|
10
|
+
type: PropType<TableAction[]>;
|
|
11
|
+
required: true;
|
|
12
|
+
default: () => never[];
|
|
13
|
+
};
|
|
14
|
+
/** 当前表格实例;允许 null(表格未挂载时按钮仍可渲染,点击不执行,下拉按钮隐藏) */
|
|
15
|
+
table: {
|
|
16
|
+
type: PropType<TableApi | null>;
|
|
17
|
+
default: null;
|
|
18
|
+
};
|
|
19
|
+
/** 是否显示内置表格操作下拉按钮(刷新/列设置/导出/视图切换/选择行/列宽拖动),默认 true 居右 */
|
|
20
|
+
showActionMenuButton: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
25
|
+
/** 表级命令列表,每条渲染为一个 el-button(type/plain/icon/desc),click 调 execute(table) */
|
|
26
|
+
actions: {
|
|
27
|
+
type: PropType<TableAction[]>;
|
|
28
|
+
required: true;
|
|
29
|
+
default: () => never[];
|
|
30
|
+
};
|
|
31
|
+
/** 当前表格实例;允许 null(表格未挂载时按钮仍可渲染,点击不执行,下拉按钮隐藏) */
|
|
32
|
+
table: {
|
|
33
|
+
type: PropType<TableApi | null>;
|
|
34
|
+
default: null;
|
|
35
|
+
};
|
|
36
|
+
/** 是否显示内置表格操作下拉按钮(刷新/列设置/导出/视图切换/选择行/列宽拖动),默认 true 居右 */
|
|
37
|
+
showActionMenuButton: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
}>> & Readonly<{}>, {
|
|
42
|
+
table: TableApi | null;
|
|
43
|
+
actions: TableAction[];
|
|
44
|
+
showActionMenuButton: boolean;
|
|
45
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
46
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
49
|
+
new (): {
|
|
50
|
+
$slots: S;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=commandBar.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandBar.vue.d.ts","sourceRoot":"","sources":["../../../../src/commandBar/commandBar.vue"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAyIjE,QAAA,IAAI,QAAQ,IAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AA4BhD,QAAA,MAAM,eAAe;IAMnB,4EAA4E;;cAClD,QAAQ,CAAC,WAAW,EAAE,CAAC;;;;IACjD,gDAAgD;;cACvB,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;;;IAClD,yDAAyD;;;;;;IAJzD,4EAA4E;;cAClD,QAAQ,CAAC,WAAW,EAAE,CAAC;;;;IACjD,gDAAgD;;cACvB,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;;;IAClD,yDAAyD;;;;;;;;;4EAGzD,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAE1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TableApi } from '../../packages/core/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* 表格操作菜单按钮(图标按钮 + 下拉菜单):
|
|
4
|
+
* 把「刷新 / 列设置 / 导出 Excel / 视图切换 / 选择行开关 / 列宽拖动开关 / 锁定表头开关」
|
|
5
|
+
* 收敛到一个纯图标按钮,全部命令经 TableApi 驱动。菜单本身无状态——✓ 标记在菜单
|
|
6
|
+
* 弹出渲染时直接读 table 的当前状态(TableApi getter,始终反映表格实际值),
|
|
7
|
+
* 切换调对应 setter(受控 / 非受控模式均生效)。
|
|
8
|
+
*
|
|
9
|
+
* 触发按钮可用 #trigger 插槽整体自定义(如换图标/文字/样式);
|
|
10
|
+
* 未提供时使用内置 32px 方形 sliders 图标按钮。
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
/** 当前表格实例(TableApi,必填):所有命令都经它调用 */
|
|
14
|
+
table: TableApi;
|
|
15
|
+
};
|
|
16
|
+
declare var __VLS_9: {};
|
|
17
|
+
type __VLS_Slots = {} & {
|
|
18
|
+
trigger?: (props: typeof __VLS_9) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=tableActionMenuButton.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableActionMenuButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/commandBar/tableActionMenuButton.vue"],"names":[],"mappings":"AAgKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;GASG;AACH,KAAK,WAAW,GAAG;IACjB,oCAAoC;IACpC,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AA+VF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAmB/C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|