@appscode/ui-builder
Version:
## Motivation
1 lines • 6.59 kB
JavaScript
import{h as t,g as e,ad as a,n as s}from"./wrapper-5d451278.js";import"vue";import"./es.array.concat-bc6da240.js";import"./index-ba66ec6f.js";import"./web.dom-collections.iterator-98113e95.js";import"./set-to-string-tag-edc1b53a.js";import"./object-set-prototype-of-866dfe15.js";import{_ as n,r as l}from"./stickyContent-c27d9838.js";import"./index-f7c726f7.js";import"./es.function.name-b20a5f0c.js";import"./SingleStepForm-e4a2064c.js";import"./FormElement-3679b8af.js";import"./data-function-mixins-f9cb6d20.js";import"./individual-item-disablity-check-7d31b40d.js";import"./function-call-mixins-9e1aa828.js";import{_ as r}from"./tag-icon-da9ce06c.js";import{_ as i}from"./SingleStepFormArray-4c21aac5.js";var o=s({render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return 0!==t.dataForTable.length?a("div",{staticClass:"ac-table-container table-container"},[a("table",{staticClass:"table ac-table ac-striped is-fullwidth"},[a("thead",[a("tr",[t._l(t.tableRowsName,(function(e,s){return a("th",{key:s},[t._v("\n "+t._s(t.$ubt(e))+"\n ")])})),t._v(" "),a("th",{staticClass:"has-text-right"},[t._v("Actions")])],2)]),t._v(" "),a("tbody",[t._l(t.dataForTable,(function(e,s){return[a("tr",{key:s},[t._l(t.tableValuesPath,(function(s,n){return a("td",{key:n},["key-operator-values-array"===t.tableData[n].typeOfValue?t._l(t.getTableValue(e,s),(function(e,s){return a("span",{key:s},[a("span",{staticClass:"circle-list-shape"}),t._v(" "),a("code",[t._v(t._s(t.$ubt(e.key))+" "+t._s(t.$ubt(e.operator))+"\n "+t._s("["+t.$ubt(e.values.join(", "))+"]"))]),t._v(" "),a("br")])})):"array"===t.tableData[n].typeOfValue?t._l(t.getTableValue(e,s),(function(e,s){return a("span",{key:s},[a("span",{staticClass:"circle-list-shape"}),a("strong",[t._v(t._s(t.$ubt(e)))]),t._v(" "),a("br")])})):"key-value"===t.tableData[n].typeOfValue?t._l(t.getTableValue(e,s),(function(e,s){return a("span",{key:s},[a("div",{staticClass:"label-action is-flex is-flex-wrap-wrap"},[t._m(0,!0),t._v(" "),a("strong",[t._v(t._s(s)+" : "+t._s(e)+" ")])]),t._v(" "),a("br")])})):"code"===t.tableData[n].typeOfValue?[a("pre",[t._v(t._s(t.getTableValue(e,s)))])]:[t._v("\n "+t._s(t.$ubt(t.getTableValue(e,s)))+"\n ")]],2)})),t._v(" "),a("td",[a("div",{staticClass:"buttons is-pulled-right"},[a("button",{staticClass:"button ac-button is-square is-tinny is-outlined-gray is-transparent",attrs:{title:t.$ubt("buttons.show_details")},on:{click:function(e){return e.preventDefault(),t.onDetailsClick(s)}}},[a("i",{class:["fa",t.showFieldIdx===s?"fa-angle-up":"fa-angle-down"],attrs:{"aria-hidden":"true"}})])])])],2),t._v(" "),t.showFieldIdx===s?a("tr",{key:s+"-show",staticClass:"is-selected"},[a("td",{staticClass:"pr-0"},t._l(t.tableContents,(function(s,n){return a("div",{key:n},["value"===s.type?a("div",{staticClass:"single-name-title mb-10"},[a("h6",{staticClass:"is-small"},[a("span",[t._v(t._s(t.$ubt(s.label&&s.label.text)))])]),t._v(" "),"string"===s.typeOfValue?a("p",{staticClass:"is-small"},[t._v("\n "+t._s(t.getTableValue(e,s.path))+"\n ")]):t._e(),t._v(" "),"array"===s.typeOfValue?a("ul",{staticClass:"ac-unordered-list-items"},t._l(t.getTableValue(e,s.path),(function(e,s){return a("li",{key:s},[a("span",{staticClass:"circle-list-shape"}),t._v(" "),a("strong",[t._v(t._s(e))])])})),0):t._e(),t._v(" "),"key-value"===s.typeOfValue?a("ul",{staticClass:"ac-unordered-list-items"},t._l(t.getTableValue(e,s.path),(function(e,s){return a("li",{key:s},[a("div",{staticClass:"label-action is-flex is-flex-wrap-wrap"},[t._m(1,!0),t._v(" "),a("strong",[t._v(t._s(s)+" : "+t._s(e)+" ")])])])})),0):t._e(),t._v(" "),"code"===s.typeOfValue?a("pre",[t._v(t._s(t.getTableValue(e,s.path)))]):t._e(),t._v(" "),"object-array"===s.typeOfValue||"key-operator-values-array"===s.typeOfValue?a("ub-object-array-table",{attrs:{"table-contents":s.tableContents,"model-value":t.getTableValue(e,s.path)}}):t._e()],1):t._e(),t._v(" "),"label"===s.type&&s.label&&""!==s.label.text?a("ub-label-element",{attrs:{label:t.label}}):t._e()],1)})),0)]):t._e()]}))],2)])]):t._e()},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"label-icon"},[e("img",{attrs:{src:r,alt:""}})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"label-icon"},[e("img",{attrs:{src:r,alt:""}})])}]},void 0,{name:"ub-object-array-table",components:{UbObjectArrayTable:function(){return Promise.resolve().then((function(){return u})).then((function(t){return t.default}))},UbLabelElement:function(){return import("./LabelElement-d1b528f2.js").then((function(t){return t.default}))}},props:{tableContents:{type:Array,default:function(){return[]}},modelValue:{type:Array,default:function(){return[]}}},data:function(){return{showFieldIdx:"",dataForTable:""}},watch:{modelValue:{deep:!0,handler:function(t){this.updateDataForTable(t)}}},mounted:function(){this.updateDataForTable(this.modelValue)},computed:{tableData:function(){return this.tableContents.filter((function(t){return t.inTableColumn}))},tableValuesPath:function(){return this.tableData.map((function(t){return t.path}))},tableRowsName:function(){return this.tableData.map((function(t){var e;return null===(e=t.label)||void 0===e?void 0:e.text}))}},methods:{getTableValue:function(e,a){return t(e,"#/"+a)},onDetailsClick:function(t){this.showFieldIdx!==t?this.showFieldIdx=t:this.showFieldIdx=""},updateDataForTable:function(t){var a=this;return n(l.mark((function s(){var n,r,o;return l.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:a.dataForTable=e(t),n=i(a.tableContents),s.prev=2,o=l.mark((function e(){var s,n,i;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(s=r.value).computed){e.next=7;break}return n=t.map((function(t){return a.performFuncCall(s.computed,t)})),e.next=5,Promise.all(n);case 5:i=e.sent,a.dataForTable.forEach((function(t,e){a.setValue(t,s.path.split("/"),i[e])}));case 7:case"end":return e.stop()}}),e)})),n.s();case 5:if((r=n.n()).done){s.next=9;break}return s.delegateYield(o(),"t0",7);case 7:s.next=5;break;case 9:s.next=14;break;case 11:s.prev=11,s.t1=s.catch(2),n.e(s.t1);case 14:return s.prev=14,n.f(),s.finish(14);case 17:case"end":return s.stop()}}),s,null,[[2,11,14,17]])})))()},setValue:function(t,e,s){if("object"!==a(t)&&(t={}),1===e.length)this.$set(t,e[0],s);else if(e.length>1){var n=e.shift();t[n]||this.$set(t,n,{}),this.setValue(t[n],e,s)}}}},void 0,!1,void 0,!1,void 0,void 0,void 0),u=Object.freeze({__proto__:null,default:o});export default o;