@nocobase/app 2.0.0-beta.20 → 2.0.0-beta.22

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 (50) hide show
  1. package/dist/client/1161.7f32c8ad.async.js +40 -0
  2. package/dist/client/1442.fd65d046.async.js +5 -0
  3. package/dist/client/{1595.f3d71f31.async.js → 1595.4ba8b880.async.js} +2 -2
  4. package/dist/client/{1883.9a059d9c.async.js → 1883.b3a67ecd.async.js} +2 -2
  5. package/dist/client/{1905.b546fd90.async.js → 1905.817fe450.async.js} +3 -3
  6. package/dist/client/{2097.682e266e.async.js → 2097.469d41dd.async.js} +2 -2
  7. package/dist/client/{2380.8298c573.async.js → 2380.04c234b2.async.js} +1 -1
  8. package/dist/client/{2775.39407a48.async.js → 2775.3b131ed6.async.js} +5 -5
  9. package/dist/client/{2936.c875b061.async.js → 2936.745e500f.async.js} +4 -4
  10. package/dist/client/{3357.b82bd041.async.js → 3357.0dc001fc.async.js} +4 -4
  11. package/dist/client/341.01fc2262.async.js +28 -0
  12. package/dist/client/{3451.3c01f5ab.async.js → 3451.883e4b24.async.js} +3 -3
  13. package/dist/client/3781.16f1bb74.async.js +1 -0
  14. package/dist/client/{4327.a4b050e3.async.js → 4327.017d9dd5.async.js} +5 -5
  15. package/dist/client/{4351.57614a08.async.js → 4351.934f807d.async.js} +4 -4
  16. package/dist/client/{4356.c4b269d3.async.js → 4356.a3863dfa.async.js} +2 -2
  17. package/dist/client/{4750.bf97ff2e.async.js → 4750.0863f7b1.async.js} +2 -2
  18. package/dist/client/{4926.3d530cd7.async.js → 4926.5145490f.async.js} +5 -5
  19. package/dist/client/5501.7bed1ac8.async.js +23 -0
  20. package/dist/client/5662.3071d144.async.js +26 -0
  21. package/dist/client/6021.b3ab345b.async.js +22 -0
  22. package/dist/client/{645.fc351075.async.js → 645.c50250c0.async.js} +2 -2
  23. package/dist/client/6534.87203710.async.js +33 -0
  24. package/dist/client/{6747.b91a9f29.async.js → 6747.6cd202fc.async.js} +6 -6
  25. package/dist/client/{6920.a8417eba.async.js → 6920.e9b2edd5.async.js} +3 -3
  26. package/dist/client/{703.1a5ec139.async.js → 703.ee1a1177.async.js} +2 -2
  27. package/dist/client/7087.e5b68989.async.js +6 -0
  28. package/dist/client/{7483.9b86876d.async.js → 7483.48e5c2c9.async.js} +2 -2
  29. package/dist/client/{7764.00328ea3.async.js → 7764.f7b626cb.async.js} +1 -1
  30. package/dist/client/{8408.731c795f.async.js → 8408.a613a1b7.async.js} +2 -2
  31. package/dist/client/{8805.3ba17917.async.js → 8805.58c92f65.async.js} +3 -3
  32. package/dist/client/{9042.8b5abb9d.async.js → 9042.35fa27dc.async.js} +4 -4
  33. package/dist/client/{935.c46b3064.async.js → 935.63a37ee3.async.js} +4 -4
  34. package/dist/client/{95.4ac502e9.async.js → 95.cf18a56e.async.js} +2 -2
  35. package/dist/client/9844.acade9ed.async.js +37 -0
  36. package/dist/client/index.html +1 -1
  37. package/dist/client/index.html.tpl +1 -1
  38. package/dist/client/p__index.e8f56d15.async.js +2605 -0
  39. package/dist/client/{umi.eadf9b7e.js → umi.1b77d758.js} +1 -1
  40. package/package.json +6 -6
  41. package/dist/client/1161.cfb9aa6a.async.js +0 -40
  42. package/dist/client/1442.1692e030.async.js +0 -5
  43. package/dist/client/341.3c086bf4.async.js +0 -28
  44. package/dist/client/5501.d2a75c24.async.js +0 -23
  45. package/dist/client/5662.1729c315.async.js +0 -26
  46. package/dist/client/6021.d883e164.async.js +0 -22
  47. package/dist/client/6534.8552e64c.async.js +0 -33
  48. package/dist/client/7087.af51c764.async.js +0 -6
  49. package/dist/client/9844.02aff90e.async.js +0 -37
  50. package/dist/client/p__index.a5ec8c6e.async.js +0 -2601
