cabloy 5.1.171 → 5.1.173

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.
Files changed (106) hide show
  1. package/.cabloy-version +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/package.json +2 -2
  4. package/repo-docs/frontend/component-guide.md +33 -0
  5. package/repo-docs/frontend/model-resource-cookbook.md +0 -8
  6. package/repo-docs/frontend/model-resource-usage-guide.md +0 -4
  7. package/repo-docs/frontend/table-guide.md +26 -0
  8. package/repo-e2e/specs/cabloy-basic.spec.ts +158 -0
  9. package/repo-e2e/specs/controller-boundary.spec.ts +261 -0
  10. package/test-results/.last-run.json +1 -1
  11. package/vona/packages-cli/cli/package.json +1 -1
  12. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}SelectResItem.tsx_ +4 -0
  13. package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}SelectResItem.tsx_ +4 -0
  14. package/vona/packages-cli/cli-set-api/package.json +1 -1
  15. package/vona/packages-utils/lint/package.json +1 -1
  16. package/vona/packages-utils/lint/src/oxc/lint.ts +1 -1
  17. package/vona/packages-utils/lint/src/oxc/lintVue.ts +1 -1
  18. package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectResItem.tsx +4 -0
  19. package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +5 -0
  20. package/zova/package.original.json +1 -1
  21. package/zova/packages-cli/cli/package.json +2 -2
  22. package/zova/packages-cli/cli-set-front/package.json +3 -3
  23. package/zova/packages-cli/cli-set-front/src/lib/bean/cli.bin.buildRest.ts +14 -3
  24. package/zova/packages-utils/babel-plugin-zova-behavior/package.json +2 -1
  25. package/zova/packages-utils/babel-plugin-zova-behavior/src/index.ts +21 -8
  26. package/zova/packages-utils/babel-plugin-zova-behavior/test/behaviorSlots.test.ts +111 -0
  27. package/zova/packages-utils/zova-jsx/package.json +2 -2
  28. package/zova/packages-utils/zova-vite/package.json +2 -2
  29. package/zova/packages-zova/zova/package.json +3 -3
  30. package/zova/packages-zova/zova-core/package.json +1 -1
  31. package/zova/packages-zova/zova-core/src/bean/beanBase.ts +1 -1
  32. package/zova/packages-zova/zova-core/src/bean/beanContainer.ts +95 -39
  33. package/zova/packages-zova/zova-core/src/bean/resource/error/type.ts +9 -0
  34. package/zova/packages-zova/zova-core/src/bean/type.ts +18 -0
  35. package/zova/packages-zova/zova-core/src/components/component.ts +2 -1
  36. package/zova/packages-zova/zova-core/src/composables/useController.ts +155 -25
  37. package/zova/packages-zova/zova-core/src/core/component/error.ts +62 -5
  38. package/zova/packages-zova/zova-core/src/core/context/component.ts +37 -2
  39. package/zova/packages-zova/zova-core/src/core/context/hooks.ts +13 -2
  40. package/zova/packages-zova/zova-core/src/core/context/meta.ts +1 -0
  41. package/zova/packages-zova/zova-core/src/core/context/state.ts +161 -0
  42. package/zova/packages-zova/zova-core/src/core/sys/config.ts +32 -7
  43. package/zova/packages-zova/zova-core/src/types/interface/monkey.ts +15 -0
  44. package/zova/packages-zova/zova-core/src/types/utils/powerPartial.ts +1 -1
  45. package/zova/pnpm-lock.yaml +69 -54
  46. package/zova/src/front/config/config/config.ts +11 -0
  47. package/zova/src/front/config/config/render.tsx +79 -0
  48. package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/order.ts +0 -1
  49. package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/component/controllerBoundaryProbe.ts +31 -0
  50. package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/component/controllerBoundaryProbeInline.ts +34 -0
  51. package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/component/controllerBoundaryProbeOverride.ts +34 -0
  52. package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/index.ts +58 -1
  53. package/zova/src/suite/a-demo/modules/demo-basic/src/.metadata/page/controllerBoundary.ts +23 -0
  54. package/zova/src/suite/a-demo/modules/demo-basic/src/component/controllerBoundaryProbe/controller.tsx +36 -0
  55. package/zova/src/suite/a-demo/modules/demo-basic/src/component/controllerBoundaryProbeInline/controller.tsx +34 -0
  56. package/zova/src/suite/a-demo/modules/demo-basic/src/component/controllerBoundaryProbeOverride/controller.tsx +46 -0
  57. package/zova/src/suite/a-demo/modules/demo-basic/src/page/controllerBoundary/controller.tsx +185 -0
  58. package/zova/src/suite/a-demo/modules/demo-basic/src/routes.ts +6 -0
  59. package/zova/src/suite/a-home/modules/home-base/src/config/locale/en-us.ts +1 -0
  60. package/zova/src/suite/a-home/modules/home-base/src/config/locale/zh-cn.ts +1 -0
  61. package/zova/src/suite/a-training/modules/training-student/src/model/student.ts +0 -3
  62. package/zova/src/suite/cabloy-basic/modules/basic-button/package.json +58 -0
  63. package/zova/src/suite/cabloy-basic/modules/basic-button/src/.metadata/component/button.ts +31 -0
  64. package/zova/src/suite/cabloy-basic/modules/basic-button/src/.metadata/index.ts +122 -0
  65. package/zova/src/suite/cabloy-basic/modules/basic-button/src/.metadata/this.ts +2 -0
  66. package/zova/src/suite/cabloy-basic/modules/basic-button/src/bean/behavior.perform.tsx +103 -0
  67. package/zova/src/suite/cabloy-basic/modules/basic-button/src/component/button/controller.tsx +39 -0
  68. package/zova/src/suite/cabloy-basic/modules/basic-button/src/index.ts +1 -0
  69. package/zova/src/suite/cabloy-basic/modules/basic-button/tsconfig.build.json +13 -0
  70. package/zova/src/suite/cabloy-basic/modules/basic-button/tsconfig.json +5 -0
  71. package/zova/src/suite/cabloy-basic/modules/basic-details/package.json +2 -1
  72. package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionDelete.tsx +4 -4
  73. package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx +5 -1
  74. package/zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockPageEntry/controller.tsx +5 -1
  75. package/zova/src/suite/cabloy-basic/modules/basic-table/package.json +2 -1
  76. package/zova/src/suite/cabloy-basic/modules/basic-table/src/.metadata/component/actionRefresh.ts +31 -0
  77. package/zova/src/suite/cabloy-basic/modules/basic-table/src/.metadata/index.ts +13 -0
  78. package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionDelete.tsx +4 -4
  79. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/actionRefresh/controller.tsx +44 -0
  80. package/zova/src/suite/cabloy-basic/modules/basic-table/src/config/locale/en-us.ts +1 -0
  81. package/zova/src/suite/cabloy-basic/modules/basic-table/src/config/locale/zh-cn.ts +1 -0
  82. package/zova/src/suite/cabloy-basic/package.json +1 -0
  83. package/zova/src/suite-vendor/a-cabloy/modules/a-layoutprofile/package.json +1 -1
  84. package/zova/src/suite-vendor/a-cabloy/modules/a-layoutprofile/src/model/layoutprofile.ts +0 -3
  85. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
  86. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/.metadata/page/resource.ts +6 -1
  87. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +0 -1
  88. package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/resource/controller.tsx +5 -1
  89. package/zova/src/suite-vendor/a-cabloy/package.json +3 -3
  90. package/zova/src/suite-vendor/a-zova/modules/a-bean/cli/controller/metadata/generateFilePage.ts +3 -1
  91. package/zova/src/suite-vendor/a-zova/modules/a-bean/package.json +1 -1
  92. package/zova/src/suite-vendor/a-zova/modules/a-model/package.json +1 -1
  93. package/zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useMutation.ts +1 -11
  94. package/zova/src/suite-vendor/a-zova/modules/a-model/src/bean/bean.model/bean.model.useQuery.ts +1 -17
  95. package/zova/src/suite-vendor/a-zova/modules/a-model/src/lib/utils.ts +2 -1
  96. package/zova/src/suite-vendor/a-zova/modules/a-model/src/types/query.ts +2 -7
  97. package/zova/src/suite-vendor/a-zova/modules/a-model/test/lib/mutation.types.ts +14 -0
  98. package/zova/src/suite-vendor/a-zova/modules/a-model/test/lib/queryEnsureLoaded.test.ts +56 -0
  99. package/zova/src/suite-vendor/a-zova/modules/a-router/package.json +1 -1
  100. package/zova/src/suite-vendor/a-zova/modules/a-router/src/monkey.ts +8 -0
  101. package/zova/src/suite-vendor/a-zova/modules/a-ssr/package.json +1 -1
  102. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/lib/ssr.ts +85 -1
  103. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/monkey.ts +25 -1
  104. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/types/ssr.ts +15 -1
  105. package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
  106. package/zova/src/suite-vendor/a-zova/package.json +6 -6
