@yeepay/yee-boss-ui 0.1.20 → 0.1.21

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.
@@ -1,32 +0,0 @@
1
- import { YeeSelectRuntimeProps, YeeSelectSlots, YeeSelectValue } from './types';
2
- type __VLS_Props = YeeSelectRuntimeProps;
3
- type __VLS_PublicProps = {
4
- 'value'?: YeeSelectValue;
5
- } & __VLS_Props;
6
- declare function __VLS_template(): {
7
- attrs: Partial<{}>;
8
- slots: Readonly<YeeSelectSlots> & YeeSelectSlots;
9
- refs: {
10
- select: unknown;
11
- };
12
- rootEl: any;
13
- };
14
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
- declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
16
- focus: () => void;
17
- blur: () => void;
18
- scrollTo: import('ant-design-vue/es/vc-virtual-list/List').ScrollTo;
19
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
- "update:value": (value: import('ant-design-vue/es/select').SelectValue) => any;
21
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
- "onUpdate:value"?: (value: import('ant-design-vue/es/select').SelectValue) => any;
23
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
24
- select: unknown;
25
- }, any>;
26
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
27
- export default _default;
28
- type __VLS_WithTemplateSlots<T, S> = T & {
29
- new (): {
30
- $slots: S;
31
- };
32
- };
@@ -1,3 +0,0 @@
1
- import { YeeSelectComponent as YeeSelectPublicComponent } from './types';
2
- export declare const YeeSelect: YeeSelectPublicComponent;
3
- export type { YeeSelectComponent, YeeSelectDisplayValue, YeeSelectDropdownRenderProps, YeeSelectEmits, YeeSelectExpose, YeeSelectFieldNames, YeeSelectOption, YeeSelectProps, YeeSelectSlots, YeeSelectTagRenderProps, YeeSelectValue, } from './types';
@@ -1,120 +0,0 @@
1
- import { DefaultOptionType, LabeledValue, RefSelectProps, SelectProps, SelectValue } from 'ant-design-vue/es/select';
2
- import { ComponentOptionsMixin, DefineComponent, VNodeChild } from 'vue';
3
- /** YeeSelect 选项,沿用 Ant Design Vue 的默认选项结构。 */
4
- export type YeeSelectOption = DefaultOptionType;
5
- /** 自定义选项字段映射。 */
6
- export type YeeSelectFieldNames = NonNullable<SelectProps['fieldNames']>;
7
- /** YeeSelect 支持的受控值。 */
8
- export type YeeSelectValue = SelectValue;
9
- /** 下拉面板自定义插槽接收的参数。 */
10
- export interface YeeSelectDropdownRenderProps {
11
- /** Select 默认生成的下拉菜单节点。 */
12
- menuNode?: VNodeChild;
13
- /** 下拉面板接收到的内部属性。 */
14
- props?: Record<string, unknown>;
15
- }
16
- /** 多选模式下单个已选标签的渲染参数。 */
17
- export interface YeeSelectTagRenderProps {
18
- /** 当前标签是否允许关闭。 */
19
- closable: boolean;
20
- /** 当前选项是否禁用。 */
21
- disabled: boolean;
22
- /** 当前标签展示内容。 */
23
- label: VNodeChild;
24
- /** 关闭当前标签。 */
25
- onClose: (event?: MouseEvent) => void;
26
- /** 当前标签对应的完整选项。 */
27
- option: YeeSelectOption;
28
- /** 当前标签对应的原始值。 */
29
- value: string | number;
30
- }
31
- /** maxTagPlaceholder 接收的单个折叠选中项。 */
32
- export interface YeeSelectDisplayValue {
33
- /** 当前选项是否禁用。 */
34
- disabled?: boolean;
35
- /** 当前选中项的稳定键。 */
36
- key?: string | number;
37
- /** 当前选中项的展示内容。 */
38
- label?: VNodeChild;
39
- /** 当前选中项对应的完整选项。 */
40
- option?: YeeSelectOption;
41
- /** 当前选中项的原始值。 */
42
- value?: string | number;
43
- }
44
- /**
45
- * YeeSelect 的公开属性,完整继承 Ant Design Vue Select。
46
- * value 显式允许 undefined,兼容严格模式下尚未选择的 v-model 初始值。
47
- */
48
- export type YeeSelectProps = Omit<SelectProps, 'value'> & {
49
- /** 当前选中值,支持 v-model:value。 */
50
- value?: YeeSelectValue | undefined;
51
- };
52
- /** YeeSelect 在运行时主动接管的属性,其余 SelectProps 通过 $attrs 透传。 */
53
- export interface YeeSelectRuntimeProps {
54
- /** 自定义选项字段映射。 */
55
- fieldNames?: YeeSelectFieldNames;
56
- /** 选择项列表。 */
57
- options?: YeeSelectOption[];
58
- }
59
- /** YeeSelect 的公开事件。 */
60
- export interface YeeSelectEmits {
61
- /** 选择框失去焦点时触发。 */
62
- blur: [event: FocusEvent];
63
- /** 选中值变化时触发。 */
64
- change: [value: YeeSelectValue, option: YeeSelectOption | YeeSelectOption[]];
65
- /** 清空已选内容时触发。 */
66
- clear: [];
67
- /** 多选或标签模式取消选择时触发。 */
68
- deselect: [value: string | number | LabeledValue, option: YeeSelectOption];
69
- /** 下拉面板显隐变化时触发。 */
70
- dropdownVisibleChange: [open: boolean];
71
- /** 选择框获得焦点时触发。 */
72
- focus: [event: FocusEvent];
73
- /** 下拉面板滚动时触发。 */
74
- popupScroll: [event: UIEvent];
75
- /** 搜索文本变化时触发。 */
76
- search: [value: string];
77
- /** 选择选项时触发。 */
78
- select: [value: string | number | LabeledValue, option: YeeSelectOption];
79
- /** 受控值变化时触发,支持 v-model:value。 */
80
- 'update:value': [value: YeeSelectValue];
81
- }
82
- type YeeSelectEmitOptions = {
83
- [TEvent in keyof YeeSelectEmits]: (...args: YeeSelectEmits[TEvent]) => void;
84
- };
85
- /** YeeSelect 的公开插槽,与 Ant Design Vue Select 保持一致。 */
86
- export interface YeeSelectSlots {
87
- /** 使用 Select.Option 时的默认内容。 */
88
- default?: () => VNodeChild;
89
- /** 清除按钮图标。 */
90
- clearIcon?: () => VNodeChild;
91
- /** 自定义下拉面板。 */
92
- dropdownRender?: (props: YeeSelectDropdownRenderProps) => VNodeChild;
93
- /** 选中项图标。 */
94
- itemIcon?: () => VNodeChild;
95
- /** 最大标签数量提示。 */
96
- maxTagPlaceholder?: (omittedValues: YeeSelectDisplayValue[]) => VNodeChild;
97
- /** 无匹配选项时的内容。 */
98
- notFoundContent?: () => VNodeChild;
99
- /** 自定义选项内容。 */
100
- option?: (props: YeeSelectOption) => VNodeChild;
101
- /** 自定义选中项标签。 */
102
- optionLabel?: (option: YeeSelectOption) => VNodeChild;
103
- /** 输入框占位内容。 */
104
- placeholder?: () => VNodeChild;
105
- /** 多选标签移除图标。 */
106
- removeIcon?: () => VNodeChild;
107
- /** 选择框尾部图标。 */
108
- suffixIcon?: () => VNodeChild;
109
- /** 多选标签内容。 */
110
- tagRender?: (props: YeeSelectTagRenderProps) => VNodeChild;
111
- }
112
- /** 通过 YeeSelect 组件 ref 调用的方法。 */
113
- export type YeeSelectExpose = RefSelectProps;
114
- /** 带完整原生 Props、Events 和 Slots 提示的 YeeSelect 组件类型。 */
115
- export type YeeSelectComponent = DefineComponent<YeeSelectProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, YeeSelectEmitOptions> & {
116
- new (): YeeSelectExpose & {
117
- $slots: YeeSelectSlots;
118
- };
119
- };
120
- export {};
@@ -1,44 +0,0 @@
1
- import { shallowRef as t, reactive as i } from "vue";
2
- class h {
3
- /** 当前表单 Schema,由组件初始化,可通过 updateSchema 动态更新。 */
4
- schema = t([]);
5
- initialValues = {};
6
- values = i({});
7
- /** @internal 使用配置初始化 Schema 和字段值。 */
8
- configure(e) {
9
- this.schema.value = e.schema.map((s) => ({ ...s })), this.initialValues = { ...e.initialValues }, this.resetForm();
10
- }
11
- /** 获取指定字段值,并保留 TValues 中声明的字段类型。 */
12
- getFieldValue(e) {
13
- return this.values[e];
14
- }
15
- /** 获取当前全部字段值的浅拷贝。 */
16
- getValues() {
17
- return { ...this.values };
18
- }
19
- /** 将字段值恢复为 initialValues。 */
20
- resetForm() {
21
- for (const e of Object.keys(this.values))
22
- delete this.values[e];
23
- Object.assign(this.values, this.initialValues);
24
- }
25
- /** 设置指定字段值,字段名和值必须与 TValues 保持一致。 */
26
- setFieldValue(e, s) {
27
- this.values[e] = s;
28
- }
29
- /** 批量更新已声明字段的值。 */
30
- setValues(e) {
31
- Object.assign(this.values, e);
32
- }
33
- /** 按字段名动态更新 Schema。 */
34
- updateSchema(e) {
35
- const s = new Map(e.map((a) => [a.fieldName, a]));
36
- this.schema.value = this.schema.value.map((a) => ({
37
- ...a,
38
- ...s.get(a.fieldName)
39
- }));
40
- }
41
- }
42
- export {
43
- h as Y
44
- };
package/dist/form.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/form';
package/dist/form.js DELETED
@@ -1,6 +0,0 @@
1
- import { Y as r } from "./YeeForm-COND7XQj.js";
2
- import { Y } from "./form-api-0148j8ew.js";
3
- export {
4
- r as YeeForm,
5
- Y as YeeFormApi
6
- };
@@ -1,132 +0,0 @@
1
- import { defineComponent as F, useModel as G, useSlots as H, useAttrs as J, useTemplateRef as K, shallowRef as Q, computed as n, openBlock as y, createBlock as S, unref as d, mergeProps as g, withCtx as u, createElementVNode as N, normalizeStyle as W, normalizeClass as X, createSlots as O, createVNode as Z, toDisplayString as ee, renderList as A, renderSlot as R, normalizeProps as Y, guardReactiveProps as x, mergeModels as te } from "vue";
2
- import { Tooltip as j, Select as oe } from "ant-design-vue";
3
- import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- const le = { class: "yee-ui-select__option-label" }, se = /* @__PURE__ */ F({
5
- inheritAttrs: !1,
6
- name: "YeeSelect",
7
- __name: "YeeSelect",
8
- props: /* @__PURE__ */ te({
9
- fieldNames: {},
10
- options: {}
11
- }, {
12
- value: {},
13
- valueModifiers: {}
14
- }),
15
- emits: ["update:value"],
16
- setup(c, { expose: z }) {
17
- const h = oe, s = c, i = G(c, "value"), p = H(), f = J(), v = K("select"), C = Q(!1), l = n(() => ({
18
- label: s.fieldNames?.label ?? "label",
19
- options: s.fieldNames?.options ?? "options",
20
- value: s.fieldNames?.value ?? "value"
21
- })), B = n(() => f.class), M = n(() => f.style), w = n(() => {
22
- const e = {};
23
- for (const [t, o] of Object.entries(f))
24
- t !== "class" && t !== "style" && t !== "onDropdownVisibleChange" && (e[t] = o);
25
- return e;
26
- }), P = n(() => !p.default && !p.option), V = n(() => Object.keys(p)), $ = n(() => V.value.filter(
27
- (e) => e !== "default" && e !== "option"
28
- ));
29
- function E(e) {
30
- const t = f.onDropdownVisibleChange;
31
- if (typeof t == "function") {
32
- t(e);
33
- return;
34
- }
35
- t?.forEach((o) => o?.(e));
36
- }
37
- function D(e) {
38
- C.value = e, E(e);
39
- }
40
- function a(e) {
41
- return typeof e == "number" || typeof e == "string" ? String(e) : "";
42
- }
43
- function m(e, t) {
44
- if (e)
45
- for (const o of e) {
46
- const r = o[l.value.options], _ = m(r, t);
47
- if (_) return _;
48
- const k = o[l.value.value];
49
- if (k === t || String(k) === String(t)) return o;
50
- }
51
- }
52
- function b(e) {
53
- return e ? a(e[l.value.label]) || a(e.title) || a(e[l.value.value]) : "";
54
- }
55
- const L = n(() => {
56
- const e = i.value;
57
- if (!(e == null || e === ""))
58
- return Array.isArray(e) ? e.map((t) => b(m(s.options, t)) || a(t)).filter(Boolean).join("、") || void 0 : b(m(s.options, e)) || a(e) || void 0;
59
- });
60
- function T(e) {
61
- return b(e);
62
- }
63
- function U() {
64
- v.value?.blur();
65
- }
66
- function I() {
67
- v.value?.focus();
68
- }
69
- function q(...e) {
70
- v.value?.scrollTo(...e);
71
- }
72
- return z({ blur: U, focus: I, scrollTo: q }), (e, t) => (y(), S(d(j), g(C.value ? { open: !1 } : {}, { title: L.value }), {
73
- default: u(() => [
74
- N("div", {
75
- class: X(["yee-ui-select", B.value]),
76
- style: W(M.value)
77
- }, [
78
- P.value ? (y(), S(d(h), g({
79
- key: 0,
80
- ref: "select",
81
- value: i.value,
82
- "onUpdate:value": t[0] || (t[0] = (o) => i.value = o)
83
- }, w.value, {
84
- "field-names": l.value,
85
- options: c.options,
86
- onDropdownVisibleChange: D
87
- }), O({
88
- option: u((o) => [
89
- Z(d(j), {
90
- title: T(o),
91
- placement: "left"
92
- }, {
93
- default: u(() => [
94
- N("span", le, ee(T(o)), 1)
95
- ]),
96
- _: 2
97
- }, 1032, ["title"])
98
- ]),
99
- _: 2
100
- }, [
101
- A($.value, (o) => ({
102
- name: o,
103
- fn: u((r) => [
104
- R(e.$slots, o, Y(x(r)), void 0, !0)
105
- ])
106
- }))
107
- ]), 1040, ["value", "field-names", "options"])) : (y(), S(d(h), g({
108
- key: 1,
109
- ref: "select",
110
- value: i.value,
111
- "onUpdate:value": t[1] || (t[1] = (o) => i.value = o)
112
- }, w.value, {
113
- "field-names": l.value,
114
- options: c.options,
115
- onDropdownVisibleChange: D
116
- }), O({ _: 2 }, [
117
- A(V.value, (o) => ({
118
- name: o,
119
- fn: u((r) => [
120
- R(e.$slots, o, Y(x(r)), void 0, !0)
121
- ])
122
- }))
123
- ]), 1040, ["value", "field-names", "options"]))
124
- ], 6)
125
- ]),
126
- _: 3
127
- }, 16, ["title"]));
128
- }
129
- }), ie = /* @__PURE__ */ ne(se, [["__scopeId", "data-v-8acc9d8f"]]), ce = ie;
130
- export {
131
- ce as Y
132
- };
package/dist/select.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/select';
package/dist/select.js DELETED
@@ -1,4 +0,0 @@
1
- import { Y as r } from "./index-DvY7PmUA.js";
2
- export {
3
- r as YeeSelect
4
- };
@@ -1,85 +0,0 @@
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
- };