@nocobase/app 2.0.60 → 2.0.62
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.
- package/dist/client/113.831ac6a5.async.js +7 -0
- package/dist/client/1161.642e74da.async.js +40 -0
- package/dist/client/1442.c27f741b.async.js +5 -0
- package/dist/client/1595.404be989.async.js +44 -0
- package/dist/client/1883.9fea02cf.async.js +17 -0
- package/dist/client/1905.517d6c21.async.js +12 -0
- package/dist/client/2097.b6edcf55.async.js +14 -0
- package/dist/client/2380.6ce35762.async.js +18 -0
- package/dist/client/2612.02bfe459.async.js +22 -0
- package/dist/client/2775.f856d6e1.async.js +47 -0
- package/dist/client/2936.1d087718.async.js +28 -0
- package/dist/client/3357.3f3bcb55.async.js +28 -0
- package/dist/client/341.b3dcaeaa.async.js +28 -0
- package/dist/client/3451.6ae8c407.async.js +24 -0
- package/dist/client/3781.ac6205ea.async.js +1 -0
- package/dist/client/4327.b6e18c14.async.js +16 -0
- package/dist/client/4351.01a446f7.async.js +15 -0
- package/dist/client/4356.4f3c326f.async.js +18 -0
- package/dist/client/4727.0b941280.async.js +1 -0
- package/dist/client/4750.e49cf86c.async.js +31 -0
- package/dist/client/4926.4250890b.async.js +17 -0
- package/dist/client/5501.9ec36683.async.js +23 -0
- package/dist/client/5662.07373cc2.async.js +26 -0
- package/dist/client/6021.0ccc90a2.async.js +22 -0
- package/dist/client/645.b2d175f4.async.js +55 -0
- package/dist/client/6534.5c0d5077.async.js +33 -0
- package/dist/client/6747.7020541a.async.js +27 -0
- package/dist/client/6920.515f6b57.async.js +59 -0
- package/dist/client/703.9c3bcc59.async.js +17 -0
- package/dist/client/7087.0b335cb8.async.js +6 -0
- package/dist/client/7483.ce5f7a24.async.js +23 -0
- package/dist/client/7534.55c90179.async.js +36 -0
- package/dist/client/7764.5741884c.async.js +25 -0
- package/dist/client/8408.73034abc.async.js +83 -0
- package/dist/client/8805.c1f34b9f.async.js +20 -0
- package/dist/client/9042.8ba2e8be.async.js +45 -0
- package/dist/client/935.ebd975fb.async.js +27 -0
- package/dist/client/95.341d19ce.async.js +6 -0
- package/dist/client/9547.d9afcc50.async.js +42 -0
- package/dist/client/9844.d7f15bf1.async.js +37 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/{p__index.b16725d2.async.js → p__index.ebb5f778.async.js} +314 -314
- package/dist/client/{umi.d1997bf2.js → umi.9bbad14a.js} +1 -1
- package/package.json +6 -6
- package/dist/client/113.470c21ad.async.js +0 -7
- package/dist/client/1161.1a2c10e3.async.js +0 -40
- package/dist/client/1442.fd65d046.async.js +0 -5
- package/dist/client/1595.6281d837.async.js +0 -44
- package/dist/client/1883.7bf62549.async.js +0 -17
- package/dist/client/1905.2e6345d8.async.js +0 -12
- package/dist/client/2097.469d41dd.async.js +0 -14
- package/dist/client/2380.ce39cb9d.async.js +0 -18
- package/dist/client/2612.99f32922.async.js +0 -22
- package/dist/client/2775.364c188c.async.js +0 -47
- package/dist/client/2936.745e500f.async.js +0 -28
- package/dist/client/3357.0dc001fc.async.js +0 -28
- package/dist/client/341.01fc2262.async.js +0 -28
- package/dist/client/3451.29052272.async.js +0 -24
- package/dist/client/3781.16f1bb74.async.js +0 -1
- package/dist/client/4327.d9c9bdf4.async.js +0 -16
- package/dist/client/4351.40ef71f0.async.js +0 -15
- package/dist/client/4356.a3863dfa.async.js +0 -18
- package/dist/client/4727.09926a61.async.js +0 -1
- package/dist/client/4750.0863f7b1.async.js +0 -31
- package/dist/client/4926.f49ba56d.async.js +0 -17
- package/dist/client/5501.7bed1ac8.async.js +0 -23
- package/dist/client/5662.3071d144.async.js +0 -26
- package/dist/client/6021.b3ab345b.async.js +0 -22
- package/dist/client/645.b70364b3.async.js +0 -55
- package/dist/client/6534.87203710.async.js +0 -33
- package/dist/client/6747.1009bdb8.async.js +0 -27
- package/dist/client/6920.d29cfa84.async.js +0 -59
- package/dist/client/703.8c09e144.async.js +0 -17
- package/dist/client/7087.e5b68989.async.js +0 -6
- package/dist/client/7483.c3bd056f.async.js +0 -23
- package/dist/client/7534.1a42bafc.async.js +0 -36
- package/dist/client/7764.f7b626cb.async.js +0 -25
- package/dist/client/8408.455572b7.async.js +0 -83
- package/dist/client/8805.00cfa044.async.js +0 -20
- package/dist/client/9042.9568dd16.async.js +0 -45
- package/dist/client/935.63a37ee3.async.js +0 -27
- package/dist/client/95.cf18a56e.async.js +0 -6
- package/dist/client/9547.a9f2ea1d.async.js +0 -42
- package/dist/client/9844.b905f4ce.async.js +0 -37
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[113],{40113:function(d,n,e){e.r(n),e.d(n,{JSFieldRunJSContext:function(){return a}});var r=e(72004),i=e.n(r),l=e(12444),s=e.n(l),t=e(31996),c=e.n(t),u=e(26037),m=e.n(u),p=e(67946),_=e(26180),a=function(b){c()(o,b);var f=m()(o);function o(){return s()(this,o),f.apply(this,arguments)}return i()(o)}(p.Uo);a.define({label:"JSField RunJS context",properties:{element:(0,_.X)(`ElementProxy instance providing a safe DOM container for field rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),value:`Current value of the field (read-only).
|
|
3
|
+
Contains the data value stored in this field.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
|
|
5
|
+
Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
|
|
6
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
7
|
+
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),a.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,_.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,n,e){e.d(n,{X:function(){return l},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)"}}},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:r}}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,40 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1161,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),r=e(31996),m=e.n(r),u=e(26037),_=e.n(u),p=e(67946),c=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,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 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}}},91161:function(d,t,e){e.r(t);var n=e(41442),o={contexts:[n.JSItemRunJSContext],prefix:"sn-link-cascade",label:"Cascade select (load child roles)",description:"Load child roles based on the selected parent role",locales:{"zh-CN":{label:"\u7EA7\u8054\u9009\u62E9\uFF08\u52A0\u8F7D\u5B50\u89D2\u8272\uFF09",description:"\u6839\u636E\u9009\u62E9\u7684\u7236\u89D2\u8272\u52A0\u8F7D\u5BF9\u5E94\u5B50\u89D2\u8272"}},content:`
|
|
6
|
+
// Get selected parent role (adjust field name to match your form)
|
|
7
|
+
const parentRoleId = ctx.record?.parentRole?.id;
|
|
8
|
+
|
|
9
|
+
if (!parentRoleId) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const res = await ctx.request({
|
|
14
|
+
url: 'roles:list',
|
|
15
|
+
method: 'get',
|
|
16
|
+
params: {
|
|
17
|
+
pageSize: 100,
|
|
18
|
+
filter: {
|
|
19
|
+
parentId: parentRoleId,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const childRoles = res?.data?.data || [];
|
|
25
|
+
|
|
26
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
27
|
+
const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
|
|
28
|
+
|
|
29
|
+
const roleField = candidates.find((item) => item?.props?.name === 'role');
|
|
30
|
+
|
|
31
|
+
if (roleField) {
|
|
32
|
+
roleField.setProps({
|
|
33
|
+
dataSource: childRoles.map((role) => ({
|
|
34
|
+
value: role.id,
|
|
35
|
+
label: role.name,
|
|
36
|
+
})),
|
|
37
|
+
value: undefined,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1442],{41442:function(_,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return a}});var o=e(72004),i=e.n(o),s=e(12444),l=e.n(s),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 f=m()(r);function r(){return l()(this,r),f.apply(this,arguments)}return i()(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(_,n,e){e.d(n,{X:function(){return s},k:function(){return l}});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 s(){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 l(){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,44 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1595,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}}},41595:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-timeline",label:"Render timeline from records",description:"Display records as a timeline using Ant Design Timeline",locales:{"zh-CN":{label:"\u6E32\u67D3\u65F6\u95F4\u8F74",description:"\u4F7F\u7528 Ant Design \u65F6\u95F4\u8F74\u7EC4\u4EF6\u663E\u793A\u8BB0\u5F55\u5386\u53F2"}},content:`
|
|
7
|
+
const { Timeline, Card } = ctx.libs.antd;
|
|
8
|
+
|
|
9
|
+
const res = await ctx.request({
|
|
10
|
+
url: 'users:list',
|
|
11
|
+
method: 'get',
|
|
12
|
+
params: {
|
|
13
|
+
pageSize: 20,
|
|
14
|
+
sort: ['-createdAt'],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const records = res?.data?.data || [];
|
|
19
|
+
|
|
20
|
+
if (!records.length) {
|
|
21
|
+
ctx.render('<div style="padding:16px;color:#999;">' + ctx.t('No data') + '</div>');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ctx.render(
|
|
26
|
+
<Card title={ctx.t('Activity Timeline')} bordered>
|
|
27
|
+
<Timeline mode="left">
|
|
28
|
+
{records.map((record) => (
|
|
29
|
+
<Timeline.Item
|
|
30
|
+
key={record.id}
|
|
31
|
+
label={record.createdAt ? new Date(record.createdAt).toLocaleString() : ''}
|
|
32
|
+
>
|
|
33
|
+
<div>
|
|
34
|
+
<strong>{record.nickname || record.username || ctx.t('Unnamed user')}</strong>
|
|
35
|
+
{record.email ? (
|
|
36
|
+
<div style={{ color: '#999', fontSize: '12px', marginTop: '4px' }}>{record.email}</div>
|
|
37
|
+
) : null}
|
|
38
|
+
</div>
|
|
39
|
+
</Timeline.Item>
|
|
40
|
+
))}
|
|
41
|
+
</Timeline>
|
|
42
|
+
</Card>
|
|
43
|
+
);
|
|
44
|
+
`};t.default=r}}]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1883,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),_=e.n(o),u=e(26037),m=e.n(u),p=e(67946),d=e(26180),a=function(b){_()(i,b);var f=m()(i);function i(){return s()(this,i),f.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}}},61883:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-iframe",label:"Render iframe",description:"Embed example.com as a sandboxed iframe inside the block element",locales:{"zh-CN":{label:"\u6E32\u67D3 iframe",description:"\u5728\u533A\u5757\u4E2D\u4EE5 sandbox \u9650\u5236\u5D4C\u5165 example.com \u9875\u9762"}},content:`
|
|
7
|
+
// Create an iframe that fills the current block container
|
|
8
|
+
const iframe = document.createElement('iframe');
|
|
9
|
+
iframe.src = 'https://example.com';
|
|
10
|
+
iframe.setAttribute('sandbox', 'allow-scripts');
|
|
11
|
+
iframe.style.width = '100%';
|
|
12
|
+
iframe.style.height = '100%';
|
|
13
|
+
iframe.style.border = 'none';
|
|
14
|
+
|
|
15
|
+
// Render the iframe as the only content
|
|
16
|
+
ctx.render(iframe);
|
|
17
|
+
`};t.default=r}}]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[1905,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),_=e.n(r),m=e(26037),u=e.n(m),p=e(67946),d=e(26180),a=function(f){_()(i,f);var b=u()(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}}},71905:function(c,t,e){e.r(t);var n=e(41442),o={contexts:[n.JSItemRunJSContext],prefix:"sn-jsitem-basic",label:"Render form item",description:"Render custom content inside a form item container",locales:{"zh-CN":{label:"\u6E32\u67D3\u8868\u5355\u9879",description:"\u5728\u8868\u5355\u9879\u5BB9\u5668\u4E2D\u6E32\u67D3\u81EA\u5B9A\u4E49\u5185\u5BB9"}},content:`
|
|
6
|
+
ctx.render(\`
|
|
7
|
+
<div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6;">
|
|
8
|
+
<h3 style="color: #1890ff; margin: 0 0 12px 0; font-size: 18px; font-weight: 600;">\${ctx.t('JS Item')}</h3>
|
|
9
|
+
<div style="color:#555">\${ctx.t('This area is rendered by your JavaScript code.')}</div>
|
|
10
|
+
</div>
|
|
11
|
+
\`);
|
|
12
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2097,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),u=e.n(r),_=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 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}}},82097:function(c,t,e){e.r(t);var n=e(10095),o={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-button",label:"Render button handler",description:"Render a button and handle click events inside the block",locales:{"zh-CN":{label:"\u6309\u94AE\u4E8B\u4EF6\u5904\u7406",description:"\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u5904\u7406\u903B\u8F91"}},content:`
|
|
7
|
+
const { Button } = ctx.libs.antd;
|
|
8
|
+
|
|
9
|
+
ctx.render(
|
|
10
|
+
<Button type="primary" onClick={() => ctx.message.success(ctx.t('Clicked!'))}>
|
|
11
|
+
{ctx.t('Button')}
|
|
12
|
+
</Button>
|
|
13
|
+
);
|
|
14
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2380,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),u=e.n(r),_=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 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}}},12380:function(c,t,e){e.r(t);var n=e(10095),o={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-click",label:"Add click listener",description:"Render a button and bind a click event handler",locales:{"zh-CN":{label:"\u6DFB\u52A0\u70B9\u51FB\u76D1\u542C",description:"\u6E32\u67D3\u6309\u94AE\u5E76\u7ED1\u5B9A\u70B9\u51FB\u4E8B\u4EF6\u5904\u7406"}},content:`
|
|
7
|
+
// Render a button and bind a click handler
|
|
8
|
+
const button = document.createElement('button');
|
|
9
|
+
button.textContent = ctx.t('Click me');
|
|
10
|
+
button.style.padding = '6px 12px';
|
|
11
|
+
button.addEventListener('click', () => ctx.message.success(ctx.t('Clicked!')));
|
|
12
|
+
|
|
13
|
+
const wrapper = document.createElement('div');
|
|
14
|
+
wrapper.style.padding = '12px';
|
|
15
|
+
wrapper.appendChild(button);
|
|
16
|
+
|
|
17
|
+
ctx.render(wrapper);
|
|
18
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2612,4727],{64727:function(c,t,e){e.r(t),e.d(t,{JSColumnRunJSContext:function(){return a}});var n=e(72004),o=e.n(n),l=e(12444),s=e.n(l),r=e(31996),u=e.n(r),_=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 o()(i)}(p.Uo);a.define({label:"JSColumn RunJS context",properties:{element:(0,d.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,d.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(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}}},82612:function(c,t,e){e.r(t);var n=e(64727),o={contexts:[n.JSColumnRunJSContext],prefix:"sn-col-open-dialog",label:"Cell dialog with row data",description:"Render a button in cell to open dialog via ctx.openView with current row context",locales:{"zh-CN":{label:"\u5355\u5143\u683C\u5BF9\u8BDD\u6846\uFF08\u663E\u793A\u884C\u6570\u636E\uFF09",description:"\u5728\u5355\u5143\u683C\u6E32\u67D3\u6309\u94AE\uFF0C\u70B9\u51FB\u540E\u901A\u8FC7 ctx.openView \u6253\u5F00\u5F39\u7A97\u5E76\u4F20\u5165\u5F53\u524D\u884C\u4E0A\u4E0B\u6587"}},content:`
|
|
2
|
+
// Render a button inside the cell
|
|
3
|
+
const button = document.createElement('button');
|
|
4
|
+
button.className = 'nb-cell-btn';
|
|
5
|
+
button.style.padding = '4px 8px';
|
|
6
|
+
button.textContent = ctx.t('View');
|
|
7
|
+
const popupUid = ctx.model.uid + '-1'; // popupUid should be stable and better bound to ctx.model.uid
|
|
8
|
+
const primaryKey = ctx.collection?.primaryKey || 'id';
|
|
9
|
+
|
|
10
|
+
button?.addEventListener('click', async () => {
|
|
11
|
+
await ctx.openView(popupUid, {
|
|
12
|
+
mode: 'dialog',
|
|
13
|
+
title: ctx.t('Row detail'),
|
|
14
|
+
params: {
|
|
15
|
+
filterByTk: ctx.record?.[primaryKey],
|
|
16
|
+
record: ctx.record,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
ctx.render(button);
|
|
22
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2775,113,7087],{67087:function(d,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),a=e.n(l),s=e(31996),u=e.n(s),c=e(26037),m=e.n(c),p=e(67946),_=e(26180),i=function(b){u()(t,b);var f=m()(t);function t(){return a()(this,t),f.apply(this,arguments)}return r()(t)}(p.Uo);i.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,_.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,_.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,n,e){e.r(n),e.d(n,{JSFieldRunJSContext:function(){return i}});var o=e(72004),r=e.n(o),l=e(12444),a=e.n(l),s=e(31996),u=e.n(s),c=e(26037),m=e.n(c),p=e(67946),_=e(26180),i=function(b){u()(t,b);var f=m()(t);function t(){return a()(this,t),f.apply(this,arguments)}return r()(t)}(p.Uo);i.define({label:"JSField RunJS context",properties:{element:(0,_.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,_.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,n,e){e.d(n,{X:function(){return l},k:function(){return a}});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 a(){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}}},72775:function(d,n,e){e.r(n);var o=e(40113),r=e(67087),l={contexts:[o.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-percent",label:"Display number field as percentage bar",description:"Render numeric values as a percentage progress bar",locales:{"zh-CN":{label:"\u5C06\u6570\u5B57\u5B57\u6BB5\u663E\u793A\u4E3A\u767E\u5206\u6BD4\u8FDB\u5EA6\u6761",description:"\u5C06\u6570\u5B57\u683C\u5F0F\u5316\u4E3A\u767E\u5206\u6BD4\u5E76\u663E\u793A\u8FDB\u5EA6\u6761"}},content:`
|
|
13
|
+
const value = Number(ctx.value ?? 0);
|
|
14
|
+
|
|
15
|
+
if (!Number.isFinite(value)) {
|
|
16
|
+
ctx.render('-');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Ensure value is between 0 and 100
|
|
21
|
+
const percent = Math.max(0, Math.min(100, value));
|
|
22
|
+
|
|
23
|
+
// Color based on value
|
|
24
|
+
const getColor = (val) => {
|
|
25
|
+
if (val >= 80) return '#52c41a';
|
|
26
|
+
if (val >= 50) return '#faad14';
|
|
27
|
+
return '#f5222d';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const color = getColor(percent);
|
|
31
|
+
|
|
32
|
+
ctx.render(\`
|
|
33
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
34
|
+
<div style="flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden;">
|
|
35
|
+
<div style="
|
|
36
|
+
width: \${percent}%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
background: \${color};
|
|
39
|
+
transition: width 0.3s ease;
|
|
40
|
+
"></div>
|
|
41
|
+
</div>
|
|
42
|
+
<span style="color: \${color}; font-weight: 500; min-width: 45px; text-align: right;">
|
|
43
|
+
\${percent.toFixed(1)}%
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
\`);
|
|
47
|
+
`};n.default=l}}]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[2936,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),u=e.n(o),_=e(26037),m=e.n(_),p=e(67946),c=e(26180),a=function(f){u()(i,f);var b=m()(i);function i(){return l()(this,i),b.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}}},42936:function(d,t,e){e.r(t);var n=e(41442),r={contexts:[n.JSItemRunJSContext],prefix:"sn-link-required",label:"Set required",description:"Toggle required rule for another field within linkage",locales:{"zh-CN":{label:"\u8BBE\u7F6E\u5FC5\u586B",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u63A7\u5236\u5B57\u6BB5\u662F\u5426\u5FC5\u586B"}},content:`
|
|
6
|
+
const targetFieldUid = 'FIELD_UID_OR_NAME';
|
|
7
|
+
const required = true;
|
|
8
|
+
|
|
9
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
10
|
+
const candidates = Array.isArray(items)
|
|
11
|
+
? items
|
|
12
|
+
: Array.from(items?.values?.() || items || []);
|
|
13
|
+
const fieldModel =
|
|
14
|
+
candidates.find((item) => item?.uid === targetFieldUid) ||
|
|
15
|
+
candidates.find((item) => item?.props?.name === targetFieldUid);
|
|
16
|
+
|
|
17
|
+
if (!fieldModel) {
|
|
18
|
+
ctx.message?.warning?.(ctx.t('Field {{name}} not found', { name: targetFieldUid }));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fieldModel.setProps({ required });
|
|
23
|
+
ctx.message?.success?.(
|
|
24
|
+
ctx.t(required ? 'Set field {{name}} as required' : 'Field {{name}} is optional', {
|
|
25
|
+
name: fieldModel?.props?.label || targetFieldUid,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
`};t.default=r}}]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3357,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),_=e.n(i),m=e(26037),u=e.n(m),p=e(67946),c=e(26180),a=function(f){_()(r,f);var b=u()(r);function r(){return l()(this,r),b.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}}},93357:function(d,t,e){e.r(t);var n=e(41442),o={contexts:[n.JSItemRunJSContext],prefix:"sn-link-visibility",label:"Toggle visible",description:"Show or hide another field within linkage scripts",locales:{"zh-CN":{label:"\u5207\u6362\u53EF\u89C1\u6027",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u8BBE\u7F6E\u5B57\u6BB5\u663E\u793A\u6216\u9690\u85CF"}},content:`
|
|
6
|
+
const targetFieldUid = 'FIELD_UID_OR_NAME';
|
|
7
|
+
const shouldHide = true;
|
|
8
|
+
|
|
9
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
10
|
+
const candidates = Array.isArray(items)
|
|
11
|
+
? items
|
|
12
|
+
: Array.from(items?.values?.() || items || []);
|
|
13
|
+
const fieldModel =
|
|
14
|
+
candidates.find((item) => item?.uid === targetFieldUid) ||
|
|
15
|
+
candidates.find((item) => item?.props?.name === targetFieldUid);
|
|
16
|
+
|
|
17
|
+
if (!fieldModel) {
|
|
18
|
+
ctx.message?.warning?.(ctx.t('Field {{name}} not found', { name: targetFieldUid }));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fieldModel.setProps({ hiddenModel: shouldHide });
|
|
23
|
+
ctx.message?.success?.(
|
|
24
|
+
ctx.t(shouldHide ? 'Hidden field {{name}}' : 'Shown field {{name}}', {
|
|
25
|
+
name: fieldModel?.props?.label || targetFieldUid,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[341,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),r=e(31996),_=e.n(r),m=e(26037),u=e.n(m),p=e(67946),c=e(26180),a=function(b){_()(i,b);var f=u()(i);function i(){return l()(this,i),f.apply(this,arguments)}return o()(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)"}}},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}}},10341:function(d,t,e){e.r(t);var n=e(41442),o={contexts:[n.JSItemRunJSContext],prefix:"sn-link-disable",label:"Set disabled",description:"Enable or disable another field in linkage scripts",locales:{"zh-CN":{label:"\u8BBE\u7F6E\u7981\u7528",description:"\u5728\u8054\u52A8\u811A\u672C\u4E2D\u542F\u7528\u6216\u7981\u7528\u5B57\u6BB5"}},content:`
|
|
6
|
+
const targetFieldUid = 'FIELD_UID_OR_NAME';
|
|
7
|
+
const disabled = true;
|
|
8
|
+
|
|
9
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
10
|
+
const candidates = Array.isArray(items)
|
|
11
|
+
? items
|
|
12
|
+
: Array.from(items?.values?.() || items || []);
|
|
13
|
+
const fieldModel =
|
|
14
|
+
candidates.find((item) => item?.uid === targetFieldUid) ||
|
|
15
|
+
candidates.find((item) => item?.props?.name === targetFieldUid);
|
|
16
|
+
|
|
17
|
+
if (!fieldModel) {
|
|
18
|
+
ctx.message?.warning?.(ctx.t('Field {{name}} not found', { name: targetFieldUid }));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fieldModel.setProps({ disabled });
|
|
23
|
+
ctx.message?.success?.(
|
|
24
|
+
ctx.t(disabled ? 'Disabled field {{name}}' : 'Enabled field {{name}}', {
|
|
25
|
+
name: fieldModel?.props?.label || targetFieldUid,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
`};t.default=o}}]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3451,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),i=e(31996),u=e.n(i),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),a=function(b){u()(o,b);var y=m()(o);function o(){return s()(this,o),y.apply(this,arguments)}return r()(o)}(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 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 s(){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:r}}},3451:function(c,t,e){e.r(t);var n=e(10095),r={contexts:[n.JSBlockRunJSContext],prefix:"sn-jsb-fetch-list",label:"Fetch & render list",description:"Fetch a small list via ctx.api and render basic HTML",locales:{"zh-CN":{label:"\u62C9\u53D6\u5E76\u6E32\u67D3\u5217\u8868",description:"\u4F7F\u7528 ctx.api \u62C9\u53D6\u5C11\u91CF\u6570\u636E\uFF0C\u5E76\u6E32\u67D3\u57FA\u7840 HTML \u5217\u8868"}},content:`
|
|
7
|
+
// Fetch users
|
|
8
|
+
const { data } = await ctx.request({
|
|
9
|
+
url: 'users:list',
|
|
10
|
+
method: 'get',
|
|
11
|
+
params: { pageSize: 5 },
|
|
12
|
+
});
|
|
13
|
+
const rows = Array.isArray(data?.data) ? data.data : (Array.isArray(data) ? data : []);
|
|
14
|
+
|
|
15
|
+
// Render as a simple HTML list
|
|
16
|
+
ctx.render([
|
|
17
|
+
'<div style="padding:12px">',
|
|
18
|
+
'<h4 style="margin:0 0 8px">' + ctx.t('Users') + '</h4>',
|
|
19
|
+
'<ul style="margin:0; padding-left:20px">',
|
|
20
|
+
...rows.map((r, i) => '<li>#' + (i + 1) + ': ' + String((r && (r.nickname ?? r.username ?? r.id)) ?? '') + '</li>'),
|
|
21
|
+
'</ul>',
|
|
22
|
+
'</div>'
|
|
23
|
+
].join(''));
|
|
24
|
+
`};t.default=r}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[3781],{43781:function(c,n,e){e.r(n),e.d(n,{JSEditableFieldRunJSContext:function(){return a}});var r=e(72004),o=e.n(r),l=e(12444),s=e.n(l),t=e(31996),u=e.n(t),_=e(26037),m=e.n(_),p=e(67946),d=e(26180),a=function(b){u()(i,b);var v=m()(i);function i(){return s()(this,i),v.apply(this,arguments)}return o()(i)}(p.Uo);a.define({label:"JSEditableField RunJS context",properties:{element:(0,d.X)("ElementProxy instance providing a safe DOM container for field rendering. In editable mode this container is typically a <span> element."),value:{description:"Current field value (read-only snapshot). In editable scenarios, prefer ctx.getValue()/ctx.setValue(v) for two-way binding.",detail:"any",examples:["const v = ctx.getValue?.() ?? ctx.value;",'ctx.setValue?.("new value");']},record:{description:"Current record data object (read-only). Available in forms that are bound to a record.",detail:"Record<string, any>"},form:{description:'Ant Design Form instance for reading/writing other fields. Example: ctx.form.getFieldValue("name")',detail:"FormInstance"},formValues:{description:"Snapshot of current form values (object). Prefer ctx.form.getFieldsValue() when you need the latest values.",detail:"Record<string, any>"},namePath:{description:"Field namePath in the form (array). Useful for advanced Form operations.",detail:"Array<string | number>"},disabled:"Whether the field is disabled (boolean).",readOnly:"Whether the field is read-only (boolean)."},methods:{getValue:{description:"Get current field value (recommended for editable custom fields).",detail:"() => any",completion:{insertText:"ctx.getValue?.()"}},setValue:{description:"Set current field value (two-way binding with the form).",detail:"(value: any) => void",completion:{insertText:"ctx.setValue?.(value)"},examples:["ctx.setValue?.(e.target.value);"]}}}),a.define({label:"JS \u53EF\u7F16\u8F91\u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:(0,d.k)("ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002"),value:{description:"\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\u5FEB\u7167\uFF09\u3002\u53EF\u7F16\u8F91\u573A\u666F\u5EFA\u8BAE\u4F7F\u7528 ctx.getValue()/ctx.setValue(v) \u505A\u53CC\u5411\u7ED1\u5B9A\u3002",detail:"any",examples:["const v = ctx.getValue?.() ?? ctx.value;",'ctx.setValue?.("\u65B0\u503C");']},record:{description:"\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF1B\u8868\u5355\u7ED1\u5B9A\u8BB0\u5F55\u65F6\u53EF\u7528\uFF09\u3002",detail:"Record<string, any>"},form:{description:"Ant Design Form \u5B9E\u4F8B\uFF0C\u53EF\u8BFB\u5199\u5176\u5B83\u5B57\u6BB5\u3002",detail:"FormInstance"},formValues:{description:"\u5F53\u524D\u8868\u5355\u503C\u5FEB\u7167\uFF08\u5BF9\u8C61\uFF09\u3002\u9700\u8981\u6700\u65B0\u503C\u53EF\u7528 ctx.form.getFieldsValue()\u3002",detail:"Record<string, any>"},namePath:{description:"\u5B57\u6BB5\u5728\u8868\u5355\u4E2D\u7684 namePath\uFF08\u6570\u7EC4\uFF09\u3002",detail:"Array<string | number>"},disabled:"\u662F\u5426\u7981\u7528\uFF08boolean\uFF09",readOnly:"\u662F\u5426\u53EA\u8BFB\uFF08boolean\uFF09"},methods:{getValue:{description:"\u83B7\u53D6\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EF\u7F16\u8F91\u5B57\u6BB5\u63A8\u8350\u4F7F\u7528\uFF09\u3002",detail:"() => any",completion:{insertText:"ctx.getValue?.()"}},setValue:{description:"\u8BBE\u7F6E\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u4E0E\u8868\u5355\u53CC\u5411\u7ED1\u5B9A\uFF09\u3002",detail:"(value: any) => void",completion:{insertText:"ctx.setValue?.(value)"},examples:["ctx.setValue?.(e.target.value);"]}}},{locale:"zh-CN"})},26180:function(c,n,e){e.d(n,{X:function(){return l},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)"}}},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 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:r}}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:o}}}}]);
|