@@ -0,0 +1,122 @@
1
+ // eslint-disable
2
+ /** controller: begin */
3
+ export * from '../component/button/controller.jsx';
4
+
5
+ import 'zova';
6
+ declare module 'zova' {
7
+
8
+
9
+ }
10
+ declare module 'zova-module-basic-button' {
11
+
12
+ export interface ControllerButton {
13
+ /** @internal */
14
+ get scope(): ScopeModuleBasicButton;
15
+ }
16
+ }
17
+ /** controller: end */
18
+ /** controller: begin */
19
+ import type { ControllerButton } from '../component/button/controller.jsx';
20
+ import 'zova';
21
+ declare module 'zova' {
22
+ export interface IBeanRecordLocal {
23
+ 'basic-button.controller.button': ControllerButton;
24
+ }
25
+ }
26
+ /** controller: end */
27
+
28
+ /** components: begin */
29
+ export * from './component/button.js';
30
+ import { ZButton } from './component/button.js';
31
+ export const components = {
32
+ 'button': ZButton,
33
+ };
34
+ import 'zova';
35
+ declare module 'zova' {
36
+ export interface IComponentRecord {
37
+ 'basic-button:button': ControllerButton;
38
+ }
39
+ export interface IZovaComponentRecord {
40
+ 'basic-button:button': typeof ZButton;
41
+ }
42
+ }
43
+ /** components: end */
44
+ /** behavior: begin */
45
+ export * from '../bean/behavior.perform.jsx';
46
+ import { IBehaviorOptionsPerform } from '../bean/behavior.perform.jsx';
47
+ import 'zova-module-a-behavior';
48
+ declare module 'zova-module-a-behavior' {
49
+
50
+ export interface IBehaviorRecord {
51
+ 'basic-button:perform': IBehaviorOptionsPerform;
52
+ }
53
+
54
+
55
+ }
56
+ declare module 'zova-module-basic-button' {
57
+
58
+ export interface BehaviorPerform {
59
+ /** @internal */
60
+ get scope(): ScopeModuleBasicButton;
61
+ }
62
+
63
+ export interface BehaviorPerform {
64
+ get $beanFullName(): 'basic-button.behavior.perform';
65
+ get $onionName(): 'basic-button:perform';
66
+ get $onionOptions(): IBehaviorOptionsPerform;
67
+ }
68
+ }
69
+ /** behavior: end */
70
+ /** behavior: begin */
71
+ import type { BehaviorPerform } from '../bean/behavior.perform.jsx';
72
+ import 'zova';
73
+ declare module 'zova' {
74
+ export interface IBeanRecordLocal {
75
+ 'basic-button.behavior.perform': BehaviorPerform;
76
+ }
77
+ }
78
+ /** behavior: end */
79
+ /** behaviors: begin */
80
+ import 'vue';
81
+ import 'vue/jsx-runtime';
82
+
83
+ declare module 'vue' {
84
+ export interface InputHTMLAttributes {
85
+ 'bs-basic-button-perform'?: IBehaviorOptionsPerform | '' | boolean;
86
+ }
87
+ }
88
+
89
+ declare module 'vue/jsx-runtime' {
90
+ namespace JSX {
91
+ // need define class/style in IntrinsicAttributes
92
+ export interface IntrinsicAttributes {
93
+ 'bs-basic-button-perform'?: IBehaviorOptionsPerform | '' | boolean;
94
+ }
95
+ }
96
+ }
97
+ /** behaviors: end */
98
+ /** scope: begin */
99
+ import { BeanScopeBase, type BeanScopeUtil } from 'zova';
100
+ import { Scope } from 'zova-module-a-bean';
101
+
102
+ @Scope()
103
+ export class ScopeModuleBasicButton extends BeanScopeBase {}
104
+
105
+ export interface ScopeModuleBasicButton {
106
+ util: BeanScopeUtil;
107
+ }
108
+
109
+ import 'zova';
110
+ declare module 'zova' {
111
+ export interface IBeanScopeRecord {
112
+ 'basic-button': ScopeModuleBasicButton;
113
+ }
114
+
115
+
116
+
117
+
118
+
119
+
120
+ }
121
+
122
+ /** scope: end */
@@ -0,0 +1,2 @@
1
+ export const __ThisModule__ = 'basic-button';
2
+ export { ScopeModuleBasicButton as ScopeModule } from './index.js';
@@ -0,0 +1,103 @@
1
+ import type { VNode } from 'vue';
2
+ import type { IDecoratorBehaviorOptions, NextBehavior } from 'zova-module-a-behavior';
3
+
4
+ import { isNavigationFailure } from '@cabloy/vue-router';
5
+ import { createVNode } from 'vue';
6
+ import { BeanBehaviorBase, Behavior } from 'zova-module-a-behavior';
7
+
8
+ export interface IBehaviorPropsInputPerform {
9
+ 'class'?: unknown;
10
+ 'disabled'?: boolean | '' | 'true' | 'false';
11
+ 'onClick'?: (e: MouseEvent) => unknown;
12
+ ['aria-busy']?: boolean | 'true' | 'false';
13
+ }
14
+
15
+ export interface IBehaviorPropsOutputPerform extends IBehaviorPropsInputPerform {
16
+ 'disabled'?: boolean;
17
+ 'onClick'?: (e: MouseEvent) => unknown;
18
+ ['aria-busy']?: boolean | 'true' | 'false';
19
+ }
20
+
21
+ export type TypeBehaviorOnError = (
22
+ error: unknown,
23
+ e: MouseEvent,
24
+ ) => boolean | void | Promise<boolean | void>;
25
+
26
+ export interface IBehaviorOptionsPerform extends IDecoratorBehaviorOptions {
27
+ isLoading?: boolean;
28
+ onPerform?: (e: MouseEvent) => Promise<void> | void;
29
+ onError?: TypeBehaviorOnError;
30
+ }
31
+
32
+ @Behavior<IBehaviorOptionsPerform>()
33
+ export class BehaviorPerform extends BeanBehaviorBase<
34
+ IBehaviorOptionsPerform,
35
+ IBehaviorPropsInputPerform,
36
+ IBehaviorPropsOutputPerform
37
+ > {
38
+ private _isLoading = false;
39
+
40
+ protected render(
41
+ props: IBehaviorPropsInputPerform,
42
+ next: NextBehavior<IBehaviorPropsOutputPerform>,
43
+ ): VNode {
44
+ const isLoading = this._isLoading || this.$options.isLoading === true;
45
+ const propsPatch: IBehaviorPropsOutputPerform = {
46
+ ...props,
47
+ 'class': isLoading ? [props.class, 'btn-disabled'] : props.class,
48
+ 'disabled':
49
+ props.disabled === true || props.disabled === '' || props.disabled === 'true' || isLoading,
50
+ 'aria-busy': isLoading || props['aria-busy'],
51
+ 'onClick': e => this._handleClick(e, props.onClick),
52
+ };
53
+ const vnode = next(propsPatch);
54
+ if (!isLoading) return vnode;
55
+ const children = vnode.children;
56
+ return createVNode(vnode.type as any, vnode.props as any, [
57
+ createVNode('span', {
58
+ 'class': 'loading loading-spinner loading-xs',
59
+ 'aria-hidden': 'true',
60
+ }),
61
+ ...(Array.isArray(children)
62
+ ? children
63
+ : children === undefined || children === null
64
+ ? []
65
+ : [children]),
66
+ ]);
67
+ }
68
+
69
+ private _handleClick(e: MouseEvent, onClick?: (e: MouseEvent) => unknown) {
70
+ if (this._isLoading || this.$options.isLoading === true) return;
71
+ return this._perform(e, onClick);
72
+ }
73
+
74
+ private async _perform(e: MouseEvent, onClick?: (e: MouseEvent) => unknown) {
75
+ try {
76
+ this._isLoading = true;
77
+ await onClick?.(e);
78
+ await this.$options.onPerform?.(e);
79
+ } catch (error) {
80
+ if (isActionControlFlowError(error)) throw error;
81
+ const handled = await this.$options.onError?.(error, e);
82
+ if (handled === true) return;
83
+ await this.$performCommand('basic-commands:alert', {
84
+ type: 'error',
85
+ text: getActionErrorMessage(error),
86
+ });
87
+ } finally {
88
+ this._isLoading = false;
89
+ }
90
+ }
91
+ }
92
+
93
+ export function isActionControlFlowError(error: unknown) {
94
+ return isNavigationFailure(error) || [301, 302, 401, 600].includes(Number((error as any)?.code));
95
+ }
96
+
97
+ export function getActionErrorMessage(error: unknown) {
98
+ if (error && (typeof error === 'object' || typeof error === 'function')) {
99
+ const message = (error as { message?: unknown }).message;
100
+ if (message !== undefined && message !== null) return String(message);
101
+ }
102
+ return String(error);
103
+ }
@@ -0,0 +1,39 @@
1
+ import type { ButtonHTMLAttributes } from 'vue';
2
+ import type { IComponentOptions } from 'zova';
3
+
4
+ import { BeanControllerBase } from 'zova';
5
+ import { Controller } from 'zova-module-a-bean';
6
+
7
+ import type { IBehaviorOptionsPerform, TypeBehaviorOnError } from '../../bean/behavior.perform.jsx';
8
+
9
+ export interface ControllerButtonProps extends Omit<ButtonHTMLAttributes, 'onError'> {
10
+ loading?: boolean;
11
+ onPerform?: (e: MouseEvent) => Promise<void> | void;
12
+ onError?: TypeBehaviorOnError;
13
+ }
14
+
15
+ @Controller()
16
+ export class ControllerButton extends BeanControllerBase {
17
+ static $propsDefault = {};
18
+ static $componentOptions: IComponentOptions = { inheritAttrs: false };
19
+
20
+ protected async __init__() {}
21
+
22
+ protected render() {
23
+ const { loading, onError, onPerform, ...props } = this.$props as ControllerButtonProps;
24
+ const behaviorPerformOptions: IBehaviorOptionsPerform = {
25
+ isLoading: loading,
26
+ onError,
27
+ onPerform,
28
+ };
29
+ return (
30
+ <button
31
+ {...props}
32
+ type={props.type ?? 'button'}
33
+ bs-basic-button-perform={behaviorPerformOptions}
34
+ >
35
+ {this.$slotDefault?.()}
36
+ </button>
37
+ );
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ export * from './.metadata/index.js';
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true,
9
+ "allowImportingTsExtensions": true,
10
+ "noEmit": false
11
+ },
12
+ "include": ["src", "src/.metadata/**/*"]
13
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../tsconfig.base",
3
+ "compilerOptions": {},
4
+ "include": ["src", "src/.metadata/**/*"]
5
+ }
@@ -51,7 +51,8 @@
51
51
  "title": "basic-details",
