cabloy 5.1.247 → 5.1.249

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 (50) hide show
  1. package/.cabloy-version +1 -1
  2. package/.vscode/settings.json +1 -2
  3. package/CHANGELOG.md +27 -0
  4. package/package.json +1 -7
  5. package/repo-docs/frontend/column-configuration-guide.md +3 -1
  6. package/repo-docs/frontend/table-guide.md +27 -2
  7. package/repo-e2e/specs/a-commerce.spec.ts +32 -0
  8. package/repo-e2e/specs/cabloy-basic.spec.ts +1236 -0
  9. package/vona/package.original.json +1 -7
  10. package/vona/pnpm-lock.yaml +139 -1011
  11. package/zova/package.original.json +0 -6
  12. package/zova/packages-cli/cli/package.json +2 -2
  13. package/zova/packages-cli/cli-set-front/package.json +2 -2
  14. package/zova/packages-utils/zova-vite/package.json +1 -1
  15. package/zova/packages-utils/zova-vite/src/teleports.ts +7 -0
  16. package/zova/packages-utils/zova-vite/test/teleports.test.ts +114 -0
  17. package/zova/packages-zova/zova/package.json +2 -2
  18. package/zova/pnpm-lock.yaml +6 -958
  19. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/controller.tsx +267 -0
  20. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.header.tsx +42 -10
  21. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.locale.tsx +10 -5
  22. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.tabs.tsx +97 -11
  23. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.theme.tsx +19 -10
  24. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.user.tsx +11 -0
  25. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/style.ts +128 -0
  26. package/zova/src/suite/a-home/modules/home-layoutadmin/src/config/locale/en-us.ts +6 -0
  27. package/zova/src/suite/a-home/modules/home-layoutadmin/src/config/locale/zh-cn.ts +6 -0
  28. package/zova/src/suite/a-home/modules/home-layoutweb/src/.metadata/component/layoutWeb.ts +10 -8
  29. package/zova/src/suite/a-home/modules/home-layoutweb/src/.metadata/index.ts +25 -0
  30. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/controller.tsx +83 -0
  31. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.header.tsx +37 -8
  32. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.locale.tsx +25 -8
  33. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.tabs.tsx +3 -1
  34. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.theme.tsx +10 -5
  35. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.user.tsx +64 -21
  36. package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/style.ts +42 -0
  37. package/zova/src/suite/a-home/modules/home-layoutweb/src/config/locale/en-us.ts +4 -0
  38. package/zova/src/suite/a-home/modules/home-layoutweb/src/config/locale/zh-cn.ts +4 -0
  39. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/rowOperations/controller.tsx +2 -1
  40. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/controller.tsx +6 -10
  41. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/render.tsx +9 -6
  42. package/zova/src/suite-vendor/a-zova/modules/a-ssr/package.json +1 -1
  43. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/lib/ssr.ts +17 -1
  44. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/lib/ssrProfile.ts +15 -0
  45. package/zova/src/suite-vendor/a-zova/modules/a-ssr/src/types/ssr.ts +1 -0
  46. package/zova/src/suite-vendor/a-zova/modules/a-ssr/test/lib/ssrProfile.test.ts +23 -1
  47. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
  48. package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/src/service/ssrHandler.ts +11 -11
  49. package/zova/src/suite-vendor/a-zova/package.json +3 -3
  50. package/vona/.textlintrc.json +0 -19
