@ys-knife-crud/taro 0.0.6 → 0.0.9
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 +589 -449
- 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 +10 -9
- 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 +451 -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,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createSelectorQuery as
|
|
3
|
-
import { emptyFilter as
|
|
4
|
-
import './index.css';const
|
|
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
|
+
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 = {
|
|
@@ -16,7 +16,7 @@ import './index.css';const he = ["lower-threshold"], ge = { 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 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(
|
|
51
|
-
const
|
|
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
|
|
56
|
-
const
|
|
57
|
-
|
|
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
|
|
70
|
-
const
|
|
71
|
-
|
|
67
|
+
function w() {
|
|
68
|
+
const g = new Map(y.value);
|
|
69
|
+
for (const p of u.value) {
|
|
70
|
+
const h = String(p[l.rowKey]);
|
|
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
|
-
i.value = p,
|
|
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
|
-
|
|
116
|
-
}), X(() =>
|
|
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
|
-
toggleRowSelection:
|
|
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: z({ height:
|
|
147
|
+
style: z({ height: t.height }),
|
|
148
148
|
"scroll-y": "",
|
|
149
|
-
"lower-threshold":
|
|
150
|
-
onScrolltolower:
|
|
149
|
+
"lower-threshold": t.threshold,
|
|
150
|
+
onScrolltolower: ne
|
|
151
151
|
}, [
|
|
152
|
-
|
|
153
|
-
(f(!0), m(L, null, H(
|
|
154
|
-
key: String(
|
|
155
|
-
class:
|
|
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:
|
|
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
|
-
|
|
166
|
-
row:
|
|
167
|
-
index:
|
|
162
|
+
x(h) ? (f(), m("text", ke, "✓")) : S("", !0)
|
|
163
|
+
], 42, pe)) : S("", !0),
|
|
164
|
+
c("view", _e, [
|
|
165
|
+
B(g.$slots, "default", {
|
|
166
|
+
row: h,
|
|
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
177
|
])) : i.value ? (f(), m("view", we, [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
], 44,
|
|
199
|
+
], 44, ge));
|
|
200
200
|
}
|
|
201
|
-
}),
|
|
202
|
-
function
|
|
203
|
-
const s =
|
|
201
|
+
}), le = Symbol("YsFilterPanel");
|
|
202
|
+
function Ie(t) {
|
|
203
|
+
const s = se(le, null);
|
|
204
204
|
if (!s) return;
|
|
205
205
|
let r = null;
|
|
206
206
|
G(() => {
|
|
207
|
-
r = s(
|
|
208
|
-
}),
|
|
207
|
+
r = s(t);
|
|
208
|
+
}), ue(() => {
|
|
209
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" }, Te = { class: "yk-filter-panel__tr
|
|
|
254
295
|
customStyle: { type: String, default: "" }
|
|
255
296
|
},
|
|
256
297
|
emits: ["search", "reset", "expand-change"],
|
|
257
|
-
setup(
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const b = I(() => {
|
|
266
|
-
const a = n.value.trim();
|
|
267
|
-
return !a || !t.textFilterBuilder ? null : t.textFilterBuilder(a) ?? null;
|
|
268
|
-
}), y = I(() => {
|
|
269
|
-
const a = [];
|
|
270
|
-
b.value && a.push(b.value);
|
|
271
|
-
for (const h of i.value) {
|
|
272
|
-
const F = h.filter;
|
|
273
|
-
F && a.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
|
-
l.value = !l.value, d("expand-change", l.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
|
-
|
|
315
|
+
function x() {
|
|
316
|
+
a("search", b.value);
|
|
286
317
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
d("reset");
|
|
318
|
+
function P() {
|
|
319
|
+
var d;
|
|
320
|
+
n.value = "", (d = i.value) == null || d.reset(), a("reset");
|
|
291
321
|
}
|
|
292
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:
|
|
305
|
-
style: z(
|
|
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" }, Te = { 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 s =
|
|
373
|
-
typeof
|
|
410
|
+
function De(t) {
|
|
411
|
+
const s = _(
|
|
412
|
+
typeof t.defaultValue == "string" ? t.defaultValue : ""
|
|
374
413
|
);
|
|
375
|
-
function r(
|
|
376
|
-
return
|
|
414
|
+
function r(u) {
|
|
415
|
+
return u == null || u.trim() === "";
|
|
377
416
|
}
|
|
378
|
-
const
|
|
379
|
-
function
|
|
380
|
-
s.value = typeof
|
|
417
|
+
const l = $(() => r(s.value) ? null : A(t.propertyPath, t.op, N(s.value)));
|
|
418
|
+
function a() {
|
|
419
|
+
s.value = typeof t.defaultValue == "string" ? t.defaultValue : "";
|
|
381
420
|
}
|
|
382
|
-
return { value: s, filter:
|
|
421
|
+
return { value: s, filter: l, reset: a };
|
|
383
422
|
}
|
|
384
|
-
function Le(
|
|
385
|
-
const s =
|
|
386
|
-
typeof
|
|
423
|
+
function Le(t) {
|
|
424
|
+
const s = _(
|
|
425
|
+
typeof t.defaultValue == "string" ? t.defaultValue : ""
|
|
387
426
|
);
|
|
388
|
-
function r(
|
|
389
|
-
return
|
|
427
|
+
function r(u) {
|
|
428
|
+
return u == null || u.trim() === "";
|
|
390
429
|
}
|
|
391
|
-
const
|
|
392
|
-
function
|
|
393
|
-
s.value = typeof
|
|
430
|
+
const l = $(() => r(s.value) ? null : A(t.propertyPath, t.op, N(s.value)));
|
|
431
|
+
function a() {
|
|
432
|
+
s.value = typeof t.defaultValue == "string" ? t.defaultValue : "";
|
|
394
433
|
}
|
|
395
|
-
return { value: s, filter:
|
|
434
|
+
return { value: s, filter: l, reset: a };
|
|
396
435
|
}
|
|
397
|
-
function ze(
|
|
398
|
-
function s(
|
|
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 r = s(
|
|
402
|
-
function
|
|
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
|
|
406
|
-
if (
|
|
407
|
-
const [
|
|
408
|
-
return A(
|
|
444
|
+
const u = $(() => {
|
|
445
|
+
if (a(l.value)) return null;
|
|
446
|
+
const [e, n] = l.value;
|
|
447
|
+
return A(t.propertyPath, U.Between, N([e, n]));
|
|
409
448
|
});
|
|
410
|
-
function
|
|
411
|
-
|
|
449
|
+
function o() {
|
|
450
|
+
l.value = r;
|
|
412
451
|
}
|
|
413
|
-
return { value:
|
|
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(
|
|
457
|
+
function ee(t) {
|
|
458
|
+
return Array.isArray(t) ? t.filter(
|
|
420
459
|
(s) => typeof s == "string" || typeof s == "number"
|
|
421
460
|
) : [];
|
|
422
461
|
}
|
|
423
|
-
function Ke(
|
|
424
|
-
const s =
|
|
425
|
-
s ? ee(
|
|
462
|
+
function Ke(t) {
|
|
463
|
+
const s = t.multiple === !0, r = _(
|
|
464
|
+
s ? ee(t.defaultValue) : Z(t.defaultValue)
|
|
426
465
|
);
|
|
427
|
-
function
|
|
428
|
-
const
|
|
429
|
-
return s ? !Array.isArray(
|
|
466
|
+
function l() {
|
|
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
|
|
432
|
-
if (
|
|
470
|
+
const a = $(() => {
|
|
471
|
+
if (l()) return null;
|
|
433
472
|
if (s) {
|
|
434
|
-
const
|
|
435
|
-
if (
|
|
436
|
-
const n =
|
|
437
|
-
return n == null ? null : A(
|
|
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
|
-
|
|
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
|
-
r.value = s ? ee(
|
|
487
|
+
function u() {
|
|
488
|
+
r.value = s ? ee(t.defaultValue) : Z(t.defaultValue);
|
|
450
489
|
}
|
|
451
|
-
return { value: r, filter:
|
|
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 Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
468
507
|
/** 占位文本 */
|
|
469
508
|
placeholder: { type: String, default: "请输入" }
|
|
470
509
|
},
|
|
471
|
-
setup(
|
|
472
|
-
const r =
|
|
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
|
-
return
|
|
518
|
+
return a.value;
|
|
480
519
|
},
|
|
481
|
-
reset:
|
|
520
|
+
reset: u
|
|
482
521
|
};
|
|
483
|
-
return s(
|
|
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 Oe = { 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 r =
|
|
525
|
-
function
|
|
526
|
-
const
|
|
527
|
-
|
|
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
|
|
530
|
-
|
|
568
|
+
function e() {
|
|
569
|
+
l.value = "";
|
|
531
570
|
}
|
|
532
571
|
const n = {
|
|
533
572
|
get filter() {
|
|
534
|
-
return
|
|
573
|
+
return a.value;
|
|
535
574
|
},
|
|
536
|
-
reset:
|
|
575
|
+
reset: u
|
|
537
576
|
};
|
|
538
|
-
return s(n), (i,
|
|
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:
|
|
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 Oe = { 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 r =
|
|
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
|
-
return
|
|
648
|
+
return a.value;
|
|
610
649
|
},
|
|
611
|
-
reset:
|
|
650
|
+
reset: u
|
|
612
651
|
};
|
|
613
|
-
return s(
|
|
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:
|
|
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:
|
|
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 Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
688
727
|
/** 单选模式是否显示清除按钮 */
|
|
689
728
|
clearable: { type: Boolean, default: !0 }
|
|
690
729
|
},
|
|
691
|
-
setup(
|
|
692
|
-
const r =
|
|
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 =
|
|
717
|
-
() => Array.isArray(
|
|
755
|
+
const y = $(
|
|
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
|
-
const
|
|
765
|
+
const P = {
|
|
727
766
|
get filter() {
|
|
728
|
-
return
|
|
767
|
+
return a.value;
|
|
729
768
|
},
|
|
730
|
-
reset:
|
|
769
|
+
reset: u
|
|
731
770
|
};
|
|
732
|
-
return s(
|
|
733
|
-
label:
|
|
734
|
-
api:
|
|
771
|
+
return s(P), (d, v) => (f(), K(j, {
|
|
772
|
+
label: t.label,
|
|
773
|
+
api: P
|
|
735
774
|
}, {
|
|
736
|
-
default:
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
key: String(
|
|
740
|
-
class:
|
|
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,
|
|
782
|
+
c("text", null, C(w.label), 1)
|
|
783
|
+
], 42, tt))), 128))
|
|
745
784
|
])) : (f(), m(L, { key: 1 }, [
|
|
746
|
-
|
|
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
|
-
|
|
756
|
-
class:
|
|
757
|
-
},
|
|
793
|
+
c("view", nt, [
|
|
794
|
+
c("text", {
|
|
795
|
+
class: R(["yk-filter-item__picker-text", { "yk-filter-item__picker-text--placeholder": !i.value }])
|
|
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 Oe = { class: "yk-filter-item__field" }, je = ["value", "placeholder"], yt
|
|
|
783
822
|
/** 外部自定义样式:追加到根节点上的内联样式字符串 */
|
|
784
823
|
customStyle: { type: String, default: "" }
|
|
785
824
|
},
|
|
786
|
-
setup(
|
|
825
|
+
setup(t) {
|
|
787
826
|
async function s(r) {
|
|
788
827
|
try {
|
|
789
828
|
await r.execute(void 0);
|
|
790
|
-
} catch (
|
|
791
|
-
console.error("[YsCommandBar] action failed:", r.name,
|
|
829
|
+
} catch (l) {
|
|
830
|
+
console.error("[YsCommandBar] action failed:", r.name, l);
|
|
792
831
|
}
|
|
793
832
|
}
|
|
794
|
-
return (r,
|
|
795
|
-
class:
|
|
796
|
-
style: z(
|
|
833
|
+
return (r, l) => (f(), m("view", {
|
|
834
|
+
class: R(["yk-command-bar", t.customClass]),
|
|
835
|
+
style: z(t.customStyle)
|
|
797
836
|
}, [
|
|
798
|
-
|
|
799
|
-
key:
|
|
800
|
-
class:
|
|
801
|
-
|
|
802
|
-
{ "yk-command-bar__btn--plain":
|
|
837
|
+
t.actions.length > 0 ? (f(!0), m(L, { key: 0 }, H(t.actions, (a) => (f(), m("view", {
|
|
838
|
+
key: a.name,
|
|
839
|
+
class: R(["yk-command-bar__btn", [
|
|
840
|
+
a.type ? `yk-command-bar__btn--${a.type}` : "yk-command-bar__btn--default",
|
|
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,98 +892,199 @@ const Oe = { 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
|
|
895
|
+
setup(t, { expose: s, emit: r }) {
|
|
896
|
+
const l = r, a = _(null), u = _(null);
|
|
858
897
|
s({
|
|
859
|
-
|
|
898
|
+
/* ---------- 数据加载(转发 YsInfiniteList) ---------- */
|
|
899
|
+
/** 重置并从第一页重新加载 */
|
|
900
|
+
reload: () => {
|
|
901
|
+
var e;
|
|
902
|
+
return (e = a.value) == null ? void 0 : e.reload();
|
|
903
|
+
},
|
|
904
|
+
/** 刷新:重置为第一页重新加载(与 reload 同义) */
|
|
905
|
+
refresh: () => {
|
|
906
|
+
var e;
|
|
907
|
+
return (e = a.value) == null ? void 0 : e.refresh();
|
|
908
|
+
},
|
|
909
|
+
/** 手动加载下一页(一般触底自动触发,无需手动调) */
|
|
910
|
+
loadNextPage: () => {
|
|
911
|
+
var e;
|
|
912
|
+
return (e = a.value) == null ? void 0 : e.loadNextPage();
|
|
913
|
+
},
|
|
914
|
+
/* ---------- 列表状态 ---------- */
|
|
915
|
+
/** 当前已加载的全部数据 */
|
|
916
|
+
get items() {
|
|
917
|
+
var e;
|
|
918
|
+
return ((e = a.value) == null ? void 0 : e.items) ?? [];
|
|
919
|
+
},
|
|
920
|
+
/** items 别名(与 YsTable 的 rows 同名) */
|
|
921
|
+
get rows() {
|
|
922
|
+
var e;
|
|
923
|
+
return ((e = a.value) == null ? void 0 : e.rows) ?? [];
|
|
924
|
+
},
|
|
925
|
+
/** 首屏加载态 */
|
|
926
|
+
get loading() {
|
|
927
|
+
var e;
|
|
928
|
+
return ((e = a.value) == null ? void 0 : e.loading) ?? !1;
|
|
929
|
+
},
|
|
930
|
+
/** 追加加载态 */
|
|
931
|
+
get loadingMore() {
|
|
932
|
+
var e;
|
|
933
|
+
return ((e = a.value) == null ? void 0 : e.loadingMore) ?? !1;
|
|
934
|
+
},
|
|
935
|
+
/** 是否还有下一页 */
|
|
936
|
+
get hasMore() {
|
|
937
|
+
var e;
|
|
938
|
+
return ((e = a.value) == null ? void 0 : e.hasMore) ?? !1;
|
|
939
|
+
},
|
|
940
|
+
/* ---------- 多选(showCheckbox 开启时有意义) ---------- */
|
|
941
|
+
/** 跨页累计选中的行 */
|
|
942
|
+
get selectedRows() {
|
|
943
|
+
var e;
|
|
944
|
+
return ((e = a.value) == null ? void 0 : e.selectedRows) ?? [];
|
|
945
|
+
},
|
|
946
|
+
/** 某行当前是否选中 */
|
|
947
|
+
isRowSelected: (e) => {
|
|
948
|
+
var n;
|
|
949
|
+
return ((n = a.value) == null ? void 0 : n.isRowSelected(e)) ?? !1;
|
|
950
|
+
},
|
|
951
|
+
/** 切换某行选中态(selected 缺省时取反) */
|
|
952
|
+
toggleRowSelection: (e, n) => {
|
|
953
|
+
var i;
|
|
954
|
+
return (i = a.value) == null ? void 0 : i.toggleRowSelection(e, n);
|
|
955
|
+
},
|
|
956
|
+
/** 清空全部选中 */
|
|
957
|
+
clearSelection: () => {
|
|
958
|
+
var e;
|
|
959
|
+
return (e = a.value) == null ? void 0 : e.clearSelection();
|
|
960
|
+
},
|
|
961
|
+
/** 选中当前已加载的全部行 */
|
|
962
|
+
selectAllOnPage: () => {
|
|
963
|
+
var e;
|
|
964
|
+
return (e = a.value) == null ? void 0 : e.selectAllOnPage();
|
|
965
|
+
},
|
|
966
|
+
/** 反选当前已加载的行 */
|
|
967
|
+
invertSelectionOnPage: () => {
|
|
968
|
+
var e;
|
|
969
|
+
return (e = a.value) == null ? void 0 : e.invertSelectionOnPage();
|
|
970
|
+
},
|
|
971
|
+
/* ---------- 筛选面板(转发 YsFilterPanel) ---------- */
|
|
972
|
+
/** 文本搜索框当前值 */
|
|
973
|
+
get keyword() {
|
|
974
|
+
var e;
|
|
975
|
+
return ((e = u.value) == null ? void 0 : e.keyword) ?? "";
|
|
976
|
+
},
|
|
977
|
+
/** 当前聚合后的查询条件 */
|
|
978
|
+
get filter() {
|
|
979
|
+
var e;
|
|
980
|
+
return (e = u.value) == null ? void 0 : e.filter;
|
|
981
|
+
},
|
|
982
|
+
/** 条件区是否展开 */
|
|
983
|
+
get filterExpanded() {
|
|
984
|
+
var e;
|
|
985
|
+
return ((e = u.value) == null ? void 0 : e.expanded) ?? !1;
|
|
986
|
+
},
|
|
987
|
+
/** 切换条件区展开/折叠 */
|
|
988
|
+
toggleFilter: () => {
|
|
989
|
+
var e;
|
|
990
|
+
return (e = u.value) == null ? void 0 : e.toggle();
|
|
991
|
+
},
|
|
992
|
+
/** 重置筛选(清空文本 + 重置已注册子项 + 派发 reset) */
|
|
993
|
+
resetFilter: () => {
|
|
994
|
+
var e;
|
|
995
|
+
return (e = u.value) == null ? void 0 : e.reset();
|
|
996
|
+
},
|
|
997
|
+
/* ---------- 子组件实例(未平铺能力的逃生舱) ---------- */
|
|
998
|
+
/** YsInfiniteList 实例 */
|
|
860
999
|
get list() {
|
|
861
|
-
return
|
|
1000
|
+
return a.value;
|
|
862
1001
|
},
|
|
863
1002
|
/** YsFilterPanel 实例 */
|
|
864
1003
|
get filterPanel() {
|
|
865
|
-
return
|
|
1004
|
+
return u.value;
|
|
866
1005
|
}
|
|
867
1006
|
});
|
|
868
|
-
function
|
|
869
|
-
|
|
1007
|
+
function o(e, n) {
|
|
1008
|
+
l("data-loaded", e, n);
|
|
870
1009
|
}
|
|
871
|
-
return (
|
|
872
|
-
|
|
873
|
-
|
|
1010
|
+
return (e, n) => (f(), m("view", st, [
|
|
1011
|
+
t.showFilter ? (f(), m("view", ut, [
|
|
1012
|
+
D(Ae, {
|
|
874
1013
|
ref_key: "filterRef",
|
|
875
|
-
ref:
|
|
876
|
-
placeholder:
|
|
877
|
-
"filter-text":
|
|
878
|
-
"search-button-text":
|
|
879
|
-
"reset-button-text":
|
|
880
|
-
"default-expanded":
|
|
881
|
-
"show-search":
|
|
882
|
-
"show-reset":
|
|
883
|
-
"text-filter-builder":
|
|
884
|
-
"custom-class":
|
|
885
|
-
"custom-style":
|
|
886
|
-
onSearch: n[0] || (n[0] = (i) =>
|
|
887
|
-
onReset: n[1] || (n[1] = (i) =>
|
|
888
|
-
onExpandChange: n[2] || (n[2] = (i) =>
|
|
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,
|
|
1025
|
+
onSearch: n[0] || (n[0] = (i) => l("search", i)),
|
|
1026
|
+
onReset: n[1] || (n[1] = (i) => l("reset")),
|
|
1027
|
+
onExpandChange: n[2] || (n[2] = (i) => l("expand-change", i))
|
|
889
1028
|
}, {
|
|
890
|
-
default:
|
|
891
|
-
|
|
1029
|
+
default: E(() => [
|
|
1030
|
+
B(e.$slots, "filter-default")
|
|
892
1031
|
]),
|
|
893
1032
|
_: 3
|
|
894
1033
|
}, 8, ["placeholder", "filter-text", "search-button-text", "reset-button-text", "default-expanded", "show-search", "show-reset", "text-filter-builder", "custom-class", "custom-style"])
|
|
895
|
-
])) :
|
|
896
|
-
|
|
897
|
-
|
|
1034
|
+
])) : S("", !0),
|
|
1035
|
+
c("view", ot, [
|
|
1036
|
+
D(Fe, {
|
|
898
1037
|
ref_key: "listRef",
|
|
899
|
-
ref:
|
|
900
|
-
"data-fun":
|
|
901
|
-
"page-size":
|
|
902
|
-
threshold:
|
|
903
|
-
"row-key":
|
|
904
|
-
immediate:
|
|
905
|
-
"show-checkbox":
|
|
1038
|
+
ref: a,
|
|
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,
|
|
906
1045
|
height: "100%",
|
|
907
|
-
class:
|
|
908
|
-
style: z(
|
|
909
|
-
onDataLoaded: n[3] || (n[3] = (i,
|
|
910
|
-
onSelectionChange: n[4] || (n[4] = (i) =>
|
|
911
|
-
onError: n[5] || (n[5] = (i) =>
|
|
1046
|
+
class: R(t.listCustomClass),
|
|
1047
|
+
style: z(t.listCustomStyle),
|
|
1048
|
+
onDataLoaded: n[3] || (n[3] = (i, k) => o(i, k)),
|
|
1049
|
+
onSelectionChange: n[4] || (n[4] = (i) => l("selection-change", i)),
|
|
1050
|
+
onError: n[5] || (n[5] = (i) => l("error", i))
|
|
912
1051
|
}, {
|
|
913
|
-
default:
|
|
914
|
-
|
|
1052
|
+
default: E(({ row: i, index: k }) => [
|
|
1053
|
+
B(e.$slots, "list-default", {
|
|
915
1054
|
row: i,
|
|
916
|
-
index:
|
|
1055
|
+
index: k
|
|
917
1056
|
})
|
|
918
1057
|
]),
|
|
919
1058
|
_: 3
|
|
920
1059
|
}, 8, ["data-fun", "page-size", "threshold", "row-key", "immediate", "show-checkbox", "class", "style"])
|
|
921
1060
|
]),
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
actions:
|
|
925
|
-
"custom-class":
|
|
926
|
-
"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
|
|
927
1066
|
}, {
|
|
928
|
-
default:
|
|
929
|
-
|
|
1067
|
+
default: E(() => [
|
|
1068
|
+
B(e.$slots, "cmd-default")
|
|
930
1069
|
]),
|
|
931
1070
|
_: 3
|
|
932
1071
|
}, 8, ["actions", "custom-class", "custom-style"])
|
|
933
|
-
])) :
|
|
1072
|
+
])) : S("", !0)
|
|
934
1073
|
]));
|
|
935
1074
|
}
|
|
936
1075
|
});
|
|
937
1076
|
export {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1077
|
+
le as FilterPanelKey,
|
|
1078
|
+
rt as YsCommandBar,
|
|
1079
|
+
vt as YsDateFilterItem,
|
|
1080
|
+
gt as YsDateRangeFilterItem,
|
|
942
1081
|
ht as YsEnumFilterItem,
|
|
943
|
-
|
|
944
|
-
|
|
1082
|
+
j as YsFilterItemLayout,
|
|
1083
|
+
Ae as YsFilterPanel,
|
|
945
1084
|
Fe as YsInfiniteList,
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1085
|
+
pt as YsInfinitePage,
|
|
1086
|
+
Be as YsRootFilterPanel,
|
|
1087
|
+
mt as YsTextFilterItem,
|
|
1088
|
+
Ie as useFilterPanelItem
|
|
949
1089
|
};
|
|
950
1090
|
//# sourceMappingURL=index.js.map
|