@nocobase/app 2.0.0-beta.9 → 2.0.1

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.
Files changed (98) hide show
  1. package/client/.umirc.ts +4 -0
  2. package/dist/client/{113.736e29a0.async.js → 113.470c21ad.async.js} +1 -1
  3. package/dist/client/1161.1a2c10e3.async.js +40 -0
  4. package/dist/client/1442.fd65d046.async.js +5 -0
  5. package/dist/client/{1595.9f992743.async.js → 1595.6281d837.async.js} +3 -3
  6. package/dist/client/{1758.eeeacf43.async.js → 1758.404cac6d.async.js} +3 -3
  7. package/dist/client/{1883.6ee256ab.async.js → 1883.7bf62549.async.js} +4 -4
  8. package/dist/client/1905.2e6345d8.async.js +12 -0
  9. package/dist/client/{2042.feb4b9ac.async.js → 2042.7da1cbfb.async.js} +1 -1
  10. package/dist/client/{2097.919e4d8a.async.js → 2097.469d41dd.async.js} +2 -2
  11. package/dist/client/{2380.900b7a22.async.js → 2380.ce39cb9d.async.js} +12 -9
  12. package/dist/client/2612.99f32922.async.js +22 -0
  13. package/dist/client/{2775.455c3402.async.js → 2775.364c188c.async.js} +8 -8
  14. package/dist/client/2936.745e500f.async.js +28 -0
  15. package/dist/client/3357.0dc001fc.async.js +28 -0
  16. package/dist/client/341.01fc2262.async.js +28 -0
  17. package/dist/client/{3451.a9466e73.async.js → 3451.29052272.async.js} +6 -6
  18. package/dist/client/3781.16f1bb74.async.js +1 -0
  19. package/dist/client/4279.f53ade52.async.js +1 -0
  20. package/dist/client/{4327.68c0f17b.async.js → 4327.d9c9bdf4.async.js} +5 -5
  21. package/dist/client/{4351.efe05af2.async.js → 4351.40ef71f0.async.js} +5 -5
  22. package/dist/client/{4356.d61392c6.async.js → 4356.a3863dfa.async.js} +2 -2
  23. package/dist/client/4727.09926a61.async.js +1 -0
  24. package/dist/client/{4750.ce3051f3.async.js → 4750.0863f7b1.async.js} +2 -2
  25. package/dist/client/{4926.58238954.async.js → 4926.f49ba56d.async.js} +6 -6
  26. package/dist/client/501.e8db2401.async.js +1 -0
  27. package/dist/client/{5013.b14730ba.async.js → 5013.eaaaceb4.async.js} +1 -1
  28. package/dist/client/5501.7bed1ac8.async.js +23 -0
  29. package/dist/client/5662.3071d144.async.js +26 -0
  30. package/dist/client/6021.b3ab345b.async.js +22 -0
  31. package/dist/client/{645.ab5af584.async.js → 645.b70364b3.async.js} +3 -3
  32. package/dist/client/{6474.49632e37.async.js → 6474.8e54befa.async.js} +1 -1
  33. package/dist/client/6534.87203710.async.js +33 -0
  34. package/dist/client/{6747.de538558.async.js → 6747.1009bdb8.async.js} +12 -7
  35. package/dist/client/{689.4de33d65.async.js → 689.4dc252d6.async.js} +1 -1
  36. package/dist/client/{6920.497d7e80.async.js → 6920.d29cfa84.async.js} +5 -5
  37. package/dist/client/6998.e875a954.async.js +62 -0
  38. package/dist/client/{703.7ad807b0.async.js → 703.8c09e144.async.js} +3 -3
  39. package/dist/client/7087.e5b68989.async.js +6 -0
  40. package/dist/client/{7483.546ddcb6.async.js → 7483.c3bd056f.async.js} +4 -4
  41. package/dist/client/7534.1a42bafc.async.js +36 -0
  42. package/dist/client/{7764.a3ae7727.async.js → 7764.f7b626cb.async.js} +2 -2
  43. package/dist/client/816.4e92dc2c.async.js +1 -0
  44. package/dist/client/{8183.4c6f7e21.async.js → 8183.5418c6c8.async.js} +1 -1
  45. package/dist/client/{8408.c0ef773c.async.js → 8408.455572b7.async.js} +5 -6
  46. package/dist/client/{8805.819c4f44.async.js → 8805.00cfa044.async.js} +6 -6
  47. package/dist/client/{9042.3d21f631.async.js → 9042.9568dd16.async.js} +7 -7
  48. package/dist/client/{908.0e8c8a54.async.js → 908.4b088a69.async.js} +2 -3
  49. package/dist/client/{9317.fe6ffa9a.async.js → 9317.7d0009d1.async.js} +2 -2
  50. package/dist/client/935.63a37ee3.async.js +27 -0
  51. package/dist/client/{95.24aa76c4.async.js → 95.cf18a56e.async.js} +2 -2
  52. package/dist/client/{9547.a442df93.async.js → 9547.a9f2ea1d.async.js} +23 -6
  53. package/dist/client/{9801.34b13a74.async.js → 9801.dacad822.async.js} +1 -1
  54. package/dist/client/9844.b905f4ce.async.js +37 -0
  55. package/dist/client/index.html +3 -1
  56. package/dist/client/index.html.tpl +3 -1
  57. package/dist/client/{npm._at_ant-design.3d565a45.async.js → npm._at_ant-design.4fb666c7.async.js} +3 -3
  58. package/dist/client/npm._at_budibase.2d91cea2.async.js +36 -0
  59. package/dist/client/{npm._at_codemirror.23366286.async.js → npm._at_codemirror.aa828743.async.js} +10 -10
  60. package/dist/client/{npm.antd.601f2259.async.js → npm.antd.d7898d85.async.js} +13 -13
  61. package/dist/client/{npm.dagre-d3-es.5506d747.async.js → npm.dagre-d3-es.a13ce21a.async.js} +1 -1
  62. package/dist/client/{npm.highlight.js.5db864c8.async.js → npm.highlight.js.763ebb2d.async.js} +2 -2
  63. package/dist/client/{npm.lodash-es.d3d83c5d.async.js → npm.lodash-es.9fd92a41.async.js} +1 -1
  64. package/dist/client/npm.mathjs.7874451c.async.js +53 -0
  65. package/dist/client/npm.mermaid.952e77a0.async.js +1556 -0
  66. package/dist/client/{npm.rc-picker.baba6981.async.js → npm.rc-picker.95a28587.async.js} +1 -1
  67. package/dist/client/{npm.sanitize-html.506a0a55.async.js → npm.sanitize-html.2df959dd.async.js} +14 -14
  68. package/dist/client/{npm.slate-react.ef6881ab.async.js → npm.slate-react.f9b7bba3.async.js} +1 -1
  69. package/dist/client/npm.slate.6a5d16e1.async.js +1 -0
  70. package/dist/client/npm.typed-function.9df0469b.async.js +1 -0
  71. package/dist/client/p__index.f960ebe0.async.js +2697 -0
  72. package/dist/client/{umi.67dbd627.js → umi.0259ebb2.js} +2 -2
  73. package/package.json +6 -6
  74. package/dist/client/1161.0b3b5766.async.js +0 -40
  75. package/dist/client/1442.be509f94.async.js +0 -5
  76. package/dist/client/1905.ff0793ff.async.js +0 -12
  77. package/dist/client/2612.0865e67e.async.js +0 -19
  78. package/dist/client/2936.902710e4.async.js +0 -28
  79. package/dist/client/3357.be95167c.async.js +0 -28
  80. package/dist/client/341.fba65e23.async.js +0 -28
  81. package/dist/client/3885.fd54a10c.async.js +0 -50
  82. package/dist/client/4727.0f6df8fb.async.js +0 -1
  83. package/dist/client/501.72b99d17.async.js +0 -1
  84. package/dist/client/5501.22d50b3a.async.js +0 -23
  85. package/dist/client/5662.8c643e63.async.js +0 -26
  86. package/dist/client/6021.cdefa0d3.async.js +0 -22
  87. package/dist/client/6534.6ea6468b.async.js +0 -33
  88. package/dist/client/7087.5646e199.async.js +0 -6
  89. package/dist/client/7534.0d69e071.async.js +0 -34
  90. package/dist/client/816.b71d5e67.async.js +0 -1
  91. package/dist/client/935.97d45ffa.async.js +0 -27
  92. package/dist/client/9844.6f484975.async.js +0 -37
  93. package/dist/client/npm._at_budibase.b1200847.async.js +0 -36
  94. package/dist/client/npm.mathjs.fd97f3b7.async.js +0 -52
  95. package/dist/client/npm.mermaid.91e7e45d.async.js +0 -1556
  96. package/dist/client/npm.slate.44c32547.async.js +0 -1
  97. package/dist/client/npm.uuid.15e7bb90.async.js +0 -1
  98. package/dist/client/p__index.7e8edd31.async.js +0 -2517
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4727],{64727:function(h,n,e){e.r(n),e.d(n,{JSColumnRunJSContext:function(){return o}});var r=e(72004),t=e.n(r),s=e(12444),l=e.n(s),a=e(31996),u=e.n(a),i=e(26037),d=e.n(i),m=e(67946),o=function(c){u()(_,c);var b=d()(_);function _(){return l()(this,_),b.apply(this,arguments)}return t()(_)}(m.Uo);o.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)`"}}),o.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"})}}]);
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4750,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return _}});var o=e(72004),r=e.n(o),a=e(12444),l=e.n(a),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(1772),_=function(b){c()(t,b);var p=u()(t);function t(){return l()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);_.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4750,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),r=e.n(o),_=e(12444),l=e.n(_),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(67946),a=function(b){c()(t,b);var p=u()(t);function t(){return l()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);a.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.
3
3
  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).
4
4
  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.
5
5
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
6
- Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),_.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)`"}},{locale:"zh-CN"})},24750:function(s,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-info-card",label:"Render record info card",description:"Display current record information in an Ant Design card",locales:{"zh-CN":{label:"\u6E32\u67D3\u8BB0\u5F55\u4FE1\u606F\u5361\u7247",description:"\u4F7F\u7528 Ant Design \u5361\u7247\u663E\u793A\u5F53\u524D\u8BB0\u5F55\u7684\u5173\u952E\u4FE1\u606F"}},content:`
6
+ 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`)."}}),a.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"})},24750:function(s,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-info-card",label:"Render record info card",description:"Display current record information in an Ant Design card",locales:{"zh-CN":{label:"\u6E32\u67D3\u8BB0\u5F55\u4FE1\u606F\u5361\u7247",description:"\u4F7F\u7528 Ant Design \u5361\u7247\u663E\u793A\u5F53\u524D\u8BB0\u5F55\u7684\u5173\u952E\u4FE1\u606F"}},content:`
7
7
  const { Card, Descriptions, Tag } = ctx.libs.antd;
8
8
 
9
9
  if (!ctx.record) {
@@ -1,17 +1,17 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4926,113,7087],{67087:function(f,o,e){e.r(o),e.d(o,{FormJSFieldItemRunJSContext:function(){return _}});var l=e(72004),r=e.n(l),s=e(12444),t=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(1772),_=function(c){d()(n,c);var b=i()(n);function n(){return t()(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.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4926,113,7087],{67087:function(f,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return _}});var l=e(72004),r=e.n(l),s=e(12444),t=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(67946),_=function(c){d()(o,c);var b=i()(o);function o(){return t()(this,o),b.apply(this,arguments)}return r()(o)}(m.Uo);_.define({label:"FormJSFieldItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form field rendering.
2
2
  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).
3
- Contains all field values of the parent record.`},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
3
+ 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.
4
4
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
5
5
  Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
6
- 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"},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"})},40113:function(f,o,e){e.r(o),e.d(o,{JSFieldRunJSContext:function(){return _}});var l=e(72004),r=e.n(l),s=e(12444),t=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(1772),_=function(c){d()(n,c);var b=i()(n);function n(){return t()(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.
6
+ 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"})},40113:function(f,n,e){e.r(n),e.d(n,{JSFieldRunJSContext:function(){return _}});var l=e(72004),r=e.n(l),s=e(12444),t=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(67946),_=function(c){d()(o,c);var b=i()(o);function o(){return t()(this,o),b.apply(this,arguments)}return r()(o)}(m.Uo);_.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
7
7
  Supports innerHTML, append, and other DOM manipulation methods.`,value:`Current value of the field (read-only).
8
8
  Contains the data value stored in this field.`,record:`Current record data object (read-only).
9
9
  Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
10
10
  Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
11
11
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
12
- 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"})},44926:function(f,o,e){e.r(o);var l=e(40113),r=e(67087),s={contexts:[l.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-color",label:"Display number field as colored text",description:"Display numeric values using colors based on their sign",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u5F69\u8272\u6587\u672C",description:"\u6839\u636E\u6570\u503C\u6B63\u8D1F\u8BBE\u7F6E\u663E\u793A\u989C\u8272"}},content:`
12
+ 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"})},44926:function(f,n,e){e.r(n);var l=e(40113),r=e(67087),s={contexts:[l.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-color",label:"Display number field as colored text",description:"Display numeric values using colors based on their sign",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u5F69\u8272\u6587\u672C",description:"\u6839\u636E\u6570\u503C\u6B63\u8D1F\u8BBE\u7F6E\u663E\u793A\u989C\u8272"}},content:`
13
13
  // Colorize based on numeric sign
14
14
  const n = Number(ctx.value ?? 0);
15
15
  const color = Number.isFinite(n) ? (n > 0 ? 'green' : n < 0 ? 'red' : '#999') : '#555';
16
- ctx.element.innerHTML = '<span style=' + JSON.stringify('color:' + color) + '>' + String(ctx.value ?? '') + '</span>';
17
- `};o.default=s}}]);
16
+ ctx.render('<span style=' + JSON.stringify('color:' + color) + '>' + String(ctx.value ?? '') + '</span>');
17
+ `};n.default=s}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[501],{80501:function(N,m,e){e.r(m),e.d(m,{default:function(){return A}});var y=e(84203),p=e(34138),j=e.n(p),x=e(97857),C=e.n(x),o=e(4737);function k(u,I){o.o.initialize(C()({securityLevel:"loose"},I));function L(n){return n.split(/\s+/g)[0]}var l=u.renderer.rules.fence;function R(n,c,E,F,s){var v=n[c],f=v.info.trim(),H=f?L(f):"";if(["mermaid","{mermaid}"].indexOf(H)===-1)return l!==void 0?l(n,c,E,F,s):"";var g="",r=[],a=document.createElement("div");document.body.appendChild(a);try{var h="mermaid-container";o.o.mermaidAPI.render(h,v.content,function(d){var i=document.getElementById(h);i!==null&&r.push(["style","max-width:".concat(i.style.maxWidth,";max-height:").concat(i.style.maxHeight)]),g=d},a)}catch(d){return'<div class="alert alert-danger">'.concat(d,"</div>")}finally{a.remove()}return r.push(["src","data:image/svg+xml,".concat(encodeURIComponent(g))]),"<img ".concat(s.renderAttrs({attrs:r}),">")}u.renderer.rules.fence=R}var t=new y.Z({html:!0,linkify:!0,typographer:!0,breaks:!0});t.use(j()),t.use(k);var A=t}}]);
@@ -1,3 +1,3 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5013],{55013:function(h,n,e){e.r(n),e.d(n,{JSRecordActionRunJSContext:function(){return o}});var s=e(72004),r=e.n(s),l=e(12444),t=e.n(l),a=e(31996),u=e.n(a),d=e(26037),m=e.n(d),i=e(1772),o=function(b){u()(_,b);var c=m()(_);function _(){return t()(this,_),c.apply(this,arguments)}return r()(_)}(i.Uo);o.define({label:"JSRecordAction RunJS context",properties:{record:`Current record data object (read-only).
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5013],{55013:function(h,n,e){e.r(n),e.d(n,{JSRecordActionRunJSContext:function(){return o}});var s=e(72004),r=e.n(s),l=e(12444),t=e.n(l),a=e(31996),u=e.n(a),d=e(26037),m=e.n(d),i=e(67946),o=function(b){u()(_,b);var c=m()(_);function _(){return t()(this,_),c.apply(this,arguments)}return r()(_)}(i.Uo);o.define({label:"JSRecordAction RunJS context",properties:{record:`Current record data object (read-only).
2
2
  Contains all field values of the record associated with this action.`,filterByTk:`Primary key or filter key of the current record (read-only).
3
3
  Used to identify the specific record in database operations.`}}),o.define({label:"JS \u8BB0\u5F55\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",filterByTk:"\u4E3B\u952E/\u8FC7\u6EE4\u952E\uFF08\u53EA\u8BFB\uFF09"}},{locale:"zh-CN"})}}]);
@@ -0,0 +1,23 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5501,1442],{41442:function(t,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var r=e(72004),s=e.n(r),a=e(12444),l=e.n(a),d=e(31996),i=e.n(d),u=e(26037),m=e.n(u),c=e(67946),_=function(p){i()(o,p);var b=m()(o);function o(){return l()(this,o),b.apply(this,arguments)}return s()(o)}(c.Uo);_.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
+ Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
+ Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
4
+ 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 item container DOM element to be ready before executing callback.
5
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),_.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\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\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},45501:function(t,n,e){e.r(n);var r=e(41442),s={contexts:[r.JSItemRunJSContext],prefix:"sn-link-require",label:"Conditional required field",description:"Make a field required based on another field's value",locales:{"zh-CN":{label:"\u6761\u4EF6\u5FC5\u586B",description:"\u6839\u636E\u53E6\u4E00\u4E2A\u5B57\u6BB5\u7684\u503C\u52A8\u6001\u8BBE\u7F6E\u5FC5\u586B\u72B6\u6001"}},content:`
6
+ // When 'needsApproval' is true, make 'approver' field required
7
+ const needsApproval = ctx.record?.needsApproval;
8
+
9
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
10
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
11
+
12
+ const approverField = candidates.find((item) => item?.props?.name === 'approver');
13
+
14
+ if (approverField) {
15
+ approverField.setProps({
16
+ required: !!needsApproval,
17
+ // Also toggle visibility if needed
18
+ // display: needsApproval ? 'visible' : 'hidden',
19
+ });
20
+ } else {
21
+ console.warn('[Form snippet] approver field not found');
22
+ }
23
+ `};n.default=s}}]);
@@ -0,0 +1,26 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5662,1442],{41442:function(a,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var s=e(72004),t=e.n(s),r=e(12444),l=e.n(r),i=e(31996),d=e.n(i),m=e(26037),u=e.n(m),c=e(67946),_=function(b){d()(o,b);var f=u()(o);function o(){return l()(this,o),f.apply(this,arguments)}return t()(o)}(c.Uo);_.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
+ Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
+ Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
4
+ 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 item container DOM element to be ready before executing callback.
5
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),_.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\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\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},75662:function(a,n,e){e.r(n);var s=e(41442),t={contexts:[s.JSItemRunJSContext],prefix:"sn-link-show-hide",label:"Show/hide fields based on condition",description:"Toggle multiple fields visibility based on a condition",locales:{"zh-CN":{label:"\u6761\u4EF6\u663E\u793A/\u9690\u85CF\u5B57\u6BB5",description:"\u6839\u636E\u6761\u4EF6\u6279\u91CF\u663E\u793A\u6216\u9690\u85CF\u591A\u4E2A\u5B57\u6BB5"}},content:`
6
+ // Show payment fields only when paymentMethod is 'online'
7
+ const paymentMethod = ctx.record?.paymentMethod;
8
+ const showPaymentFields = paymentMethod === 'online';
9
+
10
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
11
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
12
+
13
+ // Fields to toggle
14
+ const fieldNames = ['creditCard', 'expiryDate', 'cvv'];
15
+
16
+ fieldNames.forEach((fieldName) => {
17
+ const field = candidates.find((item) => item?.props?.name === fieldName);
18
+ if (field) {
19
+ field.setProps({
20
+ display: showPaymentFields ? 'visible' : 'hidden',
21
+ // Also clear values when hiding
22
+ value: showPaymentFields ? field.props.value : undefined,
23
+ });
24
+ }
25
+ });
26
+ `};n.default=t}}]);
@@ -0,0 +1,22 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6021,1442],{41442:function(s,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var o=e(72004),r=e.n(o),a=e(12444),l=e.n(a),i=e(31996),u=e.n(i),m=e(26037),c=e.n(m),d=e(67946),_=function(b){u()(t,b);var f=c()(t);function t(){return l()(this,t),f.apply(this,arguments)}return r()(t)}(d.Uo);_.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
+ Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
+ Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
4
+ 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 item container DOM element to be ready before executing callback.
5
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),_.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\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\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},96021:function(s,n,e){e.r(n);var o=e(41442),r={contexts:[o.JSItemRunJSContext],prefix:"sn-link-calc",label:"Calculate total price (quantity \xD7 price)",description:"Automatically calculate total when quantity or unit price changes",locales:{"zh-CN":{label:"\u8BA1\u7B97\u603B\u4EF7\uFF08\u6570\u91CF \xD7 \u5355\u4EF7\uFF09",description:"\u5F53\u6570\u91CF\u6216\u5355\u4EF7\u53D8\u5316\u65F6\u81EA\u52A8\u8BA1\u7B97\u603B\u4EF7"}},content:`
6
+ // Get quantity and unit price from current record
7
+ const quantity = Number(ctx.record?.quantity) || 0;
8
+ const unitPrice = Number(ctx.record?.unitPrice) || 0;
9
+ const total = quantity * unitPrice;
10
+
11
+ // Find and update the 'totalPrice' field
12
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
13
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
14
+
15
+ const totalField = candidates.find((item) => item?.props?.name === 'totalPrice');
16
+
17
+ if (totalField) {
18
+ totalField.setProps({ value: total.toFixed(2) });
19
+ } else {
20
+ console.warn('[Form snippet] totalPrice field not found');
21
+ }
22
+ `};n.default=r}}]);
@@ -1,12 +1,12 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[645,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return s}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),i=e(31996),u=e.n(i),c=e(26037),d=e.n(c),m=e(1772),s=function(b){u()(t,b);var p=d()(t);function t(){return _()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);s.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[645,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),i=e(31996),u=e.n(i),c=e(26037),d=e.n(c),m=e(67946),a=function(b){u()(t,b);var p=d()(t);function t(){return _()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);a.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.
3
3
  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).
4
4
  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.
5
5
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
6
- Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),s.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)`"}},{locale:"zh-CN"})},10645:function(a,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-stats",label:"Render statistics cards",description:"Display multiple statistic cards with numbers from API",locales:{"zh-CN":{label:"\u6E32\u67D3\u7EDF\u8BA1\u5361\u7247",description:"\u663E\u793A\u591A\u4E2A\u7EDF\u8BA1\u6570\u5B57\u5361\u7247\uFF08\u4ECE API \u83B7\u53D6\u6570\u636E\uFF09"}},content:`
6
+ 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`)."}}),a.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"})},10645:function(s,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-stats",label:"Render statistics cards",description:"Display multiple statistic cards with numbers from API",locales:{"zh-CN":{label:"\u6E32\u67D3\u7EDF\u8BA1\u5361\u7247",description:"\u663E\u793A\u591A\u4E2A\u7EDF\u8BA1\u6570\u5B57\u5361\u7247\uFF08\u4ECE API \u83B7\u53D6\u6570\u636E\uFF09"}},content:`
7
7
  const { Card, Statistic, Row, Col } = ctx.libs.antd;
8
8
 
9
- const res = await ctx.api.request({
9
+ const res = await ctx.request({
10
10
  url: 'users:list',
11
11
  method: 'get',
12
12
  params: {
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6474,689],{689:function(l,o,e){e.r(o),e.d(o,{JSCollectionActionRunJSContext:function(){return t}});var _=e(72004),s=e.n(_),r=e(12444),a=e.n(r),c=e(31996),u=e.n(c),i=e(26037),d=e.n(i),m=e(1772),t=function(b){u()(n,b);var C=d()(n);function n(){return a()(this,n),C.apply(this,arguments)}return s()(n)}(m.Uo);t.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6474,689],{689:function(l,o,e){e.r(o),e.d(o,{JSCollectionActionRunJSContext:function(){return t}});var _=e(72004),s=e.n(_),r=e(12444),a=e.n(r),c=e(31996),u=e.n(c),i=e(26037),d=e.n(i),m=e(67946),t=function(b){u()(n,b);var C=d()(n);function n(){return a()(this,n),C.apply(this,arguments)}return s()(n)}(m.Uo);t.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
2
2
  Use ctx.resource.selectedRows to get selected records.
3
3
  Use ctx.resource.pagination for page info.`}}),t.define({label:"JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{resource:"\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"}},{locale:"zh-CN"})},36474:function(l,o,e){e.r(o);var _=e(689),s={contexts:[_.JSCollectionActionRunJSContext],prefix:"sn-act-export",label:"Export selected rows as JSON",description:"Download selected rows as a JSON file",locales:{"zh-CN":{label:"\u5BFC\u51FA\u9009\u4E2D\u884C\u4E3A JSON",description:"\u5C06\u9009\u4E2D\u7684\u884C\u5BFC\u51FA\u4E3A JSON \u6587\u4EF6\u4E0B\u8F7D"}},content:`
4
4
  const rows = ctx.resource?.getSelectedRows?.() || [];
@@ -0,0 +1,33 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6534,1442],{41442:function(_,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return r}});var s=e(72004),t=e.n(s),a=e(12444),l=e.n(a),i=e(31996),m=e.n(i),d=e(26037),u=e.n(d),c=e(67946),r=function(b){m()(o,b);var p=u()(o);function o(){return l()(this,o),p.apply(this,arguments)}return t()(o)}(c.Uo);r.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
+ Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
+ Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
4
+ 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 item container DOM element to be ready before executing callback.
5
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),r.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\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\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},76534:function(_,n,e){e.r(n);var s=e(41442),t={contexts:[s.JSItemRunJSContext],prefix:"sn-link-copy",label:"Copy value from another field",description:"Copy value from one field to another when checkbox is checked",locales:{"zh-CN":{label:"\u590D\u5236\u5B57\u6BB5\u503C",description:"\u52FE\u9009\u590D\u9009\u6846\u65F6\uFF0C\u5C06\u4E00\u4E2A\u5B57\u6BB5\u7684\u503C\u590D\u5236\u5230\u53E6\u4E00\u4E2A\u5B57\u6BB5"}},content:`
6
+ // When 'sameAsAbove' is checked, copy billing address to shipping address
7
+ const sameAsAbove = ctx.record?.sameAsAbove;
8
+
9
+ if (!sameAsAbove) {
10
+ return;
11
+ }
12
+
13
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
14
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
15
+
16
+ // Source and target field mappings
17
+ const fieldMappings = [
18
+ { from: 'billingAddress', to: 'shippingAddress' },
19
+ { from: 'billingCity', to: 'shippingCity' },
20
+ { from: 'billingZipCode', to: 'shippingZipCode' },
21
+ ];
22
+
23
+ fieldMappings.forEach(({ from, to }) => {
24
+ const sourceValue = ctx.record?.[from];
25
+ const targetField = candidates.find((item) => item?.props?.name === to);
26
+
27
+ if (targetField) {
28
+ targetField.setProps({ value: sourceValue });
29
+ }
30
+ });
31
+
32
+ ctx.message?.success?.(ctx.t('Address copied successfully'));
33
+ `};n.default=t}}]);
@@ -1,22 +1,27 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6747,95,113,7087],{67087:function(h,_,e){e.r(_),e.d(_,{FormJSFieldItemRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"FormJSFieldItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form field rendering.
1
+ "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.
2
2
  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).
3
- Contains all field values of the parent record.`},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
3
+ 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.
4
4
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
5
5
  Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
6
- Example: ctx.setProps(fieldModel, { value: "new value" })`}}),o.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"},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(h,_,e){e.r(_),e.d(_,{JSBlockRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
6
+ 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.
7
7
  Supports innerHTML, append, and other DOM manipulation methods.
8
8
  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).
