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