zova-cli-set-front 1.2.77 → 1.2.79

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.
@@ -1,6 +1,10 @@
1
- import type { IResourceBlockOptionsBase, IJsxRenderContextPage } from 'zova-module-a-openapi';
1
+ import type { IComponentOptions } from 'zova';
2
+ import type {
3
+ IResourceBlockOptionsBase,
4
+ IJsxRenderContextPage,
5
+ } from 'zova-module-a-openapi';
2
6
 
3
- import { BeanControllerBase, type IComponentOptions, Use } from 'zova';
7
+ import { BeanControllerBase, Use } from 'zova';
4
8
  import { Controller } from 'zova-module-a-bean';
5
9
 
6
10
  declare module 'zova-module-a-openapi' {
@@ -1,6 +1,10 @@
1
- import type { IResourceBlockOptionsBase, IJsxRenderContextPageEntry } from 'zova-module-a-openapi';
1
+ import type { IComponentOptions } from 'zova';
2
+ import type {
3
+ IResourceBlockOptionsBase,
4
+ IJsxRenderContextPageEntry,
5
+ } from 'zova-module-a-openapi';
2
6
 
3
- import { BeanControllerBase, type IComponentOptions, Use } from 'zova';
7
+ import { BeanControllerBase, Use } from 'zova';
4
8
  import { Controller } from 'zova-module-a-bean';
5
9
 
6
10
  declare module 'zova-module-a-openapi' {
@@ -1,6 +1,10 @@
1
- import type { IJsxRenderContextPageEntry, IResourceFormActionRowOptionsBase } from 'zova-module-a-openapi';
1
+ import type { IComponentOptions } from 'zova';
2
+ import type {
3
+ IJsxRenderContextPageEntry,
4
+ IResourceFormActionRowOptionsBase,
5
+ } from 'zova-module-a-openapi';
2
6
 
3
- import { BeanControllerBase, type IComponentOptions, Use } from 'zova';
7
+ import { BeanControllerBase, Use } from 'zova';
4
8
  import { Controller } from 'zova-module-a-bean';
5
9
 
6
10
  declare module 'zova-module-a-openapi' {
@@ -1,9 +1,10 @@
1
1
  import type { IComponentOptions } from 'zova';
2
+ import type { IFormFieldComponentOptions } from 'zova-module-a-form';
2
3
  import type { IResourceFormFieldOptionsBase } from 'zova-module-a-openapi';
3
4
 
4
5
  import { BeanControllerBase } from 'zova';
5
6
  import { Controller } from 'zova-module-a-bean';
6
- import { ZFormField, type IFormFieldComponentOptions } from 'zova-module-a-form';
7
+ import { ZFormField } from 'zova-module-a-form';
7
8
 
8
9
  declare module 'zova-module-a-openapi' {
9
10
  export interface IResourceFormFieldRecord {
@@ -1,6 +1,10 @@
1
- import type { IJsxRenderContextPage, IResourceTableActionBulkOptionsBase } from 'zova-module-a-openapi';
1
+ import type { IComponentOptions } from 'zova';
2
+ import type {
3
+ IJsxRenderContextPage,
4
+ IResourceTableActionBulkOptionsBase,
5
+ } from 'zova-module-a-openapi';
2
6
 
3
- import { BeanControllerBase, type IComponentOptions, Use } from 'zova';
7
+ import { BeanControllerBase, Use } from 'zova';
4
8
  import { Controller } from 'zova-module-a-bean';
5
9
 
6
10
  declare module 'zova-module-a-openapi' {
@@ -1,5 +1,10 @@
1
1
  import type { ZovaOpenapiConfigModule } from 'zova-openapi';
2
2
 
3
3
  export default function (): ZovaOpenapiConfigModule {
4
- return {};
4
+ return {
5
+ operations: {
6
+ // Specify operations.match or operations.ignore explicitly for this module.
7
+ match: [],
8
+ },
9
+ };
5
10
  }
@@ -6,15 +6,18 @@ import type {
6
6
  IResourceTableActionRowRecord,
7
7
  IResourceFormActionRowRecord,
8
8
  IResourceTableActionBulkRecord,
9
+ IResourceDetailsActionBulkRecord,
9
10
  IResourceBlockRecord,
10
11
  TypeFormSchemaScene,
11
12
  IResourceRenderTableActionRowOptionsAction,
12
13
  IResourceRenderFormActionRowOptionsAction,
13
14
  IResourceRenderTableActionBulkOptionsAction,
15
+ IResourceRenderDetailsActionBulkOptionsAction,
14
16
  IResourceRenderBlockOptionsBlock,
15
17
  IResourceTableActionRowOptionsBase,
16
18
  IResourceFormActionRowOptionsBase,
17
19
  IResourceTableActionBulkOptionsBase,
20
+ IResourceDetailsActionBulkOptionsBase,
18
21
  } from 'zova-module-a-openapi';
19
22
 
20
23
  import { _generalSchemaRest, _toLowerCaseFirstChar } from './inner.ts';
@@ -120,6 +123,25 @@ export function schemaRenderTableActionBulkJsx(
120
123
  return { render: renderComponentJsx, options };
121
124
  }
122
125
 
126
+ export function schemaRenderDetailsActionBulk<K extends keyof IResourceDetailsActionBulkRecord>(
127
+ render: K,
128
+ options?: IResourceDetailsActionBulkRecord[K],
129
+ ): IResourceRenderDetailsActionBulkOptionsAction {
130
+ const pos = render.toString().indexOf(':action');
131
+ const name =
132
+ pos > -1
133
+ ? _toLowerCaseFirstChar(render.toString().substring(pos + ':action'.length))
134
+ : undefined;
135
+ return { $$typeof: 'zova-jsx:actionBulk', name, render, options };
136
+ }
137
+
138
+ export function schemaRenderDetailsActionBulkJsx(
139
+ renderComponentJsx: TypeRenderComponentJsx,
140
+ options?: Pick<IResourceDetailsActionBulkOptionsBase, 'permission'>,
141
+ ) {
142
+ return { render: renderComponentJsx, options };
143
+ }
144
+
123
145
  export function schemaRenderBlock<K extends keyof IResourceBlockRecord>(
124
146
  render: K,
125
147
  options?: IResourceBlockRecord[K],
@@ -3,6 +3,8 @@ import {
3
3
  schemaRenderBlockJsx,
4
4
  schemaRenderCell,
5
5
  schemaRenderCellJsx,
6
+ schemaRenderDetailsActionBulk,
7
+ schemaRenderDetailsActionBulkJsx,
6
8
  schemaRenderField,
7
9
  schemaRenderFieldJsx,
8
10
  schemaRenderFormActionRow,
@@ -40,6 +42,8 @@ export const ZovaRender = {
40
42
  formActionRowJsx: schemaRenderFormActionRowJsx,
41
43
  tableActionBulk: schemaRenderTableActionBulk,
42
44
  tableActionBulkJsx: schemaRenderTableActionBulkJsx,
45
+ detailsActionBulk: schemaRenderDetailsActionBulk,
46
+ detailsActionBulkJsx: schemaRenderDetailsActionBulkJsx,
43
47
  block: schemaRenderBlock,
44
48
  blockJsx: schemaRenderBlockJsx,
45
49
  };
package/dist/index.js CHANGED
@@ -1632,6 +1632,7 @@ class CliOpenapiGenerate extends BeanCliBase {
1632
1632
  apiMeta: false,
1633
1633
  apiSchema: true
1634
1634
  }, config.default, moduleConfigCli, config.modules[moduleInfo.relativeName]);
1635
+ _validateOperations(moduleConfig, moduleInfo.relativeName, configFile);
1635
1636
  const cache = await this._outputFiles(openapiTypescript, moduleConfig, moduleInfo, module, __caches);
1636
1637
  // generate
1637
1638
  await this._generateApis(openapiTypescript, cache.ast, moduleConfig, moduleInfo, module);
@@ -2001,10 +2002,24 @@ function _isNodeNever(node) {
2001
2002
  function _q(question) {
2002
2003
  return question ? '?' : '';
2003
2004
  }
2005
+ function _hasOperationRule(rule) {
2006
+ if (!rule) return false;
2007
+ return !Array.isArray(rule) || rule.length > 0;
2008
+ }
2009
+ function _validateOperations(moduleConfig, moduleName, configFile) {
2010
+ if (_hasOperationRule(moduleConfig.operations?.match) || _hasOperationRule(moduleConfig.operations?.ignore)) {
2011
+ return;
2012
+ }
2013
+ throw new Error(`Please specify operations.match or operations.ignore in ${configFile} to avoid generating a large number of API SDKs unrelated to module "${moduleName}".`);
2014
+ }
2004
2015
  function _checkOperationIdEnabled(moduleConfig, selector) {
2005
2016
  if (!selector) return false;
2006
- if (!moduleConfig.operations?.match && !moduleConfig.operations?.ignore) return true;
2007
- return moduleConfig.operations?.match && matchSelector(moduleConfig.operations?.match, selector) || moduleConfig.operations?.ignore && !matchSelector(moduleConfig.operations?.ignore, selector);
2017
+ const match = moduleConfig.operations?.match;
2018
+ const ignore = moduleConfig.operations?.ignore;
2019
+ const hasMatch = _hasOperationRule(match);
2020
+ const hasIgnore = _hasOperationRule(ignore);
2021
+ if (!hasMatch && !hasIgnore) return false;
2022
+ return hasMatch && matchSelector(match, selector) || hasIgnore && !matchSelector(ignore, selector);
2008
2023
  }
2009
2024
 
2010
2025
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-cli-set-front",
3
- "version": "1.2.77",
4
- "gitHead": "ca10457f38716ad28bf5918dd67c85dd1f7dc9d0",
3
+ "version": "1.2.79",
4
+ "gitHead": "073e81bb206a2f67cf31bc4c9e9fc6b0a0155d30",
5
5
  "description": "zova cli-set-front",
6
6
  "keywords": [
7
7
  "framework",