52
52
  "zovaModule": {
53
53
  "dependencies": {
54
- "basic-app": "5.0.0"
54
+ "basic-app": "5.0.0",
55
+ "basic-button": "5.0.0"
55
56
  }
56
57
  }
57
58
  }
@@ -8,6 +8,7 @@ import type {
8
8
  import { BeanBase } from 'zova';
9
9
  import { ZIcon } from 'zova-module-a-icon';
10
10
  import { TableCell } from 'zova-module-a-table';
11
+ import { ZButton } from 'zova-module-basic-button';
11
12
 
12
13
  import { ICommandOptionsDelete } from './command.delete.jsx';
13
14
 
@@ -30,10 +31,9 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
30
31
  ) {
31
32
  const { $host } = renderContext;
32
33
  return (
33
- <button
34
+ <ZButton
34
35
  class={options.class}
35
- type="button"
36
- onClick={async () => {
36
+ onPerform={async () => {
37
37
  const confirmed = await $host.$performCommand('basic-commands:confirm', {
38
38
  text: this.scope.locale.DeleteConfirm(),
39
39
  });
@@ -46,7 +46,7 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
46
46
  }}
47
47
  >
48
48
  <ZIcon name="::delete" width={24}></ZIcon>
49
- </button>
49
+ </ZButton>
50
50
  );
51
51
  }
52
52
  }
@@ -58,7 +58,11 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
58
58
  pageSize: 20,
59
59
  };
