@nocobase/app 2.0.0-alpha.7 → 2.0.0-alpha.8
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.736e29a0.async.js +7 -0
- package/dist/client/1145.0351040a.async.js +3 -0
- package/dist/client/1161.0b3b5766.async.js +40 -0
- package/dist/client/1442.be509f94.async.js +5 -0
- package/dist/client/1595.1827ce7f.async.js +45 -0
- package/dist/client/1758.eeeacf43.async.js +5 -0
- package/dist/client/1883.6ee256ab.async.js +17 -0
- package/dist/client/1905.ff0793ff.async.js +12 -0
- package/dist/client/2042.feb4b9ac.async.js +10 -0
- package/dist/client/2097.5a49892c.async.js +12 -0
- package/dist/client/{2190.90c718a9.async.js → 2190.4f5395e5.async.js} +1 -1
- package/dist/client/2380.900b7a22.async.js +15 -0
- package/dist/client/2612.0865e67e.async.js +19 -0
- package/dist/client/2775.455c3402.async.js +47 -0
- package/dist/client/2936.902710e4.async.js +28 -0
- package/dist/client/3357.be95167c.async.js +28 -0
- package/dist/client/341.fba65e23.async.js +28 -0
- package/dist/client/3451.a9466e73.async.js +24 -0
- package/dist/client/4327.68c0f17b.async.js +16 -0
- package/dist/client/4351.efe05af2.async.js +15 -0
- package/dist/client/4666.fb83d11a.async.js +9 -0
- package/dist/client/4727.0f6df8fb.async.js +1 -0
- package/dist/client/4750.044f647b.async.js +32 -0
- package/dist/client/4926.58238954.async.js +17 -0
- package/dist/client/5013.b14730ba.async.js +3 -0
- package/dist/client/5501.22d50b3a.async.js +23 -0
- package/dist/client/5662.8c643e63.async.js +26 -0
- package/dist/client/5950.179a885e.async.js +4 -0
- package/dist/client/6021.cdefa0d3.async.js +22 -0
- package/dist/client/645.ea6376fe.async.js +60 -0
- package/dist/client/6474.49632e37.async.js +21 -0
- package/dist/client/6534.6ea6468b.async.js +33 -0
- package/dist/client/6747.de538558.async.js +22 -0
- package/dist/client/689.4de33d65.async.js +3 -0
- package/dist/client/6920.497d7e80.async.js +59 -0
- package/dist/client/6996.ae27c9d6.async.js +9 -0
- package/dist/client/703.20003a5c.async.js +17 -0
- package/dist/client/7087.5646e199.async.js +6 -0
- package/dist/client/7197.35a4b316.async.js +35 -0
- package/dist/client/7483.546ddcb6.async.js +23 -0
- package/dist/client/7534.0d69e071.async.js +34 -0
- package/dist/client/8183.4c6f7e21.async.js +12 -0
- package/dist/client/8408.c0ef773c.async.js +84 -0
- package/dist/client/8805.819c4f44.async.js +20 -0
- package/dist/client/9017.4ae5c322.async.js +6 -0
- package/dist/client/9042.3d21f631.async.js +45 -0
- package/dist/client/908.0e8c8a54.async.js +14 -0
- package/dist/client/9317.fe6ffa9a.async.js +13 -0
- package/dist/client/935.97d45ffa.async.js +27 -0
- package/dist/client/95.24aa76c4.async.js +6 -0
- package/dist/client/9547.a442df93.async.js +25 -0
- package/dist/client/9801.34b13a74.async.js +9 -0
- package/dist/client/9844.6f484975.async.js +37 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/{npm._at_umijs.47085d01.async.js → npm._at_umijs.f64c1387.async.js} +1 -1
- package/dist/client/{npm.highlight.js.c1f693ec.async.js → npm.highlight.js.d3beb708.async.js} +1 -1
- package/dist/client/{npm.htmlparser2.a2f8d64d.async.js → npm.htmlparser2.ee1fb042.async.js} +1 -1
- package/dist/client/p__index.25560ad9.async.js +2272 -0
- package/dist/client/{umi.743c1d73.js → umi.103d7bb8.js} +2 -2
- package/package.json +6 -6
- package/dist/client/1145.4029b0be.async.js +0 -3
- package/dist/client/1617.dd671a87.async.js +0 -6
- package/dist/client/1833.82373d30.async.js +0 -6
- package/dist/client/2134.1d86e440.async.js +0 -5
- package/dist/client/2498.be8b1194.async.js +0 -7
- package/dist/client/260.5b02a0a5.async.js +0 -4
- package/dist/client/2953.2e77d77c.async.js +0 -24
- package/dist/client/3170.6147bd19.async.js +0 -24
- package/dist/client/3255.e6303833.async.js +0 -10
- package/dist/client/3520.81fd6362.async.js +0 -24
- package/dist/client/3522.674f2264.async.js +0 -4
- package/dist/client/4088.0568ef31.async.js +0 -5
- package/dist/client/4205.c3eac46d.async.js +0 -9
- package/dist/client/4644.ae01f8a6.async.js +0 -4
- package/dist/client/4666.d20ff352.async.js +0 -8
- package/dist/client/4840.477401f9.async.js +0 -8
- package/dist/client/5068.72e9d750.async.js +0 -5
- package/dist/client/5087.468f5500.async.js +0 -6
- package/dist/client/5950.b83f8586.async.js +0 -4
- package/dist/client/6416.361c93ff.async.js +0 -4
- package/dist/client/6472.ac05f778.async.js +0 -7
- package/dist/client/6779.47fc1971.async.js +0 -10
- package/dist/client/6816.1ff200ac.async.js +0 -5
- package/dist/client/6996.836a3f7f.async.js +0 -8
- package/dist/client/7463.70ca58ce.async.js +0 -20
- package/dist/client/7522.1f91be5c.async.js +0 -23
- package/dist/client/7596.232a7185.async.js +0 -10
- package/dist/client/7688.85d6d7bb.async.js +0 -4
- package/dist/client/8106.829fd6b5.async.js +0 -10
- package/dist/client/8541.e3110aaa.async.js +0 -8
- package/dist/client/9017.28eacc5a.async.js +0 -6
- package/dist/client/937.a55819ab.async.js +0 -5
- package/dist/client/9462.ea2d8827.async.js +0 -35
- package/dist/client/9489.25ca39a9.async.js +0 -7
- package/dist/client/9663.c04b2ad1.async.js +0 -5
- package/dist/client/9729.0d7a5c47.async.js +0 -8
- package/dist/client/9848.18f8d3db.async.js +0 -4
- package/dist/client/p__index.900597dd.async.js +0 -2316
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5662,1442],{41442:function(a,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return t}});var _=e(72004),s=e.n(_),r=e(12444),l=e.n(r),d=e(31996),i=e.n(d),m=e(26037),u=e.n(m),c=e(1772),t=function(b){i()(o,b);var h=u()(o);function o(){return l()(this,o),h.apply(this,arguments)}return s()(o)}(c.Uo);t.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`},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`}}),t.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},75662:function(a,n,e){e.r(n);var _=e(41442),s={contexts:[_.JSItemRunJSContext],prefix:"sn-link-show-hide",label:"Show/hide fields based on condition",description:"Toggle multiple fields visibility based on a condition",locales:{"zh-CN":{label:"\u6761\u4EF6\u663E\u793A/\u9690\u85CF\u5B57\u6BB5",description:"\u6839\u636E\u6761\u4EF6\u6279\u91CF\u663E\u793A\u6216\u9690\u85CF\u591A\u4E2A\u5B57\u6BB5"}},content:`
|
|
6
|
+
// Show payment fields only when paymentMethod is 'online'
|
|
7
|
+
const paymentMethod = ctx.record?.paymentMethod;
|
|
8
|
+
const showPaymentFields = paymentMethod === 'online';
|
|
9
|
+
|
|
10
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
11
|
+
const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
|
|
12
|
+
|
|
13
|
+
// Fields to toggle
|
|
14
|
+
const fieldNames = ['creditCard', 'expiryDate', 'cvv'];
|
|
15
|
+
|
|
16
|
+
fieldNames.forEach((fieldName) => {
|
|
17
|
+
const field = candidates.find((item) => item?.props?.name === fieldName);
|
|
18
|
+
if (field) {
|
|
19
|
+
field.setProps({
|
|
20
|
+
display: showPaymentFields ? 'visible' : 'hidden',
|
|
21
|
+
// Also clear values when hiding
|
|
22
|
+
value: showPaymentFields ? field.props.value : undefined,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
`};n.default=s}}]);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5950],{45950:function(a,n,e){e.r(n);var o={contexts:["*"],prefix:"sn-window-open",label:"Open new window",description:"Safely open a new browser window/tab",locales:{"zh-CN":{label:"\u6253\u5F00\u65B0\u7A97\u53E3",description:"\u5B89\u5168\u5730\u6253\u5F00\u4E00\u4E2A\u65B0\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6216\u6807\u7B7E\u9875"}},content:`
|
|
2
|
+
// Open a new window/tab
|
|
3
|
+
window.open('https://example.com', '_blank');
|
|
4
|
+
`};n.default=o}}]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6021,1442],{41442:function(s,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),a=e(12444),l=e.n(a),u=e(31996),i=e.n(u),d=e(26037),m=e.n(d),c=e(1772),r=function(b){i()(o,b);var p=m()(o);function o(){return l()(this,o),p.apply(this,arguments)}return _()(o)}(c.Uo);r.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`},methods:{onRefReady:`Wait for form item container DOM element to be ready before executing callback.
|
|
5
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),r.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},96021:function(s,n,e){e.r(n);var t=e(41442),_={contexts:[t.JSItemRunJSContext],prefix:"sn-link-calc",label:"Calculate total price (quantity \xD7 price)",description:"Automatically calculate total when quantity or unit price changes",locales:{"zh-CN":{label:"\u8BA1\u7B97\u603B\u4EF7\uFF08\u6570\u91CF \xD7 \u5355\u4EF7\uFF09",description:"\u5F53\u6570\u91CF\u6216\u5355\u4EF7\u53D8\u5316\u65F6\u81EA\u52A8\u8BA1\u7B97\u603B\u4EF7"}},content:`
|
|
6
|
+
// Get quantity and unit price from current record
|
|
7
|
+
const quantity = Number(ctx.record?.quantity) || 0;
|
|
8
|
+
const unitPrice = Number(ctx.record?.unitPrice) || 0;
|
|
9
|
+
const total = quantity * unitPrice;
|
|
10
|
+
|
|
11
|
+
// Find and update the 'totalPrice' field
|
|
12
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
13
|
+
const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
|
|
14
|
+
|
|
15
|
+
const totalField = candidates.find((item) => item?.props?.name === 'totalPrice');
|
|
16
|
+
|
|
17
|
+
if (totalField) {
|
|
18
|
+
totalField.setProps({ value: total.toFixed(2) });
|
|
19
|
+
} else {
|
|
20
|
+
console.warn('[Form snippet] totalPrice field not found');
|
|
21
|
+
}
|
|
22
|
+
`};n.default=_}}]);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[645,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return s}});var o=e(72004),r=e.n(o),l=e(12444),_=e.n(l),i=e(31996),c=e.n(i),u=e(26037),d=e.n(u),m=e(1772),s=function(b){c()(t,b);var h=d()(t);function t(){return _()(this,t),h.apply(this,arguments)}return r()(t)}(m.Uo);s.define({label:"RunJS context",properties:{element:{description:`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.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},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 ESM module: `const mod = await ctx.importAsync(url)`"}}),s.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},10645:function(a,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-stats",label:"Render statistics cards",description:"Display multiple statistic cards with numbers from API",locales:{"zh-CN":{label:"\u6E32\u67D3\u7EDF\u8BA1\u5361\u7247",description:"\u663E\u793A\u591A\u4E2A\u7EDF\u8BA1\u6570\u5B57\u5361\u7247\uFF08\u4ECE API \u83B7\u53D6\u6570\u636E\uFF09"}},content:`
|
|
7
|
+
const { Card, Statistic, Row, Col } = ctx.antd;
|
|
8
|
+
const { createElement: h } = ctx.React;
|
|
9
|
+
|
|
10
|
+
const res = await ctx.api.request({
|
|
11
|
+
url: 'users:list',
|
|
12
|
+
method: 'get',
|
|
13
|
+
params: {
|
|
14
|
+
pageSize: 100,
|
|
15
|
+
appends: ['roles'],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const users = res?.data?.data || [];
|
|
20
|
+
|
|
21
|
+
const total = users.length;
|
|
22
|
+
const adminCount = users.filter((user) =>
|
|
23
|
+
Array.isArray(user?.roles) && user.roles.some((role) => role?.name === 'admin')
|
|
24
|
+
).length;
|
|
25
|
+
const withEmail = users.filter((user) => !!user?.email).length;
|
|
26
|
+
const distinctRoles = new Set(
|
|
27
|
+
users
|
|
28
|
+
.flatMap((user) => (Array.isArray(user?.roles) ? user.roles.map((role) => role?.name) : []))
|
|
29
|
+
.filter(Boolean),
|
|
30
|
+
).size;
|
|
31
|
+
|
|
32
|
+
ctx.ReactDOM.createRoot(ctx.element).render(
|
|
33
|
+
h(Row, { gutter: 16 },
|
|
34
|
+
h(Col, { span: 6 },
|
|
35
|
+
h(Card, {},
|
|
36
|
+
h(Statistic, { title: ctx.t('Total users'), value: total, valueStyle: { color: '#3f8600' } })
|
|
37
|
+
)
|
|
38
|
+
),
|
|
39
|
+
h(Col, { span: 6 },
|
|
40
|
+
h(Card, {},
|
|
41
|
+
h(Statistic, { title: ctx.t('Administrators'), value: adminCount, valueStyle: { color: '#1890ff' } })
|
|
42
|
+
)
|
|
43
|
+
),
|
|
44
|
+
h(Col, { span: 6 },
|
|
45
|
+
h(Card, {},
|
|
46
|
+
h(Statistic, { title: ctx.t('Users with email'), value: withEmail, valueStyle: { color: '#faad14' } })
|
|
47
|
+
)
|
|
48
|
+
),
|
|
49
|
+
h(Col, { span: 6 },
|
|
50
|
+
h(Card, {},
|
|
51
|
+
h(Statistic, {
|
|
52
|
+
title: ctx.t('Distinct roles'),
|
|
53
|
+
value: distinctRoles,
|
|
54
|
+
valueStyle: { color: '#cf1322' },
|
|
55
|
+
})
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
`};n.default=r}}]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6474,689],{689:function(l,o,e){e.r(o),e.d(o,{JSCollectionActionRunJSContext:function(){return t}});var _=e(72004),s=e.n(_),r=e(12444),a=e.n(r),c=e(31996),u=e.n(c),i=e(26037),d=e.n(i),m=e(1772),t=function(b){u()(n,b);var C=d()(n);function n(){return a()(this,n),C.apply(this,arguments)}return s()(n)}(m.Uo);t.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
|
|
2
|
+
Use ctx.resource.selectedRows to get selected records.
|
|
3
|
+
Use ctx.resource.pagination for page info.`}}),t.define({label:"JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{resource:"\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"}},{locale:"zh-CN"})},36474:function(l,o,e){e.r(o);var _=e(689),s={contexts:[_.JSCollectionActionRunJSContext],prefix:"sn-act-export",label:"Export selected rows as JSON",description:"Download selected rows as a JSON file",locales:{"zh-CN":{label:"\u5BFC\u51FA\u9009\u4E2D\u884C\u4E3A JSON",description:"\u5C06\u9009\u4E2D\u7684\u884C\u5BFC\u51FA\u4E3A JSON \u6587\u4EF6\u4E0B\u8F7D"}},content:`
|
|
4
|
+
const rows = ctx.resource?.getSelectedRows?.() || [];
|
|
5
|
+
if (!rows.length) {
|
|
6
|
+
ctx.message.warning(ctx.t('Please select at least one row'));
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Create JSON file and download
|
|
11
|
+
const jsonStr = JSON.stringify(rows, null, 2);
|
|
12
|
+
const blob = new Blob([jsonStr], { type: 'application/json' });
|
|
13
|
+
const url = URL.createObjectURL(blob);
|
|
14
|
+
const link = document.createElement('a');
|
|
15
|
+
link.href = url;
|
|
16
|
+
link.download = \`export-\${new Date().toISOString().split('T')[0]}.json\`;
|
|
17
|
+
link.click();
|
|
18
|
+
URL.revokeObjectURL(url);
|
|
19
|
+
|
|
20
|
+
ctx.message.success(ctx.t('Exported {{count}} records', { count: rows.length }));
|
|
21
|
+
`};o.default=s}}]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6534,1442],{41442:function(r,n,e){e.r(n),e.d(n,{JSItemRunJSContext:function(){return t}});var s=e(72004),_=e.n(s),a=e(12444),l=e.n(a),i=e(31996),d=e.n(i),m=e(26037),u=e.n(m),c=e(1772),t=function(b){d()(o,b);var p=u()(o);function o(){return l()(this,o),p.apply(this,arguments)}return _()(o)}(c.Uo);t.define({label:"JSItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`},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`}}),t.define({label:"JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",resource:"\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)"}},{locale:"zh-CN"})},76534:function(r,n,e){e.r(n);var s=e(41442),_={contexts:[s.JSItemRunJSContext],prefix:"sn-link-copy",label:"Copy value from another field",description:"Copy value from one field to another when checkbox is checked",locales:{"zh-CN":{label:"\u590D\u5236\u5B57\u6BB5\u503C",description:"\u52FE\u9009\u590D\u9009\u6846\u65F6\uFF0C\u5C06\u4E00\u4E2A\u5B57\u6BB5\u7684\u503C\u590D\u5236\u5230\u53E6\u4E00\u4E2A\u5B57\u6BB5"}},content:`
|
|
6
|
+
// When 'sameAsAbove' is checked, copy billing address to shipping address
|
|
7
|
+
const sameAsAbove = ctx.record?.sameAsAbove;
|
|
8
|
+
|
|
9
|
+
if (!sameAsAbove) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
14
|
+
const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
|
|
15
|
+
|
|
16
|
+
// Source and target field mappings
|
|
17
|
+
const fieldMappings = [
|
|
18
|
+
{ from: 'billingAddress', to: 'shippingAddress' },
|
|
19
|
+
{ from: 'billingCity', to: 'shippingCity' },
|
|
20
|
+
{ from: 'billingZipCode', to: 'shippingZipCode' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
fieldMappings.forEach(({ from, to }) => {
|
|
24
|
+
const sourceValue = ctx.record?.[from];
|
|
25
|
+
const targetField = candidates.find((item) => item?.props?.name === to);
|
|
26
|
+
|
|
27
|
+
if (targetField) {
|
|
28
|
+
targetField.setProps({ value: sourceValue });
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
ctx.message?.success?.(ctx.t('Address copied successfully'));
|
|
33
|
+
`};n.default=_}}]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6747,95,113,7087],{67087:function(h,_,e){e.r(_),e.d(_,{FormJSFieldItemRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"FormJSFieldItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form field rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,value:"Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).",record:`Current record data object (read-only).
|
|
3
|
+
Contains all field values of the parent record.`},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
|
|
4
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
|
|
5
|
+
Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
|
|
6
|
+
Example: ctx.setProps(fieldModel, { value: "new value" })`}}),o.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",value:"\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",setProps:"\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"}},{locale:"zh-CN"})},10095:function(h,_,e){e.r(_),e.d(_,{JSBlockRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
|
|
7
|
+
Supports innerHTML, append, and other DOM manipulation methods.
|
|
8
|
+
Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
|
|
9
|
+
Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
|
|
10
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
11
|
+
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),o.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},40113:function(h,_,e){e.r(_),e.d(_,{JSFieldRunJSContext:function(){return o}});var t=e(72004),l=e.n(t),r=e(12444),s=e.n(r),a=e(31996),u=e.n(a),d=e(26037),i=e.n(d),m=e(1772),o=function(c){u()(n,c);var b=i()(n);function n(){return s()(this,n),b.apply(this,arguments)}return l()(n)}(m.Uo);o.define({label:"JSField RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for field rendering.
|
|
12
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,value:`Current value of the field (read-only).
|
|
13
|
+
Contains the data value stored in this field.`,record:`Current record data object (read-only).
|
|
14
|
+
Contains all field values of the parent record.`,collection:`Collection definition metadata (read-only).
|
|
15
|
+
Provides schema information about the collection this field belongs to.`},methods:{onRefReady:`Wait for field container DOM element to be ready before executing callback.
|
|
16
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
17
|
+
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = ctx.value })`}}),o.define({label:"JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",value:"\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF0C\u5305\u542B\u7236\u8BB0\u5F55\u5168\u90E8\u5B57\u6BB5\u503C\uFF09",collection:"\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF0C\u63CF\u8FF0\u5B57\u6BB5\u6240\u5C5E\u96C6\u5408\u7684 Schema\uFF09"},methods:{onRefReady:"\u5728\u5B57\u6BB5\u5BB9\u5668 DOM \u5C31\u7EEA\u540E\u6267\u884C\u56DE\u8C03\u3002\u53C2\u6570\uFF1A(ref, callback, timeout?)\uFF1B\u793A\u4F8B\uFF1Actx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"}},{locale:"zh-CN"})},86747:function(h,_,e){e.r(_);var t=e(10095),l=e(40113),r=e(67087),s={contexts:[t.JSBlockRunJSContext,l.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-query-selector",label:"Query selector",description:"Find a child element inside ctx.element using querySelector",locales:{"zh-CN":{label:"\u67E5\u8BE2\u5B50\u5143\u7D20",description:"\u4F7F\u7528 querySelector \u5728 ctx.element \u5185\u67E5\u627E\u5B50\u5143\u7D20"}},content:`
|
|
18
|
+
const child = ctx.element.querySelector('.child-class');
|
|
19
|
+
if (child) {
|
|
20
|
+
child.textContent = ctx.t('Hello from querySelector');
|
|
21
|
+
}
|
|
22
|
+
`};_.default=s}}]);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[689],{689:function(C,n,e){e.r(n),e.d(n,{JSCollectionActionRunJSContext:function(){return o}});var s=e(72004),l=e.n(s),r=e(12444),t=e.n(r),u=e(31996),a=e.n(u),m=e(26037),c=e.n(m),d=e(1772),o=function(i){a()(_,i);var b=c()(_);function _(){return t()(this,_),b.apply(this,arguments)}return l()(_)}(d.Uo);o.define({label:"JSCollectionAction RunJS context",properties:{resource:`Collection resource instance providing access to selected rows, pagination, and data operations.
|
|
2
|
+
Use ctx.resource.selectedRows to get selected records.
|
|
3
|
+
Use ctx.resource.pagination for page info.`}}),o.define({label:"JS \u96C6\u5408\u52A8\u4F5C RunJS \u4E0A\u4E0B\u6587",properties:{resource:"\u5217\u8868\u8D44\u6E90\uFF08\u5305\u542B\u9009\u4E2D\u884C/\u5206\u9875\u4FE1\u606F\u7B49\uFF09"}},{locale:"zh-CN"})}}]);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6920,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var r=e(72004),o=e.n(r),_=e(12444),l=e.n(_),i=e(31996),d=e.n(i),c=e(26037),u=e.n(c),m=e(1772),a=function(b){d()(t,b);var p=u()(t);function t(){return l()(this,t),p.apply(this,arguments)}return o()(t)}(m.Uo);a.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.
|
|
3
|
+
Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
|
|
4
|
+
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 ESM module: `const mod = await ctx.importAsync(url)`"}}),a.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},96920:function(s,n,e){e.r(n);var r=e(10095),o={contexts:[r.JSBlockRunJSContext],prefix:"sn-jsb-chartjs",label:"Render Chart.js bar chart",description:"Load Chart.js from CDN and render a basic bar chart inside the block",locales:{"zh-CN":{label:"\u6E32\u67D3 Chart.js \u67F1\u72B6\u56FE",description:"\u901A\u8FC7 CDN \u5F15\u5165 Chart.js \u5E76\u5728\u533A\u5757\u4E2D\u6E32\u67D3\u57FA\u7840\u67F1\u72B6\u56FE"}},content:`
|
|
7
|
+
const wrapper = document.createElement('div');
|
|
8
|
+
wrapper.style.padding = '16px';
|
|
9
|
+
wrapper.style.background = '#fff';
|
|
10
|
+
wrapper.style.borderRadius = '8px';
|
|
11
|
+
wrapper.style.boxShadow = '0 2px 8px rgba(0,0,0,0.05)';
|
|
12
|
+
|
|
13
|
+
const canvas = document.createElement('canvas');
|
|
14
|
+
canvas.width = 480;
|
|
15
|
+
canvas.height = 320;
|
|
16
|
+
wrapper.appendChild(canvas);
|
|
17
|
+
ctx.element.replaceChildren(wrapper);
|
|
18
|
+
|
|
19
|
+
async function renderChart() {
|
|
20
|
+
const loaded = await ctx.requireAsync('https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js');
|
|
21
|
+
const Chart = loaded?.Chart || loaded?.default?.Chart || loaded?.default;
|
|
22
|
+
if (!Chart) {
|
|
23
|
+
throw new Error('Chart.js is not available');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const labels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
|
|
27
|
+
const data = [12, 18, 9, 15, 22];
|
|
28
|
+
|
|
29
|
+
new Chart(canvas.getContext('2d'), {
|
|
30
|
+
type: 'bar',
|
|
31
|
+
data: {
|
|
32
|
+
labels,
|
|
33
|
+
datasets: [
|
|
34
|
+
{
|
|
35
|
+
label: ctx.t('Daily visits'),
|
|
36
|
+
data,
|
|
37
|
+
backgroundColor: 'rgba(24, 144, 255, 0.6)',
|
|
38
|
+
borderColor: '#1890ff',
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
options: {
|
|
44
|
+
plugins: {
|
|
45
|
+
legend: { display: true },
|
|
46
|
+
title: {
|
|
47
|
+
display: true,
|
|
48
|
+
text: ctx.t('Weekly overview'),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
renderChart().catch((error) => {
|
|
56
|
+
console.error('[RunJS] failed to render chart', error);
|
|
57
|
+
wrapper.innerHTML = '<div style="color:#c00;">' + (error?.message || ctx.t('Chart initialization failed')) + '</div>';
|
|
58
|
+
});
|
|
59
|
+
`};n.default=o}}]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6996],{96996:function(o,e,n){n.r(e);var i={contexts:["*"],versions:["*"],prefix:"sn-open-dialog",label:"Open view (dialog)",description:"Open a view in dialog via ctx.openView",locales:{"zh-CN":{label:"\u6253\u5F00\u89C6\u56FE\uFF08\u5BF9\u8BDD\u6846\uFF09",description:"\u901A\u8FC7 ctx.openView \u4EE5\u5BF9\u8BDD\u6846\u65B9\u5F0F\u6253\u5F00\u89C6\u56FE"}},content:`
|
|
2
|
+
// Open a view as dialog and pass arguments at top-level
|
|
3
|
+
const popupUid = ctx.model.uid + '-1'; // popupUid should be stable and better bound to ctx.model.uid
|
|
4
|
+
await ctx.openView(popupUid, {
|
|
5
|
+
mode: 'dialog',
|
|
6
|
+
title: ctx.t('Sample dialog'),
|
|
7
|
+
size: 'medium',
|
|
8
|
+
});
|
|
9
|
+
`};e.default=i}}]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[703,95],{10095:function(r,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return a}});var o=e(72004),_=e.n(o),l=e(12444),s=e.n(l),c=e(31996),i=e.n(c),d=e(26037),u=e.n(d),m=e(1772),a=function(b){i()(t,b);var R=u()(t);function t(){return s()(this,t),R.apply(this,arguments)}return _()(t)}(m.Uo);a.define({label:"RunJS context",properties:{element:{description:`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.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},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 ESM module: `const mod = await ctx.importAsync(url)`"}}),a.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},70703:function(r,n,e){e.r(n);var o=e(10095),_={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-react",label:"Render React",description:"Render a React element inside the block container",locales:{"zh-CN":{label:"\u6E32\u67D3 React",description:"\u5728\u533A\u5757\u5BB9\u5668\u4E2D\u6E32\u67D3 React \u7EC4\u4EF6"}},content:`
|
|
7
|
+
// Render a React element into ctx.element via ReactDOM
|
|
8
|
+
const { React, ReactDOM, antd } = ctx;
|
|
9
|
+
const { Button } = antd;
|
|
10
|
+
|
|
11
|
+
const node = React.createElement(
|
|
12
|
+
'div',
|
|
13
|
+
{ style: { padding: 12 } },
|
|
14
|
+
React.createElement(Button, { type: 'primary', onClick: () => ctx.message.success(ctx.t('Clicked!')) }, ctx.t('Click')),
|
|
15
|
+
);
|
|
16
|
+
ReactDOM.createRoot(ctx.element).render(node);
|
|
17
|
+
`};n.default=_}}]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[7087],{67087:function(p,n,e){e.r(n),e.d(n,{FormJSFieldItemRunJSContext:function(){return o}});var s=e(72004),r=e.n(s),l=e(12444),a=e.n(l),t=e(31996),d=e.n(t),m=e(26037),u=e.n(m),i=e(1772),o=function(b){d()(_,b);var c=u()(_);function _(){return a()(this,_),c.apply(this,arguments)}return r()(_)}(i.Uo);o.define({label:"FormJSFieldItem RunJS context",properties:{element:`ElementProxy instance providing a safe DOM container for form field rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`,value:"Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).",record:`Current record data object (read-only).
|
|
3
|
+
Contains all field values of the parent record.`},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
|
|
4
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
|
|
5
|
+
Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
|
|
6
|
+
Example: ctx.setProps(fieldModel, { value: "new value" })`}}),o.define({label:"\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",properties:{element:"ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",value:"\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09"},methods:{onRefReady:"\u5BB9\u5668\u5C31\u7EEA\u56DE\u8C03",setProps:"\u8BBE\u7F6E\u8868\u5355\u9879\u5C5E\u6027\uFF1A`setProps(fieldModel, { value })`\uFF08\u7531\u8054\u52A8/\u8868\u5355\u4E0A\u4E0B\u6587\u63D0\u4F9B\uFF09"}},{locale:"zh-CN"})}}]);
|