@nocobase/app 2.1.0-beta.42 → 2.1.0-beta.44
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/assets/1507-be1bb59f.js +7 -0
- package/dist/client/assets/2702-2229ffce.js +5 -0
- package/dist/client/assets/3475-c853dcfb.js +1 -0
- package/dist/client/assets/3660-ae135b62.js +6 -0
- package/dist/client/assets/3916-03cc08e1.js +6 -0
- package/dist/client/assets/4687-cb88a94b.js +1 -0
- package/dist/client/assets/6269-d8f21ee9.js +1 -0
- package/dist/client/assets/{index-d8e97233.js → index-2bb32c00.js} +287 -287
- package/dist/client/assets/runtime-6964d231.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/v2/assets/1310-c0031389.js +59 -0
- package/dist/client/v2/assets/1425-69534606.js +42 -0
- package/dist/client/v2/assets/1507-9a211af0.js +7 -0
- package/dist/client/v2/assets/158-5273dfbb.js +23 -0
- package/dist/client/v2/assets/1725-d9ce2582.js +83 -0
- package/dist/client/v2/assets/1786-e6c321bb.js +16 -0
- package/dist/client/v2/assets/1951-84be8ebc.js +55 -0
- package/dist/client/v2/assets/2017-29a9879a.js +26 -0
- package/dist/client/v2/assets/212-0f8a26a2.js +18 -0
- package/dist/client/v2/assets/2335-669f21bd.js +22 -0
- package/dist/client/v2/assets/2555-4ca49e21.js +31 -0
- package/dist/client/v2/assets/2702-5ce93acd.js +5 -0
- package/dist/client/v2/assets/2710-e7286996.js +36 -0
- package/dist/client/v2/assets/2726-4d19faa1.js +23 -0
- package/dist/client/v2/assets/2898-7656f7f9.js +17 -0
- package/dist/client/v2/assets/2958-93de29a6.js +27 -0
- package/dist/client/v2/assets/3117-cc936eae.js +33 -0
- package/dist/client/v2/assets/3475-be655098.js +1 -0
- package/dist/client/v2/assets/3660-280439df.js +6 -0
- package/dist/client/v2/assets/3662-8dff1ffe.js +28 -0
- package/dist/client/v2/assets/3727-1cfef422.js +44 -0
- package/dist/client/v2/assets/3916-3b34f216.js +6 -0
- package/dist/client/v2/assets/3989-c8fcfd6c.js +27 -0
- package/dist/client/v2/assets/4313-ab774fd9.js +28 -0
- package/dist/client/v2/assets/5501-387a31be.js +17 -0
- package/dist/client/v2/assets/5721-af25e047.js +18 -0
- package/dist/client/v2/assets/5759-2b3bdcc6.js +47 -0
- package/dist/client/v2/assets/5761-857b6bbb.js +28 -0
- package/dist/client/v2/assets/6269-a8a1ea3f.js +1 -0
- package/dist/client/v2/assets/6437-3865fd7e.js +12 -0
- package/dist/client/v2/assets/6738-c6598897.js +20 -0
- package/dist/client/v2/assets/700-e75b7faa.js +15 -0
- package/dist/client/v2/assets/7021-4975d54d.js +45 -0
- package/dist/client/v2/assets/7201-5b49ce84.js +14 -0
- package/dist/client/v2/assets/7959-f7ef21c6.js +40 -0
- package/dist/client/v2/assets/8138-e90c290e.js +24 -0
- package/dist/client/v2/assets/8434-9140d106.js +25 -0
- package/dist/client/v2/assets/8438-d2ff6bc1.js +37 -0
- package/dist/client/v2/assets/8562-ffa35312.js +17 -0
- package/dist/client/v2/assets/9836-fcbb81f6.js +22 -0
- package/dist/client/v2/assets/{index-48dce4e9.js → index-496065db.js} +136 -136
- package/dist/client/v2/assets/{runtime-0629701e.js → runtime-afd2b4ee.js} +1 -1
- package/dist/client/v2/index.html +1 -1
- package/package.json +7 -7
- package/dist/client/assets/1507-bfaf088d.js +0 -7
- package/dist/client/assets/2702-448a397f.js +0 -5
- package/dist/client/assets/3475-9e7a0395.js +0 -1
- package/dist/client/assets/3660-fdea8689.js +0 -6
- package/dist/client/assets/3916-a8888466.js +0 -6
- package/dist/client/assets/6269-5467af50.js +0 -1
- package/dist/client/assets/runtime-1dde2b80.js +0 -1
- package/dist/client/v2/assets/1310-21e5c8a8.js +0 -59
- package/dist/client/v2/assets/1425-a2b446a6.js +0 -42
- package/dist/client/v2/assets/1507-a673a0c0.js +0 -7
- package/dist/client/v2/assets/158-6a033567.js +0 -23
- package/dist/client/v2/assets/1725-6f5b8d53.js +0 -83
- package/dist/client/v2/assets/1786-8969223a.js +0 -16
- package/dist/client/v2/assets/1951-f63bc4b3.js +0 -55
- package/dist/client/v2/assets/2017-b35f125d.js +0 -26
- package/dist/client/v2/assets/212-59d29e60.js +0 -18
- package/dist/client/v2/assets/2335-1d33c3cf.js +0 -22
- package/dist/client/v2/assets/2555-dee484a1.js +0 -31
- package/dist/client/v2/assets/2702-8d5ab2a8.js +0 -5
- package/dist/client/v2/assets/2710-93d67bf0.js +0 -36
- package/dist/client/v2/assets/2726-f6cc5db9.js +0 -23
- package/dist/client/v2/assets/2898-2a7d5793.js +0 -17
- package/dist/client/v2/assets/2958-5a85effa.js +0 -27
- package/dist/client/v2/assets/3117-3d38bb4d.js +0 -33
- package/dist/client/v2/assets/3475-c42974e1.js +0 -1
- package/dist/client/v2/assets/3660-27f9c6c5.js +0 -6
- package/dist/client/v2/assets/3662-135bbea1.js +0 -28
- package/dist/client/v2/assets/3727-b74fc29b.js +0 -44
- package/dist/client/v2/assets/3916-ba5b43b5.js +0 -6
- package/dist/client/v2/assets/3989-e72345bb.js +0 -27
- package/dist/client/v2/assets/4313-9687f912.js +0 -28
- package/dist/client/v2/assets/5501-a3b5b97f.js +0 -17
- package/dist/client/v2/assets/5721-f00ddbf2.js +0 -18
- package/dist/client/v2/assets/5759-d5b1d946.js +0 -47
- package/dist/client/v2/assets/5761-8ab1974d.js +0 -28
- package/dist/client/v2/assets/6269-35e90156.js +0 -1
- package/dist/client/v2/assets/6437-2f91d29a.js +0 -12
- package/dist/client/v2/assets/6738-eb09fa59.js +0 -20
- package/dist/client/v2/assets/700-5f166286.js +0 -15
- package/dist/client/v2/assets/7021-01608dc5.js +0 -45
- package/dist/client/v2/assets/7201-8e6e91a3.js +0 -14
- package/dist/client/v2/assets/7959-ab57fce2.js +0 -40
- package/dist/client/v2/assets/8138-704104a5.js +0 -24
- package/dist/client/v2/assets/8434-79232eec.js +0 -25
- package/dist/client/v2/assets/8438-9d210970.js +0 -37
- package/dist/client/v2/assets/8562-215edc37.js +0 -17
- package/dist/client/v2/assets/9836-288424d8.js +0 -22
- /package/dist/client/assets/{index-d8e97233.js.LICENSE.txt → index-2bb32c00.js.LICENSE.txt} +0 -0
- /package/dist/client/v2/assets/{index-48dce4e9.js.LICENSE.txt → index-496065db.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e,t,r,o={},a={};function n(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=o,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);n.r(r);var o={};c=c||[null,i({}),i([]),i(i)];for(var a=2&t&&e;("object"==typeof a||"function"==typeof a)&&!~c.indexOf(a);a=i(a))Object.getOwnPropertyNames(a).forEach(t=>{o[t]=()=>e[t]});return o.default=()=>e,n.d(r,o),r},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>"assets/"+e+"-"+({1310:"b898cb4d",1425:"4fdfdcef",1507:"be1bb59f",158:"b8de229f",1676:"bc5ee382",1725:"503bd3a4",1786:"265decd7",1951:"365ff4cd",2017:"10a1c2b0",212:"beec614d",2203:"d2b55f56",2260:"2f33021a",2335:"16797c56",2555:"d9b0ecc1",2702:"2229ffce",2710:"4f381ff2",2726:"4790b65d",2861:"42d1296b",2898:"3de77d03",2958:"47b4bf68",3018:"16e6d079",3117:"d514e826",32:"862a0bee",338:"41483b89",3475:"c853dcfb",3660:"ae135b62",3662:"c5b81593",3690:"be1db747",3727:"0de5ad1c",3916:"03cc08e1",3937:"63dfd8b6",3989:"6d49bc78",4222:"bd317ec9",4313:"2cb3af9a",4687:"cb88a94b",5064:"3f4d601d",5501:"e71eb990",5721:"09758577",5759:"b328c03a",5761:"9959bdb7",6269:"d8f21ee9",6373:"45c932c0",6437:"f363ff04",6581:"80b2bebd",6738:"8932efd6",700:"5aa1e7c4",7021:"ee85f2f4",7201:"1a9a4dad",7211:"518822f0",7492:"b7d61a70",754:"3019da13",7876:"4398be9a",7946:"d1966f76",7959:"6e982e34",8138:"0f9d766b",8262:"7b1f9374",8434:"30f32617",8438:"1e43f2ed",8562:"34318af5",9827:"a0d945ea",9836:"47bf9623"})[e]+".js",n.miniCssF=e=>""+e+".css",n.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f={},n.l=function(e,t,r,o){if(f[e])return void f[e].push(t);if(void 0!==r)for(var a,c,i=document.getElementsByTagName("script"),b=0;b<i.length;b++){var d=i[b];if(d.getAttribute("src")==e||d.getAttribute("data-rspack")=="nocobase:"+r){a=d;break}}a||(c=!0,(a=document.createElement("script")).timeout=120,n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-rspack","nocobase:"+r),a.src=e),f[e]=[t];var l=function(t,r){a.onerror=a.onload=null,clearTimeout(u);var o=f[e];if(delete f[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(function(e){return e(r)}),t)return t(r)},u=setTimeout(l.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=l.bind(null,a.onerror),a.onload=l.bind(null,a.onload),c&&document.head.appendChild(a)},n.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),b=[],n.O=(e,t,r,o)=>{if(t){o=o||0;for(var a=b.length;a>0&&b[a-1][2]>o;a--)b[a]=b[a-1];b[a]=[t,r,o];return}for(var c=1/0,a=0;a<b.length;a++){for(var[t,r,o]=b[a],i=!0,f=0;f<t.length;f++)(!1&o||c>=o)&&Object.keys(n.O).every(e=>n.O[e](t[f]))?t.splice(f--,1):(i=!1,o<c&&(c=o));if(i){b.splice(a--,1);var d=r();void 0!==d&&(e=d)}}return e},n.g.importScripts&&(d=n.g.location+"");var c,i,f,b,d,l=n.g.document;if(!d&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(d=l.currentScript.src),!d)){var u=l.getElementsByTagName("script");if(u.length)for(var s=u.length-1;s>-1&&(!d||!/^http(s?):/.test(d));)d=u[s--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");n.p=(d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"))+"../",e={3146:0,9967:0},n.f.j=function(t,r){var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else if(/^(3146|9967)$/.test(t))e[t]=0;else{var a=new Promise((r,a)=>o=e[t]=[r,a]);r.push(o[2]=a);var c=n.p+n.u(t),i=Error();n.l(c,function(r){if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var a=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+c+")",i.name="ChunkLoadError",i.type=a,i.request=c,o[1](i)}},"chunk-"+t,t)}},n.O.j=t=>0===e[t],t=(t,r)=>{var o,a,[c,i,f]=r,b=0;if(c.some(t=>0!==e[t])){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(f)var d=f(n)}for(t&&t(r);b<c.length;b++)a=c[b],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(d)},(r=globalThis.webpackChunknocobase=globalThis.webpackChunknocobase||[]).forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();
|
package/dist/client/index.html
CHANGED
|
@@ -15,7 +15,7 @@ window['__nocobase_ws_url__'] = '';
|
|
|
15
15
|
window['__nocobase_ws_path__'] = '/ws';
|
|
16
16
|
window['__nocobase_app_dev__'] = false;
|
|
17
17
|
window['__esm_cdn_base_url__'] = 'https://esm.sh';
|
|
18
|
-
window['__esm_cdn_suffix__'] = '';</script><script src="/browser-checker.js?v=1"></script><script type="module" src="/assets/runtime-
|
|
18
|
+
window['__esm_cdn_suffix__'] = '';</script><script src="/browser-checker.js?v=1"></script><script type="module" src="/assets/runtime-6964d231.js"></script><script type="module" src="/assets/vendor-core-a233b529.js"></script><script type="module" src="/assets/vendor-antd-ecosystem-b9174353.js"></script><script type="module" src="/assets/vendor-moment-8e0638ed.js"></script><script type="module" src="/assets/vendor-lodash-97b39f5f.js"></script><script type="module" src="/assets/vendor-ses-4e1acd6f.js"></script><script type="module" src="/assets/vendor-antd-icons-b345e75b.js"></script><script type="module" src="/assets/vendor-antd-a0dccf46.js"></script><script type="module" src="/assets/vendor-antv-b2b63ca6.js"></script><script type="module" src="/assets/vendor-markdown-6cd7c4ae.js"></script><script type="module" src="/assets/vendor-math-template-e14d2da2.js"></script><script type="module" src="/assets/vendor-editor-4a3d9571.js"></script><script type="module" src="/assets/vendor-mobile-ui-d13eb245.js"></script><script type="module" src="/assets/vendor-dayjs-b86f7bf1.js"></script><script type="module" src="/assets/vendor-diagram-bc0ac0e3.js"></script><script type="module" src="/assets/vendor-misc-0f74f11a.js"></script><script type="module" src="/assets/index-2bb32c00.js"></script><link href="/assets/vendor-antd-debce1bd.css" rel="stylesheet"><link href="/assets/vendor-markdown-c8e9c5dd.css" rel="stylesheet"><link href="/assets/vendor-mobile-ui-4d3e1f9f.css" rel="stylesheet"><link href="/assets/9967-52c0cdfd.css" rel="stylesheet"><link href="/assets/index-560f1b6d.css" rel="stylesheet"></head>
|
|
19
19
|
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
|
@@ -15,7 +15,7 @@ window['__nocobase_ws_url__'] = '{{env.WS_URL}}';
|
|
|
15
15
|
window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
|
|
16
16
|
window['__nocobase_app_dev__'] = {{env.NOCOBASE_APP_DEV}};
|
|
17
17
|
window['__esm_cdn_base_url__'] = '{{env.ESM_CDN_BASE_URL}}';
|
|
18
|
-
window['__esm_cdn_suffix__'] = '{{env.ESM_CDN_SUFFIX}}';</script><script src="{{env.APP_PUBLIC_PATH}}browser-checker.js?v=1"></script><script type="module" src="assets/runtime-
|
|
18
|
+
window['__esm_cdn_suffix__'] = '{{env.ESM_CDN_SUFFIX}}';</script><script src="{{env.APP_PUBLIC_PATH}}browser-checker.js?v=1"></script><script type="module" src="assets/runtime-6964d231.js"></script><script type="module" src="assets/vendor-core-a233b529.js"></script><script type="module" src="assets/vendor-antd-ecosystem-b9174353.js"></script><script type="module" src="assets/vendor-moment-8e0638ed.js"></script><script type="module" src="assets/vendor-lodash-97b39f5f.js"></script><script type="module" src="assets/vendor-ses-4e1acd6f.js"></script><script type="module" src="assets/vendor-antd-icons-b345e75b.js"></script><script type="module" src="assets/vendor-antd-a0dccf46.js"></script><script type="module" src="assets/vendor-antv-b2b63ca6.js"></script><script type="module" src="assets/vendor-markdown-6cd7c4ae.js"></script><script type="module" src="assets/vendor-math-template-e14d2da2.js"></script><script type="module" src="assets/vendor-editor-4a3d9571.js"></script><script type="module" src="assets/vendor-mobile-ui-d13eb245.js"></script><script type="module" src="assets/vendor-dayjs-b86f7bf1.js"></script><script type="module" src="assets/vendor-diagram-bc0ac0e3.js"></script><script type="module" src="assets/vendor-misc-0f74f11a.js"></script><script type="module" src="assets/index-2bb32c00.js"></script><link href="assets/vendor-antd-debce1bd.css" rel="stylesheet"><link href="assets/vendor-markdown-c8e9c5dd.css" rel="stylesheet"><link href="assets/vendor-mobile-ui-4d3e1f9f.css" rel="stylesheet"><link href="assets/9967-52c0cdfd.css" rel="stylesheet"><link href="assets/index-560f1b6d.css" rel="stylesheet"></head>
|
|
19
19
|
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const __rspack_esm_id="1310";export const __rspack_esm_ids=["1310"];export const __webpack_modules__={79271(e,t,n){n.r(t),n.d(t,{JSBlockRunJSContext:()=>a});var r=n(29007),i=n(4418);class a extends r.uk{}a.define({label:"RunJS context",properties:{element:(0,i.e)(`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 上下文",properties:{element:(0,i.V)("ElementProxy,安全的 DOM 容器,支持 innerHTML/append 等"),record:"当前记录(只读,用于数据区块/详情等场景)",value:"当前值(若存在)",React:"React 库",antd:"Ant Design 库"},methods:{onRefReady:"容器 ref 就绪回调:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"加载外部库:`const lib = await ctx.requireAsync(url)`",importAsync:"按 URL 动态导入 ESM 模块:`const mod = await ctx.importAsync(url)`。\n注意:当模块只有 default 一个导出时,ctx.importAsync 会直接返回 default 值(无需再写 `.default`)。"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>o,e:()=>a});let 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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}},39101(e,t,n){n.r(t),n.d(t,{default:()=>r});let r={contexts:[n(79271).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:"渲染 Chart.js 柱状图",description:"通过 CDN 引入 Chart.js 并在区块中渲染基础柱状图"}},content:`
|
|
7
|
+
const wrapper = document.createElement('div');
|
|
8
|
+
wrapper.style.padding = '16px';
|
|
9
|
+
wrapper.style.background = '#fff';
|
|
10
|
+
wrapper.style.borderRadius = '8px';
|
|
11
|
+
wrapper.style.boxShadow = '0 2px 8px rgba(0,0,0,0.05)';
|
|
12
|
+
|
|
13
|
+
const canvas = document.createElement('canvas');
|
|
14
|
+
canvas.width = 480;
|
|
15
|
+
canvas.height = 320;
|
|
16
|
+
wrapper.appendChild(canvas);
|
|
17
|
+
ctx.render(wrapper);
|
|
18
|
+
|
|
19
|
+
async function renderChart() {
|
|
20
|
+
const loaded = await ctx.requireAsync('chart.js@4.4.0/dist/chart.umd.min.js');
|
|
21
|
+
const Chart = loaded?.Chart || loaded?.default?.Chart || loaded?.default;
|
|
22
|
+
if (!Chart) {
|
|
23
|
+
throw new Error('Chart.js is not available');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const labels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
|
|
27
|
+
const data = [12, 18, 9, 15, 22];
|
|
28
|
+
|
|
29
|
+
new Chart(canvas.getContext('2d'), {
|
|
30
|
+
type: 'bar',
|
|
31
|
+
data: {
|
|
32
|
+
labels,
|
|
33
|
+
datasets: [
|
|
34
|
+
{
|
|
35
|
+
label: ctx.t('Daily visits'),
|
|
36
|
+
data,
|
|
37
|
+
backgroundColor: 'rgba(24, 144, 255, 0.6)',
|
|
38
|
+
borderColor: '#1890ff',
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
options: {
|
|
44
|
+
plugins: {
|
|
45
|
+
legend: { display: true },
|
|
46
|
+
title: {
|
|
47
|
+
display: true,
|
|
48
|
+
text: ctx.t('Weekly overview'),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
renderChart().catch((error) => {
|
|
56
|
+
console.error('[RunJS] failed to render chart', error);
|
|
57
|
+
wrapper.innerHTML = '<div style="color:#c00;">' + (error?.message || ctx.t('Chart initialization failed')) + '</div>';
|
|
58
|
+
});
|
|
59
|
+
`}}};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const __rspack_esm_id="1425";export const __rspack_esm_ids=["1425"];export const __webpack_modules__={98542(e,t,n){n.r(t),n.d(t,{JSFieldRunJSContext:()=>r});var i=n(29007),l=n(4418);class r extends i.uk{}r.define({label:"JSField RunJS context",properties:{element:(0,l.e)(`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 })`}}),r.define({label:"JS 字段 RunJS 上下文",properties:{element:(0,l.V)("ElementProxy,字段渲染容器,支持 innerHTML/append 等 DOM 操作"),value:"字段当前值(只读)",record:"当前记录对象(只读,包含父记录全部字段值)",collection:"集合定义元数据(只读,描述字段所属集合的 Schema)"},methods:{onRefReady:"在字段容器 DOM 就绪后执行回调。参数:(ref, callback, timeout?);示例:ctx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>o,e:()=>r});let i={innerHTML:"Sanitized inner HTML string.",outerHTML:"Sanitized outer HTML string.",textContent:"Text content.",style:"Inline style declaration.",classList:"DOMTokenList for CSS classes.",appendChild:{type:"function",description:"Append a DOM node or text.",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"Set an HTML attribute.",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"Read an HTML attribute.",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"Find the first matching descendant.",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"Find all matching descendants.",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"Attach an event listener to the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"Remove an event listener from the element.",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}},l={innerHTML:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:l}}},57064(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(98542).JSFieldRunJSContext],prefix:"sn-jsf-copy",label:"Display text field with copy button",description:"Render the text field value with a copy-to-clipboard button",locales:{"zh-CN":{label:"将文本字段显示为复制按钮",description:"展示字段值并提供快捷复制到剪贴板的按钮"}},content:`
|
|
8
|
+
const text = String(ctx.value ?? '');
|
|
9
|
+
|
|
10
|
+
const wrapper = document.createElement('span');
|
|
11
|
+
wrapper.style.display = 'inline-flex';
|
|
12
|
+
wrapper.style.alignItems = 'center';
|
|
13
|
+
wrapper.style.gap = '8px';
|
|
14
|
+
|
|
15
|
+
const valueEl = document.createElement('span');
|
|
16
|
+
valueEl.textContent = text;
|
|
17
|
+
valueEl.style.color = '#666';
|
|
18
|
+
|
|
19
|
+
const copyEl = document.createElement('a');
|
|
20
|
+
copyEl.textContent = ctx.t('Copy');
|
|
21
|
+
copyEl.style.cursor = 'pointer';
|
|
22
|
+
copyEl.style.color = '#1677ff';
|
|
23
|
+
|
|
24
|
+
copyEl.addEventListener('click', async () => {
|
|
25
|
+
if (navigator?.clipboard?.writeText) {
|
|
26
|
+
await navigator.clipboard.writeText(text);
|
|
27
|
+
} else {
|
|
28
|
+
const ta = document.createElement('textarea');
|
|
29
|
+
ta.value = text;
|
|
30
|
+
document.body.appendChild(ta);
|
|
31
|
+
ta.select();
|
|
32
|
+
document.execCommand('copy');
|
|
33
|
+
document.body.removeChild(ta);
|
|
34
|
+
}
|
|
35
|
+
ctx.message.success(ctx.t('Copied'));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
wrapper.appendChild(valueEl);
|
|
39
|
+
wrapper.appendChild(copyEl);
|
|
40
|
+
|
|
41
|
+
ctx.render(wrapper);
|
|
42
|
+
`}}};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const __rspack_esm_id="1507";export const __rspack_esm_ids=["1507"];export const __webpack_modules__={98542(e,t,n){n.r(t),n.d(t,{JSFieldRunJSContext:()=>l});var i=n(29007),r=n(4418);class l extends i.uk{}l.define({label:"JSField RunJS context",properties:{element:(0,r.e)(`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 })`}}),l.define({label:"JS 字段 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,字段渲染容器,支持 innerHTML/append 等 DOM 操作"),value:"字段当前值(只读)",record:"当前记录对象(只读,包含父记录全部字段值)",collection:"集合定义元数据(只读,描述字段所属集合的 Schema)"},methods:{onRefReady:"在字段容器 DOM 就绪后执行回调。参数:(ref, callback, timeout?);示例:ctx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>o,e:()=>l});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}}};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const __rspack_esm_id="158";export const __rspack_esm_ids=["158"];export const __webpack_modules__={32221(e,t,n){n.r(t),n.d(t,{JSItemRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"JSItem RunJS context",properties:{element:(0,r.e)(`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`,formValues:{description:"Snapshot of current form values (object). Available in form contexts (CreateForm/EditForm).",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:`Wait for form item container DOM element to be ready before executing callback.
|
|
5
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),o.define({label:"JS 表单项 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,表单项渲染容器,支持 innerHTML/append 等 DOM 操作"),resource:"当前资源(只读)",record:"当前记录(只读)",formValues:{description:"当前表单值快照(对象)。仅表单相关上下文可用(Create/Edit Form)。",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"容器就绪后执行回调。参数:(ref, callback, timeout?)"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>o});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},37517(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(32221).JSItemRunJSContext],prefix:"sn-link-require",label:"Conditional required field",description:"Make a field required based on another field's value",locales:{"zh-CN":{label:"条件必填",description:"根据另一个字段的值动态设置必填状态"}},content:`
|
|
6
|
+
// When 'needsApproval' is true, make 'approver' field required
|
|
7
|
+
const needsApproval = ctx.record?.needsApproval;
|
|
8
|
+
|
|
9
|
+
const items = ctx.model?.subModels?.grid?.subModels?.items;
|
|
10
|
+
const candidates = Array.isArray(items) ? items : Array.from(items?.values?.() || items || []);
|
|
11
|
+
|
|
12
|
+
const approverField = candidates.find((item) => item?.props?.name === 'approver');
|
|
13
|
+
|
|
14
|
+
if (approverField) {
|
|
15
|
+
approverField.setProps({
|
|
16
|
+
required: !!needsApproval,
|
|
17
|
+
// Also toggle visibility if needed
|
|
18
|
+
// display: needsApproval ? 'visible' : 'hidden',
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
console.warn('[Form snippet] approver field not found');
|
|
22
|
+
}
|
|
23
|
+
`}}};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export const __rspack_esm_id="1725";export const __rspack_esm_ids=["1725"];export const __webpack_modules__={79271(e,t,n){n.r(t),n.d(t,{JSBlockRunJSContext:()=>i});var o=n(29007),r=n(4418);class i extends o.uk{}i.define({label:"RunJS context",properties:{element:(0,r.e)(`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`)."}}),i.define({label:"RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,安全的 DOM 容器,支持 innerHTML/append 等"),record:"当前记录(只读,用于数据区块/详情等场景)",value:"当前值(若存在)",React:"React 库",antd:"Ant Design 库"},methods:{onRefReady:"容器 ref 就绪回调:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"加载外部库:`const lib = await ctx.requireAsync(url)`",importAsync:"按 URL 动态导入 ESM 模块:`const mod = await ctx.importAsync(url)`。\n注意:当模块只有 default 一个导出时,ctx.importAsync 会直接返回 default 值(无需再写 `.default`)。"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>i});let 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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:o}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},40812(e,t,n){n.r(t),n.d(t,{default:()=>o});let o={contexts:[n(79271).JSBlockRunJSContext],prefix:"sn-jsb-vue",label:"Embed Vue component",description:"Use ctx.importAsync to load Vue 3 ESM build and render a reactive widget",locales:{"zh-CN":{label:"嵌入 Vue 组件",description:"通过 ctx.importAsync 加载 Vue 3 ESM 构建并渲染交互组件"}},content:`
|
|
7
|
+
const mountNode = document.createElement('div');
|
|
8
|
+
mountNode.style.padding = '16px';
|
|
9
|
+
mountNode.style.background = '#fff';
|
|
10
|
+
mountNode.style.borderRadius = '8px';
|
|
11
|
+
const target = document.createElement('div');
|
|
12
|
+
target.className = 'nb-vue-counter';
|
|
13
|
+
mountNode.appendChild(target);
|
|
14
|
+
ctx.render(mountNode);
|
|
15
|
+
|
|
16
|
+
async function bootstrap() {
|
|
17
|
+
const mod = await ctx.importAsync('vue@3.4.27/dist/vue.runtime.esm-browser.js');
|
|
18
|
+
const createApp = mod?.createApp;
|
|
19
|
+
const ref = mod?.ref;
|
|
20
|
+
const h = mod?.h;
|
|
21
|
+
if (typeof createApp !== 'function' || typeof ref !== 'function' || typeof h !== 'function') {
|
|
22
|
+
throw new Error('Vue ESM module not available');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Counter = {
|
|
26
|
+
setup() {
|
|
27
|
+
const count = ref(0);
|
|
28
|
+
const increase = () => {
|
|
29
|
+
count.value += 1;
|
|
30
|
+
};
|
|
31
|
+
const openPopup = async () => {
|
|
32
|
+
const popupUid = ctx.model?.uid ? ctx.model.uid + '-popup' : 'vue-popup';
|
|
33
|
+
await ctx.openView(popupUid, {
|
|
34
|
+
mode: 'drawer',
|
|
35
|
+
title: ctx.t('Hello from Vue'),
|
|
36
|
+
params: {
|
|
37
|
+
fromVue: true,
|
|
38
|
+
triggerCount: count.value,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return () =>
|
|
43
|
+
h(
|
|
44
|
+
'div',
|
|
45
|
+
{ style: 'display:flex;align-items:center;gap:12px;' },
|
|
46
|
+
[
|
|
47
|
+
h(
|
|
48
|
+
'button',
|
|
49
|
+
{
|
|
50
|
+
style:
|
|
51
|
+
'padding:6px 12px;border:1px solid #fa8c16;background:#fa8c16;color:#fff;border-radius:4px;cursor:pointer;',
|
|
52
|
+
onClick: increase,
|
|
53
|
+
},
|
|
54
|
+
ctx.t('Increase'),
|
|
55
|
+
),
|
|
56
|
+
h(
|
|
57
|
+
'button',
|
|
58
|
+
{
|
|
59
|
+
style:
|
|
60
|
+
'padding:6px 12px;border:1px solid #1677ff;background:#1677ff;color:#fff;border-radius:4px;cursor:pointer;',
|
|
61
|
+
onClick: openPopup,
|
|
62
|
+
},
|
|
63
|
+
ctx.t('Open popup'),
|
|
64
|
+
),
|
|
65
|
+
h(
|
|
66
|
+
'span',
|
|
67
|
+
null,
|
|
68
|
+
ctx.t('Current count') + ': ' + count.value,
|
|
69
|
+
),
|
|
70
|
+
],
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const app = createApp(Counter);
|
|
76
|
+
app.mount(target);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
bootstrap().catch((error) => {
|
|
80
|
+
console.error('[RunJS] failed to mount Vue counter', error);
|
|
81
|
+
mountNode.innerHTML = '<div style="color:#c00;">' + (error?.message || ctx.t('Vue initialization failed')) + '</div>';
|
|
82
|
+
});
|
|
83
|
+
`}}};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const __rspack_esm_id="1786";export const __rspack_esm_ids=["1786"];export const __webpack_modules__={25831(e,t,n){n.r(t),n.d(t,{FormJSFieldItemRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"FormJSFieldItem RunJS context",properties:{element:(0,r.e)(`ElementProxy instance providing a safe DOM container for form field rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),value:"Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).",record:`Current record data object (read-only).
|
|
3
|
+
Contains all field values of the parent record.`,formValues:{description:"Snapshot of current form values (object). Available in form contexts (CreateForm/EditForm).",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:`Wait for form field container DOM element to be ready before executing callback.
|
|
4
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`,setProps:`Set form field properties programmatically.
|
|
5
|
+
Parameters: (fieldModel: any, props: { value?: any, disabled?: boolean, visible?: boolean }) => void
|
|
6
|
+
Example: ctx.setProps(fieldModel, { value: "new value" })`}}),o.define({label:"表单 JS 字段项 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,表单字段容器"),value:"字段值(展示模式为只读;受控场景用 setProps 修改)",record:"当前记录(只读)",formValues:{description:"当前表单值快照(对象)。仅表单相关上下文可用(Create/Edit Form)。",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"容器就绪回调",setProps:"设置表单项属性:`setProps(fieldModel, { value })`(由联动/表单上下文提供)"}},{locale:"zh-CN"})},98542(e,t,n){n.r(t),n.d(t,{JSFieldRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"JSField RunJS context",properties:{element:(0,r.e)(`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 })`}}),o.define({label:"JS 字段 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,字段渲染容器,支持 innerHTML/append 等 DOM 操作"),value:"字段当前值(只读)",record:"当前记录对象(只读,包含父记录全部字段值)",collection:"集合定义元数据(只读,描述字段所属集合的 Schema)"},methods:{onRefReady:"在字段容器 DOM 就绪后执行回调。参数:(ref, callback, timeout?);示例:ctx.onRefReady(ctx.ref, el => { el.innerHTML = ctx.value })"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>o});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},84529(e,t,n){n.r(t),n.d(t,{default:()=>o});var i=n(98542),r=n(25831);let o={contexts:[i.JSFieldRunJSContext,r.FormJSFieldItemRunJSContext],prefix:"sn-jsf-num",label:"Display number field as localized number",description:"Format numeric values with locale-aware separators before rendering",locales:{"zh-CN":{label:"将数字字段显示为本地化格式",description:"按本地化格式输出数值"}},content:`
|
|
13
|
+
// Format number using locale
|
|
14
|
+
const n = Number(ctx.value ?? 0);
|
|
15
|
+
ctx.render(String(Number.isFinite(n) ? n.toLocaleString() : ctx.value ?? ''));
|
|
16
|
+
`}}};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const __rspack_esm_id="1951";export const __rspack_esm_ids=["1951"];export const __webpack_modules__={79271(e,t,n){n.r(t),n.d(t,{JSBlockRunJSContext:()=>l});var i=n(29007),r=n(4418);class l extends i.uk{}l.define({label:"RunJS context",properties:{element:(0,r.e)(`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`)."}}),l.define({label:"RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,安全的 DOM 容器,支持 innerHTML/append 等"),record:"当前记录(只读,用于数据区块/详情等场景)",value:"当前值(若存在)",React:"React 库",antd:"Ant Design 库"},methods:{onRefReady:"容器 ref 就绪回调:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"加载外部库:`const lib = await ctx.requireAsync(url)`",importAsync:"按 URL 动态导入 ESM 模块:`const mod = await ctx.importAsync(url)`。\n注意:当模块只有 default 一个导出时,ctx.importAsync 会直接返回 default 值(无需再写 `.default`)。"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>o,e:()=>l});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},47890(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(79271).JSBlockRunJSContext],prefix:"sn-jsb-stats",label:"Render statistics cards",description:"Display multiple statistic cards with numbers from API",locales:{"zh-CN":{label:"渲染统计卡片",description:"显示多个统计数字卡片(从 API 获取数据)"}},content:`
|
|
7
|
+
const { Card, Statistic, Row, Col } = ctx.libs.antd;
|
|
8
|
+
|
|
9
|
+
const res = await ctx.request({
|
|
10
|
+
url: 'users:list',
|
|
11
|
+
method: 'get',
|
|
12
|
+
params: {
|
|
13
|
+
pageSize: 100,
|
|
14
|
+
appends: ['roles'],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const users = res?.data?.data || [];
|
|
19
|
+
|
|
20
|
+
const total = users.length;
|
|
21
|
+
const adminCount = users.filter((user) =>
|
|
22
|
+
Array.isArray(user?.roles) && user.roles.some((role) => role?.name === 'admin')
|
|
23
|
+
).length;
|
|
24
|
+
const withEmail = users.filter((user) => !!user?.email).length;
|
|
25
|
+
const distinctRoles = new Set(
|
|
26
|
+
users
|
|
27
|
+
.flatMap((user) => (Array.isArray(user?.roles) ? user.roles.map((role) => role?.name) : []))
|
|
28
|
+
.filter(Boolean),
|
|
29
|
+
).size;
|
|
30
|
+
|
|
31
|
+
ctx.render(
|
|
32
|
+
<Row gutter={16}>
|
|
33
|
+
<Col span={6}>
|
|
34
|
+
<Card>
|
|
35
|
+
<Statistic title={ctx.t('Total users')} value={total} valueStyle={{ color: '#3f8600' }} />
|
|
36
|
+
</Card>
|
|
37
|
+
</Col>
|
|
38
|
+
<Col span={6}>
|
|
39
|
+
<Card>
|
|
40
|
+
<Statistic title={ctx.t('Administrators')} value={adminCount} valueStyle={{ color: '#1890ff' }} />
|
|
41
|
+
</Card>
|
|
42
|
+
</Col>
|
|
43
|
+
<Col span={6}>
|
|
44
|
+
<Card>
|
|
45
|
+
<Statistic title={ctx.t('Users with email')} value={withEmail} valueStyle={{ color: '#faad14' }} />
|
|
46
|
+
</Card>
|
|
47
|
+
</Col>
|
|
48
|
+
<Col span={6}>
|
|
49
|
+
<Card>
|
|
50
|
+
<Statistic title={ctx.t('Distinct roles')} value={distinctRoles} valueStyle={{ color: '#cf1322' }} />
|
|
51
|
+
</Card>
|
|
52
|
+
</Col>
|
|
53
|
+
</Row>
|
|
54
|
+
);
|
|
55
|
+
`}}};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const __rspack_esm_id="2017";export const __rspack_esm_ids=["2017"];export const __webpack_modules__={32221(e,t,n){n.r(t),n.d(t,{JSItemRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"JSItem RunJS context",properties:{element:(0,r.e)(`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`,formValues:{description:"Snapshot of current form values (object). Available in form contexts (CreateForm/EditForm).",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:`Wait for form item container DOM element to be ready before executing callback.
|
|
5
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),o.define({label:"JS 表单项 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,表单项渲染容器,支持 innerHTML/append 等 DOM 操作"),resource:"当前资源(只读)",record:"当前记录(只读)",formValues:{description:"当前表单值快照(对象)。仅表单相关上下文可用(Create/Edit Form)。",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"容器就绪后执行回调。参数:(ref, callback, timeout?)"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>o});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},57768(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(32221).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:"条件显示/隐藏字段",description:"根据条件批量显示或隐藏多个字段"}},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
|
+
`}}};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const __rspack_esm_id="212";export const __rspack_esm_ids=["212"];export const __webpack_modules__={79271(e,t,n){n.r(t),n.d(t,{JSBlockRunJSContext:()=>l});var i=n(29007),r=n(4418);class l extends i.uk{}l.define({label:"RunJS context",properties:{element:(0,r.e)(`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`)."}}),l.define({label:"RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,安全的 DOM 容器,支持 innerHTML/append 等"),record:"当前记录(只读,用于数据区块/详情等场景)",value:"当前值(若存在)",React:"React 库",antd:"Ant Design 库"},methods:{onRefReady:"容器 ref 就绪回调:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"加载外部库:`const lib = await ctx.requireAsync(url)`",importAsync:"按 URL 动态导入 ESM 模块:`const mod = await ctx.importAsync(url)`。\n注意:当模块只有 default 一个导出时,ctx.importAsync 会直接返回 default 值(无需再写 `.default`)。"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>o,e:()=>l});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},97487(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(79271).JSBlockRunJSContext],prefix:"sn-jsb-click",label:"Add click listener",description:"Render a button and bind a click event handler",locales:{"zh-CN":{label:"添加点击监听",description:"渲染按钮并绑定点击事件处理"}},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
|
+
`}}};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const __rspack_esm_id="2335";export const __rspack_esm_ids=["2335"];export const __webpack_modules__={32221(e,t,n){n.r(t),n.d(t,{JSItemRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"JSItem RunJS context",properties:{element:(0,r.e)(`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
2
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),resource:`Current resource instance (read-only).
|
|
3
|
+
Provides access to the data resource associated with the current form context.`,record:`Current record data object (read-only).
|
|
4
|
+
Contains all field values of the parent record.`,formValues:{description:"Snapshot of current form values (object). Available in form contexts (CreateForm/EditForm).",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:`Wait for form item container DOM element to be ready before executing callback.
|
|
5
|
+
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void`}}),o.define({label:"JS 表单项 RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,表单项渲染容器,支持 innerHTML/append 等 DOM 操作"),resource:"当前资源(只读)",record:"当前记录(只读)",formValues:{description:"当前表单值快照(对象)。仅表单相关上下文可用(Create/Edit Form)。",detail:"Record<string, any>",examples:["const { name, status } = ctx.formValues || {};"]}},methods:{onRefReady:"容器就绪后执行回调。参数:(ref, callback, timeout?)"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>o});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},74354(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(32221).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:"计算总价(数量 \xd7 单价)",description:"当数量或单价变化时自动计算总价"}},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
|
+
`}}};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const __rspack_esm_id="2555";export const __rspack_esm_ids=["2555"];export const __webpack_modules__={79271(e,t,n){n.r(t),n.d(t,{JSBlockRunJSContext:()=>o});var i=n(29007),r=n(4418);class o extends i.uk{}o.define({label:"RunJS context",properties:{element:(0,r.e)(`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`)."}}),o.define({label:"RunJS 上下文",properties:{element:(0,r.V)("ElementProxy,安全的 DOM 容器,支持 innerHTML/append 等"),record:"当前记录(只读,用于数据区块/详情等场景)",value:"当前值(若存在)",React:"React 库",antd:"Ant Design 库"},methods:{onRefReady:"容器 ref 就绪回调:\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"加载外部库:`const lib = await ctx.requireAsync(url)`",importAsync:"按 URL 动态导入 ESM 模块:`const mod = await ctx.importAsync(url)`。\n注意:当模块只有 default 一个导出时,ctx.importAsync 会直接返回 default 值(无需再写 `.default`)。"}},{locale:"zh-CN"})},4418(e,t,n){n.d(t,{V:()=>l,e:()=>o});let i={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:"已消毒的 innerHTML 字符串。",outerHTML:"已消毒的 outerHTML 字符串。",textContent:"文本内容。",style:"内联样式声明。",classList:"CSS class 列表。",appendChild:{type:"function",description:"追加 DOM 节点或文本。",detail:"(child: Node | string) => void",completion:{insertText:"ctx.element.appendChild('text')"}},setAttribute:{type:"function",description:"设置 HTML 属性。",detail:"(name: string, value: string) => void",completion:{insertText:"ctx.element.setAttribute('data-key', 'value')"}},getAttribute:{type:"function",description:"读取 HTML 属性。",detail:"(name: string) => string | null",completion:{insertText:"ctx.element.getAttribute('data-key')"}},querySelector:{type:"function",description:"查询第一个匹配的后代元素。",detail:"(selectors: string) => Element | null",completion:{insertText:"ctx.element.querySelector('.selector')"}},querySelectorAll:{type:"function",description:"查询所有匹配的后代元素。",detail:"(selectors: string) => NodeListOf<Element>",completion:{insertText:"ctx.element.querySelectorAll('.selector')"}},addEventListener:{type:"function",description:"给元素添加事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.addEventListener('click', (event) => {})"}},removeEventListener:{type:"function",description:"移除元素事件监听。",detail:"(type: string, listener: EventListener) => void",completion:{insertText:"ctx.element.removeEventListener('click', handler)"}}};function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Current DOM container for this RunJS context. Usually an ElementProxy.";return{description:e,detail:"HTMLElement | ElementProxy",properties:i}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"当前 RunJS 上下文的 DOM 容器,通常为 ElementProxy。";return{description:e,detail:"HTMLElement | ElementProxy",properties:r}}},53494(e,t,n){n.r(t),n.d(t,{default:()=>i});let i={contexts:[n(79271).JSBlockRunJSContext],prefix:"sn-jsb-info-card",label:"Render record info card",description:"Display current record information in an Ant Design card",locales:{"zh-CN":{label:"渲染记录信息卡片",description:"使用 Ant Design 卡片显示当前记录的关键信息"}},content:`
|
|
7
|
+
const { Card, Descriptions, Tag } = ctx.libs.antd;
|
|
8
|
+
|
|
9
|
+
if (!ctx.record) {
|
|
10
|
+
ctx.render('<div style="padding:16px;color:#999;">' + ctx.t('No record data') + '</div>');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const record = ctx.record;
|
|
15
|
+
|
|
16
|
+
ctx.render(
|
|
17
|
+
<Card title={ctx.t('Record Details')} bordered style={{ margin: 0 }}>
|
|
18
|
+
<Descriptions column={2} size="small">
|
|
19
|
+
<Descriptions.Item label={ctx.t('ID')}>{record.id || '-'}</Descriptions.Item>
|
|
20
|
+
<Descriptions.Item label={ctx.t('Status')}>
|
|
21
|
+
<Tag color={record.status === 'active' ? 'green' : 'default'}>{record.status || '-'}</Tag>
|
|
22
|
+
</Descriptions.Item>
|
|
23
|
+
<Descriptions.Item label={ctx.t('Title')}>{record.title || '-'}</Descriptions.Item>
|
|
24
|
+
<Descriptions.Item label={ctx.t('Created At')}>
|
|
25
|
+
{record.createdAt ? new Date(record.createdAt).toLocaleString() : '-'}
|
|
26
|
+
</Descriptions.Item>
|
|
27
|
+
</Descriptions>
|
|
28
|
+
</Card>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
`}}};
|