@nocobase/app 2.0.60 → 2.0.61

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 (85) hide show
  1. package/dist/client/113.831ac6a5.async.js +7 -0
  2. package/dist/client/1161.642e74da.async.js +40 -0
  3. package/dist/client/1442.c27f741b.async.js +5 -0
  4. package/dist/client/1595.404be989.async.js +44 -0
  5. package/dist/client/1883.9fea02cf.async.js +17 -0
  6. package/dist/client/1905.517d6c21.async.js +12 -0
  7. package/dist/client/2097.b6edcf55.async.js +14 -0
  8. package/dist/client/2380.6ce35762.async.js +18 -0
  9. package/dist/client/2612.02bfe459.async.js +22 -0
  10. package/dist/client/2775.f856d6e1.async.js +47 -0
  11. package/dist/client/2936.1d087718.async.js +28 -0
  12. package/dist/client/3357.3f3bcb55.async.js +28 -0
  13. package/dist/client/341.b3dcaeaa.async.js +28 -0
  14. package/dist/client/3451.6ae8c407.async.js +24 -0
  15. package/dist/client/3781.ac6205ea.async.js +1 -0
  16. package/dist/client/4327.b6e18c14.async.js +16 -0
  17. package/dist/client/4351.01a446f7.async.js +15 -0
  18. package/dist/client/4356.4f3c326f.async.js +18 -0
  19. package/dist/client/4727.0b941280.async.js +1 -0
  20. package/dist/client/4750.e49cf86c.async.js +31 -0
  21. package/dist/client/4926.4250890b.async.js +17 -0
  22. package/dist/client/5501.9ec36683.async.js +23 -0
  23. package/dist/client/5662.07373cc2.async.js +26 -0
  24. package/dist/client/6021.0ccc90a2.async.js +22 -0
  25. package/dist/client/645.b2d175f4.async.js +55 -0
  26. package/dist/client/6534.5c0d5077.async.js +33 -0
  27. package/dist/client/6747.7020541a.async.js +27 -0
  28. package/dist/client/6920.515f6b57.async.js +59 -0
  29. package/dist/client/703.9c3bcc59.async.js +17 -0
  30. package/dist/client/7087.0b335cb8.async.js +6 -0
  31. package/dist/client/7483.ce5f7a24.async.js +23 -0
  32. package/dist/client/7534.55c90179.async.js +36 -0
  33. package/dist/client/7764.5741884c.async.js +25 -0
  34. package/dist/client/8408.73034abc.async.js +83 -0
  35. package/dist/client/8805.c1f34b9f.async.js +20 -0
  36. package/dist/client/9042.8ba2e8be.async.js +45 -0
  37. package/dist/client/935.ebd975fb.async.js +27 -0
  38. package/dist/client/95.341d19ce.async.js +6 -0
  39. package/dist/client/9547.d9afcc50.async.js +42 -0
  40. package/dist/client/9844.d7f15bf1.async.js +37 -0
  41. package/dist/client/index.html +1 -1
  42. package/dist/client/index.html.tpl +1 -1
  43. package/dist/client/{p__index.b16725d2.async.js → p__index.9a5f5b1a.async.js} +323 -323
  44. package/dist/client/{umi.d1997bf2.js → umi.dac06e7c.js} +1 -1
  45. package/package.json +6 -6
  46. package/dist/client/113.470c21ad.async.js +0 -7
  47. package/dist/client/1161.1a2c10e3.async.js +0 -40
  48. package/dist/client/1442.fd65d046.async.js +0 -5
  49. package/dist/client/1595.6281d837.async.js +0 -44
  50. package/dist/client/1883.7bf62549.async.js +0 -17
  51. package/dist/client/1905.2e6345d8.async.js +0 -12
  52. package/dist/client/2097.469d41dd.async.js +0 -14
  53. package/dist/client/2380.ce39cb9d.async.js +0 -18
  54. package/dist/client/2612.99f32922.async.js +0 -22
  55. package/dist/client/2775.364c188c.async.js +0 -47
  56. package/dist/client/2936.745e500f.async.js +0 -28
  57. package/dist/client/3357.0dc001fc.async.js +0 -28
  58. package/dist/client/341.01fc2262.async.js +0 -28
  59. package/dist/client/3451.29052272.async.js +0 -24
  60. package/dist/client/3781.16f1bb74.async.js +0 -1
  61. package/dist/client/4327.d9c9bdf4.async.js +0 -16
  62. package/dist/client/4351.40ef71f0.async.js +0 -15
  63. package/dist/client/4356.a3863dfa.async.js +0 -18
  64. package/dist/client/4727.09926a61.async.js +0 -1
  65. package/dist/client/4750.0863f7b1.async.js +0 -31
  66. package/dist/client/4926.f49ba56d.async.js +0 -17
  67. package/dist/client/5501.7bed1ac8.async.js +0 -23
  68. package/dist/client/5662.3071d144.async.js +0 -26
  69. package/dist/client/6021.b3ab345b.async.js +0 -22
  70. package/dist/client/645.b70364b3.async.js +0 -55
  71. package/dist/client/6534.87203710.async.js +0 -33
  72. package/dist/client/6747.1009bdb8.async.js +0 -27
  73. package/dist/client/6920.d29cfa84.async.js +0 -59
  74. package/dist/client/703.8c09e144.async.js +0 -17
  75. package/dist/client/7087.e5b68989.async.js +0 -6
  76. package/dist/client/7483.c3bd056f.async.js +0 -23
  77. package/dist/client/7534.1a42bafc.async.js +0 -36
  78. package/dist/client/7764.f7b626cb.async.js +0 -25
  79. package/dist/client/8408.455572b7.async.js +0 -83
  80. package/dist/client/8805.00cfa044.async.js +0 -20
  81. package/dist/client/9042.9568dd16.async.js +0 -45
  82. package/dist/client/935.63a37ee3.async.js +0 -27
  83. package/dist/client/95.cf18a56e.async.js +0 -6
  84. package/dist/client/9547.a9f2ea1d.async.js +0 -42
  85. package/dist/client/9844.b905f4ce.async.js +0 -37
