| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- import { g as E, I as T, _ as g, j as F, aK as D, aL as w, m as k, a as C, F as N } from "./index2.js";
- import { shallowRef as K, onMounted as L, inject as V, computed as $, provide as X, defineComponent as W, ref as R, onBeforeUnmount as H, createVNode as B } from "vue";
- import { d as P } from "./styleChecker.js";
- const J = () => {
- const e = K(!1);
- return L(() => {
- e.value = P();
- }), e;
- }, _ = Symbol("rowContextKey"), U = (e) => {
- X(_, e);
- }, q = () => V(_, {
- gutter: $(() => {
- }),
- wrap: $(() => {
- }),
- supportFlexGap: $(() => {
- })
- }), Q = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- // Grid system
- [t]: {
- display: "flex",
- flexFlow: "row wrap",
- minWidth: 0,
- "&::before, &::after": {
- display: "flex"
- },
- "&-no-wrap": {
- flexWrap: "nowrap"
- },
- // The origin of the X-axis
- "&-start": {
- justifyContent: "flex-start"
- },
- // The center of the X-axis
- "&-center": {
- justifyContent: "center"
- },
- // The opposite of the X-axis
- "&-end": {
- justifyContent: "flex-end"
- },
- "&-space-between": {
- justifyContent: "space-between"
- },
- "&-space-around ": {
- justifyContent: "space-around"
- },
- "&-space-evenly ": {
- justifyContent: "space-evenly"
- },
- // Align at the top
- "&-top": {
- alignItems: "flex-start"
- },
- // Align at the center
- "&-middle": {
- alignItems: "center"
- },
- "&-bottom": {
- alignItems: "flex-end"
- }
- }
- };
- }, Y = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- // Grid system
- [t]: {
- position: "relative",
- maxWidth: "100%",
- // Prevent columns from collapsing when empty
- minHeight: 1
- }
- };
- }, Z = (e, t) => {
- const {
- componentCls: a,
- gridColumns: u
- } = e, o = {};
- for (let s = u; s >= 0; s--)
- s === 0 ? (o[`${a}${t}-${s}`] = {
- display: "none"
- }, o[`${a}-push-${s}`] = {
- insetInlineStart: "auto"
- }, o[`${a}-pull-${s}`] = {
- insetInlineEnd: "auto"
- }, o[`${a}${t}-push-${s}`] = {
- insetInlineStart: "auto"
- }, o[`${a}${t}-pull-${s}`] = {
- insetInlineEnd: "auto"
- }, o[`${a}${t}-offset-${s}`] = {
- marginInlineEnd: 0
- }, o[`${a}${t}-order-${s}`] = {
- order: 0
- }) : (o[`${a}${t}-${s}`] = {
- display: "block",
- flex: `0 0 ${s / u * 100}%`,
- maxWidth: `${s / u * 100}%`
- }, o[`${a}${t}-push-${s}`] = {
- insetInlineStart: `${s / u * 100}%`
- }, o[`${a}${t}-pull-${s}`] = {
- insetInlineEnd: `${s / u * 100}%`
- }, o[`${a}${t}-offset-${s}`] = {
- marginInlineStart: `${s / u * 100}%`
- }, o[`${a}${t}-order-${s}`] = {
- order: s
- });
- return o;
- }, O = (e, t) => Z(e, t), z = (e, t, a) => ({
- [`@media (min-width: ${t}px)`]: g({}, O(e, a))
- }), ee = E("Grid", (e) => [Q(e)]), te = E("Grid", (e) => {
- const t = T(e, {
- gridColumns: 24
- // Row is divided into 24 parts in Grid
- }), a = {
- "-sm": t.screenSMMin,
- "-md": t.screenMDMin,
- "-lg": t.screenLGMin,
- "-xl": t.screenXLMin,
- "-xxl": t.screenXXLMin
- };
- return [Y(t), O(t, ""), O(t, "-xs"), Object.keys(a).map((u) => z(t, a[u], u)).reduce((u, o) => g(g({}, u), o), {})];
- }), ne = () => ({
- align: N([String, Object]),
- justify: N([String, Object]),
- prefixCls: String,
- gutter: N([Number, Array, Object], 0),
- wrap: {
- type: Boolean,
- default: void 0
- }
- }), ie = W({
- compatConfig: {
- MODE: 3
- },
- name: "ARow",
- inheritAttrs: !1,
- props: ne(),
- setup(e, t) {
- let {
- slots: a,
- attrs: u
- } = t;
- const {
- prefixCls: o,
- direction: s
- } = F("row", e), [G, y] = ee(o);
- let v;
- const x = D(), b = R({
- xs: !0,
- sm: !0,
- md: !0,
- lg: !0,
- xl: !0,
- xxl: !0
- }), S = R({
- xs: !1,
- sm: !1,
- md: !1,
- lg: !1,
- xl: !1,
- xxl: !1
- }), h = (n) => $(() => {
- if (typeof e[n] == "string")
- return e[n];
- if (typeof e[n] != "object")
- return "";
- for (let r = 0; r < w.length; r++) {
- const l = w[r];
- if (!S.value[l]) continue;
- const i = e[n][l];
- if (i !== void 0)
- return i;
- }
- return "";
- }), f = h("align"), p = h("justify"), d = J();
- L(() => {
- v = x.value.subscribe((n) => {
- S.value = n;
- const r = e.gutter || 0;
- (!Array.isArray(r) && typeof r == "object" || Array.isArray(r) && (typeof r[0] == "object" || typeof r[1] == "object")) && (b.value = n);
- });
- }), H(() => {
- x.value.unsubscribe(v);
- });
- const m = $(() => {
- const n = [void 0, void 0], {
- gutter: r = 0
- } = e;
- return (Array.isArray(r) ? r : [r, void 0]).forEach((i, M) => {
- if (typeof i == "object")
- for (let I = 0; I < w.length; I++) {
- const A = w[I];
- if (b.value[A] && i[A] !== void 0) {
- n[M] = i[A];
- break;
- }
- }
- else
- n[M] = i;
- }), n;
- });
- U({
- gutter: m,
- supportFlexGap: d,
- wrap: $(() => e.wrap)
- });
- const j = $(() => k(o.value, {
- [`${o.value}-no-wrap`]: e.wrap === !1,
- [`${o.value}-${p.value}`]: p.value,
- [`${o.value}-${f.value}`]: f.value,
- [`${o.value}-rtl`]: s.value === "rtl"
- }, u.class, y.value)), c = $(() => {
- const n = m.value, r = {}, l = n[0] != null && n[0] > 0 ? `${n[0] / -2}px` : void 0, i = n[1] != null && n[1] > 0 ? `${n[1] / -2}px` : void 0;
- return l && (r.marginLeft = l, r.marginRight = l), d.value ? r.rowGap = `${n[1]}px` : i && (r.marginTop = i, r.marginBottom = i), r;
- });
- return () => {
- var n;
- return G(B("div", C(C({}, u), {}, {
- class: j.value,
- style: g(g({}, c.value), u.style)
- }), [(n = a.default) === null || n === void 0 ? void 0 : n.call(a)]));
- };
- }
- });
- function re(e) {
- return typeof e == "number" ? `${e} ${e} auto` : /^\d+(\.\d+)?(px|em|rem|%)$/.test(e) ? `0 0 ${e}` : e;
- }
- const se = () => ({
- span: [String, Number],
- order: [String, Number],
- offset: [String, Number],
- push: [String, Number],
- pull: [String, Number],
- xs: {
- type: [String, Number, Object],
- default: void 0
- },
- sm: {
- type: [String, Number, Object],
- default: void 0
- },
- md: {
- type: [String, Number, Object],
- default: void 0
- },
- lg: {
- type: [String, Number, Object],
- default: void 0
- },
- xl: {
- type: [String, Number, Object],
- default: void 0
- },
- xxl: {
- type: [String, Number, Object],
- default: void 0
- },
- prefixCls: String,
- flex: [String, Number]
- }), oe = ["xs", "sm", "md", "lg", "xl", "xxl"], de = W({
- compatConfig: {
- MODE: 3
- },
- name: "ACol",
- inheritAttrs: !1,
- props: se(),
- setup(e, t) {
- let {
- slots: a,
- attrs: u
- } = t;
- const {
- gutter: o,
- supportFlexGap: s,
- wrap: G
- } = q(), {
- prefixCls: y,
- direction: v
- } = F("col", e), [x, b] = te(y), S = $(() => {
- const {
- span: f,
- order: p,
- offset: d,
- push: m,
- pull: j
- } = e, c = y.value;
- let n = {};
- return oe.forEach((r) => {
- let l = {};
- const i = e[r];
- typeof i == "number" ? l.span = i : typeof i == "object" && (l = i || {}), n = g(g({}, n), {
- [`${c}-${r}-${l.span}`]: l.span !== void 0,
- [`${c}-${r}-order-${l.order}`]: l.order || l.order === 0,
- [`${c}-${r}-offset-${l.offset}`]: l.offset || l.offset === 0,
- [`${c}-${r}-push-${l.push}`]: l.push || l.push === 0,
- [`${c}-${r}-pull-${l.pull}`]: l.pull || l.pull === 0,
- [`${c}-rtl`]: v.value === "rtl"
- });
- }), k(c, {
- [`${c}-${f}`]: f !== void 0,
- [`${c}-order-${p}`]: p,
- [`${c}-offset-${d}`]: d,
- [`${c}-push-${m}`]: m,
- [`${c}-pull-${j}`]: j
- }, n, u.class, b.value);
- }), h = $(() => {
- const {
- flex: f
- } = e, p = o.value, d = {};
- if (p && p[0] > 0) {
- const m = `${p[0] / 2}px`;
- d.paddingLeft = m, d.paddingRight = m;
- }
- if (p && p[1] > 0 && !s.value) {
- const m = `${p[1] / 2}px`;
- d.paddingTop = m, d.paddingBottom = m;
- }
- return f && (d.flex = re(f), G.value === !1 && !d.minWidth && (d.minWidth = 0)), d;
- });
- return () => {
- var f;
- return x(B("div", C(C({}, u), {}, {
- class: S.value,
- style: [h.value, u.style]
- }), [(f = a.default) === null || f === void 0 ? void 0 : f.call(a)]));
- };
- }
- });
- export {
- ie as A,
- de as C
- };
|