epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
279 lines (278 loc) • 7.51 kB
JavaScript
import { i as D } from "./interopRequireDefault-40f894e3.js";
import { r as A } from "./_vue_commonjs-external-eb7fec7f.js";
import { a as H, r as W } from "./public_api-1267ff2a.js";
import { r as G, d as J, e as K, f as Q, b as X } from "./useConfigInject-d85d8c62.js";
import { r as Y } from "./createContext-a42fe982.js";
import { r as Z } from "./index-f96a976e.js";
import { l as ee } from "./lodash-915646fb.js";
var n = {}, S = {}, _ = {}, O;
function te() {
if (O)
return _;
O = 1, Object.defineProperty(_, "__esModule", {
value: !0
}), _.default = void 0;
var e = (d) => {
const {
componentCls: p
} = d;
return {
[p]: {
display: "inline-flex",
"&-block": {
display: "flex",
width: "100%"
},
"&-vertical": {
flexDirection: "column"
}
}
};
};
return _.default = e, _;
}
var k;
function ae() {
if (k)
return S;
k = 1;
var s = D;
Object.defineProperty(S, "__esModule", {
value: !0
}), S.default = void 0;
var e = G(), d = s(te());
const p = (a) => {
const {
componentCls: o
} = a;
return {
[o]: {
display: "inline-flex",
"&-rtl": {
direction: "rtl"
},
"&-vertical": {
flexDirection: "column"
},
"&-align": {
flexDirection: "column",
"&-center": {
alignItems: "center"
},
"&-start": {
alignItems: "flex-start"
},
"&-end": {
alignItems: "flex-end"
},
"&-baseline": {
alignItems: "baseline"
}
},
[`${o}-space-item`]: {
"&:empty": {
display: "none"
}
}
}
};
};
var $ = (0, e.genComponentStyleHook)("Space", (a) => [p(a), (0, d.default)(a)]);
return S.default = $, S;
}
var T;
function me() {
if (T)
return n;
T = 1;
var s = D;
Object.defineProperty(n, "__esModule", {
value: !0
}), n.useCompactItemContext = n.spaceCompactProps = n.spaceCompactItemProps = n.default = n.SpaceCompactItemContext = n.NoCompactStyle = void 0;
var e = A, d = s(H()), p = s(J()), $ = s(Y()), a = s(K()), o = s(ae()), u = s(Z()), r = Q(), c = ee, g = X();
const y = () => ({
compactSize: String,
compactDirection: u.default.oneOf((0, r.tuple)("horizontal", "vertical")).def("horizontal"),
isFirstItem: (0, r.booleanType)(),
isLastItem: (0, r.booleanType)()
});
n.spaceCompactItemProps = y;
const v = (0, $.default)(null);
n.SpaceCompactItemContext = v;
const x = (i, C) => {
const t = v.useInject(), l = (0, e.computed)(() => {
if (!t || (0, c.isEmpty)(t))
return "";
const {
compactDirection: f,
isFirstItem: h,
isLastItem: m
} = t, I = f === "vertical" ? "-vertical-" : "-";
return (0, p.default)({
[`${i.value}-compact${I}item`]: !0,
[`${i.value}-compact${I}first-item`]: h,
[`${i.value}-compact${I}last-item`]: m,
[`${i.value}-compact${I}item-rtl`]: C.value === "rtl"
});
});
return {
compactSize: (0, e.computed)(() => t == null ? void 0 : t.compactSize),
compactDirection: (0, e.computed)(() => t == null ? void 0 : t.compactDirection),
compactItemClassnames: l
};
};
n.useCompactItemContext = x;
const F = (0, e.defineComponent)({
name: "NoCompactStyle",
setup(i, C) {
let {
slots: t
} = C;
return v.useProvide(null), () => {
var l;
return (l = t.default) === null || l === void 0 ? void 0 : l.call(t);
};
}
});
n.NoCompactStyle = F;
const j = () => ({
prefixCls: String,
size: {
type: String
},
direction: u.default.oneOf((0, r.tuple)("horizontal", "vertical")).def("horizontal"),
align: u.default.oneOf((0, r.tuple)("start", "end", "center", "baseline")),
block: {
type: Boolean,
default: void 0
}
});
n.spaceCompactProps = j;
const L = (0, e.defineComponent)({
name: "CompactItem",
props: y(),
setup(i, C) {
let {
slots: t
} = C;
return v.useProvide(i), () => {
var l;
return (l = t.default) === null || l === void 0 ? void 0 : l.call(t);
};
}
});
var M = (0, e.defineComponent)({
name: "ASpaceCompact",
inheritAttrs: !1,
props: j(),
setup(i, C) {
let {
attrs: t,
slots: l
} = C;
const {
prefixCls: f,
direction: h
} = (0, a.default)("space-compact", i), m = v.useInject(), [I, U] = (0, o.default)(f), V = (0, e.computed)(() => (0, p.default)(f.value, U.value, {
[`${f.value}-rtl`]: h.value === "rtl",
[`${f.value}-block`]: i.block,
[`${f.value}-vertical`]: i.direction === "vertical"
}));
return () => {
var q;
const R = (0, g.flattenChildren)(((q = l.default) === null || q === void 0 ? void 0 : q.call(l)) || []);
return R.length === 0 ? null : I((0, e.createVNode)("div", (0, d.default)((0, d.default)({}, t), {}, {
class: [V.value, t.class]
}), [R.map((E, z) => {
var P;
const w = E && E.key || `${f.value}-item-${z}`, N = !m || (0, c.isEmpty)(m);
return (0, e.createVNode)(L, {
key: w,
compactSize: (P = i.size) !== null && P !== void 0 ? P : "middle",
compactDirection: i.direction,
isFirstItem: z === 0 && (N || (m == null ? void 0 : m.isFirstItem)),
isLastItem: z === R.length - 1 && (N || (m == null ? void 0 : m.isLastItem))
}, {
default: () => [E]
});
})]));
};
}
});
return n.default = M, n;
}
var b = {}, B;
function de() {
if (B)
return b;
B = 1;
var s = D;
Object.defineProperty(b, "__esModule", {
value: !0
}), b.genCompactItemStyle = $;
var e = s(W());
function d(a, o, u) {
const {
focusElCls: r,
focus: c,
borderElCls: g
} = u, y = g ? "> *" : "", v = ["hover", c ? "focus" : null, "active"].filter(Boolean).map((x) => `&:${x} ${y}`).join(",");
return {
[`&-item:not(${o}-last-item)`]: {
marginInlineEnd: -a.lineWidth
},
"&-item": (0, e.default)((0, e.default)({
[v]: {
zIndex: 2
}
}, r ? {
[`&${r}`]: {
zIndex: 2
}
} : {}), {
[`&[disabled] ${y}`]: {
zIndex: 0
}
})
};
}
function p(a, o, u) {
const {
borderElCls: r
} = u, c = r ? `> ${r}` : "";
return {
[`&-item:not(${o}-first-item):not(${o}-last-item) ${c}`]: {
borderRadius: 0
},
[`&-item:not(${o}-last-item)${o}-first-item`]: {
[`& ${c}, &${a}-sm ${c}, &${a}-lg ${c}`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`&-item:not(${o}-first-item)${o}-last-item`]: {
[`& ${c}, &${a}-sm ${c}, &${a}-lg ${c}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
}
};
}
function $(a) {
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
focus: !0
};
const {
componentCls: u
} = a, r = `${u}-compact`;
return {
[r]: (0, e.default)((0, e.default)({}, d(a, r, o)), p(u, r, o))
};
}
return b;
}
export {
de as a,
ae as b,
me as r
};