@ys-knife-crud/taro 0.0.5 → 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.css +1 -1
- package/dist/index.js +508 -416
- 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
|
|
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,81 +47,81 @@ 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
|
|
52
|
-
function S(
|
|
53
|
-
return
|
|
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
|
+
function S(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
|
-
function
|
|
60
|
-
|
|
59
|
+
function k() {
|
|
60
|
+
y.value = /* @__PURE__ */ new Map();
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
for (const
|
|
65
|
-
|
|
62
|
+
function r() {
|
|
63
|
+
const v = new Map(y.value);
|
|
64
|
+
for (const p of o.value) v.set(String(p[l.rowKey]), p);
|
|
65
|
+
y.value = v;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
for (const
|
|
70
|
-
const
|
|
71
|
-
|
|
67
|
+
function g() {
|
|
68
|
+
const v = new Map(y.value);
|
|
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(
|
|
76
|
-
async function
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
|
|
75
|
+
X(C, (v) => a("selection-change", [...v]));
|
|
76
|
+
async function F(v) {
|
|
77
|
+
if (v) {
|
|
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
|
|
86
|
-
|
|
87
|
-
} catch (
|
|
88
|
-
|
|
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
|
+
} catch (p) {
|
|
88
|
+
i.value = p, a("error", p);
|
|
89
89
|
} finally {
|
|
90
|
-
|
|
90
|
+
v ? t.value = !1 : c.value = !1, i.value || ne();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
function j() {
|
|
94
|
-
|
|
94
|
+
F(!0);
|
|
95
95
|
}
|
|
96
96
|
function D() {
|
|
97
|
-
|
|
97
|
+
n.value = !0, F(!1);
|
|
98
98
|
}
|
|
99
99
|
function le() {
|
|
100
|
-
|
|
100
|
+
n.value && !c.value && !t.value && j();
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const J = ae();
|
|
103
103
|
async function ne() {
|
|
104
|
-
if (!
|
|
104
|
+
if (!n.value || c.value || t.value) return;
|
|
105
105
|
await ie();
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
ye().in(
|
|
109
|
-
const
|
|
110
|
-
E &&
|
|
106
|
+
const v = J == null ? void 0 : J.proxy;
|
|
107
|
+
v && await new Promise((p) => {
|
|
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
|
-
hasMore:
|
|
124
|
+
hasMore: n,
|
|
125
125
|
/** 重置并从第一页重新加载 */
|
|
126
126
|
reload: D,
|
|
127
127
|
/** 刷新:重置为第一页重新加载(与 YsTable 的 refresh 同名同义) */
|
|
@@ -129,95 +129,93 @@ 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
|
-
selectedRows:
|
|
134
|
+
selectedRows: C,
|
|
135
135
|
/** 某行当前是否选中 */
|
|
136
136
|
isRowSelected: S,
|
|
137
137
|
/** 切换某行选中态(selected 缺省时取反) */
|
|
138
|
-
toggleRowSelection:
|
|
138
|
+
toggleRowSelection: P,
|
|
139
139
|
/** 清空全部选中 */
|
|
140
|
-
clearSelection:
|
|
140
|
+
clearSelection: k,
|
|
141
141
|
/** 选中当前已加载的全部行 */
|
|
142
|
-
selectAllOnPage:
|
|
142
|
+
selectAllOnPage: r,
|
|
143
143
|
/** 反选当前已加载的行 */
|
|
144
|
-
invertSelectionOnPage:
|
|
145
|
-
}), (
|
|
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
|
-
(d(!0),
|
|
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 ? (d(),
|
|
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(
|
|
163
|
-
], 42, pe)) :
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
row:
|
|
167
|
-
index:
|
|
162
|
+
S(h) ? (d(), m("text", ke, "✓")) : w("", !0)
|
|
163
|
+
], 42, pe)) : w("", !0),
|
|
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
|
-
|
|
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
|
-
])) :
|
|
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
|
-
])) :
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
])) : w("", !0),
|
|
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
|
-
])) :
|
|
193
|
-
!
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
])) : w("", !0),
|
|
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: {
|
|
219
|
-
/** 文本搜索框的值(v-model) */
|
|
220
|
-
modelValue: { type: String, default: "" },
|
|
221
219
|
/** 文本搜索框占位文案 */
|
|
222
220
|
placeholder: { type: String, default: "请输入" },
|
|
223
221
|
/** 展开/折叠触发器文案,默认「筛选」 */
|
|
@@ -255,103 +253,104 @@ const Ie = { class: "yk-filter-panel__bar" }, Ve = { class: "yk-filter-panel__tr
|
|
|
255
253
|
/** 外部自定义样式:追加到根节点上的内联样式字符串 */
|
|
256
254
|
customStyle: { type: String, default: "" }
|
|
257
255
|
},
|
|
258
|
-
emits: ["
|
|
259
|
-
setup(e, { expose:
|
|
260
|
-
const
|
|
261
|
-
function
|
|
262
|
-
return
|
|
263
|
-
|
|
256
|
+
emits: ["search", "reset", "expand-change"],
|
|
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);
|
|
264
262
|
};
|
|
265
263
|
}
|
|
266
|
-
ce(te,
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
_ && o.push(_);
|
|
264
|
+
ce(te, _);
|
|
265
|
+
const b = I(() => {
|
|
266
|
+
const r = n.value.trim();
|
|
267
|
+
return !r || !l.textFilterBuilder ? null : l.textFilterBuilder(r) ?? null;
|
|
268
|
+
}), y = I(() => {
|
|
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);
|
|
277
274
|
}
|
|
278
|
-
return
|
|
275
|
+
return r.length === 0 ? me() : r.length === 1 ? r[0] : ve.createAnd(...r);
|
|
279
276
|
});
|
|
280
|
-
function
|
|
281
|
-
|
|
277
|
+
function C() {
|
|
278
|
+
t.value = !t.value, a("expand-change", t.value);
|
|
282
279
|
}
|
|
283
|
-
function
|
|
284
|
-
const
|
|
285
|
-
|
|
280
|
+
function S(r) {
|
|
281
|
+
const g = r.detail;
|
|
282
|
+
n.value = (g == null ? void 0 : g.value) ?? "";
|
|
286
283
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
284
|
+
function P() {
|
|
285
|
+
a("search", y.value);
|
|
289
286
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
for (const
|
|
293
|
-
|
|
287
|
+
function k() {
|
|
288
|
+
n.value = "";
|
|
289
|
+
for (const r of i.value) r.reset();
|
|
290
|
+
a("reset");
|
|
294
291
|
}
|
|
295
|
-
return
|
|
292
|
+
return u({
|
|
293
|
+
/** 文本搜索框当前值(只读读取用,外部不能写入) */
|
|
294
|
+
keyword: n,
|
|
296
295
|
/** 条件区是否展开 */
|
|
297
|
-
expanded:
|
|
296
|
+
expanded: t,
|
|
298
297
|
/** 当前聚合后的查询条件 */
|
|
299
|
-
filter:
|
|
298
|
+
filter: y,
|
|
300
299
|
/** 切换条件区展开/折叠 */
|
|
301
|
-
toggle:
|
|
300
|
+
toggle: C,
|
|
302
301
|
/** 重置(清空文本 + 重置已注册子项 + 派发 reset) */
|
|
303
|
-
reset:
|
|
304
|
-
}), (
|
|
305
|
-
class:
|
|
306
|
-
style:
|
|
302
|
+
reset: k
|
|
303
|
+
}), (r, g) => (d(), m("view", {
|
|
304
|
+
class: R(["yk-filter-panel", e.customClass]),
|
|
305
|
+
style: O(e.customStyle)
|
|
307
306
|
}, [
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
f("view", Ie, [
|
|
308
|
+
c.value ? (d(), m("view", {
|
|
310
309
|
key: 0,
|
|
311
310
|
class: "yk-filter-panel__trigger",
|
|
312
|
-
onTap:
|
|
311
|
+
onTap: C
|
|
313
312
|
}, [
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
], 32)) :
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
f("text", Pe, $(e.filterText), 1),
|
|
314
|
+
f("text", Te, $(t.value ? "▲" : "▼"), 1)
|
|
315
|
+
], 32)) : w("", !0),
|
|
316
|
+
f("view", Re, [
|
|
317
|
+
f("input", {
|
|
319
318
|
class: "yk-filter-panel__input",
|
|
320
|
-
value:
|
|
319
|
+
value: n.value,
|
|
321
320
|
placeholder: e.placeholder,
|
|
322
321
|
"placeholder-class": "yk-filter-panel__placeholder",
|
|
323
|
-
onInput:
|
|
324
|
-
onConfirm:
|
|
325
|
-
}, null, 40,
|
|
322
|
+
onInput: S,
|
|
323
|
+
onConfirm: P
|
|
324
|
+
}, null, 40, Ve)
|
|
326
325
|
]),
|
|
327
|
-
|
|
328
|
-
e.showSearch ? (d(),
|
|
326
|
+
f("view", Ye, [
|
|
327
|
+
e.showSearch ? (d(), m("view", {
|
|
329
328
|
key: 0,
|
|
330
329
|
class: "yk-filter-panel__btn yk-filter-panel__btn--primary",
|
|
331
|
-
onTap:
|
|
330
|
+
onTap: P
|
|
332
331
|
}, [
|
|
333
|
-
|
|
334
|
-
], 32)) :
|
|
335
|
-
e.showReset ? (d(),
|
|
332
|
+
f("text", null, $(e.searchButtonText), 1)
|
|
333
|
+
], 32)) : w("", !0),
|
|
334
|
+
e.showReset ? (d(), m("view", {
|
|
336
335
|
key: 1,
|
|
337
336
|
class: "yk-filter-panel__btn yk-filter-panel__btn--default",
|
|
338
|
-
onTap:
|
|
337
|
+
onTap: k
|
|
339
338
|
}, [
|
|
340
|
-
|
|
341
|
-
], 32)) :
|
|
339
|
+
f("text", null, $(e.resetButtonText), 1)
|
|
340
|
+
], 32)) : w("", !0)
|
|
342
341
|
])
|
|
343
342
|
]),
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
c.value ? fe((d(), m("view", Ee, [
|
|
344
|
+
T(r.$slots, "default")
|
|
346
345
|
], 512)), [
|
|
347
|
-
[de,
|
|
348
|
-
]) :
|
|
346
|
+
[de, t.value]
|
|
347
|
+
]) : w("", !0)
|
|
349
348
|
], 6));
|
|
350
349
|
}
|
|
351
|
-
}), Ae = { class: "yk-filter-item" },
|
|
350
|
+
}), Ae = { class: "yk-filter-item" }, Ne = {
|
|
352
351
|
key: 0,
|
|
353
352
|
class: "yk-filter-item__label"
|
|
354
|
-
},
|
|
353
|
+
}, qe = { class: "yk-filter-item__control" }, K = /* @__PURE__ */ Y({
|
|
355
354
|
name: "YsFilterItemLayout",
|
|
356
355
|
__name: "filter-item-layout",
|
|
357
356
|
props: {
|
|
@@ -361,97 +360,97 @@ const Ie = { class: "yk-filter-panel__bar" }, Ve = { class: "yk-filter-panel__tr
|
|
|
361
360
|
api: { type: Object, required: !0 }
|
|
362
361
|
},
|
|
363
362
|
setup(e) {
|
|
364
|
-
return Be(e.api), (
|
|
365
|
-
e.label ? (d(),
|
|
366
|
-
|
|
367
|
-
|
|
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")
|
|
368
367
|
])
|
|
369
368
|
]));
|
|
370
369
|
}
|
|
371
370
|
});
|
|
372
371
|
function De(e) {
|
|
373
|
-
const
|
|
372
|
+
const u = x(
|
|
374
373
|
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
375
374
|
);
|
|
376
|
-
function
|
|
377
|
-
return
|
|
375
|
+
function s(o) {
|
|
376
|
+
return o == null || o.trim() === "";
|
|
378
377
|
}
|
|
379
|
-
const
|
|
380
|
-
function
|
|
381
|
-
|
|
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 : "";
|
|
382
381
|
}
|
|
383
|
-
return { value:
|
|
382
|
+
return { value: u, filter: l, reset: a };
|
|
384
383
|
}
|
|
385
384
|
function Le(e) {
|
|
386
|
-
const
|
|
385
|
+
const u = x(
|
|
387
386
|
typeof e.defaultValue == "string" ? e.defaultValue : ""
|
|
388
387
|
);
|
|
389
|
-
function
|
|
390
|
-
return
|
|
388
|
+
function s(o) {
|
|
389
|
+
return o == null || o.trim() === "";
|
|
391
390
|
}
|
|
392
|
-
const
|
|
393
|
-
function
|
|
394
|
-
|
|
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 : "";
|
|
395
394
|
}
|
|
396
|
-
return { value:
|
|
395
|
+
return { value: u, filter: l, reset: a };
|
|
397
396
|
}
|
|
398
|
-
function
|
|
399
|
-
function
|
|
400
|
-
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;
|
|
401
400
|
}
|
|
402
|
-
const
|
|
403
|
-
function
|
|
404
|
-
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];
|
|
405
404
|
}
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
const [
|
|
409
|
-
return A(e.propertyPath,
|
|
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]));
|
|
410
409
|
});
|
|
411
|
-
function
|
|
412
|
-
|
|
410
|
+
function c() {
|
|
411
|
+
l.value = s;
|
|
413
412
|
}
|
|
414
|
-
return { value:
|
|
413
|
+
return { value: l, filter: o, reset: c };
|
|
415
414
|
}
|
|
416
415
|
function Z(e) {
|
|
417
416
|
return typeof e == "string" || typeof e == "number" ? e : null;
|
|
418
417
|
}
|
|
419
418
|
function ee(e) {
|
|
420
419
|
return Array.isArray(e) ? e.filter(
|
|
421
|
-
(
|
|
420
|
+
(u) => typeof u == "string" || typeof u == "number"
|
|
422
421
|
) : [];
|
|
423
422
|
}
|
|
424
|
-
function
|
|
425
|
-
const
|
|
426
|
-
|
|
423
|
+
function ze(e) {
|
|
424
|
+
const u = e.multiple === !0, s = x(
|
|
425
|
+
u ? ee(e.defaultValue) : Z(e.defaultValue)
|
|
427
426
|
);
|
|
428
|
-
function
|
|
429
|
-
const
|
|
430
|
-
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() === "";
|
|
431
430
|
}
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
const
|
|
438
|
-
return
|
|
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));
|
|
439
438
|
}
|
|
440
439
|
return A(
|
|
441
440
|
e.propertyPath,
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
U.In,
|
|
442
|
+
N(t)
|
|
444
443
|
);
|
|
445
444
|
}
|
|
446
|
-
const
|
|
447
|
-
return
|
|
445
|
+
const c = s.value;
|
|
446
|
+
return c == null ? null : A(e.propertyPath, e.op, N(c));
|
|
448
447
|
});
|
|
449
|
-
function
|
|
450
|
-
|
|
448
|
+
function o() {
|
|
449
|
+
s.value = u ? ee(e.defaultValue) : Z(e.defaultValue);
|
|
451
450
|
}
|
|
452
|
-
return { value:
|
|
451
|
+
return { value: s, filter: a, reset: o };
|
|
453
452
|
}
|
|
454
|
-
const
|
|
453
|
+
const Ke = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt = /* @__PURE__ */ Y({
|
|
455
454
|
name: "YsTextFilterItem",
|
|
456
455
|
__name: "text-filter-item",
|
|
457
456
|
props: {
|
|
@@ -469,37 +468,37 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
469
468
|
/** 占位文本 */
|
|
470
469
|
placeholder: { type: String, default: "请输入" }
|
|
471
470
|
},
|
|
472
|
-
setup(e, { expose:
|
|
473
|
-
const
|
|
474
|
-
function
|
|
475
|
-
const
|
|
476
|
-
|
|
471
|
+
setup(e, { expose: u }) {
|
|
472
|
+
const s = e, { value: l, filter: a, reset: o } = De(s);
|
|
473
|
+
function c(n) {
|
|
474
|
+
const i = n.detail;
|
|
475
|
+
l.value = (i == null ? void 0 : i.value) ?? "";
|
|
477
476
|
}
|
|
478
|
-
const
|
|
477
|
+
const t = {
|
|
479
478
|
get filter() {
|
|
480
|
-
return
|
|
479
|
+
return a.value;
|
|
481
480
|
},
|
|
482
|
-
reset:
|
|
481
|
+
reset: o
|
|
483
482
|
};
|
|
484
|
-
return
|
|
483
|
+
return u(t), (n, i) => (d(), z(K, {
|
|
485
484
|
label: e.label,
|
|
486
|
-
api:
|
|
485
|
+
api: t
|
|
487
486
|
}, {
|
|
488
|
-
default:
|
|
489
|
-
|
|
490
|
-
|
|
487
|
+
default: M(() => [
|
|
488
|
+
f("view", Ke, [
|
|
489
|
+
f("input", {
|
|
491
490
|
class: "yk-filter-item__input",
|
|
492
|
-
value:
|
|
491
|
+
value: B(l),
|
|
493
492
|
placeholder: e.placeholder,
|
|
494
493
|
"placeholder-class": "yk-filter-item__placeholder",
|
|
495
|
-
onInput:
|
|
494
|
+
onInput: c
|
|
496
495
|
}, null, 40, je)
|
|
497
496
|
])
|
|
498
497
|
]),
|
|
499
498
|
_: 1
|
|
500
499
|
}, 8, ["label"]));
|
|
501
500
|
}
|
|
502
|
-
}),
|
|
501
|
+
}), Je = ["value", "start", "end"], Qe = { class: "yk-filter-item__picker" }, mt = /* @__PURE__ */ Y({
|
|
503
502
|
name: "YsDateFilterItem",
|
|
504
503
|
__name: "date-filter-item",
|
|
505
504
|
props: {
|
|
@@ -521,52 +520,52 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
521
520
|
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
522
521
|
end: { type: String, default: "" }
|
|
523
522
|
},
|
|
524
|
-
setup(e, { expose:
|
|
525
|
-
const
|
|
526
|
-
function i
|
|
527
|
-
const
|
|
528
|
-
|
|
523
|
+
setup(e, { expose: u }) {
|
|
524
|
+
const s = e, { value: l, filter: a, reset: o } = Le(s);
|
|
525
|
+
function c(i) {
|
|
526
|
+
const _ = i.detail;
|
|
527
|
+
l.value = (_ == null ? void 0 : _.value) ?? "";
|
|
529
528
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
529
|
+
function t() {
|
|
530
|
+
l.value = "";
|
|
532
531
|
}
|
|
533
|
-
const
|
|
532
|
+
const n = {
|
|
534
533
|
get filter() {
|
|
535
|
-
return
|
|
534
|
+
return a.value;
|
|
536
535
|
},
|
|
537
|
-
reset:
|
|
536
|
+
reset: o
|
|
538
537
|
};
|
|
539
|
-
return
|
|
538
|
+
return u(n), (i, _) => (d(), z(K, {
|
|
540
539
|
label: e.label,
|
|
541
|
-
api:
|
|
540
|
+
api: n
|
|
542
541
|
}, {
|
|
543
|
-
default:
|
|
544
|
-
|
|
542
|
+
default: M(() => [
|
|
543
|
+
f("picker", {
|
|
545
544
|
class: "yk-filter-item__picker-trigger",
|
|
546
545
|
mode: "date",
|
|
547
|
-
value:
|
|
546
|
+
value: B(l),
|
|
548
547
|
start: e.start,
|
|
549
548
|
end: e.end,
|
|
550
|
-
onChange:
|
|
549
|
+
onChange: c
|
|
551
550
|
}, [
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
class:
|
|
555
|
-
},
|
|
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)
|
|
556
555
|
])
|
|
557
|
-
], 40,
|
|
558
|
-
|
|
556
|
+
], 40, Je),
|
|
557
|
+
B(l) ? (d(), m("view", {
|
|
559
558
|
key: 0,
|
|
560
559
|
class: "yk-filter-item__clear",
|
|
561
|
-
onTap: W(
|
|
562
|
-
}, [...
|
|
563
|
-
|
|
564
|
-
])], 32)) :
|
|
560
|
+
onTap: W(t, ["stop"])
|
|
561
|
+
}, [..._[0] || (_[0] = [
|
|
562
|
+
f("text", null, "✕", -1)
|
|
563
|
+
])], 32)) : w("", !0)
|
|
565
564
|
]),
|
|
566
565
|
_: 1
|
|
567
566
|
}, 8, ["label"]));
|
|
568
567
|
}
|
|
569
|
-
}),
|
|
568
|
+
}), Ue = ["value", "start", "end"], Ge = { class: "yk-filter-item__picker" }, He = ["value", "start", "end"], We = { class: "yk-filter-item__picker" }, vt = /* @__PURE__ */ Y({
|
|
570
569
|
name: "YsDateRangeFilterItem",
|
|
571
570
|
__name: "date-range-filter-item",
|
|
572
571
|
props: {
|
|
@@ -588,72 +587,72 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
588
587
|
/** 可选范围上限(YYYY-MM-DD),空串表示不限制 */
|
|
589
588
|
end: { type: String, default: "" }
|
|
590
589
|
},
|
|
591
|
-
setup(e, { expose:
|
|
592
|
-
const
|
|
593
|
-
function
|
|
594
|
-
const
|
|
595
|
-
S[
|
|
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;
|
|
596
595
|
}
|
|
597
|
-
function
|
|
598
|
-
const
|
|
599
|
-
|
|
596
|
+
function t(b) {
|
|
597
|
+
const y = b.detail;
|
|
598
|
+
c(0, (y == null ? void 0 : y.value) ?? "");
|
|
600
599
|
}
|
|
601
|
-
function
|
|
602
|
-
const
|
|
603
|
-
|
|
600
|
+
function n(b) {
|
|
601
|
+
const y = b.detail;
|
|
602
|
+
c(1, (y == null ? void 0 : y.value) ?? "");
|
|
604
603
|
}
|
|
605
|
-
function
|
|
606
|
-
|
|
604
|
+
function i() {
|
|
605
|
+
l.value = null;
|
|
607
606
|
}
|
|
608
|
-
const
|
|
607
|
+
const _ = {
|
|
609
608
|
get filter() {
|
|
610
|
-
return
|
|
609
|
+
return a.value;
|
|
611
610
|
},
|
|
612
|
-
reset:
|
|
611
|
+
reset: o
|
|
613
612
|
};
|
|
614
|
-
return
|
|
613
|
+
return u(_), (b, y) => (d(), z(K, {
|
|
615
614
|
label: e.label,
|
|
616
|
-
api:
|
|
615
|
+
api: _
|
|
617
616
|
}, {
|
|
618
|
-
default:
|
|
619
|
-
var
|
|
617
|
+
default: M(() => {
|
|
618
|
+
var C, S, P, k, r, g;
|
|
620
619
|
return [
|
|
621
|
-
|
|
620
|
+
f("picker", {
|
|
622
621
|
class: "yk-filter-item__picker-trigger",
|
|
623
622
|
mode: "date",
|
|
624
|
-
value: ((
|
|
623
|
+
value: ((C = B(l)) == null ? void 0 : C[0]) ?? "",
|
|
625
624
|
start: e.start,
|
|
626
625
|
end: e.end,
|
|
627
|
-
onChange:
|
|
626
|
+
onChange: t
|
|
628
627
|
}, [
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
class:
|
|
632
|
-
},
|
|
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)
|
|
633
632
|
])
|
|
634
|
-
], 40,
|
|
635
|
-
|
|
636
|
-
|
|
633
|
+
], 40, Ue),
|
|
634
|
+
y[1] || (y[1] = f("text", { class: "yk-filter-item__sep" }, "至", -1)),
|
|
635
|
+
f("picker", {
|
|
637
636
|
class: "yk-filter-item__picker-trigger",
|
|
638
637
|
mode: "date",
|
|
639
|
-
value: ((
|
|
638
|
+
value: ((k = B(l)) == null ? void 0 : k[1]) ?? "",
|
|
640
639
|
start: e.start,
|
|
641
640
|
end: e.end,
|
|
642
|
-
onChange:
|
|
641
|
+
onChange: n
|
|
643
642
|
}, [
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
class:
|
|
647
|
-
},
|
|
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)
|
|
648
647
|
])
|
|
649
648
|
], 40, He),
|
|
650
|
-
|
|
649
|
+
B(l) ? (d(), m("view", {
|
|
651
650
|
key: 0,
|
|
652
651
|
class: "yk-filter-item__clear",
|
|
653
|
-
onTap: W(
|
|
654
|
-
}, [...
|
|
655
|
-
|
|
656
|
-
])], 32)) :
|
|
652
|
+
onTap: W(i, ["stop"])
|
|
653
|
+
}, [...y[0] || (y[0] = [
|
|
654
|
+
f("text", null, "✕", -1)
|
|
655
|
+
])], 32)) : w("", !0)
|
|
657
656
|
];
|
|
658
657
|
}),
|
|
659
658
|
_: 1
|
|
@@ -665,7 +664,7 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
665
664
|
}, Ze = {
|
|
666
665
|
key: 0,
|
|
667
666
|
class: "yk-filter-item__chips-empty"
|
|
668
|
-
}, 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({
|
|
669
668
|
name: "YsEnumFilterItem",
|
|
670
669
|
__name: "enum-filter-item",
|
|
671
670
|
props: {
|
|
@@ -689,82 +688,82 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
689
688
|
/** 单选模式是否显示清除按钮 */
|
|
690
689
|
clearable: { type: Boolean, default: !0 }
|
|
691
690
|
},
|
|
692
|
-
setup(e, { expose:
|
|
693
|
-
const
|
|
691
|
+
setup(e, { expose: u }) {
|
|
692
|
+
const s = e, { value: l, filter: a, reset: o } = ze(s), c = x([]), t = x(!1);
|
|
694
693
|
G(async () => {
|
|
695
|
-
|
|
694
|
+
t.value = !0;
|
|
696
695
|
try {
|
|
697
|
-
|
|
696
|
+
c.value = await s.optionsSource();
|
|
698
697
|
} finally {
|
|
699
|
-
|
|
698
|
+
t.value = !1;
|
|
700
699
|
}
|
|
701
700
|
});
|
|
702
|
-
const
|
|
703
|
-
const
|
|
704
|
-
return
|
|
705
|
-
}),
|
|
706
|
-
var
|
|
707
|
-
const
|
|
708
|
-
return
|
|
701
|
+
const n = I(() => {
|
|
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
|
+
}), i = I(() => {
|
|
705
|
+
var r;
|
|
706
|
+
const k = n.value;
|
|
707
|
+
return k >= 0 ? ((r = c.value[k]) == null ? void 0 : r.label) ?? "" : "";
|
|
709
708
|
});
|
|
710
|
-
function
|
|
711
|
-
const
|
|
712
|
-
|
|
709
|
+
function _(k) {
|
|
710
|
+
const r = k.detail, g = Number((r == null ? void 0 : r.value) ?? -1), F = c.value[g];
|
|
711
|
+
F && (l.value = F.value);
|
|
713
712
|
}
|
|
714
|
-
function
|
|
715
|
-
|
|
713
|
+
function b() {
|
|
714
|
+
l.value = null;
|
|
716
715
|
}
|
|
717
|
-
const
|
|
718
|
-
() => Array.isArray(
|
|
716
|
+
const y = I(
|
|
717
|
+
() => Array.isArray(l.value) ? l.value : []
|
|
719
718
|
);
|
|
720
|
-
function
|
|
721
|
-
return
|
|
719
|
+
function C(k) {
|
|
720
|
+
return y.value.some((r) => String(r) === String(k.value));
|
|
722
721
|
}
|
|
723
|
-
function S(
|
|
724
|
-
const
|
|
725
|
-
|
|
722
|
+
function S(k) {
|
|
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;
|
|
726
725
|
}
|
|
727
|
-
const
|
|
726
|
+
const P = {
|
|
728
727
|
get filter() {
|
|
729
|
-
return
|
|
728
|
+
return a.value;
|
|
730
729
|
},
|
|
731
|
-
reset:
|
|
730
|
+
reset: o
|
|
732
731
|
};
|
|
733
|
-
return
|
|
732
|
+
return u(P), (k, r) => (d(), z(K, {
|
|
734
733
|
label: e.label,
|
|
735
|
-
api:
|
|
734
|
+
api: P
|
|
736
735
|
}, {
|
|
737
|
-
default:
|
|
738
|
-
e.multiple ? (d(),
|
|
739
|
-
|
|
740
|
-
key: String(
|
|
741
|
-
class:
|
|
742
|
-
onTap: (
|
|
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)
|
|
743
742
|
}, [
|
|
744
|
-
|
|
743
|
+
f("text", null, $(g.label), 1)
|
|
745
744
|
], 42, et))), 128))
|
|
746
|
-
])) : (d(),
|
|
747
|
-
|
|
745
|
+
])) : (d(), m(L, { key: 1 }, [
|
|
746
|
+
f("picker", {
|
|
748
747
|
class: "yk-filter-item__picker-trigger",
|
|
749
748
|
mode: "selector",
|
|
750
|
-
range:
|
|
749
|
+
range: c.value,
|
|
751
750
|
"range-key": "label",
|
|
752
|
-
value:
|
|
753
|
-
onChange:
|
|
751
|
+
value: n.value < 0 ? 0 : n.value,
|
|
752
|
+
onChange: _
|
|
754
753
|
}, [
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
class:
|
|
758
|
-
},
|
|
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)
|
|
759
758
|
])
|
|
760
759
|
], 40, tt),
|
|
761
|
-
e.clearable &&
|
|
760
|
+
e.clearable && i.value ? (d(), m("view", {
|
|
762
761
|
key: 0,
|
|
763
762
|
class: "yk-filter-item__clear",
|
|
764
|
-
onTap: W(
|
|
765
|
-
}, [...
|
|
766
|
-
|
|
767
|
-
])], 32)) :
|
|
763
|
+
onTap: W(b, ["stop"])
|
|
764
|
+
}, [...r[0] || (r[0] = [
|
|
765
|
+
f("text", null, "✕", -1)
|
|
766
|
+
])], 32)) : w("", !0)
|
|
768
767
|
], 64))
|
|
769
768
|
]),
|
|
770
769
|
_: 1
|
|
@@ -785,28 +784,28 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
785
784
|
customStyle: { type: String, default: "" }
|
|
786
785
|
},
|
|
787
786
|
setup(e) {
|
|
788
|
-
async function
|
|
787
|
+
async function u(s) {
|
|
789
788
|
try {
|
|
790
|
-
await
|
|
791
|
-
} catch (
|
|
792
|
-
console.error("[YsCommandBar] action failed:",
|
|
789
|
+
await s.execute(void 0);
|
|
790
|
+
} catch (l) {
|
|
791
|
+
console.error("[YsCommandBar] action failed:", s.name, l);
|
|
793
792
|
}
|
|
794
793
|
}
|
|
795
|
-
return (
|
|
796
|
-
class:
|
|
797
|
-
style:
|
|
794
|
+
return (s, l) => (d(), m("view", {
|
|
795
|
+
class: R(["yk-command-bar", e.customClass]),
|
|
796
|
+
style: O(e.customStyle)
|
|
798
797
|
}, [
|
|
799
|
-
e.actions.length > 0 ? (d(!0),
|
|
800
|
-
key:
|
|
801
|
-
class:
|
|
802
|
-
|
|
803
|
-
{ "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 }
|
|
804
803
|
]]),
|
|
805
|
-
onTap: (
|
|
804
|
+
onTap: (o) => u(a)
|
|
806
805
|
}, [
|
|
807
|
-
|
|
808
|
-
], 42, nt))), 128)) :
|
|
809
|
-
|
|
806
|
+
f("text", at, $(a.desc), 1)
|
|
807
|
+
], 42, nt))), 128)) : w("", !0),
|
|
808
|
+
T(s.$slots, "default")
|
|
810
809
|
], 6));
|
|
811
810
|
}
|
|
812
811
|
}), rt = { class: "yk-infinite-page" }, st = {
|
|
@@ -815,13 +814,11 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
815
814
|
}, ut = { class: "yk-infinite-page__list" }, ot = {
|
|
816
815
|
key: 1,
|
|
817
816
|
class: "yk-infinite-page__cmd"
|
|
818
|
-
},
|
|
817
|
+
}, ht = /* @__PURE__ */ Y({
|
|
819
818
|
name: "YsInfinitePage",
|
|
820
819
|
__name: "infinite-page",
|
|
821
820
|
props: {
|
|
822
821
|
/* ---------- FilterPanel ---------- */
|
|
823
|
-
/** 文本搜索框的值(v-model 绑定内部 FilterPanel) */
|
|
824
|
-
modelValue: { type: String, default: "" },
|
|
825
822
|
/** 是否渲染顶部 FilterPanel,默认 true */
|
|
826
823
|
showFilter: { type: Boolean, default: !0 },
|
|
827
824
|
/** 文本搜索条件构造委托(FilterPanel 唯一入口) */
|
|
@@ -855,31 +852,127 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
855
852
|
listCustomClass: { type: String, default: "" },
|
|
856
853
|
listCustomStyle: { type: String, default: "" }
|
|
857
854
|
},
|
|
858
|
-
emits: ["
|
|
859
|
-
setup(e, { expose:
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
855
|
+
emits: ["search", "reset", "expand-change", "data-loaded", "selection-change", "error"],
|
|
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 实例 */
|
|
863
960
|
get list() {
|
|
864
|
-
return
|
|
961
|
+
return a.value;
|
|
865
962
|
},
|
|
866
963
|
/** YsFilterPanel 实例 */
|
|
867
964
|
get filterPanel() {
|
|
868
|
-
return
|
|
965
|
+
return o.value;
|
|
869
966
|
}
|
|
870
967
|
});
|
|
871
|
-
function
|
|
872
|
-
|
|
968
|
+
function c(t, n) {
|
|
969
|
+
l("data-loaded", t, n);
|
|
873
970
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
return (r, u) => (d(), v("view", rt, [
|
|
878
|
-
e.showFilter ? (d(), v("view", st, [
|
|
879
|
-
J(qe, {
|
|
971
|
+
return (t, n) => (d(), m("view", rt, [
|
|
972
|
+
e.showFilter ? (d(), m("view", st, [
|
|
973
|
+
Q(Me, {
|
|
880
974
|
ref_key: "filterRef",
|
|
881
|
-
ref:
|
|
882
|
-
"model-value": e.modelValue,
|
|
975
|
+
ref: o,
|
|
883
976
|
placeholder: e.placeholder,
|
|
884
977
|
"filter-text": e.filterText,
|
|
885
978
|
"search-button-text": e.searchButtonText,
|
|
@@ -890,21 +983,20 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
890
983
|
"text-filter-builder": e.textFilterBuilder,
|
|
891
984
|
"custom-class": e.filterCustomClass,
|
|
892
985
|
"custom-style": e.filterCustomStyle,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
onExpandChange: u[2] || (u[2] = (h) => t("expand-change", h))
|
|
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))
|
|
897
989
|
}, {
|
|
898
|
-
default:
|
|
899
|
-
|
|
990
|
+
default: M(() => [
|
|
991
|
+
T(t.$slots, "filter-default")
|
|
900
992
|
]),
|
|
901
993
|
_: 3
|
|
902
|
-
}, 8, ["
|
|
903
|
-
])) :
|
|
904
|
-
|
|
905
|
-
|
|
994
|
+
}, 8, ["placeholder", "filter-text", "search-button-text", "reset-button-text", "default-expanded", "show-search", "show-reset", "text-filter-builder", "custom-class", "custom-style"])
|
|
995
|
+
])) : w("", !0),
|
|
996
|
+
f("view", ut, [
|
|
997
|
+
Q(Fe, {
|
|
906
998
|
ref_key: "listRef",
|
|
907
|
-
ref:
|
|
999
|
+
ref: a,
|
|
908
1000
|
"data-fun": e.dataFun,
|
|
909
1001
|
"page-size": e.pageSize,
|
|
910
1002
|
threshold: e.threshold,
|
|
@@ -912,33 +1004,33 @@ const Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
912
1004
|
immediate: e.immediate,
|
|
913
1005
|
"show-checkbox": e.showCheckbox,
|
|
914
1006
|
height: "100%",
|
|
915
|
-
class:
|
|
916
|
-
style:
|
|
917
|
-
onDataLoaded:
|
|
918
|
-
onSelectionChange:
|
|
919
|
-
onError:
|
|
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))
|
|
920
1012
|
}, {
|
|
921
|
-
default:
|
|
922
|
-
|
|
923
|
-
row:
|
|
924
|
-
index:
|
|
1013
|
+
default: M(({ row: i, index: _ }) => [
|
|
1014
|
+
T(t.$slots, "list-default", {
|
|
1015
|
+
row: i,
|
|
1016
|
+
index: _
|
|
925
1017
|
})
|
|
926
1018
|
]),
|
|
927
1019
|
_: 3
|
|
928
1020
|
}, 8, ["data-fun", "page-size", "threshold", "row-key", "immediate", "show-checkbox", "class", "style"])
|
|
929
1021
|
]),
|
|
930
|
-
e.showCommandBar ? (d(),
|
|
931
|
-
|
|
1022
|
+
e.showCommandBar ? (d(), m("view", ot, [
|
|
1023
|
+
Q(it, {
|
|
932
1024
|
actions: e.actions,
|
|
933
1025
|
"custom-class": e.cmdCustomClass,
|
|
934
1026
|
"custom-style": e.cmdCustomStyle
|
|
935
1027
|
}, {
|
|
936
|
-
default:
|
|
937
|
-
|
|
1028
|
+
default: M(() => [
|
|
1029
|
+
T(t.$slots, "cmd-default")
|
|
938
1030
|
]),
|
|
939
1031
|
_: 3
|
|
940
1032
|
}, 8, ["actions", "custom-class", "custom-style"])
|
|
941
|
-
])) :
|
|
1033
|
+
])) : w("", !0)
|
|
942
1034
|
]));
|
|
943
1035
|
}
|
|
944
1036
|
});
|
|
@@ -947,11 +1039,11 @@ export {
|
|
|
947
1039
|
it as YsCommandBar,
|
|
948
1040
|
mt as YsDateFilterItem,
|
|
949
1041
|
vt as YsDateRangeFilterItem,
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1042
|
+
gt as YsEnumFilterItem,
|
|
1043
|
+
K as YsFilterItemLayout,
|
|
1044
|
+
Me as YsFilterPanel,
|
|
953
1045
|
Fe as YsInfiniteList,
|
|
954
|
-
|
|
1046
|
+
ht as YsInfinitePage,
|
|
955
1047
|
yt as YsTextFilterItem,
|
|
956
1048
|
Be as useFilterPanelItem
|
|
957
1049
|
};
|