60
60
 
61
- static $componentOptions: IComponentOptions = { inheritAttrs: false, deepExtendDefault: true };
61
+ static $componentOptions: IComponentOptions = {
62
+ inheritAttrs: false,
63
+ deepExtendDefault: true,
64
+ boundary: { retry: true },
65
+ };
62
66
 
63
67
  tableRef: BeanControllerTableBase<TData> | undefined;
64
68
  private _tableMetaRefreshPending = false;
@@ -42,7 +42,11 @@ export interface ControllerBlockPageEntryProps extends IResourceBlockOptionsBase
42
42
  @Controller()
43
43
  export class ControllerBlockPageEntry<TData extends {} = {}> extends BeanControllerBase {
44
44
  static $propsDefault = { pageTitleKey: 'name' };
45
- static $componentOptions: IComponentOptions = { inheritAttrs: false, deepExtendDefault: true };
45
+ static $componentOptions: IComponentOptions = {
46
+ inheritAttrs: false,
47
+ deepExtendDefault: true,
48
+ boundary: { retry: true },
49
+ };
46
50
 
47
51
  entryIdCreated?: TableIdentity;
48
52
 
@@ -51,7 +51,8 @@
51
51
  "title": "basic-table",
52
52
  "zovaModule": {
53
53
  "dependencies": {
54
- "basic-app": "5.0.0"
54
+ "basic-app": "5.0.0",
55
+ "basic-button": "5.0.0"
55
56
  }
56
57
  }
57
58
  }
