@nocobase/app 2.1.0-alpha.1 → 2.1.0-alpha.2

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 (99) hide show
  1. package/client/.umirc.ts +6 -1
  2. package/client/src/pages/index.tsx +2 -0
  3. package/dist/client/{113.736e29a0.async.js → 113.470c21ad.async.js} +1 -1
  4. package/dist/client/1161.1a2c10e3.async.js +40 -0
  5. package/dist/client/1442.fd65d046.async.js +5 -0
  6. package/dist/client/{1595.9f992743.async.js → 1595.6281d837.async.js} +3 -3
  7. package/dist/client/{1758.eeeacf43.async.js → 1758.404cac6d.async.js} +3 -3
  8. package/dist/client/{1883.6ee256ab.async.js → 1883.7bf62549.async.js} +4 -4
  9. package/dist/client/1905.2e6345d8.async.js +12 -0
  10. package/dist/client/{2042.feb4b9ac.async.js → 2042.7da1cbfb.async.js} +1 -1
  11. package/dist/client/{2097.919e4d8a.async.js → 2097.469d41dd.async.js} +2 -2
  12. package/dist/client/{2380.900b7a22.async.js → 2380.ce39cb9d.async.js} +12 -9
  13. package/dist/client/2612.99f32922.async.js +22 -0
  14. package/dist/client/{2775.455c3402.async.js → 2775.364c188c.async.js} +8 -8
  15. package/dist/client/2936.745e500f.async.js +28 -0
  16. package/dist/client/3357.0dc001fc.async.js +28 -0
  17. package/dist/client/341.01fc2262.async.js +28 -0
  18. package/dist/client/{3451.a9466e73.async.js → 3451.29052272.async.js} +6 -6
  19. package/dist/client/3781.16f1bb74.async.js +1 -0
  20. package/dist/client/4279.f53ade52.async.js +1 -0
  21. package/dist/client/{4327.68c0f17b.async.js → 4327.d9c9bdf4.async.js} +5 -5
  22. package/dist/client/{4351.efe05af2.async.js → 4351.40ef71f0.async.js} +5 -5
  23. package/dist/client/{4356.d61392c6.async.js → 4356.a3863dfa.async.js} +2 -2
  24. package/dist/client/4727.09926a61.async.js +1 -0
  25. package/dist/client/{4750.ce3051f3.async.js → 4750.0863f7b1.async.js} +2 -2
  26. package/dist/client/{4926.58238954.async.js → 4926.f49ba56d.async.js} +6 -6
  27. package/dist/client/501.e8db2401.async.js +1 -0
  28. package/dist/client/{5013.b14730ba.async.js → 5013.eaaaceb4.async.js} +1 -1
  29. package/dist/client/5501.7bed1ac8.async.js +23 -0
  30. package/dist/client/5662.3071d144.async.js +26 -0
  31. package/dist/client/6021.b3ab345b.async.js +22 -0
  32. package/dist/client/{645.ab5af584.async.js → 645.b70364b3.async.js} +3 -3
  33. package/dist/client/{6474.49632e37.async.js → 6474.8e54befa.async.js} +1 -1
  34. package/dist/client/6534.87203710.async.js +33 -0
  35. package/dist/client/{6747.de538558.async.js → 6747.1009bdb8.async.js} +12 -7
  36. package/dist/client/{689.4de33d65.async.js → 689.4dc252d6.async.js} +1 -1
  37. package/dist/client/{6920.497d7e80.async.js → 6920.d29cfa84.async.js} +5 -5
  38. package/dist/client/6998.e875a954.async.js +62 -0
  39. package/dist/client/{703.7ad807b0.async.js → 703.8c09e144.async.js} +3 -3
  40. package/dist/client/7087.e5b68989.async.js +6 -0
  41. package/dist/client/{7483.546ddcb6.async.js → 7483.c3bd056f.async.js} +4 -4
  42. package/dist/client/7534.1a42bafc.async.js +36 -0
  43. package/dist/client/{7764.a3ae7727.async.js → 7764.f7b626cb.async.js} +2 -2
  44. package/dist/client/816.4e92dc2c.async.js +1 -0
  45. package/dist/client/{8183.4c6f7e21.async.js → 8183.5418c6c8.async.js} +1 -1
  46. package/dist/client/{8408.c0ef773c.async.js → 8408.455572b7.async.js} +5 -6
  47. package/dist/client/{8805.819c4f44.async.js → 8805.00cfa044.async.js} +6 -6
  48. package/dist/client/{9042.3d21f631.async.js → 9042.9568dd16.async.js} +7 -7
  49. package/dist/client/{908.0e8c8a54.async.js → 908.4b088a69.async.js} +2 -3
  50. package/dist/client/{9317.fe6ffa9a.async.js → 9317.7d0009d1.async.js} +2 -2
  51. package/dist/client/935.63a37ee3.async.js +27 -0
  52. package/dist/client/{95.24aa76c4.async.js → 95.cf18a56e.async.js} +2 -2
  53. package/dist/client/{9547.a442df93.async.js → 9547.a9f2ea1d.async.js} +23 -6
  54. package/dist/client/{9801.34b13a74.async.js → 9801.dacad822.async.js} +1 -1
  55. package/dist/client/9844.b905f4ce.async.js +37 -0
  56. package/dist/client/index.html +5 -2
  57. package/dist/client/index.html.tpl +5 -2
  58. package/dist/client/{npm._at_ant-design.3d565a45.async.js → npm._at_ant-design.4fb666c7.async.js} +3 -3
  59. package/dist/client/npm._at_budibase.2d91cea2.async.js +36 -0
  60. package/dist/client/{npm._at_codemirror.23366286.async.js → npm._at_codemirror.aa828743.async.js} +10 -10
  61. package/dist/client/{npm.antd.601f2259.async.js → npm.antd.d7898d85.async.js} +13 -13
  62. package/dist/client/{npm.dagre-d3-es.5506d747.async.js → npm.dagre-d3-es.a13ce21a.async.js} +1 -1
  63. package/dist/client/{npm.highlight.js.5db864c8.async.js → npm.highlight.js.763ebb2d.async.js} +2 -2
  64. package/dist/client/{npm.lodash-es.d3d83c5d.async.js → npm.lodash-es.9fd92a41.async.js} +1 -1
  65. package/dist/client/npm.mathjs.7874451c.async.js +53 -0
  66. package/dist/client/npm.mermaid.952e77a0.async.js +1556 -0
  67. package/dist/client/{npm.rc-picker.baba6981.async.js → npm.rc-picker.95a28587.async.js} +1 -1
  68. package/dist/client/{npm.sanitize-html.506a0a55.async.js → npm.sanitize-html.2df959dd.async.js} +14 -14
  69. package/dist/client/{npm.slate-react.ef6881ab.async.js → npm.slate-react.f9b7bba3.async.js} +1 -1
  70. package/dist/client/npm.slate.6a5d16e1.async.js +1 -0
  71. package/dist/client/npm.typed-function.9df0469b.async.js +1 -0
  72. package/dist/client/p__index.0b274666.async.js +2697 -0
  73. package/dist/client/{umi.9bdf4cb0.js → umi.b520fbf8.js} +2 -2
  74. package/package.json +6 -6
  75. package/dist/client/1161.0b3b5766.async.js +0 -40
  76. package/dist/client/1442.be509f94.async.js +0 -5
  77. package/dist/client/1905.ff0793ff.async.js +0 -12
  78. package/dist/client/2612.0865e67e.async.js +0 -19
  79. package/dist/client/2936.902710e4.async.js +0 -28
  80. package/dist/client/3357.be95167c.async.js +0 -28
  81. package/dist/client/341.fba65e23.async.js +0 -28
  82. package/dist/client/3885.fd54a10c.async.js +0 -50
  83. package/dist/client/4727.0f6df8fb.async.js +0 -1
  84. package/dist/client/501.72b99d17.async.js +0 -1
  85. package/dist/client/5501.22d50b3a.async.js +0 -23
  86. package/dist/client/5662.8c643e63.async.js +0 -26
  87. package/dist/client/6021.cdefa0d3.async.js +0 -22
  88. package/dist/client/6534.6ea6468b.async.js +0 -33
  89. package/dist/client/7087.5646e199.async.js +0 -6
  90. package/dist/client/7534.0d69e071.async.js +0 -34
  91. package/dist/client/816.b71d5e67.async.js +0 -1
  92. package/dist/client/935.97d45ffa.async.js +0 -27
  93. package/dist/client/9844.6f484975.async.js +0 -37
  94. package/dist/client/npm._at_budibase.b1200847.async.js +0 -36
  95. package/dist/client/npm.mathjs.fd97f3b7.async.js +0 -52
  96. package/dist/client/npm.mermaid.91e7e45d.async.js +0 -1556
  97. package/dist/client/npm.slate.44c32547.async.js +0 -1
  98. package/dist/client/npm.uuid.15e7bb90.async.js +0 -1
  99. package/dist/client/p__index.ca249387.async.js +0 -2505