@@ -0,0 +1,16 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4327,113,7087],{67087:function(d,t,e){e.r(t),e.d(t,{FormJSFieldItemRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for form field rendering.
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.`,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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
5
+ Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
6
+ Example: ctx.setProps(fieldModel, { value: "new value" })`}}),i.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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(d,t,e){e.r(t),e.d(t,{JSFieldRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"JSField RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for field rendering.
7
+ Supports innerHTML, append, and other DOM manipulation methods.`),value:`Current value of the field (read-only).
8
+ Contains the data value stored in this field.`,record:`Current record data object (read-only).
9
+ Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
12
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),i.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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"})},26180:function(d,t,e){e.d(t,{X:function(){return l},k:function(){return _}});var o={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:s,detail:"HTMLElement | ElementProxy",properties:o}}function _(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:s,detail:"HTMLElement | ElementProxy",properties:r}}},65:function(d,t,e){e.r(t);var o=e(40113),r=e(67087),l={contexts:[o.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
+ // Format number using locale
14
+ const n = Number(ctx.value ?? 0);
15
+ ctx.render(String(Number.isFinite(n) ? n.toLocaleString() : ctx.value ?? ''));
16
+ `};t.default=l}}]);
@@ -0,0 +1,15 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4351,113,7087],{67087:function(d,t,e){e.r(t),e.d(t,{FormJSFieldItemRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for form field rendering.
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.`,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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
5
+ Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
6
+ Example: ctx.setProps(fieldModel, { value: "new value" })`}}),i.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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(d,t,e){e.r(t),e.d(t,{JSFieldRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"JSField RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for field rendering.
7
+ Supports innerHTML, append, and other DOM manipulation methods.`),value:`Current value of the field (read-only).
8
+ Contains the data value stored in this field.`,record:`Current record data object (read-only).
9
+ Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
12
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),i.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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"})},26180:function(d,t,e){e.d(t,{X:function(){return l},k:function(){return _}});var o={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:s,detail:"HTMLElement | ElementProxy",properties:o}}function _(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:s,detail:"HTMLElement | ElementProxy",properties:r}}},4351:function(d,t,e){e.r(t);var o=e(40113),r=e(67087),l={contexts:[o.JSFieldRunJSContext,r.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
+ const v = String(ctx.value ?? '');
14
+ ctx.render(\`<span class="nb-js-field-value" style="color:#1890ff;font-weight:600">\${v}</span>\`);
15
+ `};t.default=l}}]);
@@ -0,0 +1,18 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4356,95],{10095:function(c,t,e){e.r(t),e.d(t,{JSBlockRunJSContext:function(){return a}});var n=e(72004),o=e.n(n),l=e(12444),s=e.n(l),r=e(31996),_=e.n(r),u=e(26037),m=e.n(u),p=e(67946),d=e(26180),a=function(b){_()(i,b);var y=m()(i);function i(){return s()(this,i),y.apply(this,arguments)}return o()(i)}(p.Uo);a.define({label:"RunJS context",properties:{element:(0,d.X)(`ElementProxy instance providing a safe DOM container.
2
+ Supports innerHTML, append, and other DOM manipulation methods.
3
+ Use this to render content in the JS block.`),record:`Current record data object (read-only).
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
+ 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 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:(0,d.k)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),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"})},26180:function(c,t,e){e.d(t,{X:function(){return l},k:function(){return s}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},o={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:r,detail:"HTMLElement | ElementProxy",properties:n}}function s(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:r,detail:"HTMLElement | ElementProxy",properties:o}}},24356:function(c,t,e){e.r(t);var n=e(10095),o={contexts:[n.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
+ // Render a React component with JSX
8
+ const { React } = ctx.libs;
9
+
10
+ const App = () => (
11
+ <div style={{ padding: 12 }}>
12
+ <h3 style={{ margin: 0, color: '#1890ff' }}>Hello JSX</h3>
13
+ <div style={{ color: '#555' }}>This block is rendered by JSX.</div>
14
+ </div>
15
+ );
16
+
17
+ ctx.render(<App />);
18
+ `};t.default=o}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4727],{64727:function(_,n,e){e.r(n),e.d(n,{JSColumnRunJSContext:function(){return a}});var o=e(72004),i=e.n(o),l=e(12444),s=e.n(l),t=e(31996),d=e.n(t),u=e(26037),m=e.n(u),p=e(67946),c=e(26180),a=function(b){d()(r,b);var y=m()(r);function r(){return s()(this,r),y.apply(this,arguments)}return i()(r)}(p.Uo);a.define({label:"JSColumn RunJS context",properties:{element:(0,c.X)("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)`"}}),a.define({label:"JS \u5217 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,c.k)("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"})},26180:function(_,n,e){e.d(n,{X:function(){return l},k:function(){return s}});var o={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},i={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:t,detail:"HTMLElement | ElementProxy",properties:o}}function s(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:t,detail:"HTMLElement | ElementProxy",properties:i}}}}]);
@@ -0,0 +1,31 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4750,95],{10095:function(c,t,e){e.r(t),e.d(t,{JSBlockRunJSContext:function(){return a}});var n=e(72004),r=e.n(n),l=e(12444),s=e.n(l),o=e(31996),u=e.n(o),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),a=function(b){u()(i,b);var x=m()(i);function i(){return s()(this,i),x.apply(this,arguments)}return r()(i)}(p.Uo);a.define({label:"RunJS context",properties:{element:(0,d.X)(`ElementProxy instance providing a safe DOM container.
2
+ Supports innerHTML, append, and other DOM manipulation methods.
3
+ Use this to render content in the JS block.`),record:`Current record data object (read-only).
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
+ 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 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:(0,d.k)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),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"})},26180:function(c,t,e){e.d(t,{X:function(){return l},k:function(){return s}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:o,detail:"HTMLElement | ElementProxy",properties:n}}function s(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:o,detail:"HTMLElement | ElementProxy",properties:r}}},24750:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.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
+ const { Card, Descriptions, Tag } = ctx.libs.antd;
8
+
9
+ if (!ctx.record) {
10
+ ctx.render('<div style="padding:16px;color:#999;">' + ctx.t('No record data') + '</div>');
11
+ return;
12
+ }
13
+
14
+ const record = ctx.record;
15
+
16
+ ctx.render(
17
+ <Card title={ctx.t('Record Details')} bordered style={{ margin: 0 }}>
18
+ <Descriptions column={2} size="small">
19
+ <Descriptions.Item label={ctx.t('ID')}>{record.id || '-'}</Descriptions.Item>
20
+ <Descriptions.Item label={ctx.t('Status')}>
21
+ <Tag color={record.status === 'active' ? 'green' : 'default'}>{record.status || '-'}</Tag>
22
+ </Descriptions.Item>
23
+ <Descriptions.Item label={ctx.t('Title')}>{record.title || '-'}</Descriptions.Item>
24
+ <Descriptions.Item label={ctx.t('Created At')}>
25
+ {record.createdAt ? new Date(record.createdAt).toLocaleString() : '-'}
26
+ </Descriptions.Item>
27
+ </Descriptions>
28
+ </Card>
29
+ );
30
+
31
+ `};t.default=r}}]);
@@ -0,0 +1,17 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4926,113,7087],{67087:function(d,t,e){e.r(t),e.d(t,{FormJSFieldItemRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for form field rendering.
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.`,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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
5
+ Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
6
+ Example: ctx.setProps(fieldModel, { value: "new value" })`}}),i.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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(d,t,e){e.r(t),e.d(t,{JSFieldRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),s=e(31996),u=e.n(s),m=e(26037),c=e.n(m),p=e(67946),a=e(26180),i=function(b){u()(n,b);var f=c()(n);function n(){return _()(this,n),f.apply(this,arguments)}return r()(n)}(p.Uo);i.define({label:"JSField RunJS context",properties:{element:(0,a.X)(`ElementProxy instance providing a safe DOM container for field rendering.
7
+ Supports innerHTML, append, and other DOM manipulation methods.`),value:`Current value of the field (read-only).
8
+ Contains the data value stored in this field.`,record:`Current record data object (read-only).
9
+ Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
12
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),i.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,a.k)("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"})},26180:function(d,t,e){e.d(t,{X:function(){return l},k:function(){return _}});var o={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:s,detail:"HTMLElement | ElementProxy",properties:o}}function _(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:s,detail:"HTMLElement | ElementProxy",properties:r}}},44926:function(d,t,e){e.r(t);var o=e(40113),r=e(67087),l={contexts:[o.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-color",label:"Display number field as colored text",description:"Display numeric values using colors based on their sign",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u5F69\u8272\u6587\u672C",description:"\u6839\u636E\u6570\u503C\u6B63\u8D1F\u8BBE\u7F6E\u663E\u793A\u989C\u8272"}},content:`
13
+ // Colorize based on numeric sign
14
+ const n = Number(ctx.value ?? 0);
15
+ const color = Number.isFinite(n) ? (n > 0 ? 'green' : n < 0 ? 'red' : '#999') : '#555';
16
+ ctx.render('<span style=' + JSON.stringify('color:' + color) + '>' + String(ctx.value ?? '') + '</span>');
17
+ `};t.default=l}}]);
@@ -0,0 +1,23 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5501,1442],{41442:function(d,t,e){e.r(t),e.d(t,{JSItemRunJSContext:function(){return a}});var n=e(72004),r=e.n(n),s=e(12444),l=e.n(s),o=e(31996),_=e.n(o),u=e(26037),m=e.n(u),p=e(67946),c=e(26180),a=function(f){_()(i,f);var v=m()(i);function i(){return l()(this,i),v.apply(this,arguments)}return r()(i)}(p.Uo);a.define({label:"JSItem RunJS context",properties:{element:(0,c.X)(`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`}}),a.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,c.k)("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"})},26180:function(d,t,e){e.d(t,{X:function(){return s},k:function(){return l}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function s(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:o,detail:"HTMLElement | ElementProxy",properties:n}}function l(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:o,detail:"HTMLElement | ElementProxy",properties:r}}},45501:function(d,t,e){e.r(t);var n=e(41442),r={contexts:[n.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
+ `};t.default=r}}]);
@@ -0,0 +1,26 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5662,1442],{41442:function(d,t,e){e.r(t),e.d(t,{JSItemRunJSContext:function(){return a}});var n=e(72004),o=e.n(n),s=e(12444),l=e.n(s),i=e(31996),m=e.n(i),_=e(26037),u=e.n(_),p=e(67946),c=e(26180),a=function(f){m()(r,f);var h=u()(r);function r(){return l()(this,r),h.apply(this,arguments)}return o()(r)}(p.Uo);a.define({label:"JSItem RunJS context",properties:{element:(0,c.X)(`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`}}),a.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,c.k)("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"})},26180:function(d,t,e){e.d(t,{X:function(){return s},k:function(){return l}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},o={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function s(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:i,detail:"HTMLElement | ElementProxy",properties:n}}function l(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:i,detail:"HTMLElement | ElementProxy",properties:o}}},75662:function(d,t,e){e.r(t);var n=e(41442),o={contexts:[n.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
+ `};t.default=o}}]);
@@ -0,0 +1,22 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6021,1442],{41442:function(c,t,e){e.r(t),e.d(t,{JSItemRunJSContext:function(){return a}});var n=e(72004),o=e.n(n),s=e(12444),l=e.n(s),r=e(31996),u=e.n(r),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),a=function(f){u()(i,f);var b=m()(i);function i(){return l()(this,i),b.apply(this,arguments)}return o()(i)}(p.Uo);a.define({label:"JSItem RunJS context",properties:{element:(0,d.X)(`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`}}),a.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,d.k)("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"})},26180:function(c,t,e){e.d(t,{X:function(){return s},k:function(){return l}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},o={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function s(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:r,detail:"HTMLElement | ElementProxy",properties:n}}function l(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:r,detail:"HTMLElement | ElementProxy",properties:o}}},96021:function(c,t,e){e.r(t);var n=e(41442),o={contexts:[n.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
+ `};t.default=o}}]);
@@ -0,0 +1,55 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[645,95],{10095:function(c,t,e){e.r(t),e.d(t,{JSBlockRunJSContext:function(){return a}});var n=e(72004),r=e.n(n),l=e(12444),s=e.n(l),o=e(31996),u=e.n(o),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),a=function(y){u()(i,y);var b=m()(i);function i(){return s()(this,i),b.apply(this,arguments)}return r()(i)}(p.Uo);a.define({label:"RunJS context",properties:{element:(0,d.X)(`ElementProxy instance providing a safe DOM container.
2
+ Supports innerHTML, append, and other DOM manipulation methods.
3
+ Use this to render content in the JS block.`),record:`Current record data object (read-only).
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
+ 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 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:(0,d.k)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),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"})},26180:function(c,t,e){e.d(t,{X:function(){return l},k:function(){return s}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:o,detail:"HTMLElement | ElementProxy",properties:n}}function s(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:o,detail:"HTMLElement | ElementProxy",properties:r}}},10645:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-stats",label:"Render statistics cards",description:"Display multiple statistic cards with numbers from API",locales:{"zh-CN":{label:"\u6E32\u67D3\u7EDF\u8BA1\u5361\u7247",description:"\u663E\u793A\u591A\u4E2A\u7EDF\u8BA1\u6570\u5B57\u5361\u7247\uFF08\u4ECE API \u83B7\u53D6\u6570\u636E\uFF09"}},content:`
7
+ const { Card, Statistic, Row, Col } = ctx.libs.antd;
8
+
9
+ const res = await ctx.request({
10
+ url: 'users:list',
11
+ method: 'get',
12
+ params: {
13
+ pageSize: 100,
14
+ appends: ['roles'],
15
+ },
16
+ });
17
+
18
+ const users = res?.data?.data || [];
19
+
20
+ const total = users.length;
21
+ const adminCount = users.filter((user) =>
22
+ Array.isArray(user?.roles) && user.roles.some((role) => role?.name === 'admin')
23
+ ).length;
24
+ const withEmail = users.filter((user) => !!user?.email).length;
25
+ const distinctRoles = new Set(
26
+ users
27
+ .flatMap((user) => (Array.isArray(user?.roles) ? user.roles.map((role) => role?.name) : []))
28
+ .filter(Boolean),
29
+ ).size;
30
+
31
+ ctx.render(
32
+ <Row gutter={16}>
33
+ <Col span={6}>
34
+ <Card>
35
+ <Statistic title={ctx.t('Total users')} value={total} valueStyle={{ color: '#3f8600' }} />
36
+ </Card>
37
+ </Col>
38
+ <Col span={6}>
39
+ <Card>
40
+ <Statistic title={ctx.t('Administrators')} value={adminCount} valueStyle={{ color: '#1890ff' }} />
41
+ </Card>
42
+ </Col>
43
+ <Col span={6}>
44
+ <Card>
45
+ <Statistic title={ctx.t('Users with email')} value={withEmail} valueStyle={{ color: '#faad14' }} />
46
+ </Card>
47
+ </Col>
48
+ <Col span={6}>
49
+ <Card>
50
+ <Statistic title={ctx.t('Distinct roles')} value={distinctRoles} valueStyle={{ color: '#cf1322' }} />
51
+ </Card>
52
+ </Col>
53
+ </Row>
54
+ );
55
+ `};t.default=r}}]);
@@ -0,0 +1,33 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6534,1442],{41442:function(c,t,e){e.r(t),e.d(t,{JSItemRunJSContext:function(){return a}});var n=e(72004),o=e.n(n),s=e(12444),l=e.n(s),r=e(31996),m=e.n(r),u=e(26037),_=e.n(u),p=e(67946),d=e(26180),a=function(f){m()(i,f);var b=_()(i);function i(){return l()(this,i),b.apply(this,arguments)}return o()(i)}(p.Uo);a.define({label:"JSItem RunJS context",properties:{element:(0,d.X)(`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`}}),a.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,d.k)("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"})},26180:function(c,t,e){e.d(t,{X:function(){return s},k:function(){return l}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},o={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function s(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:r,detail:"HTMLElement | ElementProxy",properties:n}}function l(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:r,detail:"HTMLElement | ElementProxy",properties:o}}},76534:function(c,t,e){e.r(t);var n=e(41442),o={contexts:[n.JSItemRunJSContext],prefix:"sn-link-copy",label:"Copy value from another field",description:"Copy value from one field to another when checkbox is checked",locales:{"zh-CN":{label:"\u590D\u5236\u5B57\u6BB5\u503C",description:"\u52FE\u9009\u590D\u9009\u6846\u65F6\uFF0C\u5C06\u4E00\u4E2A\u5B57\u6BB5\u7684\u503C\u590D\u5236\u5230\u53E6\u4E00\u4E2A\u5B57\u6BB5"}},content:`
6
+ // When 'sameAsAbove' is checked, copy billing address to shipping address
7
+ const sameAsAbove = ctx.record?.sameAsAbove;
8
+
9
+ if (!sameAsAbove) {
10
+ return;
11
+ }
12
+
13
+ const items = ctx.model?.subModels?.grid?.subModels?.items;
14
+ const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
15
+
16
+ // Source and target field mappings
17
+ const fieldMappings = [
18
+ { from: 'billingAddress', to: 'shippingAddress' },
19
+ { from: 'billingCity', to: 'shippingCity' },
20
+ { from: 'billingZipCode', to: 'shippingZipCode' },
21
+ ];
22
+
23
+ fieldMappings.forEach(({ from, to }) => {
24
+ const sourceValue = ctx.record?.[from];
25
+ const targetField = candidates.find((item) => item?.props?.name === to);
26
+
27
+ if (targetField) {
28
+ targetField.setProps({ value: sourceValue });
29
+ }
30
+ });
31
+
32
+ ctx.message?.success?.(ctx.t('Address copied successfully'));
33
+ `};t.default=o}}]);
@@ -0,0 +1,27 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6747,95,113,7087],{67087:function(E,t,e){e.r(t),e.d(t,{FormJSFieldItemRunJSContext:function(){return o}});var r=e(72004),l=e.n(r),_=e(12444),s=e.n(_),a=e(31996),d=e.n(a),u=e(26037),c=e.n(u),m=e(67946),i=e(26180),o=function(p){d()(n,p);var b=c()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,i.X)(`ElementProxy instance providing a safe DOM container for form field rendering.
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.`,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
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
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:(0,i.k)("ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668"),value:"\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",formValues:{description:"\u5F53\u524D\u8868\u5355\u503C\u5FEB\u7167\uFF08\u5BF9\u8C61\uFF09\u3002\u4EC5\u8868\u5355\u76F8\u5173\u4E0A\u4E0B\u6587\u53EF\u7528\uFF08Create/Edit Form\uFF09\u3002",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",setProps:"\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"}},{locale:"zh-CN"})},10095:function(E,t,e){e.r(t),e.d(t,{JSBlockRunJSContext:function(){return o}});var r=e(72004),l=e.n(r),_=e(12444),s=e.n(_),a=e(31996),d=e.n(a),u=e(26037),c=e.n(u),m=e(67946),i=e(26180),o=function(p){d()(n,p);var b=c()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"RunJS context",properties:{element:(0,i.X)(`ElementProxy instance providing a safe DOM container.
7
+ Supports innerHTML, append, and other DOM manipulation methods.
8
+ Use this to render content in the JS block.`),record:`Current record data object (read-only).
9
+ Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
10
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
11
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import an ESM module by URL: `const mod = await ctx.importAsync(url)`.\nNote: if the module has only a default export, ctx.importAsync returns that default value directly (no `.default`)."}}),o.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,i.k)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`\u3002\n\u6CE8\u610F\uFF1A\u5F53\u6A21\u5757\u53EA\u6709 default \u4E00\u4E2A\u5BFC\u51FA\u65F6\uFF0Cctx.importAsync \u4F1A\u76F4\u63A5\u8FD4\u56DE default \u503C\uFF08\u65E0\u9700\u518D\u5199 `.default`\uFF09\u3002"}},{locale:"zh-CN"})},40113:function(E,t,e){e.r(t),e.d(t,{JSFieldRunJSContext:function(){return o}});var r=e(72004),l=e.n(r),_=e(12444),s=e.n(_),a=e(31996),d=e.n(a),u=e(26037),c=e.n(u),m=e(67946),i=e(26180),o=function(p){d()(n,p);var b=c()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"JSField RunJS context",properties:{element:(0,i.X)(`ElementProxy instance providing a safe DOM container for field rendering.
12
+ Supports innerHTML, append, and other DOM manipulation methods.`),value:`Current value of the field (read-only).
13
+ Contains the data value stored in this field.`,record:`Current record data object (read-only).
14
+ Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
15
+ Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
16
+ Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
17
+ Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),o.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,i.k)("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"})},26180:function(E,t,e){e.d(t,{X:function(){return _},k:function(){return s}});var r={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},l={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function _(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:a,detail:"HTMLElement | ElementProxy",properties:r}}function s(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:a,detail:"HTMLElement | ElementProxy",properties:l}}},86747:function(E,t,e){e.r(t);var r=e(10095),l=e(40113),_=e(67087),s={contexts:[r.JSBlockRunJSContext,l.JSFieldRunJSContext,_.FormJSFieldItemRunJSContext],prefix:"sn-query-selector",label:"Query selector",description:"Find a child element inside rendered DOM using querySelector",locales:{"zh-CN":{label:"\u67E5\u8BE2\u5B50\u5143\u7D20",description:"\u4F7F\u7528 querySelector \u5728\u6E32\u67D3\u7684 DOM \u5185\u67E5\u627E\u5B50\u5143\u7D20"}},content:`
18
+ const wrapper = document.createElement('div');
19
+ wrapper.innerHTML = '<div class="child-class"></div>';
20
+
21
+ ctx.render(wrapper);
22
+
23
+ const child = wrapper.querySelector('.child-class');
24
+ if (child) {
25
+ child.textContent = ctx.t('Hello from querySelector');
26
+ }
27
+ `};t.default=s}}]);
@@ -0,0 +1,59 @@
1
+ "use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6920,95],{10095:function(c,t,e){e.r(t),e.d(t,{JSBlockRunJSContext:function(){return s}});var n=e(72004),r=e.n(n),a=e(12444),l=e.n(a),o=e(31996),u=e.n(o),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),s=function(b){u()(i,b);var h=m()(i);function i(){return l()(this,i),h.apply(this,arguments)}return r()(i)}(p.Uo);s.define({label:"RunJS context",properties:{element:(0,d.X)(`ElementProxy instance providing a safe DOM container.
2
+ Supports innerHTML, append, and other DOM manipulation methods.
3
+ Use this to render content in the JS block.`),record:`Current record data object (read-only).
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
+ 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 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`)."}}),s.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,d.k)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),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"})},26180:function(c,t,e){e.d(t,{X:function(){return a},k:function(){return l}});var n={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},r={innerHTML:"\u5DF2\u6D88\u6BD2\u7684 innerHTML \u5B57\u7B26\u4E32\u3002",outerHTML:"\u5DF2\u6D88\u6BD2\u7684 outerHTML \u5B57\u7B26\u4E32\u3002",textContent:"\u6587\u672C\u5185\u5BB9\u3002",style:"\u5185\u8054\u6837\u5F0F\u58F0\u660E\u3002",classList:"CSS class \u5217\u8868\u3002",appendChild:{type:"function",description:"\u8FFD\u52A0 DOM \u8282\u70B9\u6216\u6587\u672C\u3002",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"\u8BBE\u7F6E HTML \u5C5E\u6027\u3002",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"\u8BFB\u53D6 HTML \u5C5E\u6027\u3002",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"\u67E5\u8BE2\u7B2C\u4E00\u4E2A\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"\u67E5\u8BE2\u6240\u6709\u5339\u914D\u7684\u540E\u4EE3\u5143\u7D20\u3002",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"\u7ED9\u5143\u7D20\u6DFB\u52A0\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"\u79FB\u9664\u5143\u7D20\u4E8B\u4EF6\u76D1\u542C\u3002",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function a(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:o,detail:"HTMLElement | ElementProxy",properties:n}}function l(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"\u5F53\u524D RunJS \u4E0A\u4E0B\u6587\u7684 DOM \u5BB9\u5668\uFF0C\u901A\u5E38\u4E3A ElementProxy\u3002";return{description:o,detail:"HTMLElement | ElementProxy",properties:r}}},96920:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-chartjs",label:"Render Chart.js bar chart",description:"Load Chart.js from CDN and render a basic bar chart inside the block",locales:{"zh-CN":{label:"\u6E32\u67D3 Chart.js \u67F1\u72B6\u56FE",description:"\u901A\u8FC7 CDN \u5F15\u5165 Chart.js \u5E76\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u57FA\u7840\u67F1\u72B6\u56FE"}},content:`
7
+ const wrapper = document.createElement('div');
8
+ wrapper.style.padding = '16px';
9
+ wrapper.style.background = '#fff';
10
+ wrapper.style.borderRadius = '8px';
11
+ wrapper.style.boxShadow = '0 2px 8px rgba(0,0,0,0.05)';
12
+
13
+ const canvas = document.createElement('canvas');
14
+ canvas.width = 480;
15
+ canvas.height = 320;
16
+ wrapper.appendChild(canvas);
17
+ ctx.render(wrapper);
18
+
19
+ async function renderChart() {
20
+ const loaded = await ctx.requireAsync('chart.js@4.4.0/dist/chart.umd.min.js');
21
+ const Chart = loaded?.Chart || loaded?.default?.Chart || loaded?.default;
22
+ if (!Chart) {
23
+ throw new Error('Chart.js is not available');
24
+ }
25
+
26
+ const labels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
27
+ const data = [12, 18, 9, 15, 22];
28
+
29
+ new Chart(canvas.getContext('2d'), {
30
+ type: 'bar',
31
+ data: {
32
+ labels,
33
+ datasets: [
34
+ {
35
+ label: ctx.t('Daily visits'),
36
+ data,
37
+ backgroundColor: 'rgba(24, 144, 255, 0.6)',
38
+ borderColor: '#1890ff',
39
+ borderWidth: 1,
40
+ },
41
+ ],
42
+ },
43
+ options: {
44
+ plugins: {
45
+ legend: { display: true },
46
+ title: {
47
+ display: true,
48
+ text: ctx.t('Weekly overview'),
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+
55
+ renderChart().catch((error) => {
56
+ console.error('[RunJS] failed to render chart', error);
57
+ wrapper.innerHTML = '<div style="color:#c00;">' + (error?.message || ctx.t('Chart initialization failed')) + '</div>';
58
+ });
59
+ `};t.default=r}}]);