@nocobase/client-v2 2.2.28 → 2.2.29
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/es/index.mjs +2 -2
- package/lib/index.js +25 -25
- package/package.json +7 -7
- package/src/flow/models/fields/InputFieldModel.tsx +1 -1
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +16 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +1 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +20 -0
package/es/index.mjs
CHANGED
|
@@ -294,7 +294,7 @@ ${n}`,u)}}let o=T(e.issues.filter(e=>"runtime"===e.type)),n=o?`Key runtime issue
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
`;function D(e,t){var l;return!!(null==(l=I[e])?void 0:l.has(t))}function E(e){return"hasAvailableData"in e&&"function"==typeof e.hasAvailableData}function Y(e){return"submit"in e&&"function"==typeof e.submit}class N extends m.t{serialize(){return{...super.serialize(),variableContractType:{type:"form",use:this.use}}}get form(){return this.context.form}submitFromRunJs(){if(E(this)&&!this.hasAvailableData())return;let e=this.mapSubModels("actions",e=>e).find(e=>e.getFlow("submitSettings"));if(e)return e.onClick(void 0);let t=["CreateFormModel","EditFormModel"].some(e=>{let t=this.flowEngine.getModelClass(e);return t&&this instanceof t});!this.context.publicFormRuntime&&t&&Y(this)&&this.submit().catch(e=>{this.context.message.error(this.context.t("Save failed")),console.error("Form submission error:",e)})}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let o=this.getStepParams("formModelSettings","assignRules"),n=(null==o?void 0:o.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(n)?n:[]);let i=null==(l=this.context)?void 0:l.resource,r=T(n,this.collection);(null==i?void 0:i.addUpdateAssociationValues)&&r.length&&i.addUpdateAssociationValues(r)}renderConfigureActions(){return(0,o.jsx)(r.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,o.jsx)(r.FlowSettingsButton,{icon:(0,o.jsx)(n.SettingOutlined,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var o;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(o=super.onDispatchEventStart)?void 0:o.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&D(e,t)&&l){let o=l.getStepParams(e,t);return void 0!==o?o:super.getStepParams(e,t)}if(e&&!t&&I[e]&&l){let t=super.getStepParams(e)||{},o=l.getStepParams(e)||{};for(let l of I[e])Object.prototype.hasOwnProperty.call(o,l)&&void 0!==o[l]&&(t[l]=o[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let o=this.subModels.grid,n=(e,t)=>{let l=I[e];if(!l||!o)return t;let n={};for(let[i,r]of Object.entries(t))l.has(i)?o.setStepParams(e,i,r):n[i]=r;return n};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(D(e,t)&&o?o.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=n(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,o]of Object.entries(e)){if("object"!=typeof o||null===o){t[l]=o;continue}let e=n(l,o);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,p.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,r.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=a.Form.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new P({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,o,n,i,a,s,u,c,p,m,h,f,g,v,y,_;if(!e)return!1;let b=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!b||!(null==(o=this.collection)||null==(l=o.getField)?void 0:l.call(o,b)))return!1;if((()=>{var e,t,l,o;let n=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],i=new Set;for(let e of n){let t=null==e||null==(o=e.getStepParams)||null==(l=o.call(e,"fieldSettings","init"))?void 0:l.fieldPath,n=null==t?void 0:t.toString().split(".")[0];n&&i.add(n)}return i})().has(b)){let l=null==(i=this.form)||null==(n=i.getFieldValue)?void 0:n.call(i,b);if(null==l||Array.isArray(l)&&0===l.length)return!1;let o=t.getFormValuesSnapshot(),c=!1;if(o&&"object"==typeof o){let t=(0,d.getValuesByPath)(o,e);if(void 0!==t){let l=e.replace(/\[\d+\]/g,"").split(".").filter(e=>!/^\d+$/.test(e)).join("."),o=null==(s=this.collection)||null==(a=s.getFieldByPath)?void 0:a.call(s,l),n=null==o?void 0:o.targetCollectionTitleFieldName,i=e=>!(!e||"object"!=typeof e||Array.isArray(e))&&(!n||void 0!==e[n]),r=null===t||(Array.isArray(t)?0===t.length||t.every(e=>null===e||i(e)):i(t));if(!(null==o||null==(u=o.isAssociationField)?void 0:u.call(o))||r)return!1;c=!0}}return(0,r.createAssociationSubpathResolver)(()=>this.collection,c?void 0:()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(m=this.context)||null==(p=m.resource)||null==(c=p.getMeta)?void 0:c.call(p,"currentFilterByTk"))??(null==(g=this.context)||null==(f=g.resource)||null==(h=f.getFilterByTk)?void 0:h.call(f))??(null==(_=this.collection)||null==(y=_.getFilterByTK)?void 0:y.call(_,null==(v=this.context)?void 0:v.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,o){return t.setFormValues(this,[{path:e,value:l}],o)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),this.userModifiedTopLevelFields=new Set,this._defaultCustomModelClasses={FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"},this.customModelClasses={}}}function O(e){var t,l,n,i;let{model:r,children:d,layoutProps:u={},initialValues:c,...p}=e,m=!!((null==r||null==(t=r.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),h=[p.className,m?L:"",m?R:""].filter(Boolean).join(" ");return(0,o.jsx)(a.Form,{form:r.form,initialValues:(null==(i=r.context)||null==(n=i.view)||null==(l=n.inputArgs)?void 0:l.formData)||r.context.record||c,...(0,s.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=r.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=r.markUserModifiedFields)||l.call(r,e);let o=r.formValueRuntime;o?o.handleFormValuesChange(e,t):(r.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),r.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:h||void 0,children:d})}let B=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),o=parseFloat(l.marginTop)||0,n=parseFloat(l.marginBottom)||0;return t.height+o+n},V=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},H=e=>{let{heightMode:t,containerRef:l,actionsRef:o,footerRef:n,deps:i=[]}=e,[r,a]=(0,u.useState)(),s=(0,u.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let r=Math.max(0,Math.floor(i-B((null==o?void 0:o.current)||null)-B((null==n?void 0:n.current)||null)));a(e=>e===r?e:r)},[t,l,o,n]);return(0,u.useLayoutEffect)(()=>{s()},[s,...i]),(0,u.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==o?void 0:o.current)||null,i=(null==n?void 0:n.current)||null,r=new ResizeObserver(()=>s());return r.observe(e),t&&r.observe(t),i&&r.observe(i),()=>r.disconnect()},[s,l,o,n,...i]),r},q=e=>{var t,l;let{model:n,gridModel:i,layoutProps:r,onFinish:a,grid:s,actions:d,footer:c,heightMode:p,height:m}=e,h=(0,u.useRef)(null),f=(0,u.useRef)(null),g=(0,u.useRef)(null),v="specifyValue"===p||"fullHeight"===p,y={paddingTop:null==(l=n.context)||null==(t=l.themeToken)?void 0:t.padding},_=(null==r?void 0:r.layout)==="horizontal"?V(null==r?void 0:r.labelWidth):void 0;_&&(y.marginInlineStart=_);let b=H({heightMode:p,containerRef:h,actionsRef:d?f:void 0,footerRef:c?g:void 0,deps:[m]});(0,u.useEffect)(()=>{var e;if(!i)return;let t=v?b:void 0;(null==(e=i.props)?void 0:e.height)!==t&&i.setProps({height:t})},[i,b,v]);let x=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,M=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,o.jsx)(O,{model:n,layoutProps:r,onFinish:a,style:x,children:(0,o.jsxs)("div",{ref:h,style:M,children:[s,d?(0,o.jsx)("div",{style:y,ref:f,children:d}):null,c?(0,o.jsx)("div",{ref:g,children:c}):null]})})};N.define({hide:!0}),N.registerFlow({key:"formModelSettings",title:(0,r.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,r.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,r.tExpr)("Field values"),beforeParamsSave(e){let t=(0,j.Fp)(e.model);Array.isArray(t)&&t.length&&(0,p.jI)(e.model)},afterParamsSave(e){var t,l,o,n,i,r;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(o=e.model)||null==(l=o.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(i=e.model)||null==(n=i.context)?void 0:n.resource,u=T(s,null==(r=e.model)?void 0:r.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),N.registerFlow({key:"eventSettings",title:(0,r.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),N.registerEvents({formValuesChange:{title:(0,r.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,r.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":c.H}},handler:c.b}});class $ extends N{}$.define({hide:!0})},3127(e,t,l){l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>o.S2});var o=l(3341);let n=["editItemSettings","formItemSettings"],i=(0,o.li)(n),r=(0,o.u4)(n);function a(e){return(0,o.TE)(e,i)}function s(e){return(0,o.Co)(e,i,r)}},4084(e,t,l){l.d(t,{submitHandler:()=>a});var o=l(504),n=l(3027),i=l(24);function r(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,m,h,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,1961)),_=v instanceof y;await (0,i.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,i.go)(null==e?void 0:e.model)});let b=v.form.getFieldsValue(!0),x=(0,i.xT)(b,v),M=await (0,n.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!M){null==(s=e.exit)||s.call(e);return}let w=(0,n.GO)(x,M);if(g instanceof o.SingleRecordResource){if(_){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=r(a?await a(w):await g.save(w,t.requestConfig));return _?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(m=v.formValueRuntime)||null==(p=m.resetAfterFormReset)||p.call(m),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof o.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let o=a?await a(w,l):await g.update(l,w,t.requestConfig);return null==(h=v.resetUserModifiedFields)||h.call(v),r(o)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},24(e,t,l){l.d(t,{D9:()=>g,go:()=>f,xT:()=>v});var o=l(7583),n=l(3728);function i(e,t){var l,o;let n=null==e||null==(o=e.context)||null==(l=o.blockModel)?void 0:l.uid,i=null==t?void 0:t.uid;return!!n&&!!i&&String(n)===String(i)}function r(e){var t,l;let o=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(o)&&o.length)return o;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),o=null==t?void 0:t.fieldPath;if("string"==typeof o&&o)return o}catch{}let n=null==e?void 0:e.fieldPath;if("string"==typeof n&&n)return n;let i="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,r=null==i?void 0:i.name;return"string"==typeof r&&r||Array.isArray(r)&&r.length?r:null}function a(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function s(e){var t;let l=r(e);return l?a((0,n.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function d(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let i=o.default.get(e,n);o.default.isPlainObject(i)&&0===Object.keys(i).length&&o.default.unset(e,n)}}function u(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function c(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],o=new Set;return u(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!i(t,e))return;let n=s(t);if(!n)return;let r=JSON.stringify(n);o.has(r)||(o.add(r),l.push(n))}),l}function p(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?a(e):null}function m(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function h(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let o=[],n=new Set;for(let e of l){let t=p(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);n.has(l)||(n.add(l),o.push(t))}if(!o.length)return null;let i=c(e);return i.length?o.filter(e=>!i.some(t=>m(t,e))):o}function f(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function g(e){let{form:t,blockModel:l,flowSettingsEnabled:o,skipValidator:n}=e;if(n||!t||"function"!=typeof t.validateFields)return;let i=o&&l?h(l):null;if(Array.isArray(i)){i.length&&await t.validateFields(i);return}await t.validateFields()}function v(e,t){if(!e||"object"!=typeof e)return e;let l=c(t);if(!l.length)return e;let n=o.default.cloneDeep(e);for(let e of l)o.default.unset(n,e),d(n,e);return n}},9413(e,t,l){l.d(t,{F:()=>n});var o=l(3526);function n(e,t){let l=(t,l,o)=>{var n,i,r;return!l||(null==e||null==(r=e.app)||null==(i=r.jsonLogic)||null==(n=i.apply)?void 0:n.call(i,{[l]:[t,o]}))};try{return(0,o.evaluateConditions)((0,o.removeInvalidFilterItems)(t),l)}catch{return!1}}},9613(e,t,l){l.d(t,{Dd:()=>s,G:()=>u,Wp:()=>c,x3:()=>d});var o=l(2314),n=l(504),i=l(7583),r=l(3728);function a(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||i.default.isPlainObject(e))}function s(e,t){if(t)for(let l of(0,r.ef)(e))t.deps.add(`fv:${l}`)}function d(e){let{valuesMirror:t,collector:l,basePath:n,getFormValuesSnapshot:r,getFormValueAtPath:u}=e,c=()=>n.length?i.default.get(t,n):t,p=c(),m=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},h=e=>d({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:r,getFormValueAtPath:u});return new Proxy(m,{get(e,d){if("toJSON"===d)return(l&&(l.wildcard=!0),0===n.length)?()=>r():()=>(0,o.toJS)(c());if("symbol"==typeof d){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[d]}let p=c();if(null==p)return;if("__raw"===d)return p;if("__proto__"===d||"prototype"===d||"constructor"===d){l&&(l.wildcard=!0);return}let m=Array.isArray(p),f=m&&("number"==typeof d&&Number.isInteger(d)||"string"==typeof d&&/^\d+$/.test(d));if(m&&!f){l&&(l.wildcard=!0);let e=p[d];return"function"==typeof e?e.bind(p):e}let g=[...n,f?Number(d):d];s(g,l);let v=p[d];if(void 0===v){let e=u(g);i.default.isEqual(e,v)||(i.default.set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:a(v)?h(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function u(e,t){try{let l=(0,n.extractUsedVariablePaths)(e)||{};for(let[e,o]of Object.entries(l)){let l=Array.isArray(o)?o:[];for(let o of l.length?l:[""]){if("formValues"===e){if(!o){t.wildcard=!0;continue}let e=(0,r.EA)(String(o)).filter(e=>"object"!=typeof e);s(e,t);continue}let l=o?`ctx:${e}:${String(o)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function c(e,t){if((0,n.isRunJSValue)(e))try{let l=(0,n.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,o]of Object.entries(l)){let l=Array.isArray(o)?o:[];for(let o of l.length?l:[""]){if("formValues"===e){if(!o){t.wildcard=!0;continue}let e=(0,r.EA)(String(o)).filter(e=>"object"!=typeof e);s(e,t);continue}let l=o?`ctx:${e}:${String(o)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},3728(e,t,l){function o(e){let t=[],l=0,o=e.length,n=()=>{let n=l;for(;l<o&&"."!==e[l]&&"["!==e[l];)l++;let i=e.slice(n,l);i&&t.push(i)};for(;l<o;){let i=e[l];if("."===i){l++;continue}if("["===i){let n=++l;for(;l<o&&"]"!==e[l];)l++;let i=e.slice(n,l);l++,/^\d+$/.test(i)?t.push(Number(i)):i&&t.push({placeholder:i});continue}n()}return t}function n(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,o]=e.split(":"),n=Number(o);!t||Number.isNaN(n)||l.push({name:t,index:n})}return l}function i(e,t){let l=Array.isArray(e)?[...e]:o(e),i=n(t),r=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=r[r.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<i.length&&i[a].name!==t;)a++;if(a>=i.length)return null;r.push(i[a].index),a++;continue}if(r.push(t),"string"==typeof t&&a<i.length&&i[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(r.push(i[a].index),a++)}}return r}function r(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return o(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let o of e)l.push(o),t.push(r(l));return t}l.d(t,{EA:()=>o,IJ:()=>i,Qc:()=>r,c1:()=>a,ef:()=>s})},1022(e,t,l){l.d(t,{Po:()=>i,ao:()=>r,li:()=>n});var o=l(7583);let n=20;function i(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!o.default.isPlainObject(e)&&0===Object.keys(e).length)}function r(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},3341(e,t,l){l.d(t,{Co:()=>h,PP:()=>i,S2:()=>m,TE:()=>p,li:()=>s,u4:()=>c});var o=l(7583);function n(){return{logic:"$and",items:[]}}function i(e,t,l){var o;let n=null==e||null==(o=e.getStepParams)?void 0:o.call(e,t,l);return!!n&&Object.prototype.hasOwnProperty.call(n,"value")}function r(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function a(e,t){var l,o;if(e)return null==(o=e.getStepParams)||null==(l=o.call(e,t,"initialValue"))?void 0:l.defaultValue}function s(e){return t=>{if(!t)return;let l=r(t);if(void 0!==l)return l;for(let l of e){let e=a(t,l);if(void 0!==e)return e}}}function d(e,t,l){var n,i,r;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],o.default.isEmpty(a)&&delete e.stepParams[t],null==(r=e.emitter)||null==(i=r.emit)||i.call(r,"onStepParamsChanged"))}function u(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let o=null==(l=e._options)?void 0:l.props;o&&Object.prototype.hasOwnProperty.call(o,"initialValue")&&delete o.initialValue}function c(e){return t=>{if(t)for(let l of(u(t),e))d(t,l,"initialValue")}}function p(e,t){var l,o,i,r,a;let s=null==e||null==(i=e.subModels)||null==(o=i.grid)||null==(l=o.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(r=a.call(e,"fieldSettings","init"))?void 0:r.fieldPath)||(null==e?void 0:e.fieldPath),o=l?String(l):"";if(!o)continue;let i=t(e);void 0!==i&&u.push({key:`legacy-default:${o}`,enable:!0,targetPath:o,mode:"default",condition:n(),value:i})}return u}function m(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){n.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&n.add(t)}}let i=new Set(l.map(e=>String(e.key??""))),r=[];for(let e of o){let t=e.targetPath?String(e.targetPath):"";if(!t||n.has(t))continue;let l={...e},o=String(l.key??"");o&&i.has(o)&&(l.key=`${o}:${t}`),r.push(l)}return r.length?[...l,...r]:l}function h(e,t,l){var o,n,i;let r=null==e||null==(i=e.subModels)||null==(n=i.grid)||null==(o=n.subModels)?void 0:o.items,a=Array.isArray(r)?r:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},8709(e,t,l){l.d(t,{$4:()=>a,r5:()=>r});var o=l(7404);let n="__index__";function i(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function r(e,t){let l=null==e?void 0:e[n];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let o=i(e,t);return null!=o?`pk:${o}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[n];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[n]:(0,o.uid)()}):e});return t?l:e}},4881(e,t,l){l.d(t,{m:()=>p});var o=l(1178),n=l(504),i=l(2793),r=l(1649),a=l(9829),s=l(6859),d=l(16);function u(e){let{value:t,onChange:l,onCompositionStart:n,onCompositionEnd:a,...s}=e,[d,u]=(0,r.useState)(()=>c(t));(0,r.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,o.jsx)(i.Input,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==n||n(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,o.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,o.jsx)(u,{...l})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,o;null==(o=e.blockModel)||null==(l=o.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.customAlphabet)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,n.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,n.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,n.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let o=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(o||{},"enableScan")?!!(null==o?void 0:o.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,n.tExpr)("Input")}),n.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),n.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},7520(e,t,l){l.d(t,{o:()=>o,e:()=>s});class o{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){this.apiClient=e,this.loading=!1,this.listeners=new Set}}var n=l(504),i=l(6305),r=l(6553),a=l(1649);let s=()=>{var e,t;let l=(0,i.nm)().systemSettings,o=(0,n.useFlowEngine)({throwError:!1}),[,s]=(0,a.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,a.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>r.A[e]).map(e=>({label:r.A[e].label,value:e})),[d]);return(0,a.useEffect)(()=>(l.load(),l.subscribe(()=>{s(e=>e+1)})),[l]),(0,a.useEffect)(()=>{o&&o.context.defineProperty("locale",{get:e=>{var t,l,o;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(o=e.i18n)?void 0:o.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[o,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},8481(e,t,l){l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let o={view:"get"},n=e=>e?o[e]||e:null,i=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>n(e)).filter(Boolean)}},r=(e,t)=>{let l=n(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:o,unavailableActions:i}=e.options;return Array.isArray(o)?o.includes(l):!Array.isArray(i)||!i.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>r(e,t)),s=e=>{var t;let l=i(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let o=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof o)return null;try{let e=o.call({}),t=n(e);return t?[t]:null}catch{return null}},d=e=>i(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},7123(e,t,l){l.d(t,{l:()=>o});function o(e){let{blockLabel:t,dsName:l,dsCount:o,collectionTitle:n,sourceCollectionTitle:i,associationTitle:r}=e,a=o>1&&!!l,s=n;if(i&&r){let e=`${i} > ${r} (${n})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${n}`;return`
|
|
297
|
+
`;function D(e,t){var l;return!!(null==(l=I[e])?void 0:l.has(t))}function E(e){return"hasAvailableData"in e&&"function"==typeof e.hasAvailableData}function Y(e){return"submit"in e&&"function"==typeof e.submit}class N extends m.t{serialize(){return{...super.serialize(),variableContractType:{type:"form",use:this.use}}}get form(){return this.context.form}submitFromRunJs(){if(E(this)&&!this.hasAvailableData())return;let e=this.mapSubModels("actions",e=>e).find(e=>e.getFlow("submitSettings"));if(e)return e.onClick(void 0);let t=["CreateFormModel","EditFormModel"].some(e=>{let t=this.flowEngine.getModelClass(e);return t&&this instanceof t});!this.context.publicFormRuntime&&t&&Y(this)&&this.submit().catch(e=>{this.context.message.error(this.context.t("Save failed")),console.error("Form submission error:",e)})}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let o=this.getStepParams("formModelSettings","assignRules"),n=(null==o?void 0:o.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(n)?n:[]);let i=null==(l=this.context)?void 0:l.resource,r=T(n,this.collection);(null==i?void 0:i.addUpdateAssociationValues)&&r.length&&i.addUpdateAssociationValues(r)}renderConfigureActions(){return(0,o.jsx)(r.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,o.jsx)(r.FlowSettingsButton,{icon:(0,o.jsx)(n.SettingOutlined,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var o;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(o=super.onDispatchEventStart)?void 0:o.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&D(e,t)&&l){let o=l.getStepParams(e,t);return void 0!==o?o:super.getStepParams(e,t)}if(e&&!t&&I[e]&&l){let t=super.getStepParams(e)||{},o=l.getStepParams(e)||{};for(let l of I[e])Object.prototype.hasOwnProperty.call(o,l)&&void 0!==o[l]&&(t[l]=o[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let o=this.subModels.grid,n=(e,t)=>{let l=I[e];if(!l||!o)return t;let n={};for(let[i,r]of Object.entries(t))l.has(i)?o.setStepParams(e,i,r):n[i]=r;return n};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(D(e,t)&&o?o.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=n(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,o]of Object.entries(e)){if("object"!=typeof o||null===o){t[l]=o;continue}let e=n(l,o);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,p.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,r.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=a.Form.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new P({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,o,n,i,a,s,u,c,p,m,h,f,g,v,y,_;if(!e)return!1;let b=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!b||!(null==(o=this.collection)||null==(l=o.getField)?void 0:l.call(o,b)))return!1;if((()=>{var e,t,l,o;let n=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],i=new Set;for(let e of n){let t=null==e||null==(o=e.getStepParams)||null==(l=o.call(e,"fieldSettings","init"))?void 0:l.fieldPath,n=null==t?void 0:t.toString().split(".")[0];n&&i.add(n)}return i})().has(b)){let l=null==(i=this.form)||null==(n=i.getFieldValue)?void 0:n.call(i,b);if(null==l||Array.isArray(l)&&0===l.length)return!1;let o=t.getFormValuesSnapshot(),c=!1;if(o&&"object"==typeof o){let t=(0,d.getValuesByPath)(o,e);if(void 0!==t){let l=e.replace(/\[\d+\]/g,"").split(".").filter(e=>!/^\d+$/.test(e)).join("."),o=null==(s=this.collection)||null==(a=s.getFieldByPath)?void 0:a.call(s,l),n=null==o?void 0:o.targetCollectionTitleFieldName,i=e=>!(!e||"object"!=typeof e||Array.isArray(e))&&(!n||void 0!==e[n]),r=null===t||(Array.isArray(t)?0===t.length||t.every(e=>null===e||i(e)):i(t));if(!(null==o||null==(u=o.isAssociationField)?void 0:u.call(o))||r)return!1;c=!0}}return(0,r.createAssociationSubpathResolver)(()=>this.collection,c?void 0:()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(m=this.context)||null==(p=m.resource)||null==(c=p.getMeta)?void 0:c.call(p,"currentFilterByTk"))??(null==(g=this.context)||null==(f=g.resource)||null==(h=f.getFilterByTk)?void 0:h.call(f))??(null==(_=this.collection)||null==(y=_.getFilterByTK)?void 0:y.call(_,null==(v=this.context)?void 0:v.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,o){return t.setFormValues(this,[{path:e,value:l}],o)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),this.userModifiedTopLevelFields=new Set,this._defaultCustomModelClasses={FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"},this.customModelClasses={}}}function O(e){var t,l,n,i;let{model:r,children:d,layoutProps:u={},initialValues:c,...p}=e,m=!!((null==r||null==(t=r.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),h=[p.className,m?L:"",m?R:""].filter(Boolean).join(" ");return(0,o.jsx)(a.Form,{form:r.form,initialValues:(null==(i=r.context)||null==(n=i.view)||null==(l=n.inputArgs)?void 0:l.formData)||r.context.record||c,...(0,s.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=r.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=r.markUserModifiedFields)||l.call(r,e);let o=r.formValueRuntime;o?o.handleFormValuesChange(e,t):(r.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),r.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:h||void 0,children:d})}let B=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),o=parseFloat(l.marginTop)||0,n=parseFloat(l.marginBottom)||0;return t.height+o+n},V=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},H=e=>{let{heightMode:t,containerRef:l,actionsRef:o,footerRef:n,deps:i=[]}=e,[r,a]=(0,u.useState)(),s=(0,u.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let r=Math.max(0,Math.floor(i-B((null==o?void 0:o.current)||null)-B((null==n?void 0:n.current)||null)));a(e=>e===r?e:r)},[t,l,o,n]);return(0,u.useLayoutEffect)(()=>{s()},[s,...i]),(0,u.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==o?void 0:o.current)||null,i=(null==n?void 0:n.current)||null,r=new ResizeObserver(()=>s());return r.observe(e),t&&r.observe(t),i&&r.observe(i),()=>r.disconnect()},[s,l,o,n,...i]),r},q=e=>{var t,l;let{model:n,gridModel:i,layoutProps:r,onFinish:a,grid:s,actions:d,footer:c,heightMode:p,height:m}=e,h=(0,u.useRef)(null),f=(0,u.useRef)(null),g=(0,u.useRef)(null),v="specifyValue"===p||"fullHeight"===p,y={paddingTop:null==(l=n.context)||null==(t=l.themeToken)?void 0:t.padding},_=(null==r?void 0:r.layout)==="horizontal"?V(null==r?void 0:r.labelWidth):void 0;_&&(y.marginInlineStart=_);let b=H({heightMode:p,containerRef:h,actionsRef:d?f:void 0,footerRef:c?g:void 0,deps:[m]});(0,u.useEffect)(()=>{var e;if(!i)return;let t=v?b:void 0;(null==(e=i.props)?void 0:e.height)!==t&&i.setProps({height:t})},[i,b,v]);let x=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,M=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,o.jsx)(O,{model:n,layoutProps:r,onFinish:a,style:x,children:(0,o.jsxs)("div",{ref:h,style:M,children:[s,d?(0,o.jsx)("div",{style:y,ref:f,children:d}):null,c?(0,o.jsx)("div",{ref:g,children:c}):null]})})};N.define({hide:!0}),N.registerFlow({key:"formModelSettings",title:(0,r.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,r.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,r.tExpr)("Field values"),beforeParamsSave(e){let t=(0,j.Fp)(e.model);Array.isArray(t)&&t.length&&(0,p.jI)(e.model)},afterParamsSave(e){var t,l,o,n,i,r;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(o=e.model)||null==(l=o.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(i=e.model)||null==(n=i.context)?void 0:n.resource,u=T(s,null==(r=e.model)?void 0:r.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),N.registerFlow({key:"eventSettings",title:(0,r.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),N.registerEvents({formValuesChange:{title:(0,r.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,r.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":c.H}},handler:c.b}});class $ extends N{}$.define({hide:!0})},3127(e,t,l){l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>o.S2});var o=l(3341);let n=["editItemSettings","formItemSettings"],i=(0,o.li)(n),r=(0,o.u4)(n);function a(e){return(0,o.TE)(e,i)}function s(e){return(0,o.Co)(e,i,r)}},4084(e,t,l){l.d(t,{submitHandler:()=>a});var o=l(504),n=l(3027),i=l(24);function r(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,m,h,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,1961)),_=v instanceof y;await (0,i.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,i.go)(null==e?void 0:e.model)});let b=v.form.getFieldsValue(!0),x=(0,i.xT)(b,v),M=await (0,n.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!M){null==(s=e.exit)||s.call(e);return}let w=(0,n.GO)(x,M);if(g instanceof o.SingleRecordResource){if(_){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=r(a?await a(w):await g.save(w,t.requestConfig));return _?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(m=v.formValueRuntime)||null==(p=m.resetAfterFormReset)||p.call(m),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof o.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let o=a?await a(w,l):await g.update(l,w,t.requestConfig);return null==(h=v.resetUserModifiedFields)||h.call(v),r(o)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},24(e,t,l){l.d(t,{D9:()=>g,go:()=>f,xT:()=>v});var o=l(7583),n=l(3728);function i(e,t){var l,o;let n=null==e||null==(o=e.context)||null==(l=o.blockModel)?void 0:l.uid,i=null==t?void 0:t.uid;return!!n&&!!i&&String(n)===String(i)}function r(e){var t,l;let o=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(o)&&o.length)return o;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),o=null==t?void 0:t.fieldPath;if("string"==typeof o&&o)return o}catch{}let n=null==e?void 0:e.fieldPath;if("string"==typeof n&&n)return n;let i="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,r=null==i?void 0:i.name;return"string"==typeof r&&r||Array.isArray(r)&&r.length?r:null}function a(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function s(e){var t;let l=r(e);return l?a((0,n.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function d(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let i=o.default.get(e,n);o.default.isPlainObject(i)&&0===Object.keys(i).length&&o.default.unset(e,n)}}function u(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function c(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],o=new Set;return u(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!i(t,e))return;let n=s(t);if(!n)return;let r=JSON.stringify(n);o.has(r)||(o.add(r),l.push(n))}),l}function p(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?a(e):null}function m(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function h(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let o=[],n=new Set;for(let e of l){let t=p(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);n.has(l)||(n.add(l),o.push(t))}if(!o.length)return null;let i=c(e);return i.length?o.filter(e=>!i.some(t=>m(t,e))):o}function f(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function g(e){let{form:t,blockModel:l,flowSettingsEnabled:o,skipValidator:n}=e;if(n||!t||"function"!=typeof t.validateFields)return;let i=o&&l?h(l):null;if(Array.isArray(i)){i.length&&await t.validateFields(i);return}await t.validateFields()}function v(e,t){if(!e||"object"!=typeof e)return e;let l=c(t);if(!l.length)return e;let n=o.default.cloneDeep(e);for(let e of l)o.default.unset(n,e),d(n,e);return n}},9413(e,t,l){l.d(t,{F:()=>n});var o=l(3526);function n(e,t){let l=(t,l,o)=>{var n,i,r;return!l||(null==e||null==(r=e.app)||null==(i=r.jsonLogic)||null==(n=i.apply)?void 0:n.call(i,{[l]:[t,o]}))};try{return(0,o.evaluateConditions)((0,o.removeInvalidFilterItems)(t),l)}catch{return!1}}},9613(e,t,l){l.d(t,{Dd:()=>s,G:()=>u,Wp:()=>c,x3:()=>d});var o=l(2314),n=l(504),i=l(7583),r=l(3728);function a(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||i.default.isPlainObject(e))}function s(e,t){if(t)for(let l of(0,r.ef)(e))t.deps.add(`fv:${l}`)}function d(e){let{valuesMirror:t,collector:l,basePath:n,getFormValuesSnapshot:r,getFormValueAtPath:u}=e,c=()=>n.length?i.default.get(t,n):t,p=c(),m=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},h=e=>d({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:r,getFormValueAtPath:u});return new Proxy(m,{get(e,d){if("toJSON"===d)return(l&&(l.wildcard=!0),0===n.length)?()=>r():()=>(0,o.toJS)(c());if("symbol"==typeof d){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[d]}let p=c();if(null==p)return;if("__raw"===d)return p;if("__proto__"===d||"prototype"===d||"constructor"===d){l&&(l.wildcard=!0);return}let m=Array.isArray(p),f=m&&("number"==typeof d&&Number.isInteger(d)||"string"==typeof d&&/^\d+$/.test(d));if(m&&!f){l&&(l.wildcard=!0);let e=p[d];return"function"==typeof e?e.bind(p):e}let g=[...n,f?Number(d):d];s(g,l);let v=p[d];if(void 0===v){let e=u(g);i.default.isEqual(e,v)||(i.default.set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:a(v)?h(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function u(e,t){try{let l=(0,n.extractUsedVariablePaths)(e)||{};for(let[e,o]of Object.entries(l)){let l=Array.isArray(o)?o:[];for(let o of l.length?l:[""]){if("formValues"===e){if(!o){t.wildcard=!0;continue}let e=(0,r.EA)(String(o)).filter(e=>"object"!=typeof e);s(e,t);continue}let l=o?`ctx:${e}:${String(o)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function c(e,t){if((0,n.isRunJSValue)(e))try{let l=(0,n.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,o]of Object.entries(l)){let l=Array.isArray(o)?o:[];for(let o of l.length?l:[""]){if("formValues"===e){if(!o){t.wildcard=!0;continue}let e=(0,r.EA)(String(o)).filter(e=>"object"!=typeof e);s(e,t);continue}let l=o?`ctx:${e}:${String(o)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},3728(e,t,l){function o(e){let t=[],l=0,o=e.length,n=()=>{let n=l;for(;l<o&&"."!==e[l]&&"["!==e[l];)l++;let i=e.slice(n,l);i&&t.push(i)};for(;l<o;){let i=e[l];if("."===i){l++;continue}if("["===i){let n=++l;for(;l<o&&"]"!==e[l];)l++;let i=e.slice(n,l);l++,/^\d+$/.test(i)?t.push(Number(i)):i&&t.push({placeholder:i});continue}n()}return t}function n(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,o]=e.split(":"),n=Number(o);!t||Number.isNaN(n)||l.push({name:t,index:n})}return l}function i(e,t){let l=Array.isArray(e)?[...e]:o(e),i=n(t),r=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=r[r.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<i.length&&i[a].name!==t;)a++;if(a>=i.length)return null;r.push(i[a].index),a++;continue}if(r.push(t),"string"==typeof t&&a<i.length&&i[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(r.push(i[a].index),a++)}}return r}function r(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return o(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let o of e)l.push(o),t.push(r(l));return t}l.d(t,{EA:()=>o,IJ:()=>i,Qc:()=>r,c1:()=>a,ef:()=>s})},1022(e,t,l){l.d(t,{Po:()=>i,ao:()=>r,li:()=>n});var o=l(7583);let n=20;function i(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!o.default.isPlainObject(e)&&0===Object.keys(e).length)}function r(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},3341(e,t,l){l.d(t,{Co:()=>h,PP:()=>i,S2:()=>m,TE:()=>p,li:()=>s,u4:()=>c});var o=l(7583);function n(){return{logic:"$and",items:[]}}function i(e,t,l){var o;let n=null==e||null==(o=e.getStepParams)?void 0:o.call(e,t,l);return!!n&&Object.prototype.hasOwnProperty.call(n,"value")}function r(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function a(e,t){var l,o;if(e)return null==(o=e.getStepParams)||null==(l=o.call(e,t,"initialValue"))?void 0:l.defaultValue}function s(e){return t=>{if(!t)return;let l=r(t);if(void 0!==l)return l;for(let l of e){let e=a(t,l);if(void 0!==e)return e}}}function d(e,t,l){var n,i,r;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],o.default.isEmpty(a)&&delete e.stepParams[t],null==(r=e.emitter)||null==(i=r.emit)||i.call(r,"onStepParamsChanged"))}function u(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let o=null==(l=e._options)?void 0:l.props;o&&Object.prototype.hasOwnProperty.call(o,"initialValue")&&delete o.initialValue}function c(e){return t=>{if(t)for(let l of(u(t),e))d(t,l,"initialValue")}}function p(e,t){var l,o,i,r,a;let s=null==e||null==(i=e.subModels)||null==(o=i.grid)||null==(l=o.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(r=a.call(e,"fieldSettings","init"))?void 0:r.fieldPath)||(null==e?void 0:e.fieldPath),o=l?String(l):"";if(!o)continue;let i=t(e);void 0!==i&&u.push({key:`legacy-default:${o}`,enable:!0,targetPath:o,mode:"default",condition:n(),value:i})}return u}function m(e,t){let l=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(!o.length)return l;let n=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){n.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&n.add(t)}}let i=new Set(l.map(e=>String(e.key??""))),r=[];for(let e of o){let t=e.targetPath?String(e.targetPath):"";if(!t||n.has(t))continue;let l={...e},o=String(l.key??"");o&&i.has(o)&&(l.key=`${o}:${t}`),r.push(l)}return r.length?[...l,...r]:l}function h(e,t,l){var o,n,i;let r=null==e||null==(i=e.subModels)||null==(n=i.grid)||null==(o=n.subModels)?void 0:o.items,a=Array.isArray(r)?r:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},8709(e,t,l){l.d(t,{$4:()=>a,r5:()=>r});var o=l(7404);let n="__index__";function i(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function r(e,t){let l=null==e?void 0:e[n];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let o=i(e,t);return null!=o?`pk:${o}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[n];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[n]:(0,o.uid)()}):e});return t?l:e}},4881(e,t,l){l.d(t,{m:()=>p});var o=l(1178),n=l(504),i=l(2793),r=l(1649),a=l(9829),s=l(6859),d=l(16);function u(e){let{value:t,onChange:l,onCompositionStart:n,onCompositionEnd:a,...s}=e,[d,u]=(0,r.useState)(()=>c(t));(0,r.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,o.jsx)(i.Input,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==n||n(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,o.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,o.jsx)(u,{...l,style:{verticalAlign:"top",...l.style}})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,o;null==(o=e.blockModel)||null==(l=o.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.customAlphabet)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,n.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,n.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,n.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let o=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(o||{},"enableScan")?!!(null==o?void 0:o.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,n.tExpr)("Input")}),n.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),n.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},7520(e,t,l){l.d(t,{o:()=>o,e:()=>s});class o{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){this.apiClient=e,this.loading=!1,this.listeners=new Set}}var n=l(504),i=l(6305),r=l(6553),a=l(1649);let s=()=>{var e,t;let l=(0,i.nm)().systemSettings,o=(0,n.useFlowEngine)({throwError:!1}),[,s]=(0,a.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,a.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>r.A[e]).map(e=>({label:r.A[e].label,value:e})),[d]);return(0,a.useEffect)(()=>(l.load(),l.subscribe(()=>{s(e=>e+1)})),[l]),(0,a.useEffect)(()=>{o&&o.context.defineProperty("locale",{get:e=>{var t,l,o;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(o=e.i18n)?void 0:o.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[o,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},8481(e,t,l){l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let o={view:"get"},n=e=>e?o[e]||e:null,i=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>n(e)).filter(Boolean)}},r=(e,t)=>{let l=n(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:o,unavailableActions:i}=e.options;return Array.isArray(o)?o.includes(l):!Array.isArray(i)||!i.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>r(e,t)),s=e=>{var t;let l=i(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let o=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof o)return null;try{let e=o.call({}),t=n(e);return t?[t]:null}catch{return null}},d=e=>i(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},7123(e,t,l){l.d(t,{l:()=>o});function o(e){let{blockLabel:t,dsName:l,dsCount:o,collectionTitle:n,sourceCollectionTitle:i,associationTitle:r}=e,a=o>1&&!!l,s=n;if(i&&r){let e=`${i} > ${r} (${n})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${n}`;return`
|
|
298
298
|
${t}:
|
|
299
299
|
${s}`}},7093(e,t,l){l.d(t,{SM:()=>s,M6:()=>p,Xi:()=>i,hH:()=>m,NY:()=>c,hO:()=>h,lr:()=>o.l,HZ:()=>d});var o=l(7123),n=l(504);async function i(e,t,l,o,i){let r=(null==i?void 0:i.includeSelf)??!0,a=(null==i?void 0:i.includeForks)??!0,s=new Set,d=[e],u=[],c=e=>{e&&"function"==typeof e.dispatchEvent&&u.push(e.dispatchEvent(t,l,o))};for(;d.length;){let t=d.pop();if(!t||s.has(t))continue;if(s.add(t),r||t!==e){var p;c(t),a&&(null==(p=t.forks)?void 0:p.size)&&t.forks.forEach(e=>{null!=e&&e.disposed||c(e)})}let l=t.subModels;if(l)for(let e of Object.values(l))if(Array.isArray(e))for(let t of e)t instanceof n.FlowModel&&d.push(t);else e instanceof n.FlowModel&&d.push(e)}await Promise.all(u)}var r=l(691),a=l(1649);let s=e=>{let t=e.dataLength||0,l=e.pageSize||10,o=e.current||1;return t<l||!e.hasNext?l*o:l*o+1},d=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,r.css)`
|
|
300
300
|
.ant-pagination-simple-pager {
|
|
@@ -847,7 +847,7 @@ if (!ctx.record) {
|
|
|
847
847
|
overflow: hidden;
|
|
848
848
|
text-overflow: ellipsis;
|
|
849
849
|
}
|
|
850
|
-
`;function uK(e){return e?{...e,display:"none"}:{display:"none"}}function uG(e){return(null==e?void 0:e.value)??"value"}function uW(e,t,l,o){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"record";if(o)return Array.isArray(e)?e.filter(e=>null!=e).map(e=>{if("value"===n)return l.get(e)??{[t]:e};let o=null==e?void 0:e[t];return l.get(o)??e}):[];if("value"===n&&("string"==typeof e||"number"==typeof e))return[l.get(e)??{[t]:e}].filter(Boolean);if(e&&"object"==typeof e){let o=e[t],n=l.get(o)??e;return n?[n]:[]}return[]}function uJ(e){let{fieldNames:t,value:l,multiple:o,allowMultiple:n,options:r,onChange:a,onDropdownVisibleChange:s,onPopupScroll:d,onSearch:u,disabled:c,dropdownStyle:p,loading:h=!1,valueMode:g="record",...v}=e,y=(0,f.useFlowModelContext)().t,_=!!(o&&n),x=uG(t),M=uH(r,l,_),w=(0,i.useMemo)(()=>{let e=new Map;for(let t of M)e.set(null==t?void 0:t[x],t);return e},[M,x]),[S,k]=(0,i.useState)(!1),[F,C]=(0,i.useState)(""),A=(0,i.useMemo)(()=>uW(l,x,w,_,g),[l,x,w,_,g]),[P,T]=(0,i.useState)(()=>A),j=(0,i.useRef)(S);(0,i.useEffect)(()=>{S&&!j.current&&T(A),j.current=S},[A,S]),(0,i.useEffect)(()=>{S||C("")},[S]);let I=(0,i.useMemo)(()=>{if(!P.length)return[];let e=[];for(let t of P){let l=null==t?void 0:t[x];null!=l&&e.push(l)}return e},[P,x]),L=(0,i.useCallback)(()=>{c||(k(!0),null==s||s(!0))},[c,s]),R=(0,i.useCallback)(()=>{k(!1),null==s||s(!1)},[s]),D=(0,i.useCallback)(()=>{if("value"===g){if(_)a(P.map(e=>null==e?void 0:e[x]).filter(e=>null!=e));else{var e;a(null==P||null==(e=P[0])?void 0:e[x])}R();return}a(P),R()},[R,_,a,P,x,g]),E=(0,i.useCallback)(e=>{if(_)return void T(t=>{let l=new Map;for(let e of t)l.set(null==e?void 0:e[x],e);let o=[];for(let t of e){let e=w.get(t)??l.get(t);e&&o.push(e)}return o});let t=e[0];if(void 0===t){a(void 0),R();return}let l=w.get(t);l&&("value"===g?a(null==l?void 0:l[x]):a(l)),R()},[R,_,a,w,x,g]),Y=(0,i.useCallback)(e=>{if(!d)return;let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-20||d({target:t})},[d]),N=(0,i.useCallback)(e=>{C(e),null==u||u(e)},[u]),O=(0,i.useCallback)(e=>{c||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),L())},[c,L]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(b.Select,{...v,dropdownStyle:uK(p),fieldNames:t,options:M,value:uV(l,t,_,g,M),mode:_?"multiple":void 0,open:!1,onClick:L,onKeyDown:O,onChange:(e,t)=>{"value"===g?Array.isArray(t)?a(t.map(e=>(null==e?void 0:e[x])??(null==e?void 0:e.value)).filter(e=>void 0!==e)):a((null==t?void 0:t[x])??(null==t?void 0:t.value)):a(t)},loading:h,optionRender:e=>{let{data:l}=e;return(0,m.jsx)(uB,{option:l,fieldNames:t})},labelRender:e=>(0,m.jsx)("div",{className:uU,children:e.label}),showSearch:!1}),(0,m.jsxs)(__rspack_external_antd_mobile_0b674875.Popup,{visible:S,onMaskClick:R,destroyOnClose:!0,children:[(0,m.jsx)("div",{style:{margin:"10px"},children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.SearchBar,{placeholder:y("search"),value:F,onChange:N,onCancel:R,cancelText:y("Cancel"),showCancelButton:!0})}),(0,m.jsxs)("div",{style:uz(_),onScroll:Y,children:[(0,m.jsx)(__rspack_external_antd_mobile_0b674875.CheckList,{multiple:_,value:I,onChange:E,children:M.map(e=>{let l=null==e?void 0:e[x];return(0,m.jsx)(__rspack_external_antd_mobile_0b674875.CheckList.Item,{value:l,children:(0,m.jsx)(uB,{option:e,fieldNames:t})},l)})}),h&&(0,m.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"12px 0"},children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.SpinLoading,{color:"primary"})})]}),_&&(0,m.jsx)("div",{style:u$,children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.Button,{block:!0,color:"primary",onClick:D,style:{marginTop:"16px"},children:y("Confirm")})})]})]})}function uX(e,t){let l=e;for(;l;){var o;let e=null==l||null==(o=l.constructor)?void 0:o.name;if(e&&t.includes(e))return!0;l=null==l?void 0:l.parent}return!1}function uQ(e){let t=null==e?void 0:e.parent;if((null==t?void 0:t.use)==="QuickEditFormModel")return t.viewContainer}function uZ(e,t){let l=uQ(e);if(null==l?void 0:l.update){if(t)return void l.update({preventClose:!0});setTimeout(()=>{var e;null==(e=l.update)||e.call(l,{preventClose:!1})},0)}}function u0(e){let{options:t}=e,l=(0,f.useFlowViewContext)(),{data:o,loading:n}=(0,nB.useRequest)(async()=>await l.engine.loadOrCreateModel(t,{delegateToParent:!1,delegate:l,skipSave:!l.flowSettingsEnabled}),{refreshDeps:[l,t]});return!n&&(null==o?void 0:o.uid)?(0,m.jsx)(f.FlowModelRenderer,{model:o,fallback:(0,m.jsx)(nV,{style:{margin:16}})}):(0,m.jsx)(nV,{style:{margin:16}})}function u1(e){let{model:t,toOne:l=!1}=e,o=(0,f.useFlowContext)();o.defineProperty("flowSettingsEnabled",{get:()=>t.context.flowSettingsEnabled,cache:!1});let{Header:n,type:i}=o.view;return t._closeView=o.view.close,(0,m.jsxs)("div",{children:[(0,m.jsx)(n,{title:"dialog"===i?(0,m.jsx)("div",{style:{padding:`${o.themeToken.paddingLG}px ${o.themeToken.paddingLG}px 0`,marginBottom:-o.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"},children:o.t("Create record")}):o.t("Create record")}),(0,m.jsx)(u0,{options:{parentId:o.view.inputArgs.parentId,subKey:"grid",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel"}})]})}let u2=(e,t)=>{var l,o;let n=null==(l=e.context.collectionField)?void 0:l.collection,r=null==n?void 0:n.dataSource,a=e.context.t,s=(null==(o=e.context.collectionField)?void 0:o.name)||e.fieldPath,d=(0,i.useMemo)(()=>{let e=a((null==r?void 0:r.displayName)||(null==r?void 0:r.key)||""),t=e?`${e} > `:"",l=n?`${a(n.title)||n.name||n.tableName} > `:"";return`${t}${l}${s}`},[n,null==r?void 0:r.displayName,null==r?void 0:r.key,s,a]);return t?null:a('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for field "{{name}}"',{name:d,actionName:"Update"}).replaceAll(">",">")},u5=(0,A.css)`
|
|
850
|
+
`;function uK(e){return e?{...e,display:"none"}:{display:"none"}}function uG(e){return(null==e?void 0:e.value)??"value"}function uW(e,t,l,o){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"record";if(o)return Array.isArray(e)?e.filter(e=>null!=e).map(e=>{if("value"===n)return l.get(e)??{[t]:e};let o=null==e?void 0:e[t];return l.get(o)??e}):[];if("value"===n&&("string"==typeof e||"number"==typeof e))return[l.get(e)??{[t]:e}].filter(Boolean);if(e&&"object"==typeof e){let o=e[t],n=l.get(o)??e;return n?[n]:[]}return[]}function uJ(e){let{fieldNames:t,value:l,multiple:o,allowMultiple:n,options:r,onChange:a,onDropdownVisibleChange:s,onPopupScroll:d,onSearch:u,disabled:c,dropdownStyle:p,loading:h=!1,valueMode:g="record",...v}=e,y=(0,f.useFlowModelContext)().t,_=!!(o&&n),x=uG(t),M=uH(r,l,_),w=(0,i.useMemo)(()=>{let e=new Map;for(let t of M)e.set(null==t?void 0:t[x],t);return e},[M,x]),[S,k]=(0,i.useState)(!1),[F,C]=(0,i.useState)(""),A=(0,i.useMemo)(()=>uW(l,x,w,_,g),[l,x,w,_,g]),[P,T]=(0,i.useState)(()=>A),j=(0,i.useRef)(S);(0,i.useEffect)(()=>{S&&!j.current&&T(A),j.current=S},[A,S]),(0,i.useEffect)(()=>{S||C("")},[S]);let I=(0,i.useMemo)(()=>{if(!P.length)return[];let e=[];for(let t of P){let l=null==t?void 0:t[x];null!=l&&e.push(l)}return e},[P,x]),L=(0,i.useCallback)(()=>{c||(k(!0),null==s||s(!0))},[c,s]),R=(0,i.useCallback)(()=>{k(!1),null==s||s(!1)},[s]),D=(0,i.useCallback)(()=>{if("value"===g){if(_)a(P.map(e=>null==e?void 0:e[x]).filter(e=>null!=e));else{var e;a(null==P||null==(e=P[0])?void 0:e[x])}R();return}a(P),R()},[R,_,a,P,x,g]),E=(0,i.useCallback)(e=>{if(_)return void T(t=>{let l=new Map;for(let e of t)l.set(null==e?void 0:e[x],e);let o=[];for(let t of e){let e=w.get(t)??l.get(t);e&&o.push(e)}return o});let t=e[0];if(void 0===t){a(void 0),R();return}let l=w.get(t);l&&("value"===g?a(null==l?void 0:l[x]):a(l)),R()},[R,_,a,w,x,g]),Y=(0,i.useCallback)(e=>{if(!d)return;let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-20||d({target:t})},[d]),N=(0,i.useCallback)(e=>{C(e),null==u||u(e)},[u]),O=(0,i.useCallback)(e=>{c||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),L())},[c,L]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(b.Select,{...v,disabled:c,dropdownStyle:uK(p),fieldNames:t,options:M,value:uV(l,t,_,g,M),mode:_?"multiple":void 0,open:!1,onClick:L,onKeyDown:O,onChange:(e,t)=>{"value"===g?Array.isArray(t)?a(t.map(e=>(null==e?void 0:e[x])??(null==e?void 0:e.value)).filter(e=>void 0!==e)):a((null==t?void 0:t[x])??(null==t?void 0:t.value)):a(t)},loading:h,optionRender:e=>{let{data:l}=e;return(0,m.jsx)(uB,{option:l,fieldNames:t})},labelRender:e=>(0,m.jsx)("div",{className:uU,children:e.label}),showSearch:!1}),(0,m.jsxs)(__rspack_external_antd_mobile_0b674875.Popup,{visible:S,onMaskClick:R,destroyOnClose:!0,children:[(0,m.jsx)("div",{style:{margin:"10px"},children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.SearchBar,{placeholder:y("search"),value:F,onChange:N,onCancel:R,cancelText:y("Cancel"),showCancelButton:!0})}),(0,m.jsxs)("div",{style:uz(_),onScroll:Y,children:[(0,m.jsx)(__rspack_external_antd_mobile_0b674875.CheckList,{multiple:_,value:I,onChange:E,children:M.map(e=>{let l=null==e?void 0:e[x];return(0,m.jsx)(__rspack_external_antd_mobile_0b674875.CheckList.Item,{value:l,children:(0,m.jsx)(uB,{option:e,fieldNames:t})},l)})}),h&&(0,m.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"12px 0"},children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.SpinLoading,{color:"primary"})})]}),_&&(0,m.jsx)("div",{style:u$,children:(0,m.jsx)(__rspack_external_antd_mobile_0b674875.Button,{block:!0,color:"primary",onClick:D,style:{marginTop:"16px"},children:y("Confirm")})})]})]})}function uX(e,t){let l=e;for(;l;){var o;let e=null==l||null==(o=l.constructor)?void 0:o.name;if(e&&t.includes(e))return!0;l=null==l?void 0:l.parent}return!1}function uQ(e){let t=null==e?void 0:e.parent;if((null==t?void 0:t.use)==="QuickEditFormModel")return t.viewContainer}function uZ(e,t){let l=uQ(e);if(null==l?void 0:l.update){if(t)return void l.update({preventClose:!0});setTimeout(()=>{var e;null==(e=l.update)||e.call(l,{preventClose:!1})},0)}}function u0(e){let{options:t}=e,l=(0,f.useFlowViewContext)(),{data:o,loading:n}=(0,nB.useRequest)(async()=>await l.engine.loadOrCreateModel(t,{delegateToParent:!1,delegate:l,skipSave:!l.flowSettingsEnabled}),{refreshDeps:[l,t]});return!n&&(null==o?void 0:o.uid)?(0,m.jsx)(f.FlowModelRenderer,{model:o,fallback:(0,m.jsx)(nV,{style:{margin:16}})}):(0,m.jsx)(nV,{style:{margin:16}})}function u1(e){let{model:t,toOne:l=!1}=e,o=(0,f.useFlowContext)();o.defineProperty("flowSettingsEnabled",{get:()=>t.context.flowSettingsEnabled,cache:!1});let{Header:n,type:i}=o.view;return t._closeView=o.view.close,(0,m.jsxs)("div",{children:[(0,m.jsx)(n,{title:"dialog"===i?(0,m.jsx)("div",{style:{padding:`${o.themeToken.paddingLG}px ${o.themeToken.paddingLG}px 0`,marginBottom:-o.themeToken.marginSM,backgroundColor:"var(--colorBgLayout)"},children:o.t("Create record")}):o.t("Create record")}),(0,m.jsx)(u0,{options:{parentId:o.view.inputArgs.parentId,subKey:"grid",async:!0,delegateToParent:!1,subType:"object",use:"BlockGridModel"}})]})}let u2=(e,t)=>{var l,o;let n=null==(l=e.context.collectionField)?void 0:l.collection,r=null==n?void 0:n.dataSource,a=e.context.t,s=(null==(o=e.context.collectionField)?void 0:o.name)||e.fieldPath,d=(0,i.useMemo)(()=>{let e=a((null==r?void 0:r.displayName)||(null==r?void 0:r.key)||""),t=e?`${e} > `:"",l=n?`${a(n.title)||n.name||n.tableName} > `:"";return`${t}${l}${s}`},[n,null==r?void 0:r.displayName,null==r?void 0:r.key,s,a]);return t?null:a('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for field "{{name}}"',{name:d,actionName:"Update"}).replaceAll(">",">")},u5=(0,A.css)`
|
|
851
851
|
min-width: 0;
|
|
852
852
|
|
|
853
853
|
.ant-select-selector {
|