package/client/.umirc.ts CHANGED
@@ -25,15 +25,20 @@ export default defineConfig({
25
25
  ? `
26
26
  window['__nocobase_public_path__'] = "${process.env.APP_PUBLIC_PATH || '/'}";
27
27
  window['__nocobase_dev_public_path__'] = "/";
28
+ window['__esm_cdn_base_url__'] = '${process.env.ESM_CDN_BASE_URL || ''}';
29
+ window['__esm_cdn_suffix__'] = '${process.env.ESM_CDN_SUFFIX || ''}';
28
30
  `
29
31
  : `
30
- window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
32
+ window['__webpack_public_path__'] = '{{env.CDN_BASE_URL}}';
31
33
  window['__nocobase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
32
34
  window['__nocobase_api_base_url__'] = '{{env.API_BASE_URL}}';
33
35
  window['__nocobase_api_client_storage_prefix__'] = '{{env.API_CLIENT_STORAGE_PREFIX}}';
34
36
  window['__nocobase_api_client_storage_type__'] = '{{env.API_CLIENT_STORAGE_TYPE}}';
37
+ window['__nocobase_api_client_share_token__'] = {{env.API_CLIENT_SHARE_TOKEN}};
35
38
  window['__nocobase_ws_url__'] = '{{env.WS_URL}}';
36
39
  window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
40
+ window['__esm_cdn_base_url__'] = '{{env.ESM_CDN_BASE_URL}}';
41
+ window['__esm_cdn_suffix__'] = '{{env.ESM_CDN_SUFFIX}}';
37
42
  `,
38
43
  },
39
44
  {
@@ -13,6 +13,8 @@ import devDynamicImport from '../.plugins/index';
13
13
 
14
14
  export const app = new Application({
15
15
  apiClient: {
16
+ // @ts-ignore
17
+ shareToken: window['__nocobase_api_client_share_token__'] || process.env.API_CLIENT_SHARE_TOKEN === 'true',
16
18
  storageType:
17
19
  // @ts-ignore
18
20
  window['__nocobase_api_client_storage_type__'] || process.env.API_CLIENT_STORAGE_TYPE || 'localStorage',
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[113],{40113:function(h,o,e){e.r(o),e.d(o,{JSFieldRunJSContext:function(){return n}});var l=e(72004),a=e.n(l),t=e(12444),r=e.n(t),s=e(31996),u=e.n(s),d=e(26037),i=e.n(d),m=e(1772),n=function(c){u()(_,c);var b=i()(_);function _(){return r()(this,_),b.apply(this,arguments)}return a()(_)}(m.Uo);n.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[113],{40113:function(h,o,e){e.r(o),e.d(o,{JSFieldRunJSContext:function(){return n}});var l=e(72004),a=e.n(l),t=e(12444),r=e.n(t),s=e(31996),u=e.n(s),d=e(26037),i=e.n(d),m=e(67946),n=function(c){u()(_,c);var b=i()(_);function _(){return r()(this,_),b.apply(this,arguments)}return a()(_)}(m.Uo);n.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
2
2
  Supports innerHTML, append, and other DOM manipulation methods.`,value:`Current value of the field (read-only).
3
3
  Contains the data value stored in this field.`,record:`Current record data object (read-only).
4
4
  Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
@@ -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.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,12 +1,12 @@
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(1772),_=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
- const res = await ctx.api.request({
9
+ const res = await ctx.request({
10
10
  url: 'users:list',
11
11
  method: 'get',
12
12
  params: {
@@ -1,5 +1,5 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1758],{51758:function(s,e,n){n.r(e);var a={contexts:["*"],prefix:"sn-require",label:"Load AMD module",description:"Dynamically load an AMD/RequireJS module by URL",locales:{"zh-CN":{label:"\u52A0\u8F7D AMD \u6A21\u5757",description:"\u901A\u8FC7 RequireJS \u6309 URL \u52A8\u6001\u52A0\u8F7D AMD \u6A21\u5757"}},content:`
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1758],{51758:function(s,e,a){a.r(e);var n={contexts:["*"],prefix:"sn-require",label:"Load AMD module",description:"Dynamically load an AMD/RequireJS module by URL",locales:{"zh-CN":{label:"\u52A0\u8F7D AMD \u6A21\u5757",description:"\u901A\u8FC7 RequireJS \u6309 URL \u52A8\u6001\u52A0\u8F7D AMD \u6A21\u5757"}},content:`
2
2
  // Load an external library (AMD/RequireJS)
3
- const dayjs = await ctx.requireAsync('https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js');
3
+ const dayjs = await ctx.requireAsync('dayjs@1/dayjs.min.js');
4
4
  console.log('dayjs loaded:', dayjs?.default || dayjs);
5
- `};e.default=a}}]);
5
+ `};e.default=n}}]);
@@ -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(1772),_=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';
@@ -12,6 +12,6 @@ iframe.style.width = '100%';
12
12
  iframe.style.height = '100%';
13
13
  iframe.style.border = 'none';
14
14
 
15
- // Replace existing children so the iframe is the only content
16
- ctx.element.replaceChildren(iframe);
15
+ // Render the iframe as the only content
16
+ ctx.render(iframe);
17
17
  `};n.default=r}}]);
@@ -0,0 +1,12 @@
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
+ 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"})},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
+ ctx.render(\`
7
+ <div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6;">
8
+ <h3 style="color: #1890ff; margin: 0 0 12px 0; font-size: 18px; font-weight: 600;">\${ctx.t('JS Item')}</h3>
9
+ <div style="color:#555">\${ctx.t('This area is rendered by your JavaScript code.')}</div>
10
+ </div>
11
+ \`);
12
+ `};n.default=t}}]);
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2042,689],{689:function(l,_,e){e.r(_),e.d(_,{JSCollectionActionRunJSContext:function(){return t}});var n=e(72004),s=e.n(n),r=e(12444),u=e.n(r),a=e(31996),c=e.n(a),i=e(26037),d=e.n(i),m=e(1772),t=function(b){c()(o,b);var C=d()(o);function o(){return u()(this,o),C.apply(this,arguments)}return s()(o)}(m.Uo);t.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2042,689],{689:function(l,_,e){e.r(_),e.d(_,{JSCollectionActionRunJSContext:function(){return t}});var n=e(72004),s=e.n(n),r=e(12444),u=e.n(r),a=e(31996),c=e.n(a),i=e(26037),d=e.n(i),m=e(67946),t=function(b){c()(o,b);var C=d()(o);function o(){return u()(this,o),C.apply(this,arguments)}return s()(o)}(m.Uo);t.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
2
2
  Use ctx.resource.selectedRows to get selected records.
3
3
  Use ctx.resource.pagination for page info.`}}),t.define({label:"JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{resource:"\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"}},{locale:"zh-CN"})},32042:function(l,_,e){e.r(_);var n=e(689),s={contexts:[n.JSCollectionActionRunJSContext],prefix:"sn-act-selected-count",label:"Selected count",description:"Show number of selected rows in list action",locales:{"zh-CN":{label:"\u9009\u4E2D\u6570\u91CF",description:"\u63D0\u793A\u5F53\u524D\u9009\u4E2D\u884C\u7684\u6570\u91CF"}},content:`
4
4
  const rows = ctx.resource?.getSelectedRows?.() || [];
@@ -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(1772),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(
@@ -1,15 +1,18 @@
1
- "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2380,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),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(1772),r=function(b){c()(t,b);var p=u()(t);function t(){return s()(this,t),p.apply(this,arguments)}return _()(t)}(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([[2380,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),c=e(31996),i=e.n(c),d=e(26037),u=e.n(d),m=e(67946),r=function(b){i()(t,b);var p=u()(t);function t(){return s()(this,t),p.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"})},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
- ctx.element.innerHTML = \`
9
- <button id="nb-jsb-btn" style="padding:6px 12px">\${ctx.t('Click me')}</button>
10
- \`;
11
- const btn = document.getElementById('nb-jsb-btn');
12
- if (btn) {
13
- btn.addEventListener('click', () => ctx.message.success(ctx.t('Clicked!')));
14
- }
8
+ const button = document.createElement('button');
9
+ button.textContent = ctx.t('Click me');
10
+ button.style.padding = '6px 12px';
11
+ button.addEventListener('click', () => ctx.message.success(ctx.t('Clicked!')));
12
+
13
+ const wrapper = document.createElement('div');
14
+ wrapper.style.padding = '12px';
15
+ wrapper.appendChild(button);
16
+
17
+ ctx.render(wrapper);
15
18
  `};n.default=_}}]);
@@ -0,0 +1,22 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2612,4727],{64727:function(l,n,e){e.r(n),e.d(n,{JSColumnRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),a=e(12444),s=e.n(a),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(67946),r=function(b){c()(o,b);var p=u()(o);function o(){return s()(this,o),p.apply(this,arguments)}return _()(o)}(m.Uo);r.define({label:"JSColumn RunJS context",properties:{element:"ElementProxy instance providing a safe DOM container for the current table cell. Supports innerHTML/append and basic DOM APIs.",record:"Current row record object (read-only).",recordIndex:"Index of the current row in the page (0-based).",collection:"Collection definition metadata (read-only).",viewer:"View controller providing dialog/drawer/embed helpers for interactions initiated from the cell (e.g., open details).",React:"React library",antd:"Ant Design library"},methods:{onRefReady:"Wait for cell DOM element to be ready before executing callback. Parameters: (ref, callback, timeout?) => void",requireAsync:"Load external library by URL: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module by URL: `const mod = await ctx.importAsync(url)`"}}),r.define({label:"JS \u5217 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",record:"\u5F53\u524D\u884C\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF09",recordIndex:"\u5F53\u524D\u884C\u7D22\u5F15\uFF08\u4ECE 0 \u5F00\u59CB\uFF09",collection:"\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF09",viewer:"\u89C6\u56FE\u63A7\u5236\u5668\uFF0C\u53EF\u7528\u4E8E\u5728\u5355\u5143\u683C\u4E2D\u89E6\u53D1\u62BD\u5C49/\u5BF9\u8BDD\u6846/\u5185\u5D4C\u7B49\u4EA4\u4E92",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u7B49\u5F85\u5355\u5143\u683C DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)",requireAsync:"\u6309 URL \u5F02\u6B65\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},82612:function(l,n,e){e.r(n);var t=e(64727),_={contexts:[t.JSColumnRunJSContext],prefix:"sn-col-open-dialog",label:"Cell dialog with row data",description:"Render a button in cell to open dialog via ctx.openView with current row context",locales:{"zh-CN":{label:"\u5355\u5143\u683C\u5BF9\u8BDD\u6846\uFF08\u663E\u793A\u884C\u6570\u636E\uFF09",description:"\u5728\u5355\u5143\u683C\u6E32\u67D3\u6309\u94AE\uFF0C\u70B9\u51FB\u540E\u901A\u8FC7 ctx.openView \u6253\u5F00\u5F39\u7A97\u5E76\u4F20\u5165\u5F53\u524D\u884C\u4E0A\u4E0B\u6587"}},content:`
2
+ // Render a button inside the cell
3
+ const button = document.createElement('button');
4
+ button.className = 'nb-cell-btn';
5
+ button.style.padding = '4px 8px';
6
+ button.textContent = ctx.t('View');
7
+ const popupUid = ctx.model.uid + '-1'; // popupUid should be stable and better bound to ctx.model.uid
8
+ const primaryKey = ctx.collection?.primaryKey || 'id';
9
+
10
+ button?.addEventListener('click', async () => {
11
+ await ctx.openView(popupUid, {
12
+ mode: 'dialog',
13
+ title: ctx.t('Row detail'),
14
+ params: {
15
+ filterByTk: ctx.record?.[primaryKey],
16
+ record: ctx.record,
17
+ },
18
+ });
19
+ });
20
+
21
+ ctx.render(button);
22
+ `};n.default=_}}]);
@@ -1,19 +1,19 @@
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(1772),_=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(1772),_=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)) {
16
- ctx.element.innerHTML = '-';
16
+ ctx.render('-');
17
17
  return;
18
18
  }