@@ -0,0 +1,40 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1161,1442],{41442:function(_,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return s}});var t=e(72004),r=e.n(t),a=e(12444),l=e.n(a),d=e(31996),m=e.n(d),u=e(26037),i=e.n(u),c=e(67946),s=function(b){m()(o,b);var p=i()(o);function o(){return l()(this,o),p.apply(this,arguments)}return r()(o)}(c.Uo);s.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`}}),s.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"})},91161:function(_,n,e){e.r(n);var t=e(41442),r={contexts:[t.JSItemRunJSContext],prefix:"sn-link-cascade",label:"Cascade select (load child roles)",description:"Load child roles based on the selected parent role",locales:{"zh-CN":{label:"\u7EA7\u8054\u9009\u62E9\uFF08\u52A0\u8F7D\u5B50\u89D2\u8272\uFF09",description:"\u6839\u636E\u9009\u62E9\u7684\u7236\u89D2\u8272\u52A0\u8F7D\u5BF9\u5E94\u5B50\u89D2\u8272"}},content:`
6
+ // Get selected parent role (adjust field name to match your form)
7
+ const parentRoleId = ctx.record?.parentRole?.id;
8
+
9
+ if (!parentRoleId) {
10
+ return;
11
+ }
12
+
13
+ const res = await ctx.api.request({
14
+ url: 'roles:list',
15
+ method: 'get',
16
+ params: {
17
+ pageSize: 100,
18
+ filter: {
19
+ parentId: parentRoleId,
20
+ },
21
+ },
22
+ });
23
+
24
+ const childRoles = res?.data?.data || [];
25
+
26
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
27
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
28
+
29
+ const roleField = candidates.find((item) => item?.props?.name === 'role');
30
+
31
+ if (roleField) {
32
+ roleField.setProps({
33
+ dataSource: childRoles.map((role) => ({
34
+ value: role.id,
35
+ label: role.name,
36
+ })),
37
+ value: undefined,
38
+ });
39
+ }
40
+ `};n.default=r}}]);
@@ -0,0 +1,5 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1442],{41442:function(h,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return o}});var r=e(72004),s=e.n(r),t=e(12444),a=e.n(t),l=e(31996),m=e.n(l),u=e(26037),d=e.n(u),i=e(67946),o=function(c){m()(_,c);var b=d()(_);function _(){return a()(this,_),b.apply(this,arguments)}return s()(_)}(i.Uo);o.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`}}),o.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"})}}]);
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1595,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),s=e(12444),l=e.n(s),i=e(31996),d=e.n(i),c=e(26037),m=e.n(c),u=e(67946),_=function(b){d()(o,b);var p=m()(o);function o(){return l()(this,o),p.apply(this,arguments)}return r()(o)}(u.Uo);_.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1595,95],{10095:function(_,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),r=e.n(o),l=e(12444),s=e.n(l),i=e(31996),d=e.n(i),c=e(26037),u=e.n(c),m=e(67946),a=function(b){d()(t,b);var p=u()(t);function t(){return s()(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"})},41595:function(a,n,e){e.r(n);var t=e(10095),r={contexts:[t.JSBlockRunJSContext],prefix:"sn-jsb-timeline",label:"Render timeline from records",description:"Display records as a timeline using Ant Design Timeline",locales:{"zh-CN":{label:"\u6E32\u67D3\u65F6\u95F4\u8F74",description:"\u4F7F\u7528 Ant Design \u65F6\u95F4\u8F74\u7EC4\u4EF6\u663E\u793A\u8BB0\u5F55\u5386\u53F2"}},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"})},41595:function(_,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-timeline",label:"Render timeline from records",description:"Display records as a timeline using Ant Design Timeline",locales:{"zh-CN":{label:"\u6E32\u67D3\u65F6\u95F4\u8F74",description:"\u4F7F\u7528 Ant Design \u65F6\u95F4\u8F74\u7EC4\u4EF6\u663E\u793A\u8BB0\u5F55\u5386\u53F2"}},content:`
7
7
  const { Timeline, Card } = ctx.libs.antd;
8
8
 
9
9
  const res = await ctx.api.request({
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1883,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),l=e(12444),s=e.n(l),i=e(31996),c=e.n(i),m=e(26037),u=e.n(m),d=e(67946),_=function(b){c()(o,b);var h=u()(o);function o(){return s()(this,o),h.apply(this,arguments)}return r()(o)}(d.Uo);_.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1883,95],{10095:function(_,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),r=e.n(o),l=e(12444),s=e.n(l),i=e(31996),c=e.n(i),m=e(26037),u=e.n(m),d=e(67946),a=function(b){c()(t,b);var f=u()(t);function t(){return s()(this,t),f.apply(this,arguments)}return r()(t)}(d.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"})},61883:function(a,n,e){e.r(n);var t=e(10095),r={contexts:[t.JSBlockRunJSContext],prefix:"sn-jsb-iframe",label:"Render iframe",description:"Embed example.com as a sandboxed iframe inside the block element",locales:{"zh-CN":{label:"\u6E32\u67D3 iframe",description:"\u5728\u533A\u5757\u4E2D\u4EE5 sandbox \u9650\u5236\u5D4C\u5165 example.com \u9875\u9762"}},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"})},61883:function(_,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-iframe",label:"Render iframe",description:"Embed example.com as a sandboxed iframe inside the block element",locales:{"zh-CN":{label:"\u6E32\u67D3 iframe",description:"\u5728\u533A\u5757\u4E2D\u4EE5 sandbox \u9650\u5236\u5D4C\u5165 example.com \u9875\u9762"}},content:`
7
7
  // Create an iframe that fills the current block container
8
8
  const iframe = document.createElement('iframe');
9
9
  iframe.src = 'https://example.com';
@@ -1,8 +1,8 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1905,1442],{41442:function(r,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return s}});var _=e(72004),t=e.n(_),a=e(12444),l=e.n(a),m=e(31996),u=e.n(m),i=e(26037),d=e.n(i),c=e(67946),s=function(b){u()(o,b);var h=d()(o);function o(){return l()(this,o),h.apply(this,arguments)}return t()(o)}(c.Uo);s.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1905,1442],{41442:function(r,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return s}});var _=e(72004),t=e.n(_),a=e(12444),l=e.n(a),m=e(31996),u=e.n(m),i=e(26037),d=e.n(i),c=e(67946),s=function(b){u()(o,b);var f=d()(o);function o(){return l()(this,o),f.apply(this,arguments)}return t()(o)}(c.Uo);s.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
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.`},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`}}),s.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"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},71905:function(r,n,e){e.r(n);var _=e(41442),t={contexts:[_.JSItemRunJSContext],prefix:"sn-jsitem-basic",label:"Render form item",description:"Render custom content inside a form item container",locales:{"zh-CN":{label:"\u6E32\u67D3\u8868\u5355\u9879",description:"\u5728\u8868\u5355\u9879\u5BB9\u5668\u4E2D\u6E32\u67D3\u81EA\u5B9A\u4E49\u5185\u5BB9"}},content:`
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`}}),s.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"})},71905:function(r,n,e){e.r(n);var _=e(41442),t={contexts:[_.JSItemRunJSContext],prefix:"sn-jsitem-basic",label:"Render form item",description:"Render custom content inside a form item container",locales:{"zh-CN":{label:"\u6E32\u67D3\u8868\u5355\u9879",description:"\u5728\u8868\u5355\u9879\u5BB9\u5668\u4E2D\u6E32\u67D3\u81EA\u5B9A\u4E49\u5185\u5BB9"}},content:`
6
6
  ctx.element.innerHTML = \`
7
7
  <div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6;">
8
8
  <h3 style="color: #1890ff; margin: 0 0 12px 0; font-size: 18px; font-weight: 600;">\${ctx.t('JS Item')}</h3>
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2097,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),s=e(12444),l=e.n(s),i=e(31996),c=e.n(i),u=e(26037),d=e.n(u),m=e(67946),r=function(b){c()(o,b);var h=d()(o);function o(){return l()(this,o),h.apply(this,arguments)}return _()(o)}(m.Uo);r.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2097,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var o=e(72004),_=e.n(o),l=e(12444),s=e.n(l),u=e(31996),c=e.n(u),i=e(26037),d=e.n(i),m=e(67946),r=function(b){c()(t,b);var h=d()(t);function t(){return s()(this,t),h.apply(this,arguments)}return _()(t)}(m.Uo);r.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)`"}}),r.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"})},82097:function(a,n,e){e.r(n);var t=e(10095),_={contexts:[t.JSBlockRunJSContext],prefix:"sn-jsb-button",label:"Render button handler",description:"Render a button and handle click events inside the block",locales:{"zh-CN":{label:"\u6309\u94AE\u4E8B\u4EF6\u5904\u7406",description:"\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u5904\u7406\u903B\u8F91"}},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`)."}}),r.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"})},82097:function(a,n,e){e.r(n);var o=e(10095),_={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-button",label:"Render button handler",description:"Render a button and handle click events inside the block",locales:{"zh-CN":{label:"\u6309\u94AE\u4E8B\u4EF6\u5904\u7406",description:"\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u5904\u7406\u903B\u8F91"}},content:`
7
7
  const { Button } = ctx.libs.antd;
8
8
 
9
9
  ctx.render(
@@ -3,7 +3,7 @@
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)`"}}),r.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"})},12380:function(a,n,e){e.r(n);var o=e(10095),_={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-click",label:"Add click listener",description:"Render a button and bind a click event handler",locales:{"zh-CN":{label:"\u6DFB\u52A0\u70B9\u51FB\u76D1\u542C",description:"\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u4E8B\u4EF6\u5904\u7406"}},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`)."}}),r.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"})},12380:function(a,n,e){e.r(n);var o=e(10095),_={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-click",label:"Add click listener",description:"Render a button and bind a click event handler",locales:{"zh-CN":{label:"\u6DFB\u52A0\u70B9\u51FB\u76D1\u542C",description:"\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u4E8B\u4EF6\u5904\u7406"}},content:`
7
7
  // Render a button and bind a click handler
8
8
  ctx.element.innerHTML = \`
9
9
  <button id="nb-jsb-btn" style="padding:6px 12px">\${ctx.t('Click me')}</button>
@@ -1,15 +1,15 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2775,113,7087],{67087:function(f,o,e){e.r(o),e.d(o,{FormJSFieldItemRunJSContext:function(){return _}});var t=e(72004),l=e.n(t),r=e(12444),a=e.n(r),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 l()(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([[2775,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),i=e(26037),u=e.n(i),m=e(67946),_=function(c){d()(n,c);var b=u()(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" })`}}),_.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 t=e(72004),l=e.n(t),r=e(12444),a=e.n(r),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 l()(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,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),i=e(26037),u=e.n(i),m=e(67946),_=function(c){d()(n,c);var b=u()(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.
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"})},72775:function(f,o,e){e.r(o);var t=e(40113),l=e(67087),r={contexts:[t.JSFieldRunJSContext,l.FormJSFieldItemRunJSContext],prefix:"sn-jsf-percent",label:"Display number field as percentage bar",description:"Render numeric values as a percentage progress bar",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u767E\u5206\u6BD4\u8FDB\u5EA6\u6761",description:"\u5C06\u6570\u5B57\u683C\u5F0F\u5316\u4E3A\u767E\u5206\u6BD4\u5E76\u663E\u793A\u8FDB\u5EA6\u6761"}},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"})},72775:function(f,o,e){e.r(o);var t=e(40113),r=e(67087),l={contexts:[t.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-percent",label:"Display number field as percentage bar",description:"Render numeric values as a percentage progress bar",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u767E\u5206\u6BD4\u8FDB\u5EA6\u6761",description:"\u5C06\u6570\u5B57\u683C\u5F0F\u5316\u4E3A\u767E\u5206\u6BD4\u5E76\u663E\u793A\u8FDB\u5EA6\u6761"}},content:`
13
13
  const value = Number(ctx.value ?? 0);
