UNPKG

@chief-editor/ui

Version:

UI Component for chief editor

1 lines 2.09 kB
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(r[s[o]]=t[s[o]])}return r},__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});var util_1=require("@co-hooks/util"),react_1=__importStar(require("react")),hooks_1=require("../../hooks"),grid_1=__importDefault(require("../row/context/grid"));function Col(t){var e=t.span,r=t.order,s=t.offset,o=t.push,l=t.pull,n=t.xxs,a=t.xs,i=t.sm,u=t.md,_=t.lg,p=t.xl,f=t.xxl,c=t.className,h=t.children,d=t.style,x=__rest(t,["span","order","offset","push","pull","xxs","xs","sm","md","lg","xl","xxl","className","children","style"]),g={span:e,order:r,offset:s,push:o,pull:l,xxs:n,xs:a,sm:i,md:u,lg:_,xl:p,xxl:f},m=react_1.useContext(grid_1.default),y=m.gutter,O=m.breakpoint,v=util_1.classnames(hooks_1.usePrefixCls("col",match(g,O)),c),b=y>0?__assign({paddingLeft:y/2,paddingRight:y/2},d):d;return react_1.default.createElement("div",__assign({},x,{style:b,className:v}),h)}exports.Col=Col;var COL_PROP_TYPES=util_1.tuple("span","order","offset","push","pull");function match(t,e){var r={};return COL_PROP_TYPES.forEach((function(s){var o=t[e],l=t[s];if("span"!==s)r[s]=String("object"==typeof o&&o[s]||null!=l&&l||"0");else{var n="object"==typeof o&&o[s]||"string"==typeof o&&o||"number"==typeof o&&String(o)||null!=l&&l||"0";r[n]=!0}})),r}