@aplus-frontend/ui 0.2.6 → 0.2.7
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/es/src/ap-field/interface.d.ts +2 -1
- package/es/src/ap-field/switch/index.vue.mjs +48 -48
- package/es/src/ap-table/constants.d.ts +7 -1189
- package/lib/src/ap-field/interface.d.ts +2 -1
- package/lib/src/ap-field/switch/index.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +7 -1189
- package/package.json +20 -7
|
@@ -71,10 +71,11 @@ export type ApiFieldRadioExpose = {
|
|
|
71
71
|
focus: () => void;
|
|
72
72
|
blur: () => void;
|
|
73
73
|
};
|
|
74
|
+
export type ApFieldSwitchConfirmConfig = Pick<PopconfirmProps, 'title' | 'okText' | 'cancelText' | 'description' | 'showCancel' | 'icon' | 'okType' | 'onCancel' | 'okButtonProps' | 'cancelButtonProps'>;
|
|
74
75
|
export type ApFieldSwitchProps = BasicApFieldProps<Omit<SwitchProps, 'onClick'>> & {
|
|
75
76
|
emptyText?: string;
|
|
76
77
|
onAction?: (checked: string | boolean | number, e?: Event) => boolean | Promise<boolean>;
|
|
77
|
-
confirm?:
|
|
78
|
+
confirm?: ApFieldSwitchConfirmConfig | ((checked: string | number | boolean) => ApFieldSwitchConfirmConfig);
|
|
78
79
|
};
|
|
79
80
|
export type ApFieldTextAreaProps = BasicApFieldProps<Omit<TextAreaProps, 'autosize'>> & {
|
|
80
81
|
emptyText?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Switch as
|
|
1
|
+
import { defineComponent as z, useSlots as D, ref as T, unref as o, computed as g, createVNode as s, Fragment as f, openBlock as h, createBlock as k, resolveDynamicComponent as E, createElementBlock as K, mergeProps as p, createSlots as V, renderList as v, withCtx as C, renderSlot as B, normalizeProps as w, guardReactiveProps as A } from "vue";
|
|
2
|
+
import { Switch as P, Popconfirm as L } from "@aplus-frontend/antdv";
|
|
3
3
|
import "../../hooks/index.mjs";
|
|
4
|
-
import { isNil as
|
|
5
|
-
import { isDef as
|
|
6
|
-
import { useControllableValue as
|
|
7
|
-
const
|
|
4
|
+
import { isNil as M, isFunction as R, omit as S } from "lodash-unified";
|
|
5
|
+
import { isDef as l } from "@fruits-chain/utils";
|
|
6
|
+
import { useControllableValue as j } from "../../hooks/useControllableValue.mjs";
|
|
7
|
+
const O = /* @__PURE__ */ z({
|
|
8
8
|
name: "ApFieldSwitch",
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: {
|
|
@@ -49,76 +49,76 @@ const J = /* @__PURE__ */ F({
|
|
|
49
49
|
confirm: {}
|
|
50
50
|
},
|
|
51
51
|
emits: ["update:checked"],
|
|
52
|
-
setup(
|
|
52
|
+
setup(_, {
|
|
53
53
|
emit: b
|
|
54
54
|
}) {
|
|
55
|
-
const c =
|
|
56
|
-
value:
|
|
57
|
-
updateValue:
|
|
58
|
-
} =
|
|
55
|
+
const c = D(), e = _, F = b, {
|
|
56
|
+
value: r,
|
|
57
|
+
updateValue: d
|
|
58
|
+
} = j(e, F, {
|
|
59
59
|
valuePropName: "checked"
|
|
60
|
-
}),
|
|
61
|
-
async function y(
|
|
62
|
-
if (!
|
|
63
|
-
if (!
|
|
64
|
-
|
|
60
|
+
}), a = T(!1);
|
|
61
|
+
async function y(n, u) {
|
|
62
|
+
if (!l(e.confirm)) {
|
|
63
|
+
if (!l(e.onAction)) {
|
|
64
|
+
d(n);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
a.value = !0;
|
|
68
68
|
try {
|
|
69
|
-
await
|
|
69
|
+
await e.onAction(n, u) && d(n);
|
|
70
70
|
} finally {
|
|
71
|
-
|
|
71
|
+
a.value = !1;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
async function
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
|
|
75
|
+
async function N() {
|
|
76
|
+
const n = o(r) === e.checkedValue ? e.unCheckedValue : e.checkedValue;
|
|
77
|
+
if (!l(e.onAction)) {
|
|
78
|
+
d(n);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
await
|
|
81
|
+
await e.onAction(n) && d(n);
|
|
82
82
|
}
|
|
83
|
-
const $ =
|
|
84
|
-
var
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
});
|
|
88
|
-
return (
|
|
83
|
+
const $ = g(() => {
|
|
84
|
+
var i, t;
|
|
85
|
+
const n = o(r);
|
|
86
|
+
return M(n) ? s(f, null, [e.emptyText]) : n === e.checkedValue ? s(f, null, [e.checkedChildren || ((i = c.checkedChildren) == null ? void 0 : i.call(c)) || `${e.checkedValue}`]) : s(f, null, [e.unCheckedChildren || ((t = c.unCheckedChildren) == null ? void 0 : t.call(c)) || `${e.unCheckedValue}`]);
|
|
87
|
+
}), U = g(() => l(e.confirm) ? R(e.confirm) ? e.confirm(o(r)) : e.confirm : {});
|
|
88
|
+
return (n, u) => n.mode === "read" ? (h(), k(E($.value), {
|
|
89
89
|
key: 0
|
|
90
|
-
})) : (h(),
|
|
90
|
+
})) : (h(), K(f, {
|
|
91
91
|
key: 1
|
|
92
|
-
}, [!o(
|
|
92
|
+
}, [!o(l)(n.confirm) || n.disabled ? (h(), k(o(P), p({
|
|
93
93
|
key: 0
|
|
94
|
-
}, o(
|
|
95
|
-
checked: o(
|
|
94
|
+
}, o(S)(e, "onUpdate:checked"), {
|
|
95
|
+
checked: o(r),
|
|
96
96
|
onClick: y,
|
|
97
|
-
loading:
|
|
98
|
-
}),
|
|
97
|
+
loading: n.loading ?? a.value
|
|
98
|
+
}), V({
|
|
99
99
|
_: 2
|
|
100
|
-
}, [
|
|
100
|
+
}, [v(c, (i, t) => ({
|
|
101
101
|
name: t,
|
|
102
|
-
fn: C((m) => [
|
|
103
|
-
}))]), 1040, ["checked", "loading"])) : (h(), k(o(
|
|
102
|
+
fn: C((m) => [B(n.$slots, t, w(A(m || {})))])
|
|
103
|
+
}))]), 1040, ["checked", "loading"])) : (h(), k(o(L), p({
|
|
104
104
|
key: 1
|
|
105
|
-
},
|
|
106
|
-
onConfirm:
|
|
105
|
+
}, U.value, {
|
|
106
|
+
onConfirm: N
|
|
107
107
|
}), {
|
|
108
|
-
default: C(() => [
|
|
109
|
-
checked: o(
|
|
108
|
+
default: C(() => [s(o(P), p(o(S)(e, "onUpdate:checked"), {
|
|
109
|
+
checked: o(r),
|
|
110
110
|
onClick: y,
|
|
111
|
-
loading:
|
|
112
|
-
}),
|
|
111
|
+
loading: n.loading ?? a.value
|
|
112
|
+
}), V({
|
|
113
113
|
_: 2
|
|
114
|
-
}, [
|
|
114
|
+
}, [v(c, (i, t) => ({
|
|
115
115
|
name: t,
|
|
116
|
-
fn: C((m) => [
|
|
116
|
+
fn: C((m) => [B(n.$slots, t, w(A(m || {})))])
|
|
117
117
|
}))]), 1040, ["checked", "loading"])]),
|
|
118
118
|
_: 3
|
|
119
119
|
}, 16))], 64));
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
export {
|
|
123
|
-
|
|
123
|
+
O as default
|
|
124
124
|
};
|