14
14
 
15
15
  if (!Number.isFinite(value)) {
@@ -44,4 +44,4 @@ ctx.element.innerHTML = \`
44
44
  </span>
45
45
  </div>
46
46
  \`;
47
- `};o.default=r}}]);
47
+ `};o.default=l}}]);
@@ -1,8 +1,8 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2936,1442],{41442:function(s,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return r}});var _=e(72004),t=e.n(_),a=e(12444),l=e.n(a),d=e(31996),i=e.n(d),u=e(26037),m=e.n(u),c=e(67946),r=function(b){i()(o,b);var f=m()(o);function o(){return l()(this,o),f.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.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2936,1442],{41442:function(s,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var t=e(72004),r=e.n(t),a=e(12444),l=e.n(a),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 r()(o)}(c.Uo);_.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
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.`},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"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},42936:function(s,n,e){e.r(n);var _=e(41442),t={contexts:[_.JSItemRunJSContext],prefix:"sn-link-required",label:"Set required",description:"Toggle required rule for another field within linkage",locales:{"zh-CN":{label:"\u8BBE\u7F6E\u5FC5\u586B",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u63A7\u5236\u5B57\u6BB5\u662F\u5426\u5FC5\u586B"}},content:`
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"})},42936:function(s,n,e){e.r(n);var t=e(41442),r={contexts:[t.JSItemRunJSContext],prefix:"sn-link-required",label:"Set required",description:"Toggle required rule for another field within linkage",locales:{"zh-CN":{label:"\u8BBE\u7F6E\u5FC5\u586B",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u63A7\u5236\u5B57\u6BB5\u662F\u5426\u5FC5\u586B"}},content:`
6
6
  const targetFieldUid = 'FIELD_UID_OR_NAME';