9
9
  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.
10
10
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
11
- Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),o.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)`"}},{locale:"zh-CN"})},40113:function(h,_,e){e.r(_),e.d(_,{JSFieldRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
11
+ 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.
12
12
  Supports innerHTML, append, and other DOM manipulation methods.`,value:`Current value of the field (read-only).
13
13
  Contains the data value stored in this field.`,record:`Current record data object (read-only).
14
14
  Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
15
15
  Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
16
16
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
17
- Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),o.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(h,_,e){e.r(_);var t=e(10095),l=e(40113),r=e(67087),s={contexts:[t.JSBlockRunJSContext,l.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-query-selector",label:"Query selector",description:"Find a child element inside ctx.element using querySelector",locales:{"zh-CN":{label:"\u67E5\u8BE2\u5B50\u5143\u7D20",description:"\u4F7F\u7528 querySelector \u5728 ctx.element \u5185\u67E5\u627E\u5B50\u5143\u7D20"}},content:`
18
- const child = ctx.element.querySelector('.child-class');
17
+ 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:`
18
+ const wrapper = document.createElement('div');
19
+ wrapper.innerHTML = '<div class="child-class"></div>';
20
+
21
+ ctx.render(wrapper);
22
+
23
+ const child = wrapper.querySelector('.child-class');
19
24
  if (child) {
20
25
  child.textContent = ctx.t('Hello from querySelector');
21
26
  }
22
- `};_.default=s}}]);
27
+ `};o.default=a}}]);
@@ -1,3 +1,3 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[689],{689:function(C,n,e){e.r(n),e.d(n,{JSCollectionActionRunJSContext:function(){return o}});var s=e(72004),l=e.n(s),r=e(12444),t=e.n(r),u=e(31996),a=e.n(u),m=e(26037),c=e.n(m),d=e(1772),o=function(i){a()(_,i);var b=c()(_);function _(){return t()(this,_),b.apply(this,arguments)}return l()(_)}(d.Uo);o.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[689],{689:function(C,n,e){e.r(n),e.d(n,{JSCollectionActionRunJSContext:function(){return o}});var s=e(72004),l=e.n(s),r=e(12444),t=e.n(r),u=e(31996),a=e.n(u),m=e(26037),c=e.n(m),d=e(67946),o=function(i){a()(_,i);var b=c()(_);function _(){return t()(this,_),b.apply(this,arguments)}return l()(_)}(d.Uo);o.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
2
2
  Use ctx.resource.selectedRows to get selected records.
3
3
  Use ctx.resource.pagination for page info.`}}),o.define({label:"JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{resource:"\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"}},{locale:"zh-CN"})}}]);
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6920,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var r=e(72004),o=e.n(r),_=e(12444),l=e.n(_),i=e(31996),d=e.n(i),c=e(26037),u=e.n(c),m=e(1772),a=function(b){d()(t,b);var p=u()(t);function t(){return l()(this,t),p.apply(this,arguments)}return o()(t)}(m.Uo);a.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6920,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return o}});var r=e(72004),a=e.n(r),l=e(12444),_=e.n(l),d=e(31996),i=e.n(d),c=e(26037),u=e.n(c),m=e(67946),o=function(b){i()(t,b);var h=u()(t);function t(){return _()(this,t),h.apply(this,arguments)}return a()(t)}(m.Uo);o.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.
3
3
  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).
