@ys-knife-crud/taro 0.0.6 → 0.0.7
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.js +424 -324
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as Y, ref as x, computed as I, watch as X, getCurrentInstance as ae, onMounted as G, openBlock as
|
|
1
|
+
import { defineComponent as Y, ref as x, computed as I, watch as X, getCurrentInstance as ae, onMounted as G, openBlock as d, createElementBlock as m, normalizeStyle as O, createElementVNode as f, Fragment as L, renderList as H, normalizeClass as R, createCommentVNode as w, renderSlot as T, toDisplayString as $, 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 z, withCtx as M, unref as B, withModifiers as W, createVNode as Q } from "vue";
|
|
2
2
|
import { createSelectorQuery as ye } from "@tarojs/taro";
|
|
3
|
-
import { emptyFilter as me, FilterInfo as ve, filter as A, con as
|
|
4
|
-
import './index.css';const
|
|
3
|
+
import { emptyFilter as me, FilterInfo as ve, filter as A, con as N, Operator as U } from "@ys-knife-crud/core";
|
|
4
|
+
import './index.css';const ge = ["lower-threshold"], he = { class: "yk-infinite-list__content" }, pe = ["onTap"], ke = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "yk-infinite-list__checkbox-icon"
|
|
7
7
|
}, _e = { class: "yk-infinite-list__item-body" }, xe = { class: "yk-infinite-list__item-json" }, Se = {
|
|
@@ -47,47 +47,47 @@ import './index.css';const he = ["lower-threshold"], ge = { class: "yk-infinite-
|
|
|
47
47
|
showCheckbox: { type: Boolean, default: !1 }
|
|
48
48
|
},
|
|
49
49
|
emits: ["data-loaded", "error", "selection-change"],
|
|
50
|
-
setup(e, { expose:
|
|
51
|
-
const
|
|
50
|
+
setup(e, { expose: u, emit: s }) {
|
|
51
|
+
const l = e, a = s, o = x([]), c = x(!1), t = x(!1), n = x(!0), i = x(null), _ = x(0), b = I(() => o.value.length), y = x(/* @__PURE__ */ new Map()), C = I(() => [...y.value.values()]);
|
|
52
52
|
function S(v) {
|
|
53
|
-
return y.value.has(String(v[
|
|
53
|
+
return y.value.has(String(v[l.rowKey]));
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
|
|
55
|
+
function P(v, p) {
|
|
56
|
+
const h = String(v[l.rowKey]), V = new Map(y.value), E = V.has(h), q = p ?? !E;
|
|
57
|
+
q && !E ? V.set(h, v) : !q && E && V.delete(h), y.value = V;
|
|
58
58
|
}
|
|
59
59
|
function k() {
|
|
60
60
|
y.value = /* @__PURE__ */ new Map();
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function r() {
|
|
63
63
|
const v = new Map(y.value);
|
|
64
|
-
for (const p of
|
|
64
|
+
for (const p of o.value) v.set(String(p[l.rowKey]), p);
|
|
65
65
|
y.value = v;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function g() {
|
|
68
68
|
const v = new Map(y.value);
|
|
69
|
-
for (const p of
|
|
70
|
-
const
|
|
71
|
-
v.has(
|
|
69
|
+
for (const p of o.value) {
|
|
70
|
+
const h = String(p[l.rowKey]);
|
|
71
|
+
v.has(h) ? v.delete(h) : v.set(h, p);
|
|
72
72
|
}
|
|
73
73
|
y.value = v;
|
|
74
74
|
}
|
|
75
|
-
X(C, (v) =>
|
|
75
|
+
X(C, (v) => a("selection-change", [...v]));
|
|
76
76
|
async function F(v) {
|
|
77
77
|
if (v) {
|
|
78
|
-
if (
|
|
79
|
-
|
|
78
|
+
if (t.value || c.value || !n.value) return;
|
|
79
|
+
t.value = !0;
|
|
80
80
|
} else {
|
|
81
|
-
if (
|
|
82
|
-
|
|
81
|
+
if (c.value) return;
|
|
82
|
+
c.value = !0, i.value = null;
|
|
83
83
|
}
|
|
84
84
|
try {
|
|
85
|
-
const p = v ? b.value : 0,
|
|
86
|
-
v ?
|
|
85
|
+
const p = v ? b.value : 0, h = await l.dataFun({ limit: l.pageSize, offset: p });
|
|
86
|
+
v ? o.value.push(...h.items) : o.value = h.items, n.value = h.hasNext ?? !1, h.totalCount != null && (_.value = h.totalCount), a("data-loaded", h, v);
|
|
87
87
|
} catch (p) {
|
|
88
|
-
i.value = p,
|
|
88
|
+
i.value = p, a("error", p);
|
|
89
89
|
} finally {
|
|
90
|
-
v ?
|
|
90
|
+
v ? t.value = !1 : c.value = !1, i.value || ne();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function j() {
|
|
@@ -97,29 +97,29 @@ import './index.css';const he = ["lower-threshold"], ge = { class: "yk-infinite-
|
|
|
97
97
|
n.value = !0, F(!1);
|
|
98
98
|
}
|
|
99
99
|
function le() {
|
|
100
|
-
n.value && !
|
|
100
|
+
n.value && !c.value && !t.value && j();
|
|
101
101
|
}
|
|
102
102
|
const J = ae();
|
|
103
103
|
async function ne() {
|
|
104
|
-
if (!n.value ||
|
|
104
|
+
if (!n.value || c.value || t.value) return;
|
|
105
105
|
await ie();
|
|
106
106
|
const v = J == null ? void 0 : J.proxy;
|
|
107
107
|
v && await new Promise((p) => {
|
|
108
|
-
ye().in(v).select(".yk-infinite-list").boundingClientRect().select(".yk-infinite-list__content").boundingClientRect().exec((
|
|
109
|
-
const
|
|
110
|
-
E &&
|
|
108
|
+
ye().in(v).select(".yk-infinite-list").boundingClientRect().select(".yk-infinite-list__content").boundingClientRect().exec((h) => {
|
|
109
|
+
const V = h ?? [], E = V[0], q = V[1];
|
|
110
|
+
E && q && q.height <= E.height + 1 && j(), p();
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
return G(() => {
|
|
115
|
-
|
|
116
|
-
}), X(() =>
|
|
115
|
+
l.immediate && F(!1);
|
|
116
|
+
}), X(() => l.dataFun, () => D()), u({
|
|
117
117
|
/** 当前已加载的全部数据 */
|
|
118
|
-
items:
|
|
118
|
+
items: o,
|
|
119
119
|
/** 首屏加载态 */
|
|
120
|
-
loading:
|
|
120
|
+
loading: c,
|
|
121
121
|
/** 追加加载态 */
|
|
122
|
-
loadingMore:
|
|
122
|
+
loadingMore: t,
|
|
123
123
|
/** 是否还有下一页 */
|
|
124
124
|
hasMore: n,
|
|
125
125
|
/** 重置并从第一页重新加载 */
|
|
@@ -129,90 +129,90 @@ import './index.css';const he = ["lower-threshold"], ge = { class: "yk-infinite-
|
|
|
129
129
|
/** 手动触发加载下一页(一般由触底自动触发) */
|
|
130
130
|
loadNextPage: j,
|
|
131
131
|
/** rows 别名:当前已加载的全部数据(与 YsTable 的 rows 同名) */
|
|
132
|
-
rows:
|
|
132
|
+
rows: o,
|
|
133
133
|
/** 跨页累计选中的行(showCheckbox 开启时有意义) */
|
|
134
134
|
selectedRows: C,
|
|
135
135
|
/** 某行当前是否选中 */
|
|
136
136
|
isRowSelected: S,
|
|
137
137
|
/** 切换某行选中态(selected 缺省时取反) */
|
|
138
|
-
toggleRowSelection:
|
|
138
|
+
toggleRowSelection: P,
|
|
139
139
|
/** 清空全部选中 */
|
|
140
140
|
clearSelection: k,
|
|
141
141
|
/** 选中当前已加载的全部行 */
|
|
142
|
-
selectAllOnPage:
|
|
142
|
+
selectAllOnPage: r,
|
|
143
143
|
/** 反选当前已加载的行 */
|
|
144
|
-
invertSelectionOnPage:
|
|
145
|
-
}), (v, p) => (
|
|
144
|
+
invertSelectionOnPage: g
|
|
145
|
+
}), (v, p) => (d(), m("scroll-view", {
|
|
146
146
|
class: "yk-infinite-list",
|
|
147
|
-
style:
|
|
147
|
+
style: O({ height: e.height }),
|
|
148
148
|
"scroll-y": "",
|
|
149
149
|
"lower-threshold": e.threshold,
|
|
150
150
|
onScrolltolower: le
|
|
151
151
|
}, [
|
|
152
|
-
|
|
153
|
-
(
|
|
154
|
-
key: String(
|
|
155
|
-
class:
|
|
152
|
+
f("view", he, [
|
|
153
|
+
(d(!0), m(L, null, H(o.value, (h, V) => (d(), m("view", {
|
|
154
|
+
key: String(h[e.rowKey]),
|
|
155
|
+
class: R(["yk-infinite-list__item", { "is-selected": e.showCheckbox && S(h) }])
|
|
156
156
|
}, [
|
|
157
|
-
e.showCheckbox ? (
|
|
157
|
+
e.showCheckbox ? (d(), m("view", {
|
|
158
158
|
key: 0,
|
|
159
|
-
class:
|
|
160
|
-
onTap: (E) =>
|
|
159
|
+
class: R(["yk-infinite-list__item-checkbox", { "is-checked": S(h) }]),
|
|
160
|
+
onTap: (E) => P(h)
|
|
161
161
|
}, [
|
|
162
|
-
S(
|
|
162
|
+
S(h) ? (d(), m("text", ke, "✓")) : w("", !0)
|
|
163
163
|
], 42, pe)) : w("", !0),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
row:
|
|
167
|
-
index:
|
|
164
|
+
f("view", _e, [
|
|
165
|
+
T(v.$slots, "default", {
|
|
166
|
+
row: h,
|
|
167
|
+
index: V
|
|
168
168
|
}, () => [
|
|
169
|
-
|
|
169
|
+
f("text", xe, $(JSON.stringify(h)), 1)
|
|
170
170
|
])
|
|
171
171
|
])
|
|
172
172
|
], 2))), 128)),
|
|
173
|
-
!
|
|
174
|
-
|
|
175
|
-
p[0] || (p[0] =
|
|
173
|
+
!c.value && o.value.length === 0 && !i.value ? (d(), m("view", Se, [
|
|
174
|
+
T(v.$slots, "empty", {}, () => [
|
|
175
|
+
p[0] || (p[0] = f("text", { class: "yk-infinite-list__status-text" }, "暂无数据", -1))
|
|
176
176
|
])
|
|
177
|
-
])) : i.value ? (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
])) : i.value ? (d(), m("view", we, [
|
|
178
|
+
T(v.$slots, "error", { error: i.value }, () => [
|
|
179
|
+
f("text", be, "加载失败:" + $(String(i.value)), 1),
|
|
180
|
+
f("button", {
|
|
181
181
|
class: "yk-infinite-list__retry",
|
|
182
182
|
size: "mini",
|
|
183
183
|
onTap: D
|
|
184
184
|
}, "重试", 32)
|
|
185
185
|
])
|
|
186
186
|
])) : w("", !0),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
p[1] || (p[1] =
|
|
190
|
-
p[2] || (p[2] =
|
|
187
|
+
t.value ? (d(), m("view", Ce, [
|
|
188
|
+
T(v.$slots, "loading", {}, () => [
|
|
189
|
+
p[1] || (p[1] = f("view", { class: "yk-infinite-list__spinner" }, null, -1)),
|
|
190
|
+
p[2] || (p[2] = f("text", null, "加载中...", -1))
|
|
191
191
|
])
|
|
192
192
|
])) : w("", !0),
|
|
193
|
-
!n.value &&
|
|
194
|
-
|
|
195
|
-
p[3] || (p[3] =
|
|
193
|
+
!n.value && o.value.length > 0 && !c.value ? (d(), m("view", $e, [
|
|
194
|
+
T(v.$slots, "no-more", {}, () => [
|
|
195
|
+
p[3] || (p[3] = f("text", null, "— 没有更多了 —", -1))
|
|
196
196
|
])
|
|
197
197
|
])) : w("", !0)
|
|
198
198
|
])
|
|
199
|
-
], 44,
|
|
199
|
+
], 44, ge));
|
|
200
200
|
}
|
|
201
201
|
}), te = Symbol("YsFilterPanel");
|
|
202
202
|
function Be(e) {
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
205
|
-
let
|
|
203
|
+
const u = re(te, null);
|
|
204
|
+
if (!u) return;
|
|
205
|
+
let s = null;
|
|
206
206
|
G(() => {
|
|
207
|
-
|
|
207
|
+
s = u(e);
|
|
208
208
|
}), se(() => {
|
|
209
|
-
|
|
209
|
+
s == null || s(), s = null;
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
const Ie = { class: "yk-filter-panel__bar" },
|
|
212
|
+
const Ie = { class: "yk-filter-panel__bar" }, Pe = { class: "yk-filter-panel__trigger-text" }, Te = { class: "yk-filter-panel__arrow" }, Re = { class: "yk-filter-panel__field" }, Ve = ["value", "placeholder"], Ye = { class: "yk-filter-panel__actions" }, Ee = {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: "yk-filter-panel__conditions"
|
|
215
|
-
},
|
|
215
|
+
}, Me = /* @__PURE__ */ Y({
|
|
216
216
|
name: "YsFilterPanel",
|
|
217
217
|
__name: "filter-panel",
|
|
218
218
|
props: {
|
|
@@ -254,103 +254,103 @@ const Ie = { class: "yk-filter-panel__bar" }, Te = { class: "yk-filter-panel__tr
|
|
|
254
254
|
customStyle: { type: String, default: "" }
|
|
255
255
|
},
|
|
256
256
|
emits: ["search", "reset", "expand-change"],
|
|
257
|
-
setup(e, { expose:
|
|
258
|
-
const
|
|
259
|
-
function _(
|
|
260
|
-
return i.value = [...i.value,
|
|
261
|
-
i.value = i.value.filter((
|
|
257
|
+
setup(e, { expose: u, emit: s }) {
|
|
258
|
+
const l = e, a = s, o = ue(), c = I(() => !!o.default), t = x(l.defaultExpanded), n = x(""), i = oe([]);
|
|
259
|
+
function _(r) {
|
|
260
|
+
return i.value = [...i.value, r], () => {
|
|
261
|
+
i.value = i.value.filter((g) => g !== r);
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
ce(te, _);
|
|
265
265
|
const b = I(() => {
|
|
266
|
-
const
|
|
267
|
-
return !
|
|
266
|
+
const r = n.value.trim();
|
|
267
|
+
return !r || !l.textFilterBuilder ? null : l.textFilterBuilder(r) ?? null;
|
|
268
268
|
}), y = I(() => {
|
|
269
|
-
const
|
|
270
|
-
b.value &&
|
|
271
|
-
for (const
|
|
272
|
-
const F =
|
|
273
|
-
F &&
|
|
269
|
+
const r = [];
|
|
270
|
+
b.value && r.push(b.value);
|
|
271
|
+
for (const g of i.value) {
|
|
272
|
+
const F = g.filter;
|
|
273
|
+
F && r.push(F);
|
|
274
274
|
}
|
|
275
|
-
return
|
|
275
|
+
return r.length === 0 ? me() : r.length === 1 ? r[0] : ve.createAnd(...r);
|
|
276
276
|
});
|
|
277
277
|
function C() {
|
|
278
|
-
|
|
278
|
+
t.value = !t.value, a("expand-change", t.value);
|
|
279
279
|
}
|
|
280
|
-
function S(
|
|
281
|
-
const
|
|
282
|
-
n.value = (
|
|
280
|
+
function S(r) {
|
|
281
|
+
const g = r.detail;
|
|
282
|
+
n.value = (g == null ? void 0 : g.value) ?? "";
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
|
|
284
|
+
function P() {
|
|
285
|
+
a("search", y.value);
|
|
286
286
|
}
|
|
287
287
|
function k() {
|
|
288
288
|
n.value = "";
|
|
289
|
-
for (const
|
|
290
|
-
|
|
289
|
+
for (const r of i.value) r.reset();
|
|
290
|
+
a("reset");
|
|
291
291
|
}
|
|
292
|
-
return
|
|
292
|
+
return u({
|
|
293
293
|
/** 文本搜索框当前值(只读读取用,外部不能写入) */
|
|
294
294
|
keyword: n,
|
|
295
295
|
/** 条件区是否展开 */
|
|
296
|
-
expanded:
|
|
296
|
+
expanded: t,
|
|
297
297
|
/** 当前聚合后的查询条件 */
|
|
298
298
|
filter: y,
|
|
299
299
|
/** 切换条件区展开/折叠 */
|
|
300
300
|
toggle: C,
|
|
301
301
|
/** 重置(清空文本 + 重置已注册子项 + 派发 reset) */
|
|
302
302
|
reset: k
|
|
303
|
-
}), (
|
|
304
|
-
class:
|
|
305
|
-
style:
|
|
303
|
+
}), (r, g) => (d(), m("view", {
|
|
304
|
+
class: R(["yk-filter-panel", e.customClass]),
|
|
305
|
+
style: O(e.customStyle)
|
|
306
306
|
}, [
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
f("view", Ie, [
|
|
308
|
+
c.value ? (d(), m("view", {
|
|
309
309
|
key: 0,
|
|
310
310
|
class: "yk-filter-panel__trigger",
|
|
311
311
|
onTap: C
|
|
312
312
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
f("text", Pe, $(e.filterText), 1),
|
|
314
|
+
f("text", Te, $(t.value ? "▲" : "▼"), 1)
|
|
315
315
|
], 32)) : w("", !0),
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
f("view", Re, [
|
|
317
|
+
f("input", {
|
|
318
318
|
class: "yk-filter-panel__input",
|
|
319
319
|
value: n.value,
|
|
320
320
|
placeholder: e.placeholder,
|
|
321
321
|
"placeholder-class": "yk-filter-panel__placeholder",
|
|
322
322
|
onInput: S,
|
|
323
|
-
onConfirm:
|
|
324
|
-
}, null, 40,
|
|
323
|
+
onConfirm: P
|
|
324
|
+
}, null, 40, Ve)
|
|
325
325
|
]),
|
|
326
|
-
|
|
327
|
-
e.showSearch ? (
|
|
326
|
+
f("view", Ye, [
|
|
327
|
+
e.showSearch ? (d(), m("view", {
|
|
328
328
|
key: 0,
|
|
329
329
|
class: "yk-filter-panel__btn yk-filter-panel__btn--primary",
|
|
330
|
-
onTap:
|
|
330
|
+
onTap: P
|
|
331
331
|
}, [
|
|
332
|
-
|
|
332
|
+
f("text", null, $(e.searchButtonText), 1)
|
|
333
333
|
], 32)) : w("", !0),
|
|
334
|
-
e.showReset ? (
|
|
334
|
+
e.showReset ? (d(), m("view", {
|
|
335
335
|
key: 1,
|
|
336
336
|
class: "yk-filter-panel__btn yk-filter-panel__btn--default",
|
|
337
337
|
onTap: k
|
|
338
338
|
}, [
|
|
339
|
-
|
|
339
|
+
f("text", null, $(e.resetButtonText), 1)
|
|
340
340
|
], 32)) : w("", !0)
|
|
341
341
|
])
|
|
342
342
|
]),
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
c.value ? fe((d(), m("view", Ee, [
|
|
344
|
+
T(r.$slots, "default")
|
|
345
345
|
], 512)), [
|
|
346
|
-
[de,
|
|
346
|
+
[de, t.value]
|
|
347
347
|
]) : w("", !0)
|
|
348
348
|
], 6));
|
|
349
349
|
}
|
|
350
|
-
}), Ae = { class: "yk-filter-item" },
|
|
350
|
+
}), Ae = { class: "yk-filter-item" }, Ne = {
|
|
351
351
|
key: 0,
|
|
352
352
|
class: "yk-filter-item__label"
|
|
353
|
-
},
|
|
353
|
+
}, qe = { class: "yk-filter-item__control" }, K = /* @__PURE__ */ Y({
|
|
354
354
|
name: "YsFilterItemLayout",
|
|
355
355
|
__name: "filter-item-layout",
|
|
356
356
|
props: {
|
|
@@ -360,97 +360,97 @@ const Ie = { class: "yk-filter-panel__bar" }, Te = { class: "yk-filter-panel__tr
|
|
|
360
360
|
api: { type: Object, required: !0 }
|
|
361
361
|
},
|
|
362
362
|
setup(e) {
|
|
363
|
-
return Be(e.api), (
|
|
364
|
-
e.label ? (
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
return Be(e.api), (s, l) => (d(), m("view", Ae, [
|
|
364
|
+
e.label ? (d(), m("text", Ne, $(e.label), 1)) : w("", !0),
|
|
365
|
+
f("view", qe, [
|
|
366
|
+
T(s.$slots, "default")
|
|
367
367
|
])
|
|
368
368
|
]));
|
|
369
369
|
}
|
|
370
370
|
});
|
|
371
371
|
function De(e) {
|
|
372
|
-
const
|
|
372
|
+
const u = x(
|
|
373
373
|
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
374
374
|
);
|
|
375
|
-
function
|
|
376
|
-
return
|
|
375
|
+
function s(o) {
|
|
376
|
+
return o == null || o.trim() === "";
|
|
377
377
|
}
|
|
378
|
-
const
|
|
379
|
-
function
|
|
380
|
-
|
|
378
|
+
const l = I(() => s(u.value) ? null : A(e.propertyPath, e.op, N(u.value)));
|
|
379
|
+
function a() {
|
|
380
|
+
u.value = typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
381
381
|
}
|
|
382
|
-
return { value:
|
|
382
|
+
return { value: u, filter: l, reset: a };
|
|
383
383
|
}
|
|
384
384
|
function Le(e) {
|
|
385
|
-
const
|
|
385
|
+
const u = x(
|
|
386
386
|
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
387
387
|
);
|
|
388
|
-
function
|
|
389
|
-
return
|
|
388
|
+
function s(o) {
|
|
389
|
+
return o == null || o.trim() === "";
|
|
390
390
|
}
|
|
391
|
-
const
|
|
392
|
-
function
|
|
393
|
-
|
|
391
|
+
const l = I(() => s(u.value) ? null : A(e.propertyPath, e.op, N(u.value)));
|
|
392
|
+
function a() {
|
|
393
|
+
u.value = typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
394
394
|
}
|
|
395
|
-
return { value:
|
|
395
|
+
return { value: u, filter: l, reset: a };
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
function
|
|
399
|
-
return
|
|
397
|
+
function Oe(e) {
|
|
398
|
+
function u(t) {
|
|
399
|
+
return t && t.length === 2 && typeof t[0] == "string" && typeof t[1] == "string" ? [t[0], t[1]] : null;
|
|
400
400
|
}
|
|
401
|
-
const
|
|
402
|
-
function
|
|
403
|
-
return
|
|
401
|
+
const s = u(e.defaultValue), l = x(s);
|
|
402
|
+
function a(t) {
|
|
403
|
+
return t == null || t.length !== 2 || !t[0] || !t[1];
|
|
404
404
|
}
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
const [
|
|
408
|
-
return A(e.propertyPath, U.Between,
|
|
405
|
+
const o = I(() => {
|
|
406
|
+
if (a(l.value)) return null;
|
|
407
|
+
const [t, n] = l.value;
|
|
408
|
+
return A(e.propertyPath, U.Between, N([t, n]));
|
|
409
409
|
});
|
|
410
|
-
function
|
|
411
|
-
|
|
410
|
+
function c() {
|
|
411
|
+
l.value = s;
|
|
412
412
|
}
|
|
413
|
-
return { value:
|
|
413
|
+
return { value: l, filter: o, reset: c };
|
|
414
414
|
}
|
|
415
415
|
function Z(e) {
|
|
416
416
|
return typeof e == "string" || typeof e == "number" ? e : null;
|
|
417
417
|
}
|
|
418
418
|
function ee(e) {
|
|
419
419
|
return Array.isArray(e) ? e.filter(
|
|
420
|
-
(
|
|
420
|
+
(u) => typeof u == "string" || typeof u == "number"
|
|
421
421
|
) : [];
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
const
|
|
425
|
-
|
|
423
|
+
function ze(e) {
|
|
424
|
+
const u = e.multiple === !0, s = x(
|
|
425
|
+
u ? ee(e.defaultValue) : Z(e.defaultValue)
|
|
426
426
|
);
|
|
427
|
-
function
|
|
428
|
-
const
|
|
429
|
-
return
|
|
427
|
+
function l() {
|
|
428
|
+
const c = s.value;
|
|
429
|
+
return u ? !Array.isArray(c) || c.length === 0 : c == null || typeof c == "string" && c.trim() === "";
|
|
430
430
|
}
|
|
431
|
-
const
|
|
432
|
-
if (
|
|
433
|
-
if (
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
const n =
|
|
437
|
-
return n == null ? null : A(e.propertyPath, U.Equals,
|
|
431
|
+
const a = I(() => {
|
|
432
|
+
if (l()) return null;
|
|
433
|
+
if (u) {
|
|
434
|
+
const t = s.value;
|
|
435
|
+
if (t.length === 1) {
|
|
436
|
+
const n = t[0];
|
|
437
|
+
return n == null ? null : A(e.propertyPath, U.Equals, N(n));
|
|
438
438
|
}
|
|
439
439
|
return A(
|
|
440
440
|
e.propertyPath,
|
|
441
441
|
U.In,
|
|
442
|
-
|
|
442
|
+
N(t)
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
return
|
|
445
|
+
const c = s.value;
|
|
446
|
+
return c == null ? null : A(e.propertyPath, e.op, N(c));
|
|
447
447
|
});
|
|
448
|
-
function
|
|
449
|
-
|
|
448
|
+
function o() {
|
|
449
|
+
s.value = u ? ee(e.defaultValue) : Z(e.defaultValue);
|
|
450
450
|
}
|
|
451
|
-
return { value:
|
|
451
|
+
return { value: s, filter: a, reset: o };
|
|
452
452
|
}
|
|
453
|
-
const
|
|
453
|
+
const Ke = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt = /* @__PURE__ */ Y({
|
|
454
454
|
name: "YsTextFilterItem",
|
|
455
455
|
__name: "text-filter-item",
|
|
456
456
|
props: {
|
|
@@ -468,30 +468,30 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
468
468
|
/** 占位文本 */
|
|
469
469
|
placeholder: { type: String, default: "请输入" }
|
|
470
470
|
},
|
|
471
|
-
setup(e, { expose:
|
|
472
|
-
const
|
|
473
|
-
function
|
|
471
|
+
setup(e, { expose: u }) {
|
|
472
|
+
const s = e, { value: l, filter: a, reset: o } = De(s);
|
|
473
|
+
function c(n) {
|
|
474
474
|
const i = n.detail;
|
|
475
|
-
|
|
475
|
+
l.value = (i == null ? void 0 : i.value) ?? "";
|
|
476
476
|
}
|
|
477
|
-
const
|
|
477
|
+
const t = {
|
|
478
478
|
get filter() {
|
|
479
|
-
return
|
|
479
|
+
return a.value;
|
|
480
480
|
},
|
|
481
|
-
reset:
|
|
481
|
+
reset: o
|
|
482
482
|
};
|
|
483
|
-
return
|
|
483
|
+
return u(t), (n, i) => (d(), z(K, {
|
|
484
484
|
label: e.label,
|
|
485
|
-
api:
|
|
485
|
+
api: t
|
|
486
486
|
}, {
|
|
487
|
-
default:
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
default: M(() => [
|
|
488
|
+
f("view", Ke, [
|
|
489
|
+
f("input", {
|
|
490
490
|
class: "yk-filter-item__input",
|
|
491
|
-
value: B(
|
|
491
|
+
value: B(l),
|
|
492
492
|
placeholder: e.placeholder,
|
|
493
493
|
"placeholder-class": "yk-filter-item__placeholder",
|
|
494
|
-
onInput:
|
|
494
|
+
onInput: c
|
|
495
495
|
}, null, 40, je)
|
|
496
496
|
])
|
|
497
497
|
]),
|
|
@@ -520,46 +520,46 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
520
520
|
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
521
521
|
end: { type: String, default: "" }
|
|
522
522
|
},
|
|
523
|
-
setup(e, { expose:
|
|
524
|
-
const
|
|
525
|
-
function
|
|
523
|
+
setup(e, { expose: u }) {
|
|
524
|
+
const s = e, { value: l, filter: a, reset: o } = Le(s);
|
|
525
|
+
function c(i) {
|
|
526
526
|
const _ = i.detail;
|
|
527
|
-
|
|
527
|
+
l.value = (_ == null ? void 0 : _.value) ?? "";
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
|
|
529
|
+
function t() {
|
|
530
|
+
l.value = "";
|
|
531
531
|
}
|
|
532
532
|
const n = {
|
|
533
533
|
get filter() {
|
|
534
|
-
return
|
|
534
|
+
return a.value;
|
|
535
535
|
},
|
|
536
|
-
reset:
|
|
536
|
+
reset: o
|
|
537
537
|
};
|
|
538
|
-
return
|
|
538
|
+
return u(n), (i, _) => (d(), z(K, {
|
|
539
539
|
label: e.label,
|
|
540
540
|
api: n
|
|
541
541
|
}, {
|
|
542
|
-
default:
|
|
543
|
-
|
|
542
|
+
default: M(() => [
|
|
543
|
+
f("picker", {
|
|
544
544
|
class: "yk-filter-item__picker-trigger",
|
|
545
545
|
mode: "date",
|
|
546
|
-
value: B(
|
|
546
|
+
value: B(l),
|
|
547
547
|
start: e.start,
|
|
548
548
|
end: e.end,
|
|
549
|
-
onChange:
|
|
549
|
+
onChange: c
|
|
550
550
|
}, [
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
class:
|
|
554
|
-
}, $(B(
|
|
551
|
+
f("view", Qe, [
|
|
552
|
+
f("text", {
|
|
553
|
+
class: R(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !B(l) }])
|
|
554
|
+
}, $(B(l) || e.placeholder), 3)
|
|
555
555
|
])
|
|
556
556
|
], 40, Je),
|
|
557
|
-
B(
|
|
557
|
+
B(l) ? (d(), m("view", {
|
|
558
558
|
key: 0,
|
|
559
559
|
class: "yk-filter-item__clear",
|
|
560
|
-
onTap: W(
|
|
560
|
+
onTap: W(t, ["stop"])
|
|
561
561
|
}, [..._[0] || (_[0] = [
|
|
562
|
-
|
|
562
|
+
f("text", null, "✕", -1)
|
|
563
563
|
])], 32)) : w("", !0)
|
|
564
564
|
]),
|
|
565
565
|
_: 1
|
|
@@ -587,71 +587,71 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
587
587
|
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
588
588
|
end: { type: String, default: "" }
|
|
589
589
|
},
|
|
590
|
-
setup(e, { expose:
|
|
591
|
-
const
|
|
592
|
-
function
|
|
593
|
-
const C =
|
|
594
|
-
S[b] = y,
|
|
590
|
+
setup(e, { expose: u }) {
|
|
591
|
+
const s = e, { value: l, filter: a, reset: o } = Oe(s);
|
|
592
|
+
function c(b, y) {
|
|
593
|
+
const C = l.value ?? ["", ""], S = [C[0], C[1]];
|
|
594
|
+
S[b] = y, l.value = !S[0] && !S[1] ? null : S;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function t(b) {
|
|
597
597
|
const y = b.detail;
|
|
598
|
-
|
|
598
|
+
c(0, (y == null ? void 0 : y.value) ?? "");
|
|
599
599
|
}
|
|
600
600
|
function n(b) {
|
|
601
601
|
const y = b.detail;
|
|
602
|
-
|
|
602
|
+
c(1, (y == null ? void 0 : y.value) ?? "");
|
|
603
603
|
}
|
|
604
604
|
function i() {
|
|
605
|
-
|
|
605
|
+
l.value = null;
|
|
606
606
|
}
|
|
607
607
|
const _ = {
|
|
608
608
|
get filter() {
|
|
609
|
-
return
|
|
609
|
+
return a.value;
|
|
610
610
|
},
|
|
611
|
-
reset:
|
|
611
|
+
reset: o
|
|
612
612
|
};
|
|
613
|
-
return
|
|
613
|
+
return u(_), (b, y) => (d(), z(K, {
|
|
614
614
|
label: e.label,
|
|
615
615
|
api: _
|
|
616
616
|
}, {
|
|
617
|
-
default:
|
|
618
|
-
var C, S,
|
|
617
|
+
default: M(() => {
|
|
618
|
+
var C, S, P, k, r, g;
|
|
619
619
|
return [
|
|
620
|
-
|
|
620
|
+
f("picker", {
|
|
621
621
|
class: "yk-filter-item__picker-trigger",
|
|
622
622
|
mode: "date",
|
|
623
|
-
value: ((C = B(
|
|
623
|
+
value: ((C = B(l)) == null ? void 0 : C[0]) ?? "",
|
|
624
624
|
start: e.start,
|
|
625
625
|
end: e.end,
|
|
626
|
-
onChange:
|
|
626
|
+
onChange: t
|
|
627
627
|
}, [
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
class:
|
|
631
|
-
}, $(((
|
|
628
|
+
f("view", Ge, [
|
|
629
|
+
f("text", {
|
|
630
|
+
class: R(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !((S = B(l)) != null && S[0]) }])
|
|
631
|
+
}, $(((P = B(l)) == null ? void 0 : P[0]) || e.startPlaceholder), 3)
|
|
632
632
|
])
|
|
633
633
|
], 40, Ue),
|
|
634
|
-
y[1] || (y[1] =
|
|
635
|
-
|
|
634
|
+
y[1] || (y[1] = f("text", { class: "yk-filter-item__sep" }, "至", -1)),
|
|
635
|
+
f("picker", {
|
|
636
636
|
class: "yk-filter-item__picker-trigger",
|
|
637
637
|
mode: "date",
|
|
638
|
-
value: ((k = B(
|
|
638
|
+
value: ((k = B(l)) == null ? void 0 : k[1]) ?? "",
|
|
639
639
|
start: e.start,
|
|
640
640
|
end: e.end,
|
|
641
641
|
onChange: n
|
|
642
642
|
}, [
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
class:
|
|
646
|
-
}, $(((
|
|
643
|
+
f("view", We, [
|
|
644
|
+
f("text", {
|
|
645
|
+
class: R(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !((r = B(l)) != null && r[1]) }])
|
|
646
|
+
}, $(((g = B(l)) == null ? void 0 : g[1]) || e.endPlaceholder), 3)
|
|
647
647
|
])
|
|
648
648
|
], 40, He),
|
|
649
|
-
B(
|
|
649
|
+
B(l) ? (d(), m("view", {
|
|
650
650
|
key: 0,
|
|
651
651
|
class: "yk-filter-item__clear",
|
|
652
652
|
onTap: W(i, ["stop"])
|
|
653
653
|
}, [...y[0] || (y[0] = [
|
|
654
|
-
|
|
654
|
+
f("text", null, "✕", -1)
|
|
655
655
|
])], 32)) : w("", !0)
|
|
656
656
|
];
|
|
657
657
|
}),
|
|
@@ -664,7 +664,7 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
664
664
|
}, Ze = {
|
|
665
665
|
key: 0,
|
|
666
666
|
class: "yk-filter-item__chips-empty"
|
|
667
|
-
}, et = ["onTap"], tt = ["range", "value"], lt = { class: "yk-filter-item__picker" },
|
|
667
|
+
}, et = ["onTap"], tt = ["range", "value"], lt = { class: "yk-filter-item__picker" }, gt = /* @__PURE__ */ Y({
|
|
668
668
|
name: "YsEnumFilterItem",
|
|
669
669
|
__name: "enum-filter-item",
|
|
670
670
|
props: {
|
|
@@ -688,81 +688,81 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
688
688
|
/** 单选模式是否显示清除按钮 */
|
|
689
689
|
clearable: { type: Boolean, default: !0 }
|
|
690
690
|
},
|
|
691
|
-
setup(e, { expose:
|
|
692
|
-
const
|
|
691
|
+
setup(e, { expose: u }) {
|
|
692
|
+
const s = e, { value: l, filter: a, reset: o } = ze(s), c = x([]), t = x(!1);
|
|
693
693
|
G(async () => {
|
|
694
|
-
|
|
694
|
+
t.value = !0;
|
|
695
695
|
try {
|
|
696
|
-
|
|
696
|
+
c.value = await s.optionsSource();
|
|
697
697
|
} finally {
|
|
698
|
-
|
|
698
|
+
t.value = !1;
|
|
699
699
|
}
|
|
700
700
|
});
|
|
701
701
|
const n = I(() => {
|
|
702
|
-
const k = Array.isArray(
|
|
703
|
-
return k == null ? -1 :
|
|
702
|
+
const k = Array.isArray(l.value) ? null : l.value;
|
|
703
|
+
return k == null ? -1 : c.value.findIndex((r) => String(r.value) === String(k));
|
|
704
704
|
}), i = I(() => {
|
|
705
|
-
var
|
|
705
|
+
var r;
|
|
706
706
|
const k = n.value;
|
|
707
|
-
return k >= 0 ? ((
|
|
707
|
+
return k >= 0 ? ((r = c.value[k]) == null ? void 0 : r.label) ?? "" : "";
|
|
708
708
|
});
|
|
709
709
|
function _(k) {
|
|
710
|
-
const
|
|
711
|
-
F && (
|
|
710
|
+
const r = k.detail, g = Number((r == null ? void 0 : r.value) ?? -1), F = c.value[g];
|
|
711
|
+
F && (l.value = F.value);
|
|
712
712
|
}
|
|
713
713
|
function b() {
|
|
714
|
-
|
|
714
|
+
l.value = null;
|
|
715
715
|
}
|
|
716
716
|
const y = I(
|
|
717
|
-
() => Array.isArray(
|
|
717
|
+
() => Array.isArray(l.value) ? l.value : []
|
|
718
718
|
);
|
|
719
719
|
function C(k) {
|
|
720
|
-
return y.value.some((
|
|
720
|
+
return y.value.some((r) => String(r) === String(k.value));
|
|
721
721
|
}
|
|
722
722
|
function S(k) {
|
|
723
|
-
const
|
|
724
|
-
|
|
723
|
+
const r = [...y.value], g = r.findIndex((F) => String(F) === String(k.value));
|
|
724
|
+
g >= 0 ? r.splice(g, 1) : r.push(k.value), l.value = r;
|
|
725
725
|
}
|
|
726
|
-
const
|
|
726
|
+
const P = {
|
|
727
727
|
get filter() {
|
|
728
|
-
return
|
|
728
|
+
return a.value;
|
|
729
729
|
},
|
|
730
|
-
reset:
|
|
730
|
+
reset: o
|
|
731
731
|
};
|
|
732
|
-
return
|
|
732
|
+
return u(P), (k, r) => (d(), z(K, {
|
|
733
733
|
label: e.label,
|
|
734
|
-
api:
|
|
734
|
+
api: P
|
|
735
735
|
}, {
|
|
736
|
-
default:
|
|
737
|
-
e.multiple ? (
|
|
738
|
-
|
|
739
|
-
key: String(
|
|
740
|
-
class:
|
|
741
|
-
onTap: (F) => S(
|
|
736
|
+
default: M(() => [
|
|
737
|
+
e.multiple ? (d(), m("view", Xe, [
|
|
738
|
+
t.value ? (d(), m("text", Ze, "加载中…")) : (d(!0), m(L, { key: 1 }, H(c.value, (g) => (d(), m("view", {
|
|
739
|
+
key: String(g.value),
|
|
740
|
+
class: R(["yk-filter-item__chip", { "yk-filter-item__chip--active": C(g) }]),
|
|
741
|
+
onTap: (F) => S(g)
|
|
742
742
|
}, [
|
|
743
|
-
|
|
743
|
+
f("text", null, $(g.label), 1)
|
|
744
744
|
], 42, et))), 128))
|
|
745
|
-
])) : (
|
|
746
|
-
|
|
745
|
+
])) : (d(), m(L, { key: 1 }, [
|
|
746
|
+
f("picker", {
|
|
747
747
|
class: "yk-filter-item__picker-trigger",
|
|
748
748
|
mode: "selector",
|
|
749
|
-
range:
|
|
749
|
+
range: c.value,
|
|
750
750
|
"range-key": "label",
|
|
751
751
|
value: n.value < 0 ? 0 : n.value,
|
|
752
752
|
onChange: _
|
|
753
753
|
}, [
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
class:
|
|
757
|
-
}, $(
|
|
754
|
+
f("view", lt, [
|
|
755
|
+
f("text", {
|
|
756
|
+
class: R(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !i.value }])
|
|
757
|
+
}, $(t.value ? "加载中…" : i.value || e.placeholder), 3)
|
|
758
758
|
])
|
|
759
759
|
], 40, tt),
|
|
760
|
-
e.clearable && i.value ? (
|
|
760
|
+
e.clearable && i.value ? (d(), m("view", {
|
|
761
761
|
key: 0,
|
|
762
762
|
class: "yk-filter-item__clear",
|
|
763
763
|
onTap: W(b, ["stop"])
|
|
764
|
-
}, [...
|
|
765
|
-
|
|
764
|
+
}, [...r[0] || (r[0] = [
|
|
765
|
+
f("text", null, "✕", -1)
|
|
766
766
|
])], 32)) : w("", !0)
|
|
767
767
|
], 64))
|
|
768
768
|
]),
|
|
@@ -784,28 +784,28 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
784
784
|
customStyle: { type: String, default: "" }
|
|
785
785
|
},
|
|
786
786
|
setup(e) {
|
|
787
|
-
async function s
|
|
787
|
+
async function u(s) {
|
|
788
788
|
try {
|
|
789
|
-
await
|
|
790
|
-
} catch (
|
|
791
|
-
console.error("[YsCommandBar] action failed:",
|
|
789
|
+
await s.execute(void 0);
|
|
790
|
+
} catch (l) {
|
|
791
|
+
console.error("[YsCommandBar] action failed:", s.name, l);
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
|
-
return (
|
|
795
|
-
class:
|
|
796
|
-
style:
|
|
794
|
+
return (s, l) => (d(), m("view", {
|
|
795
|
+
class: R(["yk-command-bar", e.customClass]),
|
|
796
|
+
style: O(e.customStyle)
|
|
797
797
|
}, [
|
|
798
|
-
e.actions.length > 0 ? (
|
|
799
|
-
key:
|
|
800
|
-
class:
|
|
801
|
-
|
|
802
|
-
{ "yk-command-bar__btn--plain":
|
|
798
|
+
e.actions.length > 0 ? (d(!0), m(L, { key: 0 }, H(e.actions, (a) => (d(), m("view", {
|
|
799
|
+
key: a.name,
|
|
800
|
+
class: R(["yk-command-bar__btn", [
|
|
801
|
+
a.type ? `yk-command-bar__btn--${a.type}` : "yk-command-bar__btn--default",
|
|
802
|
+
{ "yk-command-bar__btn--plain": a.plain }
|
|
803
803
|
]]),
|
|
804
|
-
onTap: (
|
|
804
|
+
onTap: (o) => u(a)
|
|
805
805
|
}, [
|
|
806
|
-
|
|
806
|
+
f("text", at, $(a.desc), 1)
|
|
807
807
|
], 42, nt))), 128)) : w("", !0),
|
|
808
|
-
|
|
808
|
+
T(s.$slots, "default")
|
|
809
809
|
], 6));
|
|
810
810
|
}
|
|
811
811
|
}), rt = { class: "yk-infinite-page" }, st = {
|
|
@@ -814,7 +814,7 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
814
814
|
}, ut = { class: "yk-infinite-page__list" }, ot = {
|
|
815
815
|
key: 1,
|
|
816
816
|
class: "yk-infinite-page__cmd"
|
|
817
|
-
},
|
|
817
|
+
}, ht = /* @__PURE__ */ Y({
|
|
818
818
|
name: "YsInfinitePage",
|
|
819
819
|
__name: "infinite-page",
|
|
820
820
|
props: {
|
|
@@ -853,26 +853,126 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
853
853
|
listCustomStyle: { type: String, default: "" }
|
|
854
854
|
},
|
|
855
855
|
emits: ["search", "reset", "expand-change", "data-loaded", "selection-change", "error"],
|
|
856
|
-
setup(e, { expose:
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
|
|
856
|
+
setup(e, { expose: u, emit: s }) {
|
|
857
|
+
const l = s, a = x(null), o = x(null);
|
|
858
|
+
u({
|
|
859
|
+
/* ---------- 数据加载(转发 YsInfiniteList) ---------- */
|
|
860
|
+
/** 重置并从第一页重新加载 */
|
|
861
|
+
reload: () => {
|
|
862
|
+
var t;
|
|
863
|
+
return (t = a.value) == null ? void 0 : t.reload();
|
|
864
|
+
},
|
|
865
|
+
/** 刷新:重置为第一页重新加载(与 reload 同义) */
|
|
866
|
+
refresh: () => {
|
|
867
|
+
var t;
|
|
868
|
+
return (t = a.value) == null ? void 0 : t.refresh();
|
|
869
|
+
},
|
|
870
|
+
/** 手动加载下一页(一般触底自动触发,无需手动调) */
|
|
871
|
+
loadNextPage: () => {
|
|
872
|
+
var t;
|
|
873
|
+
return (t = a.value) == null ? void 0 : t.loadNextPage();
|
|
874
|
+
},
|
|
875
|
+
/* ---------- 列表状态 ---------- */
|
|
876
|
+
/** 当前已加载的全部数据 */
|
|
877
|
+
get items() {
|
|
878
|
+
var t;
|
|
879
|
+
return ((t = a.value) == null ? void 0 : t.items) ?? [];
|
|
880
|
+
},
|
|
881
|
+
/** items 别名(与 YsTable 的 rows 同名) */
|
|
882
|
+
get rows() {
|
|
883
|
+
var t;
|
|
884
|
+
return ((t = a.value) == null ? void 0 : t.rows) ?? [];
|
|
885
|
+
},
|
|
886
|
+
/** 首屏加载态 */
|
|
887
|
+
get loading() {
|
|
888
|
+
var t;
|
|
889
|
+
return ((t = a.value) == null ? void 0 : t.loading) ?? !1;
|
|
890
|
+
},
|
|
891
|
+
/** 追加加载态 */
|
|
892
|
+
get loadingMore() {
|
|
893
|
+
var t;
|
|
894
|
+
return ((t = a.value) == null ? void 0 : t.loadingMore) ?? !1;
|
|
895
|
+
},
|
|
896
|
+
/** 是否还有下一页 */
|
|
897
|
+
get hasMore() {
|
|
898
|
+
var t;
|
|
899
|
+
return ((t = a.value) == null ? void 0 : t.hasMore) ?? !1;
|
|
900
|
+
},
|
|
901
|
+
/* ---------- 多选(showCheckbox 开启时有意义) ---------- */
|
|
902
|
+
/** 跨页累计选中的行 */
|
|
903
|
+
get selectedRows() {
|
|
904
|
+
var t;
|
|
905
|
+
return ((t = a.value) == null ? void 0 : t.selectedRows) ?? [];
|
|
906
|
+
},
|
|
907
|
+
/** 某行当前是否选中 */
|
|
908
|
+
isRowSelected: (t) => {
|
|
909
|
+
var n;
|
|
910
|
+
return ((n = a.value) == null ? void 0 : n.isRowSelected(t)) ?? !1;
|
|
911
|
+
},
|
|
912
|
+
/** 切换某行选中态(selected 缺省时取反) */
|
|
913
|
+
toggleRowSelection: (t, n) => {
|
|
914
|
+
var i;
|
|
915
|
+
return (i = a.value) == null ? void 0 : i.toggleRowSelection(t, n);
|
|
916
|
+
},
|
|
917
|
+
/** 清空全部选中 */
|
|
918
|
+
clearSelection: () => {
|
|
919
|
+
var t;
|
|
920
|
+
return (t = a.value) == null ? void 0 : t.clearSelection();
|
|
921
|
+
},
|
|
922
|
+
/** 选中当前已加载的全部行 */
|
|
923
|
+
selectAllOnPage: () => {
|
|
924
|
+
var t;
|
|
925
|
+
return (t = a.value) == null ? void 0 : t.selectAllOnPage();
|
|
926
|
+
},
|
|
927
|
+
/** 反选当前已加载的行 */
|
|
928
|
+
invertSelectionOnPage: () => {
|
|
929
|
+
var t;
|
|
930
|
+
return (t = a.value) == null ? void 0 : t.invertSelectionOnPage();
|
|
931
|
+
},
|
|
932
|
+
/* ---------- 筛选面板(转发 YsFilterPanel) ---------- */
|
|
933
|
+
/** 文本搜索框当前值 */
|
|
934
|
+
get keyword() {
|
|
935
|
+
var t;
|
|
936
|
+
return ((t = o.value) == null ? void 0 : t.keyword) ?? "";
|
|
937
|
+
},
|
|
938
|
+
/** 当前聚合后的查询条件 */
|
|
939
|
+
get filter() {
|
|
940
|
+
var t;
|
|
941
|
+
return (t = o.value) == null ? void 0 : t.filter;
|
|
942
|
+
},
|
|
943
|
+
/** 条件区是否展开 */
|
|
944
|
+
get filterExpanded() {
|
|
945
|
+
var t;
|
|
946
|
+
return ((t = o.value) == null ? void 0 : t.expanded) ?? !1;
|
|
947
|
+
},
|
|
948
|
+
/** 切换条件区展开/折叠 */
|
|
949
|
+
toggleFilter: () => {
|
|
950
|
+
var t;
|
|
951
|
+
return (t = o.value) == null ? void 0 : t.toggle();
|
|
952
|
+
},
|
|
953
|
+
/** 重置筛选(清空文本 + 重置已注册子项 + 派发 reset) */
|
|
954
|
+
resetFilter: () => {
|
|
955
|
+
var t;
|
|
956
|
+
return (t = o.value) == null ? void 0 : t.reset();
|
|
957
|
+
},
|
|
958
|
+
/* ---------- 子组件实例(未平铺能力的逃生舱) ---------- */
|
|
959
|
+
/** YsInfiniteList 实例 */
|
|
860
960
|
get list() {
|
|
861
|
-
return
|
|
961
|
+
return a.value;
|
|
862
962
|
},
|
|
863
963
|
/** YsFilterPanel 实例 */
|
|
864
964
|
get filterPanel() {
|
|
865
|
-
return
|
|
965
|
+
return o.value;
|
|
866
966
|
}
|
|
867
967
|
});
|
|
868
|
-
function
|
|
869
|
-
|
|
968
|
+
function c(t, n) {
|
|
969
|
+
l("data-loaded", t, n);
|
|
870
970
|
}
|
|
871
|
-
return (
|
|
872
|
-
e.showFilter ? (
|
|
873
|
-
Q(
|
|
971
|
+
return (t, n) => (d(), m("view", rt, [
|
|
972
|
+
e.showFilter ? (d(), m("view", st, [
|
|
973
|
+
Q(Me, {
|
|
874
974
|
ref_key: "filterRef",
|
|
875
|
-
ref:
|
|
975
|
+
ref: o,
|
|
876
976
|
placeholder: e.placeholder,
|
|
877
977
|
"filter-text": e.filterText,
|
|
878
978
|
"search-button-text": e.searchButtonText,
|
|
@@ -883,20 +983,20 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
883
983
|
"text-filter-builder": e.textFilterBuilder,
|
|
884
984
|
"custom-class": e.filterCustomClass,
|
|
885
985
|
"custom-style": e.filterCustomStyle,
|
|
886
|
-
onSearch: n[0] || (n[0] = (i) =>
|
|
887
|
-
onReset: n[1] || (n[1] = (i) =>
|
|
888
|
-
onExpandChange: n[2] || (n[2] = (i) =>
|
|
986
|
+
onSearch: n[0] || (n[0] = (i) => l("search", i)),
|
|
987
|
+
onReset: n[1] || (n[1] = (i) => l("reset")),
|
|
988
|
+
onExpandChange: n[2] || (n[2] = (i) => l("expand-change", i))
|
|
889
989
|
}, {
|
|
890
|
-
default:
|
|
891
|
-
|
|
990
|
+
default: M(() => [
|
|
991
|
+
T(t.$slots, "filter-default")
|
|
892
992
|
]),
|
|
893
993
|
_: 3
|
|
894
994
|
}, 8, ["placeholder", "filter-text", "search-button-text", "reset-button-text", "default-expanded", "show-search", "show-reset", "text-filter-builder", "custom-class", "custom-style"])
|
|
895
995
|
])) : w("", !0),
|
|
896
|
-
|
|
996
|
+
f("view", ut, [
|
|
897
997
|
Q(Fe, {
|
|
898
998
|
ref_key: "listRef",
|
|
899
|
-
ref:
|
|
999
|
+
ref: a,
|
|
900
1000
|
"data-fun": e.dataFun,
|
|
901
1001
|
"page-size": e.pageSize,
|
|
902
1002
|
threshold: e.threshold,
|
|
@@ -904,14 +1004,14 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
904
1004
|
immediate: e.immediate,
|
|
905
1005
|
"show-checkbox": e.showCheckbox,
|
|
906
1006
|
height: "100%",
|
|
907
|
-
class:
|
|
908
|
-
style:
|
|
909
|
-
onDataLoaded: n[3] || (n[3] = (i, _) =>
|
|
910
|
-
onSelectionChange: n[4] || (n[4] = (i) =>
|
|
911
|
-
onError: n[5] || (n[5] = (i) =>
|
|
1007
|
+
class: R(e.listCustomClass),
|
|
1008
|
+
style: O(e.listCustomStyle),
|
|
1009
|
+
onDataLoaded: n[3] || (n[3] = (i, _) => c(i, _)),
|
|
1010
|
+
onSelectionChange: n[4] || (n[4] = (i) => l("selection-change", i)),
|
|
1011
|
+
onError: n[5] || (n[5] = (i) => l("error", i))
|
|
912
1012
|
}, {
|
|
913
|
-
default:
|
|
914
|
-
|
|
1013
|
+
default: M(({ row: i, index: _ }) => [
|
|
1014
|
+
T(t.$slots, "list-default", {
|
|
915
1015
|
row: i,
|
|
916
1016
|
index: _
|
|
917
1017
|
})
|
|
@@ -919,14 +1019,14 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
919
1019
|
_: 3
|
|
920
1020
|
}, 8, ["data-fun", "page-size", "threshold", "row-key", "immediate", "show-checkbox", "class", "style"])
|
|
921
1021
|
]),
|
|
922
|
-
e.showCommandBar ? (
|
|
1022
|
+
e.showCommandBar ? (d(), m("view", ot, [
|
|
923
1023
|
Q(it, {
|
|
924
1024
|
actions: e.actions,
|
|
925
1025
|
"custom-class": e.cmdCustomClass,
|
|
926
1026
|
"custom-style": e.cmdCustomStyle
|
|
927
1027
|
}, {
|
|
928
|
-
default:
|
|
929
|
-
|
|
1028
|
+
default: M(() => [
|
|
1029
|
+
T(t.$slots, "cmd-default")
|
|
930
1030
|
]),
|
|
931
1031
|
_: 3
|
|
932
1032
|
}, 8, ["actions", "custom-class", "custom-style"])
|
|
@@ -939,11 +1039,11 @@ export {
|
|
|
939
1039
|
it as YsCommandBar,
|
|
940
1040
|
mt as YsDateFilterItem,
|
|
941
1041
|
vt as YsDateRangeFilterItem,
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1042
|
+
gt as YsEnumFilterItem,
|
|
1043
|
+
K as YsFilterItemLayout,
|
|
1044
|
+
Me as YsFilterPanel,
|
|
945
1045
|
Fe as YsInfiniteList,
|
|
946
|
-
|
|
1046
|
+
ht as YsInfinitePage,
|
|
947
1047
|
yt as YsTextFilterItem,
|
|
948
1048
|
Be as useFilterPanelItem
|
|
949
1049
|
};
|