7
7
  const required = true;
8
8
 
@@ -25,4 +25,4 @@ ctx.message?.success?.(
25
25
  name: fieldModel?.props?.label || targetFieldUid,
26
26
  }),
27
27
  );
28
- `};n.default=t}}]);
28
+ `};n.default=r}}]);
@@ -1,8 +1,8 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3357,1442],{41442:function(r,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return s}});var _=e(72004),t=e.n(_),a=e(12444),l=e.n(a),d=e(31996),i=e.n(d),m=e(26037),u=e.n(m),c=e(67946),s=function(b){i()(o,b);var h=u()(o);function o(){return l()(this,o),h.apply(this,arguments)}return t()(o)}(c.Uo);s.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3357,1442],{41442:function(r,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var t=e(72004),s=e.n(t),a=e(12444),l=e.n(a),d=e(31996),i=e.n(d),m=e(26037),u=e.n(m),c=e(67946),_=function(b){i()(o,b);var f=u()(o);function o(){return l()(this,o),f.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
2
  Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
3
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.`},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`}}),s.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"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},93357:function(r,n,e){e.r(n);var _=e(41442),t={contexts:[_.JSItemRunJSContext],prefix:"sn-link-visibility",label:"Toggle visible",description:"Show or hide another field within linkage scripts",locales:{"zh-CN":{label:"\u5207\u6362\u53EF\u89C1\u6027",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u8BBE\u7F6E\u5B57\u6BB5\u663E\u793A\u6216\u9690\u85CF"}},content:`
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"})},93357:function(r,n,e){e.r(n);var t=e(41442),s={contexts:[t.JSItemRunJSContext],prefix:"sn-link-visibility",label:"Toggle visible",description:"Show or hide another field within linkage scripts",locales:{"zh-CN":{label:"\u5207\u6362\u53EF\u89C1\u6027",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u8BBE\u7F6E\u5B57\u6BB5\u663E\u793A\u6216\u9690\u85CF"}},content:`
6
6
  const targetFieldUid = 'FIELD_UID_OR_NAME';
