@htmlbricks/hb-form-composer 0.20.14 → 0.20.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/release/manifest.json +1 -1
- package/release/release.js +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@htmlbricks/hb-form-composer",
|
|
3
3
|
"displayName": "Svelte-Bootstrap form-composer",
|
|
4
4
|
"description": "Svelte-Bootstrap form-composer",
|
|
5
|
-
"version": "0.20.
|
|
5
|
+
"version": "0.20.15",
|
|
6
6
|
"main": "release/release.js",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"webcomponents"
|
|
76
76
|
],
|
|
77
77
|
"contributors": [],
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "dd6a5cf7cc52fa6572b0f3db83e52fd2c9ba4126",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@htmlbricks/hb-dialogform": "^0.20.
|
|
81
|
-
"@htmlbricks/hb-form": "^0.20.
|
|
82
|
-
"@htmlbricks/hb-table": "^0.20.
|
|
80
|
+
"@htmlbricks/hb-dialogform": "^0.20.15",
|
|
81
|
+
"@htmlbricks/hb-form": "^0.20.15",
|
|
82
|
+
"@htmlbricks/hb-table": "^0.20.15",
|
|
83
83
|
"style-to-object": "^0.3.0"
|
|
84
84
|
}
|
|
85
85
|
}
|
package/release/manifest.json
CHANGED
package/release/release.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var release=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function l(e,t){e.appendChild(t)}function i(e,t,n){e.insertBefore(t,n||null)}function s(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function u(e){return document.createTextNode(e)}function d(){return u(" ")}function p(){return u("")}function f(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function m(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function h(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:m(e,t,n)}function b(e,t,n,o){null==n?e.style.removeProperty(t):e.style.setProperty(t,n,o?"important":"")}function y(e){const t={};for(const n of e)t[n.name]=n.value;return t}let v;function g(e){v=e}function $(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const e=$();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const a=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,a)})),!a.defaultPrevented}return!0}}const x=[],k=[];let T=[];const _=[],C=Promise.resolve();let E=!1;function N(e){T.push(e)}const S=new Set;let V=0;function L(){if(0!==V)return;const e=v;do{try{for(;V<x.length;){const e=x[V];V++,g(e),O(e.$$)}}catch(e){throw x.length=0,V=0,e}for(g(null),x.length=0,V=0;k.length;)k.pop()();for(let e=0;e<T.length;e+=1){const t=T[e];S.has(t)||(S.add(t),t())}T.length=0}while(x.length);for(;_.length;)_.pop()();E=!1,S.clear(),g(e)}function O(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(N)}}const P=new Set;function q(e,t){e&&e.i&&(P.delete(e),e.i(t))}function A(e,t){e.d(1),t.delete(e.key)}function M(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];T.forEach((o=>-1===e.indexOf(o)?t.push(o):n.push(o))),n.forEach((e=>e())),T=t}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function j(e,t){-1===e.$$.dirty[0]&&(x.push(e),E||(E=!0,C.then(L)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function D(a,l,i,c,u,d,p,f=[-1]){const m=v;g(a);const h=a.$$={fragment:null,ctx:[],props:d,update:e,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:l.target||m.$$.root};p&&p(h.root);let b=!1;if(h.ctx=i?i(a,l.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&u(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),b&&j(a,e)),t})):[],h.update(),b=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),l.target){if(l.hydrate){const e=function(e){return Array.from(e.childNodes)}(l.target);h.fragment&&h.fragment.l(e),e.forEach(s)}else h.fragment&&h.fragment.c();l.intro&&q(a.$$.fragment),function(e,n,a,l){const{fragment:i,after_update:s}=e.$$;i&&i.m(n,a),l||N((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),s.forEach(N)}(a,l.target,l.anchor,l.customElement),L()}g(m)}let J;"function"==typeof HTMLElement&&(J=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){M(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var I="0.20.14",R=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,z=/\n/g,F=/^\s*/,B=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,W=/^:\s*/,H=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,K=/^[;\s]*/,G=/^\s+|\s+$/g,Q="";function U(e){return e?e.replace(G,Q):Q}var X=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,a,l=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(z);t&&(n+=t.length);var r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function a(){var e={line:n,column:o};return function(t){return t.position=new l(e),c(),t}}function l(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function i(r){var a=new Error(t.source+":"+n+":"+o+": "+r);if(a.reason=r,a.filename=t.source,a.line=n,a.column=o,a.source=e,!t.silent)throw a}function s(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function c(){s(F)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=a();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;Q!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,Q===e.charAt(n-1))return i("End of comment missing");var l=e.slice(2,n-2);return o+=2,r(l),e=e.slice(n),o+=2,t({type:"comment",comment:l})}}function p(){var e=a(),t=s(B);if(t){if(d(),!s(W))return i("property missing ':'");var n=s(H),o=e({type:"declaration",property:U(t[0].replace(R,Q)),value:n?U(n[0].replace(R,Q)):Q});return s(K),o}}return l.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()}(e),i="function"==typeof t,s=0,c=l.length;s<c;s++)r=(n=l[s]).property,a=n.value,i?t(r,a,n):a&&(o||(o={}),o[r]=a);return o};var Y,Z=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var a=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},l=0,i=Object.keys(e);l<i.length;l++)a(i[l]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},e.getDictionaryWord=function(t,n,o){var r;if(!t)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[t]))return n[o][t];var a="",l=e.getDefaultLang();if(!o||l!==o){var i=null==n?void 0:n[l];(null==i?void 0:i[t])&&(a=i[t])}return a},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(Y={exports:{}},Y.exports),Y.exports),ee={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"invalid-feedback",description:""},{name:"main_button",description:""},{name:"button_container",description:""}]},te={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]},ne={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]};function oe(e,t,n){const o=e.slice();return o[25]=t[n],o}function re(e){let t,n,r,a,l;return{c(){t=c("hb-dialogform"),h(t,"title","Add property"),h(t,"show",n=e[7]?"yes":"no"),h(t,"schema",r=e[25].schema),h(t,"style",e[4])},m(n,o){i(n,t,o),a||(l=[f(t,"modalFormConfirm",e[17]),f(t,"modalFormCancel",e[18]),f(t,"modalShow",e[19])],a=!0)},p(e,o){128&o&&n!==(n=e[7]?"yes":"no")&&h(t,"show",n),4&o&&r!==(r=e[25].schema)&&h(t,"schema",r),16&o&&h(t,"style",e[4])},d(e){e&&s(t),a=!1,o(l)}}}function ae(e,t){let n,o,r=t[25].counter===t[2].length-1&&re(t);return{key:e,first:null,c(){n=p(),r&&r.c(),o=p(),this.first=n},m(e,t){i(e,n,t),r&&r.m(e,t),i(e,o,t)},p(e,n){(t=e)[25].counter===t[2].length-1?r?r.p(t,n):(r=re(t),r.c(),r.m(o.parentNode,o)):r&&(r.d(1),r=null)},d(e){e&&s(n),r&&r.d(e),e&&s(o)}}}function le(e){let t,n,o;function r(e,t){return e[1]?.length?se:ie}let a=r(e),l=a(e);return{c(){t=c("h2"),t.textContent="output",n=d(),l.c(),o=p(),b(t,"margin","60px"),b(t,"text-align","center"),b(t,"color","blue")},m(e,r){i(e,t,r),i(e,n,r),l.m(e,r),i(e,o,r)},p(e,t){a===(a=r(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(o.parentNode,o)))},d(e){e&&s(t),e&&s(n),l.d(e),e&&s(o)}}}function ie(t){let n;return{c(){n=u("...no output")},m(e,t){i(e,n,t)},p:e,d(e){e&&s(n)}}}function se(e){let t,n;return{c(){t=c("hb-form"),h(t,"hide_submit","yes"),h(t,"schema",n=JSON.stringify(e[1])),h(t,"style",e[3])},m(e,n){i(e,t,n)},p(e,o){2&o&&n!==(n=JSON.stringify(e[1]))&&h(t,"schema",n),8&o&&h(t,"style",e[3])},d(e){e&&s(t)}}}function ce(t){let n,r,a,u,b,y,v,g,$,w=[],x=new Map,k=t[2];const T=e=>e[25].counter;for(let e=0;e<k.length;e+=1){let n=oe(t,k,e),o=T(n);x.set(o,w[e]=ae(o,n))}let _=t[0]&&le(t);return{c(){n=c("hb-table"),r=c("span"),a=c("button"),a.textContent="done",b=d();for(let e=0;e<w.length;e+=1)w[e].c();y=d(),_&&_.c(),v=p(),this.c=e,m(a,"class","btn btn-outline-primary btn-sm"),m(r,"slot","buttons-container"),h(n,"id","table_specs"),h(n,"style",t[5]),h(n,"disablepagination","yes"),h(n,"headers",JSON.stringify(t[8])),h(n,"rows",u=JSON.stringify(t[6])),h(n,"add_item","yes")},m(e,o){i(e,n,o),l(n,r),l(r,a),i(e,b,o);for(let t=0;t<w.length;t+=1)w[t]&&w[t].m(e,o);i(e,y,o),_&&_.m(e,o),i(e,v,o),g||($=[f(a,"click",t[11]),f(n,"tableCustomActionClick",t[15]),f(n,"addItem",t[16])],g=!0)},p(e,[t]){32&t&&h(n,"style",e[5]),64&t&&u!==(u=JSON.stringify(e[6]))&&h(n,"rows",u),660&t&&(k=e[2],w=function(e,t,n,r,a,l,i,s,c,u,d,p){let f=e.length,m=l.length,h=f;const b={};for(;h--;)b[e[h].key]=h;const y=[],v=new Map,g=new Map,$=[];for(h=m;h--;){const e=p(a,l,h),o=n(e);let s=i.get(o);s?r&&$.push((()=>s.p(e,t))):(s=u(o,e),s.c()),v.set(o,y[h]=s),o in b&&g.set(o,Math.abs(h-b[o]))}const w=new Set,x=new Set;function k(e){q(e,1),e.m(s,d),i.set(e.key,e),d=e.first,m--}for(;f&&m;){const t=y[m-1],n=e[f-1],o=t.key,r=n.key;t===n?(d=t.first,f--,m--):v.has(r)?!i.has(o)||w.has(o)?k(t):x.has(r)?f--:g.get(o)>g.get(r)?(x.add(o),k(t)):(w.add(r),f--):(c(n,i),f--)}for(;f--;){const t=e[f];v.has(t.key)||c(t,i)}for(;m;)k(y[m-1]);return o($),y}(w,t,T,1,e,k,x,y.parentNode,A,ae,y,oe)),e[0]?_?_.p(e,t):(_=le(e),_.c(),_.m(v.parentNode,v)):_&&(_.d(1),_=null)},i:e,o:e,d(e){e&&s(n),e&&s(b);for(let t=0;t<w.length;t+=1)w[t].d(e);e&&s(y),_&&_.d(e),e&&s(v),g=!1,o($)}}}function ue(e,t,n){const o=$(),r=w();let{id:a}=t,{style:l}=t,{debug:i}=t,{output_schema:s}=t;const c=[{id:"first-row",type:"row",params:{columns:[{type:"text",placeholder:"Label...",id:"label",required:!0,label:"Property Label",validationTip:"This field cannot be empty."},{type:"select",placeholder:"Select something here...",id:"type",required:!0,label:"Type",validationTip:"This field cannot be empty.",params:{options:[{label:"",value:""},{label:"text",value:"text"},{label:"textarea",value:"textarea"},{label:"email",value:"email"},{label:"number",value:"number"},{label:"select",value:"select"},{label:"radio",value:"radio"},{label:"checkbox",value:"checkbox"},{label:"file",value:"file"},{label:"date",value:"date"},{label:"datetime",value:"datetime"},{label:"color",value:"color"},{label:"range",value:"range"}]}}]}},{id:"conditionals-row",type:"row",params:{columns:[{type:"checkbox",placeholder:"Conditional...",id:"conditional",label:"Is Conditional?"},{type:"checkbox",placeholder:"Required...",id:"required",label:"Is Required?"}]}},{id:"size-row",type:"row",params:{columns:[{type:"number",placeholder:"Min...",id:"min",label:"Min",dependencies:[{id:"type",values:["number","date","datetime","text","textarea","range"]}]},{type:"number",placeholder:"Max...",id:"max",label:"Max",dependencies:[{id:"type",values:["number","date","datetime","text","textarea","range"]}]}]}},{type:"arrayobjects",label:"conditions",id:"conditions",params:{addPropertyLabel:"add condition",schema:[{id:"conditions-row",type:"row",params:{columns:[{type:"text",placeholder:"Condition Property name...",id:"conditionlabel",required:!0,label:"Label",validationTip:"This field cannot be empty."},{type:"text",placeholder:"Condition values (separated by comma)...",id:"conditionvalue",label:"Values",validationTip:"This field cannot be empty."}]}}]},dependencies:[{id:"conditional"}]},{type:"arrayobjects",label:"options",placeholder:"Insert your last name here...",id:"options",validationTip:"This field cannot be empty.",params:{addPropertyLabel:"add option",schema:[{id:"options-row",type:"row",params:{columns:[{type:"text",placeholder:"Property name...",id:"optionlabel",required:!0,label:"Label",validationTip:"This field cannot be empty."},{type:"text",placeholder:"Value...",id:"optionvalue",label:"Value",required:!0,validationTip:"This field cannot be empty."}]}}]},dependencies:[{id:"type",values:["select","radio"]}]}];let u,d,p,f="",m="",h="";let b,y=!1;function v(e){console.log("addSchema",e);let t,o={};if(e.conditions&&(t=e.conditions.map((e=>({id:e.conditionlabel,values:e.conditionvalue?e.conditionvalue.replace(", ",",").replace(" ,",",").split(","):void 0})))),"text"!==e.type&&"textarea"!==e.type&&"number"!==e.type&&"datetime"!==e.type&&"date"!==e.type&&"range"!==e.type||(e.min&&(o.min=e.min),e.max&&(o.max=e.max)),"select"===e.type||"radio"===e.type&&e.options.length){o.options=[];for(const t of e.options)o.options.push({label:t.optionlabel,value:t.optionvalue})}const r={id:e.label,type:e.type,label:e.label,required:e.required,placeholder:e.placeholder,dependencies:t};Object.keys(o).length&&(r.params=o),s.find((t=>t.label===e.label))?n(1,s=s.map((t=>t.label===e.label?r:t))):n(1,s=[...s,r]),n(2,u=[...u,{counter:u.length,schema:JSON.stringify(c)}]),console.info("schema4selectorS",u)}function g(e){console.log(e,s);const t=s.find((t=>t.label===e));if(null==t?void 0:t.value)return console.warn("cannot remove default value");n(1,s=s.filter((t=>t.label!==e))),n(2,u=u.filter((e=>e.counter!==u.length-1)))}!function(e){$().$$.on_mount.push(e)}((()=>{Z.addComponent({repoName:"@htmlbricks/hb-form",version:I}),Z.addComponent({repoName:"@htmlbricks/hb-table",version:I}),Z.addComponent({repoName:"@htmlbricks/hb-dialogform",version:I}),p=o.shadowRoot.getElementById("schema"),console.log("formComponent",p)}));return e.$$set=e=>{"id"in e&&n(12,a=e.id),"style"in e&&n(13,l=e.style),"debug"in e&&n(0,i=e.debug),"output_schema"in e&&n(1,s=e.output_schema)},e.$$.update=()=>{if(28679&e.$$.dirty){if(a||n(12,a=""),l&&(n(14,d=X(l)),n(3,f=Z.getChildStyleToPass(d,null==ee?void 0:ee.vars)),n(5,h=Z.getChildStyleToPass(d,null==te?void 0:te.vars)),n(4,m=Z.getChildStyleToPass(d,null==ne?void 0:ne.vars))),"string"==typeof s&&""!==s)try{console.log("parsing output_schema"),n(1,s=JSON.parse(s))}catch(e){console.error("error parsing output_schema",e)}s||n(1,s=[]),"string"!=typeof i||"true"!==i&&"yes"!==i&&""!==i?!0!==i&&n(0,i=!1):n(0,i=!0),u||n(2,u=[{counter:0,schema:JSON.stringify(c)}]);const e=[];for(const t of s){let n,o;t.params&&(o=JSON.stringify(t.params)),t.dependencies&&(n=JSON.stringify(t.dependencies)),e.push({_id:t.label,label:t.label,type:t.type,params:o,required:t.required,dependencies:n,value:t.value,_actions:[{name:"delete",type:"icon",iconOrText:"x-octagon-fill",disabled:!!t.value}]})}n(6,b=e)}},[i,s,u,f,m,h,b,y,[{label:"Label",key:"label"},{label:"type",key:"type"},{label:"params",key:"params",nosort:!0},{label:"dependencies",key:"dependencies"},{label:"required",key:"required"},{label:"value",key:"value"},{label:"modifiche",key:"mod",type:"actions",nosort:!0}],v,g,function(){!function(e,t){r(e,t),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(e,{detail:t}))}("done",{schema:s,id:a})},a,l,d,e=>{"delete"===e.detail.action&&g(e.detail.itemId)},e=>{n(7,y=!0)},e=>{console.log(e.detail),v(e.detail),n(7,y=!1)},e=>{console.log("cancelform"),n(7,y=!1)},e=>{console.log("modalShow"),n(7,y=e.detail.show)}]}class de extends J{constructor(e){super();const t=document.createElement("style");t.textContent='@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif}.btn{display:inline-block;font-weight:400;line-height:1.5;color:#212529;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;user-select:none;background-color:transparent;border:1px solid transparent;padding:0.375rem 0.75rem;font-size:1rem;border-radius:0.25rem;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out}@media(prefers-reduced-motion: reduce){.btn{transition:none}}.btn:hover{color:#212529}.btn:focus{outline:0;box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.25)}.btn:disabled{pointer-events:none;opacity:0.65}.btn-outline-primary{color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:hover{color:#fff;background-color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:focus{box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.5)}.btn-outline-primary:active{color:#fff;background-color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:active:focus{box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.5)}.btn-outline-primary:disabled{color:var(--bs-primary,#07689f);background-color:transparent}.btn-sm{padding:0.25rem 0.5rem;font-size:0.875rem;border-radius:0.2rem}',this.shadowRoot.appendChild(t),D(this,{target:this.shadowRoot,props:y(this.attributes),customElement:!0},ue,ce,a,{id:12,style:13,debug:0,output_schema:1},null),e&&(e.target&&i(e.target,this,e.anchor),e.props&&(this.$set(e.props),L()))}static get observedAttributes(){return["id","style","debug","output_schema"]}get id(){return this.$$.ctx[12]}set id(e){this.$$set({id:e}),L()}get style(){return this.$$.ctx[13]}set style(e){this.$$set({style:e}),L()}get debug(){return this.$$.ctx[0]}set debug(e){this.$$set({debug:e}),L()}get output_schema(){return this.$$.ctx[1]}set output_schema(e){this.$$set({output_schema:e}),L()}}return customElements.define("hb-form-composer",de),de}();
|
|
1
|
+
var release=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function l(e,t){e.appendChild(t)}function i(e,t,n){e.insertBefore(t,n||null)}function s(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function u(e){return document.createTextNode(e)}function d(){return u(" ")}function p(){return u("")}function f(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function m(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function h(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:m(e,t,n)}function b(e,t,n,o){null==n?e.style.removeProperty(t):e.style.setProperty(t,n,o?"important":"")}function y(e){const t={};for(const n of e)t[n.name]=n.value;return t}let v;function g(e){v=e}function $(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const e=$();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const a=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,a)})),!a.defaultPrevented}return!0}}const x=[],k=[];let T=[];const _=[],C=Promise.resolve();let E=!1;function N(e){T.push(e)}const S=new Set;let V=0;function L(){if(0!==V)return;const e=v;do{try{for(;V<x.length;){const e=x[V];V++,g(e),O(e.$$)}}catch(e){throw x.length=0,V=0,e}for(g(null),x.length=0,V=0;k.length;)k.pop()();for(let e=0;e<T.length;e+=1){const t=T[e];S.has(t)||(S.add(t),t())}T.length=0}while(x.length);for(;_.length;)_.pop()();E=!1,S.clear(),g(e)}function O(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(N)}}const P=new Set;function q(e,t){e&&e.i&&(P.delete(e),e.i(t))}function A(e,t){e.d(1),t.delete(e.key)}function M(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];T.forEach((o=>-1===e.indexOf(o)?t.push(o):n.push(o))),n.forEach((e=>e())),T=t}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function j(e,t){-1===e.$$.dirty[0]&&(x.push(e),E||(E=!0,C.then(L)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function D(a,l,i,c,u,d,p,f=[-1]){const m=v;g(a);const h=a.$$={fragment:null,ctx:[],props:d,update:e,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:l.target||m.$$.root};p&&p(h.root);let b=!1;if(h.ctx=i?i(a,l.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&u(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),b&&j(a,e)),t})):[],h.update(),b=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),l.target){if(l.hydrate){const e=function(e){return Array.from(e.childNodes)}(l.target);h.fragment&&h.fragment.l(e),e.forEach(s)}else h.fragment&&h.fragment.c();l.intro&&q(a.$$.fragment),function(e,n,a,l){const{fragment:i,after_update:s}=e.$$;i&&i.m(n,a),l||N((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),s.forEach(N)}(a,l.target,l.anchor,l.customElement),L()}g(m)}let J;"function"==typeof HTMLElement&&(J=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){M(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var I="0.20.15",R=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,z=/\n/g,F=/^\s*/,B=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,W=/^:\s*/,H=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,K=/^[;\s]*/,G=/^\s+|\s+$/g,Q="";function U(e){return e?e.replace(G,Q):Q}var X=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,a,l=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(z);t&&(n+=t.length);var r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function a(){var e={line:n,column:o};return function(t){return t.position=new l(e),c(),t}}function l(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function i(r){var a=new Error(t.source+":"+n+":"+o+": "+r);if(a.reason=r,a.filename=t.source,a.line=n,a.column=o,a.source=e,!t.silent)throw a}function s(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function c(){s(F)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=a();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;Q!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,Q===e.charAt(n-1))return i("End of comment missing");var l=e.slice(2,n-2);return o+=2,r(l),e=e.slice(n),o+=2,t({type:"comment",comment:l})}}function p(){var e=a(),t=s(B);if(t){if(d(),!s(W))return i("property missing ':'");var n=s(H),o=e({type:"declaration",property:U(t[0].replace(R,Q)),value:n?U(n[0].replace(R,Q)):Q});return s(K),o}}return l.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()}(e),i="function"==typeof t,s=0,c=l.length;s<c;s++)r=(n=l[s]).property,a=n.value,i?t(r,a,n):a&&(o||(o={}),o[r]=a);return o};var Y,Z=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var a=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},l=0,i=Object.keys(e);l<i.length;l++)a(i[l]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},e.getDictionaryWord=function(t,n,o){var r;if(!t)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[t]))return n[o][t];var a="",l=e.getDefaultLang();if(!o||l!==o){var i=null==n?void 0:n[l];(null==i?void 0:i[t])&&(a=i[t])}return a},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(Y={exports:{}},Y.exports),Y.exports),ee={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"invalid-feedback",description:""},{name:"main_button",description:""},{name:"button_container",description:""}]},te={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]},ne={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]};function oe(e,t,n){const o=e.slice();return o[25]=t[n],o}function re(e){let t,n,r,a,l;return{c(){t=c("hb-dialogform"),h(t,"title","Add property"),h(t,"show",n=e[7]?"yes":"no"),h(t,"schema",r=e[25].schema),h(t,"style",e[4])},m(n,o){i(n,t,o),a||(l=[f(t,"modalFormConfirm",e[17]),f(t,"modalFormCancel",e[18]),f(t,"modalShow",e[19])],a=!0)},p(e,o){128&o&&n!==(n=e[7]?"yes":"no")&&h(t,"show",n),4&o&&r!==(r=e[25].schema)&&h(t,"schema",r),16&o&&h(t,"style",e[4])},d(e){e&&s(t),a=!1,o(l)}}}function ae(e,t){let n,o,r=t[25].counter===t[2].length-1&&re(t);return{key:e,first:null,c(){n=p(),r&&r.c(),o=p(),this.first=n},m(e,t){i(e,n,t),r&&r.m(e,t),i(e,o,t)},p(e,n){(t=e)[25].counter===t[2].length-1?r?r.p(t,n):(r=re(t),r.c(),r.m(o.parentNode,o)):r&&(r.d(1),r=null)},d(e){e&&s(n),r&&r.d(e),e&&s(o)}}}function le(e){let t,n,o;function r(e,t){return e[1]?.length?se:ie}let a=r(e),l=a(e);return{c(){t=c("h2"),t.textContent="output",n=d(),l.c(),o=p(),b(t,"margin","60px"),b(t,"text-align","center"),b(t,"color","blue")},m(e,r){i(e,t,r),i(e,n,r),l.m(e,r),i(e,o,r)},p(e,t){a===(a=r(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(o.parentNode,o)))},d(e){e&&s(t),e&&s(n),l.d(e),e&&s(o)}}}function ie(t){let n;return{c(){n=u("...no output")},m(e,t){i(e,n,t)},p:e,d(e){e&&s(n)}}}function se(e){let t,n;return{c(){t=c("hb-form"),h(t,"hide_submit","yes"),h(t,"schema",n=JSON.stringify(e[1])),h(t,"style",e[3])},m(e,n){i(e,t,n)},p(e,o){2&o&&n!==(n=JSON.stringify(e[1]))&&h(t,"schema",n),8&o&&h(t,"style",e[3])},d(e){e&&s(t)}}}function ce(t){let n,r,a,u,b,y,v,g,$,w=[],x=new Map,k=t[2];const T=e=>e[25].counter;for(let e=0;e<k.length;e+=1){let n=oe(t,k,e),o=T(n);x.set(o,w[e]=ae(o,n))}let _=t[0]&&le(t);return{c(){n=c("hb-table"),r=c("span"),a=c("button"),a.textContent="done",b=d();for(let e=0;e<w.length;e+=1)w[e].c();y=d(),_&&_.c(),v=p(),this.c=e,m(a,"class","btn btn-outline-primary btn-sm"),m(r,"slot","buttons-container"),h(n,"id","table_specs"),h(n,"style",t[5]),h(n,"disablepagination","yes"),h(n,"headers",JSON.stringify(t[8])),h(n,"rows",u=JSON.stringify(t[6])),h(n,"add_item","yes")},m(e,o){i(e,n,o),l(n,r),l(r,a),i(e,b,o);for(let t=0;t<w.length;t+=1)w[t]&&w[t].m(e,o);i(e,y,o),_&&_.m(e,o),i(e,v,o),g||($=[f(a,"click",t[11]),f(n,"tableCustomActionClick",t[15]),f(n,"addItem",t[16])],g=!0)},p(e,[t]){32&t&&h(n,"style",e[5]),64&t&&u!==(u=JSON.stringify(e[6]))&&h(n,"rows",u),660&t&&(k=e[2],w=function(e,t,n,r,a,l,i,s,c,u,d,p){let f=e.length,m=l.length,h=f;const b={};for(;h--;)b[e[h].key]=h;const y=[],v=new Map,g=new Map,$=[];for(h=m;h--;){const e=p(a,l,h),o=n(e);let s=i.get(o);s?r&&$.push((()=>s.p(e,t))):(s=u(o,e),s.c()),v.set(o,y[h]=s),o in b&&g.set(o,Math.abs(h-b[o]))}const w=new Set,x=new Set;function k(e){q(e,1),e.m(s,d),i.set(e.key,e),d=e.first,m--}for(;f&&m;){const t=y[m-1],n=e[f-1],o=t.key,r=n.key;t===n?(d=t.first,f--,m--):v.has(r)?!i.has(o)||w.has(o)?k(t):x.has(r)?f--:g.get(o)>g.get(r)?(x.add(o),k(t)):(w.add(r),f--):(c(n,i),f--)}for(;f--;){const t=e[f];v.has(t.key)||c(t,i)}for(;m;)k(y[m-1]);return o($),y}(w,t,T,1,e,k,x,y.parentNode,A,ae,y,oe)),e[0]?_?_.p(e,t):(_=le(e),_.c(),_.m(v.parentNode,v)):_&&(_.d(1),_=null)},i:e,o:e,d(e){e&&s(n),e&&s(b);for(let t=0;t<w.length;t+=1)w[t].d(e);e&&s(y),_&&_.d(e),e&&s(v),g=!1,o($)}}}function ue(e,t,n){const o=$(),r=w();let{id:a}=t,{style:l}=t,{debug:i}=t,{output_schema:s}=t;const c=[{id:"first-row",type:"row",params:{columns:[{type:"text",placeholder:"Label...",id:"label",required:!0,label:"Property Label",validationTip:"This field cannot be empty."},{type:"select",placeholder:"Select something here...",id:"type",required:!0,label:"Type",validationTip:"This field cannot be empty.",params:{options:[{label:"",value:""},{label:"text",value:"text"},{label:"textarea",value:"textarea"},{label:"email",value:"email"},{label:"number",value:"number"},{label:"select",value:"select"},{label:"radio",value:"radio"},{label:"checkbox",value:"checkbox"},{label:"file",value:"file"},{label:"date",value:"date"},{label:"datetime",value:"datetime"},{label:"color",value:"color"},{label:"range",value:"range"}]}}]}},{id:"conditionals-row",type:"row",params:{columns:[{type:"checkbox",placeholder:"Conditional...",id:"conditional",label:"Is Conditional?"},{type:"checkbox",placeholder:"Required...",id:"required",label:"Is Required?"}]}},{id:"size-row",type:"row",params:{columns:[{type:"number",placeholder:"Min...",id:"min",label:"Min",dependencies:[{id:"type",values:["number","date","datetime","text","textarea","range"]}]},{type:"number",placeholder:"Max...",id:"max",label:"Max",dependencies:[{id:"type",values:["number","date","datetime","text","textarea","range"]}]}]}},{type:"arrayobjects",label:"conditions",id:"conditions",params:{addPropertyLabel:"add condition",schema:[{id:"conditions-row",type:"row",params:{columns:[{type:"text",placeholder:"Condition Property name...",id:"conditionlabel",required:!0,label:"Label",validationTip:"This field cannot be empty."},{type:"text",placeholder:"Condition values (separated by comma)...",id:"conditionvalue",label:"Values",validationTip:"This field cannot be empty."}]}}]},dependencies:[{id:"conditional"}]},{type:"arrayobjects",label:"options",placeholder:"Insert your last name here...",id:"options",validationTip:"This field cannot be empty.",params:{addPropertyLabel:"add option",schema:[{id:"options-row",type:"row",params:{columns:[{type:"text",placeholder:"Property name...",id:"optionlabel",required:!0,label:"Label",validationTip:"This field cannot be empty."},{type:"text",placeholder:"Value...",id:"optionvalue",label:"Value",required:!0,validationTip:"This field cannot be empty."}]}}]},dependencies:[{id:"type",values:["select","radio"]}]}];let u,d,p,f="",m="",h="";let b,y=!1;function v(e){console.log("addSchema",e);let t,o={};if(e.conditions&&(t=e.conditions.map((e=>({id:e.conditionlabel,values:e.conditionvalue?e.conditionvalue.replace(", ",",").replace(" ,",",").split(","):void 0})))),"text"!==e.type&&"textarea"!==e.type&&"number"!==e.type&&"datetime"!==e.type&&"date"!==e.type&&"range"!==e.type||(e.min&&(o.min=e.min),e.max&&(o.max=e.max)),"select"===e.type||"radio"===e.type&&e.options.length){o.options=[];for(const t of e.options)o.options.push({label:t.optionlabel,value:t.optionvalue})}const r={id:e.label,type:e.type,label:e.label,required:e.required,placeholder:e.placeholder,dependencies:t};Object.keys(o).length&&(r.params=o),s.find((t=>t.label===e.label))?n(1,s=s.map((t=>t.label===e.label?r:t))):n(1,s=[...s,r]),n(2,u=[...u,{counter:u.length,schema:JSON.stringify(c)}]),console.info("schema4selectorS",u)}function g(e){console.log(e,s);const t=s.find((t=>t.label===e));if(null==t?void 0:t.value)return console.warn("cannot remove default value");n(1,s=s.filter((t=>t.label!==e))),n(2,u=u.filter((e=>e.counter!==u.length-1)))}!function(e){$().$$.on_mount.push(e)}((()=>{Z.addComponent({repoName:"@htmlbricks/hb-form",version:I}),Z.addComponent({repoName:"@htmlbricks/hb-table",version:I}),Z.addComponent({repoName:"@htmlbricks/hb-dialogform",version:I}),p=o.shadowRoot.getElementById("schema"),console.log("formComponent",p)}));return e.$$set=e=>{"id"in e&&n(12,a=e.id),"style"in e&&n(13,l=e.style),"debug"in e&&n(0,i=e.debug),"output_schema"in e&&n(1,s=e.output_schema)},e.$$.update=()=>{if(28679&e.$$.dirty){if(a||n(12,a=""),l&&(n(14,d=X(l)),n(3,f=Z.getChildStyleToPass(d,null==ee?void 0:ee.vars)),n(5,h=Z.getChildStyleToPass(d,null==te?void 0:te.vars)),n(4,m=Z.getChildStyleToPass(d,null==ne?void 0:ne.vars))),"string"==typeof s&&""!==s)try{console.log("parsing output_schema"),n(1,s=JSON.parse(s))}catch(e){console.error("error parsing output_schema",e)}s||n(1,s=[]),"string"!=typeof i||"true"!==i&&"yes"!==i&&""!==i?!0!==i&&n(0,i=!1):n(0,i=!0),u||n(2,u=[{counter:0,schema:JSON.stringify(c)}]);const e=[];for(const t of s){let n,o;t.params&&(o=JSON.stringify(t.params)),t.dependencies&&(n=JSON.stringify(t.dependencies)),e.push({_id:t.label,label:t.label,type:t.type,params:o,required:t.required,dependencies:n,value:t.value,_actions:[{name:"delete",type:"icon",iconOrText:"x-octagon-fill",disabled:!!t.value}]})}n(6,b=e)}},[i,s,u,f,m,h,b,y,[{label:"Label",key:"label"},{label:"type",key:"type"},{label:"params",key:"params",nosort:!0},{label:"dependencies",key:"dependencies"},{label:"required",key:"required"},{label:"value",key:"value"},{label:"modifiche",key:"mod",type:"actions",nosort:!0}],v,g,function(){!function(e,t){r(e,t),o.dispatchEvent&&o.dispatchEvent(new CustomEvent(e,{detail:t}))}("done",{schema:s,id:a})},a,l,d,e=>{"delete"===e.detail.action&&g(e.detail.itemId)},e=>{n(7,y=!0)},e=>{console.log(e.detail),v(e.detail),n(7,y=!1)},e=>{console.log("cancelform"),n(7,y=!1)},e=>{console.log("modalShow"),n(7,y=e.detail.show)}]}class de extends J{constructor(e){super();const t=document.createElement("style");t.textContent='@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif}.btn{display:inline-block;font-weight:400;line-height:1.5;color:#212529;text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;user-select:none;background-color:transparent;border:1px solid transparent;padding:0.375rem 0.75rem;font-size:1rem;border-radius:0.25rem;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out}@media(prefers-reduced-motion: reduce){.btn{transition:none}}.btn:hover{color:#212529}.btn:focus{outline:0;box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.25)}.btn:disabled{pointer-events:none;opacity:0.65}.btn-outline-primary{color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:hover{color:#fff;background-color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:focus{box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.5)}.btn-outline-primary:active{color:#fff;background-color:var(--bs-primary,#07689f);border-color:var(--bs-primary,#07689f)}.btn-outline-primary:active:focus{box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.5)}.btn-outline-primary:disabled{color:var(--bs-primary,#07689f);background-color:transparent}.btn-sm{padding:0.25rem 0.5rem;font-size:0.875rem;border-radius:0.2rem}',this.shadowRoot.appendChild(t),D(this,{target:this.shadowRoot,props:y(this.attributes),customElement:!0},ue,ce,a,{id:12,style:13,debug:0,output_schema:1},null),e&&(e.target&&i(e.target,this,e.anchor),e.props&&(this.$set(e.props),L()))}static get observedAttributes(){return["id","style","debug","output_schema"]}get id(){return this.$$.ctx[12]}set id(e){this.$$set({id:e}),L()}get style(){return this.$$.ctx[13]}set style(e){this.$$set({style:e}),L()}get debug(){return this.$$.ctx[0]}set debug(e){this.$$set({debug:e}),L()}get output_schema(){return this.$$.ctx[1]}set output_schema(e){this.$$set({output_schema:e}),L()}}return customElements.define("hb-form-composer",de),de}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|