@cosmic-design/san
Advanced tools
Comparing version 0.1.1-beta.bc2614d to 0.1.1-beta.c46fae2
@@ -1,5 +0,5 @@ | ||
"use strict";var a=require("san");const c=["xs","sm","md","lg","xl","xxl"];function l(r,t,e){return function(n){const s=r[n];if(typeof s=="object")for(const i in s)s.hasOwnProperty(i)&&(t[i][n]=s[i]);else t[e][n]=s}}const d="cos-row",u="cos-col";var p={row:d,col:u};class o extends a.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parent;for(;t&&!t.isGridRow;)t=t.parent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}o.trimWhitespace="all";o.template=` | ||
<div class="${p.col}" style="{{colStyle}}"> | ||
"use strict";var a=require("san");const c=["xs","sm","md","lg","xl","xxl"];function l(o,t,e){return function(n){const s=o[n];if(typeof s=="object")for(const i in s)s.hasOwnProperty(i)&&(t[i][n]=s[i]);else t[e][n]=s}}const d="cos-row",p="cos-col";var u={row:d,col:p};class r extends a.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parentComponent;for(;t&&!t.isGridRow;)t=t.parentComponent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}r.trimWhitespace="all";r.template=` | ||
<div class="${u.col}" style="{{colStyle}}"> | ||
<slot></slot> | ||
</div> | ||
`;o.computed={responsive(){const r=this.data.get("size"),t=this.data.get("span"),e=c.reduce((n,s)=>(n[s]=this.data.get(s)||{},n),{});return["span"].forEach(l({span:t},e,r)),e},current(){const r=this.data.get("responsive"),t=this.data.get("size");return r[t]},colStyle(){const r=this.data.get("current"),t=r&&r.span,e=this.data.get("rowCurrent"),n={"box-sizing":"border-box"};if(e&&e.gutter){const s=e.gutter/2;Object.assign(n,{"padding-left":`${s}px`,"padding-right":`${s}px`})}if(e&&e.columns&&t){const s=+t/+e.columns*100;Object.assign(n,{flex:"0 0 auto",width:`${s}%`})}return n}};module.exports=o; | ||
`;r.computed={responsive(){const o=this.data.get("size"),t=this.data.get("span"),e=c.reduce((n,s)=>(n[s]=this.data.get(s)||{},n),{});return["span"].forEach(l({span:t},e,o)),e},current(){const o=this.data.get("responsive"),t=this.data.get("size");return o[t]},colStyle(){const o=this.data.get("current"),t=o&&o.span,e=this.data.get("rowCurrent"),n={"box-sizing":"border-box"};if(e&&e.gutter){const s=e.gutter/2;Object.assign(n,{"padding-left":`${s}px`,"padding-right":`${s}px`})}if(e&&e.columns&&t){const s=+t/+e.columns*100;Object.assign(n,{flex:"0 0 auto",width:`${s}%`})}return n}};module.exports=r; |
@@ -1,4 +0,4 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n=require("san");const U="cos-button",H="cos-hover",V="cos-active",q="cos-disabled",K="cos-button-icon",G="cos-button-prefix",J="cos-button-suffix",Q="cos-button-content",Z="cos-square",tt="cos-dashed",et="cos-light",st="cos-link",at="cos-solid",it="cos-text";var b={button:U,hover:H,active:V,disabled:q,"button-icon":"cos-button-icon",buttonIcon:K,"button-prefix":"cos-button-prefix",buttonPrefix:G,"button-suffix":"cos-button-suffix",buttonSuffix:J,"button-content":"cos-button-content",buttonContent:Q,square:Z,dashed:tt,light:et,link:st,solid:at,text:it};class A extends n.Component{initData(){return{name:void 0,value:void 0,type:"button",disabled:!1}}click(t){this.fire("click",t)}}A.trimWhitespace="all";A.template=` | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n=require("san");const U="cos-button",H="cos-hover",V="cos-active",q="cos-disabled",K="cos-button-icon",G="cos-button-prefix",J="cos-button-suffix",Q="cos-button-content",Z="cos-square",tt="cos-dashed",et="cos-light",st="cos-link",at="cos-solid",it="cos-text";var m={button:U,hover:H,active:V,disabled:q,"button-icon":"cos-button-icon",buttonIcon:K,"button-prefix":"cos-button-prefix",buttonPrefix:G,"button-suffix":"cos-button-suffix",buttonSuffix:J,"button-content":"cos-button-content",buttonContent:Q,square:Z,dashed:tt,light:et,link:st,solid:at,text:it};class A extends n.Component{initData(){return{name:void 0,value:void 0,type:"button",disabled:!1}}click(t){this.fire("click",t)}}A.trimWhitespace="all";A.template=` | ||
<button | ||
class="${b.button} {{disabled ? ${b.disabled} : ''}}" | ||
class="${m.button} {{disabled ? ${m.disabled} : ''}}" | ||
type="{{type}}" | ||
@@ -10,5 +10,5 @@ name="{{name}}" | ||
> | ||
<slot name="prefix" class="${b.buttonPrefix}"></slot> | ||
<slot class="${b.buttonContent}"></slot> | ||
<slot name="suffix" class="${b.buttonSuffix}"></slot> | ||
<slot name="prefix" class="${m.buttonPrefix}"></slot> | ||
<slot class="${m.buttonContent}"></slot> | ||
<slot name="suffix" class="${m.buttonSuffix}"></slot> | ||
</button> | ||
@@ -21,3 +21,3 @@ `;const ot="cos-horizontal",ct="cos-vertical",lt="cos-slot-container";var nt={horizontal:ot,vertical:ct,"slot-container":"cos-slot-container",slotContainer:lt};class E extends n.Component{initData(){var e,a;const t=!!((a=(e=this.sourceSlots)==null?void 0:e.noname)!=null&&a.length)||0;return{nativeAttributes:{},direction:"horizontal",hasSlot:t>0}}}E.trimWhitespace="all";E.template=` | ||
</div> | ||
`;const rt="cos-paragraph",dt="cos-md",ht="cos-xs",pt="cos-sm",ut="cos-lg",ft="cos-paragraph-nospacing",gt="cos-paragraph-prefix",bt="cos-paragraph-suffix";var h={paragraph:rt,md:dt,xs:ht,sm:pt,lg:ut,"paragraph-nospacing":"cos-paragraph-nospacing",paragraphNospacing:ft,"paragraph-prefix":"cos-paragraph-prefix",paragraphPrefix:gt,"paragraph-suffix":"cos-paragraph-suffix",paragraphSuffix:bt};class P extends n.Component{initData(){return{spacing:!1}}click(t){this.fire("click",t)}}P.trimWhitespace="all";P.template=` | ||
`;const rt="cos-paragraph",dt="cos-md",ht="cos-xs",pt="cos-sm",ut="cos-lg",ft="cos-paragraph-nospacing",gt="cos-paragraph-prefix",mt="cos-paragraph-suffix";var h={paragraph:rt,md:dt,xs:ht,sm:pt,lg:ut,"paragraph-nospacing":"cos-paragraph-nospacing",paragraphNospacing:ft,"paragraph-prefix":"cos-paragraph-prefix",paragraphPrefix:gt,"paragraph-suffix":"cos-paragraph-suffix",paragraphSuffix:mt};class P extends n.Component{initData(){return{spacing:!1}}click(t){this.fire("click",t)}}P.trimWhitespace="all";P.template=` | ||
<div | ||
@@ -42,3 +42,3 @@ s-if="!spacing" | ||
</p> | ||
`;const R=["xs","sm","md","lg","xl","xxl"];function B(s,t,e){return function(a){const i=s[a];if(typeof i=="object")for(const o in i)i.hasOwnProperty(o)&&(t[o][a]=i[o]);else t[e][a]=i}}const mt="cos-row",vt="cos-col";var Y={row:mt,col:vt};class w extends n.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parent;for(;t&&!t.isGridRow;)t=t.parent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}w.trimWhitespace="all";w.template=` | ||
`;const R=["xs","sm","md","lg","xl","xxl"];function B(s,t,e){return function(a){const i=s[a];if(typeof i=="object")for(const o in i)i.hasOwnProperty(o)&&(t[o][a]=i[o]);else t[e][a]=i}}const bt="cos-row",vt="cos-col";var Y={row:bt,col:vt};class w extends n.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parentComponent;for(;t&&!t.isGridRow;)t=t.parentComponent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}w.trimWhitespace="all";w.template=` | ||
<div class="${Y.col}" style="{{colStyle}}"> | ||
@@ -126,11 +126,11 @@ <slot></slot> | ||
</div> | ||
`;I.computed={objectFitValue(){const s="object-fit:",t=this.data.get("objectFit");return t&&["fill","contain","cover","none","scale-down"].indexOf(t)!==-1?`${s}${t};`:""}};const Ot="cos-root -v-bg-inapparent -v-h -v-px -v-text",Wt="cos-active",jt="cos-prefix",_t="cos-input",zt="cos-input-wrapper",Xt="cos-input-real -v-text",Mt="cos-input-prefix",Rt="cos-input-suffix";var m={root:Ot,active:Wt,prefix:jt,input:_t,"input-wrapper":"cos-input-wrapper",inputWrapper:zt,"input-real":"cos-input-real -v-text",inputReal:Xt,"input-prefix":"cos-input-prefix",inputPrefix:Mt,"input-suffix":"cos-input-suffix",inputSuffix:Rt};class F extends n.Component{initData(){return{nativeAttributes:{},value:"",placeholder:"",disabled:!1,hasPrefix:!!this.sourceSlots.named.prefix,hasSuffix:!!this.sourceSlots.named.suffix}}handleInput(t){const e=this.data.get("value");this.fire("input",e);const a={event:t,value:e};this.dispatch("input:input",a)}handleChange(t){const e=this.data.get("value");this.fire("change",e);const a={event:t,value:e};this.dispatch("change:input",a)}}F.template=` | ||
<div class="${m.input}"> | ||
`;I.computed={objectFitValue(){const s="object-fit:",t=this.data.get("objectFit");return t&&["fill","contain","cover","none","scale-down"].indexOf(t)!==-1?`${s}${t};`:""}};const Ot="cos-root -v-bg-inapparent -v-h -v-px -v-text",Wt="cos-active",jt="cos-prefix",_t="cos-input",zt="cos-input-wrapper",Xt="cos-input-real -v-text",Mt="cos-input-prefix",Rt="cos-input-suffix";var b={root:Ot,active:Wt,prefix:jt,input:_t,"input-wrapper":"cos-input-wrapper",inputWrapper:zt,"input-real":"cos-input-real -v-text",inputReal:Xt,"input-prefix":"cos-input-prefix",inputPrefix:Mt,"input-suffix":"cos-input-suffix",inputSuffix:Rt};class F extends n.Component{initData(){return{nativeAttributes:{},value:"",placeholder:"",disabled:!1,hasPrefix:!!this.sourceSlots.named.prefix,hasSuffix:!!this.sourceSlots.named.suffix}}handleInput(t){const e=this.data.get("value");this.fire("input",e);const a={event:t,value:e};this.dispatch("input:input",a)}handleChange(t){const e=this.data.get("value");this.fire("change",e);const a={event:t,value:e};this.dispatch("change:input",a)}}F.template=` | ||
<div class="${b.input}"> | ||
<div | ||
s-if="hasPrefix" | ||
class="${m.inputPrefix}" | ||
class="${b.inputPrefix}" | ||
> | ||
<slot name="prefix"></slot> | ||
</div> | ||
<div class="${m.inputWrapper}"> | ||
<div class="${b.inputWrapper}"> | ||
<input | ||
@@ -142,3 +142,3 @@ type="input" | ||
s-bind="nativeAttributes" | ||
class="${m.inputReal}" | ||
class="${b.inputReal}" | ||
on-input="handleInput" | ||
@@ -150,3 +150,3 @@ on-change="handleChange" | ||
s-if="hasSuffix" | ||
class="${m.inputSuffix}" | ||
class="${b.inputSuffix}" | ||
> | ||
@@ -210,3 +210,3 @@ <slot name="suffix"></slot> | ||
<th width="{{width}}" class="${g.th}"><slot></slot></th> | ||
`;const fe="UI:tr-inited",ge="click:table-tfoot-item",be="click:table-tbody-item";class f extends n.Component{constructor(){super(...arguments),this.tag=Number(Math.random()+Date.now())}initData(){return{selected:!1,pos:"tbody",tableSelectable:"single"}}inited(){this.dispatch(fe,null)}select(){const t=this.data.get("selected"),e=this.data.get("pos");this.data.set("selected",!t),this.dispatch(`select:table-select-${e==="tbody"?"item":"head"}`,!t)}handleClick(){var a,i,o;if(((a=this==null?void 0:this.parentComponent)==null?void 0:a.tagName)==="thead")return;if(((i=this==null?void 0:this.parentComponent)==null?void 0:i.tagName)==="tfoot"){this.dispatch(ge,"tfoot");return}const t=((o=this==null?void 0:this.parent)==null?void 0:o.children)||[];let e=0;t.forEach((c,l)=>{this.tag===c.tag&&(e=l)}),this.dispatch(be,e)}}f.template=` | ||
`;const fe="UI:tr-inited",ge="click:table-tfoot-item",me="click:table-tbody-item";class f extends n.Component{constructor(){super(...arguments),this.tag=Number(Math.random()+Date.now())}initData(){return{selected:!1,pos:"tbody",tableSelectable:"single"}}inited(){this.dispatch(fe,null)}select(){const t=this.data.get("selected"),e=this.data.get("pos");this.data.set("selected",!t),this.dispatch(`select:table-select-${e==="tbody"?"item":"head"}`,!t)}handleClick(){var a,i,o;if(((a=this==null?void 0:this.parentComponent)==null?void 0:a.tagName)==="thead")return;if(((i=this==null?void 0:this.parentComponent)==null?void 0:i.tagName)==="tfoot"){this.dispatch(ge,"tfoot");return}const t=((o=this==null?void 0:this.parent)==null?void 0:o.children)||[];let e=0;t.forEach((c,l)=>{this.tag===c.tag&&(e=l)}),this.dispatch(me,e)}}f.template=` | ||
<tr class="${g.tr}" on-click="handleClick($event)"> | ||
@@ -239,7 +239,7 @@ <cc-th | ||
</tr> | ||
`;f.components={"cc-td":k,"cc-th":S};f.computed={checked(){const s=this.data.get("selected");switch(this.data.get("tableSelectable")){case"single":return s?"ON":"";case"multi":return s?["ON"]:[""]}}};f.dataTypes={selected:n.DataTypes.bool,pos:n.DataTypes.oneOf(["tbody","thead","tfoot"])};const me="select:table-select-body",ve="click:table-tbody-tr",xe="UI:tbody-inited";class L extends n.Component{initData(){return{}}inited(){this.dispatch(xe,null)}eachItem(t){this.findChildTRs().forEach((e,a)=>{t.call(this,e,a),a++})}findChildTRs(){let t=[];function e(a){a instanceof f?t.push(a):a.children&&a.children.forEach(i=>{e(i)})}return e(this),t}}L.template=` | ||
`;f.components={"cc-td":k,"cc-th":S};f.computed={checked(){const s=this.data.get("selected");switch(this.data.get("tableSelectable")){case"single":return s?"ON":"";case"multi":return s?["ON"]:[""]}}};f.dataTypes={selected:n.DataTypes.bool,pos:n.DataTypes.oneOf(["tbody","thead","tfoot"])};const be="select:table-select-body",ve="click:table-tbody-tr",xe="UI:tbody-inited";class L extends n.Component{initData(){return{}}inited(){this.dispatch(xe,null)}eachItem(t){this.findChildTRs().forEach((e,a)=>{t.call(this,e,a),a++})}findChildTRs(){let t=[];function e(a){a instanceof f?t.push(a):a.children&&a.children.forEach(i=>{e(i)})}return e(this),t}}L.template=` | ||
<tbody> | ||
<slot></slot> | ||
</tbody> | ||
`;L.messages={"UI:tr-inited"(s){var e,a;let t=(s==null?void 0:s.target)||null;(e=t==null?void 0:t.data)==null||e.set("pos","tbody"),(a=t==null?void 0:t.data)==null||a.set("tableSelectable",this.data.get("tableSelectable"))},"select:table-select-item"(s){let t=this.data.get("tableSelectable"),e=1;switch(t){case"single":this.eachItem((a,i)=>{let o=a===s.target;a.data.set("selected",o),o&&(e=i)});break;case"multi":e=[],this.eachItem((a,i)=>{a.data.get("selected")&&e.push(i)});break}this.dispatch(me,e)},"click:table-tbody-item"(s){this.dispatch(ve,s.value)}};class D extends n.Component{initData(){return{selectable:"single",data:[],field:[]}}select(t){this.fire("select",t)}}D.template=` | ||
`;L.messages={"UI:tr-inited"(s){var e,a;let t=(s==null?void 0:s.target)||null;(e=t==null?void 0:t.data)==null||e.set("pos","tbody"),(a=t==null?void 0:t.data)==null||a.set("tableSelectable",this.data.get("tableSelectable"))},"select:table-select-item"(s){let t=this.data.get("tableSelectable"),e=1;switch(t){case"single":this.eachItem((a,i)=>{let o=a===s.target;a.data.set("selected",o),o&&(e=i)});break;case"multi":e=[],this.eachItem((a,i)=>{a.data.get("selected")&&e.push(i)});break}this.dispatch(be,e)},"click:table-tbody-item"(s){this.dispatch(ve,s.value)}};class D extends n.Component{initData(){return{selectable:"single",data:[],field:[]}}select(t){this.fire("select",t)}}D.template=` | ||
<cc-table selectable="{{selectable}}" on-select="select($event)"> | ||
@@ -246,0 +246,0 @@ <cc-thead> |
@@ -1,2 +0,2 @@ | ||
(function(i,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r(require("san")):typeof define=="function"&&define.amd?define(["san"],r):(i=typeof globalThis!="undefined"?globalThis:i||self,i["@cosmic-design/san"]=r(i.san))})(this,function(i){"use strict";const r=["xs","sm","md","lg","xl","xxl"];function d(o,t,s){return function(n){const e=o[n];if(typeof e=="object")for(const c in e)e.hasOwnProperty(c)&&(t[c][n]=e[c]);else t[s][n]=e}}var l={row:"cos-row",col:"cos-col"};class a extends i.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parent;for(;t&&!t.isGridRow;)t=t.parent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}return a.trimWhitespace="all",a.template=` | ||
(function(i,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r(require("san")):typeof define=="function"&&define.amd?define(["san"],r):(i=typeof globalThis!="undefined"?globalThis:i||self,i["@cosmic-design/san"]=r(i.san))})(this,function(i){"use strict";const r=["xs","sm","md","lg","xl","xxl"];function d(o,t,s){return function(n){const e=o[n];if(typeof e=="object")for(const c in e)e.hasOwnProperty(c)&&(t[c][n]=e[c]);else t[s][n]=e}}var l={row:"cos-row",col:"cos-col"};class a extends i.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parentComponent;for(;t&&!t.isGridRow;)t=t.parentComponent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}return a.trimWhitespace="all",a.template=` | ||
<div class="${l.col}" style="{{colStyle}}"> | ||
@@ -3,0 +3,0 @@ <slot></slot> |
@@ -40,3 +40,3 @@ (function(l,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("san")):typeof define=="function"&&define.amd?define(["exports","san"],n):(l=typeof globalThis!="undefined"?globalThis:l||self,n(l["@cosmic-design/san"]={},l.san))})(this,function(l,n){"use strict";var et="",m={button:"cos-button",hover:"cos-hover",active:"cos-active",disabled:"cos-disabled","button-icon":"cos-button-icon",buttonIcon:"cos-button-icon","button-prefix":"cos-button-prefix",buttonPrefix:"cos-button-prefix","button-suffix":"cos-button-suffix",buttonSuffix:"cos-button-suffix","button-content":"cos-button-content",buttonContent:"cos-button-content",square:"cos-square",dashed:"cos-dashed",light:"cos-light",link:"cos-link",solid:"cos-solid",text:"cos-text"};class E extends n.Component{initData(){return{name:void 0,value:void 0,type:"button",disabled:!1}}click(t){this.fire("click",t)}}E.trimWhitespace="all",E.template=` | ||
</p> | ||
`;const z=["xs","sm","md","lg","xl","xxl"];function R(s,t,e){return function(a){const i=s[a];if(typeof i=="object")for(const o in i)i.hasOwnProperty(o)&&(t[o][a]=i[o]);else t[e][a]=i}}var X={row:"cos-row",col:"cos-col"};class x extends n.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parent;for(;t&&!t.isGridRow;)t=t.parent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}x.trimWhitespace="all",x.template=` | ||
`;const z=["xs","sm","md","lg","xl","xxl"];function R(s,t,e){return function(a){const i=s[a];if(typeof i=="object")for(const o in i)i.hasOwnProperty(o)&&(t[o][a]=i[o]);else t[e][a]=i}}var X={row:"cos-row",col:"cos-col"};class x extends n.Component{initData(){return{span:void 0,xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},size:"xs",rowCurrent:void 0}}inited(){let t=this.parentComponent;for(;t&&!t.isGridRow;)t=t.parentComponent;t&&t.data&&(this.data.set("size",t.data.get("size")),this.data.set("rowCurrent",t.data.get("current")))}}x.trimWhitespace="all",x.template=` | ||
<div class="${X.col}" style="{{colStyle}}"> | ||
@@ -184,3 +184,3 @@ <slot></slot> | ||
</div> | ||
`;var b={table:"cos-table",thead:"cos-thead",th:"cos-th",td:"cos-td",xs:"cos-xs",icon:"cos-icon",sm:"cos-sm",md:"cos-md",lg:"cos-lg",xl:"cos-xl",xxl:"cos-xxl",tr:"cos-tr",hover:"cos-hover",active:"cos-active",disabled:"cos-disabled"};class y extends n.Component{initData(){return{selectable:""}}attached(){!this.data.get("selectable")||this.thead&&this.thead.updateSelectAllState(this.isAllSelected())}isAllSelected(){var a;const t=((a=this==null?void 0:this.tbody)==null?void 0:a.findChildTRs())||[];let e=!0;if((t==null?void 0:t.length)>0){for(let i=0,o=t==null?void 0:t.length;i<o;i++)if(!t[i].data.get("selected")){e=!1;break}}else e=!1;return e}}y.template=` | ||
`;var b={table:"cos-table",thead:"cos-thead",th:"cos-th",td:"cos-td",xs:"cos-xs",icon:"cos-icon",sm:"cos-sm",md:"cos-md",lg:"cos-lg",xl:"cos-xl",xxl:"cos-xxl",tr:"cos-tr",hover:"cos-hover",active:"cos-active",disabled:"cos-disabled"};class C extends n.Component{initData(){return{selectable:""}}attached(){!this.data.get("selectable")||this.thead&&this.thead.updateSelectAllState(this.isAllSelected())}isAllSelected(){var a;const t=((a=this==null?void 0:this.tbody)==null?void 0:a.findChildTRs())||[];let e=!0;if((t==null?void 0:t.length)>0){for(let i=0,o=t==null?void 0:t.length;i<o;i++)if(!t[i].data.get("selected")){e=!1;break}}else e=!1;return e}}C.template=` | ||
<table class="${b.table}"> | ||
@@ -191,5 +191,5 @@ <slot name="header"></slot> | ||
</table> | ||
`,y.messages={"UI:tbody-inited"(s){var t;this.tbody=s.target,(t=s==null?void 0:s.target)==null||t.data.set("tableSelectable",this.data.get("selectable"))},"UI:thead-inited"(s){var t,e;this.thead=s.target,(e=(t=s==null?void 0:s.target)==null?void 0:t.data)==null||e.set("tableSelectable",this.data.get("selectable"))},"select:table-select-head"(s){var a;let t=[];const e=s.value;(a=this==null?void 0:this.tbody)==null||a.eachItem((i,o)=>{i.data.get("disabled")?i.data.get("selected")&&t.push(o):(i.data.set("selected",e),e&&t.push(o))}),this.fire("select",t)},"select:table-select-body"(s){this.thead&&this.thead.updateSelectAllState(this.isAllSelected()),this.fire("select",s.value)},"click:table-tbody-tr"(s){this.fire("click",s.value)}};const q="UI:thead-inited";class C extends n.Component{inited(){this.dispatch(q,null)}updateSelectAllState(t){this.tr&&this.tr.data.set("selected",t)}initData(){return{}}}C.template=` | ||
`,C.messages={"UI:tbody-inited"(s){var t;this.tbody=s.target,(t=s==null?void 0:s.target)==null||t.data.set("tableSelectable",this.data.get("selectable"))},"UI:thead-inited"(s){var t,e;this.thead=s.target,(e=(t=s==null?void 0:s.target)==null?void 0:t.data)==null||e.set("tableSelectable",this.data.get("selectable"))},"select:table-select-head"(s){var a;let t=[];const e=s.value;(a=this==null?void 0:this.tbody)==null||a.eachItem((i,o)=>{i.data.get("disabled")?i.data.get("selected")&&t.push(o):(i.data.set("selected",e),e&&t.push(o))}),this.fire("select",t)},"select:table-select-body"(s){this.thead&&this.thead.updateSelectAllState(this.isAllSelected()),this.fire("select",s.value)},"click:table-tbody-tr"(s){this.fire("click",s.value)}};const q="UI:thead-inited";class y extends n.Component{inited(){this.dispatch(q,null)}updateSelectAllState(t){this.tr&&this.tr.data.set("selected",t)}initData(){return{}}}y.template=` | ||
<thead class="${b.thead}"><slot></slot></thead> | ||
`,C.messages={"UI:tr-inited"(s){var t,e;(t=s.target)==null||t.data.set("pos","thead"),(e=s.target)==null||e.data.set("tableSelectable",this.data.get("tableSelectable")),this.tr=s.target}};const V="UI:tfoot-inited";class _ extends n.Component{inited(){this.dispatch(V,null)}}_.template=` | ||
`,y.messages={"UI:tr-inited"(s){var t,e;(t=s.target)==null||t.data.set("pos","thead"),(e=s.target)==null||e.data.set("tableSelectable",this.data.get("tableSelectable")),this.tr=s.target}};const V="UI:tfoot-inited";class _ extends n.Component{inited(){this.dispatch(V,null)}}_.template=` | ||
<tfoot> | ||
@@ -252,2 +252,2 @@ <slot></slot> | ||
</cc-table> | ||
`,D.components={"cc-tr":f,"cc-th":S,"cc-td":k,"cc-tbody":L,"cc-thead":C,"cc-table":y},D.filters={renderField(s,t){return typeof s.content=="function"?s.content.call(this,t):s.prop?t[s.prop]:""}},l.Button=E,l.Col=x,l.ConfigurableTable=D,l.Divider=P,l.Image=I,l.Input=M,l.Paragraph=N,l.Row=W,l.Swiper=w,l.SwiperItem=O,l.TBody=L,l.TD=k,l.TFoot=_,l.TH=S,l.THead=C,l.TR=f,l.Table=y,l.Tabs=T,l.TabsItem=j,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
`,D.components={"cc-tr":f,"cc-th":S,"cc-td":k,"cc-tbody":L,"cc-thead":y,"cc-table":C},D.filters={renderField(s,t){return typeof s.content=="function"?s.content.call(this,t):s.prop?t[s.prop]:""}},l.Button=E,l.Col=x,l.ConfigurableTable=D,l.Divider=P,l.Image=I,l.Input=M,l.Paragraph=N,l.Row=W,l.Swiper=w,l.SwiperItem=O,l.TBody=L,l.TD=k,l.TFoot=_,l.TH=S,l.THead=y,l.TR=f,l.Table=C,l.Tabs=T,l.TabsItem=j,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -45,5 +45,5 @@ import { Component } from "san"; | ||
inited() { | ||
let parent = this.parent; | ||
let parent = this.parentComponent; | ||
while (parent && !parent.isGridRow) { | ||
parent = parent.parent; | ||
parent = parent.parentComponent; | ||
} | ||
@@ -50,0 +50,0 @@ if (parent && parent.data) { |
@@ -189,5 +189,5 @@ import { Component, DataTypes } from "san"; | ||
inited() { | ||
let parent = this.parent; | ||
let parent = this.parentComponent; | ||
while (parent && !parent.isGridRow) { | ||
parent = parent.parent; | ||
parent = parent.parentComponent; | ||
} | ||
@@ -194,0 +194,0 @@ if (parent && parent.data) { |
{ | ||
"name": "@cosmic-design/san", | ||
"version": "0.1.1-beta.bc2614d", | ||
"version": "0.1.1-beta.c46fae2", | ||
"scripts": { | ||
"build": "node ./script/build.js", | ||
"build": "node ./script/build.js && npm run build:talos", | ||
"build:talos": "node ./script/build.talos.js", | ||
"watch": "node ./script/watch.js", | ||
@@ -23,2 +24,6 @@ "test": "jest", | ||
"require": "./dist/cjs/index.js" | ||
}, | ||
"./talos/*": { | ||
"import": "./dist/talos/*", | ||
"require": "./dist/talos/*" | ||
} | ||
@@ -33,3 +38,3 @@ }, | ||
"dependencies": { | ||
"@cosmic-design/style": "0.1.1-beta.bc2614d", | ||
"@cosmic-design/style": "0.1.1-beta.c46fae2", | ||
"prismjs": "~1.27.0", | ||
@@ -36,0 +41,0 @@ "san": "~3.11.1" |
@@ -88,6 +88,7 @@ /** | ||
inited() { | ||
// 暂时采用 parentComponent,如果使用 parent 在 san-ssr 中获取不到 | ||
let parent = this.parentComponent; | ||
// @ts-ignore | ||
let parent = this.parent; | ||
while (parent && !parent.isGridRow) { | ||
parent = parent.parent; | ||
parent = parent.parentComponent; | ||
} | ||
@@ -94,0 +95,0 @@ |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
620056
353
9436
38
+ Added@cosmic-design/style@0.1.1-beta.c46fae2(transitive)
- Removed@cosmic-design/style@0.1.1-beta.bc2614d(transitive)