7
7
  const shouldHide = true;
8
8
 
@@ -25,4 +25,4 @@ ctx.message?.success?.(
25
25
  name: fieldModel?.props?.label || targetFieldUid,
26
26
  }),
27
27
  );
28
- `};n.default=t}}]);
28
+ `};n.default=s}}]);
@@ -0,0 +1,28 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[341,1442],{41442:function(a,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return _}});var t=e(72004),s=e.n(t),r=e(12444),l=e.n(r),d=e(31996),i=e.n(d),m=e(26037),u=e.n(m),c=e(67946),_=function(b){i()(o,b);var f=u()(o);function o(){return l()(this,o),f.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"})},10341:function(a,n,e){e.r(n);var t=e(41442),s={contexts:[t.JSItemRunJSContext],prefix:"sn-link-disable",label:"Set disabled",description:"Enable or disable another field in linkage scripts",locales:{"zh-CN":{label:"\u8BBE\u7F6E\u7981\u7528",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u542F\u7528\u6216\u7981\u7528\u5B57\u6BB5"}},content:`
6
+ const targetFieldUid = 'FIELD_UID_OR_NAME';
7
+ const disabled = true;
8
+
9
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
10
+ const candidates = Array.isArray(items)
11
+ ? items
12
+ : Array.from(items?.values?.() || items || []);
13
+ const fieldModel =
14
+ candidates.find((item) => item?.uid === targetFieldUid) ||
15
+ candidates.find((item) => item?.props?.name === targetFieldUid);
16
+
17
+ if (!fieldModel) {
18
+ ctx.message?.warning?.(ctx.t('Field {{name}} not found', { name: targetFieldUid }));
19
+ return;
20
+ }
21
+
22
+ fieldModel.setProps({ disabled });
23
+ ctx.message?.success?.(
24
+ ctx.t(disabled ? 'Disabled field {{name}}' : 'Enabled field {{name}}', {
25
+ name: fieldModel?.props?.label || targetFieldUid,
26
+ }),
27
+ );
28
+ `};n.default=s}}]);
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3451,95],{10095:function(_,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),r=e.n(o),s=e(12444),l=e.n(s),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.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3451,95],{10095:function(_,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var o=e(72004),a=e.n(o),s=e(12444),l=e.n(s),i=e(31996),d=e.n(i),u=e(26037),c=e.n(u),m=e(67946),r=function(b){d()(t,b);var p=c()(t);function t(){return l()(this,t),p.apply(this,arguments)}return a()(t)}(m.Uo);r.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"})},3451:function(_,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-fetch-list",label:"Fetch & render list",description:"Fetch a small list via ctx.api and render basic HTML",locales:{"zh-CN":{label:"\u62C9\u53D6\u5E76\u6E32\u67D3\u5217\u8868",description:"\u4F7F\u7528 ctx.api \u62C9\u53D6\u5C11\u91CF\u6570\u636E\uFF0C\u5E76\u6E32\u67D3\u57FA\u7840 HTML \u5217\u8868"}},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`)."}}),r.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"})},3451:function(_,n,e){e.r(n);var o=e(10095),a={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-fetch-list",label:"Fetch & render list",description:"Fetch a small list via ctx.api and render basic HTML",locales:{"zh-CN":{label:"\u62C9\u53D6\u5E76\u6E32\u67D3\u5217\u8868",description:"\u4F7F\u7528 ctx.api \u62C9\u53D6\u5C11\u91CF\u6570\u636E\uFF0C\u5E76\u6E32\u67D3\u57FA\u7840 HTML \u5217\u8868"}},content:`
7
7
  // Fetch users
8
8
  const { data } = await ctx.api.request({
9
9
  url: 'users:list',
@@ -21,4 +21,4 @@ ctx.element.innerHTML = [
21
21
  '</ul>',
22
22
  '</div>'
23
23
  ].join('');
24
- `};n.default=r}}]);
24
+ `};n.default=a}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3781],{43781:function(p,o,e){e.r(o),e.d(o,{JSEditableFieldRunJSContext:function(){return n}});var a=e(72004),l=e.n(a),r=e(12444),s=e.n(r),_=e(31996),i=e.n(_),d=e(26037),u=e.n(d),m=e(67946),n=function(c){i()(t,c);var b=u()(t);function t(){return s()(this,t),b.apply(this,arguments)}return l()(t)}(m.Uo);n.define({label:"JSEditableField RunJS context",properties:{element:{description:"ElementProxy instance providing a safe DOM container for field rendering. In editable mode this container is typically a <span> element.",detail:"ElementProxy"},value:{description:"Current field value (read-only snapshot). In editable scenarios, prefer ctx.getValue()/ctx.setValue(v) for two-way binding.",detail:"any",examples:["const v = ctx.getValue?.() ?? ctx.value;",'ctx.setValue?.("new value");']},record:{description:"Current record data object (read-only). Available in forms that are bound to a record.",detail:"Record<string, any>"},form:{description:'Ant Design Form instance for reading/writing other fields. Example: ctx.form.getFieldValue("name")',detail:"FormInstance"},formValues:{description:"Snapshot of current form values (object). Prefer ctx.form.getFieldsValue() when you need the latest values.",detail:"Record<string, any>"},namePath:{description:"Field namePath in the form (array). Useful for advanced Form operations.",detail:"Array<string | number>"},disabled:"Whether the field is disabled (boolean).",readOnly:"Whether the field is read-only (boolean)."},methods:{getValue:{description:"Get current field value (recommended for editable custom fields).",detail:"() => any",completion:{insertText:"ctx.getValue?.()"}},setValue:{description:"Set current field value (two-way binding with the form).",detail:"(value: any) => void",completion:{insertText:"ctx.setValue?.(value)"},examples:["ctx.setValue?.(e.target.value);"]}}}),n.define({label:"JS \u53EF\u7F16\u8F91\u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002",detail:"ElementProxy"},value:{description:"\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\u5FEB\u7167\uFF09\u3002\u53EF\u7F16\u8F91\u573A\u666F\u5EFA\u8BAE\u4F7F\u7528 ctx.getValue()/ctx.setValue(v) \u505A\u53CC\u5411\u7ED1\u5B9A\u3002",detail:"any",examples:["const v = ctx.getValue?.() ?? ctx.value;",'ctx.setValue?.("\u65B0\u503C");']},record:{description:"\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF1B\u8868\u5355\u7ED1\u5B9A\u8BB0\u5F55\u65F6\u53EF\u7528\uFF09\u3002",detail:"Record<string, any>"},form:{description:"Ant Design Form \u5B9E\u4F8B\uFF0C\u53EF\u8BFB\u5199\u5176\u5B83\u5B57\u6BB5\u3002",detail:"FormInstance"},formValues:{description:"\u5F53\u524D\u8868\u5355\u503C\u5FEB\u7167\uFF08\u5BF9\u8C61\uFF09\u3002\u9700\u8981\u6700\u65B0\u503C\u53EF\u7528 ctx.form.getFieldsValue()\u3002",detail:"Record<string, any>"},namePath:{description:"\u5B57\u6BB5\u5728\u8868\u5355\u4E2D\u7684 namePath\uFF08\u6570\u7EC4\uFF09\u3002",detail:"Array<string | number>"},disabled:"\u662F\u5426\u7981\u7528\uFF08boolean\uFF09",readOnly:"\u662F\u5426\u53EA\u8BFB\uFF08boolean\uFF09"},methods:{getValue:{description:"\u83B7\u53D6\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EF\u7F16\u8F91\u5B57\u6BB5\u63A8\u8350\u4F7F\u7528\uFF09\u3002",detail:"() => any",completion:{insertText:"ctx.getValue?.()"}},setValue:{description:"\u8BBE\u7F6E\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u4E0E\u8868\u5355\u53CC\u5411\u7ED1\u5B9A\uFF09\u3002",detail:"(value: any) => void",completion:{insertText:"ctx.setValue?.(value)"},examples:["ctx.setValue?.(e.target.value);"]}}},{locale:"zh-CN"})}}]);
@@ -1,16 +1,16 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4327,113,7087],{67087:function(f,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return o}});var l=e(72004),r=e.n(l),t=e(12444),s=e.n(t),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 s()(this,_),c.apply(this,arguments)}return r()(_)}(i.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([[4327,113,7087],{67087:function(f,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return _}});var l=e(72004),t=e.n(l),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),m=e.n(d),i=e(67946),_=function(c){u()(o,c);var b=m()(o);function o(){return s()(this,o),b.apply(this,arguments)}return t()(o)}(i.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"})},40113:function(f,n,e){e.r(n),e.d(n,{JSFieldRunJSContext:function(){return o}});var l=e(72004),r=e.n(l),t=e(12444),s=e.n(t),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 s()(this,_),c.apply(this,arguments)}return r()(_)}(i.Uo);o.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),t=e.n(l),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),m=e.n(d),i=e(67946),_=function(c){u()(o,c);var b=m()(o);function o(){return s()(this,o),b.apply(this,arguments)}return t()(o)}(i.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 })`}}),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"})},65:function(f,n,e){e.r(n);var l=e(40113),r=e(67087),t={contexts:[l.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-num",label:"Display number field as localized number",description:"Format numeric values with locale-aware separators before rendering",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u672C\u5730\u5316\u683C\u5F0F",description:"\u6309\u672C\u5730\u5316\u683C\u5F0F\u8F93\u51FA\u6570\u503C"}},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"})},65:function(f,n,e){e.r(n);var l=e(40113),t=e(67087),r={contexts:[l.JSFieldRunJSContext,t.FormJSFieldItemRunJSContext],prefix:"sn-jsf-num",label:"Display number field as localized number",description:"Format numeric values with locale-aware separators before rendering",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u672C\u5730\u5316\u683C\u5F0F",description:"\u6309\u672C\u5730\u5316\u683C\u5F0F\u8F93\u51FA\u6570\u503C"}},content:`
13
13
  // Format number using locale
14
14
  const n = Number(ctx.value ?? 0);
15
15
  ctx.element.innerHTML = String(Number.isFinite(n) ? n.toLocaleString() : ctx.value ?? '');
16
- `};n.default=t}}]);
16
+ `};n.default=r}}]);
@@ -1,15 +1,15 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4351,113,7087],{67087:function(f,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return o}});var l=e(72004),t=e.n(l),s=e(12444),r=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(67946),o=function(c){d()(_,c);var b=i()(_);function _(){return r()(this,_),b.apply(this,arguments)}return t()(_)}(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([[4351,113,7087],{67087:function(f,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return _}});var t=e(72004),l=e.n(t),s=e(12444),r=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 r()(this,o),b.apply(this,arguments)}return l()(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" })`}}),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"})},40113:function(f,n,e){e.r(n),e.d(n,{JSFieldRunJSContext:function(){return o}});var l=e(72004),t=e.n(l),s=e(12444),r=e.n(s),a=e(31996),d=e.n(a),u=e(26037),i=e.n(u),m=e(67946),o=function(c){d()(_,c);var b=i()(_);function _(){return r()(this,_),b.apply(this,arguments)}return t()(_)}(m.Uo);o.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 t=e(72004),l=e.n(t),s=e(12444),r=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 r()(this,o),b.apply(this,arguments)}return l()(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 })`}}),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"})},4351:function(f,n,e){e.r(n);var l=e(40113),t=e(67087),s={contexts:[l.JSFieldRunJSContext,t.FormJSFieldItemRunJSContext],prefix:"sn-jsf-value",label:"Display text field as highlighted text",description:"Render the current text field value with simple highlight styling",locales:{"zh-CN":{label:"\u5C06\u6587\u672C\u5B57\u6BB5\u663E\u793A\u4E3A\u9AD8\u4EAE\u6587\u672C",description:"\u5C06\u5B57\u6BB5\u503C\u5199\u5165\u5BB9\u5668\u5E76\u6DFB\u52A0\u9AD8\u4EAE\u6837\u5F0F"}},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"})},4351:function(f,n,e){e.r(n);var t=e(40113),l=e(67087),s={contexts:[t.JSFieldRunJSContext,l.FormJSFieldItemRunJSContext],prefix:"sn-jsf-value",label:"Display text field as highlighted text",description:"Render the current text field value with simple highlight styling",locales:{"zh-CN":{label:"\u5C06\u6587\u672C\u5B57\u6BB5\u663E\u793A\u4E3A\u9AD8\u4EAE\u6587\u672C",description:"\u5C06\u5B57\u6BB5\u503C\u5199\u5165\u5BB9\u5668\u5E76\u6DFB\u52A0\u9AD8\u4EAE\u6837\u5F0F"}},content:`
13
13
  const v = String(ctx.value ?? '');
14
14
  ctx.element.innerHTML = \`<span class="nb-js-field-value" style="color:#1890ff;font-weight:600">\${v}</span>\`;
15
15
  `};n.default=s}}]);
