zova-module-a-command 5.1.29 → 5.1.33
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/cli/command/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/cli/commandBulk/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/cli/commandDetailsRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +20 -0
- package/cli/commandRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/dist/index.js.map +1 -1
- package/dist/types/command.d.ts +2 -0
- package/dist/types/command.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/types/command.ts +2 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
8
|
import { BeanBase } from 'zova';
|
|
4
|
-
import { Command
|
|
9
|
+
import { Command } from 'zova-module-a-command';
|
|
5
10
|
|
|
6
11
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
7
12
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandBulkOptionsBase,
|
|
3
|
+
ICommandExecute,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
|
-
import { BeanCommandBulkBase, Command
|
|
8
|
+
import { BeanCommandBulkBase, Command } from 'zova-module-a-command';
|
|
4
9
|
|
|
5
10
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
6
11
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandDetailsRowOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
6
|
+
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
7
|
+
|
|
8
|
+
import { BeanBase } from 'zova';
|
|
9
|
+
import { Command } from 'zova-module-a-command';
|
|
10
|
+
|
|
11
|
+
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
12
|
+
|
|
13
|
+
export interface ICommandOptions<%=argv.beanNameCapitalize%> extends ICommandDetailsRowOptionsBase<TypeCommand<%=argv.beanNameCapitalize%>Result> {}
|
|
14
|
+
|
|
15
|
+
@Command<ICommandOptions<%=argv.beanNameCapitalize%>>()
|
|
16
|
+
export class Command<%=argv.beanNameCapitalize%> extends BeanBase implements ICommandExecute {
|
|
17
|
+
execute(_options: ICommandOptions<%=argv.beanNameCapitalize%>, _renderContext: IJsxRenderContextBase, next: NextCommandExecute) {
|
|
18
|
+
return next();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandRowOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
|
-
import { BeanCommandRowBase, Command
|
|
8
|
+
import { BeanCommandRowBase, Command } from 'zova-module-a-command';
|
|
4
9
|
|
|
5
10
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
6
11
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/lib/performCommand.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/beanCommandBulkBase.ts","../src/lib/beanCommandRowBase.ts","../src/lib/command.ts","../src/types/command.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/lib/performCommand.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/beanCommandBulkBase.ts","../src/lib/beanCommandRowBase.ts","../src/lib/command.ts","../src/types/command.ts"],"sourcesContent":["import { beanFullNameFromOnionName, deepExtend } from 'zova';\nexport function $performCommand(sys, commandName, options, renderContext, next) {\n if (!next) {\n next = commandRes => {\n return commandRes;\n };\n }\n // command\n const beanFullName = beanFullNameFromOnionName(commandName, 'command');\n const beanInstance = sys.bean._getBeanSyncOnly(beanFullName);\n if (beanInstance) {\n // sync\n return _renderEventCommandNormal_inner(beanInstance, options, renderContext, next);\n }\n // async\n return sys.bean._getBean(beanFullName, false).then(beanInstance => {\n return _renderEventCommandNormal_inner(beanInstance, options, renderContext, next);\n });\n}\nfunction _renderEventCommandNormal_inner(beanInstance, options, renderContext, next) {\n const onionOptions = beanInstance.$onionOptions;\n // props\n const props = onionOptions ? deepExtend({}, onionOptions, options) : options ?? {};\n return beanInstance.execute(props, renderContext, next);\n}","import { BeanSimple, cast } from 'zova';\nimport { $performCommand } from './lib/performCommand.js';\nexport class Monkey extends BeanSimple {\n async beanInit(bean, beanInstance) {\n const self = this;\n bean.defineProperty(beanInstance, '$performCommand', {\n enumerable: false,\n configurable: true,\n get() {\n return function (commandName, options, renderContext, next) {\n renderContext = Object.assign({\n app: cast(beanInstance).app,\n ctx: cast(beanInstance).ctx,\n $host: beanInstance\n }, renderContext);\n return $performCommand(self.sys, commandName, options, renderContext, next);\n };\n }\n });\n }\n}","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\nexport let ScopeModuleACommand = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-command\"\n}), _dec(_class = _dec2(_class = class ScopeModuleACommand extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","import { BeanBase } from 'zova';\nexport class BeanCommandBulkBase extends BeanBase {\n getResource(options, renderContext) {\n let resource = options.resource;\n if (renderContext.$scene === 'page') {\n const {\n $celScope\n } = renderContext;\n resource = resource ?? $celScope.resource;\n }\n if (!resource) {\n throw new Error(`should specify resource in scene: ${renderContext.$scene}`);\n }\n return {\n resource\n };\n }\n}","import { isNil } from '@cabloy/utils';\nimport { BeanBase } from 'zova';\nexport class BeanCommandRowBase extends BeanBase {\n getResourceAndId(options, renderContext) {\n let resource = options.resource;\n let id = options.id;\n if (renderContext.$scene === 'tableCell') {\n const {\n $celScope,\n cellContext\n } = renderContext;\n resource = resource ?? $celScope.resource;\n id = id ?? cellContext.row.id;\n }\n if (isNil(resource) || isNil(id)) {\n throw new Error(`should specify resource or id in scene: ${renderContext.$scene}`);\n }\n return {\n resource,\n id\n };\n }\n}","import { createBeanDecorator } from 'zova';\nexport function Command(options) {\n return createBeanDecorator('command', 'sys', true, options);\n}","export const SymbolCommandResult = Symbol('SymbolCommandResult');"],"mappings":";;;;AACA,SAAgB,gBAAgB,KAAK,aAAa,SAAS,eAAe,MAAM;CAC9E,IAAI,CAAC,MACH,QAAO,eAAc;EACnB,OAAO;CACT;CAGF,MAAM,eAAe,0BAA0B,aAAa,SAAS;CACrE,MAAM,eAAe,IAAI,KAAK,iBAAiB,YAAY;CAC3D,IAAI,cAEF,OAAO,gCAAgC,cAAc,SAAS,eAAe,IAAI;CAGnF,OAAO,IAAI,KAAK,SAAS,cAAc,KAAK,CAAC,CAAC,MAAK,iBAAgB;EACjE,OAAO,gCAAgC,cAAc,SAAS,eAAe,IAAI;CACnF,CAAC;AACH;AACA,SAAS,gCAAgC,cAAc,SAAS,eAAe,MAAM;CACnF,MAAM,eAAe,aAAa;CAElC,MAAM,QAAQ,eAAe,WAAW,CAAC,GAAG,cAAc,OAAO,IAAI,WAAW,CAAC;CACjF,OAAO,aAAa,QAAQ,OAAO,eAAe,IAAI;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rBA,SAAgB,QAAQ,SAAS;CAC/B,OAAO,oBAAoB,WAAW,OAAO,MAAM,OAAO;AAC5D;;;ACHA,IAAa,sBAAsB,OAAO,qBAAqB"}
|
package/dist/types/command.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface ICommandRowOptionsBase<Result = any> extends ICommandOptionsBas
|
|
|
26
26
|
resource?: string;
|
|
27
27
|
id?: TableIdentity;
|
|
28
28
|
}
|
|
29
|
+
export interface ICommandDetailsRowOptionsBase<Result = any> extends ICommandOptionsBase<Result> {
|
|
30
|
+
}
|
|
29
31
|
declare module 'zova-module-a-bean' {
|
|
30
32
|
interface SysOnion {
|
|
31
33
|
command: ServiceOnion<IDecoratorCommandOptions, keyof ICommandRecord>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/types/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,cAAc,IAAI;IAC/D,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,mBAAmB,CAAC,CAAC;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,WAAW,eAAe;IAC9B,OAAO,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Q;QACvB,OAAO,EAAE,YAAY,CAAC,wBAAwB,EAAE,MAAM,cAAc,CAAC,CAAC;KACvE;CACF;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,YAAY;QAC3B,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;KACpC;IAED,UAAiB,gBAAgB;QAC/B,OAAO,EAAE,KAAK,CAAC;KAChB;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-command",
|
|
3
|
-
"version": "5.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "5.1.33",
|
|
4
|
+
"gitHead": "1a39e8008e1b48001cfeff475ddd53a2a0d867c4",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Zova Module"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/zova.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
29
29
|
"prepublishOnly": "npm run tsc:publish",
|
|
30
30
|
"prepack": "clean-package",
|
|
31
|
-
"postpack": "clean-package restore
|
|
31
|
+
"postpack": "clean-package restore"
|
|
32
32
|
},
|
|
33
33
|
"title": "a-command",
|
|
34
34
|
"zovaModule": {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"optionsGlobalInterfaceFrom": "zova-module-a-command",
|
|
40
40
|
"boilerplate": "command/boilerplate",
|
|
41
41
|
"boilerplateCommandBulk": "commandBulk/boilerplate",
|
|
42
|
-
"boilerplateCommandRow": "commandRow/boilerplate"
|
|
42
|
+
"boilerplateCommandRow": "commandRow/boilerplate",
|
|
43
|
+
"boilerplateCommandDetailsRow": "commandDetailsRow/boilerplate"
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"capabilities": {
|
package/src/types/command.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface ICommandRowOptionsBase<Result = any> extends ICommandOptionsBas
|
|
|
40
40
|
id?: TableIdentity;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export interface ICommandDetailsRowOptionsBase<Result = any> extends ICommandOptionsBase<Result> {}
|
|
44
|
+
|
|
43
45
|
declare module 'zova-module-a-bean' {
|
|
44
46
|
export interface SysOnion {
|
|
45
47
|
command: ServiceOnion<IDecoratorCommandOptions, keyof ICommandRecord>;
|