@@ -0,0 +1,42 @@
1
+ import { BeanStyleBase } from 'zova';
2
+ import { Style } from 'zova-module-a-bean';
3
+
4
+ @Style()
5
+ export class StyleLayoutWeb extends BeanStyleBase {
6
+ cHeaderActions: string;
7
+
8
+ protected async __init__() {
9
+ this.cHeaderActions = this.$style({
10
+ $nest: {
11
+ '& .header-actions-panel > ul > li > details > ul': {
12
+ maxHeight: 'calc(100dvh - 5rem)',
13
+ overflowY: 'auto',
14
+ },
15
+ '@media (width < 64rem)': {
16
+ $nest: {
17
+ '& .header-actions-panel': {
18
+ width: '16rem',
19
+ maxWidth: 'calc(100vw - 1rem)',
20
+ maxHeight: 'calc(100dvh - 5rem)',
21
+ overflowY: 'auto',
22
+ },
23
+ '& .header-actions-panel > ul > li > details > ul': {
24
+ width: 'auto',
25
+ maxWidth: '100%',
26
+ whiteSpace: 'normal',
27
+ overflowWrap: 'anywhere',
28
+ },
29
+ },
30
+ },
31
+ '@media (min-width: 64rem)': {
32
+ $nest: {
33
+ '& .header-actions-panel > ul > li > details > ul': {
34
+ right: 0,
35
+ maxWidth: 'calc(100vw - 1rem)',
36
+ },
37
+ },
38
+ },
39
+ },
40
+ });
41
+ }
42
+ }
@@ -1,5 +1,9 @@
1
1
  export default {
2
2
  'Home': 'Home',
3
+ 'MoreActions': 'More actions',
4
+ 'Language': 'Language',
5
+ 'ColorMode': 'Color mode',
6
+ 'Account': 'Account',
3
7
  'Logout': 'Logout',
4
8
  'Login': 'Login',
5
9
  'NotLoggedIn': 'Not logged in',
@@ -1,5 +1,9 @@
1
1
  export default {
2
2
  'Home': '首页',
3
+ 'MoreActions': '更多操作',
4
+ 'Language': '语言',
5
+ 'ColorMode': '明暗模式',
6
+ 'Account': '账户',
3
7
  'Logout': '退出登录',
4
8
  'Login': '登录',
5
9
  'NotLoggedIn': '未登录',
@@ -37,6 +37,7 @@ export class ControllerRowOperations extends BeanControllerBase {
37
37
  };
38
38
  this._id = this.$composable(useId);
39
39
  this._cPopover = this.$style({
40
+ display: 'none',
40
41
  position: 'fixed',
41
42
  inset: 'auto',
42
43
  margin: 0,
@@ -207,7 +208,7 @@ export class ControllerRowOperations extends BeanControllerBase {
207
208
  aria-label={label}
208
209
  aria-controls={this._id}
209
210
  aria-expanded={this._open}
210
- {...{ popovertarget: this._id }}
211
+ {...{ 'popovertarget': this._id, 'data-hydrate-ignore-popovertarget': '' }}
211
212
  >
212
213
  <ZIcon name="::more-horiz" width={24} aria-hidden="true" />
213
214
  </ZButton>
@@ -19,8 +19,8 @@ export class ControllerTable extends BeanControllerBase {
19
19
  static $propsDefault = { compactBreakpoint: 768 };
20
20
 
21
21
  innerTable?: ControllerTableInner<any>;
22
- containerWidth: number = 0;
23
- popoverSupported: boolean = false;
22
+ containerWidth: number | undefined;
23
+ popoverSupported: boolean | undefined;
24
24
  private _container?: HTMLElement;
25
25
  private _observer?: ResizeObserver;
26
26
  private _mounted: boolean = false;
@@ -39,12 +39,9 @@ export class ControllerTable extends BeanControllerBase {
39
39
 
40
40
  public get compact() {
41
41
  const breakpoint = this.$props.compactBreakpoint;
42
- return (
43
- this.popoverSupported &&
44
- breakpoint !== false &&
45
- this.containerWidth > 0 &&
46
- this.containerWidth < (breakpoint ?? 768)
47
- );
42
+ if (breakpoint === false || this.popoverSupported === false) return false;
43
+ if (this.containerWidth === undefined) return this.$ssr.state.compactHint === true;
44
+ return this.containerWidth > 0 && this.containerWidth < (breakpoint ?? 768);
48
45
  }
49
46
 
50
47
  public get columnSizing() {
@@ -57,8 +54,7 @@ export class ControllerTable extends BeanControllerBase {
57
54
  return sizing;
58
55
  }
59
56
 
60
- public isOperationsColumn(key: string) {
61
- const table = this.innerTable;
57
+ public isOperationsColumn(key: string, table = this.innerTable) {
62
58
  if (!table) return false;
63
59
  const scope = table.getColumnScope(key);
64
60
  const { render } = table.getColumnComponentPropsTop(key, scope, {});
@@ -45,12 +45,15 @@ export class RenderTable<TData extends {} = {}> extends BeanRenderBase {
45
45
  );
46
46
  }
47
47
 
48
- private _getColumnStyle(column: any): CSSProperties {
48
+ private _getColumnStyle(column: any, $$table: ControllerTable<TData>): CSSProperties {
49
49
  const rest = (column.columnDef.meta as any)?.rest;
50
50
  const fixed = column.getIsPinned();
51
- const width = column.getSize();
51
+ const compactOperations = this.compact && this.isOperationsColumn(column.id, $$table);
52
+ const width = compactOperations ? 80 : column.getSize();
52
53
  return {
53
- ...(typeof rest?.width === 'number' || typeof this.columnSizing[column.id] === 'number'
54
+ ...(compactOperations ||
55
+ typeof rest?.width === 'number' ||
56
+ typeof this.columnSizing[column.id] === 'number'
54
57
  ? { width: `${width}px`, minWidth: `${width}px` }
55
58
  : {}),
56
59
  textAlign: rest?.align,
@@ -89,7 +92,7 @@ export class RenderTable<TData extends {} = {}> extends BeanRenderBase {
89
92
  onChange={table.getToggleAllPageRowsSelectedHandler()}
90
93
  />
91
94
  )
92
- ) : this.compact && this.isOperationsColumn(column.id) ? (
95
+ ) : this.compact && this.isOperationsColumn(column.id, $$table) ? (
93
96
  <span class="sr-only">
94
97
  <FlexRender render={headerDefinition} props={header.getContext()}></FlexRender>
95
98
  </span>
@@ -109,7 +112,7 @@ export class RenderTable<TData extends {} = {}> extends BeanRenderBase {
109
112
  <th
110
113
  key={header.id}
111
114
  class={fixed ? 'bg-base-100' : undefined}
112
- style={this._getColumnStyle(column)}
115
+ style={this._getColumnStyle(column, $$table)}
113
116
  aria-sort={sortAria}
114
117
  >
115
118
  {canSort ? (
@@ -141,7 +144,7 @@ export class RenderTable<TData extends {} = {}> extends BeanRenderBase {
141
144
  <td
142
145
  key={cell.id}
143
146
  class={column.getIsPinned() ? 'bg-base-100' : undefined}
144
- style={this._getColumnStyle(column)}
147
+ style={this._getColumnStyle(column, $$table)}
145
148
  >
146
149
  {selection ? (
147
150
  <input
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-ssr",
3
- "version": "5.1.42",
3
+ "version": "5.1.43",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "",
6
6
  "keywords": [
@@ -7,6 +7,7 @@ import type { Functionable, IControllerLoadEvent, ILocaleRecord, ZovaContext } f
7
7
 
8
8
  import { includeBooleanAttr, isBooleanAttr, isString, stringifyStyle } from '@vue/shared';
9
9
  import { defu } from 'defu';
10
+ import { Platform } from 'quasar';
10
11
  import { normalizeClass, normalizeStyle, ref, useSSRContext } from 'vue';
11
12
  import { BeanSimple } from 'zova';
12
13
 
@@ -24,7 +25,11 @@ import type {
24
25
 
25
26
  import { CtxSSRMetaStore } from './ssrMetaStore.ts';
26
27
  import { getCanonicalLocaleRoutePath } from './ssrNavigation.ts';
27
- import { resolveSsrProfile, resolveSsrProfileOptions } from './ssrProfile.ts';
28
+ import {
29
+ resolveSsrProfile,
30
+ resolveSsrProfileOptions,
31
+ resolveSsrResponseCacheExpires,
32
+ } from './ssrProfile.ts';
28
33
 
29
34
  const SymbolIsRuntimeSsrPreHydration = Symbol('SymbolIsRuntimeSsrPreHydration');
30
35
  const SymbolSSRContext = Symbol('SymbolSSRContext');
@@ -210,6 +215,17 @@ export class CtxSSR extends BeanSimple {
210
215
  );
211
216
  this.state.ssrProfile = ssrProfile;
212
217
  this.state.ssrProfileOptions = ssrProfileOptions;
218
+ if (process.env.SERVER) {
219
+ const expires = resolveSsrResponseCacheExpires(
220
+ ssrProfileOptions.responseCache,
221
+ this.sys.env.META_MODE,
222
+ );
223
+ if (ssrProfile === 'public' && expires !== false && expires !== 0) {
224
+ delete this.state.compactHint;
225
+ } else {
226
+ this.state.compactHint = !!Platform.parseSSR(this.context).is.mobile;
227
+ }
228
+ }
213
229
  }
214
230
 
215
231
  /** @internal */
@@ -1,5 +1,7 @@
1
1
  import type { ZovaConfigSsrProfile } from 'zova';
2
2
 
3
+ import ms from 'ms';
4
+
3
5
  import type {
4
6
  ISsrProfileOptions,
5
7
  ISsrResponseCachePolicy,
@@ -18,6 +20,19 @@ export function resolveSsrProfile(
18
20
  return ssrProfile;
19
21
  }
20
22
 
23
+ export function resolveSsrResponseCacheExpires(
24
+ responseCache: ISsrProfileOptions['responseCache'],
25
+ metaMode: string | undefined,
26
+ ): number | false {
27
+ if (responseCache === false) return false;
28
+ const responseCacheExpires = responseCache.expires ?? 0;
29
+ const expires =
30
+ typeof responseCacheExpires === 'string'
31
+ ? ms(responseCacheExpires) / 1000
32
+ : responseCacheExpires;
33
+ return metaMode === 'development' ? 0 : expires;
34
+ }
35
+
21
36
  export function resolveSsrProfileOptions(
22
37
  ssrProfile: TypeSsrProfile,
23
38
  profiles: Readonly<Record<TypeSsrProfile, ZovaConfigSsrProfile>>,
@@ -59,6 +59,7 @@ export type ISsrProfileOptions = Readonly<
59
59
  >;
60
60
 
61
61
  export interface SSRContextState {
62
+ compactHint?: boolean;
62
63
  envClient?: ZovaConfigEnv;
63
64
  pagePathFull?: string;
64
65
  pagePath?: string;
@@ -5,7 +5,11 @@ import test from 'node:test';
5
5
 
6
6
  import type { ISsrRouteProfileOptions } from '../../src/types/ssr.ts';
7
7
 
8
- import { resolveSsrProfile, resolveSsrProfileOptions } from '../../src/lib/ssrProfile.ts';
8
+ import {
9
+ resolveSsrProfile,
10
+ resolveSsrProfileOptions,
11
+ resolveSsrResponseCacheExpires,
12
+ } from '../../src/lib/ssrProfile.ts';
9
13
 
10
14
  const profiles = {
11
15
  public: {
@@ -77,6 +81,24 @@ test('SSR route options override locale-aware cache defaults', () => {
77
81
  assert.equal(disabled.responseCache, false);
78
82
  });
79
83
 
84
+ test('SSR response cache expiry preserves disabled, no-store, and public max-age branches', () => {
85
+ assert.equal(resolveSsrResponseCacheExpires(false, 'production'), false);
86
+ assert.equal(resolveSsrResponseCacheExpires(false, 'development'), false);
87
+ assert.equal(resolveSsrResponseCacheExpires({}, 'production'), 0);
88
+ assert.equal(resolveSsrResponseCacheExpires({ expires: 0 }, 'production'), 0);
89
+ assert.equal(resolveSsrResponseCacheExpires({ expires: '0s' }, 'production'), 0);
90
+ assert.equal(resolveSsrResponseCacheExpires({ expires: 600 }, 'production'), 600);
91
+ assert.equal(resolveSsrResponseCacheExpires({ expires: '10m' }, 'test'), 600);
92
+ assert.equal(resolveSsrResponseCacheExpires({ expires: '10m' }, 'development'), 0);
93
+
94
+ const override = resolveSsrProfileOptions('public', profiles, {
95
+ responseCache: { expires: '5m' },
96
+ });
97
+ assert.equal(resolveSsrResponseCacheExpires(override.responseCache, 'production'), 300);
98
+ const noLocale = resolveSsrProfileOptions('public', profiles);
99
+ assert.equal(resolveSsrResponseCacheExpires(noLocale.responseCache, 'production'), 0);
100
+ });
101
+
80
102
  test('SSR profile options are fresh immutable snapshots', () => {
81
103
  const routeOptions: ISsrRouteProfileOptions = {
82
104
  responseCache: { expires: '5m' },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-ssrserver",
3
- "version": "5.1.27",
3
+ "version": "5.1.28",
4
4
  "gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
5
5
  "description": "",
6
6
  "keywords": [
@@ -2,13 +2,16 @@ import type { ISsrProfileOptions } from 'zova-module-a-ssr';
2
2
 
3
3
  import { catchError } from '@cabloy/utils';
4
4
  import fse from 'fs-extra';
5
- import ms from 'ms';
6
5
  import path, { basename } from 'node:path';
7
6
  import { pathToFileURL } from 'node:url';
8
7
  import { BeanBase, cast, Use } from 'zova';
9
8
  import { Service } from 'zova-module-a-bean';
10
9
  import { SysRouter } from 'zova-module-a-router';
11
- import { resolveSsrProfile, resolveSsrProfileOptions } from 'zova-module-a-ssr';
10
+ import {
11
+ resolveSsrProfile,
12
+ resolveSsrProfileOptions,
13
+ resolveSsrResponseCacheExpires,
14
+ } from 'zova-module-a-ssr';
12
15
 
13
16
  import { ISsrHandlerRenderOptionsInner, TypeEventResolvePathResult } from '../types/ssr.ts';
14
17
 
@@ -286,15 +289,12 @@ export class ServiceSsrHandler extends BeanBase {
286
289
  ssrProfileOptions: Readonly<ISsrProfileOptions>,
287
290
  ) {
288
291
  const { res } = options;
289
- const responseCache = ssrProfileOptions.responseCache;
290
- if (responseCache === false) return;
291
- // expires
292
- const responseCacheExpires = responseCache.expires ?? 0;
293
- const expires =
294
- typeof responseCacheExpires === 'string'
295
- ? ms(responseCacheExpires) / 1000
296
- : responseCacheExpires;
297
- if (expires === 0 || this.sys.env.META_MODE === 'development') {
292
+ const expires = resolveSsrResponseCacheExpires(
293
+ ssrProfileOptions.responseCache,
294
+ this.sys.env.META_MODE,
295
+ );
296
+ if (expires === false) return;
297
+ if (expires === 0) {
298
298
  res.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
299
299
  } else {
300
300
  res.setHeader('cache-control', `public, max-age=${expires}`);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-suite-a-zova",
3
- "version": "5.1.177",
3
+ "version": "5.1.178",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "zova",
6
6
  "license": "MIT",
@@ -25,9 +25,9 @@
25
25
  "zova-module-a-router": "^5.1.43",
26
26
  "zova-module-a-routerstack": "^5.1.30",
27
27
  "zova-module-a-routertabs": "^5.1.36",
28
- "zova-module-a-ssr": "^5.1.42",
28
+ "zova-module-a-ssr": "^5.1.43",
29
29
  "zova-module-a-ssrhmr": "^5.1.24",
30
- "zova-module-a-ssrserver": "^5.1.27",
30
+ "zova-module-a-ssrserver": "^5.1.28",
31
31
  "zova-module-a-style": "^5.1.36",
32
32
  "zova-module-a-table": "^5.1.46",
33
33
  "zova-module-a-zod": "^5.1.39",
@@ -1,19 +0,0 @@
1
- {
2
- "plugins": {},
3
- "filters": {},
4
- "rules": {
5
- "ja-no-mixed-period": {
6
- "periodMark": "。",
7
- "forceAppendPeriod": true,
8
- "allowPeriodMarks": ["?", "!", ":", "?", "!", ":"]
9
- },
10
- "en-no-mixed-period": {
11
- "periodMark": ".",
12
- "forceAppendPeriod": true,
13
- "allowPeriodMarks": ["?", "!", ":", "?", "!", ":", "。"]
14
- },
15
- "ja-space-between-half-and-full-width": {
16
- "space": "always"
17
- }
18
- }
19
- }