@@ -1,9 +1,9 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4356,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),s=e(12444),l=e.n(s),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 l()(this,o),p.apply(this,arguments)}return _()(o)}(m.Uo);r.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4356,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),l=e(12444),s=e.n(l),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:"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)`"}}),r.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"})},24356:function(a,n,e){e.r(n);var t=e(10095),_={contexts:[t.JSBlockRunJSContext],prefix:"sn-react-jsx",label:"Render React (JSX)",description:"Render a simple React component using JSX syntax",locales:{"zh-CN":{label:"\u6E32\u67D3 React\uFF08JSX\uFF09",description:"\u4F7F\u7528 JSX \u8BED\u6CD5\u6E32\u67D3\u4E00\u4E2A\u7B80\u5355\u7684 React \u7EC4\u4EF6"}},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`)."}}),r.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"})},24356:function(a,n,e){e.r(n);var t=e(10095),_={contexts:[t.JSBlockRunJSContext],prefix:"sn-react-jsx",label:"Render React (JSX)",description:"Render a simple React component using JSX syntax",locales:{"zh-CN":{label:"\u6E32\u67D3 React\uFF08JSX\uFF09",description:"\u4F7F\u7528 JSX \u8BED\u6CD5\u6E32\u67D3\u4E00\u4E2A\u7B80\u5355\u7684 React \u7EC4\u4EF6"}},content:`
7
7
  // Render a React component with JSX
8
8
  const { React } = ctx.libs;
9
9
 
@@ -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(67946),_=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(67946),_=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),t=e.n(l),r=e(12444),s=e.n(r),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 s()(this,o),b.apply(this,arguments)}return t()(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(67946),_=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),t=e.n(l),r=e(12444),s=e.n(r),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 s()(this,o),b.apply(this,arguments)}return t()(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),t=e(67087),r={contexts:[l.JSFieldRunJSContext,t.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
16
  ctx.element.innerHTML = '<span style=' + JSON.stringify('color:' + color) + '>' + String(ctx.value ?? '') + '</span>';
17
- `};o.default=s}}]);
17
+ `};n.default=r}}]);
@@ -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}}]);