@@ -0,0 +1,31 @@
1
+ import type { TypeControllerInnerProps } from 'zova';
2
+
3
+ import { defineComponent } from 'vue';
4
+ import { prepareComponentOptions, useController } from 'zova';
5
+
6
+ import type { ControllerActionRefreshProps } from '../../component/actionRefresh/controller.jsx';
7
+
8
+ import { ControllerActionRefresh } from '../../component/actionRefresh/controller.jsx';
9
+ export type ZActionRefreshProps = {
10
+ controllerRef?: (ref: ControllerActionRefresh) => void;
11
+ } & ControllerActionRefreshProps;
12
+
13
+ type ControllerInnerProps = TypeControllerInnerProps<
14
+ ControllerActionRefreshProps,
15
+ keyof typeof ControllerActionRefresh.$propsDefault
16
+ >;
17
+ declare module 'zova-module-basic-table' {
18
+ export interface ControllerActionRefresh {
19
+ $props: ControllerInnerProps;
20
+ }
21
+ }
22
+
23
+ export const ZActionRefresh = defineComponent((_props: ZActionRefreshProps) => {
24
+ useController(ControllerActionRefresh, undefined, undefined);
25
+ return () => {};
26
+ }, prepareComponentOptions(ControllerActionRefresh.$componentOptions));
27
+ declare module 'zova-module-a-bean' {
28
+ export interface IVonaComponentRecord {
29
+ 'basic-table:actionRefresh': ControllerActionRefreshProps;
30
+ }
31
+ }
@@ -3,6 +3,7 @@
3
3
  export * from '../component/actionColumnConfig/controller.jsx';
