build change
This commit is contained in:
@@ -0,0 +1,213 @@
|
||||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import { defineComponent, computed, createVNode } from 'vue';
|
||||
import { Y as withInstall, G as useConfigInject, H as genComponentStyleHook, ae as flattenChildren, J as merge, M as resetComponent } from './server.mjs';
|
||||
|
||||
const genSharedDividerStyle = (token) => {
|
||||
const {
|
||||
componentCls,
|
||||
sizePaddingEdgeHorizontal,
|
||||
colorSplit,
|
||||
lineWidth
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: _extends(_extends({}, resetComponent(token)), {
|
||||
borderBlockStart: `${lineWidth}px solid ${colorSplit}`,
|
||||
// vertical
|
||||
"&-vertical": {
|
||||
position: "relative",
|
||||
top: "-0.06em",
|
||||
display: "inline-block",
|
||||
height: "0.9em",
|
||||
margin: `0 ${token.dividerVerticalGutterMargin}px`,
|
||||
verticalAlign: "middle",
|
||||
borderTop: 0,
|
||||
borderInlineStart: `${lineWidth}px solid ${colorSplit}`
|
||||
},
|
||||
"&-horizontal": {
|
||||
display: "flex",
|
||||
clear: "both",
|
||||
width: "100%",
|
||||
minWidth: "100%",
|
||||
margin: `${token.dividerHorizontalGutterMargin}px 0`
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text`]: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
margin: `${token.dividerHorizontalWithTextGutterMargin}px 0`,
|
||||
color: token.colorTextHeading,
|
||||
fontWeight: 500,
|
||||
fontSize: token.fontSizeLG,
|
||||
whiteSpace: "nowrap",
|
||||
textAlign: "center",
|
||||
borderBlockStart: `0 ${colorSplit}`,
|
||||
"&::before, &::after": {
|
||||
position: "relative",
|
||||
width: "50%",
|
||||
borderBlockStart: `${lineWidth}px solid transparent`,
|
||||
// Chrome not accept `inherit` in `border-top`
|
||||
borderBlockStartColor: "inherit",
|
||||
borderBlockEnd: 0,
|
||||
transform: "translateY(50%)",
|
||||
content: "''"
|
||||
}
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text-left`]: {
|
||||
"&::before": {
|
||||
width: "5%"
|
||||
},
|
||||
"&::after": {
|
||||
width: "95%"
|
||||
}
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text-right`]: {
|
||||
"&::before": {
|
||||
width: "95%"
|
||||
},
|
||||
"&::after": {
|
||||
width: "5%"
|
||||
}
|
||||
},
|
||||
[`${componentCls}-inner-text`]: {
|
||||
display: "inline-block",
|
||||
padding: "0 1em"
|
||||
},
|
||||
"&-dashed": {
|
||||
background: "none",
|
||||
borderColor: colorSplit,
|
||||
borderStyle: "dashed",
|
||||
borderWidth: `${lineWidth}px 0 0`
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text${componentCls}-dashed`]: {
|
||||
"&::before, &::after": {
|
||||
borderStyle: "dashed none none"
|
||||
}
|
||||
},
|
||||
[`&-vertical${componentCls}-dashed`]: {
|
||||
borderInlineStartWidth: lineWidth,
|
||||
borderInlineEnd: 0,
|
||||
borderBlockStart: 0,
|
||||
borderBlockEnd: 0
|
||||
},
|
||||
[`&-plain${componentCls}-with-text`]: {
|
||||
color: token.colorText,
|
||||
fontWeight: "normal",
|
||||
fontSize: token.fontSize
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text-left${componentCls}-no-default-orientation-margin-left`]: {
|
||||
"&::before": {
|
||||
width: 0
|
||||
},
|
||||
"&::after": {
|
||||
width: "100%"
|
||||
},
|
||||
[`${componentCls}-inner-text`]: {
|
||||
paddingInlineStart: sizePaddingEdgeHorizontal
|
||||
}
|
||||
},
|
||||
[`&-horizontal${componentCls}-with-text-right${componentCls}-no-default-orientation-margin-right`]: {
|
||||
"&::before": {
|
||||
width: "100%"
|
||||
},
|
||||
"&::after": {
|
||||
width: 0
|
||||
},
|
||||
[`${componentCls}-inner-text`]: {
|
||||
paddingInlineEnd: sizePaddingEdgeHorizontal
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
const useStyle = genComponentStyleHook("Divider", (token) => {
|
||||
const dividerToken = merge(token, {
|
||||
dividerVerticalGutterMargin: token.marginXS,
|
||||
dividerHorizontalWithTextGutterMargin: token.margin,
|
||||
dividerHorizontalGutterMargin: token.marginLG
|
||||
});
|
||||
return [genSharedDividerStyle(dividerToken)];
|
||||
}, {
|
||||
sizePaddingEdgeHorizontal: 0
|
||||
});
|
||||
const dividerProps = () => ({
|
||||
prefixCls: String,
|
||||
type: {
|
||||
type: String,
|
||||
default: "horizontal"
|
||||
},
|
||||
dashed: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
orientation: {
|
||||
type: String,
|
||||
default: "center"
|
||||
},
|
||||
plain: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
orientationMargin: [String, Number]
|
||||
});
|
||||
const Divider = defineComponent({
|
||||
name: "ADivider",
|
||||
inheritAttrs: false,
|
||||
compatConfig: {
|
||||
MODE: 3
|
||||
},
|
||||
props: dividerProps(),
|
||||
setup(props, _ref) {
|
||||
let {
|
||||
slots,
|
||||
attrs
|
||||
} = _ref;
|
||||
const {
|
||||
prefixCls: prefixClsRef,
|
||||
direction
|
||||
} = useConfigInject("divider", props);
|
||||
const [wrapSSR, hashId] = useStyle(prefixClsRef);
|
||||
const hasCustomMarginLeft = computed(() => props.orientation === "left" && props.orientationMargin != null);
|
||||
const hasCustomMarginRight = computed(() => props.orientation === "right" && props.orientationMargin != null);
|
||||
const classString = computed(() => {
|
||||
const {
|
||||
type,
|
||||
dashed,
|
||||
plain
|
||||
} = props;
|
||||
const prefixCls = prefixClsRef.value;
|
||||
return {
|
||||
[prefixCls]: true,
|
||||
[hashId.value]: !!hashId.value,
|
||||
[`${prefixCls}-${type}`]: true,
|
||||
[`${prefixCls}-dashed`]: !!dashed,
|
||||
[`${prefixCls}-plain`]: !!plain,
|
||||
[`${prefixCls}-rtl`]: direction.value === "rtl",
|
||||
[`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft.value,
|
||||
[`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight.value
|
||||
};
|
||||
});
|
||||
const innerStyle = computed(() => {
|
||||
const marginValue = typeof props.orientationMargin === "number" ? `${props.orientationMargin}px` : props.orientationMargin;
|
||||
return _extends(_extends({}, hasCustomMarginLeft.value && {
|
||||
marginLeft: marginValue
|
||||
}), hasCustomMarginRight.value && {
|
||||
marginRight: marginValue
|
||||
});
|
||||
});
|
||||
const orientationPrefix = computed(() => props.orientation.length > 0 ? "-" + props.orientation : props.orientation);
|
||||
return () => {
|
||||
var _a;
|
||||
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
|
||||
return wrapSSR(createVNode("div", _objectSpread(_objectSpread({}, attrs), {}, {
|
||||
"class": [classString.value, children.length ? `${prefixClsRef.value}-with-text ${prefixClsRef.value}-with-text${orientationPrefix.value}` : "", attrs.class],
|
||||
"role": "separator"
|
||||
}), [children.length ? createVNode("span", {
|
||||
"class": `${prefixClsRef.value}-inner-text`,
|
||||
"style": innerStyle.value
|
||||
}, [children]) : null]));
|
||||
};
|
||||
}
|
||||
});
|
||||
const __nuxt_component_2 = withInstall(Divider);
|
||||
|
||||
export { __nuxt_component_2 as _ };
|
||||
Reference in New Issue
Block a user