@ys-knife-crud/taro 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +865 -111
- package/dist/index.js.map +1 -1
- package/dist/taro/src/components/filter-item/index.d.ts +6 -0
- package/dist/taro/src/components/filter-item/index.d.ts.map +1 -0
- package/dist/taro/src/components/filter-item/use-filter-item.d.ts +77 -0
- package/dist/taro/src/components/filter-item/use-filter-item.d.ts.map +1 -0
- package/dist/taro/src/components/filter-panel/context.d.ts +28 -0
- package/dist/taro/src/components/filter-panel/context.d.ts.map +1 -0
- package/dist/taro/src/components/filter-panel/index.d.ts +2 -0
- package/dist/taro/src/components/filter-panel/index.d.ts.map +1 -0
- package/dist/taro/src/index.d.ts +5 -0
- package/dist/taro/src/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { defineComponent as Y, ref as
|
|
2
|
-
import { createSelectorQuery as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as Y, ref as w, computed as B, watch as X, getCurrentInstance as ae, onMounted as G, openBlock as d, createElementBlock as v, normalizeStyle as z, createElementVNode as s, Fragment as L, renderList as H, normalizeClass as T, createCommentVNode as b, renderSlot as V, toDisplayString as C, nextTick as ie, inject as re, onBeforeUnmount as se, useSlots as ue, shallowRef as oe, provide as ce, withDirectives as fe, vShow as de, createBlock as K, withCtx as q, unref as F, withModifiers as W, createVNode as J } from "vue";
|
|
2
|
+
import { createSelectorQuery as ye } from "@tarojs/taro";
|
|
3
|
+
import { emptyFilter as me, FilterInfo as ve, filter as A, con as M, Operator as Q } from "@ys-knife-crud/core";
|
|
4
|
+
import './index.css';const he = ["lower-threshold"], ge = { class: "yk-infinite-list__content" }, pe = ["onTap"], ke = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "yk-infinite-list__checkbox-icon"
|
|
6
|
-
},
|
|
7
|
+
}, _e = { class: "yk-infinite-list__item-body" }, xe = { class: "yk-infinite-list__item-json" }, Se = {
|
|
7
8
|
key: 0,
|
|
8
9
|
class: "yk-infinite-list__status"
|
|
9
|
-
},
|
|
10
|
+
}, we = {
|
|
10
11
|
key: 1,
|
|
11
12
|
class: "yk-infinite-list__status"
|
|
12
|
-
},
|
|
13
|
+
}, be = { class: "yk-infinite-list__status-text" }, Ce = {
|
|
13
14
|
key: 2,
|
|
14
15
|
class: "yk-infinite-list__loading-more"
|
|
15
|
-
},
|
|
16
|
+
}, $e = {
|
|
16
17
|
key: 3,
|
|
17
18
|
class: "yk-infinite-list__no-more"
|
|
18
|
-
},
|
|
19
|
+
}, Fe = /* @__PURE__ */ Y({
|
|
19
20
|
name: "YsInfiniteList",
|
|
20
21
|
__name: "infinite-list",
|
|
21
22
|
props: {
|
|
@@ -46,159 +47,912 @@ import './index.css';const U = ["lower-threshold"], W = { class: "yk-infinite-li
|
|
|
46
47
|
showCheckbox: { type: Boolean, default: !1 }
|
|
47
48
|
},
|
|
48
49
|
emits: ["data-loaded", "error", "selection-change"],
|
|
49
|
-
setup(
|
|
50
|
-
const
|
|
51
|
-
function
|
|
52
|
-
return
|
|
50
|
+
setup(e, { expose: a, emit: n }) {
|
|
51
|
+
const t = e, c = n, f = w([]), i = w(!1), l = w(!1), r = w(!0), u = w(null), h = w(0), x = B(() => f.value.length), m = w(/* @__PURE__ */ new Map()), $ = B(() => [...m.value.values()]);
|
|
52
|
+
function S(g) {
|
|
53
|
+
return m.value.has(String(g[t.rowKey]));
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
function I(g, k) {
|
|
56
|
+
const p = String(g[t.rowKey]), R = new Map(m.value), E = R.has(p), N = k ?? !E;
|
|
57
|
+
N && !E ? R.set(p, g) : !N && E && R.delete(p), m.value = R;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
59
|
+
function o() {
|
|
60
|
+
m.value = /* @__PURE__ */ new Map();
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
for (const
|
|
64
|
-
|
|
62
|
+
function y() {
|
|
63
|
+
const g = new Map(m.value);
|
|
64
|
+
for (const k of f.value) g.set(String(k[t.rowKey]), k);
|
|
65
|
+
m.value = g;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
for (const
|
|
69
|
-
const
|
|
70
|
-
|
|
67
|
+
function _() {
|
|
68
|
+
const g = new Map(m.value);
|
|
69
|
+
for (const k of f.value) {
|
|
70
|
+
const p = String(k[t.rowKey]);
|
|
71
|
+
g.has(p) ? g.delete(p) : g.set(p, k);
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
m.value = g;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
-
async function
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
|
|
75
|
+
X($, (g) => c("selection-change", [...g]));
|
|
76
|
+
async function P(g) {
|
|
77
|
+
if (g) {
|
|
78
|
+
if (l.value || i.value || !r.value) return;
|
|
79
|
+
l.value = !0;
|
|
79
80
|
} else {
|
|
80
|
-
if (
|
|
81
|
-
|
|
81
|
+
if (i.value) return;
|
|
82
|
+
i.value = !0, u.value = null;
|
|
82
83
|
}
|
|
83
84
|
try {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
} catch (
|
|
87
|
-
|
|
85
|
+
const k = g ? x.value : 0, p = await t.dataFun({ limit: t.pageSize, offset: k });
|
|
86
|
+
g ? f.value.push(...p.items) : f.value = p.items, r.value = p.hasNext ?? !1, p.totalCount != null && (h.value = p.totalCount), c("data-loaded", p, g);
|
|
87
|
+
} catch (k) {
|
|
88
|
+
u.value = k, c("error", k);
|
|
88
89
|
} finally {
|
|
89
|
-
|
|
90
|
+
g ? l.value = !1 : i.value = !1, u.value || ne();
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
93
|
+
function j() {
|
|
94
|
+
P(!0);
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
const
|
|
102
|
-
async function
|
|
103
|
-
if (!
|
|
104
|
-
await
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
96
|
+
function D() {
|
|
97
|
+
r.value = !0, P(!1);
|
|
98
|
+
}
|
|
99
|
+
function le() {
|
|
100
|
+
r.value && !i.value && !l.value && j();
|
|
101
|
+
}
|
|
102
|
+
const U = ae();
|
|
103
|
+
async function ne() {
|
|
104
|
+
if (!r.value || i.value || l.value) return;
|
|
105
|
+
await ie();
|
|
106
|
+
const g = U == null ? void 0 : U.proxy;
|
|
107
|
+
g && await new Promise((k) => {
|
|
108
|
+
ye().in(g).select(".yk-infinite-list").boundingClientRect().select(".yk-infinite-list__content").boundingClientRect().exec((p) => {
|
|
109
|
+
const R = p ?? [], E = R[0], N = R[1];
|
|
110
|
+
E && N && N.height <= E.height + 1 && j(), k();
|
|
110
111
|
});
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
}),
|
|
114
|
+
return G(() => {
|
|
115
|
+
t.immediate && P(!1);
|
|
116
|
+
}), X(() => t.dataFun, () => D()), a({
|
|
116
117
|
/** 当前已加载的全部数据 */
|
|
117
|
-
items:
|
|
118
|
+
items: f,
|
|
118
119
|
/** 首屏加载态 */
|
|
119
|
-
loading:
|
|
120
|
+
loading: i,
|
|
120
121
|
/** 追加加载态 */
|
|
121
|
-
loadingMore:
|
|
122
|
+
loadingMore: l,
|
|
122
123
|
/** 是否还有下一页 */
|
|
123
|
-
hasMore:
|
|
124
|
+
hasMore: r,
|
|
124
125
|
/** 重置并从第一页重新加载 */
|
|
125
|
-
reload:
|
|
126
|
+
reload: D,
|
|
126
127
|
/** 刷新:重置为第一页重新加载(与 YsTable 的 refresh 同名同义) */
|
|
127
|
-
refresh:
|
|
128
|
+
refresh: D,
|
|
128
129
|
/** 手动触发加载下一页(一般由触底自动触发) */
|
|
129
|
-
loadNextPage:
|
|
130
|
+
loadNextPage: j,
|
|
130
131
|
/** rows 别名:当前已加载的全部数据(与 YsTable 的 rows 同名) */
|
|
131
|
-
rows:
|
|
132
|
+
rows: f,
|
|
132
133
|
/** 跨页累计选中的行(showCheckbox 开启时有意义) */
|
|
133
|
-
selectedRows:
|
|
134
|
+
selectedRows: $,
|
|
134
135
|
/** 某行当前是否选中 */
|
|
135
|
-
isRowSelected:
|
|
136
|
+
isRowSelected: S,
|
|
136
137
|
/** 切换某行选中态(selected 缺省时取反) */
|
|
137
|
-
toggleRowSelection:
|
|
138
|
+
toggleRowSelection: I,
|
|
138
139
|
/** 清空全部选中 */
|
|
139
|
-
clearSelection:
|
|
140
|
+
clearSelection: o,
|
|
140
141
|
/** 选中当前已加载的全部行 */
|
|
141
|
-
selectAllOnPage:
|
|
142
|
+
selectAllOnPage: y,
|
|
142
143
|
/** 反选当前已加载的行 */
|
|
143
|
-
invertSelectionOnPage:
|
|
144
|
-
}), (
|
|
144
|
+
invertSelectionOnPage: _
|
|
145
|
+
}), (g, k) => (d(), v("scroll-view", {
|
|
145
146
|
class: "yk-infinite-list",
|
|
146
|
-
style:
|
|
147
|
+
style: z({ height: e.height }),
|
|
147
148
|
"scroll-y": "",
|
|
148
|
-
"lower-threshold":
|
|
149
|
-
onScrolltolower:
|
|
149
|
+
"lower-threshold": e.threshold,
|
|
150
|
+
onScrolltolower: le
|
|
150
151
|
}, [
|
|
151
|
-
|
|
152
|
-
(
|
|
153
|
-
key: String(
|
|
154
|
-
class:
|
|
152
|
+
s("view", ge, [
|
|
153
|
+
(d(!0), v(L, null, H(f.value, (p, R) => (d(), v("view", {
|
|
154
|
+
key: String(p[e.rowKey]),
|
|
155
|
+
class: T(["yk-infinite-list__item", { "is-selected": e.showCheckbox && S(p) }])
|
|
155
156
|
}, [
|
|
156
|
-
|
|
157
|
+
e.showCheckbox ? (d(), v("view", {
|
|
157
158
|
key: 0,
|
|
158
|
-
class:
|
|
159
|
-
onTap: (
|
|
159
|
+
class: T(["yk-infinite-list__item-checkbox", { "is-checked": S(p) }]),
|
|
160
|
+
onTap: (E) => I(p)
|
|
160
161
|
}, [
|
|
161
|
-
|
|
162
|
-
], 42,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
row:
|
|
166
|
-
index:
|
|
162
|
+
S(p) ? (d(), v("text", ke, "✓")) : b("", !0)
|
|
163
|
+
], 42, pe)) : b("", !0),
|
|
164
|
+
s("view", _e, [
|
|
165
|
+
V(g.$slots, "default", {
|
|
166
|
+
row: p,
|
|
167
|
+
index: R
|
|
167
168
|
}, () => [
|
|
168
|
-
|
|
169
|
+
s("text", xe, C(JSON.stringify(p)), 1)
|
|
169
170
|
])
|
|
170
171
|
])
|
|
171
172
|
], 2))), 128)),
|
|
172
|
-
!
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
!i.value && f.value.length === 0 && !u.value ? (d(), v("view", Se, [
|
|
174
|
+
V(g.$slots, "empty", {}, () => [
|
|
175
|
+
k[0] || (k[0] = s("text", { class: "yk-infinite-list__status-text" }, "暂无数据", -1))
|
|
175
176
|
])
|
|
176
|
-
])) :
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
])) : u.value ? (d(), v("view", we, [
|
|
178
|
+
V(g.$slots, "error", { error: u.value }, () => [
|
|
179
|
+
s("text", be, "加载失败:" + C(String(u.value)), 1),
|
|
180
|
+
s("button", {
|
|
180
181
|
class: "yk-infinite-list__retry",
|
|
181
182
|
size: "mini",
|
|
182
|
-
onTap:
|
|
183
|
+
onTap: D
|
|
183
184
|
}, "重试", 32)
|
|
184
185
|
])
|
|
185
|
-
])) :
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
])) : b("", !0),
|
|
187
|
+
l.value ? (d(), v("view", Ce, [
|
|
188
|
+
V(g.$slots, "loading", {}, () => [
|
|
189
|
+
k[1] || (k[1] = s("view", { class: "yk-infinite-list__spinner" }, null, -1)),
|
|
190
|
+
k[2] || (k[2] = s("text", null, "加载中...", -1))
|
|
190
191
|
])
|
|
191
|
-
])) :
|
|
192
|
-
!
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
])) : b("", !0),
|
|
193
|
+
!r.value && f.value.length > 0 && !i.value ? (d(), v("view", $e, [
|
|
194
|
+
V(g.$slots, "no-more", {}, () => [
|
|
195
|
+
k[3] || (k[3] = s("text", null, "— 没有更多了 —", -1))
|
|
195
196
|
])
|
|
196
|
-
])) :
|
|
197
|
+
])) : b("", !0)
|
|
198
|
+
])
|
|
199
|
+
], 44, he));
|
|
200
|
+
}
|
|
201
|
+
}), te = Symbol("YsFilterPanel");
|
|
202
|
+
function Be(e) {
|
|
203
|
+
const a = re(te, null);
|
|
204
|
+
if (!a) return;
|
|
205
|
+
let n = null;
|
|
206
|
+
G(() => {
|
|
207
|
+
n = a(e);
|
|
208
|
+
}), se(() => {
|
|
209
|
+
n == null || n(), n = null;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const Ie = { class: "yk-filter-panel__bar" }, Ve = { class: "yk-filter-panel__trigger-text" }, Te = { class: "yk-filter-panel__arrow" }, Pe = { class: "yk-filter-panel__field" }, Re = ["value", "placeholder"], Ye = { class: "yk-filter-panel__actions" }, Ee = {
|
|
213
|
+
key: 0,
|
|
214
|
+
class: "yk-filter-panel__conditions"
|
|
215
|
+
}, qe = /* @__PURE__ */ Y({
|
|
216
|
+
name: "YsFilterPanel",
|
|
217
|
+
__name: "filter-panel",
|
|
218
|
+
props: {
|
|
219
|
+
/** 文本搜索框的值(v-model) */
|
|
220
|
+
modelValue: { type: String, default: "" },
|
|
221
|
+
/** 文本搜索框占位文案 */
|
|
222
|
+
placeholder: { type: String, default: "请输入" },
|
|
223
|
+
/** 展开/折叠触发器文案,默认「筛选」 */
|
|
224
|
+
filterText: { type: String, default: "筛选" },
|
|
225
|
+
/** 查询按钮文案,默认「查询」 */
|
|
226
|
+
searchButtonText: { type: String, default: "查询" },
|
|
227
|
+
/** 重置按钮文案,默认「重置」 */
|
|
228
|
+
resetButtonText: { type: String, default: "重置" },
|
|
229
|
+
/** 条件区初始是否展开,默认 false(「筛选」按钮默认折叠) */
|
|
230
|
+
defaultExpanded: { type: Boolean, default: !1 },
|
|
231
|
+
/** 是否渲染「查询」按钮,默认 true */
|
|
232
|
+
showSearch: { type: Boolean, default: !0 },
|
|
233
|
+
/** 是否渲染「重置」按钮,默认 true */
|
|
234
|
+
showReset: { type: Boolean, default: !0 },
|
|
235
|
+
/**
|
|
236
|
+
* 文本搜索条件构造委托:入参是输入框当前值(已 trim),返回本次搜索应产出的 FilterInfo。
|
|
237
|
+
* 返回 null / undefined 表示本次搜索不参与聚合(等价于输入为空)。
|
|
238
|
+
*
|
|
239
|
+
* 适用场景:
|
|
240
|
+
* - 最简单的单属性 contains:kw => filter('name', Operator.Contains, con(kw))
|
|
241
|
+
* - 一个输入框映射多个属性(OR):
|
|
242
|
+
* kw => FilterInfo.createOr(
|
|
243
|
+
* filter('name', Operator.Contains, con(kw)),
|
|
244
|
+
* filter('code', Operator.Contains, con(kw))
|
|
245
|
+
* )
|
|
246
|
+
*
|
|
247
|
+
* 未传委托时,文本搜索框仅作为 UI 占位,不会产生 FilterInfo(插槽里的自定义搜索项不受影响)。
|
|
248
|
+
*/
|
|
249
|
+
textFilterBuilder: {
|
|
250
|
+
type: Function,
|
|
251
|
+
default: void 0
|
|
252
|
+
},
|
|
253
|
+
/** 外部自定义样式:追加到根节点上的类名(覆盖内部样式的入口) */
|
|
254
|
+
customClass: { type: String, default: "" },
|
|
255
|
+
/** 外部自定义样式:追加到根节点上的内联样式字符串 */
|
|
256
|
+
customStyle: { type: String, default: "" }
|
|
257
|
+
},
|
|
258
|
+
emits: ["update:modelValue", "search", "reset", "expand-change"],
|
|
259
|
+
setup(e, { expose: a, emit: n }) {
|
|
260
|
+
const t = e, c = n, f = ue(), i = B(() => !!f.default), l = w(t.defaultExpanded), r = oe([]);
|
|
261
|
+
function u(o) {
|
|
262
|
+
return r.value = [...r.value, o], () => {
|
|
263
|
+
r.value = r.value.filter((y) => y !== o);
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
ce(te, u);
|
|
267
|
+
const h = B(() => {
|
|
268
|
+
var _;
|
|
269
|
+
const o = ((_ = t.modelValue) == null ? void 0 : _.trim()) ?? "";
|
|
270
|
+
return !o || !t.textFilterBuilder ? null : t.textFilterBuilder(o) ?? null;
|
|
271
|
+
}), x = B(() => {
|
|
272
|
+
const o = [];
|
|
273
|
+
h.value && o.push(h.value);
|
|
274
|
+
for (const y of r.value) {
|
|
275
|
+
const _ = y.filter;
|
|
276
|
+
_ && o.push(_);
|
|
277
|
+
}
|
|
278
|
+
return o.length === 0 ? me() : o.length === 1 ? o[0] : ve.createAnd(...o);
|
|
279
|
+
});
|
|
280
|
+
function m() {
|
|
281
|
+
l.value = !l.value, c("expand-change", l.value);
|
|
282
|
+
}
|
|
283
|
+
function $(o) {
|
|
284
|
+
const y = o.detail;
|
|
285
|
+
c("update:modelValue", (y == null ? void 0 : y.value) ?? "");
|
|
286
|
+
}
|
|
287
|
+
function S() {
|
|
288
|
+
c("search", x.value);
|
|
289
|
+
}
|
|
290
|
+
function I() {
|
|
291
|
+
c("update:modelValue", "");
|
|
292
|
+
for (const o of r.value) o.reset();
|
|
293
|
+
c("reset");
|
|
294
|
+
}
|
|
295
|
+
return a({
|
|
296
|
+
/** 条件区是否展开 */
|
|
297
|
+
expanded: l,
|
|
298
|
+
/** 当前聚合后的查询条件 */
|
|
299
|
+
filter: x,
|
|
300
|
+
/** 切换条件区展开/折叠 */
|
|
301
|
+
toggle: m,
|
|
302
|
+
/** 重置(清空文本 + 重置已注册子项 + 派发 reset) */
|
|
303
|
+
reset: I
|
|
304
|
+
}), (o, y) => (d(), v("view", {
|
|
305
|
+
class: T(["yk-filter-panel", e.customClass]),
|
|
306
|
+
style: z(e.customStyle)
|
|
307
|
+
}, [
|
|
308
|
+
s("view", Ie, [
|
|
309
|
+
i.value ? (d(), v("view", {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: "yk-filter-panel__trigger",
|
|
312
|
+
onTap: m
|
|
313
|
+
}, [
|
|
314
|
+
s("text", Ve, C(e.filterText), 1),
|
|
315
|
+
s("text", Te, C(l.value ? "▲" : "▼"), 1)
|
|
316
|
+
], 32)) : b("", !0),
|
|
317
|
+
s("view", Pe, [
|
|
318
|
+
s("input", {
|
|
319
|
+
class: "yk-filter-panel__input",
|
|
320
|
+
value: e.modelValue,
|
|
321
|
+
placeholder: e.placeholder,
|
|
322
|
+
"placeholder-class": "yk-filter-panel__placeholder",
|
|
323
|
+
onInput: $,
|
|
324
|
+
onConfirm: S
|
|
325
|
+
}, null, 40, Re)
|
|
326
|
+
]),
|
|
327
|
+
s("view", Ye, [
|
|
328
|
+
e.showSearch ? (d(), v("view", {
|
|
329
|
+
key: 0,
|
|
330
|
+
class: "yk-filter-panel__btn yk-filter-panel__btn--primary",
|
|
331
|
+
onTap: S
|
|
332
|
+
}, [
|
|
333
|
+
s("text", null, C(e.searchButtonText), 1)
|
|
334
|
+
], 32)) : b("", !0),
|
|
335
|
+
e.showReset ? (d(), v("view", {
|
|
336
|
+
key: 1,
|
|
337
|
+
class: "yk-filter-panel__btn yk-filter-panel__btn--default",
|
|
338
|
+
onTap: I
|
|
339
|
+
}, [
|
|
340
|
+
s("text", null, C(e.resetButtonText), 1)
|
|
341
|
+
], 32)) : b("", !0)
|
|
342
|
+
])
|
|
343
|
+
]),
|
|
344
|
+
i.value ? fe((d(), v("view", Ee, [
|
|
345
|
+
V(o.$slots, "default")
|
|
346
|
+
], 512)), [
|
|
347
|
+
[de, l.value]
|
|
348
|
+
]) : b("", !0)
|
|
349
|
+
], 6));
|
|
350
|
+
}
|
|
351
|
+
}), Ae = { class: "yk-filter-item" }, Me = {
|
|
352
|
+
key: 0,
|
|
353
|
+
class: "yk-filter-item__label"
|
|
354
|
+
}, Ne = { class: "yk-filter-item__control" }, O = /* @__PURE__ */ Y({
|
|
355
|
+
name: "YsFilterItemLayout",
|
|
356
|
+
__name: "filter-item-layout",
|
|
357
|
+
props: {
|
|
358
|
+
/** 控件上方的标签文本;空串时不渲染 */
|
|
359
|
+
label: { type: String, default: "" },
|
|
360
|
+
/** FilterItem 的 API 对象,由 layout 注册到最近的 YsFilterPanel */
|
|
361
|
+
api: { type: Object, required: !0 }
|
|
362
|
+
},
|
|
363
|
+
setup(e) {
|
|
364
|
+
return Be(e.api), (n, t) => (d(), v("view", Ae, [
|
|
365
|
+
e.label ? (d(), v("text", Me, C(e.label), 1)) : b("", !0),
|
|
366
|
+
s("view", Ne, [
|
|
367
|
+
V(n.$slots, "default")
|
|
197
368
|
])
|
|
198
|
-
]
|
|
369
|
+
]));
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
function De(e) {
|
|
373
|
+
const a = w(
|
|
374
|
+
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
375
|
+
);
|
|
376
|
+
function n(f) {
|
|
377
|
+
return f == null || f.trim() === "";
|
|
378
|
+
}
|
|
379
|
+
const t = B(() => n(a.value) ? null : A(e.propertyPath, e.op, M(a.value)));
|
|
380
|
+
function c() {
|
|
381
|
+
a.value = typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
382
|
+
}
|
|
383
|
+
return { value: a, filter: t, reset: c };
|
|
384
|
+
}
|
|
385
|
+
function Le(e) {
|
|
386
|
+
const a = w(
|
|
387
|
+
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
388
|
+
);
|
|
389
|
+
function n(f) {
|
|
390
|
+
return f == null || f.trim() === "";
|
|
391
|
+
}
|
|
392
|
+
const t = B(() => n(a.value) ? null : A(e.propertyPath, e.op, M(a.value)));
|
|
393
|
+
function c() {
|
|
394
|
+
a.value = typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
395
|
+
}
|
|
396
|
+
return { value: a, filter: t, reset: c };
|
|
397
|
+
}
|
|
398
|
+
function ze(e) {
|
|
399
|
+
function a(l) {
|
|
400
|
+
return l && l.length === 2 && typeof l[0] == "string" && typeof l[1] == "string" ? [l[0], l[1]] : null;
|
|
401
|
+
}
|
|
402
|
+
const n = a(e.defaultValue), t = w(n);
|
|
403
|
+
function c(l) {
|
|
404
|
+
return l == null || l.length !== 2 || !l[0] || !l[1];
|
|
405
|
+
}
|
|
406
|
+
const f = B(() => {
|
|
407
|
+
if (c(t.value)) return null;
|
|
408
|
+
const [l, r] = t.value;
|
|
409
|
+
return A(e.propertyPath, Q.Between, M([l, r]));
|
|
410
|
+
});
|
|
411
|
+
function i() {
|
|
412
|
+
t.value = n;
|
|
413
|
+
}
|
|
414
|
+
return { value: t, filter: f, reset: i };
|
|
415
|
+
}
|
|
416
|
+
function Z(e) {
|
|
417
|
+
return typeof e == "string" || typeof e == "number" ? e : null;
|
|
418
|
+
}
|
|
419
|
+
function ee(e) {
|
|
420
|
+
return Array.isArray(e) ? e.filter(
|
|
421
|
+
(a) => typeof a == "string" || typeof a == "number"
|
|
422
|
+
) : [];
|
|
423
|
+
}
|
|
424
|
+
function Ke(e) {
|
|
425
|
+
const a = e.multiple === !0, n = w(
|
|
426
|
+
a ? ee(e.defaultValue) : Z(e.defaultValue)
|
|
427
|
+
);
|
|
428
|
+
function t() {
|
|
429
|
+
const i = n.value;
|
|
430
|
+
return a ? !Array.isArray(i) || i.length === 0 : i == null || typeof i == "string" && i.trim() === "";
|
|
431
|
+
}
|
|
432
|
+
const c = B(() => {
|
|
433
|
+
if (t()) return null;
|
|
434
|
+
if (a) {
|
|
435
|
+
const l = n.value;
|
|
436
|
+
if (l.length === 1) {
|
|
437
|
+
const r = l[0];
|
|
438
|
+
return r == null ? null : A(e.propertyPath, Q.Equals, M(r));
|
|
439
|
+
}
|
|
440
|
+
return A(
|
|
441
|
+
e.propertyPath,
|
|
442
|
+
Q.In,
|
|
443
|
+
M(l)
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
const i = n.value;
|
|
447
|
+
return i == null ? null : A(e.propertyPath, e.op, M(i));
|
|
448
|
+
});
|
|
449
|
+
function f() {
|
|
450
|
+
n.value = a ? ee(e.defaultValue) : Z(e.defaultValue);
|
|
451
|
+
}
|
|
452
|
+
return { value: n, filter: c, reset: f };
|
|
453
|
+
}
|
|
454
|
+
const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt = /* @__PURE__ */ Y({
|
|
455
|
+
name: "YsTextFilterItem",
|
|
456
|
+
__name: "text-filter-item",
|
|
457
|
+
props: {
|
|
458
|
+
/** 控件上方的标签 */
|
|
459
|
+
label: { type: String, default: "" },
|
|
460
|
+
/** 运算符(字符串 enum 跨包用 String as PropType<Operator>) */
|
|
461
|
+
op: { type: String, required: !0 },
|
|
462
|
+
/** 实体属性路径(FilterInfo.left),如 "name" / "user.name" */
|
|
463
|
+
propertyPath: { type: String, required: !0 },
|
|
464
|
+
/** 初始值;缺省为空字符串 */
|
|
465
|
+
defaultValue: {
|
|
466
|
+
type: String,
|
|
467
|
+
default: void 0
|
|
468
|
+
},
|
|
469
|
+
/** 占位文本 */
|
|
470
|
+
placeholder: { type: String, default: "请输入" }
|
|
471
|
+
},
|
|
472
|
+
setup(e, { expose: a }) {
|
|
473
|
+
const n = e, { value: t, filter: c, reset: f } = De(n);
|
|
474
|
+
function i(r) {
|
|
475
|
+
const u = r.detail;
|
|
476
|
+
t.value = (u == null ? void 0 : u.value) ?? "";
|
|
477
|
+
}
|
|
478
|
+
const l = {
|
|
479
|
+
get filter() {
|
|
480
|
+
return c.value;
|
|
481
|
+
},
|
|
482
|
+
reset: f
|
|
483
|
+
};
|
|
484
|
+
return a(l), (r, u) => (d(), K(O, {
|
|
485
|
+
label: e.label,
|
|
486
|
+
api: l
|
|
487
|
+
}, {
|
|
488
|
+
default: q(() => [
|
|
489
|
+
s("view", Oe, [
|
|
490
|
+
s("input", {
|
|
491
|
+
class: "yk-filter-item__input",
|
|
492
|
+
value: F(t),
|
|
493
|
+
placeholder: e.placeholder,
|
|
494
|
+
"placeholder-class": "yk-filter-item__placeholder",
|
|
495
|
+
onInput: i
|
|
496
|
+
}, null, 40, je)
|
|
497
|
+
])
|
|
498
|
+
]),
|
|
499
|
+
_: 1
|
|
500
|
+
}, 8, ["label"]));
|
|
501
|
+
}
|
|
502
|
+
}), Ue = ["value", "start", "end"], Je = { class: "yk-filter-item__picker" }, mt = /* @__PURE__ */ Y({
|
|
503
|
+
name: "YsDateFilterItem",
|
|
504
|
+
__name: "date-filter-item",
|
|
505
|
+
props: {
|
|
506
|
+
/** 控件上方的标签 */
|
|
507
|
+
label: { type: String, default: "" },
|
|
508
|
+
/** 运算符(字符串 enum 跨包用 String as PropType<Operator>) */
|
|
509
|
+
op: { type: String, required: !0 },
|
|
510
|
+
/** 实体属性路径(FilterInfo.left),如 "birthDate" / "user.createdAt" */
|
|
511
|
+
propertyPath: { type: String, required: !0 },
|
|
512
|
+
/** 初始值;YYYY-MM-DD 格式字符串 */
|
|
513
|
+
defaultValue: {
|
|
514
|
+
type: String,
|
|
515
|
+
default: void 0
|
|
516
|
+
},
|
|
517
|
+
/** 占位文本 */
|
|
518
|
+
placeholder: { type: String, default: "选择日期" },
|
|
519
|
+
/** 可选范围下限(YYYY-MM-DD),空串表示不限制 */
|
|
520
|
+
start: { type: String, default: "" },
|
|
521
|
+
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
522
|
+
end: { type: String, default: "" }
|
|
523
|
+
},
|
|
524
|
+
setup(e, { expose: a }) {
|
|
525
|
+
const n = e, { value: t, filter: c, reset: f } = Le(n);
|
|
526
|
+
function i(u) {
|
|
527
|
+
const h = u.detail;
|
|
528
|
+
t.value = (h == null ? void 0 : h.value) ?? "";
|
|
529
|
+
}
|
|
530
|
+
function l() {
|
|
531
|
+
t.value = "";
|
|
532
|
+
}
|
|
533
|
+
const r = {
|
|
534
|
+
get filter() {
|
|
535
|
+
return c.value;
|
|
536
|
+
},
|
|
537
|
+
reset: f
|
|
538
|
+
};
|
|
539
|
+
return a(r), (u, h) => (d(), K(O, {
|
|
540
|
+
label: e.label,
|
|
541
|
+
api: r
|
|
542
|
+
}, {
|
|
543
|
+
default: q(() => [
|
|
544
|
+
s("picker", {
|
|
545
|
+
class: "yk-filter-item__picker-trigger",
|
|
546
|
+
mode: "date",
|
|
547
|
+
value: F(t),
|
|
548
|
+
start: e.start,
|
|
549
|
+
end: e.end,
|
|
550
|
+
onChange: i
|
|
551
|
+
}, [
|
|
552
|
+
s("view", Je, [
|
|
553
|
+
s("text", {
|
|
554
|
+
class: T(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !F(t) }])
|
|
555
|
+
}, C(F(t) || e.placeholder), 3)
|
|
556
|
+
])
|
|
557
|
+
], 40, Ue),
|
|
558
|
+
F(t) ? (d(), v("view", {
|
|
559
|
+
key: 0,
|
|
560
|
+
class: "yk-filter-item__clear",
|
|
561
|
+
onTap: W(l, ["stop"])
|
|
562
|
+
}, [...h[0] || (h[0] = [
|
|
563
|
+
s("text", null, "✕", -1)
|
|
564
|
+
])], 32)) : b("", !0)
|
|
565
|
+
]),
|
|
566
|
+
_: 1
|
|
567
|
+
}, 8, ["label"]));
|
|
568
|
+
}
|
|
569
|
+
}), Qe = ["value", "start", "end"], Ge = { class: "yk-filter-item__picker" }, He = ["value", "start", "end"], We = { class: "yk-filter-item__picker" }, vt = /* @__PURE__ */ Y({
|
|
570
|
+
name: "YsDateRangeFilterItem",
|
|
571
|
+
__name: "date-range-filter-item",
|
|
572
|
+
props: {
|
|
573
|
+
/** 控件上方的标签 */
|
|
574
|
+
label: { type: String, default: "" },
|
|
575
|
+
/** 实体属性路径(FilterInfo.left),如 "createdAt" / "user.registeredAt" */
|
|
576
|
+
propertyPath: { type: String, required: !0 },
|
|
577
|
+
/** 初始值;[start, end] 字符串数组 */
|
|
578
|
+
defaultValue: {
|
|
579
|
+
type: Array,
|
|
580
|
+
default: void 0
|
|
581
|
+
},
|
|
582
|
+
/** 起始日期占位文本 */
|
|
583
|
+
startPlaceholder: { type: String, default: "开始日期" },
|
|
584
|
+
/** 结束日期占位文本 */
|
|
585
|
+
endPlaceholder: { type: String, default: "结束日期" },
|
|
586
|
+
/** 可选范围下限(YYYY-MM-DD),空串表示不限制 */
|
|
587
|
+
start: { type: String, default: "" },
|
|
588
|
+
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
589
|
+
end: { type: String, default: "" }
|
|
590
|
+
},
|
|
591
|
+
setup(e, { expose: a }) {
|
|
592
|
+
const n = e, { value: t, filter: c, reset: f } = ze(n);
|
|
593
|
+
function i(x, m) {
|
|
594
|
+
const $ = t.value ?? ["", ""], S = [$[0], $[1]];
|
|
595
|
+
S[x] = m, t.value = !S[0] && !S[1] ? null : S;
|
|
596
|
+
}
|
|
597
|
+
function l(x) {
|
|
598
|
+
const m = x.detail;
|
|
599
|
+
i(0, (m == null ? void 0 : m.value) ?? "");
|
|
600
|
+
}
|
|
601
|
+
function r(x) {
|
|
602
|
+
const m = x.detail;
|
|
603
|
+
i(1, (m == null ? void 0 : m.value) ?? "");
|
|
604
|
+
}
|
|
605
|
+
function u() {
|
|
606
|
+
t.value = null;
|
|
607
|
+
}
|
|
608
|
+
const h = {
|
|
609
|
+
get filter() {
|
|
610
|
+
return c.value;
|
|
611
|
+
},
|
|
612
|
+
reset: f
|
|
613
|
+
};
|
|
614
|
+
return a(h), (x, m) => (d(), K(O, {
|
|
615
|
+
label: e.label,
|
|
616
|
+
api: h
|
|
617
|
+
}, {
|
|
618
|
+
default: q(() => {
|
|
619
|
+
var $, S, I, o, y, _;
|
|
620
|
+
return [
|
|
621
|
+
s("picker", {
|
|
622
|
+
class: "yk-filter-item__picker-trigger",
|
|
623
|
+
mode: "date",
|
|
624
|
+
value: (($ = F(t)) == null ? void 0 : $[0]) ?? "",
|
|
625
|
+
start: e.start,
|
|
626
|
+
end: e.end,
|
|
627
|
+
onChange: l
|
|
628
|
+
}, [
|
|
629
|
+
s("view", Ge, [
|
|
630
|
+
s("text", {
|
|
631
|
+
class: T(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !((S = F(t)) != null && S[0]) }])
|
|
632
|
+
}, C(((I = F(t)) == null ? void 0 : I[0]) || e.startPlaceholder), 3)
|
|
633
|
+
])
|
|
634
|
+
], 40, Qe),
|
|
635
|
+
m[1] || (m[1] = s("text", { class: "yk-filter-item__sep" }, "至", -1)),
|
|
636
|
+
s("picker", {
|
|
637
|
+
class: "yk-filter-item__picker-trigger",
|
|
638
|
+
mode: "date",
|
|
639
|
+
value: ((o = F(t)) == null ? void 0 : o[1]) ?? "",
|
|
640
|
+
start: e.start,
|
|
641
|
+
end: e.end,
|
|
642
|
+
onChange: r
|
|
643
|
+
}, [
|
|
644
|
+
s("view", We, [
|
|
645
|
+
s("text", {
|
|
646
|
+
class: T(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !((y = F(t)) != null && y[1]) }])
|
|
647
|
+
}, C(((_ = F(t)) == null ? void 0 : _[1]) || e.endPlaceholder), 3)
|
|
648
|
+
])
|
|
649
|
+
], 40, He),
|
|
650
|
+
F(t) ? (d(), v("view", {
|
|
651
|
+
key: 0,
|
|
652
|
+
class: "yk-filter-item__clear",
|
|
653
|
+
onTap: W(u, ["stop"])
|
|
654
|
+
}, [...m[0] || (m[0] = [
|
|
655
|
+
s("text", null, "✕", -1)
|
|
656
|
+
])], 32)) : b("", !0)
|
|
657
|
+
];
|
|
658
|
+
}),
|
|
659
|
+
_: 1
|
|
660
|
+
}, 8, ["label"]));
|
|
661
|
+
}
|
|
662
|
+
}), Xe = {
|
|
663
|
+
key: 0,
|
|
664
|
+
class: "yk-filter-item__chips"
|
|
665
|
+
}, Ze = {
|
|
666
|
+
key: 0,
|
|
667
|
+
class: "yk-filter-item__chips-empty"
|
|
668
|
+
}, et = ["onTap"], tt = ["range", "value"], lt = { class: "yk-filter-item__picker" }, ht = /* @__PURE__ */ Y({
|
|
669
|
+
name: "YsEnumFilterItem",
|
|
670
|
+
__name: "enum-filter-item",
|
|
671
|
+
props: {
|
|
672
|
+
/** 控件上方的标签 */
|
|
673
|
+
label: { type: String, default: "" },
|
|
674
|
+
/** 运算符;仅单选模式使用(多选模式按 1 项→Equals、2+ 项→In 自动派生) */
|
|
675
|
+
op: { type: String, required: !0 },
|
|
676
|
+
/** 实体属性路径(FilterInfo.left),如 "status" / "user.roleId" */
|
|
677
|
+
propertyPath: { type: String, required: !0 },
|
|
678
|
+
/** 初始值;单选为 string | number | null,多选为 (string | number)[] */
|
|
679
|
+
defaultValue: {
|
|
680
|
+
type: [String, Number, Array],
|
|
681
|
+
default: void 0
|
|
682
|
+
},
|
|
683
|
+
/** 占位文本 */
|
|
684
|
+
placeholder: { type: String, default: "请选择" },
|
|
685
|
+
/** 选项数据源,返回 { label, value } 数组 */
|
|
686
|
+
optionsSource: { type: Function, required: !0 },
|
|
687
|
+
/** 是否多选;多选时用标签式选项渲染 */
|
|
688
|
+
multiple: { type: Boolean, default: !1 },
|
|
689
|
+
/** 单选模式是否显示清除按钮 */
|
|
690
|
+
clearable: { type: Boolean, default: !0 }
|
|
691
|
+
},
|
|
692
|
+
setup(e, { expose: a }) {
|
|
693
|
+
const n = e, { value: t, filter: c, reset: f } = Ke(n), i = w([]), l = w(!1);
|
|
694
|
+
G(async () => {
|
|
695
|
+
l.value = !0;
|
|
696
|
+
try {
|
|
697
|
+
i.value = await n.optionsSource();
|
|
698
|
+
} finally {
|
|
699
|
+
l.value = !1;
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
const r = B(() => {
|
|
703
|
+
const o = Array.isArray(t.value) ? null : t.value;
|
|
704
|
+
return o == null ? -1 : i.value.findIndex((y) => String(y.value) === String(o));
|
|
705
|
+
}), u = B(() => {
|
|
706
|
+
var y;
|
|
707
|
+
const o = r.value;
|
|
708
|
+
return o >= 0 ? ((y = i.value[o]) == null ? void 0 : y.label) ?? "" : "";
|
|
709
|
+
});
|
|
710
|
+
function h(o) {
|
|
711
|
+
const y = o.detail, _ = Number((y == null ? void 0 : y.value) ?? -1), P = i.value[_];
|
|
712
|
+
P && (t.value = P.value);
|
|
713
|
+
}
|
|
714
|
+
function x() {
|
|
715
|
+
t.value = null;
|
|
716
|
+
}
|
|
717
|
+
const m = B(
|
|
718
|
+
() => Array.isArray(t.value) ? t.value : []
|
|
719
|
+
);
|
|
720
|
+
function $(o) {
|
|
721
|
+
return m.value.some((y) => String(y) === String(o.value));
|
|
722
|
+
}
|
|
723
|
+
function S(o) {
|
|
724
|
+
const y = [...m.value], _ = y.findIndex((P) => String(P) === String(o.value));
|
|
725
|
+
_ >= 0 ? y.splice(_, 1) : y.push(o.value), t.value = y;
|
|
726
|
+
}
|
|
727
|
+
const I = {
|
|
728
|
+
get filter() {
|
|
729
|
+
return c.value;
|
|
730
|
+
},
|
|
731
|
+
reset: f
|
|
732
|
+
};
|
|
733
|
+
return a(I), (o, y) => (d(), K(O, {
|
|
734
|
+
label: e.label,
|
|
735
|
+
api: I
|
|
736
|
+
}, {
|
|
737
|
+
default: q(() => [
|
|
738
|
+
e.multiple ? (d(), v("view", Xe, [
|
|
739
|
+
l.value ? (d(), v("text", Ze, "加载中…")) : (d(!0), v(L, { key: 1 }, H(i.value, (_) => (d(), v("view", {
|
|
740
|
+
key: String(_.value),
|
|
741
|
+
class: T(["yk-filter-item__chip", { "yk-filter-item__chip--active": $(_) }]),
|
|
742
|
+
onTap: (P) => S(_)
|
|
743
|
+
}, [
|
|
744
|
+
s("text", null, C(_.label), 1)
|
|
745
|
+
], 42, et))), 128))
|
|
746
|
+
])) : (d(), v(L, { key: 1 }, [
|
|
747
|
+
s("picker", {
|
|
748
|
+
class: "yk-filter-item__picker-trigger",
|
|
749
|
+
mode: "selector",
|
|
750
|
+
range: i.value,
|
|
751
|
+
"range-key": "label",
|
|
752
|
+
value: r.value < 0 ? 0 : r.value,
|
|
753
|
+
onChange: h
|
|
754
|
+
}, [
|
|
755
|
+
s("view", lt, [
|
|
756
|
+
s("text", {
|
|
757
|
+
class: T(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !u.value }])
|
|
758
|
+
}, C(l.value ? "加载中…" : u.value || e.placeholder), 3)
|
|
759
|
+
])
|
|
760
|
+
], 40, tt),
|
|
761
|
+
e.clearable && u.value ? (d(), v("view", {
|
|
762
|
+
key: 0,
|
|
763
|
+
class: "yk-filter-item__clear",
|
|
764
|
+
onTap: W(x, ["stop"])
|
|
765
|
+
}, [...y[0] || (y[0] = [
|
|
766
|
+
s("text", null, "✕", -1)
|
|
767
|
+
])], 32)) : b("", !0)
|
|
768
|
+
], 64))
|
|
769
|
+
]),
|
|
770
|
+
_: 1
|
|
771
|
+
}, 8, ["label"]));
|
|
772
|
+
}
|
|
773
|
+
}), nt = ["onTap"], at = { class: "yk-command-bar__btn-text" }, it = /* @__PURE__ */ Y({
|
|
774
|
+
name: "YsCommandBar",
|
|
775
|
+
__name: "command-bar",
|
|
776
|
+
props: {
|
|
777
|
+
/** 表级命令列表,每条渲染为一个按钮;空数组时左侧命令区不渲染 */
|
|
778
|
+
actions: {
|
|
779
|
+
type: Array,
|
|
780
|
+
default: () => []
|
|
781
|
+
},
|
|
782
|
+
/** 外部自定义样式:追加到根节点上的类名 */
|
|
783
|
+
customClass: { type: String, default: "" },
|
|
784
|
+
/** 外部自定义样式:追加到根节点上的内联样式字符串 */
|
|
785
|
+
customStyle: { type: String, default: "" }
|
|
786
|
+
},
|
|
787
|
+
setup(e) {
|
|
788
|
+
async function a(n) {
|
|
789
|
+
try {
|
|
790
|
+
await n.execute(void 0);
|
|
791
|
+
} catch (t) {
|
|
792
|
+
console.error("[YsCommandBar] action failed:", n.name, t);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return (n, t) => (d(), v("view", {
|
|
796
|
+
class: T(["yk-command-bar", e.customClass]),
|
|
797
|
+
style: z(e.customStyle)
|
|
798
|
+
}, [
|
|
799
|
+
e.actions.length > 0 ? (d(!0), v(L, { key: 0 }, H(e.actions, (c) => (d(), v("view", {
|
|
800
|
+
key: c.name,
|
|
801
|
+
class: T(["yk-command-bar__btn", [
|
|
802
|
+
c.type ? `yk-command-bar__btn--${c.type}` : "yk-command-bar__btn--default",
|
|
803
|
+
{ "yk-command-bar__btn--plain": c.plain }
|
|
804
|
+
]]),
|
|
805
|
+
onTap: (f) => a(c)
|
|
806
|
+
}, [
|
|
807
|
+
s("text", at, C(c.desc), 1)
|
|
808
|
+
], 42, nt))), 128)) : b("", !0),
|
|
809
|
+
V(n.$slots, "default")
|
|
810
|
+
], 6));
|
|
811
|
+
}
|
|
812
|
+
}), rt = { class: "yk-infinite-page" }, st = {
|
|
813
|
+
key: 0,
|
|
814
|
+
class: "yk-infinite-page__filter"
|
|
815
|
+
}, ut = { class: "yk-infinite-page__list" }, ot = {
|
|
816
|
+
key: 1,
|
|
817
|
+
class: "yk-infinite-page__cmd"
|
|
818
|
+
}, gt = /* @__PURE__ */ Y({
|
|
819
|
+
name: "YsInfinitePage",
|
|
820
|
+
__name: "infinite-page",
|
|
821
|
+
props: {
|
|
822
|
+
/* ---------- FilterPanel ---------- */
|
|
823
|
+
/** 文本搜索框的值(v-model 绑定内部 FilterPanel) */
|
|
824
|
+
modelValue: { type: String, default: "" },
|
|
825
|
+
/** 是否渲染顶部 FilterPanel,默认 true */
|
|
826
|
+
showFilter: { type: Boolean, default: !0 },
|
|
827
|
+
/** 文本搜索条件构造委托(FilterPanel 唯一入口) */
|
|
828
|
+
textFilterBuilder: {
|
|
829
|
+
type: Function,
|
|
830
|
+
default: void 0
|
|
831
|
+
},
|
|
832
|
+
placeholder: { type: String, default: "请输入" },
|
|
833
|
+
filterText: { type: String, default: "筛选" },
|
|
834
|
+
searchButtonText: { type: String, default: "查询" },
|
|
835
|
+
resetButtonText: { type: String, default: "重置" },
|
|
836
|
+
defaultExpanded: { type: Boolean, default: !1 },
|
|
837
|
+
showSearch: { type: Boolean, default: !0 },
|
|
838
|
+
showReset: { type: Boolean, default: !0 },
|
|
839
|
+
filterCustomClass: { type: String, default: "" },
|
|
840
|
+
filterCustomStyle: { type: String, default: "" },
|
|
841
|
+
/* ---------- CommandBar ---------- */
|
|
842
|
+
/** 是否渲染底部 CommandBar,默认 true */
|
|
843
|
+
showCommandBar: { type: Boolean, default: !0 },
|
|
844
|
+
/** 命令按钮数组(透传给 YsCommandBar) */
|
|
845
|
+
actions: { type: Array, default: () => [] },
|
|
846
|
+
cmdCustomClass: { type: String, default: "" },
|
|
847
|
+
cmdCustomStyle: { type: String, default: "" },
|
|
848
|
+
/* ---------- InfiniteList ---------- */
|
|
849
|
+
dataFun: { type: Function, required: !0 },
|
|
850
|
+
pageSize: { type: Number, default: 20 },
|
|
851
|
+
threshold: { type: Number, default: 100 },
|
|
852
|
+
rowKey: { type: String, default: "id" },
|
|
853
|
+
immediate: { type: Boolean, default: !0 },
|
|
854
|
+
showCheckbox: { type: Boolean, default: !1 },
|
|
855
|
+
listCustomClass: { type: String, default: "" },
|
|
856
|
+
listCustomStyle: { type: String, default: "" }
|
|
857
|
+
},
|
|
858
|
+
emits: ["update:modelValue", "search", "reset", "expand-change", "data-loaded", "selection-change", "error"],
|
|
859
|
+
setup(e, { expose: a, emit: n }) {
|
|
860
|
+
const t = n, c = w(null), f = w(null);
|
|
861
|
+
a({
|
|
862
|
+
/** YsInfiniteList 实例(空壳子 CommandBar 没有 list 引用,业务侧通过这个 ref 调 reload / clearSelection 等) */
|
|
863
|
+
get list() {
|
|
864
|
+
return c.value;
|
|
865
|
+
},
|
|
866
|
+
/** YsFilterPanel 实例 */
|
|
867
|
+
get filterPanel() {
|
|
868
|
+
return f.value;
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
function i(r) {
|
|
872
|
+
t("update:modelValue", r);
|
|
873
|
+
}
|
|
874
|
+
function l(r, u) {
|
|
875
|
+
t("data-loaded", r, u);
|
|
876
|
+
}
|
|
877
|
+
return (r, u) => (d(), v("view", rt, [
|
|
878
|
+
e.showFilter ? (d(), v("view", st, [
|
|
879
|
+
J(qe, {
|
|
880
|
+
ref_key: "filterRef",
|
|
881
|
+
ref: f,
|
|
882
|
+
"model-value": e.modelValue,
|
|
883
|
+
placeholder: e.placeholder,
|
|
884
|
+
"filter-text": e.filterText,
|
|
885
|
+
"search-button-text": e.searchButtonText,
|
|
886
|
+
"reset-button-text": e.resetButtonText,
|
|
887
|
+
"default-expanded": e.defaultExpanded,
|
|
888
|
+
"show-search": e.showSearch,
|
|
889
|
+
"show-reset": e.showReset,
|
|
890
|
+
"text-filter-builder": e.textFilterBuilder,
|
|
891
|
+
"custom-class": e.filterCustomClass,
|
|
892
|
+
"custom-style": e.filterCustomStyle,
|
|
893
|
+
"onUpdate:modelValue": i,
|
|
894
|
+
onSearch: u[0] || (u[0] = (h) => t("search", h)),
|
|
895
|
+
onReset: u[1] || (u[1] = (h) => t("reset")),
|
|
896
|
+
onExpandChange: u[2] || (u[2] = (h) => t("expand-change", h))
|
|
897
|
+
}, {
|
|
898
|
+
default: q(() => [
|
|
899
|
+
V(r.$slots, "filter-default")
|
|
900
|
+
]),
|
|
901
|
+
_: 3
|
|
902
|
+
}, 8, ["model-value", "placeholder", "filter-text", "search-button-text", "reset-button-text", "default-expanded", "show-search", "show-reset", "text-filter-builder", "custom-class", "custom-style"])
|
|
903
|
+
])) : b("", !0),
|
|
904
|
+
s("view", ut, [
|
|
905
|
+
J(Fe, {
|
|
906
|
+
ref_key: "listRef",
|
|
907
|
+
ref: c,
|
|
908
|
+
"data-fun": e.dataFun,
|
|
909
|
+
"page-size": e.pageSize,
|
|
910
|
+
threshold: e.threshold,
|
|
911
|
+
"row-key": e.rowKey,
|
|
912
|
+
immediate: e.immediate,
|
|
913
|
+
"show-checkbox": e.showCheckbox,
|
|
914
|
+
height: "100%",
|
|
915
|
+
class: T(e.listCustomClass),
|
|
916
|
+
style: z(e.listCustomStyle),
|
|
917
|
+
onDataLoaded: u[3] || (u[3] = (h, x) => l(h, x)),
|
|
918
|
+
onSelectionChange: u[4] || (u[4] = (h) => t("selection-change", h)),
|
|
919
|
+
onError: u[5] || (u[5] = (h) => t("error", h))
|
|
920
|
+
}, {
|
|
921
|
+
default: q(({ row: h, index: x }) => [
|
|
922
|
+
V(r.$slots, "list-default", {
|
|
923
|
+
row: h,
|
|
924
|
+
index: x
|
|
925
|
+
})
|
|
926
|
+
]),
|
|
927
|
+
_: 3
|
|
928
|
+
}, 8, ["data-fun", "page-size", "threshold", "row-key", "immediate", "show-checkbox", "class", "style"])
|
|
929
|
+
]),
|
|
930
|
+
e.showCommandBar ? (d(), v("view", ot, [
|
|
931
|
+
J(it, {
|
|
932
|
+
actions: e.actions,
|
|
933
|
+
"custom-class": e.cmdCustomClass,
|
|
934
|
+
"custom-style": e.cmdCustomStyle
|
|
935
|
+
}, {
|
|
936
|
+
default: q(() => [
|
|
937
|
+
V(r.$slots, "cmd-default")
|
|
938
|
+
]),
|
|
939
|
+
_: 3
|
|
940
|
+
}, 8, ["actions", "custom-class", "custom-style"])
|
|
941
|
+
])) : b("", !0)
|
|
942
|
+
]));
|
|
199
943
|
}
|
|
200
944
|
});
|
|
201
945
|
export {
|
|
202
|
-
|
|
946
|
+
te as FilterPanelKey,
|
|
947
|
+
it as YsCommandBar,
|
|
948
|
+
mt as YsDateFilterItem,
|
|
949
|
+
vt as YsDateRangeFilterItem,
|
|
950
|
+
ht as YsEnumFilterItem,
|
|
951
|
+
O as YsFilterItemLayout,
|
|
952
|
+
qe as YsFilterPanel,
|
|
953
|
+
Fe as YsInfiniteList,
|
|
954
|
+
gt as YsInfinitePage,
|
|
955
|
+
yt as YsTextFilterItem,
|
|
956
|
+
Be as useFilterPanelItem
|
|
203
957
|
};
|
|
204
958
|
//# sourceMappingURL=index.js.map
|