"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2612,4727],{64727:function(l,n,e){e.r(n),e.d(n,{JSColumnRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),a=e(12444),s=e.n(a),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(67946),r=function(b){c()(o,b);var p=u()(o);function o(){return s()(this,o),p.apply(this,arguments)}return _()(o)}(m.Uo);r.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)`"}}),r.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"})},82612:function(l,n,e){e.r(n);var t=e(64727),_={contexts:[t.JSColumnRunJSContext],prefix:"sn-col-open-dialog",label:"Cell dialog with row data",description:"Render a button in cell to open dialog via ctx.openView with current row context",locales:{"zh-CN":{label:"\u5355\u5143\u683C\u5BF9\u8BDD\u6846\uFF08\u663E\u793A\u884C\u6570\u636E\uFF09",description:"\u5728\u5355\u5143\u683C\u6E32\u67D3\u6309\u94AE\uFF0C\u70B9\u51FB\u540E\u901A\u8FC7 ctx.openView \u6253\u5F00\u5F39\u7A97\u5E76\u4F20\u5165\u5F53\u524D\u884C\u4E0A\u4E0B\u6587"}},content:`
// Render a button inside the cell
const button = document.createElement('button');
button.className = 'nb-cell-btn';
button.style.padding = '4px 8px';
button.textContent = ctx.t('View');
const popupUid = ctx.model.uid + '-1'; // popupUid should be stable and better bound to ctx.model.uid
const primaryKey = ctx.collection?.primaryKey || 'id';

button?.addEventListener('click', async () => {
  await ctx.openView(popupUid, {
    mode: 'dialog',
    title: ctx.t('Row detail'),
    params: {
      filterByTk: ctx.record?.[primaryKey],
      record: ctx.record,
    },
  });
});

ctx.render(button);
`};n.default=_}}]);
