zova-core 5.1.84 → 5.1.86
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/core/component/locale.d.ts +1 -1
- package/dist/core/component/locale.d.ts.map +1 -1
- package/dist/core/sys/util.d.ts +1 -0
- package/dist/core/sys/util.d.ts.map +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/core/component/locale.ts +10 -3
- package/src/core/sys/resource.ts +1 -1
- package/src/core/sys/util.ts +14 -0
|
@@ -7,7 +7,7 @@ export declare class AppLocale extends BeanSimple {
|
|
|
7
7
|
private [SymbolTzCurrent];
|
|
8
8
|
get metaCookie(): import("./cookie.ts").AppCookie;
|
|
9
9
|
get current(): keyof ILocaleRecord;
|
|
10
|
-
set current(value: keyof ILocaleRecord);
|
|
10
|
+
set current(value: keyof ILocaleRecord | '' | undefined);
|
|
11
11
|
private _cookieEnabled;
|
|
12
12
|
get tz(): string;
|
|
13
13
|
set tz(value: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/core/component/locale.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAItD,QAAA,MAAM,mBAAmB,eAAgC,CAAC;AAC1D,QAAA,MAAM,eAAe,eAA4B,CAAC;AAElD,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAkC;IAC/D,OAAO,CAAC,CAAC,eAAe,CAAC,CAAkC;IAE3D,IAAI,UAAU,oCAEb;IAED,IAAI,OAAO,IAAI,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/core/component/locale.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAItD,QAAA,MAAM,mBAAmB,eAAgC,CAAC;AAC1D,QAAA,MAAM,eAAe,eAA4B,CAAC;AAElD,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAkC;IAC/D,OAAO,CAAC,CAAC,eAAe,CAAC,CAAkC;IAE3D,IAAI,UAAU,oCAEb;IAED,IAAI,OAAO,IAAI,MAAM,aAAa,CASjC;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,aAAa,GAAG,EAAE,GAAG,SAAS,EAOtD;IAED,OAAO,CAAC,cAAc;IAItB,IAAI,EAAE,IAAI,MAAM,CASf;IAED,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAInB;IAoCM,OAAO,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1C,oBAAoB,EAAE,OAAO,EAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,GAAG,EAAE,MAAM,EACX,GAAG,IAAI,EAAE,GAAG,EAAE,GACb,MAAM;CAiBV"}
|
package/dist/core/sys/util.d.ts
CHANGED
|
@@ -39,4 +39,5 @@ export declare function convertToUnit(str: number, unit?: string): string;
|
|
|
39
39
|
export declare function convertToUnit(str: string | number | null | undefined, unit?: string): string | undefined;
|
|
40
40
|
export declare function isHttpUrl(url?: string): boolean;
|
|
41
41
|
export declare function throwErrorComponentUnmounted(): void;
|
|
42
|
+
export declare function ssr_load_local(key: any, defaultValue?: any): any;
|
|
42
43
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/core/sys/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/core/sys/util.ts"],"names":[],"mappings":"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AM,GACZ,MAAM,GAAG,SAAS,CAAC;AAkBtB,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,wBAAgB,4BAA4B,SAI3C;AAED,wBAAgB,cAAc,CAAC,GAAG,KAAA,EAAE,YAAY,CAAC,KAAA,OAIhD"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@cabloy/json5';
|
|
2
2
|
import { isReactive, reactive, computed, watchEffect, watchPostEffect, watchSyncEffect, watch, customRef, toRef, markRaw, shallowReactive, provide, inject, getCurrentInstance, defineAsyncComponent, ref, defineComponent, onMounted, nextTick, useSlots, onBeforeUnmount, onUnmounted, onServerPrefetch, queuePostFlushCb } from 'vue';
|
|
3
|
-
import { isUndefined, defaultPathSerializer, isEmptyObject, combineApiPathControllerAndAction, isClass, isNilOrEmptyString, evaluateExpressions, isNil, forEach, forEachSync } from '@cabloy/utils';
|
|
3
|
+
import { isUndefined, defaultPathSerializer, isEmptyObject, combineApiPathControllerAndAction, combineQueries, isClass, isNilOrEmptyString, evaluateExpressions, isNil, forEach, forEachSync } from '@cabloy/utils';
|
|
4
4
|
import { skipPrefix, parseLastWord, skipLastWord, splitWords } from '@cabloy/word-utils';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
6
|
import { extend } from '@cabloy/extend';
|
|
@@ -287,6 +287,13 @@ class SysUtil extends BeanSimple {
|
|
|
287
287
|
// custom
|
|
288
288
|
const optionsCustom = {
|
|
289
289
|
params: options?.query,
|
|
290
|
+
paramsSerializer: {
|
|
291
|
+
serialize: params => {
|
|
292
|
+
const query = combineQueries(undefined, params);
|
|
293
|
+
const index = query.indexOf('?');
|
|
294
|
+
return index === -1 ? '' : query.substring(index + 1);
|
|
295
|
+
}
|
|
296
|
+
},
|
|
290
297
|
query: undefined
|
|
291
298
|
};
|
|
292
299
|
const interceptors = {};
|
|
@@ -398,6 +405,11 @@ function throwErrorComponentUnmounted() {
|
|
|
398
405
|
error.code = 600;
|
|
399
406
|
throw error;
|
|
400
407
|
}
|
|
408
|
+
function ssr_load_local(key, defaultValue) {
|
|
409
|
+
const __ssr_local = localStorage.getItem(key);
|
|
410
|
+
const value = __ssr_local ? JSON.parse(__ssr_local) : undefined;
|
|
411
|
+
return value ?? defaultValue;
|
|
412
|
+
}
|
|
401
413
|
|
|
402
414
|
const DecoratorBeanFullName = Symbol('Decorator#BeanFullName');
|
|
403
415
|
const SymbolDecoratorBeanInfo = Symbol('SymbolDecoratorBeanInfo');
|
|
@@ -422,7 +434,7 @@ class AppResource {
|
|
|
422
434
|
uses[options.prop] = options;
|
|
423
435
|
if (process.env.DEV) {
|
|
424
436
|
if (typeof options.prop === 'string' && !options.prop.startsWith('$$')) {
|
|
425
|
-
|
|
437
|
+
throw new Error(`inject prop name should start with $$: ${options.prop}`);
|
|
426
438
|
}
|
|
427
439
|
}
|
|
428
440
|
}
|
|
@@ -2797,13 +2809,16 @@ class AppLocale extends BeanSimple {
|
|
|
2797
2809
|
}
|
|
2798
2810
|
get current() {
|
|
2799
2811
|
let locale = this[SymbolLocaleCurrent].value;
|
|
2800
|
-
|
|
2812
|
+
// always parse locale from cookie
|
|
2813
|
+
// if (!locale && this._cookieEnabled()) {
|
|
2814
|
+
if (!locale) {
|
|
2801
2815
|
locale = this.metaCookie.getItem(this.sys.config.locale.storeKey);
|
|
2802
2816
|
}
|
|
2803
2817
|
if (!locale) locale = this.sys.config.locale.default;
|
|
2804
2818
|
return locale;
|
|
2805
2819
|
}
|
|
2806
2820
|
set current(value) {
|
|
2821
|
+
if (!value) value = this.sys.config.locale.default;
|
|
2807
2822
|
if (this[SymbolLocaleCurrent].value === value) return;
|
|
2808
2823
|
this[SymbolLocaleCurrent].value = value;
|
|
2809
2824
|
if (this._cookieEnabled()) {
|
|
@@ -2815,7 +2830,11 @@ class AppLocale extends BeanSimple {
|
|
|
2815
2830
|
}
|
|
2816
2831
|
get tz() {
|
|
2817
2832
|
let tz = this[SymbolTzCurrent].value;
|
|
2818
|
-
|
|
2833
|
+
// always parse tz from cookie
|
|
2834
|
+
// if (!tz && this._cookieEnabled()) {
|
|
2835
|
+
if (!tz) {
|
|
2836
|
+
tz = this.metaCookie.getItem(this.sys.config.tz.storeKey);
|
|
2837
|
+
}
|
|
2819
2838
|
if (!tz) tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2820
2839
|
return tz;
|
|
2821
2840
|
}
|
|
@@ -4415,5 +4434,5 @@ function $protocolKey(key) {
|
|
|
4415
4434
|
return key;
|
|
4416
4435
|
}
|
|
4417
4436
|
|
|
4418
|
-
export { $getBeanName, $protocolKey, AppError, AppLocale, AppMeta, AppMetadata, AppModule, AppResource, BeanAopBase, BeanAopMethodBase, BeanBase, BeanBaseSimple, BeanContainer, BeanControllerBase, BeanControllerIdentifier, BeanControllerLike, BeanControllerPageBase, BeanInfo, BeanRenderBase, BeanRenderIdentifier, BeanRenderLike, BeanScopeBase, BeanScopeError, BeanScopeLocale, BeanScopeUtil, BeanSimple, BeanStyleBase, BeanStyleIdentifier, ClientOnly, CtxComponent, CtxMeta, CtxState, CtxUtil, DecoratorBeanFullName, ErrorClass, LocaleModuleNameSeparator, MixinClass, OmitClass, PartialClass, PickClass, PluginBean, PluginZova, Preload, ProxyDisable, StateLock, SymbolBeanContainerInstances, SymbolBeanFullName, SymbolBeanInstanceKey, SymbolController, SymbolControllerRefDisable, SymbolDecoratorBeanInfo, SymbolDecoratorPreload, SymbolDecoratorProxyDisable, SymbolDecoratorUse, SymbolDecoratorVirtual, SymbolDecoratorVueElements, SymbolErrorInstanceInfo, SymbolInited, SymbolInstalled, SymbolMappedClassMetadataKeys, SymbolModuleBelong, SymbolModuleName, SysComponent, SysError, SysLocale, SysLogger, SysMeta, SysModule, SysUtil, Use, UseScope, Virtual, ZovaApplication, ZovaContext, ZovaSys, __prepareInjectSelectorInfo, appMetadata, appResource, beanFullNameFromOnionName, bootstrap, cast, configDefault, constantDefault, convertToUnit, copyMetadataOfClasses, copyProperties, copyPropertiesOfClasses, createBeanDecorator, createVueDecorator, createZovaComponentAsync, createZovaComponentPage, deepEqual, deepExtend, disposeInstance, errorsInternal, formatLoggerConsole, formatLoggerFilter, functionNoop, getLoggerFilterLevel, getMappedClassMetadataKeys, isHttpUrl, isUuid, localeDefault, modelGet, modelSet, objectAssignReactive, onionNameFromBeanFullName, polyfillDispose, prepareComponentOptions, registerMappedClassMetadataKey, setLoggerFilterLevel, sys, throwErrorComponentUnmounted, useApp, useComputed, useContext, useController, useControllerPage, usePrepareArg, usePrepareArgs, uuid };
|
|
4437
|
+
export { $getBeanName, $protocolKey, AppError, AppLocale, AppMeta, AppMetadata, AppModule, AppResource, BeanAopBase, BeanAopMethodBase, BeanBase, BeanBaseSimple, BeanContainer, BeanControllerBase, BeanControllerIdentifier, BeanControllerLike, BeanControllerPageBase, BeanInfo, BeanRenderBase, BeanRenderIdentifier, BeanRenderLike, BeanScopeBase, BeanScopeError, BeanScopeLocale, BeanScopeUtil, BeanSimple, BeanStyleBase, BeanStyleIdentifier, ClientOnly, CtxComponent, CtxMeta, CtxState, CtxUtil, DecoratorBeanFullName, ErrorClass, LocaleModuleNameSeparator, MixinClass, OmitClass, PartialClass, PickClass, PluginBean, PluginZova, Preload, ProxyDisable, StateLock, SymbolBeanContainerInstances, SymbolBeanFullName, SymbolBeanInstanceKey, SymbolController, SymbolControllerRefDisable, SymbolDecoratorBeanInfo, SymbolDecoratorPreload, SymbolDecoratorProxyDisable, SymbolDecoratorUse, SymbolDecoratorVirtual, SymbolDecoratorVueElements, SymbolErrorInstanceInfo, SymbolInited, SymbolInstalled, SymbolMappedClassMetadataKeys, SymbolModuleBelong, SymbolModuleName, SysComponent, SysError, SysLocale, SysLogger, SysMeta, SysModule, SysUtil, Use, UseScope, Virtual, ZovaApplication, ZovaContext, ZovaSys, __prepareInjectSelectorInfo, appMetadata, appResource, beanFullNameFromOnionName, bootstrap, cast, configDefault, constantDefault, convertToUnit, copyMetadataOfClasses, copyProperties, copyPropertiesOfClasses, createBeanDecorator, createVueDecorator, createZovaComponentAsync, createZovaComponentPage, deepEqual, deepExtend, disposeInstance, errorsInternal, formatLoggerConsole, formatLoggerFilter, functionNoop, getLoggerFilterLevel, getMappedClassMetadataKeys, isHttpUrl, isUuid, localeDefault, modelGet, modelSet, objectAssignReactive, onionNameFromBeanFullName, polyfillDispose, prepareComponentOptions, registerMappedClassMetadataKey, setLoggerFilterLevel, ssr_load_local, sys, throwErrorComponentUnmounted, useApp, useComputed, useContext, useController, useControllerPage, usePrepareArg, usePrepareArgs, uuid };
|
|
4419
4438
|
//# sourceMappingURL=index.js.map
|