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