"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6747,95,113,7087],{67087:function(f,o,e){e.r(o),e.d(o,{FormJSFieldItemRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),l=e(12444),a=e.n(l),s=e(31996),d=e.n(s),u=e(26037),i=e.n(u),m=e(67946),_=function(c){d()(n,c);var b=i()(n);function n(){return a()(this,n),b.apply(this,arguments)}return r()(n)}(m.Uo);_.define({label:"FormJSFieldItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form field rendering.
      Supports innerHTML, append, and other DOM manipulation methods.`,value:"Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).",record:`Current record data object (read-only).
      Contains all field values of the parent record.`,formValues:{description:"Snapshot of current form values (object). Available in form contexts (CreateForm/EditForm).",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
      Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
      Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
      Example: ctx.setProps(fieldModel, { value: "new value" })`}}),_.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",value:"\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",formValues:{description:"\u5F53\u524D\u8868\u5355\u503C\u5FEB\u7167\uFF08\u5BF9\u8C61\uFF09\u3002\u4EC5\u8868\u5355\u76F8\u5173\u4E0A\u4E0B\u6587\u53EF\u7528\uFF08Create/Edit Form\uFF09\u3002",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",setProps:"\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"}},{locale:"zh-CN"})},10095:function(f,o,e){e.r(o),e.d(o,{JSBlockRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),l=e(12444),a=e.n(l),s=e(31996),d=e.n(s),u=e(26037),i=e.n(u),m=e(67946),_=function(c){d()(n,c);var b=i()(n);function n(){return a()(this,n),b.apply(this,arguments)}return r()(n)}(m.Uo);_.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
      Supports innerHTML, append, and other DOM manipulation methods.
      Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
      Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
      Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
      Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import an ESM module by URL: `const mod = await ctx.importAsync(url)`.\nNote: if the module has only a default export, ctx.importAsync returns that default value directly (no `.default`)."}}),_.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`\u3002\n\u6CE8\u610F\uFF1A\u5F53\u6A21\u5757\u53EA\u6709 default \u4E00\u4E2A\u5BFC\u51FA\u65F6\uFF0Cctx.importAsync \u4F1A\u76F4\u63A5\u8FD4\u56DE default \u503C\uFF08\u65E0\u9700\u518D\u5199 `.default`\uFF09\u3002"}},{locale:"zh-CN"})},40113:function(f,o,e){e.r(o),e.d(o,{JSFieldRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),l=e(12444),a=e.n(l),s=e(31996),d=e.n(s),u=e(26037),i=e.n(u),m=e(67946),_=function(c){d()(n,c);var b=i()(n);function n(){return a()(this,n),b.apply(this,arguments)}return r()(n)}(m.Uo);_.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
      Supports innerHTML, append, and other DOM manipulation methods.`,value:`Current value of the field (read-only).
      Contains the data value stored in this field.`,record:`Current record data object (read-only).
      Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
      Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
      Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
      Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),_.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",value:"\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF0C\u5305\u542B\u7236\u8BB0\u5F55\u5168\u90E8\u5B57\u6BB5\u503C\uFF09",collection:"\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF0C\u63CF\u8FF0\u5B57\u6BB5\u6240\u5C5E\u96C6\u5408\u7684 Schema\uFF09"},methods:{onRefReady:"\u5728\u5B57\u6BB5\u5BB9\u5668 DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)\uFF1B\u793A\u4F8B\uFF1Actx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"}},{locale:"zh-CN"})},86747:function(f,o,e){e.r(o);var t=e(10095),r=e(40113),l=e(67087),a={contexts:[t.JSBlockRunJSContext,r.JSFieldRunJSContext,l.FormJSFieldItemRunJSContext],prefix:"sn-query-selector",label:"Query selector",description:"Find a child element inside rendered DOM using querySelector",locales:{"zh-CN":{label:"\u67E5\u8BE2\u5B50\u5143\u7D20",description:"\u4F7F\u7528 querySelector \u5728\u6E32\u67D3\u7684 DOM \u5185\u67E5\u627E\u5B50\u5143\u7D20"}},content:`
const wrapper = document.createElement('div');
wrapper.innerHTML = '<div class="child-class"></div>';

ctx.render(wrapper);

const child = wrapper.querySelector('.child-class');
if (child) {
  child.textContent = ctx.t('Hello from querySelector');
}
`};o.default=a}}]);
