@golemui/gui-shared 0.12.1 → 0.13.0
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/CHANGELOG.md +15 -1
- package/index.js +492 -2021
- package/index.umd.cjs +1 -1
- package/internals.d.ts +2 -0
- package/internals.js +5 -0
- package/internals.umd.cjs +1 -0
- package/lib/dx/formDef.domain.d.ts +4 -5
- package/lib/dx/resolveFormInput.d.ts +7 -5
- package/lib/dx/shortcuts/inputs/inputs.domain.d.ts +3 -4
- package/lib/golem-form.d.ts +35 -35
- package/lib/utils/repeater.d.ts +2 -0
- package/lib/widget.factory.d.ts +25 -25
- package/package.json +11 -3
package/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(r=typeof globalThis<"u"?globalThis:r||self,b(r["gui-shared"]={}))})(this,(function(r){"use strict";const b={INPUTS:"INPUTS",ACTIONS:"ACTIONS",LAYOUTS:"LAYOUTS",DISPLAYS:"DISPLAYS"};function Y(e,t,n){if(typeof t=="function"){const i=t;return{items:[{key:e,def:a=>({type:"text",...i(a)})}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}const s={type:"text",...t};return{items:[{key:e,def:s}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}function z(e,t,n){if(typeof t=="function"){const i=t;return{items:[{key:e,def:a=>({type:"number",...i(a)})}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}const s={type:"number",...t};return{items:[{key:e,def:s}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}function G(e,t,n){if(typeof t=="function"){const i=t;return{items:[{key:e,def:a=>({type:"boolean",...i(a)})}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}const s={type:"boolean",...t};return{items:[{key:e,def:s}],type:"ITEMS",itemType:b.INPUTS,tags:n??[]}}function K(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"SELECT",items:[{key:e,def:o=>({type:"select",...l(o)})}],tags:n??[]}}const s={type:"select",...t};return{type:"ITEMS",itemType:"SELECT",items:[{key:e,def:s}],tags:n??[]}}function V(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"DROPDOWN",items:[{key:e,def:o=>({type:"dropdown",...l(o)})}],tags:n??[]}}const s={type:"dropdown",...t};return{type:"ITEMS",itemType:"DROPDOWN",items:[{key:e,def:s}],tags:n??[]}}function H(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"RADIOGROUP",items:[{key:e,def:o=>({type:"radiogroup",...l(o)})}],tags:n??[]}}const s={type:"radiogroup",...t};return{type:"ITEMS",itemType:"RADIOGROUP",items:[{key:e,def:s}],tags:n??[]}}function X(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"CHECKBOX",items:[{key:e,def:o=>({type:"checkbox",...l(o)})}],tags:n??[]}}const s={type:"checkbox",...t};return{type:"ITEMS",itemType:"CHECKBOX",items:[{key:e,def:s}],tags:n??[]}}function Z(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"TEXTAREA",items:[{key:e,def:o=>({type:"textarea",...l(o)})}],tags:n??[]}}const s={type:"textarea",...t};return{type:"ITEMS",itemType:"TEXTAREA",items:[{key:e,def:s}],tags:n??[]}}function q(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"PASSWORD",items:[{key:e,def:o=>({type:"password",...l(o)})}],tags:n??[]}}const s={type:"password",...t};return{type:"ITEMS",itemType:"PASSWORD",items:[{key:e,def:s}],tags:n??[]}}function Q(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"CURRENCY",items:[{key:e,def:o=>({type:"currency",...l(o)})}],tags:n??[]}}const s={type:"currency",...t};return{type:"ITEMS",itemType:"CURRENCY",items:[{key:e,def:s}],tags:n??[]}}function J(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"MARKDOWN",items:[{key:e,def:o=>({type:"markdown",...l(o)})}],tags:n??[]}}const s={type:"markdown",...t};return{type:"ITEMS",itemType:"MARKDOWN",items:[{key:e,def:s}],tags:n??[]}}function x(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"LIST",items:[{key:e,def:o=>({type:"list",...l(o)})}],tags:n??[]}}const s={type:"list",...t};return{type:"ITEMS",itemType:"LIST",items:[{key:e,def:s}],tags:n??[]}}function ee(e,t,n){if(typeof t=="function"){const i=t;return{items:[a=>({type:"calendar",path:e,...i(a)})],type:"ITEMS",itemType:"CALENDAR",tags:n??[]}}return{items:[{type:"calendar",path:e,...t}],type:"ITEMS",itemType:"CALENDAR",tags:n??[]}}function te(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"DATE_INPUT",items:[{key:e,def:o=>({type:"dateInput",...l(o)})}],tags:n??[]}}const s={type:"dateInput",...t};return{type:"ITEMS",itemType:"DATE_INPUT",items:[{key:e,def:s}],tags:n??[]}}function ne(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"DATE_PICKER",items:[{key:e,def:o=>({type:"datePicker",...l(o)})}],tags:n??[]}}const s={type:"datePicker",...t};return{type:"ITEMS",itemType:"DATE_PICKER",items:[{key:e,def:s}],tags:n??[]}}function se(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"RANGE_CALENDAR",items:[{key:e,def:o=>({type:"rangeCalendar",...l(o)})}],tags:n??[]}}const s={type:"rangeCalendar",...t};return{type:"ITEMS",itemType:"RANGE_CALENDAR",items:[{key:e,def:s}],tags:n??[]}}function ie(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"RANGE_DATE_INPUT",items:[{key:e,def:o=>({type:"rangeDateInput",...l(o)})}],tags:n??[]}}const s={type:"rangeDateInput",...t};return{type:"ITEMS",itemType:"RANGE_DATE_INPUT",items:[{key:e,def:s}],tags:n??[]}}function le(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"RANGE_DATE_PICKER",items:[{key:e,def:o=>({type:"rangeDatePicker",...l(o)})}],tags:n??[]}}const s={type:"rangeDatePicker",...t};return{type:"ITEMS",itemType:"RANGE_DATE_PICKER",items:[{key:e,def:s}],tags:n??[]}}function ae(e,t,n,s){if(typeof n=="function"){const a=n;return{type:"ITEMS",itemType:"CUSTOM_INPUT",items:[{key:t,def:c=>({customType:e,...a(c)})}],tags:s??[]}}const i={customType:e,...n};return{type:"ITEMS",itemType:"CUSTOM_INPUT",items:[{key:t,def:i}],tags:s??[]}}class Ft{deepMerge(t,n){if(n==null)return t;if(t==null||typeof t!="object"||typeof n!="object"||Array.isArray(t)||Array.isArray(n))return n;const s={...t};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(typeof n[i]=="object"&&!Array.isArray(n[i])&&n[i]!==null&&typeof t[i]=="object"&&!Array.isArray(t[i])&&t[i]!==null?s[i]=this.deepMerge(t[i],n[i]):s[i]=n[i]);return s}}const re=new Ft;function v(e,t){return{items:[e],type:"ITEMS",itemType:b.ACTIONS,tags:t??[]}}const M=e=>{const t={uid:"#submit",label:"Submit"},n=e!=null?re.deepMerge(t,e):t;return v(n)};function oe(e,t,n){if(typeof t=="function"){const l=t;return{type:"ITEMS",itemType:"CUSTOM_ACTION",items:[u=>({customType:e,...l(u)})],tags:n??[]}}return{type:"ITEMS",itemType:"CUSTOM_ACTION",items:[{customType:e,...t}],tags:n??[]}}const R=(e,t)=>({type:"ITEMS",itemType:b.DISPLAYS,items:[{render:e}],tags:t??[]});function ue(e,t){return{type:"ITEMS",itemType:"ALERTS",items:[e],tags:t??[]}}function ce(e,t,n){if(typeof t=="function"){const u=t;return{type:"ITEMS",itemType:"CUSTOM_DISPLAY",items:[c=>({customType:e,...u(c)})],tags:n??[]}}const{uid:s,...i}=t??{};return{type:"ITEMS",itemType:"CUSTOM_DISPLAY",items:[{customType:e,...s!=null?{uid:s}:{},props:Object.keys(i).length>0?i:void 0}],tags:n??[]}}const D=(e,t,n)=>({type:"ITEMS",itemType:b.LAYOUTS,items:[{def:{widgetName:"flex",...t??{}},children:e}],tags:n??[]}),de=(e,t,n)=>D(e,{direction:"row",...t??{}},n),pe=(e,t,n)=>D(e,{direction:"column",...t??{}},n),C=(e,t,n)=>({type:"ITEMS",itemType:b.LAYOUTS,items:[{def:{widgetName:"grid",direction:"row",autoFit:!0,...t??{}},children:e}],tags:n??[]}),ye=(e,t,n)=>C(e,{direction:"row",...t??{}},n),me=(e,t,n)=>C(e,{direction:"column",...t??{}},n);function ge(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function be(e,t,n){const s=e.map(a=>({label:a.label,uid:a.uid??ge(a.label)})),i=e.map(a=>({type:"ITEMS",itemType:b.LAYOUTS,items:[{def:{uid:a.uid??ge(a.label),direction:"column",widgetName:"flex"},children:a.children}],tags:[]}));return{type:"ITEMS",itemType:"TABS",items:[{def:{tabs:s,...t},children:i}],tags:n??[]}}function fe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function he(e,t,n){const s=e.map(a=>({label:a.label,uid:a.uid??fe(a.label)})),i=e.map(a=>({type:"ITEMS",itemType:b.LAYOUTS,items:[{def:{uid:a.uid??fe(a.label),direction:"column",widgetName:"flex"},children:a.children}],tags:[]}));return{type:"ITEMS",itemType:"ACCORDION",items:[{def:{sections:s,...t},children:i}],tags:n??[]}}function Te(e,t,n,s){if(typeof n=="function"){const a=n;return{type:"ITEMS",itemType:"CUSTOM_LAYOUT",items:[{def:c=>({customType:e,...a(c)}),children:t}],tags:s??[]}}return{type:"ITEMS",itemType:"CUSTOM_LAYOUT",items:[{def:{customType:e,...n},children:t}],tags:s??[]}}function _e(e,t,n){const{template:s,...i}=t;return{type:"ITEMS",itemType:"REPEATER",items:[{key:e,def:i,children:s}],tags:n??[]}}function O(e){return function(t,n=()=>!0){return{kind:"leaf",selectorType:e,matcher:n,config:t}}}const P=new Map;function Se(e,t){if(P.has(e))throw new Error(`Item type "${e}" is already registered.`);P.set(e,t)}function U(e){const t=P.get(e);if(!t)throw new Error(`No handler registered for item type "${e}". Did you forget to import the registration module?`);return t}function Ae(e){return P.has(e)}function p(e){const t=u=>{if(!e.sensibleDefaults)return{};let o={...e.sensibleDefaults.base};for(const c of u){const d=c.config;for(const m of e.sensibleDefaults.fields){const y=m;d[y]!=null&&(o={...o,[y]:d[y]})}}return o},n=(u,o)=>e.sensibleDefaults?e.sensibleDefaults.apply(u,o):u,s=u=>{switch(e.entryShape){case"bare":return{baseDef:u};case"keyed":{const o=u;return{baseDef:o.def,path:o.key}}case"compound":{const o=u;return{baseDef:o.def,children:o.children}}}},i={rollUpSensibleDefaults:t,applySensibleDefaults:n,mapToWidget:e.mapToWidget,parseEntry:s,...e.afterMerge?{afterMerge:e.afterMerge}:{},...e.buildCustomWidget?{buildCustomWidget:e.buildCustomWidget}:{},...e.getChildren?{getChildren:e.getChildren}:{}};Se(e.itemType,i);const l=O(e.itemType);return{gsl:l,gslByUid:(u,o)=>l(o,(c=>c.uid===u))}}function g(e){const{uid:t,path:n,label:s,disabled:i,readonly:l,defaultValue:a,tags:u,type:o,size:c,onLoad:d,onChange:m,onFilter:y,on:_,states:w,include:L,exclude:Ot,validator:Wt,...I}=e;return I}function h(e,t){return typeof e=="function"?e:{type:t,...e??{}}}function jt(e){return e?e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()):""}function f(e,t){return e.label!=null||t.suppressAutomaticLabels||!e.path?e:{...e,label:jt(e.path)}}function S(e,t){return e.placeholder!=null||t.suppressAutomaticPlaceholders||!e.path?e:{...e,placeholder:e.path}}function $t(e){switch(e.type){case"text":return zt(e);case"number":return Gt(e);case"boolean":return Yt(e);default:throw new Error(`Unsupported field type "${e.type}"`)}}function Yt(e){const t=g(e);return{uid:e.uid??"",kind:"input",type:"toggle",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"boolean")}:{},props:t}}function zt(e){const t=g(e);return{uid:e.uid??"",kind:"input",type:"textinput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},props:{placeholder:t.placeholder??"",...t},validator:h(e.validator,"string")}}function Gt(e){const t=g(e);return{uid:e.uid??"",kind:"input",type:"number",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},props:{placeholder:t.placeholder??"",...t},validator:h(e.validator,"number")}}const{gsl:E,gslByUid:ke}=p({itemType:"INPUTS",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>{let n=f(e,t);return n=S(n,t),n}},mapToWidget:$t}),Ie=e=>E(e,t=>t.type==="text"),Ue=e=>E(e,t=>t.type==="number"),Ee=e=>E(e,t=>t.type==="boolean"),{gsl:De,gslByUid:Ce}=p({itemType:"SELECT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"select",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:g(e)})}),{gsl:Pe,gslByUid:Be}=p({itemType:"DROPDOWN",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"dropdown",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:g(e)})}),{gsl:we,gslByUid:Le}=p({itemType:"RADIOGROUP",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"radiogroup",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:g(e)})}),{gsl:ve,gslByUid:Me}=p({itemType:"CHECKBOX",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"checkbox",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"boolean")}:{},props:g(e)})}),{gsl:Re,gslByUid:Oe}=p({itemType:"TEXTAREA",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"textarea",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:We,gslByUid:Ne}=p({itemType:"PASSWORD",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"password",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:Fe,gslByUid:je}=p({itemType:"CURRENCY",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"currency",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"number")}:{},props:g(e)})}),{gsl:$e,gslByUid:Ye}=p({itemType:"MARKDOWN",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"markdown",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:ze,gslByUid:Ge}=p({itemType:"LIST",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"list",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:g(e)})}),{gsl:Ke,gslByUid:Ve}=p({itemType:"CALENDAR",entryShape:"bare",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"calendar",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:He,gslByUid:Xe}=p({itemType:"DATE_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"dateInput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:Ze,gslByUid:qe}=p({itemType:"DATE_PICKER",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"datePicker",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"string")}:{},props:g(e)})}),{gsl:Qe,gslByUid:Je}=p({itemType:"RANGE_CALENDAR",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeCalendar",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"array")}:{},props:g(e)})}),{gsl:xe,gslByUid:et}=p({itemType:"RANGE_DATE_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeDateInput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"array")}:{},props:g(e)})}),{gsl:tt,gslByUid:nt}=p({itemType:"RANGE_DATE_PICKER",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>S(f(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeDatePicker",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"array")}:{},props:g(e)})});function Kt(e){const t={};return e.addLabel!=null&&(t.addLabel=e.addLabel),e.removeLabel!=null&&(t.removeLabel=e.removeLabel),e.limit!=null&&(t.limit=e.limit),e.title!=null&&(t.title=e.title),e.addButtonIcon!=null&&(t.addButtonIcon=e.addButtonIcon),e.removeButtonIcon!=null&&(t.removeButtonIcon=e.removeButtonIcon),t}function Vt(e){return{uid:e.uid??"",kind:"input",type:"repeater",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:h(e.validator,"array")}:{},props:{...Kt(e),template:{kind:"layout",type:"flex",children:[],props:{direction:"column"}}}}}function W(e,t){for(const n of e){if(typeof n=="function")continue;const s=n;typeof s.path=="string"&&s.path&&(s.path=t+s.path),"children"in s&&Array.isArray(s.children)&&W(s.children,t);const i=s.props;i?.template?.children&&Array.isArray(i.template.children)&&W(i.template.children,t)}}function Ht(e,t){const n=t.walkChildren(t.children??[]),s=e.kind==="static"?e.def.path??"":e.fn({})?.path??"";s&&W(n,s+".items.");const i={kind:"layout",type:"flex",uid:"",children:n,props:{direction:"column"}};if(e.kind==="static"){const a=t.mapStaticDef(e.def,"REPEATER");return{...a,props:{...a.props,template:i}}}const l=e.fn;return(a=>{const u=l(a),o=t.mapStaticDef(u,"REPEATER");return{...o,props:{...o.props,template:i}}})}function Xt(e){return{baseDef:e.def,path:e.key,children:e.children}}function Zt(e){return e.children}Se("REPEATER",{parseEntry:Xt,rollUpSensibleDefaults:()=>({}),applySensibleDefaults:e=>e,mapToWidget:Vt,buildCustomWidget:Ht,getChildren:Zt});const N=O("REPEATER"),st=(e,t)=>N(t,(n=>n.uid===e)),it={onLoad:"load",onChange:"change",onFilter:"filter",onBlur:"blur"},qt=Object.keys(it);class Qt{extractOnClickFromMergeResult(t,n,s,i){if(t.kind==="dynamic"){const u=t.fn;return{kind:"dynamic",fn:c=>{const d=u(c);return this.wireOnClick(d,n,s,i)}}}const l=t.def;return{kind:"static",def:this.wireOnClick(l,n,s,i)}}countSubmitButtons(t){let n=0;for(const s of t){if(s.type!=="ITEMS")continue;const i=U(s.itemType);for(const l of s.items){const a=i.getChildren?.(l);if(a&&(n+=this.countSubmitButtons(a)),s.itemType===b.ACTIONS){if(typeof l=="function")continue;const u=l;(u.uid==="#submit"||u.onClick==="submit")&&n++}}}return n}wireOnClick(t,n,s,i){const l=t.uid==="#submit"||t.onClick==="submit",a=l?"#submit":i.next(),u=l?"submit":a,o=t.onClick,d=(typeof o=="function"?o:void 0)??(l?s.onSubmit:void 0);if(d){n.set(u,_=>d(_.data));const{onClick:m,...y}=t;return{...y,uid:a,on:{click:u}}}if(l){const{onClick:m,...y}=t;return{...y,uid:a,on:{click:"submit"}}}if(typeof o=="string"){const{onClick:m,...y}=t;return{...y,uid:a,on:{click:o}}}return{...t,uid:a}}wireInputLayoutEvents(t,n,s){if(t.kind==="dynamic"){const l=t.fn;return{kind:"dynamic",fn:u=>{const o=l(u);return this.wireEventProperties(o,n,s)}}}return{kind:"static",def:this.wireEventProperties(t.def,n,s)}}wireEventProperties(t,n,s){const i={...t.on||{}};let l=!1;const a={...t};for(const u of qt){const o=t[u];if(o==null)continue;const c=it[u];if(typeof o=="function"){const d=s.next();n.set(d,o),i[c]=d,l=!0}else typeof o=="string"&&(i[c]=o,l=!0);delete a[u]}return l&&(a.on=i),a}}const B=new Qt;function Jt(e){const{uid:t,label:n,disabled:s,on:i,onClick:l,data:a,type:u,tags:o,size:c,include:d,exclude:m,states:y,..._}=e;return{uid:t??"",kind:"action",type:"button",disabled:s,label:n,...i!=null?{on:i}:{},props:_}}const{gsl:lt,gslByUid:at}=p({itemType:"ACTIONS",entryShape:"bare",mapToWidget:Jt,afterMerge:(e,t)=>B.extractOnClickFromMergeResult(e,t.eventRegistry,t.formConfig,t.eventIdGenerator)});function xt(e){const{uid:t,widgetName:n,tags:s,size:i,onChange:l,include:a,exclude:u,...o}=e,{on:c,...d}=o;return{uid:t??"",kind:"layout",type:n??"flex",props:{direction:d.direction??"column",...d},children:[]}}function en(e,t){const n=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"LAYOUTS"),children:n};const s=e.fn;return(i=>{const l=s(i);return{...t.mapStaticDef(l,"LAYOUTS"),children:n}})}function tn(e){return e.children}const{gsl:rt,gslByUid:ot}=p({itemType:"LAYOUTS",entryShape:"compound",mapToWidget:xt,buildCustomWidget:en,getChildren:tn});function nn(e){return{uid:"",kind:"display",type:"renderer",props:{render:e.render}}}function sn(e,t){if(e.kind==="static"){const s=e.def;return(i=>({uid:"",kind:"display",type:"renderer",...s.include!=null?{include:s.include}:{},...s.exclude!=null?{exclude:s.exclude}:{},props:{render:s.render(i??{})}}))}const n=e.fn;return(s=>{const i=n(s);return{uid:"",kind:"display",type:"renderer",...i.include!=null?{include:i.include}:{},...i.exclude!=null?{exclude:i.exclude}:{},props:{render:i.render(s??{})}}})}const{gsl:ut,gslByUid:ct}=p({itemType:"DISPLAYS",entryShape:"bare",mapToWidget:nn,buildCustomWidget:sn}),{gsl:dt,gslByUid:pt}=p({itemType:"ALERTS",entryShape:"bare",mapToWidget:e=>({uid:e.uid??"",kind:"display",type:"alert",props:{text:e.text,...e.level!=null?{level:e.level}:{}}})});function ln(e){return{uid:e.uid??"",kind:"layout",type:"tabs",props:{tabs:e.tabs,renderMode:e.renderMode??"all",...e.defaultOpen!=null?{defaultOpen:e.defaultOpen}:{}},children:[]}}function an(e,t){const n=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"TABS"),children:n};const s=e.fn;return(i=>{const l=s(i);return{...t.mapStaticDef(l,"TABS"),children:n}})}function rn(e){return e.children}const{gsl:yt,gslByUid:mt}=p({itemType:"TABS",entryShape:"compound",mapToWidget:ln,buildCustomWidget:an,getChildren:rn});function on(e){return{uid:e.uid??"",kind:"layout",type:"accordion",props:{sections:e.sections,renderMode:e.renderMode??"all",...e.singleOpen!=null?{singleOpen:e.singleOpen}:{},...e.defaultOpen!=null?{defaultOpen:e.defaultOpen}:{}},children:[]}}function un(e,t){const n=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"ACCORDION"),children:n};const s=e.fn;return(i=>{const l=s(i);return{...t.mapStaticDef(l,"ACCORDION"),children:n}})}function cn(e){return e.children}const{gsl:gt,gslByUid:bt}=p({itemType:"ACCORDION",entryShape:"compound",mapToWidget:on,buildCustomWidget:un,getChildren:cn}),{gsl:ft,gslByUid:ht}=p({itemType:"CUSTOM_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>f(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:e.customType,path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.validator!=null?{validator:e.validator}:{},props:e.props??{}})}),{gsl:Tt,gslByUid:_t}=p({itemType:"CUSTOM_ACTION",entryShape:"bare",mapToWidget:e=>{const{uid:t,label:n,disabled:s,on:i,onClick:l,data:a,customType:u,tags:o,size:c,include:d,exclude:m,states:y,props:_,...w}=e;return{uid:t??"",kind:"action",type:e.customType,label:n,disabled:s,...i!=null?{on:i}:{},props:{..._,...w}}},afterMerge:(e,t)=>B.extractOnClickFromMergeResult(e,t.eventRegistry,t.formConfig,t.eventIdGenerator)}),{gsl:St,gslByUid:At}=p({itemType:"CUSTOM_DISPLAY",entryShape:"bare",mapToWidget:e=>({uid:e.uid??"",kind:"display",type:e.customType,props:e.props??{}})});function dn(e){return{uid:e.uid??"",kind:"layout",type:e.customType,props:e.props??{},children:[]}}function pn(e,t){const n=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"CUSTOM_LAYOUT"),children:n};const s=e.fn;return(i=>{const l=s(i);return{...t.mapStaticDef(l,"CUSTOM_LAYOUT"),children:n}})}function yn(e){return e.children}const{gsl:kt,gslByUid:It}=p({itemType:"CUSTOM_LAYOUT",entryShape:"compound",mapToWidget:dn,buildCustomWidget:pn,getChildren:yn});class k{constructor(t){this.conditions=t}static root(){return new k([])}tag(t){return new k([...this.conditions,{kind:"tagsAnd",tags:[t]}])}state(t){return new k([...this.conditions,{kind:"state",name:t}])}tagsAnd(t){return new k([...this.conditions,{kind:"tagsAnd",tags:t}])}tagsOr(t){return new k([...this.conditions,{kind:"tagsOr",tags:t}])}apply(t){if(this.conditions.length===0)return t;const n=this.conditions.find(l=>l.kind==="state"),s=this.conditions.filter(l=>l.kind!=="state"),i=t.matcher;return{...t,matcher:l=>{if(!i(l))return!1;for(const a of s){const u=l.tags??[];if(a.kind==="tagsAnd"){for(const o of a.tags)if(!u.includes(o))return!1}else{if(a.tags.length===0)continue;if(!a.tags.some(o=>u.includes(o)))return!1}}return!0},...n?{targetState:n.name}:{}}}inputs(t){return this.apply(E(t))}inputByUid(t,n){return this.apply(ke(t,n))}textInputs(t){return this.apply(Ie(t))}numberInputs(t){return this.apply(Ue(t))}booleanInputs(t){return this.apply(Ee(t))}selects(t){return this.apply(De(t))}selectByUid(t,n){return this.apply(Ce(t,n))}dropdowns(t){return this.apply(Pe(t))}dropdownByUid(t,n){return this.apply(Be(t,n))}radiogroups(t){return this.apply(we(t))}radiogroupByUid(t,n){return this.apply(Le(t,n))}checkboxes(t){return this.apply(ve(t))}checkboxByUid(t,n){return this.apply(Me(t,n))}textareas(t){return this.apply(Re(t))}textareaByUid(t,n){return this.apply(Oe(t,n))}passwords(t){return this.apply(We(t))}passwordByUid(t,n){return this.apply(Ne(t,n))}currencies(t){return this.apply(Fe(t))}currencyByUid(t,n){return this.apply(je(t,n))}markdowns(t){return this.apply($e(t))}markdownByUid(t,n){return this.apply(Ye(t,n))}lists(t){return this.apply(ze(t))}listByUid(t,n){return this.apply(Ge(t,n))}calendars(t){return this.apply(Ke(t))}calendarByUid(t,n){return this.apply(Ve(t,n))}dateInputs(t){return this.apply(He(t))}dateInputByUid(t,n){return this.apply(Xe(t,n))}datePickers(t){return this.apply(Ze(t))}datePickerByUid(t,n){return this.apply(qe(t,n))}rangeCalendars(t){return this.apply(Qe(t))}rangeCalendarByUid(t,n){return this.apply(Je(t,n))}rangeDateInputs(t){return this.apply(xe(t))}rangeDateInputByUid(t,n){return this.apply(et(t,n))}rangeDatePickers(t){return this.apply(tt(t))}rangeDatePickerByUid(t,n){return this.apply(nt(t,n))}repeaters(t){return this.apply(N(t))}repeaterByUid(t,n){return this.apply(st(t,n))}actions(t){return this.apply(lt(t))}actionByUid(t,n){return this.apply(at(t,n))}layouts(t){return this.apply(rt(t))}layoutByUid(t,n){return this.apply(ot(t,n))}displays(t){return this.apply(ut(t))}displayByUid(t,n){return this.apply(ct(t,n))}alerts(t){return this.apply(dt(t))}alertByUid(t,n){return this.apply(pt(t,n))}tabs(t){return this.apply(yt(t))}tabsByUid(t,n){return this.apply(mt(t,n))}accordions(t){return this.apply(gt(t))}accordionByUid(t,n){return this.apply(bt(t,n))}customInputs(t){return this.apply(ft(t))}customInputByUid(t,n){return this.apply(ht(t,n))}customActions(t){return this.apply(Tt(t))}customActionByUid(t,n){return this.apply(_t(t,n))}customDisplays(t){return this.apply(St(t))}customDisplayByUid(t,n){return this.apply(At(t,n))}customLayouts(t){return this.apply(kt(t))}customLayoutByUid(t,n){return this.apply(It(t,n))}}const mn={inputs:{textInput:Y,numberInput:z,booleanInput:G,select:K,dropdown:V,radiogroup:H,checkbox:X,textarea:Z,password:q,currency:Q,markdown:J,list:x,calendar:ee,dateInput:te,datePicker:ne,rangeCalendar:se,rangeDateInput:ie,rangeDatePicker:le,repeater:_e,custom:ae},actions:{button:v,submitButton:M,custom:oe},displays:{display:R,alert:ue,custom:ce},layouts:{flex:D,horizontalFlex:de,verticalFlex:pe,grid:C,horizontalGrid:ye,verticalGrid:me,tabs:be,accordion:he,custom:Te},selectors:k.root()};function gn(e,...t){return t.map(n=>({...n,targetState:e}))}function bn(e,...t){return{kind:"aggregated",matcher:n=>n.tags?.includes(e)??!1,children:t}}const Ut={INPUTS:new Set(["INPUTS","TEXTAREA","PASSWORD","SELECT","DROPDOWN","RADIOGROUP","CHECKBOX","CALENDAR","DATE_INPUT","DATE_PICKER","RANGE_CALENDAR","RANGE_DATE_INPUT","RANGE_DATE_PICKER","CURRENCY","MARKDOWN","LIST","CUSTOM_INPUT","REPEATER"]),ACTIONS:new Set(["ACTIONS","CUSTOM_ACTION"]),DISPLAYS:new Set(["DISPLAYS","ALERTS","CUSTOM_DISPLAY"]),LAYOUTS:new Set(["LAYOUTS","TABS","ACCORDION","CUSTOM_LAYOUT"])};function fn(e,t){const n=Ut[e];return n?n.has(t):e===t}class hn{resolve(t,n){const s=[];for(const l of n)l.kind==="aggregated"?this.collectFromAggregated(l,t,s):this.collectFromLeaf(l,t,s);const i=this.rollUpSensibleDefaults(s);return{leafSelectors:s,sensibleDefaults:i}}collectFromAggregated(t,n,s){if(t.matcher(n))for(const i of t.children)this.collectFromLeaf(i,n,s)}collectFromLeaf(t,n,s){fn(t.selectorType,n.itemType??"")&&t.matcher(n)&&s.push(t)}rollUpSensibleDefaults(t){const n=new Map,s=(l,a)=>{const u=n.get(l)??[];u.push(a),n.set(l,u)};for(const l of t){const a=Ut[l.selectorType];if(a)for(const u of a)s(u,l);else s(l.selectorType,l)}const i={};for(const[l,a]of n)Ae(l)&&(i[l]=U(l).rollUpSensibleDefaults(a));return i}}const Tn=new hn;class _n{constructor(t){this.objectUtils=t}merge(t,n,s){let i={},l=null;typeof t=="function"&&(l=t);const a=this.collectDecorators(s);for(const c of a){if(l!=null){l=this.composeRuntimeFunctions(l,c);continue}if(typeof c=="function"){const d=c({...i,...typeof t=="function"?{}:t});if(typeof d=="function"){l=this.createPromotedFunction(i,t,d,n,s);continue}i=this.objectUtils.deepMerge(i,d)}else i=this.objectUtils.deepMerge(i,c)}if(l!=null)return{kind:"dynamic",fn:this.wrapWithSensibleDefaults(l,i,n,s)};const u=this.objectUtils.deepMerge(t,i);return{kind:"static",def:this.applySensibleDefaults({...u},n,s)}}collectDecorators(t){const n=[];for(const s of t.leafSelectors){const i=s.config;i.override!=null&&n.push(i.override)}return n}applySensibleDefaults(t,n,s){if(!Ae(n))return t;const i=s.sensibleDefaults[n]??{};return U(n).applySensibleDefaults(t,i)}createPromotedFunction(t,n,s,i,l){return a=>{const u=s(a);let o=this.objectUtils.deepMerge(t,u);return o=this.objectUtils.deepMerge(o,n),this.applySensibleDefaults(o,i,l)}}wrapWithSensibleDefaults(t,n,s,i){return l=>{let a=t(l);return Object.keys(n).length>0&&(a=this.objectUtils.deepMerge(n,a)),this.applySensibleDefaults(a,s,i)}}composeRuntimeFunctions(t,n){return typeof n=="function"?s=>{const i=t(s),l=n(i);return typeof l=="function"?l(s):this.objectUtils.deepMerge(l,i)}:s=>{const i=t(s);return this.objectUtils.deepMerge(i,n)}}}const Sn=new _n(re);class An{mapToWidget(t,n){if(t.kind==="dynamic"){const s=t.fn;return(i=>{const l=s(i);return this.mapStaticDef(l,n)})}return this.mapStaticDef(t.def,n)}mapStaticDef(t,n){const s=U(n).mapToWidget(t);return this.applyBaseWidgetFields(s,t)}applyBaseWidgetFields(t,n){return n.size!=null&&(t.size=n.size),n.defaultValue!=null&&t.kind==="input"&&(t.defaultValue=n.defaultValue),n.on!=null&&(t.on=n.on),n.include!=null&&(t.include=n.include),n.exclude!=null&&(t.exclude=n.exclude),t}}const kn=new An;class In{normalizeSelectors(t){const n=Array.isArray(t)?t:[t],s=[],i=[];for(const l of n)l.kind==="leaf"?i.push(l):s.push(l);return i.length>0&&s.unshift({kind:"aggregated",matcher:()=>!0,children:i}),s}extractFormConfig(){return{suppressAutomaticStack:!1,suppressAutomaticSubmit:!1,onSubmit:t=>console.log("Form submitted:",t)}}}const Un=new In;function En(){let e=0;return{next:()=>`event_${e++}`}}class Dn{constructor(t,n,s,i,l){this.resolver=t,this.merger=n,this.mapper=s,this.eventWiring=i,this.stateExpansion=l}walkAndMap(t,n,s){const i=new Map,l=En(),a={value:0},u=new Set;return{widgets:this.walkItems(t,n,i,s,l,a,u),eventRegistry:i}}walkItems(t,n,s,i,l,a,u){return t.flatMap(o=>{if(o.type!=="ITEMS")throw new Error("Unexpected gui shortcut type");return o.items.map(c=>this.processItem(c,o.itemType,o.tags,n,s,i,l,a,u))})}processItem(t,n,s,i,l,a,u,o,c){const d=n,m=U(n),y=m.parseEntry(t),_=this.buildBaseDef(y),w=this.buildDecoratorForMatching(_,d,s),L=this.resolver.resolve(w,i),Ot=L.leafSelectors.filter(T=>T.targetState!=null),Wt={leafSelectors:L.leafSelectors.filter(T=>T.targetState==null),sensibleDefaults:L.sensibleDefaults};let I=this.merger.merge(_,d,Wt);m.afterMerge&&(I=m.afterMerge(I,{eventRegistry:l,formConfig:a,eventIdGenerator:u})),I=this.eventWiring.wireInputLayoutEvents(I,l,u);const{cleanedResult:Nt,stateData:$}=this.stateExpansion.extractFromMergeResult(I,Ot);let A;if(m.buildCustomWidget){const T=this.buildCustomWidgetContext(y.children,i,l,a,u,o,c);A=this.buildCustomWidget(m,Nt,T)}else A=this.mapper.mapToWidget(Nt,d);if(typeof A!="function"){const T=A;T.uid||(T.path&&!c.has(T.path)?(T.uid=T.path,c.add(T.path)):T.uid=`dx_${o.value++}`)}if(this.stateExpansion.hasStateData($))if(typeof A=="function"){const T=A;A=(Gn=>{const Kn=T(Gn);return this.stateExpansion.applyToWidget(Kn,$,l,u)})}else A=this.stateExpansion.applyToWidget(A,$,l,u);return A}buildCustomWidgetContext(t,n,s,i,l,a,u){return{children:t,mapStaticDef:(o,c)=>this.mapper.mapStaticDef(o,c),walkChildren:o=>this.walkItems(o,n,s,i,l,a,u)}}buildCustomWidget(t,n,s){return t.buildCustomWidget(n,s)}buildBaseDef(t){const n=t.baseDef;return typeof n=="function"?s=>{const l=n(s??{});return t.path!=null?{...l,path:t.path}:l}:t.path!=null?{...n,path:t.path}:n}buildDecoratorForMatching(t,n,s){if(typeof t=="function")return{itemType:n,tags:[...s]};const i=[...s,..."tags"in t&&t.tags?t.tags:[]],l="uid"in t?t.uid:void 0,a="type"in t?t.type:void 0;return{itemType:n,tags:i,uid:l,type:a}}}const Cn={input:new Set(["disabled","readonly","label","validator","size"]),action:new Set(["disabled","label","size"]),layout:new Set(["size"]),display:new Set([])},Et={onChange:"change",onLoad:"load",onFilter:"filter",onClick:"click"};class Pn{extractFromMergeResult(t,n){const s={};for(const u of n){const o=u.targetState,c=u.config,d=c.override&&typeof c.override!="function"?c.override:c;s[o]={...s[o]||{},...d}}if(t.kind==="dynamic"){const u=t.fn;return{cleanedResult:{kind:"dynamic",fn:c=>{const d=u(c),{states:m,...y}=d;return y}},stateData:{stateOverrides:s}}}const{states:i,...l}=t.def,a={};for(const[u,o]of Object.entries(s))a[u]={...o};if(i)for(const[u,o]of Object.entries(i))a[u]={...a[u]||{},...o};return{cleanedResult:{kind:"static",def:l},stateData:{stateOverrides:a}}}applyToWidget(t,n,s,i){const{stateOverrides:l}=n;if(Object.keys(l).length===0)return t;const a={...t},u=t.kind,o=Cn[u]||new Set;t.props&&(a.props={...t.props}),t.on&&(a.on={...t.on});for(const[c,d]of Object.entries(l))for(const[m,y]of Object.entries(d))m==="visible"?this.applyVisibility(a,c,y):Et[m]?this.applyStateEvent(a,c,m,y,s,i):o.has(m)?a[`${m}.${c}`]=y:(a.props||(a.props={}),a.props[`${m}.${c}`]=y);return a}hasStateData(t){return Object.keys(t.stateOverrides).length>0}applyVisibility(t,n,s){if(s){const i=t.include?.in||[];t.include={...t.include||{},in:[...i,n]}}else{const i=t.exclude?.from||[];t.exclude={...t.exclude||{},from:[...i,n]}}}applyStateEvent(t,n,s,i,l,a){const u=Et[s];if(t.on||(t.on={}),typeof i=="function"){const o=a.next();l.set(o,i),t.on[`${u}.${n}`]=o}else typeof i=="string"&&(t.on[`${u}.${n}`]=i)}}const Bn=new Pn;class wn{constructor(t,n,s){this.selectorNormalizer=t,this.eventWiring=n,this.walker=s}processDxFacade(t,n=[],s){const{defs:i,gslSelectors:l,formConfig:a}=this.prepareForm(t,n,s),{widgets:u,eventRegistry:o}=this.walker.walkAndMap(i,l,a),c=u[0];return this.buildResult({form:c},o,a)}prepareForm(t,n,s){const l=(Array.isArray(t)?[...t]:[t]).map(c=>typeof c=="function"?R(c):c),a=this.selectorNormalizer.normalizeSelectors(n),u={...this.selectorNormalizer.extractFormConfig(),...s},o=this.eventWiring.countSubmitButtons(l);if(o>1)throw new Error(`Only one submit button is allowed per form, but ${o} were found. A button is a submit button if it has uid: '#submit' or onClick: 'submit'.`);if(!u.suppressAutomaticSubmit&&o===0&&l.push(M()),!u.suppressAutomaticStack){const c={def:{uid:"#root",direction:"column",widgetName:"flex"},children:l};return{defs:[{type:"ITEMS",itemType:b.LAYOUTS,items:[c],tags:[]}],gslSelectors:a,formConfig:u}}return{defs:l,gslSelectors:a,formConfig:u}}convertStateNames(t){const n={};for(const[s,i]of Object.entries(t))n[s.replace(/\$/g,":")]=i;return n}buildResult(t,n,s){s.states&&Object.keys(s.states).length>0&&(t={...t,states:this.convertStateNames(s.states)});const i={form:t};return n.size>0&&(i.events=l=>{const a=n.get(l.name);if(a){const u=c=>{if(c&&typeof c=="object"&&"path"in c&&!("type"in c)){const{path:d,...m}=c;for(const[y,_]of Object.entries(m))l.callback({type:"OVERRIDE_WIDGET_PROP",payload:{path:d,prop:y,value:_}})}else l.callback(c)},o={...l,callback:u,update:u};a(o)}}),s.dependencies&&(i.dependencies=s.dependencies),s.widgetLoaders&&(i.widgetLoaders=s.widgetLoaders),s.validateOn&&(i.validateOn=s.validateOn),s.itemRenderers&&(i.itemRenderers=s.itemRenderers),i}}const Ln=new Dn(Tn,Sn,kn,B,Bn),Dt=new wn(Un,B,Ln);function Ct(e){return typeof e=="function"?!0:Array.isArray(e)?e.length===0||e.every(Pt):Pt(e)}function Pt(e){if(typeof e=="function")return!0;if(e===null||typeof e!="object")return!1;const t=e;return t.type==="ITEMS"&&typeof t.itemType=="string"}const Bt=Object.freeze({}),vn=Object.freeze({}),wt=new WeakMap;function F(e,t){return e==null?t:typeof e=="object"?e:{}}function Mn(e,t,n){if(!Ct(e))return{formDef:e};const s=F(e,Bt),i=F(t,Bt),l=F(n,vn);let a=wt.get(s);a||(a=new WeakMap,wt.set(s,a));let u=a.get(i);u||(u=new WeakMap,a.set(i,u));const o=u.get(l);if(o)return o;const c=Dt.processDxFacade(e,t,n),d={formDef:c.form,formEvent:c.events,dependencies:c.dependencies,widgetLoaders:c.widgetLoaders,validateOn:c.validateOn,itemRenderers:c.itemRenderers};return u.set(l,d),d}class Rn{create(t){return{states:t.states,form:{uid:"gui-root-uid",type:"flex",kind:"layout",children:t.form}}}}function On(){return new Rn}const Wn=e=>e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"label")&&Object.prototype.hasOwnProperty.call(e,"value");function Nn(e,t){if(e!=null&&typeof e=="object"&&"__rid"in e)return e.__rid;const n=t();return Object.defineProperty(e,"__rid",{value:n,enumerable:!1,configurable:!1}),n}function Fn(e){return typeof e=="object"&&e!==null&&"$ref"in e&&typeof e.$ref=="string"&&Object.keys(e).length===1}async function jn(e,t){const n=new URL(e,t).href,s=await fetch(n);if(!s.ok)throw new Error(`Failed to load form chunk ${n}: ${s.status}`);const{$schema:i,...l}=await s.json();return j(l,n)}async function j(e,t){if(Fn(e))return jn(e.$ref,t);const n=e;if(Array.isArray(n.children)){const s=await Promise.all(n.children.map(i=>j(i,t)));return{...n,children:s}}return e}async function $n(e,t){const n=await Promise.all(e.form.map(s=>j(s,t)));return{...e,form:n}}const Yn={textinput:({config:e,props:t,validator:n})=>({uid:"",kind:"input",type:"textinput",...t&&{props:t},...n&&{validator:n},...e}),password:({config:e,props:t,validator:n})=>({uid:"",kind:"input",type:"password",...t&&{props:t},...n&&{validator:n},...e}),numberinput:({config:e,props:t,validator:n})=>({uid:"",kind:"input",type:"numberinput",...t&&{props:t},...n&&{validator:n},...e}),checkbox:({config:e,props:t,validator:n})=>({uid:"",kind:"input",type:"checkbox",...t&&{props:t},...n&&{validator:n},...e}),select:({config:e,props:t,validator:n})=>({uid:"",kind:"input",type:"select",...t&&{props:t},...n&&{validator:n},...e}),flex:(e,t)=>({uid:"",kind:"layout",type:"flex",...t&&{props:t},...e}),grid:(e,t)=>({uid:"",kind:"layout",type:"grid",...t&&{props:t},...e}),tabs:(e,t)=>({uid:"",kind:"layout",type:"tabs",...t&&{props:t},...e}),alert:(e,t)=>({uid:"",kind:"display",type:"alert",...t&&{props:t},...e}),markdownText:(e,t)=>({uid:"",kind:"display",type:"markdownText",...t&&{props:t},...e})},Lt=["calendar","checkbox","currency","dateInput","datePicker","dropdown","list","markdown","number","password","radiogroup","rangeCalendar","rangeDateInput","rangeDatePicker","repeater","select","textarea","textinput","toggle"],vt=["accordion","flex","grid","tabs"],Mt=["alert","markdownText","renderer"],Rt=["button"],zn=[...Lt,...vt,...Mt,...Rt];r.GolemWidgets=Yn,r._gslAccordionByUid=bt,r._gslAccordions=gt,r._gslActionByUid=at,r._gslActions=lt,r._gslAlertByUid=pt,r._gslAlerts=dt,r._gslBooleanInputs=Ee,r._gslCalendarByUid=Ve,r._gslCalendars=Ke,r._gslCheckboxByUid=Me,r._gslCheckboxes=ve,r._gslCurrencies=Fe,r._gslCurrencyByUid=je,r._gslCustomActionByUid=_t,r._gslCustomActions=Tt,r._gslCustomDisplayByUid=At,r._gslCustomDisplays=St,r._gslCustomInputByUid=ht,r._gslCustomInputs=ft,r._gslCustomLayoutByUid=It,r._gslCustomLayouts=kt,r._gslDateInputByUid=Xe,r._gslDateInputs=He,r._gslDatePickerByUid=qe,r._gslDatePickers=Ze,r._gslDisplayByUid=ct,r._gslDisplays=ut,r._gslDropdownByUid=Be,r._gslDropdowns=Pe,r._gslInputByUid=ke,r._gslInputs=E,r._gslLayoutByUid=ot,r._gslLayouts=rt,r._gslListByUid=Ge,r._gslLists=ze,r._gslMarkdownByUid=Ye,r._gslMarkdowns=$e,r._gslNumberInputs=Ue,r._gslPasswordByUid=Ne,r._gslPasswords=We,r._gslRadiogroupByUid=Le,r._gslRadiogroups=we,r._gslRangeCalendarByUid=Je,r._gslRangeCalendars=Qe,r._gslRangeDateInputByUid=et,r._gslRangeDateInputs=xe,r._gslRangeDatePickerByUid=nt,r._gslRangeDatePickers=tt,r._gslRepeaterByUid=st,r._gslRepeaters=N,r._gslSelectByUid=Ce,r._gslSelects=De,r._gslStates=gn,r._gslTabs=yt,r._gslTabsByUid=mt,r._gslTag=bn,r._gslTextInputs=Ie,r._gslTextareaByUid=Oe,r._gslTextareas=Re,r._guiAccordion=he,r._guiAlert=ue,r._guiBooleanInput=G,r._guiButton=v,r._guiCalendar=ee,r._guiCheckbox=X,r._guiCurrency=Q,r._guiCustomAction=oe,r._guiCustomDisplay=ce,r._guiCustomInput=ae,r._guiCustomLayout=Te,r._guiDateInput=te,r._guiDatePicker=ne,r._guiDisplay=R,r._guiDropdown=V,r._guiFlex=D,r._guiGrid=C,r._guiHorizontalFlex=de,r._guiHorizontalGrid=ye,r._guiList=x,r._guiMarkdown=J,r._guiNumberInput=z,r._guiPassword=q,r._guiRadiogroup=H,r._guiRangeCalendar=se,r._guiRangeDateInput=ie,r._guiRangeDatePicker=le,r._guiRepeater=_e,r._guiSelect=K,r._guiSubmitButton=M,r._guiTabs=be,r._guiTextInput=Y,r._guiTextarea=Z,r._guiVerticalFlex=pe,r._guiVerticalGrid=me,r.actionWidgets=Rt,r.createGslSelector=O,r.defineShortcutType=p,r.displayWidgets=Mt,r.extractWidgetProps=g,r.formDefs=Dt,r.getItemKey=Nn,r.golemForm=On,r.golemWidgets=zn,r.gui=mn,r.inputWidgets=Lt,r.isDxDefinitions=Ct,r.isOption=Wn,r.layoutWidgets=vt,r.processAutoLabel=f,r.processAutoPlaceholder=S,r.resolveChunkRefs=$n,r.resolveFormInput=Mn,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./repeater-DD8jJ4pS.cjs");require("@golemui/core");require("@golemui/gui-validators");function f(s,t,e){if(typeof t=="function"){const u=t;return{items:[{key:s,def:o=>({type:"text",...u(o)})}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}const n={type:"text",...t};return{items:[{key:s,def:n}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}function T(s,t,e){if(typeof t=="function"){const u=t;return{items:[{key:s,def:o=>({type:"number",...u(o)})}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}const n={type:"number",...t};return{items:[{key:s,def:n}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}function I(s,t,e){if(typeof t=="function"){const u=t;return{items:[{key:s,def:o=>({type:"boolean",...u(o)})}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}const n={type:"boolean",...t};return{items:[{key:s,def:n}],type:"ITEMS",itemType:i.GuiItemTypes.INPUTS,tags:e??[]}}function U(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"SELECT",items:[{key:s,def:y=>({type:"select",...r(y)})}],tags:e??[]}}const n={type:"select",...t};return{type:"ITEMS",itemType:"SELECT",items:[{key:s,def:n}],tags:e??[]}}function B(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"DROPDOWN",items:[{key:s,def:y=>({type:"dropdown",...r(y)})}],tags:e??[]}}const n={type:"dropdown",...t};return{type:"ITEMS",itemType:"DROPDOWN",items:[{key:s,def:n}],tags:e??[]}}function k(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"RADIOGROUP",items:[{key:s,def:y=>({type:"radiogroup",...r(y)})}],tags:e??[]}}const n={type:"radiogroup",...t};return{type:"ITEMS",itemType:"RADIOGROUP",items:[{key:s,def:n}],tags:e??[]}}function D(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"CHECKBOX",items:[{key:s,def:y=>({type:"checkbox",...r(y)})}],tags:e??[]}}const n={type:"checkbox",...t};return{type:"ITEMS",itemType:"CHECKBOX",items:[{key:s,def:n}],tags:e??[]}}function S(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"TEXTAREA",items:[{key:s,def:y=>({type:"textarea",...r(y)})}],tags:e??[]}}const n={type:"textarea",...t};return{type:"ITEMS",itemType:"TEXTAREA",items:[{key:s,def:n}],tags:e??[]}}function h(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"PASSWORD",items:[{key:s,def:y=>({type:"password",...r(y)})}],tags:e??[]}}const n={type:"password",...t};return{type:"ITEMS",itemType:"PASSWORD",items:[{key:s,def:n}],tags:e??[]}}function E(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"CURRENCY",items:[{key:s,def:y=>({type:"currency",...r(y)})}],tags:e??[]}}const n={type:"currency",...t};return{type:"ITEMS",itemType:"CURRENCY",items:[{key:s,def:n}],tags:e??[]}}function A(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"MARKDOWN",items:[{key:s,def:y=>({type:"markdown",...r(y)})}],tags:e??[]}}const n={type:"markdown",...t};return{type:"ITEMS",itemType:"MARKDOWN",items:[{key:s,def:n}],tags:e??[]}}function R(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"LIST",items:[{key:s,def:y=>({type:"list",...r(y)})}],tags:e??[]}}const n={type:"list",...t};return{type:"ITEMS",itemType:"LIST",items:[{key:s,def:n}],tags:e??[]}}function M(s,t,e){if(typeof t=="function"){const u=t;return{items:[o=>({type:"calendar",path:s,...u(o)})],type:"ITEMS",itemType:"CALENDAR",tags:e??[]}}return{items:[{type:"calendar",path:s,...t}],type:"ITEMS",itemType:"CALENDAR",tags:e??[]}}function P(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"DATE_INPUT",items:[{key:s,def:y=>({type:"dateInput",...r(y)})}],tags:e??[]}}const n={type:"dateInput",...t};return{type:"ITEMS",itemType:"DATE_INPUT",items:[{key:s,def:n}],tags:e??[]}}function w(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"DATE_PICKER",items:[{key:s,def:y=>({type:"datePicker",...r(y)})}],tags:e??[]}}const n={type:"datePicker",...t};return{type:"ITEMS",itemType:"DATE_PICKER",items:[{key:s,def:n}],tags:e??[]}}function x(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"RANGE_CALENDAR",items:[{key:s,def:y=>({type:"rangeCalendar",...r(y)})}],tags:e??[]}}const n={type:"rangeCalendar",...t};return{type:"ITEMS",itemType:"RANGE_CALENDAR",items:[{key:s,def:n}],tags:e??[]}}function C(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"RANGE_DATE_INPUT",items:[{key:s,def:y=>({type:"rangeDateInput",...r(y)})}],tags:e??[]}}const n={type:"rangeDateInput",...t};return{type:"ITEMS",itemType:"RANGE_DATE_INPUT",items:[{key:s,def:n}],tags:e??[]}}function b(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"RANGE_DATE_PICKER",items:[{key:s,def:y=>({type:"rangeDatePicker",...r(y)})}],tags:e??[]}}const n={type:"rangeDatePicker",...t};return{type:"ITEMS",itemType:"RANGE_DATE_PICKER",items:[{key:s,def:n}],tags:e??[]}}function L(s,t,e,n){if(typeof e=="function"){const o=e;return{type:"ITEMS",itemType:"CUSTOM_INPUT",items:[{key:t,def:c=>({customType:s,...o(c)})}],tags:n??[]}}const u={customType:s,...e};return{type:"ITEMS",itemType:"CUSTOM_INPUT",items:[{key:t,def:u}],tags:n??[]}}function N(s,t,e){if(typeof t=="function"){const r=t;return{type:"ITEMS",itemType:"CUSTOM_ACTION",items:[a=>({customType:s,...r(a)})],tags:e??[]}}return{type:"ITEMS",itemType:"CUSTOM_ACTION",items:[{customType:s,...t}],tags:e??[]}}function G(s,t){return{type:"ITEMS",itemType:"ALERTS",items:[s],tags:t??[]}}function W(s,t,e){if(typeof t=="function"){const a=t;return{type:"ITEMS",itemType:"CUSTOM_DISPLAY",items:[c=>({customType:s,...a(c)})],tags:e??[]}}const{uid:n,...u}=t??{};return{type:"ITEMS",itemType:"CUSTOM_DISPLAY",items:[{customType:s,...n!=null?{uid:n}:{},props:Object.keys(u).length>0?u:void 0}],tags:e??[]}}const l=(s,t,e)=>({type:"ITEMS",itemType:i.GuiItemTypes.LAYOUTS,items:[{def:{widgetName:"flex",...t??{}},children:s}],tags:e??[]}),F=(s,t,e)=>l(s,{direction:"row",...t??{}},e),K=(s,t,e)=>l(s,{direction:"column",...t??{}},e),g=(s,t,e)=>({type:"ITEMS",itemType:i.GuiItemTypes.LAYOUTS,items:[{def:{widgetName:"grid",direction:"row",autoFit:!0,...t??{}},children:s}],tags:e??[]}),Y=(s,t,e)=>g(s,{direction:"row",...t??{}},e),$=(s,t,e)=>g(s,{direction:"column",...t??{}},e);function m(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function j(s,t,e){const n=s.map(o=>({label:o.label,uid:o.uid??m(o.label)})),u=s.map(o=>({type:"ITEMS",itemType:i.GuiItemTypes.LAYOUTS,items:[{def:{uid:o.uid??m(o.label),direction:"column",widgetName:"flex"},children:o.children}],tags:[]}));return{type:"ITEMS",itemType:"TABS",items:[{def:{tabs:n,...t},children:u}],tags:e??[]}}function _(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function z(s,t,e){const n=s.map(o=>({label:o.label,uid:o.uid??_(o.label)})),u=s.map(o=>({type:"ITEMS",itemType:i.GuiItemTypes.LAYOUTS,items:[{def:{uid:o.uid??_(o.label),direction:"column",widgetName:"flex"},children:o.children}],tags:[]}));return{type:"ITEMS",itemType:"ACCORDION",items:[{def:{sections:n,...t},children:u}],tags:e??[]}}function H(s,t,e,n){if(typeof e=="function"){const o=e;return{type:"ITEMS",itemType:"CUSTOM_LAYOUT",items:[{def:c=>({customType:s,...o(c)}),children:t}],tags:n??[]}}return{type:"ITEMS",itemType:"CUSTOM_LAYOUT",items:[{def:{customType:s,...e},children:t}],tags:n??[]}}function v(s,t,e){const{template:n,...u}=t;return{type:"ITEMS",itemType:"REPEATER",items:[{key:s,def:u,children:n}],tags:e??[]}}const V=s=>i._gslInputs(s,t=>t.type==="text"),X=s=>i._gslInputs(s,t=>t.type==="number"),q=s=>i._gslInputs(s,t=>t.type==="boolean");class d{constructor(t){this.conditions=t}static root(){return new d([])}tag(t){return new d([...this.conditions,{kind:"tagsAnd",tags:[t]}])}state(t){return new d([...this.conditions,{kind:"state",name:t}])}tagsAnd(t){return new d([...this.conditions,{kind:"tagsAnd",tags:t}])}tagsOr(t){return new d([...this.conditions,{kind:"tagsOr",tags:t}])}apply(t){if(this.conditions.length===0)return t;const e=this.conditions.find(r=>r.kind==="state"),n=this.conditions.filter(r=>r.kind!=="state"),u=t.matcher;return{...t,matcher:r=>{if(!u(r))return!1;for(const o of n){const a=r.tags??[];if(o.kind==="tagsAnd"){for(const y of o.tags)if(!a.includes(y))return!1}else{if(o.tags.length===0)continue;if(!o.tags.some(y=>a.includes(y)))return!1}}return!0},...e?{targetState:e.name}:{}}}inputs(t){return this.apply(i._gslInputs(t))}inputByUid(t,e){return this.apply(i._gslInputByUid(t,e))}textInputs(t){return this.apply(V(t))}numberInputs(t){return this.apply(X(t))}booleanInputs(t){return this.apply(q(t))}selects(t){return this.apply(i._gslSelects(t))}selectByUid(t,e){return this.apply(i._gslSelectByUid(t,e))}dropdowns(t){return this.apply(i._gslDropdowns(t))}dropdownByUid(t,e){return this.apply(i._gslDropdownByUid(t,e))}radiogroups(t){return this.apply(i._gslRadiogroups(t))}radiogroupByUid(t,e){return this.apply(i._gslRadiogroupByUid(t,e))}checkboxes(t){return this.apply(i._gslCheckboxes(t))}checkboxByUid(t,e){return this.apply(i._gslCheckboxByUid(t,e))}textareas(t){return this.apply(i._gslTextareas(t))}textareaByUid(t,e){return this.apply(i._gslTextareaByUid(t,e))}passwords(t){return this.apply(i._gslPasswords(t))}passwordByUid(t,e){return this.apply(i._gslPasswordByUid(t,e))}currencies(t){return this.apply(i._gslCurrencies(t))}currencyByUid(t,e){return this.apply(i._gslCurrencyByUid(t,e))}markdowns(t){return this.apply(i._gslMarkdowns(t))}markdownByUid(t,e){return this.apply(i._gslMarkdownByUid(t,e))}lists(t){return this.apply(i._gslLists(t))}listByUid(t,e){return this.apply(i._gslListByUid(t,e))}calendars(t){return this.apply(i._gslCalendars(t))}calendarByUid(t,e){return this.apply(i._gslCalendarByUid(t,e))}dateInputs(t){return this.apply(i._gslDateInputs(t))}dateInputByUid(t,e){return this.apply(i._gslDateInputByUid(t,e))}datePickers(t){return this.apply(i._gslDatePickers(t))}datePickerByUid(t,e){return this.apply(i._gslDatePickerByUid(t,e))}rangeCalendars(t){return this.apply(i._gslRangeCalendars(t))}rangeCalendarByUid(t,e){return this.apply(i._gslRangeCalendarByUid(t,e))}rangeDateInputs(t){return this.apply(i._gslRangeDateInputs(t))}rangeDateInputByUid(t,e){return this.apply(i._gslRangeDateInputByUid(t,e))}rangeDatePickers(t){return this.apply(i._gslRangeDatePickers(t))}rangeDatePickerByUid(t,e){return this.apply(i._gslRangeDatePickerByUid(t,e))}repeaters(t){return this.apply(i._gslRepeaters(t))}repeaterByUid(t,e){return this.apply(i._gslRepeaterByUid(t,e))}actions(t){return this.apply(i._gslActions(t))}actionByUid(t,e){return this.apply(i._gslActionByUid(t,e))}layouts(t){return this.apply(i._gslLayouts(t))}layoutByUid(t,e){return this.apply(i._gslLayoutByUid(t,e))}displays(t){return this.apply(i._gslDisplays(t))}displayByUid(t,e){return this.apply(i._gslDisplayByUid(t,e))}alerts(t){return this.apply(i._gslAlerts(t))}alertByUid(t,e){return this.apply(i._gslAlertByUid(t,e))}tabs(t){return this.apply(i._gslTabs(t))}tabsByUid(t,e){return this.apply(i._gslTabsByUid(t,e))}accordions(t){return this.apply(i._gslAccordions(t))}accordionByUid(t,e){return this.apply(i._gslAccordionByUid(t,e))}customInputs(t){return this.apply(i._gslCustomInputs(t))}customInputByUid(t,e){return this.apply(i._gslCustomInputByUid(t,e))}customActions(t){return this.apply(i._gslCustomActions(t))}customActionByUid(t,e){return this.apply(i._gslCustomActionByUid(t,e))}customDisplays(t){return this.apply(i._gslCustomDisplays(t))}customDisplayByUid(t,e){return this.apply(i._gslCustomDisplayByUid(t,e))}customLayouts(t){return this.apply(i._gslCustomLayouts(t))}customLayoutByUid(t,e){return this.apply(i._gslCustomLayoutByUid(t,e))}}const tt={inputs:{textInput:f,numberInput:T,booleanInput:I,select:U,dropdown:B,radiogroup:k,checkbox:D,textarea:S,password:h,currency:E,markdown:A,list:R,calendar:M,dateInput:P,datePicker:w,rangeCalendar:x,rangeDateInput:C,rangeDatePicker:b,repeater:v,custom:L},actions:{button:i._guiButton,submitButton:i._guiSubmitButton,custom:N},displays:{display:i._guiDisplay,alert:G,custom:W},layouts:{flex:l,horizontalFlex:F,verticalFlex:K,grid:g,horizontalGrid:Y,verticalGrid:$,tabs:j,accordion:z,custom:H},selectors:d.root()};function et(s,...t){return t.map(e=>({...e,targetState:s}))}function st(s,...t){return{kind:"aggregated",matcher:e=>e.tags?.includes(s)??!1,children:t}}class it{create(t){return{states:t.states,form:{uid:"gui-root-uid",type:"flex",kind:"layout",children:t.form}}}}function nt(){return new it}const ot=s=>s!==null&&typeof s=="object"&&Object.prototype.hasOwnProperty.call(s,"label")&&Object.prototype.hasOwnProperty.call(s,"value");function rt(s){return typeof s=="object"&&s!==null&&"$ref"in s&&typeof s.$ref=="string"&&Object.keys(s).length===1}async function ut(s,t){const e=new URL(s,t).href,n=await fetch(e);if(!n.ok)throw new Error(`Failed to load form chunk ${e}: ${n.status}`);const{$schema:u,...r}=await n.json();return p(r,e)}async function p(s,t){if(rt(s))return ut(s.$ref,t);const e=s;if(Array.isArray(e.children)){const n=await Promise.all(e.children.map(u=>p(u,t)));return{...e,children:n}}return s}async function yt(s,t){const e=await Promise.all(s.form.map(n=>p(n,t)));return{...s,form:e}}const at={textinput:({config:s,props:t,validator:e})=>({uid:"",kind:"input",type:"textinput",...t&&{props:t},...e&&{validator:e},...s}),password:({config:s,props:t,validator:e})=>({uid:"",kind:"input",type:"password",...t&&{props:t},...e&&{validator:e},...s}),numberinput:({config:s,props:t,validator:e})=>({uid:"",kind:"input",type:"numberinput",...t&&{props:t},...e&&{validator:e},...s}),checkbox:({config:s,props:t,validator:e})=>({uid:"",kind:"input",type:"checkbox",...t&&{props:t},...e&&{validator:e},...s}),select:({config:s,props:t,validator:e})=>({uid:"",kind:"input",type:"select",...t&&{props:t},...e&&{validator:e},...s}),flex:(s,t)=>({uid:"",kind:"layout",type:"flex",...t&&{props:t},...s}),grid:(s,t)=>({uid:"",kind:"layout",type:"grid",...t&&{props:t},...s}),tabs:(s,t)=>({uid:"",kind:"layout",type:"tabs",...t&&{props:t},...s}),alert:(s,t)=>({uid:"",kind:"display",type:"alert",...t&&{props:t},...s}),markdownText:(s,t)=>({uid:"",kind:"display",type:"markdownText",...t&&{props:t},...s})},Q=["calendar","checkbox","currency","dateInput","datePicker","dropdown","list","markdown","number","password","radiogroup","rangeCalendar","rangeDateInput","rangeDatePicker","repeater","select","textarea","textinput","toggle"],Z=["accordion","flex","grid","tabs"],J=["alert","markdownText","renderer"],O=["button"],dt=[...Q,...Z,...J,...O];exports._gslAccordionByUid=i._gslAccordionByUid;exports._gslAccordions=i._gslAccordions;exports._gslActionByUid=i._gslActionByUid;exports._gslActions=i._gslActions;exports._gslAlertByUid=i._gslAlertByUid;exports._gslAlerts=i._gslAlerts;exports._gslCalendarByUid=i._gslCalendarByUid;exports._gslCalendars=i._gslCalendars;exports._gslCheckboxByUid=i._gslCheckboxByUid;exports._gslCheckboxes=i._gslCheckboxes;exports._gslCurrencies=i._gslCurrencies;exports._gslCurrencyByUid=i._gslCurrencyByUid;exports._gslCustomActionByUid=i._gslCustomActionByUid;exports._gslCustomActions=i._gslCustomActions;exports._gslCustomDisplayByUid=i._gslCustomDisplayByUid;exports._gslCustomDisplays=i._gslCustomDisplays;exports._gslCustomInputByUid=i._gslCustomInputByUid;exports._gslCustomInputs=i._gslCustomInputs;exports._gslCustomLayoutByUid=i._gslCustomLayoutByUid;exports._gslCustomLayouts=i._gslCustomLayouts;exports._gslDateInputByUid=i._gslDateInputByUid;exports._gslDateInputs=i._gslDateInputs;exports._gslDatePickerByUid=i._gslDatePickerByUid;exports._gslDatePickers=i._gslDatePickers;exports._gslDisplayByUid=i._gslDisplayByUid;exports._gslDisplays=i._gslDisplays;exports._gslDropdownByUid=i._gslDropdownByUid;exports._gslDropdowns=i._gslDropdowns;exports._gslInputByUid=i._gslInputByUid;exports._gslInputs=i._gslInputs;exports._gslLayoutByUid=i._gslLayoutByUid;exports._gslLayouts=i._gslLayouts;exports._gslListByUid=i._gslListByUid;exports._gslLists=i._gslLists;exports._gslMarkdownByUid=i._gslMarkdownByUid;exports._gslMarkdowns=i._gslMarkdowns;exports._gslPasswordByUid=i._gslPasswordByUid;exports._gslPasswords=i._gslPasswords;exports._gslRadiogroupByUid=i._gslRadiogroupByUid;exports._gslRadiogroups=i._gslRadiogroups;exports._gslRangeCalendarByUid=i._gslRangeCalendarByUid;exports._gslRangeCalendars=i._gslRangeCalendars;exports._gslRangeDateInputByUid=i._gslRangeDateInputByUid;exports._gslRangeDateInputs=i._gslRangeDateInputs;exports._gslRangeDatePickerByUid=i._gslRangeDatePickerByUid;exports._gslRangeDatePickers=i._gslRangeDatePickers;exports._gslRepeaterByUid=i._gslRepeaterByUid;exports._gslRepeaters=i._gslRepeaters;exports._gslSelectByUid=i._gslSelectByUid;exports._gslSelects=i._gslSelects;exports._gslTabs=i._gslTabs;exports._gslTabsByUid=i._gslTabsByUid;exports._gslTextareaByUid=i._gslTextareaByUid;exports._gslTextareas=i._gslTextareas;exports._guiButton=i._guiButton;exports._guiDisplay=i._guiDisplay;exports._guiSubmitButton=i._guiSubmitButton;exports.createGslSelector=i.createGslSelector;exports.defineShortcutType=i.defineShortcutType;exports.extractWidgetProps=i.extractWidgetProps;exports.formDefs=i.formDefs;exports.getItemKey=i.getItemKey;exports.isDxDefinitions=i.isDxDefinitions;exports.processAutoLabel=i.processAutoLabel;exports.processAutoPlaceholder=i.processAutoPlaceholder;exports.resolveFormInput=i.resolveFormInput;exports.GolemWidgets=at;exports._gslBooleanInputs=q;exports._gslNumberInputs=X;exports._gslStates=et;exports._gslTag=st;exports._gslTextInputs=V;exports._guiAccordion=z;exports._guiAlert=G;exports._guiBooleanInput=I;exports._guiCalendar=M;exports._guiCheckbox=D;exports._guiCurrency=E;exports._guiCustomAction=N;exports._guiCustomDisplay=W;exports._guiCustomInput=L;exports._guiCustomLayout=H;exports._guiDateInput=P;exports._guiDatePicker=w;exports._guiDropdown=B;exports._guiFlex=l;exports._guiGrid=g;exports._guiHorizontalFlex=F;exports._guiHorizontalGrid=Y;exports._guiList=R;exports._guiMarkdown=A;exports._guiNumberInput=T;exports._guiPassword=h;exports._guiRadiogroup=k;exports._guiRangeCalendar=x;exports._guiRangeDateInput=C;exports._guiRangeDatePicker=b;exports._guiRepeater=v;exports._guiSelect=U;exports._guiTabs=j;exports._guiTextInput=f;exports._guiTextarea=S;exports._guiVerticalFlex=K;exports._guiVerticalGrid=$;exports.actionWidgets=O;exports.displayWidgets=J;exports.golemForm=nt;exports.golemWidgets=dt;exports.gui=tt;exports.inputWidgets=Q;exports.isOption=ot;exports.layoutWidgets=Z;exports.resolveChunkRefs=yt;
|
package/internals.d.ts
ADDED
package/internals.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./repeater-DD8jJ4pS.cjs");exports.getItemKey=e.getItemKey;exports.resolveFormInput=e.resolveFormInput;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ValidateOn } from '@golemui/core';
|
|
1
|
+
import { Form, FormEvent, UiState, ValidateOn } from '@golemui/core';
|
|
2
2
|
import { ValidGuiShortcut } from './core/dx.domain';
|
|
3
3
|
import { DxCommonFields, DxInternalFields } from './core/dxBase.types';
|
|
4
4
|
import { DxRuntimeParams } from './core/dxUtilityTypes';
|
|
5
5
|
import { Dependencies } from '../shared';
|
|
6
|
-
import * as Core from '@golemui/core';
|
|
7
6
|
export type GslItemType = string;
|
|
8
7
|
/**
|
|
9
8
|
* @deprecated Use DxCommonFields (+ kind-specific DxInputBase/DxActionBase/etc.)
|
|
@@ -16,9 +15,9 @@ export type WidgetItemDecorator = DxInternalFields & DxCommonFields;
|
|
|
16
15
|
export type DxDisplayRenderFn = (params: DxRuntimeParams) => any;
|
|
17
16
|
export type DxDefinitionItem = ValidGuiShortcut | DxDisplayRenderFn;
|
|
18
17
|
export type DxDefinitions = DxDefinitionItem | DxDefinitionItem[];
|
|
19
|
-
export type FormEvents = (event:
|
|
20
|
-
export interface DxResult<S extends
|
|
21
|
-
form:
|
|
18
|
+
export type FormEvents = (event: FormEvent) => void;
|
|
19
|
+
export interface DxResult<S extends UiState = never, F extends Record<string, any> = any> {
|
|
20
|
+
form: Form<S, F>;
|
|
22
21
|
events?: FormEvents;
|
|
23
22
|
dependencies?: Dependencies;
|
|
24
23
|
widgetLoaders?: Record<string, () => Promise<unknown>>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ValidateOn } from '@golemui/core';
|
|
1
|
+
import { ValidateOn, Action, Form, I18nTranslator, Middleware, State } from '@golemui/core';
|
|
2
2
|
import { CustomValidatorSchemas } from '@golemui/gui-validators';
|
|
3
3
|
import { Dependencies } from '../shared';
|
|
4
4
|
import { DxFormConfig, GslSelectorsInput } from './core/dx.domain';
|
|
5
5
|
import { DxDefinitions, FormEvents } from './formDef.domain';
|
|
6
|
-
import * as Core from '@golemui/core';
|
|
7
6
|
export type FormInput = string | Record<string, any> | DxDefinitions;
|
|
8
7
|
export interface GuiFormInitConfig {
|
|
9
8
|
formDef: FormInput;
|
|
@@ -13,15 +12,15 @@ export interface GuiFormInitConfig {
|
|
|
13
12
|
customValidators?: CustomValidatorSchemas;
|
|
14
13
|
data?: Record<string, any>;
|
|
15
14
|
meta?: Record<string, any>;
|
|
16
|
-
middlewares?:
|
|
15
|
+
middlewares?: Middleware<State, Action>[];
|
|
17
16
|
validateOn?: ValidateOn;
|
|
18
17
|
itemRenderers?: Record<string, unknown>;
|
|
19
|
-
localization?:
|
|
18
|
+
localization?: I18nTranslator;
|
|
20
19
|
dependencies?: Dependencies;
|
|
21
20
|
formName?: string;
|
|
22
21
|
}
|
|
23
22
|
export interface ResolvedFormInput<FormData extends Record<string, any> = any> {
|
|
24
|
-
formDef: string | Record<string, any> |
|
|
23
|
+
formDef: string | Record<string, any> | Form<any, FormData>;
|
|
25
24
|
formEvent?: FormEvents;
|
|
26
25
|
dependencies?: Dependencies;
|
|
27
26
|
widgetLoaders?: Record<string, () => Promise<unknown>>;
|
|
@@ -34,4 +33,7 @@ export interface ResolvedFormInput<FormData extends Record<string, any> = any> {
|
|
|
34
33
|
* either strings or plain objects with `kind`/`type` at the top level.
|
|
35
34
|
*/
|
|
36
35
|
export declare function isDxDefinitions(input: unknown): input is DxDefinitions;
|
|
36
|
+
/**
|
|
37
|
+
* @internal Used by framework Form wrappers, not part of the end-user public API.
|
|
38
|
+
*/
|
|
37
39
|
export declare function resolveFormInput<FormData extends Record<string, any> = any>(formDef: FormInput | undefined, formSelectors?: GslSelectorsInput, formConfig?: DxFormConfig): ResolvedFormInput<FormData>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BooleanValidator } from '@golemui/gui-validators';
|
|
1
|
+
import { NumberValidator, StringValidator, BooleanValidator } from '@golemui/gui-validators';
|
|
2
2
|
import { NumberinputProps, TextinputProps, ToggleProps } from '../../../widget.props';
|
|
3
3
|
import { DxCommonFields, DxInputBase, DxInternalFields } from '../../core/dxBase.types';
|
|
4
4
|
import { DefOrCallback, DxRuntimeParams, GslConfigBase, GuiShortcutOf } from '../../core/dxUtilityTypes';
|
|
5
|
-
import * as ValidatorsVanilla from '@golemui/gui-validators';
|
|
6
5
|
/**
|
|
7
6
|
* @deprecated Kept for backward compatibility in pipeline internals.
|
|
8
7
|
* New code should use the individual subtypes directly.
|
|
@@ -11,12 +10,12 @@ export interface DataInputDecorator extends DxInputBase, DxCommonFields {
|
|
|
11
10
|
type: 'text' | 'number' | 'boolean';
|
|
12
11
|
placeholder?: string;
|
|
13
12
|
}
|
|
14
|
-
export type NumberDataInputValidator = Omit<
|
|
13
|
+
export type NumberDataInputValidator = Omit<NumberValidator, 'type'>;
|
|
15
14
|
export interface NumberDataInputDecorator extends DxInputBase, DxCommonFields, Partial<NumberinputProps> {
|
|
16
15
|
type: 'number';
|
|
17
16
|
validator?: NumberDataInputValidator;
|
|
18
17
|
}
|
|
19
|
-
export type TextDataInputValidator = Omit<
|
|
18
|
+
export type TextDataInputValidator = Omit<StringValidator, 'type'>;
|
|
20
19
|
export interface TextDataInputDecorator extends DxInputBase, DxCommonFields, Partial<TextinputProps> {
|
|
21
20
|
type: 'text';
|
|
22
21
|
validator?: TextDataInputValidator;
|
package/lib/golem-form.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ActionWidget, DisplayWidget, Form, FormWidget, FunctionWidgetParams, InputWidget, LayoutWidget, ReactiveExpression } from '@golemui/core';
|
|
1
2
|
import { Validator } from '@golemui/gui-validators';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
type ExtractStates<S> = S extends Record<string, Core.ReactiveExpression> ? keyof S : never;
|
|
3
|
+
import { AccordionProps, AlertProps, ButtonProps, CalendarProps, CheckboxProps, CurrencyProps, DatePickerProps, DateRange, DateinputProps, DropdownProps, FlexProps, GridProps, ListProps, MarkdownProps, MarkdownTextProps, NumberinputProps, OptionValue, PasswordProps, RadiogroupProps, RangeCalendarProps, RangeDateInputProps, RangeDatePickerProps, RepeaterProps, SelectProps, TabsProps, TextareaProps, TextinputProps, ToggleProps } from './widget.props';
|
|
4
|
+
type ExtractStates<S> = S extends Record<string, ReactiveExpression> ? keyof S : never;
|
|
5
5
|
/**
|
|
6
6
|
* Make the uid propery optional on all widgets
|
|
7
7
|
*/
|
|
@@ -13,11 +13,11 @@ type DeepPartialUid<T> = T extends (...args: infer A) => infer R ? (...args: A)
|
|
|
13
13
|
type DeepPartialUidArray<T extends any[]> = {
|
|
14
14
|
[P in keyof T]: DeepPartialUid<T[P]>;
|
|
15
15
|
};
|
|
16
|
-
declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends
|
|
17
|
-
create<States extends Record<string,
|
|
16
|
+
declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never> {
|
|
17
|
+
create<States extends Record<string, ReactiveExpression>>(config: {
|
|
18
18
|
states?: States;
|
|
19
19
|
form: DeepPartialUid<GolemWidget<FormType, ExtractStates<States>, Validator, CustomWidget>>[];
|
|
20
|
-
}):
|
|
20
|
+
}): Form<ExtractStates<States>, FormType>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Creates a new GolemFormBuilder instance for building type-safe forms.
|
|
@@ -91,85 +91,85 @@ declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidge
|
|
|
91
91
|
* });
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends
|
|
95
|
-
type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
96
|
-
type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
94
|
+
export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never>(): GolemFormBuilder<FormType, CustomWidget>;
|
|
95
|
+
type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType> = never> = GuiAccordion<FormType, States, V, CustomWidget> | GuiAlert<FormType, States> | GuiButton<FormType, States> | GuiCalendar<FormType, States, V> | GuiCheckbox<FormType, States, V> | GuiCurrency<FormType, States, V> | GuiDateinput<FormType, States, V> | GuiDatePicker<FormType, States, V> | GuiDropdown<FormType, States, V> | GuiFunctionWidget<FormType, States, V, CustomWidget> | GuiList<FormType, States, V> | GuiMarkdown<FormType, States, V> | GuiMarkdownText<FormType, States> | GuiNumberinput<FormType, States, V> | GuiPassword<FormType, States, V> | GuiRadiogroup<FormType, States, V> | GuiRangeCalendar<FormType, States, V> | GuiRangeDateInput<FormType, States, V> | GuiRangeDatePicker<FormType, States, V> | GuiRepeater<FormType, States, V, CustomWidget> | GuiSelect<FormType, States, V> | GuiFlex<FormType, States, V, CustomWidget> | GuiGrid<FormType, States, V, CustomWidget> | GuiTabs<FormType, States, V, CustomWidget> | GuiTextarea<FormType, States, V> | GuiTextInput<FormType, States, V> | GuiToggle<FormType, States, V> | CustomWidget;
|
|
96
|
+
type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
97
97
|
type: 'accordion';
|
|
98
98
|
};
|
|
99
|
-
type GuiAlert<FormType extends Record<string, any>, States extends string> =
|
|
99
|
+
type GuiAlert<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, AlertProps> & {
|
|
100
100
|
type: 'alert';
|
|
101
101
|
};
|
|
102
|
-
type GuiButton<FormType extends Record<string, any>, States extends string> =
|
|
102
|
+
type GuiButton<FormType extends Record<string, any>, States extends string> = ActionWidget<States, FormType, ButtonProps> & {
|
|
103
103
|
type: 'button';
|
|
104
104
|
};
|
|
105
|
-
type GuiCalendar<FormType extends Record<string, any>, States extends string, V> =
|
|
105
|
+
type GuiCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, CalendarProps, V> & {
|
|
106
106
|
type: 'calendar';
|
|
107
107
|
};
|
|
108
|
-
type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> =
|
|
108
|
+
type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, CheckboxProps, V> & {
|
|
109
109
|
type: 'checkbox';
|
|
110
110
|
};
|
|
111
|
-
type GuiCurrency<FormType extends Record<string, any>, States extends string, V> =
|
|
111
|
+
type GuiCurrency<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, CurrencyProps, V> & {
|
|
112
112
|
type: 'currency';
|
|
113
113
|
};
|
|
114
|
-
type GuiDateinput<FormType extends Record<string, any>, States extends string, V> =
|
|
114
|
+
type GuiDateinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DateinputProps, V> & {
|
|
115
115
|
type: 'dateInput';
|
|
116
116
|
};
|
|
117
|
-
type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> =
|
|
117
|
+
type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DatePickerProps, V> & {
|
|
118
118
|
type: 'datePicker';
|
|
119
119
|
};
|
|
120
|
-
type GuiDropdown<FormType extends Record<string, any>, States extends string, V> =
|
|
120
|
+
type GuiDropdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, DropdownProps<unknown>, V> & {
|
|
121
121
|
type: 'dropdown';
|
|
122
122
|
};
|
|
123
|
-
type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
124
|
-
type GuiList<FormType extends Record<string, any>, States extends string, V> =
|
|
123
|
+
type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = (api?: FunctionWidgetParams<FormType>) => Exclude<GolemWidget<FormType, States, V, CustomWidget>, () => any>;
|
|
124
|
+
type GuiList<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, ListProps<unknown>, V> & {
|
|
125
125
|
type: 'list';
|
|
126
126
|
};
|
|
127
|
-
type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> =
|
|
127
|
+
type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, MarkdownProps, V> & {
|
|
128
128
|
type: 'markdown';
|
|
129
129
|
};
|
|
130
|
-
type GuiMarkdownText<FormType extends Record<string, any>, States extends string> =
|
|
130
|
+
type GuiMarkdownText<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, MarkdownTextProps> & {
|
|
131
131
|
type: 'markdownText';
|
|
132
132
|
};
|
|
133
|
-
type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> =
|
|
133
|
+
type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, NumberinputProps, V> & {
|
|
134
134
|
type: 'number';
|
|
135
135
|
};
|
|
136
|
-
type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> =
|
|
136
|
+
type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, RadiogroupProps, V> & {
|
|
137
137
|
type: 'radiogroup';
|
|
138
138
|
};
|
|
139
|
-
type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> =
|
|
139
|
+
type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, RangeCalendarProps, V> & {
|
|
140
140
|
type: 'rangeCalendar';
|
|
141
141
|
};
|
|
142
|
-
type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> =
|
|
142
|
+
type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDateInputProps, V> & {
|
|
143
143
|
type: 'rangeDateInput';
|
|
144
144
|
};
|
|
145
|
-
type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> =
|
|
145
|
+
type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDatePickerProps, V> & {
|
|
146
146
|
type: 'rangeDatePicker';
|
|
147
147
|
};
|
|
148
|
-
type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
148
|
+
type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = InputWidget<Record<string, unknown>[], States, FormType, RepeaterProps<LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]>>, V> & {
|
|
149
149
|
type: 'repeater';
|
|
150
150
|
};
|
|
151
|
-
type GuiSelect<FormType extends Record<string, any>, States extends string, V> =
|
|
151
|
+
type GuiSelect<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, SelectProps, V> & {
|
|
152
152
|
type: 'select';
|
|
153
153
|
};
|
|
154
|
-
type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
154
|
+
type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, FlexProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
155
155
|
type: 'flex';
|
|
156
156
|
};
|
|
157
|
-
type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
157
|
+
type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, GridProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
158
158
|
type: 'grid';
|
|
159
159
|
};
|
|
160
|
-
type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends
|
|
160
|
+
type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, TabsProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
|
|
161
161
|
type: 'tabs';
|
|
162
162
|
};
|
|
163
|
-
type GuiTextarea<FormType extends Record<string, any>, States extends string, V> =
|
|
163
|
+
type GuiTextarea<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextareaProps, V> & {
|
|
164
164
|
type: 'textarea';
|
|
165
165
|
};
|
|
166
|
-
type GuiTextInput<FormType extends Record<string, any>, States extends string, V> =
|
|
166
|
+
type GuiTextInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextinputProps, V> & {
|
|
167
167
|
type: 'textinput';
|
|
168
168
|
};
|
|
169
|
-
type GuiPassword<FormType extends Record<string, any>, States extends string, V> =
|
|
169
|
+
type GuiPassword<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, PasswordProps, V> & {
|
|
170
170
|
type: 'password';
|
|
171
171
|
};
|
|
172
|
-
type GuiToggle<FormType extends Record<string, any>, States extends string, V> =
|
|
172
|
+
type GuiToggle<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, ToggleProps, V> & {
|
|
173
173
|
type: 'toggle';
|
|
174
174
|
};
|
|
175
175
|
export {};
|
package/lib/utils/repeater.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @internal Used by framework Repeater components, not part of the end-user public API.
|
|
3
|
+
*
|
|
2
4
|
* Returns a stable unique key for a repeater data item.
|
|
3
5
|
* Assigns a non-enumerable `__rid` property on first access so the ID
|
|
4
6
|
* survives array operations (splice, filter, spread) without polluting
|
package/lib/widget.factory.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
type InputWidgetConfig<T> = Omit<
|
|
4
|
-
type LayoutWidgetConfig = Omit<
|
|
5
|
-
type DisplayWidgetConfig = Omit<
|
|
1
|
+
import { BaseWidget, DisplayWidget, InputWidget, LayoutWidget, UiState } from '@golemui/core';
|
|
2
|
+
import { AlertProps, CheckboxProps, FlexProps, GridProps, MarkdownTextProps, NumberinputProps, PasswordProps, SelectProps, TabsProps, TextinputProps } from './widget.props';
|
|
3
|
+
type InputWidgetConfig<T> = Omit<InputWidget<T>, 'kind' | 'type' | 'uid' | 'props' | 'validator'>;
|
|
4
|
+
type LayoutWidgetConfig = Omit<LayoutWidget, 'kind' | 'type' | 'uid' | 'props'>;
|
|
5
|
+
type DisplayWidgetConfig = Omit<BaseWidget, 'kind' | 'type' | 'uid' | 'props'>;
|
|
6
6
|
/**
|
|
7
7
|
* Golem widget factory
|
|
8
8
|
*/
|
|
9
9
|
export declare const GolemWidgets: {
|
|
10
|
-
textinput: <StateKeys extends
|
|
10
|
+
textinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
11
11
|
config: InputWidgetConfig<string>;
|
|
12
|
-
props?:
|
|
12
|
+
props?: TextinputProps;
|
|
13
13
|
validator?: V;
|
|
14
|
-
}) =>
|
|
15
|
-
password: <StateKeys extends
|
|
14
|
+
}) => InputWidget<string, StateKeys>;
|
|
15
|
+
password: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
16
16
|
config: InputWidgetConfig<string>;
|
|
17
|
-
props?:
|
|
17
|
+
props?: PasswordProps;
|
|
18
18
|
validator?: V;
|
|
19
|
-
}) =>
|
|
20
|
-
numberinput: <StateKeys extends
|
|
19
|
+
}) => InputWidget<string, StateKeys>;
|
|
20
|
+
numberinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
21
21
|
config: InputWidgetConfig<number>;
|
|
22
|
-
props?:
|
|
22
|
+
props?: NumberinputProps;
|
|
23
23
|
validator?: V;
|
|
24
|
-
}) =>
|
|
25
|
-
checkbox: <StateKeys extends
|
|
24
|
+
}) => InputWidget<number, StateKeys>;
|
|
25
|
+
checkbox: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
26
26
|
config: InputWidgetConfig<boolean>;
|
|
27
|
-
props?:
|
|
27
|
+
props?: CheckboxProps;
|
|
28
28
|
validator?: V;
|
|
29
|
-
}) =>
|
|
30
|
-
select: <StateKeys extends
|
|
29
|
+
}) => InputWidget<boolean, StateKeys>;
|
|
30
|
+
select: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
|
|
31
31
|
config: InputWidgetConfig<string>;
|
|
32
|
-
props?:
|
|
32
|
+
props?: SelectProps;
|
|
33
33
|
validator?: V;
|
|
34
|
-
}) =>
|
|
35
|
-
flex: <StateKeys extends
|
|
36
|
-
grid: <StateKeys extends
|
|
37
|
-
tabs: <StateKeys extends
|
|
38
|
-
alert: <StateKeys extends
|
|
39
|
-
markdownText: <StateKeys extends
|
|
34
|
+
}) => InputWidget<string, StateKeys>;
|
|
35
|
+
flex: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: FlexProps) => LayoutWidget<StateKeys>;
|
|
36
|
+
grid: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: GridProps) => LayoutWidget<StateKeys>;
|
|
37
|
+
tabs: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: TabsProps) => LayoutWidget<StateKeys>;
|
|
38
|
+
alert: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: AlertProps) => DisplayWidget<StateKeys>;
|
|
39
|
+
markdownText: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: MarkdownTextProps) => DisplayWidget<StateKeys>;
|
|
40
40
|
};
|
|
41
41
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/gui-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.umd.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"import": "./index.js",
|
|
12
12
|
"require": "./index.umd.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./internals": {
|
|
15
|
+
"types": "./internals.d.ts",
|
|
16
|
+
"import": "./internals.js",
|
|
17
|
+
"require": "./internals.umd.cjs"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -17,11 +22,14 @@
|
|
|
17
22
|
"index.d.ts",
|
|
18
23
|
"index.js",
|
|
19
24
|
"index.umd.cjs",
|
|
25
|
+
"internals.d.ts",
|
|
26
|
+
"internals.js",
|
|
27
|
+
"internals.umd.cjs",
|
|
20
28
|
"*.md"
|
|
21
29
|
],
|
|
22
30
|
"dependencies": {
|
|
23
|
-
"@golemui/core": "0.
|
|
24
|
-
"@golemui/gui-validators": "0.
|
|
31
|
+
"@golemui/core": "0.13.0",
|
|
32
|
+
"@golemui/gui-validators": "0.13.0"
|
|
25
33
|
},
|
|
26
34
|
"repository": {
|
|
27
35
|
"type": "git",
|