@nocobase/app 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/{1595.1827ce7f.async.js → 1595.9f992743.async.js} +22 -23
- package/dist/client/{2097.5a49892c.async.js → 2097.919e4d8a.async.js} +8 -6
- package/dist/client/3885.fd54a10c.async.js +50 -0
- package/dist/client/4356.d61392c6.async.js +18 -0
- package/dist/client/{4750.044f647b.async.js → 4750.ce3051f3.async.js} +17 -18
- package/dist/client/5505.a71c2922.async.js +2 -0
- package/dist/client/{645.ea6376fe.async.js → 645.ab5af584.async.js} +25 -30
- package/dist/client/6939.d7d780b7.async.js +17 -0
- package/dist/client/{703.20003a5c.async.js → 703.7ad807b0.async.js} +9 -9
- package/dist/client/7764.a3ae7727.async.js +25 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/npm._at_ant-design.3d565a45.async.js +141 -0
- package/dist/client/npm._at_jridgewell.72fd4dd4.async.js +1 -0
- package/dist/client/npm.acorn.59eb4103.async.js +11 -0
- package/dist/client/npm.antd-mobile.55661292.async.js +2 -0
- package/dist/client/{npm.antd.acf65d87.async.js → npm.antd.601f2259.async.js} +1 -1
- package/dist/client/npm.babel-runtime.eed49798.async.js +1 -0
- package/dist/client/{npm.highlight.js.d3beb708.async.js → npm.highlight.js.5db864c8.async.js} +2 -2
- package/dist/client/npm.liquidjs.7be2e0df.async.js +13 -0
- package/dist/client/npm.sucrase.1cb664e8.async.js +135 -0
- package/dist/client/{npm.unknown.1838c8f4.chunk.css → npm.unknown.d9b587d9.chunk.css} +26 -1
- package/dist/client/npm.vditor.eb5da290.async.js +233 -0
- package/dist/client/p__index.105f1972.async.js +2505 -0
- package/dist/client/{umi.d90bd9c6.js → umi.354b8729.js} +17 -17
- package/lib/config/telemetry.js +1 -0
- package/package.json +6 -6
- package/src/config/telemetry.ts +1 -0
- package/dist/client/7197.bb3092b2.async.js +0 -35
- package/dist/client/7482.3924bcd9.async.js +0 -1
- package/dist/client/npm._at_ant-design.c2d0554a.async.js +0 -141
- package/dist/client/npm._at_babel.94b2dd75.async.js +0 -3
- package/dist/client/npm.acorn.1f389fab.async.js +0 -6
- package/dist/client/npm.antd-mobile.1a8a8320.async.js +0 -2
- package/dist/client/npm.async-validator.32d9020f.async.js +0 -12
- package/dist/client/npm.buffer.bc3fb79b.async.js +0 -1
- package/dist/client/npm.react-dom.b9fb5fd7.async.js +0 -11
- package/dist/client/p__index.07478c80.async.js +0 -2272
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4356,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var t=e(72004),_=e.n(t),s=e(12444),l=e.n(s),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(1772),r=function(b){c()(o,b);var p=u()(o);function o(){return l()(this,o),p.apply(this,arguments)}return _()(o)}(m.Uo);r.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)`"}}),r.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},24356:function(a,n,e){e.r(n);var t=e(10095),_={contexts:[t.JSBlockRunJSContext],prefix:"sn-react-jsx",label:"Render React (JSX)",description:"Render a simple React component using JSX syntax",locales:{"zh-CN":{label:"\u6E32\u67D3 React\uFF08JSX\uFF09",description:"\u4F7F\u7528 JSX \u8BED\u6CD5\u6E32\u67D3\u4E00\u4E2A\u7B80\u5355\u7684 React \u7EC4\u4EF6"}},content:`
|
|
7
|
+
// Render a React component with JSX
|
|
8
|
+
const { React } = ctx.libs;
|
|
9
|
+
|
|
10
|
+
const App = () => (
|
|
11
|
+
<div style={{ padding: 12 }}>
|
|
12
|
+
<h3 style={{ margin: 0, color: '#1890ff' }}>Hello JSX</h3>
|
|
13
|
+
<div style={{ color: '#555' }}>This block is rendered by JSX.</div>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
ctx.render(<App />);
|
|
18
|
+
`};n.default=_}}]);
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4750,95],{10095:function(
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[4750,95],{10095:function(s,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return _}});var o=e(72004),r=e.n(o),a=e(12444),l=e.n(a),i=e(31996),c=e.n(i),d=e(26037),u=e.n(d),m=e(1772),_=function(b){c()(t,b);var p=u()(t);function t(){return l()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);_.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
|
|
2
2
|
Supports innerHTML, append, and other DOM manipulation methods.
|
|
3
3
|
Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
|
|
4
4
|
Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
|
|
5
5
|
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
6
|
-
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),_.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},24750:function(
|
|
7
|
-
const { Card, Descriptions, Tag
|
|
8
|
-
const { createElement: h } = ctx.React;
|
|
6
|
+
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),_.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},24750:function(s,n,e){e.r(n);var o=e(10095),r={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-info-card",label:"Render record info card",description:"Display current record information in an Ant Design card",locales:{"zh-CN":{label:"\u6E32\u67D3\u8BB0\u5F55\u4FE1\u606F\u5361\u7247",description:"\u4F7F\u7528 Ant Design \u5361\u7247\u663E\u793A\u5F53\u524D\u8BB0\u5F55\u7684\u5173\u952E\u4FE1\u606F"}},content:`
|
|
7
|
+
const { Card, Descriptions, Tag } = ctx.libs.antd;
|
|
9
8
|
|
|
10
9
|
if (!ctx.record) {
|
|
11
|
-
ctx.
|
|
10
|
+
ctx.render('<div style="padding:16px;color:#999;">' + ctx.t('No record data') + '</div>');
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
const record = ctx.record;
|
|
16
15
|
|
|
17
|
-
ctx.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
record.createdAt ? new Date(record.createdAt).toLocaleString() : '-'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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>
|
|
30
29
|
);
|
|
31
30
|
|
|
32
31
|
`};n.default=r}}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[5505],{18589:function(U,e){var _;_=!0,_=void 0;var j=`
|
|
2
|
+
`,v="\r",k=function(){function f(c){this.string=c;for(var s=[0],l=0;l<c.length;)switch(c[l]){case j:l+=j.length,s.push(l);break;case v:l+=v.length,c[l]===j&&(l+=j.length),s.push(l);break;default:l++;break}this.offsets=s}return f.prototype.locationForIndex=function(c){if(c<0||c>this.string.length)return null;for(var s=0,l=this.offsets;l[s+1]<=c;)s++;var o=c-l[s];return{line:s,column:o}},f.prototype.indexForLocation=function(c){var s=c.line,l=c.column;return s<0||s>=this.offsets.length||l<0||l>this.lengthOfLine(s)?null:this.offsets[s]+l},f.prototype.lengthOfLine=function(c){var s=this.offsets[c],l=c===this.offsets.length-1?this.string.length:this.offsets[c+1];return l-s},f}();_=k,e.ZP=k},41074:function(U,e,_){var j=this&&this.__spreadArrays||function(){for(var o=0,u=0,h=arguments.length;u<h;u++)o+=arguments[u].length;for(var g=Array(o),d=0,u=0;u<h;u++)for(var O=arguments[u],E=0,I=O.length;E<I;E++,d++)g[d]=O[E];return g};Object.defineProperty(e,"__esModule",{value:!0}),e.Checker=e.createCheckers=void 0;var v=_(22746),k=_(67180),f=_(22746);Object.defineProperty(e,"TArray",{enumerable:!0,get:function(){return f.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:!0,get:function(){return f.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:!0,get:function(){return f.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:!0,get:function(){return f.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:!0,get:function(){return f.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:!0,get:function(){return f.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:!0,get:function(){return f.TName}}),Object.defineProperty(e,"TOptional",{enumerable:!0,get:function(){return f.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:!0,get:function(){return f.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:!0,get:function(){return f.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:!0,get:function(){return f.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:!0,get:function(){return f.TTuple}}),Object.defineProperty(e,"TType",{enumerable:!0,get:function(){return f.TType}}),Object.defineProperty(e,"TUnion",{enumerable:!0,get:function(){return f.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:!0,get:function(){return f.TIntersection}}),Object.defineProperty(e,"array",{enumerable:!0,get:function(){return f.array}}),Object.defineProperty(e,"enumlit",{enumerable:!0,get:function(){return f.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:!0,get:function(){return f.enumtype}}),Object.defineProperty(e,"func",{enumerable:!0,get:function(){return f.func}}),Object.defineProperty(e,"iface",{enumerable:!0,get:function(){return f.iface}}),Object.defineProperty(e,"lit",{enumerable:!0,get:function(){return f.lit}}),Object.defineProperty(e,"name",{enumerable:!0,get:function(){return f.name}}),Object.defineProperty(e,"opt",{enumerable:!0,get:function(){return f.opt}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return f.param}}),Object.defineProperty(e,"tuple",{enumerable:!0,get:function(){return f.tuple}}),Object.defineProperty(e,"union",{enumerable:!0,get:function(){return f.union}}),Object.defineProperty(e,"intersection",{enumerable:!0,get:function(){return f.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:!0,get:function(){return f.BasicType}});var c=_(67180);Object.defineProperty(e,"VError",{enumerable:!0,get:function(){return c.VError}});function s(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];for(var h=Object.assign.apply(Object,j([{},v.basicTypes],o)),g={},d=0,O=o;d<O.length;d++)for(var E=O[d],I=0,S=Object.keys(E);I<S.length;I++){var M=S[I];g[M]=new l(h,E[M])}return g}e.createCheckers=s;var l=function(){function o(u,h,g){if(g===void 0&&(g="value"),this.suite=u,this.ttype=h,this._path=g,this.props=new Map,h instanceof v.TIface)for(var d=0,O=h.props;d<O.length;d++){var E=O[d];this.props.set(E.name,E.ttype)}this.checkerPlain=this.ttype.getChecker(u,!1),this.checkerStrict=this.ttype.getChecker(u,!0)}return o.prototype.setReportedPath=function(u){this._path=u},o.prototype.check=function(u){return this._doCheck(this.checkerPlain,u)},o.prototype.test=function(u){return this.checkerPlain(u,new k.NoopContext)},o.prototype.validate=function(u){return this._doValidate(this.checkerPlain,u)},o.prototype.strictCheck=function(u){return this._doCheck(this.checkerStrict,u)},o.prototype.strictTest=function(u){return this.checkerStrict(u,new k.NoopContext)},o.prototype.strictValidate=function(u){return this._doValidate(this.checkerStrict,u)},o.prototype.getProp=function(u){var h=this.props.get(u);if(!h)throw new Error("Type has no property "+u);return new o(this.suite,h,this._path+"."+u)},o.prototype.methodArgs=function(u){var h=this._getMethod(u);return new o(this.suite,h.paramList)},o.prototype.methodResult=function(u){var h=this._getMethod(u);return new o(this.suite,h.result)},o.prototype.getArgs=function(){if(!(this.ttype instanceof v.TFunc))throw new Error("getArgs() applied to non-function");return new o(this.suite,this.ttype.paramList)},o.prototype.getResult=function(){if(!(this.ttype instanceof v.TFunc))throw new Error("getResult() applied to non-function");return new o(this.suite,this.ttype.result)},o.prototype.getType=function(){return this.ttype},o.prototype._doCheck=function(u,h){var g=new k.NoopContext;if(!u(h,g)){var d=new k.DetailContext;throw u(h,d),d.getError(this._path)}},o.prototype._doValidate=function(u,h){var g=new k.NoopContext;if(u(h,g))return null;var d=new k.DetailContext;return u(h,d),d.getErrorDetail(this._path)},o.prototype._getMethod=function(u){var h=this.props.get(u);if(!h)throw new Error("Type has no property "+u);if(!(h instanceof v.TFunc))throw new Error("Property "+u+" is not a method");return h},o}();e.Checker=l},22746:function(U,e,_){var j=_(48764).lW,v=this&&this.__extends||function(){var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var p in a)a.hasOwnProperty(p)&&(i[p]=a[p])},t(n,r)};return function(n,r){t(n,r);function i(){this.constructor=n}n.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var k=_(67180),f=function(){function t(){}return t}();e.TType=f;function c(t){return typeof t=="string"?l(t):t}function s(t,n){var r=t[n];if(!r)throw new Error("Unknown type "+n);return r}function l(t){return new o(t)}e.name=l;var o=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.name=r,i._failMsg="is not a "+r,i}return n.prototype.getChecker=function(r,i,a){var p=this,y=s(r,this.name),m=y.getChecker(r,i,a);return y instanceof C||y instanceof n?m:function(b,T){return m(b,T)?!0:T.fail(null,p._failMsg,0)}},n}(f);e.TName=o;function u(t){return new h(t)}e.lit=u;var h=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.value=r,i.name=JSON.stringify(r),i._failMsg="is not "+i.name,i}return n.prototype.getChecker=function(r,i){var a=this;return function(p,y){return p===a.value?!0:y.fail(null,a._failMsg,-1)}},n}(f);e.TLiteral=h;function g(t){return new d(c(t))}e.array=g;var d=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.ttype=r,i}return n.prototype.getChecker=function(r,i){var a=this.ttype.getChecker(r,i);return function(p,y){if(!Array.isArray(p))return y.fail(null,"is not an array",0);for(var m=0;m<p.length;m++){var b=a(p[m],y);if(!b)return y.fail(m,null,1)}return!0}},n}(f);e.TArray=d;function O(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new E(t.map(function(r){return c(r)}))}e.tuple=O;var E=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.ttypes=r,i}return n.prototype.getChecker=function(r,i){var a=this.ttypes.map(function(y){return y.getChecker(r,i)}),p=function(y,m){if(!Array.isArray(y))return m.fail(null,"is not an array",0);for(var b=0;b<a.length;b++){var T=a[b](y[b],m);if(!T)return m.fail(b,null,1)}return!0};return i?function(y,m){return p(y,m)?y.length<=a.length?!0:m.fail(a.length,"is extraneous",2):!1}:p},n}(f);e.TTuple=E;function I(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new S(t.map(function(r){return c(r)}))}e.union=I;var S=function(t){v(n,t);function n(r){var i=t.call(this)||this;i.ttypes=r;var a=r.map(function(y){return y instanceof o||y instanceof h?y.name:null}).filter(function(y){return y}),p=r.length-a.length;return a.length?(p>0&&a.push(p+" more"),i._failMsg="is none of "+a.join(", ")):i._failMsg="is none of "+p+" types",i}return n.prototype.getChecker=function(r,i){var a=this,p=this.ttypes.map(function(y){return y.getChecker(r,i)});return function(y,m){for(var b=m.unionResolver(),T=0;T<p.length;T++){var P=p[T](y,b.createContext());if(P)return!0}return m.resolveUnion(b),m.fail(null,a._failMsg,0)}},n}(f);e.TUnion=S;function M(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new J(t.map(function(r){return c(r)}))}e.intersection=M;var J=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.ttypes=r,i}return n.prototype.getChecker=function(r,i){var a=new Set,p=this.ttypes.map(function(y){return y.getChecker(r,i,a)});return function(y,m){var b=p.every(function(T){return T(y,m)});return b?!0:m.fail(null,null,0)}},n}(f);e.TIntersection=J;function Y(t){return new R(t)}e.enumtype=Y;var R=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.members=r,i.validValues=new Set,i._failMsg="is not a valid enum value",i.validValues=new Set(Object.keys(r).map(function(a){return r[a]})),i}return n.prototype.getChecker=function(r,i){var a=this;return function(p,y){return a.validValues.has(p)?!0:y.fail(null,a._failMsg,0)}},n}(f);e.TEnumType=R;function $(t,n){return new W(t,n)}e.enumlit=$;var W=function(t){v(n,t);function n(r,i){var a=t.call(this)||this;return a.enumName=r,a.prop=i,a._failMsg="is not "+r+"."+i,a}return n.prototype.getChecker=function(r,i){var a=this,p=s(r,this.enumName);if(!(p instanceof R))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var y=p.members[this.prop];if(!p.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(m,b){return m===y?!0:b.fail(null,a._failMsg,-1)}},n}(f);e.TEnumLiteral=W;function q(t){return Object.keys(t).map(function(n){return x(n,t[n])})}function x(t,n){return n instanceof D?new V(t,n.ttype,!0):new V(t,c(n),!1)}function tt(t,n){return new Z(t,q(n))}e.iface=tt;var Z=function(t){v(n,t);function n(r,i){var a=t.call(this)||this;return a.bases=r,a.props=i,a.propSet=new Set(i.map(function(p){return p.name})),a}return n.prototype.getChecker=function(r,i,a){var p=this,y=this.bases.map(function(w){return s(r,w).getChecker(r,i)}),m=this.props.map(function(w){return w.ttype.getChecker(r,i)}),b=new k.NoopContext,T=this.props.map(function(w,A){return!w.isOpt&&!m[A](void 0,b)}),P=function(w,A){if(typeof w!="object"||w===null)return A.fail(null,"is not an object",0);for(var N=0;N<y.length;N++)if(!y[N](w,A))return!1;for(var N=0;N<m.length;N++){var F=p.props[N].name,X=w[F];if(X===void 0){if(T[N])return A.fail(F,"is missing",1)}else{var at=m[N](X,A);if(!at)return A.fail(F,null,1)}}return!0};if(!i)return P;var L=this.propSet;return a&&(this.propSet.forEach(function(w){return a.add(w)}),L=a),function(w,A){if(!P(w,A))return!1;for(var N in w)if(!L.has(N))return A.fail(N,"is extraneous",2);return!0}},n}(f);e.TIface=Z;function et(t){return new D(c(t))}e.opt=et;var D=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.ttype=r,i}return n.prototype.getChecker=function(r,i){var a=this.ttype.getChecker(r,i);return function(p,y){return p===void 0||a(p,y)}},n}(f);e.TOptional=D;var V=function(){function t(n,r,i){this.name=n,this.ttype=r,this.isOpt=i}return t}();e.TProp=V;function nt(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return new z(new H(n),c(t))}e.func=nt;var z=function(t){v(n,t);function n(r,i){var a=t.call(this)||this;return a.paramList=r,a.result=i,a}return n.prototype.getChecker=function(r,i){return function(a,p){return typeof a=="function"?!0:p.fail(null,"is not a function",0)}},n}(f);e.TFunc=z;function rt(t,n,r){return new G(t,c(n),!!r)}e.param=rt;var G=function(){function t(n,r,i){this.name=n,this.ttype=r,this.isOpt=i}return t}();e.TParam=G;var H=function(t){v(n,t);function n(r){var i=t.call(this)||this;return i.params=r,i}return n.prototype.getChecker=function(r,i){var a=this,p=this.params.map(function(T){return T.ttype.getChecker(r,i)}),y=new k.NoopContext,m=this.params.map(function(T,P){return!T.isOpt&&!p[P](void 0,y)}),b=function(T,P){if(!Array.isArray(T))return P.fail(null,"is not an array",0);for(var L=0;L<p.length;L++){var w=a.params[L];if(T[L]===void 0){if(m[L])return P.fail(w.name,"is missing",1)}else{var A=p[L](T[L],P);if(!A)return P.fail(w.name,null,1)}}return!0};return i?function(T,P){return b(T,P)?T.length<=p.length?!0:P.fail(p.length,"is extraneous",2):!1}:b},n}(f);e.TParamList=H;var C=function(t){v(n,t);function n(r,i){var a=t.call(this)||this;return a.validator=r,a.message=i,a}return n.prototype.getChecker=function(r,i){var a=this;return function(p,y){return a.validator(p)?!0:y.fail(null,a.message,0)}},n}(f);e.BasicType=C,e.basicTypes={any:new C(function(t){return!0},"is invalid"),number:new C(function(t){return typeof t=="number"},"is not a number"),object:new C(function(t){return typeof t=="object"&&t},"is not an object"),boolean:new C(function(t){return typeof t=="boolean"},"is not a boolean"),string:new C(function(t){return typeof t=="string"},"is not a string"),symbol:new C(function(t){return typeof t=="symbol"},"is not a symbol"),void:new C(function(t){return t==null},"is not void"),undefined:new C(function(t){return t===void 0},"is not undefined"),null:new C(function(t){return t===null},"is not null"),never:new C(function(t){return!1},"is unexpected"),Date:new C(K("[object Date]"),"is not a Date"),RegExp:new C(K("[object RegExp]"),"is not a RegExp")};var it=Object.prototype.toString;function K(t){return function(n){return typeof n=="object"&&n&&it.call(n)===t}}typeof j<"u"&&(e.basicTypes.Buffer=new C(function(t){return j.isBuffer(t)},"is not a Buffer"));for(var ut=function(t){e.basicTypes[t.name]=new C(function(n){return n instanceof t},"is not a "+t.name)},B=0,Q=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];B<Q.length;B++){var ot=Q[B];ut(ot)}},67180:function(U,e){var _=this&&this.__extends||function(){var c=function(s,l){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var h in u)u.hasOwnProperty(h)&&(o[h]=u[h])},c(s,l)};return function(s,l){c(s,l);function o(){this.constructor=s}s.prototype=l===null?Object.create(l):(o.prototype=l.prototype,new o)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.DetailContext=e.NoopContext=e.VError=void 0;var j=function(c){_(s,c);function s(l,o){var u=c.call(this,o)||this;return u.path=l,Object.setPrototypeOf(u,s.prototype),u}return s}(Error);e.VError=j;var v=function(){function c(){}return c.prototype.fail=function(s,l,o){return!1},c.prototype.unionResolver=function(){return this},c.prototype.createContext=function(){return this},c.prototype.resolveUnion=function(s){},c}();e.NoopContext=v;var k=function(){function c(){this._propNames=[""],this._messages=[null],this._score=0}return c.prototype.fail=function(s,l,o){return this._propNames.push(s),this._messages.push(l),this._score+=o,!1},c.prototype.unionResolver=function(){return new f},c.prototype.resolveUnion=function(s){for(var l,o,u=s,h=null,g=0,d=u.contexts;g<d.length;g++){var O=d[g];(!h||O._score>=h._score)&&(h=O)}h&&h._score>0&&((l=this._propNames).push.apply(l,h._propNames),(o=this._messages).push.apply(o,h._messages))},c.prototype.getError=function(s){for(var l=[],o=this._propNames.length-1;o>=0;o--){var u=this._propNames[o];s+=typeof u=="number"?"["+u+"]":u?"."+u:"";var h=this._messages[o];h&&l.push(s+" "+h)}return new j(s,l.join("; "))},c.prototype.getErrorDetail=function(s){for(var l=[],o=this._propNames.length-1;o>=0;o--){var u=this._propNames[o];s+=typeof u=="number"?"["+u+"]":u?"."+u:"";var h=this._messages[o];h&&l.push({path:s,message:h})}for(var g=null,o=l.length-1;o>=0;o--)g&&(l[o].nested=[g]),g=l[o];return g},c}();e.DetailContext=k;var f=function(){function c(){this.contexts=[]}return c.prototype.createContext=function(){var s=new k;return this.contexts.push(s),s},c}()}}]);
|
|
@@ -1,11 +1,10 @@
|
|
|
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),
|
|
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),u=e.n(i),c=e(26037),d=e.n(c),m=e(1772),s=function(b){u()(t,b);var p=d()(t);function t(){return _()(this,t),p.apply(this,arguments)}return r()(t)}(m.Uo);s.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
|
|
2
2
|
Supports innerHTML, append, and other DOM manipulation methods.
|
|
3
3
|
Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
|
|
4
4
|
Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
|
|
5
5
|
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
6
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;
|
|
7
|
+
const { Card, Statistic, Row, Col } = ctx.libs.antd;
|
|
9
8
|
|
|
10
9
|
const res = await ctx.api.request({
|
|
11
10
|
url: 'users:list',
|
|
@@ -29,32 +28,28 @@ const distinctRoles = new Set(
|
|
|
29
28
|
.filter(Boolean),
|
|
30
29
|
).size;
|
|
31
30
|
|
|
32
|
-
ctx.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
)
|
|
57
|
-
)
|
|
58
|
-
)
|
|
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>
|
|
59
54
|
);
|
|
60
55
|
`};n.default=r}}]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[6939],{96939:function(o,t,n){n.r(t);var e={contexts:["*"],prefix:"sn-clipboard-copy",label:"Copy text to clipboard (function)",description:"A reusable function that copies a given string to the clipboard.",locales:{"zh-CN":{label:"\u590D\u5236\u6587\u672C\u5230\u526A\u8D34\u677F\uFF08\u51FD\u6570\uFF09",description:"\u901A\u7528\u51FD\u6570\uFF1A\u63A5\u53D7\u4E00\u4E2A\u5B57\u7B26\u4E32\u53C2\u6570\u5E76\u590D\u5236\u5230\u526A\u8D34\u677F\u3002"}},content:`
|
|
2
|
+
// A general utility function that copies text to clipboard.
|
|
3
|
+
// Usage:
|
|
4
|
+
// const ok = await copyTextToClipboard('Hello');
|
|
5
|
+
// if (ok) { /* success */ } else { /* handle failure */ }
|
|
6
|
+
async function copyTextToClipboard(text) {
|
|
7
|
+
const s = String(text ?? '');
|
|
8
|
+
try {
|
|
9
|
+
if (navigator?.clipboard?.writeText) {
|
|
10
|
+
await navigator.clipboard.writeText(s);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
} catch (_) {
|
|
14
|
+
// Fallback below
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`};t.default=e}}]);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[703,95],{10095:function(
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[703,95],{10095:function(a,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return r}});var o=e(72004),_=e.n(o),s=e(12444),l=e.n(s),c=e(31996),i=e.n(c),u=e(26037),d=e.n(u),m=e(1772),r=function(b){i()(t,b);var p=d()(t);function t(){return l()(this,t),p.apply(this,arguments)}return _()(t)}(m.Uo);r.define({label:"RunJS context",properties:{element:{description:`ElementProxy instance providing a safe DOM container.
|
|
2
2
|
Supports innerHTML, append, and other DOM manipulation methods.
|
|
3
3
|
Use this to render content in the JS block.`,detail:"ElementProxy",properties:{innerHTML:"Set or read the HTML content of the container element."}},record:`Current record data object (read-only).
|
|
4
4
|
Available when the JS block is within a data block or detail view context.`,value:"Current value of the field or component, if available in the current context.",React:"React library",antd:"Ant Design library"},methods:{onRefReady:`Wait for container DOM element to be ready before executing callback.
|
|
5
5
|
Parameters: (ref: React.RefObject, callback: (element: HTMLElement) => void, timeout?: number) => void
|
|
6
|
-
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),
|
|
6
|
+
Example: ctx.onRefReady(ctx.ref, (el) => { el.innerHTML = "Ready!" })`,requireAsync:"Load external library: `const lib = await ctx.requireAsync(url)`",importAsync:"Dynamically import ESM module: `const mod = await ctx.importAsync(url)`"}}),r.define({label:"RunJS \u4E0A\u4E0B\u6587",properties:{element:{description:"ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",detail:"ElementProxy",properties:{innerHTML:"\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"}},record:"\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",value:"\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",React:"React \u5E93",antd:"Ant Design \u5E93"},methods:{onRefReady:"\u5BB9\u5668 ref \u5C31\u7EEA\u56DE\u8C03\uFF1A\n```js\nctx.onRefReady(ctx.ref, el => { /* ... */ })\n```",requireAsync:"\u52A0\u8F7D\u5916\u90E8\u5E93\uFF1A`const lib = await ctx.requireAsync(url)`",importAsync:"\u6309 URL \u52A8\u6001\u5BFC\u5165 ESM \u6A21\u5757\uFF1A`const mod = await ctx.importAsync(url)`"}},{locale:"zh-CN"})},70703:function(a,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
7
|
// Render a React element into ctx.element via ReactDOM
|
|
8
|
-
const {
|
|
9
|
-
const { Button } = antd;
|
|
8
|
+
const { Button } = ctx.libs.antd;
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
ctx.render(
|
|
11
|
+
<div style={{ padding: 12 }}>
|
|
12
|
+
<Button type="primary" onClick={() => ctx.message.success(ctx.t('Clicked!'))}>
|
|
13
|
+
{ctx.t('Click')}
|
|
14
|
+
</Button>
|
|
15
|
+
</div>
|
|
15
16
|
);
|
|
16
|
-
ReactDOM.createRoot(ctx.element).render(node);
|
|
17
17
|
`};n.default=_}}]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[7764,95],{10095:function(r,n,e){e.r(n),e.d(n,{JSBlockRunJSContext:function(){return s}});var o=e(72004),_=e.n(o),a=e(12444),l=e.n(a),i=e(31996),c=e.n(i),u=e(26037),d=e.n(u),m=e(1772),s=function(b){c()(t,b);var p=d()(t);function t(){return l()(this,t),p.apply(this,arguments)}return _()(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"})},17764:function(r,n,e){e.r(n);var o=e(10095),_={contexts:[o.JSBlockRunJSContext],prefix:"sn-jsb-antd-icons",label:"Render Ant Design icons",description:"Render Ant Design icons with buttons inside the block container",locales:{"zh-CN":{label:"\u6E32\u67D3 Ant Design \u56FE\u6807",description:"\u5728\u533A\u5757\u5BB9\u5668\u4E2D\u4F7F\u7528 Ant Design \u56FE\u6807\u4E0E\u6309\u94AE\u8FDB\u884C\u6E32\u67D3"}},content:`
|
|
7
|
+
// Render Ant Design icons with buttons via ctx.libs
|
|
8
|
+
const { React, antd, antdIcons } = ctx.libs;
|
|
9
|
+
const { Button, Space } = antd;
|
|
10
|
+
const { PlusOutlined, EditOutlined, DeleteOutlined } = antdIcons;
|
|
11
|
+
|
|
12
|
+
const IconButtons = () => (
|
|
13
|
+
<Space style={{ padding: 12 }}>
|
|
14
|
+
<Button type="primary" icon={<PlusOutlined />}>
|
|
15
|
+
{ctx.t('Add')}
|
|
16
|
+
</Button>
|
|
17
|
+
<Button icon={<EditOutlined />}>{ctx.t('Edit')}</Button>
|
|
18
|
+
<Button danger icon={<DeleteOutlined />}>
|
|
19
|
+
{ctx.t('Delete')}
|
|
20
|
+
</Button>
|
|
21
|
+
</Space>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
ctx.render(<IconButtons />);
|
|
25
|
+
`};n.default=_}}]);
|
package/dist/client/index.html
CHANGED