| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- import { b9 as T, g as E, m as D, d as g, N as I, u as k, ba as V, bb as j, c as F, _ as C } from "./index2.js";
- import { shallowRef as X, onMounted as L, inject as H, computed as m, provide as K, defineComponent as W, ref as R, onBeforeUnmount as P, createVNode as B } from "vue";
- const J = () => {
- const e = X(!1);
- return L(() => {
- e.value = T();
- }), e;
- }, _ = Symbol("rowContextKey"), U = (e) => {
- K(_, e);
- }, q = () => H(_, {
- gutter: m(() => {
- }),
- wrap: m(() => {
- }),
- supportFlexGap: m(() => {
- })
- }), 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: u,
- gridColumns: a
- } = e, o = {};
- for (let s = a; s >= 0; s--)
- s === 0 ? (o[`${u}${t}-${s}`] = {
- display: "none"
- }, o[`${u}-push-${s}`] = {
- insetInlineStart: "auto"
- }, o[`${u}-pull-${s}`] = {
- insetInlineEnd: "auto"
- }, o[`${u}${t}-push-${s}`] = {
- insetInlineStart: "auto"
- }, o[`${u}${t}-pull-${s}`] = {
- insetInlineEnd: "auto"
- }, o[`${u}${t}-offset-${s}`] = {
- marginInlineEnd: 0
- }, o[`${u}${t}-order-${s}`] = {
- order: 0
- }) : (o[`${u}${t}-${s}`] = {
- display: "block",
- flex: `0 0 ${s / a * 100}%`,
- maxWidth: `${s / a * 100}%`
- }, o[`${u}${t}-push-${s}`] = {
- insetInlineStart: `${s / a * 100}%`
- }, o[`${u}${t}-pull-${s}`] = {
- insetInlineEnd: `${s / a * 100}%`
- }, o[`${u}${t}-offset-${s}`] = {
- marginInlineStart: `${s / a * 100}%`
- }, o[`${u}${t}-order-${s}`] = {
- order: s
- });
- return o;
- }, O = (e, t) => Z(e, t), z = (e, t, u) => ({
- [`@media (min-width: ${t}px)`]: g({}, O(e, u))
- }), ee = E("Grid", (e) => [Q(e)]), te = E("Grid", (e) => {
- const t = D(e, {
- gridColumns: 24
- // Row is divided into 24 parts in Grid
- }), u = {
- "-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(u).map((a) => z(t, u[a], a)).reduce((a, o) => g(g({}, a), o), {})];
- }), ne = () => ({
- align: I([String, Object]),
- justify: I([String, Object]),
- prefixCls: String,
- gutter: I([Number, Array, Object], 0),
- wrap: {
- type: Boolean,
- default: void 0
- }
- }), ae = W({
- compatConfig: {
- MODE: 3
- },
- name: "ARow",
- inheritAttrs: !1,
- props: ne(),
- setup(e, t) {
- let {
- slots: u,
- attrs: a
- } = t;
- const {
- prefixCls: o,
- direction: s
- } = k("row", e), [G, y] = ee(o);
- let b;
- const v = V(), x = 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) => m(() => {
- if (typeof e[n] == "string")
- return e[n];
- if (typeof e[n] != "object")
- return "";
- for (let r = 0; r < j.length; r++) {
- const l = j[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(() => {
- b = v.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")) && (x.value = n);
- });
- }), P(() => {
- v.value.unsubscribe(b);
- });
- 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 N = 0; N < j.length; N++) {
- const A = j[N];
- if (x.value[A] && i[A] !== void 0) {
- n[M] = i[A];
- break;
- }
- }
- else
- n[M] = i;
- }), n;
- });
- U({
- gutter: $,
- supportFlexGap: d,
- wrap: m(() => e.wrap)
- });
- const w = m(() => F(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"
- }, a.class, y.value)), c = m(() => {
- const n = $.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({}, a), {}, {
- class: w.value,
- style: g(g({}, c.value), a.style)
- }), [(n = u.default) === null || n === void 0 ? void 0 : n.call(u)]));
- };
- }
- });
- 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"], ie = W({
- compatConfig: {
- MODE: 3
- },
- name: "ACol",
- inheritAttrs: !1,
- props: se(),
- setup(e, t) {
- let {
- slots: u,
- attrs: a
- } = t;
- const {
- gutter: o,
- supportFlexGap: s,
- wrap: G
- } = q(), {
- prefixCls: y,
- direction: b
- } = k("col", e), [v, x] = te(y), S = m(() => {
- const {
- span: f,
- order: p,
- offset: d,
- push: $,
- pull: w
- } = 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`]: b.value === "rtl"
- });
- }), F(c, {
- [`${c}-${f}`]: f !== void 0,
- [`${c}-order-${p}`]: p,
- [`${c}-offset-${d}`]: d,
- [`${c}-push-${$}`]: $,
- [`${c}-pull-${w}`]: w
- }, n, a.class, x.value);
- }), h = m(() => {
- const {
- flex: f
- } = e, p = o.value, d = {};
- if (p && p[0] > 0) {
- const $ = `${p[0] / 2}px`;
- d.paddingLeft = $, d.paddingRight = $;
- }
- if (p && p[1] > 0 && !s.value) {
- const $ = `${p[1] / 2}px`;
- d.paddingTop = $, d.paddingBottom = $;
- }
- return f && (d.flex = re(f), G.value === !1 && !d.minWidth && (d.minWidth = 0)), d;
- });
- return () => {
- var f;
- return v(B("div", C(C({}, a), {}, {
- class: S.value,
- style: [h.value, a.style]
- }), [(f = u.default) === null || f === void 0 ? void 0 : f.call(u)]));
- };
- }
- });
- export {
- ae as A,
- ie as C
- };
|