4
4
  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.
5
5
  Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
6
- Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),a.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)`"}},{locale:"zh-CN"})},96920:function(s,n,e){e.r(n);var r=e(10095),o={contexts:[r.JSBlockRunJSContext],prefix:"sn-jsb-chartjs",label:"Render Chart.js bar chart",description:"Load Chart.js from CDN and render a basic bar chart inside the block",locales:{"zh-CN":{label:"\u6E32\u67D3 Chart.js \u67F1\u72B6\u56FE",description:"\u901A\u8FC7 CDN \u5F15\u5165 Chart.js \u5E76\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u57FA\u7840\u67F1\u72B6\u56FE"}},content:`
6
+ 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`)."}}),o.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"})},96920:function(s,n,e){e.r(n);var r=e(10095),a={contexts:[r.JSBlockRunJSContext],prefix:"sn-jsb-chartjs",label:"Render Chart.js bar chart",description:"Load Chart.js from CDN and render a basic bar chart inside the block",locales:{"zh-CN":{label:"\u6E32\u67D3 Chart.js \u67F1\u72B6\u56FE",description:"\u901A\u8FC7 CDN \u5F15\u5165 Chart.js \u5E76\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u57FA\u7840\u67F1\u72B6\u56FE"}},content:`
7
7
  const wrapper = document.createElement('div');
8
8
  wrapper.style.padding = '16px';
9
9
  wrapper.style.background = '#fff';
@@ -14,10 +14,10 @@ const canvas = document.createElement('canvas');
14
14
  canvas.width = 480;
15
15
  canvas.height = 320;
16
16
  wrapper.appendChild(canvas);
17
- ctx.element.replaceChildren(wrapper);
17
+ ctx.render(wrapper);
18
18
 
19
19
  async function renderChart() {
20
- const loaded = await ctx.requireAsync('https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js');
20
+ const loaded = await ctx.requireAsync('chart.js@4.4.0/dist/chart.umd.min.js');
21
21
  const Chart = loaded?.Chart || loaded?.default?.Chart || loaded?.default;
22
22
  if (!Chart) {
23
23
  throw new Error('Chart.js is not available');
@@ -56,4 +56,4 @@ renderChart().catch((error) => {
56
56
  console.error('[RunJS] failed to render chart', error);
57
57
  wrapper.innerHTML = '<div style="color:#c00;">' + (error?.message || ctx.t('Chart initialization failed')) + '</div>';
58
58
  });
59
- `};n.default=o}}]);
59
+ `};n.default=a}}]);