"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[9844,113,4727,7087],{67087:function(p,o,e){e.r(o),e.d(o,{FormJSFieldItemRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),s=e(12444),l=e.n(s),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(67946),_=function(c){u()(n,c);var b=i()(n);function n(){return l()(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"})},64727:function(p,o,e){e.r(o),e.d(o,{JSColumnRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),s=e(12444),l=e.n(s),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(67946),_=function(c){u()(n,c);var b=i()(n);function n(){return l()(this,n),b.apply(this,arguments)}return r()(n)}(m.Uo);_.define({label:"JSColumn RunJS context",properties:{element:"ElementProxy instance providing a safe DOM container for the current table cell. Supports innerHTML/append and basic DOM APIs.",record:"Current row record object (read-only).",recordIndex:"Index of the current row in the page (0-based).",collection:"Collection definition metadata (read-only).",viewer:"View controller providing dialog/drawer/embed helpers for interactions initiated from the cell (e.g., open details).",React:"React library",antd:"Ant Design library"},methods:{onRefReady:"Wait for cell DOM element to be ready before executing callback. Parameters: (ref, callback, timeout?) => void",requireAsync:"Load external library by URL: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module by URL: `const mod = await ctx.importAsync(url)`"}}),_.define({label:"JS \u5217 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",record:"\u5F53\u524D\u884C\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF09",recordIndex:"\u5F53\u524D\u884C\u7D22\u5F15\uFF08\u4ECE 0 \u5F00\u59CB\uFF09",collection:"\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF09",viewer:"\u89C6\u56FE\u63A7\u5236\u5668\uFF0C\u53EF\u7528\u4E8E\u5728\u5355\u5143\u683C\u4E2D\u89E6\u53D1\u62BD\u5C49/\u5BF9\u8BDD\u6846/\u5185\u5D4C\u7B49\u4EA4\u4E92",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u7B49\u5F85\u5355\u5143\u683C DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)",requireAsync:"\u6309 URL \u5F02\u6B65\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)`"}},{locale:"zh-CN"})},40113:function(p,o,e){e.r(o),e.d(o,{JSFieldRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),s=e(12444),l=e.n(s),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(67946),_=function(c){u()(n,c);var b=i()(n);function n(){return l()(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"})},69844:function(p,o,e){e.r(o);var t=e(40113),r=e(67087),s=e(64727),l={contexts:[t.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext,s.JSColumnRunJSContext],scenes:["detail","table"],prefix:"sn-jsf-status-tag",label:"Display status field as colored tag",description:"Display status values using colored tags",locales:{"zh-CN":{label:"\u5C06\u72B6\u6001\u5B57\u6BB5\u663E\u793A\u4E3A\u5F69\u8272\u6807\u7B7E",description:"\u6839\u636E\u72B6\u6001\u503C\u663E\u793A\u4E0D\u540C\u989C\u8272\u7684\u6807\u7B7E"}},content:`
const statusColors = {
  active: 'green',
  pending: 'orange',
  inactive: 'gray',
  error: 'red',
  success: 'blue',
};

const status = String(ctx.value || 'unknown');
const color = statusColors[status] || 'default';

ctx.render(\`
  <span style="
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background-color: var(--\${color}-1, #f0f0f0);
    color: var(--\${color}-6, #333);
    border: 1px solid var(--\${color}-3, #d9d9d9);
  ">
    \${ctx.t(status)}
  </span>
\`);
`};o.default=l}}]);