4
4
  export * from '../component/actionCreate/controller.jsx';
5
5
  export * from '../component/actionDeleteBulk/controller.jsx';
6
+ export * from '../component/actionRefresh/controller.jsx';
6
7
  export * from '../component/table/controller.jsx';
7
8
 
8
9
  import 'zova';
@@ -27,6 +28,11 @@ declare module 'zova-module-basic-table' {
27
28
  get scope(): ScopeModuleBasicTable;
28
29
  }
29
30
 
31
+ export interface ControllerActionRefresh {
32
+ /** @internal */
33
+ get scope(): ScopeModuleBasicTable;
34
+ }
35
+
30
36
  export interface ControllerTable {
31
37
  /** @internal */
32
38
  get scope(): ScopeModuleBasicTable;
@@ -37,6 +43,7 @@ declare module 'zova-module-basic-table' {
37
43
  import type { ControllerActionColumnConfig } from '../component/actionColumnConfig/controller.jsx';
38
44
  import type { ControllerActionCreate } from '../component/actionCreate/controller.jsx';
39
45
  import type { ControllerActionDeleteBulk } from '../component/actionDeleteBulk/controller.jsx';
46
+ import type { ControllerActionRefresh } from '../component/actionRefresh/controller.jsx';
40
47
  import type { ControllerTable } from '../component/table/controller.jsx';
41
48
  import 'zova';
42
49
  declare module 'zova' {
@@ -44,6 +51,7 @@ declare module 'zova' {
44
51
  'basic-table.controller.actionColumnConfig': ControllerActionColumnConfig;
45
52
  'basic-table.controller.actionCreate': ControllerActionCreate;
46
53
  'basic-table.controller.actionDeleteBulk': ControllerActionDeleteBulk;
54
+ 'basic-table.controller.actionRefresh': ControllerActionRefresh;
47
55
  'basic-table.controller.table': ControllerTable;
48
56
  }
49
57
  }
@@ -56,12 +64,15 @@ export * from './component/actionCreate.js';
56
64
  import { ZActionCreate } from './component/actionCreate.js';
57
65
  export * from './component/actionDeleteBulk.js';
58
66
  import { ZActionDeleteBulk } from './component/actionDeleteBulk.js';
67
+ export * from './component/actionRefresh.js';
68
+ import { ZActionRefresh } from './component/actionRefresh.js';
59
69
  export * from './component/table.js';
60
70
  import { ZTable } from './component/table.js';
61
71
  export const components = {
62
72
  'actionColumnConfig': ZActionColumnConfig,
63
73
  'actionCreate': ZActionCreate,
64
74
  'actionDeleteBulk': ZActionDeleteBulk,
75
+ 'actionRefresh': ZActionRefresh,
65
76
  'table': ZTable,
66
77
  };
67
78
  import 'zova';
@@ -70,12 +81,14 @@ export interface IComponentRecord {
70
81
  'basic-table:actionColumnConfig': ControllerActionColumnConfig;
71
82
  'basic-table:actionCreate': ControllerActionCreate;
72
83
  'basic-table:actionDeleteBulk': ControllerActionDeleteBulk;
84
+ 'basic-table:actionRefresh': ControllerActionRefresh;
73
85
  'basic-table:table': ControllerTable;
74
86
  }
75
87
  export interface IZovaComponentRecord {
76
88
  'basic-table:actionColumnConfig': typeof ZActionColumnConfig;
77
89
  'basic-table:actionCreate': typeof ZActionCreate;
78
90
  'basic-table:actionDeleteBulk': typeof ZActionDeleteBulk;
91
+ 'basic-table:actionRefresh': typeof ZActionRefresh;
79
92
  'basic-table:table': typeof ZTable;
80
93
  }
81
94
  }
@@ -8,6 +8,7 @@ import type {
8
8
  import { BeanBase } from 'zova';
9
9
  import { ZIcon } from 'zova-module-a-icon';
10
10
  import { TableCell } from 'zova-module-a-table';
11
+ import { ZButton } from 'zova-module-basic-button';
11
12
 
12
13
  declare module 'zova-module-a-openapi' {
13
14
  export interface IResourceTableActionRowRecord {
@@ -28,10 +29,9 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
28
29
  ) {
29
30
  const { $host } = renderContext;
30
31
  return (
31
- <button
32
+ <ZButton
32
33
  class={options.class}
33
- type="button"
34
- onClick={async () => {
34
+ onPerform={async () => {
35
35
  const confirmed = await $host.$performCommand('basic-commands:confirm', {
36
36
  text: this.scope.locale.DeleteConfirm(),
37
37
  });
@@ -40,7 +40,7 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
40
40
  }}
41
41
  >
42
42
  <ZIcon name="::delete" width={24}></ZIcon>
43
- </button>
43
+ </ZButton>
44
44
  );
45
45
  }
46
46
  }
@@ -0,0 +1,44 @@
1
+ import type { IComponentOptions } from 'zova';
2
+ import type {
3
+ IJsxRenderContextPage,
4
+ IResourceTableActionBulkPropsBase,
5
+ } from 'zova-module-a-openapi';
6
+
7
+ import { BeanControllerBase, Use } from 'zova';
8
+ import { Controller } from 'zova-module-a-bean';
9
+ import { ZIcon } from 'zova-module-a-icon';
10
+ import { ZButton } from 'zova-module-basic-button';
11
+
12
+ declare module 'zova-module-a-openapi' {
13
+ export interface IResourceTableActionBulkRecord {
14
+ 'basic-table:actionRefresh'?: ControllerActionRefreshProps;
15
+ }
16
+ }
17
+
18
+ export interface ControllerActionRefreshProps extends IResourceTableActionBulkPropsBase {}
19
+
20
+ @Controller()
21
+ export class ControllerActionRefresh extends BeanControllerBase {
22
+ static $propsDefault = { class: 'btn join-item' };
23
+ static $componentOptions: IComponentOptions = { inheritAttrs: false, deepExtendDefault: true };
24
+
25
+ @Use({ injectionScope: 'host' })
26
+ $$renderContext: IJsxRenderContextPage;
27
+
28
+ protected render() {
29
+ const disabled = this.$props.disabled === true || this.$props.dynamicDisabled === true;
30
+ return (
31
+ <ZButton
32
+ class={[this.$props.class, 'btn-square']}
33
+ disabled={disabled}
34
+ aria-label={this.scope.locale.Refresh()}
35
+ title={this.scope.locale.Refresh()}
36
+ onPerform={async () => {
37
+ await this.$$renderContext.$$page.queryData.refetch({ throwOnError: true });
38
+ }}
39
+ >
40
+ <ZIcon name="::arrow-repeat" width={20}></ZIcon>
41
+ </ZButton>
42
+ );
43
+ }
44
+ }
@@ -5,6 +5,7 @@ export default {
5
5
  SelectRow: 'Select row %s',
6
6
  DeleteBulk: 'Bulk Delete',
7
7
  DeleteBulkConfirm: 'Are you sure you want to bulk delete %d selected items?',
8
+ Refresh: 'Refresh',
8
9
  ColumnConfiguration: 'Column configuration',
9
10
  Columns: 'Columns',
10
11
  Visible: 'Visible',
@@ -5,6 +5,7 @@ export default {
5
5
  SelectRow: '选择行 %s',
6
6
  DeleteBulk: '批量删除',
7
7
  DeleteBulkConfirm: '您确认要批量删除已选择的 %d 项吗?',
8
+ Refresh: '刷新',
8
9
  ColumnConfiguration: '列配置',
9
10
  Columns: '字段',
10
11
  Visible: '显示',
@@ -9,6 +9,7 @@
9
9
  "dependencies": {
10
10
  "zova-module-basic-adapter": "^5.0.5",
11
11
  "zova-module-basic-app": "^5.0.0",
12
+ "zova-module-basic-button": "^5.0.0",
12
13
  "zova-module-basic-captcha": "^5.0.8",
13
14
  "zova-module-basic-commands": "^5.1.15",
14
15
  "zova-module-basic-commandssync": "^5.0.5",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-layoutprofile",
3
- "version": "5.0.2",
3
+ "version": "5.0.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "Zova Module"
@@ -36,9 +36,6 @@ export class ModelLayoutProfile extends BeanModelBase {
36
36
  query: { layoutKey: this.layoutKey },
37
37
  });
38
38
  },
39
- meta: {
40
- disableErrorEffect: true,
41
- },
42
39
  });
43
40
  }
44
41
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-rest-resource",
3
- "version": "5.1.54",
3
+ "version": "5.1.55",
4
4
  "gitHead": "4dece229b6d3f4735930e833afcb4b95ec51bf86",
5
5
  "description": "",
6
6
  "keywords": [
@@ -9,4 +9,9 @@ export namespace NSControllerPageResource {
9
9
  export type ParamsOutput = z.output<typeof ControllerPageResourceSchemaParams>;
10
10
  }
11
11
 
12
- export const ZPageResource = createZovaComponentPage(ControllerPageResource, undefined, undefined);
12
+ export const ZPageResource = createZovaComponentPage(
13
+ ControllerPageResource,
14
+ undefined,
15
+ undefined,
16
+ ControllerPageResource.$componentOptions,
17
+ );
@@ -28,7 +28,6 @@ interface IModelResourceQueryItemOptions<TData> {
28
28
  queryFn: () => Promise<TData>;
29
29
  meta?: {
30
30
  disableSuspenseOnInit?: boolean;
31
- disableErrorEffect?: boolean;
32
31
  persister?: QueryMetaPersister | boolean;
33
32
  };
34
33
  }
@@ -1,6 +1,6 @@
1
1
  import { VNode } from 'vue';
2
2
  import { z } from 'zod';
3
- import { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';
3
+ import { BeanControllerPageBase, deepExtend, IComponentOptions, Use, usePrepareArg } from 'zova';
4
4
  import { ZovaJsx } from 'zova-jsx';
5
5
  import { Controller } from 'zova-module-a-bean';
6
6
  import { $QueryEnsureLoaded } from 'zova-module-a-model';
@@ -14,6 +14,10 @@ export const ControllerPageResourceSchemaParams = z.object({
14
14
 
15
15
  @Controller()
16
16
  export class ControllerPageResource extends BeanControllerPageBase {
17
+ static $componentOptions: IComponentOptions = {
18
+ boundary: { retry: true },
19
+ };
20
+
17
21
  jsxZova: ZovaJsx;
18
22
 
19
23
  @Use({ beanFullName: 'rest-resource.model.resource' })
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "zova-suite-a-cabloy",
3
- "version": "5.1.56",
3
+ "version": "5.1.57",
4
4
  "gitHead": "4dece229b6d3f4735930e833afcb4b95ec51bf86",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "files": [],
8
8
  "type": "module",
9
9
  "dependencies": {
10
- "zova-module-a-layoutprofile": "^5.0.2",
10
+ "zova-module-a-layoutprofile": "^5.0.3",
11
11
  "zova-module-a-rbac": "^5.0.1",
12
- "zova-module-rest-resource": "^5.1.54"
12
+ "zova-module-rest-resource": "^5.1.55"
13
13
  },
14
14
  "title": "a-cabloy"
15
15
  }