@yeepay/yee-boss-ui 0.1.18 → 0.1.20
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/README.md +57 -29
- package/dist/YeeForm-COND7XQj.js +160 -0
- package/dist/YeeGrid-CF-0OZUj.js +395 -0
- package/dist/app-shell.js +2 -2
- package/dist/components/grid/use-yee-grid.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/descriptions.js +1 -1
- package/dist/ellipsis-text.js +1 -1
- package/dist/file-upload.js +1 -1
- package/dist/form-api-0148j8ew.js +44 -0
- package/dist/form.js +3 -2
- package/dist/grid.css +1 -0
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -36
- package/dist/modal.js +1 -1
- package/dist/page.js +1 -1
- package/dist/plugin.d.ts +3 -0
- package/dist/select.js +1 -1
- package/dist/style.css +147 -1
- package/dist/use-yee-grid-ClKZU8CY.js +85 -0
- package/package.json +2 -1
- package/dist/form-api-DbIL_dvg.js +0 -201
- package/dist/use-yee-grid-rYoenViE.js +0 -464
- /package/dist/{PlatformConfigProvider-BwqlDDcK.js → PlatformConfigProvider-BuML7gEO.js} +0 -0
- /package/dist/{YeeDescriptions-BZ33odSs.js → YeeDescriptions-DyYySPuw.js} +0 -0
- /package/dist/{YeeEllipsisText-CR94Jym2.js → YeeEllipsisText-BTSbIuBl.js} +0 -0
- /package/dist/{YeeFileUpload-DvRN1D-j.js → YeeFileUpload-BUFoWs8x.js} +0 -0
- /package/dist/{YeePage-Dbvn1TNi.js → YeePage-Duxhrl0F.js} +0 -0
- /package/dist/{YeeTabs-BPzlkZy6.js → YeeTabs-YwptF8tY.js} +0 -0
- /package/dist/{index-kF3hvw2Z.js → index-DvY7PmUA.js} +0 -0
- /package/dist/{index-DZP16zRG.js → index-mOUIZzI1.js} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { shallowRef as s, defineComponent as l, onBeforeUnmount as n, h as u, defineAsyncComponent as d } from "vue";
|
|
2
|
+
import { Y as h } from "./form-api-0148j8ew.js";
|
|
3
|
+
class m {
|
|
4
|
+
/** 查询表单控制器。 */
|
|
5
|
+
formApi = new h();
|
|
6
|
+
/** 查询表单当前是否可见。 */
|
|
7
|
+
searchFormVisible;
|
|
8
|
+
/** 当前 Grid 初始化配置。 */
|
|
9
|
+
state;
|
|
10
|
+
grid;
|
|
11
|
+
constructor(e) {
|
|
12
|
+
this.state = s(e), this.searchFormVisible = s(e.showSearchForm ?? !0);
|
|
13
|
+
}
|
|
14
|
+
/** @internal 由 YeeGrid 挂载底层 VXE Grid 实例。 */
|
|
15
|
+
mount(e) {
|
|
16
|
+
this.grid = e;
|
|
17
|
+
}
|
|
18
|
+
/** 保留当前页码并执行查询,可在查询前合并表单值。 */
|
|
19
|
+
query = async (e) => (e && this.formApi.setValues(e), this.grid?.commitProxy("query"));
|
|
20
|
+
/** 回到第一页并重新查询,可在查询前合并表单值。 */
|
|
21
|
+
reload = async (e) => (e && this.formApi.setValues(e), this.grid?.commitProxy("reload"));
|
|
22
|
+
/** 合并更新 VXE Grid 配置。 */
|
|
23
|
+
setGridOptions(e) {
|
|
24
|
+
this.setState({
|
|
25
|
+
gridOptions: {
|
|
26
|
+
...this.state.value.gridOptions,
|
|
27
|
+
...e
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** 设置表格加载状态。 */
|
|
32
|
+
setLoading(e) {
|
|
33
|
+
this.setGridOptions({ loading: e });
|
|
34
|
+
}
|
|
35
|
+
/** 合并更新 useYeeGrid 初始化配置。 */
|
|
36
|
+
setState(e) {
|
|
37
|
+
this.state.value = {
|
|
38
|
+
...this.state.value,
|
|
39
|
+
...e
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** 切换查询表单显隐,并返回切换后的状态。 */
|
|
43
|
+
toggleSearchForm(e) {
|
|
44
|
+
return this.searchFormVisible.value = e ?? !this.searchFormVisible.value, this.searchFormVisible.value;
|
|
45
|
+
}
|
|
46
|
+
/** @internal 清理底层 VXE Grid 实例引用。 */
|
|
47
|
+
unmount() {
|
|
48
|
+
this.grid = void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let i = !1;
|
|
52
|
+
function c() {
|
|
53
|
+
if (!(i || typeof document > "u")) {
|
|
54
|
+
if (document.querySelector("link[data-yee-grid-styles]")) {
|
|
55
|
+
i = !0;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
i = !0, import("@yeepay/yee-boss-ui/grid.css");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const p = d(() => import("./YeeGrid-CF-0OZUj.js"));
|
|
62
|
+
function b(r) {
|
|
63
|
+
c();
|
|
64
|
+
const e = new m(r);
|
|
65
|
+
return [l({
|
|
66
|
+
name: "YeeGrid",
|
|
67
|
+
inheritAttrs: !1,
|
|
68
|
+
props: {
|
|
69
|
+
tableTitle: String,
|
|
70
|
+
tableTitleHelp: String
|
|
71
|
+
},
|
|
72
|
+
setup(t, { attrs: a, slots: o }) {
|
|
73
|
+
return n(() => e.unmount()), () => u(p, {
|
|
74
|
+
...a,
|
|
75
|
+
api: e,
|
|
76
|
+
...t.tableTitle ? { tableTitle: t.tableTitle } : {},
|
|
77
|
+
...t.tableTitleHelp ? { tableTitleHelp: t.tableTitleHelp } : {}
|
|
78
|
+
}, o);
|
|
79
|
+
}
|
|
80
|
+
}), e];
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
m as Y,
|
|
84
|
+
b as u
|
|
85
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yeepay/yee-boss-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "运营后台平台公共 UI 与主题基础能力",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"types": "./dist/grid.d.ts",
|
|
44
44
|
"import": "./dist/grid.js"
|
|
45
45
|
},
|
|
46
|
+
"./grid.css": "./dist/grid.css",
|
|
46
47
|
"./tailwind-preset": {
|
|
47
48
|
"types": "./dist/tailwind-preset.d.ts",
|
|
48
49
|
"import": "./dist/tailwind-preset.js"
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { defineComponent as I, shallowRef as r, computed as d, onMounted as U, nextTick as D, onBeforeUnmount as j, openBlock as i, createElementBlock as f, withModifiers as z, createElementVNode as h, Fragment as L, renderList as A, toDisplayString as w, renderSlot as G, createBlock as S, resolveDynamicComponent as K, mergeProps as $, createCommentVNode as R, createVNode as N, unref as v, withCtx as y, createTextVNode as g, reactive as q } from "vue";
|
|
2
|
-
import { TreeSelect as H, TimeRangePicker as J, TimePicker as Q, Textarea as W, Switch as X, Slider as Z, Select as ee, Segmented as te, Rate as oe, RangePicker as ne, RadioGroup as ae, Radio as se, Mentions as ie, InputPassword as le, InputNumber as ue, Input as re, DatePicker as ce, CheckboxGroup as me, Checkbox as pe, Cascader as de, AutoComplete as fe, Button as C } from "ant-design-vue";
|
|
3
|
-
import { Y as he } from "./YeeFileUpload-DvRN1D-j.js";
|
|
4
|
-
import { _ as ve } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
-
const ye = {
|
|
6
|
-
AutoComplete: fe,
|
|
7
|
-
Cascader: de,
|
|
8
|
-
Checkbox: pe,
|
|
9
|
-
CheckboxGroup: me,
|
|
10
|
-
DatePicker: ce,
|
|
11
|
-
Input: re,
|
|
12
|
-
InputNumber: ue,
|
|
13
|
-
InputPassword: le,
|
|
14
|
-
Mentions: ie,
|
|
15
|
-
Radio: se,
|
|
16
|
-
RadioGroup: ae,
|
|
17
|
-
RangePicker: ne,
|
|
18
|
-
Rate: oe,
|
|
19
|
-
Segmented: te,
|
|
20
|
-
Select: ee,
|
|
21
|
-
Slider: Z,
|
|
22
|
-
Switch: X,
|
|
23
|
-
Textarea: W,
|
|
24
|
-
TimePicker: Q,
|
|
25
|
-
TimeRangePicker: J,
|
|
26
|
-
TreeSelect: H,
|
|
27
|
-
Upload: he
|
|
28
|
-
}, ge = {
|
|
29
|
-
Checkbox: "checked",
|
|
30
|
-
Radio: "checked",
|
|
31
|
-
Switch: "checked",
|
|
32
|
-
Upload: "fileList"
|
|
33
|
-
}, Ce = { class: "yee-ui-form__label" }, be = { class: "yee-ui-form__actions" }, ke = /* @__PURE__ */ I({
|
|
34
|
-
name: "YeeForm",
|
|
35
|
-
__name: "YeeForm",
|
|
36
|
-
props: {
|
|
37
|
-
api: {},
|
|
38
|
-
onReset: { type: Function },
|
|
39
|
-
onSubmit: { type: Function },
|
|
40
|
-
options: {}
|
|
41
|
-
},
|
|
42
|
-
setup(l) {
|
|
43
|
-
const e = l, a = r(e.options.collapsed ?? !0), s = r(3), u = r(null);
|
|
44
|
-
let c;
|
|
45
|
-
e.api.configure(e.options);
|
|
46
|
-
const b = d(() => e.api.schema.value.filter((t) => !t.hide)), x = d(() => Math.max(1, e.options.collapsedRows ?? 1) * s.value), B = d(() => !e.options.showCollapseButton || !a.value ? b.value : b.value.slice(0, x.value));
|
|
47
|
-
function k() {
|
|
48
|
-
const t = u.value;
|
|
49
|
-
if (!t) return;
|
|
50
|
-
const n = getComputedStyle(t).gridTemplateColumns.split(" ").map((o) => o.trim()).filter(Boolean);
|
|
51
|
-
n.length > 0 && (s.value = n.length);
|
|
52
|
-
}
|
|
53
|
-
U(async () => {
|
|
54
|
-
await D(), k(), typeof ResizeObserver < "u" && u.value && (c = new ResizeObserver(k), c.observe(u.value));
|
|
55
|
-
}), j(() => {
|
|
56
|
-
c?.disconnect();
|
|
57
|
-
});
|
|
58
|
-
function V(t) {
|
|
59
|
-
return e.api.getFieldValue(t.fieldName);
|
|
60
|
-
}
|
|
61
|
-
function _(t) {
|
|
62
|
-
return t !== "Custom";
|
|
63
|
-
}
|
|
64
|
-
function M(t) {
|
|
65
|
-
return _(t.component) ? ye[t.component] : void 0;
|
|
66
|
-
}
|
|
67
|
-
function P(t) {
|
|
68
|
-
return _(t.component) ? ge[t.component] ?? "value" : "value";
|
|
69
|
-
}
|
|
70
|
-
function O(t) {
|
|
71
|
-
const n = V(t), o = P(t);
|
|
72
|
-
return {
|
|
73
|
-
...t.componentProps,
|
|
74
|
-
...n === void 0 ? {} : { [o]: n },
|
|
75
|
-
[`onUpdate:${o}`]: (p) => F(t, p)
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function F(t, n) {
|
|
79
|
-
e.api.setFieldValue(
|
|
80
|
-
t.fieldName,
|
|
81
|
-
n
|
|
82
|
-
), e.options.submitOnChange && m();
|
|
83
|
-
}
|
|
84
|
-
async function T() {
|
|
85
|
-
e.api.resetForm(), await e.onReset?.();
|
|
86
|
-
}
|
|
87
|
-
async function m() {
|
|
88
|
-
await e.onSubmit?.(e.api.getValues());
|
|
89
|
-
}
|
|
90
|
-
function Y(t) {
|
|
91
|
-
t.key === "Enter" && e.options.submitOnEnter && (t.preventDefault(), m());
|
|
92
|
-
}
|
|
93
|
-
function E() {
|
|
94
|
-
a.value = !a.value, e.options.handleCollapsedChange?.(a.value);
|
|
95
|
-
}
|
|
96
|
-
return (t, n) => (i(), f("form", {
|
|
97
|
-
class: "yee-ui-form",
|
|
98
|
-
onKeydown: Y,
|
|
99
|
-
onSubmit: z(m, ["prevent"])
|
|
100
|
-
}, [
|
|
101
|
-
h("div", {
|
|
102
|
-
ref_key: "fieldsElement",
|
|
103
|
-
ref: u,
|
|
104
|
-
class: "yee-ui-form__fields"
|
|
105
|
-
}, [
|
|
106
|
-
(i(!0), f(L, null, A(B.value, (o) => (i(), f("label", {
|
|
107
|
-
key: o.fieldName,
|
|
108
|
-
class: "yee-ui-form__field"
|
|
109
|
-
}, [
|
|
110
|
-
h("span", Ce, w(o.label), 1),
|
|
111
|
-
G(t.$slots, o.fieldName, {
|
|
112
|
-
field: o,
|
|
113
|
-
setValue: (p) => F(o, p),
|
|
114
|
-
value: V(o),
|
|
115
|
-
values: l.api.getValues()
|
|
116
|
-
}, () => [
|
|
117
|
-
o.component !== "Custom" ? (i(), S(K(M(o)), $({
|
|
118
|
-
key: 0,
|
|
119
|
-
ref_for: !0
|
|
120
|
-
}, O(o)), null, 16)) : R("", !0)
|
|
121
|
-
], !0)
|
|
122
|
-
]))), 128))
|
|
123
|
-
], 512),
|
|
124
|
-
h("div", be, [
|
|
125
|
-
N(v(C), {
|
|
126
|
-
"html-type": "button",
|
|
127
|
-
onClick: T
|
|
128
|
-
}, {
|
|
129
|
-
default: y(() => [...n[0] || (n[0] = [
|
|
130
|
-
g(" 重置 ", -1)
|
|
131
|
-
])]),
|
|
132
|
-
_: 1
|
|
133
|
-
}),
|
|
134
|
-
N(v(C), {
|
|
135
|
-
type: "primary",
|
|
136
|
-
"html-type": "submit"
|
|
137
|
-
}, {
|
|
138
|
-
default: y(() => [...n[1] || (n[1] = [
|
|
139
|
-
g(" 查询 ", -1)
|
|
140
|
-
])]),
|
|
141
|
-
_: 1
|
|
142
|
-
}),
|
|
143
|
-
l.options.showCollapseButton ? (i(), S(v(C), {
|
|
144
|
-
key: 0,
|
|
145
|
-
type: "link",
|
|
146
|
-
"html-type": "button",
|
|
147
|
-
onClick: E
|
|
148
|
-
}, {
|
|
149
|
-
default: y(() => [
|
|
150
|
-
g(w(a.value ? "展开" : "收起"), 1)
|
|
151
|
-
]),
|
|
152
|
-
_: 1
|
|
153
|
-
})) : R("", !0)
|
|
154
|
-
])
|
|
155
|
-
], 32));
|
|
156
|
-
}
|
|
157
|
-
}), Se = /* @__PURE__ */ ve(ke, [["__scopeId", "data-v-13cadc25"]]);
|
|
158
|
-
class Re {
|
|
159
|
-
/** 当前表单 Schema,由组件初始化,可通过 updateSchema 动态更新。 */
|
|
160
|
-
schema = r([]);
|
|
161
|
-
initialValues = {};
|
|
162
|
-
values = q({});
|
|
163
|
-
/** @internal 使用配置初始化 Schema 和字段值。 */
|
|
164
|
-
configure(e) {
|
|
165
|
-
this.schema.value = e.schema.map((a) => ({ ...a })), this.initialValues = { ...e.initialValues }, this.resetForm();
|
|
166
|
-
}
|
|
167
|
-
/** 获取指定字段值,并保留 TValues 中声明的字段类型。 */
|
|
168
|
-
getFieldValue(e) {
|
|
169
|
-
return this.values[e];
|
|
170
|
-
}
|
|
171
|
-
/** 获取当前全部字段值的浅拷贝。 */
|
|
172
|
-
getValues() {
|
|
173
|
-
return { ...this.values };
|
|
174
|
-
}
|
|
175
|
-
/** 将字段值恢复为 initialValues。 */
|
|
176
|
-
resetForm() {
|
|
177
|
-
for (const e of Object.keys(this.values))
|
|
178
|
-
delete this.values[e];
|
|
179
|
-
Object.assign(this.values, this.initialValues);
|
|
180
|
-
}
|
|
181
|
-
/** 设置指定字段值,字段名和值必须与 TValues 保持一致。 */
|
|
182
|
-
setFieldValue(e, a) {
|
|
183
|
-
this.values[e] = a;
|
|
184
|
-
}
|
|
185
|
-
/** 批量更新已声明字段的值。 */
|
|
186
|
-
setValues(e) {
|
|
187
|
-
Object.assign(this.values, e);
|
|
188
|
-
}
|
|
189
|
-
/** 按字段名动态更新 Schema。 */
|
|
190
|
-
updateSchema(e) {
|
|
191
|
-
const a = new Map(e.map((s) => [s.fieldName, s]));
|
|
192
|
-
this.schema.value = this.schema.value.map((s) => ({
|
|
193
|
-
...s,
|
|
194
|
-
...a.get(s.fieldName)
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
export {
|
|
199
|
-
Se as Y,
|
|
200
|
-
Re as a
|
|
201
|
-
};
|