19
19
 
@@ -29,7 +29,7 @@ const getColor = (val) => {
29
29
 
30
30
  const color = getColor(percent);
31
31
 
32
- ctx.element.innerHTML = \`
32
+ ctx.render(\`
33
33
  <div style="display: flex; align-items: center; gap: 8px;">
34
34
  <div style="flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;">
35
35
  <div style="
@@ -43,5 +43,5 @@ ctx.element.innerHTML = \`
43
43
  \${percent.toFixed(1)}%
44
44
  </span>
45
45
  </div>
46
- \`;
47
- `};o.default=r}}]);
46
+ \`);
47
+ `};o.default=l}}]);
@@ -0,0 +1,28 @@
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
+ 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"})},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
+ const targetFieldUid = 'FIELD_UID_OR_NAME';
7
+ const required = 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({ required });
23
+ ctx.message?.success?.(
24
+ ctx.t(required ? 'Set field {{name}} as required' : 'Field {{name}} is optional', {
25
+ name: fieldModel?.props?.label || targetFieldUid,
26
+ }),
27
+ );
28
+ `};n.default=r}}]);
@@ -0,0 +1,28 @@
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
+ 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"})},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
+ const targetFieldUid = 'FIELD_UID_OR_NAME';
7
+ const shouldHide = 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({ hiddenModel: shouldHide });
23
+ ctx.message?.success?.(
24
+ ctx.t(shouldHide ? 'Hidden field {{name}}' : 'Shown field {{name}}', {
25
+ name: fieldModel?.props?.label || targetFieldUid,
26
+ }),
27
+ );
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,11 +1,11 @@
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(1772),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
- const { data } = await ctx.api.request({
8
+ const { data } = await ctx.request({
9
9
  url: 'users:list',
10
10
  method: 'get',
11
11
  params: { pageSize: 5 },
@@ -13,12 +13,12 @@ const { data } = await ctx.api.request({
13
13
  const rows = Array.isArray(data?.data) ? data.data : (Array.isArray(data) ? data : []);
14
14
 
15
15
  // Render as a simple HTML list
16
- ctx.element.innerHTML = [
16
+ ctx.render([
17
17
  '<div style="padding:12px">',
18
18
  '<h4 style="margin:0 0 8px">' + ctx.t('Users') + '</h4>',
19
19
  '<ul style="margin:0; padding-left:20px">',
20
20
  ...rows.map((r, i) => '<li>#' + (i + 1) + ': ' + String((r && (r.nickname ?? r.username ?? r.id)) ?? '') + '</li>'),
21
21
  '</ul>',
22
22
  '</div>'
23
- ].join('');
24
- `};n.default=r}}]);
23
+ ].join(''));
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"})}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4279],{74279:function(o){function f(){}f.prototype={on:function(n,r,e){var t=this.e||(this.e={});return(t[n]||(t[n]=[])).push({fn:r,ctx:e}),this},once:function(n,r,e){var t=this;function s(){t.off(n,s),r.apply(e,arguments)}return s._=r,this.on(n,s,e)},emit:function(n){var r=[].slice.call(arguments,1),e=((this.e||(this.e={}))[n]||[]).slice(),t=0,s=e.length;for(t;t<s;t++)e[t].fn.apply(e[t].ctx,r);return this},off:function(n,r){var e=this.e||(this.e={}),t=e[n],s=[];if(t&&r)for(var i=0,h=t.length;i<h;i++)t[i].fn!==r&&t[i].fn._!==r&&s.push(t[i]);return s.length?e[n]=s:delete e[n],this}},o.exports=f,o.exports.TinyEmitter=f}}]);
@@ -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(1772),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),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),_=function(c){u()(o,c);var b=m()(o);function o(){return s()(this,o),b.apply(this,arguments)}return r()(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(1772),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),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),_=function(c){u()(o,c);var b=m()(o);function o(){return s()(this,o),b.apply(this,arguments)}return r()(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),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:`
13
13
  // Format number using locale
14
14
  const n = Number(ctx.value ?? 0);
15
- ctx.element.innerHTML = String(Number.isFinite(n) ? n.toLocaleString() : ctx.value ?? '');
15
+ ctx.render(String(Number.isFinite(n) ? n.toLocaleString() : ctx.value ?? ''));
16
16
  `};n.default=t}}]);
@@ -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(1772),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(1772),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
- ctx.element.innerHTML = \`<span class="nb-js-field-value" style="color:#1890ff;font-weight:600">\${v}</span>\`;
14
+ ctx.render(\`<span class="nb-js-field-value" style="color:#1890ff;font-weight:600">\${v}</span>\`);
15
15
  `};n.default=s}}]);