@pisell/utils 3.0.6 → 3.0.7
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/es/arrayUtils.d.ts +23 -26
- package/es/arrayUtils.js +157 -97
- package/es/common/index.d.ts +5 -0
- package/es/common/index.js +5 -0
- package/es/common/stateHelper.d.ts +2 -6
- package/es/common/stateHelper.js +24 -22
- package/es/common/types.d.ts +10 -13
- package/es/common/types.js +1 -0
- package/es/componentStorage.d.ts +25 -27
- package/es/componentStorage.js +130 -94
- package/es/constants/index.js +9 -7
- package/es/date.js +53 -36
- package/es/document.js +67 -43
- package/es/escPosPrinter/EscPosPrinter.js +490 -353
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/escPosPrinter/index.js +52 -37
- package/es/firebase/config/index.js +54 -0
- package/es/firebase/index.js +232 -0
- package/es/format.d.ts +15 -12
- package/es/format.js +156 -89
- package/es/image.js +60 -48
- package/es/index.d.ts +24 -39
- package/es/index.js +35 -40
- package/es/jsBridge/index.d.ts +4 -8
- package/es/jsBridge/index.js +55 -56
- package/es/jsBridge/regDeviceApi.js +126 -87
- package/es/jsBridge/types.d.ts +115 -95
- package/es/jsBridge/types.js +1 -0
- package/es/locales.d.ts +8 -11
- package/es/locales.js +96 -77
- package/es/log.d.ts +6 -11
- package/es/log.js +59 -37
- package/es/miniRedux.d.ts +13 -20
- package/es/miniRedux.js +76 -42
- package/es/number-input/hooks/index.d.ts +4 -0
- package/es/number-input/hooks/index.js +5 -0
- package/es/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/es/number-input/hooks/useNumberInputState.js +128 -71
- package/es/number-input/index.d.ts +14 -0
- package/es/number-input/index.js +21 -0
- package/es/number-input/types.d.ts +88 -88
- package/es/number-input/types.js +1 -0
- package/es/number-input/utils/formatter.d.ts +10 -13
- package/es/number-input/utils/formatter.js +77 -51
- package/es/number-input/utils/index.d.ts +7 -0
- package/es/number-input/utils/index.js +8 -0
- package/es/number-input/utils/validation.d.ts +2 -7
- package/es/number-input/utils/validation.js +66 -51
- package/es/otherUtils.d.ts +9 -12
- package/es/otherUtils.js +129 -71
- package/es/platform.d.ts +9 -12
- package/es/platform.js +85 -61
- package/es/select/hooks/index.d.ts +5 -0
- package/es/select/hooks/index.js +6 -0
- package/es/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/es/select/hooks/useDebouncedSearch.js +53 -39
- package/es/select/hooks/useSelectState.d.ts +7 -7
- package/es/select/hooks/useSelectState.js +113 -56
- package/es/select/index.d.ts +8 -7
- package/es/select/index.js +13 -0
- package/es/select/types.d.ts +211 -211
- package/es/select/types.js +1 -0
- package/es/select/utils/filterOptions.d.ts +6 -7
- package/es/select/utils/filterOptions.js +31 -26
- package/es/select/utils/helpers.d.ts +9 -10
- package/es/select/utils/helpers.js +52 -42
- package/es/select/utils/index.d.ts +7 -4
- package/es/select/utils/index.js +8 -0
- package/es/select/utils/sortOptions.d.ts +5 -6
- package/es/select/utils/sortOptions.js +31 -19
- package/es/select/utils/tagAggregation.d.ts +6 -6
- package/es/select/utils/tagAggregation.js +47 -34
- package/es/text-input/hooks/index.d.ts +4 -0
- package/es/text-input/hooks/index.js +5 -0
- package/es/text-input/hooks/useTextInputState.d.ts +2 -6
- package/es/text-input/hooks/useTextInputState.js +126 -69
- package/es/text-input/index.d.ts +14 -0
- package/es/text-input/index.js +20 -0
- package/es/text-input/types.d.ts +48 -48
- package/es/text-input/types.js +1 -0
- package/es/text-input/utils/index.d.ts +5 -0
- package/es/text-input/utils/index.js +7 -0
- package/es/text-input/utils/validation.d.ts +2 -7
- package/es/text-input/utils/validation.js +70 -50
- package/es/typeUtils.js +84 -61
- package/es/walletValidity.d.ts +42 -44
- package/es/walletValidity.js +557 -396
- package/es/weighing.d.ts +45 -48
- package/es/weighing.js +106 -83
- package/lib/arrayUtils.d.ts +23 -26
- package/lib/arrayUtils.js +111 -101
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +29 -0
- package/lib/common/stateHelper.d.ts +2 -6
- package/lib/common/stateHelper.js +32 -21
- package/lib/common/types.d.ts +10 -13
- package/lib/common/types.js +17 -0
- package/lib/componentStorage.d.ts +25 -27
- package/lib/componentStorage.js +126 -96
- package/lib/constants/index.js +36 -7
- package/lib/date.js +65 -43
- package/lib/document.js +62 -46
- package/lib/escPosPrinter/EscPosPrinter.js +403 -327
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/escPosPrinter/index.js +84 -38
- package/lib/firebase/config/index.js +79 -0
- package/lib/firebase/index.js +180 -0
- package/lib/format.d.ts +15 -12
- package/lib/format.js +133 -91
- package/lib/image.js +74 -48
- package/lib/index.d.ts +24 -39
- package/lib/index.js +80 -137
- package/lib/jsBridge/index.d.ts +4 -8
- package/lib/jsBridge/index.js +76 -57
- package/lib/jsBridge/regDeviceApi.js +133 -86
- package/lib/jsBridge/types.d.ts +115 -95
- package/lib/jsBridge/types.js +17 -0
- package/lib/locales.d.ts +8 -11
- package/lib/locales.js +90 -79
- package/lib/log.d.ts +6 -11
- package/lib/log.js +61 -37
- package/lib/miniRedux.d.ts +13 -20
- package/lib/miniRedux.js +89 -43
- package/lib/number-input/hooks/index.d.ts +4 -0
- package/lib/number-input/hooks/index.js +29 -0
- package/lib/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/lib/number-input/hooks/useNumberInputState.js +81 -71
- package/lib/number-input/index.d.ts +14 -0
- package/lib/number-input/index.js +41 -0
- package/lib/number-input/types.d.ts +88 -88
- package/lib/number-input/types.js +17 -0
- package/lib/number-input/utils/formatter.d.ts +10 -13
- package/lib/number-input/utils/formatter.js +49 -52
- package/lib/number-input/utils/index.d.ts +7 -0
- package/lib/number-input/utils/index.js +39 -0
- package/lib/number-input/utils/validation.d.ts +2 -7
- package/lib/number-input/utils/validation.js +52 -50
- package/lib/otherUtils.d.ts +9 -12
- package/lib/otherUtils.js +98 -86
- package/lib/platform.d.ts +9 -12
- package/lib/platform.js +123 -68
- package/lib/select/hooks/index.d.ts +5 -0
- package/lib/select/hooks/index.js +34 -0
- package/lib/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/lib/select/hooks/useDebouncedSearch.js +41 -40
- package/lib/select/hooks/useSelectState.d.ts +7 -7
- package/lib/select/hooks/useSelectState.js +93 -58
- package/lib/select/index.d.ts +8 -7
- package/lib/select/index.js +53 -0
- package/lib/select/types.d.ts +211 -211
- package/lib/select/types.js +17 -0
- package/lib/select/utils/filterOptions.d.ts +6 -7
- package/lib/select/utils/filterOptions.js +37 -26
- package/lib/select/utils/helpers.d.ts +9 -10
- package/lib/select/utils/helpers.js +41 -45
- package/lib/select/utils/index.d.ts +7 -4
- package/lib/select/utils/index.js +48 -0
- package/lib/select/utils/sortOptions.d.ts +5 -6
- package/lib/select/utils/sortOptions.js +39 -18
- package/lib/select/utils/tagAggregation.d.ts +6 -6
- package/lib/select/utils/tagAggregation.js +41 -33
- package/lib/text-input/hooks/index.d.ts +4 -0
- package/lib/text-input/hooks/index.js +29 -0
- package/lib/text-input/hooks/useTextInputState.d.ts +2 -6
- package/lib/text-input/hooks/useTextInputState.js +79 -69
- package/lib/text-input/index.d.ts +14 -0
- package/lib/text-input/index.js +35 -0
- package/lib/text-input/types.d.ts +48 -48
- package/lib/text-input/types.js +17 -0
- package/lib/text-input/utils/index.d.ts +5 -0
- package/lib/text-input/utils/index.js +32 -0
- package/lib/text-input/utils/validation.d.ts +2 -7
- package/lib/text-input/utils/validation.js +58 -49
- package/lib/typeUtils.js +73 -68
- package/lib/walletValidity.d.ts +42 -44
- package/lib/walletValidity.js +393 -410
- package/lib/weighing.d.ts +45 -48
- package/lib/weighing.js +149 -104
- package/package.json +1 -1
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -11
- package/es/date.d.ts +0 -31
- package/es/document.d.ts +0 -16
- package/es/image.d.ts +0 -14
- package/es/typeUtils.d.ts +0 -45
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -16
- package/lib/_virtual/_rolldown/runtime.js +0 -23
- package/lib/date.d.ts +0 -31
- package/lib/document.d.ts +0 -16
- package/lib/image.d.ts +0 -14
- package/lib/typeUtils.d.ts +0 -45
package/lib/weighing.d.ts
CHANGED
|
@@ -1,65 +1,62 @@
|
|
|
1
|
-
//#region src/weighing.d.ts
|
|
2
1
|
/** 商品配置与 NativeScale 使用的重量单位。 */
|
|
3
|
-
type WeightUnitName = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
2
|
+
export declare type WeightUnitName = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
|
|
4
3
|
/** 订单快照与 UI 使用的标准单位符号。 */
|
|
5
|
-
type WeightUnitSymbol = 'kg' | 'g' | 'lb' | 'oz';
|
|
6
|
-
type WeightUnit = WeightUnitName | WeightUnitSymbol;
|
|
4
|
+
export declare type WeightUnitSymbol = 'kg' | 'g' | 'lb' | 'oz';
|
|
5
|
+
export declare type WeightUnit = WeightUnitName | WeightUnitSymbol;
|
|
7
6
|
/**
|
|
8
7
|
* Pisell 的标准重量单位。目录单价、缺省秤单位和缺省展示均以它为准。
|
|
9
8
|
* 后续标准单位变化时,应优先只修改此处。
|
|
10
9
|
*/
|
|
11
|
-
declare const STANDARD_WEIGHT_UNIT: WeightUnitName;
|
|
12
|
-
declare const WEIGHT_PRECISION = 3;
|
|
13
|
-
declare const UNIT_PRICE_PRECISION = 2;
|
|
14
|
-
declare const MAX_RETAIL_SCALE_WEIGHT_KG = 1000;
|
|
15
|
-
declare const WEIGHT_UNIT_SYMBOLS: Record<WeightUnitName, WeightUnitSymbol>;
|
|
16
|
-
declare const WEIGHT_UNIT_NAMES: Record<WeightUnitSymbol, WeightUnitName>;
|
|
10
|
+
export declare const STANDARD_WEIGHT_UNIT: WeightUnitName;
|
|
11
|
+
export declare const WEIGHT_PRECISION = 3;
|
|
12
|
+
export declare const UNIT_PRICE_PRECISION = 2;
|
|
13
|
+
export declare const MAX_RETAIL_SCALE_WEIGHT_KG = 1000;
|
|
14
|
+
export declare const WEIGHT_UNIT_SYMBOLS: Record<WeightUnitName, WeightUnitSymbol>;
|
|
15
|
+
export declare const WEIGHT_UNIT_NAMES: Record<WeightUnitSymbol, WeightUnitName>;
|
|
17
16
|
/** 单位对应的克数,作为不依赖 NativeScale 的目录价格换算基准。 */
|
|
18
|
-
declare const WEIGHT_UNIT_GRAMS: Record<WeightUnit, number>;
|
|
19
|
-
declare const STANDARD_WEIGHT_UNIT_SYMBOL: WeightUnitSymbol;
|
|
20
|
-
declare const normalizeWeightUnit: (unit?: string | null, fallback?: WeightUnitName) => WeightUnitName;
|
|
21
|
-
declare const getWeightUnitSymbol: (unit?: string | null) => string;
|
|
22
|
-
declare const getWeightUnitGrams: (unit?: string | null) => number | undefined;
|
|
17
|
+
export declare const WEIGHT_UNIT_GRAMS: Record<WeightUnit, number>;
|
|
18
|
+
export declare const STANDARD_WEIGHT_UNIT_SYMBOL: WeightUnitSymbol;
|
|
19
|
+
export declare const normalizeWeightUnit: (unit?: string | null, fallback?: WeightUnitName) => WeightUnitName;
|
|
20
|
+
export declare const getWeightUnitSymbol: (unit?: string | null) => string;
|
|
21
|
+
export declare const getWeightUnitGrams: (unit?: string | null) => number | undefined;
|
|
23
22
|
/**
|
|
24
23
|
* 将“每 sourceUnitValue 个 sourceUnit 的价格”换算到每 1 个目标单位的倍率。
|
|
25
24
|
* 这里只处理目录单价的单位关系;实际秤读数计价仍应使用 NativeScale。
|
|
26
25
|
*/
|
|
27
|
-
declare const getWeightUnitPriceConversionFactor: (params: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export declare const getWeightUnitPriceConversionFactor: (params: {
|
|
27
|
+
sourceUnit?: string | null;
|
|
28
|
+
sourceUnitValue?: string | number | null;
|
|
29
|
+
targetUnit?: string | null;
|
|
31
30
|
}) => number | undefined;
|
|
32
|
-
declare const isSupportedWeightUnit: (unit?: unknown) => unit is WeightUnit;
|
|
33
|
-
declare const formatWeightValue: (value: unknown, precision?: number) => string;
|
|
34
|
-
declare const formatUnitPriceValue: (value: unknown, precision?: number) => string;
|
|
35
|
-
type ScaleReadingStatus = 'stable' | 'unstable' | 'overload' | 'negative' | string | null;
|
|
36
|
-
declare const INVALID_SCALE_READING_STATUSES: readonly ["overload", "negative"];
|
|
37
|
-
declare const isInvalidScaleReadingStatus: (status?: ScaleReadingStatus) => boolean;
|
|
38
|
-
declare const getUsableScaleWeight: (status: ScaleReadingStatus | undefined, weight: number) => number;
|
|
39
|
-
interface WeighingSnapshot {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
export declare const isSupportedWeightUnit: (unit?: unknown) => unit is WeightUnit;
|
|
32
|
+
export declare const formatWeightValue: (value: unknown, precision?: number) => string;
|
|
33
|
+
export declare const formatUnitPriceValue: (value: unknown, precision?: number) => string;
|
|
34
|
+
export declare type ScaleReadingStatus = 'stable' | 'unstable' | 'overload' | 'negative' | string | null;
|
|
35
|
+
export declare const INVALID_SCALE_READING_STATUSES: readonly ["overload", "negative"];
|
|
36
|
+
export declare const isInvalidScaleReadingStatus: (status?: ScaleReadingStatus) => boolean;
|
|
37
|
+
export declare const getUsableScaleWeight: (status: ScaleReadingStatus | undefined, weight: number) => number;
|
|
38
|
+
export interface WeighingSnapshot {
|
|
39
|
+
open_sold_weight?: number | string | boolean;
|
|
40
|
+
mode?: 'auto' | 'manual' | string;
|
|
41
|
+
weight_source?: 'auto' | 'manual' | string;
|
|
42
|
+
weight?: string | number;
|
|
43
|
+
tare?: {
|
|
44
|
+
id?: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
value?: string | number;
|
|
47
|
+
unit?: WeightUnit | string;
|
|
48
|
+
};
|
|
49
|
+
tare_name?: string;
|
|
50
|
+
tare_weight?: string | number;
|
|
51
|
+
net_weight?: string | number;
|
|
52
|
+
unit_price?: string | number;
|
|
48
53
|
unit?: WeightUnit | string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
unit_price?: string | number;
|
|
54
|
-
unit?: WeightUnit | string;
|
|
55
|
-
unit_weight?: string | number;
|
|
56
|
-
unit_data_snapshot?: unknown;
|
|
57
|
-
scalePriceProduct?: unknown;
|
|
58
|
-
total_amount?: string | number;
|
|
54
|
+
unit_weight?: string | number;
|
|
55
|
+
unit_data_snapshot?: unknown;
|
|
56
|
+
scalePriceProduct?: unknown;
|
|
57
|
+
total_amount?: string | number;
|
|
59
58
|
}
|
|
60
59
|
/**
|
|
61
60
|
* 解析订单行称重快照:product_sku 是权威源,_extend.weighing 仅用于旧流程兼容。
|
|
62
61
|
*/
|
|
63
|
-
declare const resolveWeighingSnapshot: (dataSource?: Record<string, any> | null) => WeighingSnapshot | undefined;
|
|
64
|
-
//#endregion
|
|
65
|
-
export { INVALID_SCALE_READING_STATUSES, MAX_RETAIL_SCALE_WEIGHT_KG, STANDARD_WEIGHT_UNIT, STANDARD_WEIGHT_UNIT_SYMBOL, ScaleReadingStatus, UNIT_PRICE_PRECISION, WEIGHT_PRECISION, WEIGHT_UNIT_GRAMS, WEIGHT_UNIT_NAMES, WEIGHT_UNIT_SYMBOLS, WeighingSnapshot, WeightUnit, WeightUnitName, WeightUnitSymbol, formatUnitPriceValue, formatWeightValue, getUsableScaleWeight, getWeightUnitGrams, getWeightUnitPriceConversionFactor, getWeightUnitSymbol, isInvalidScaleReadingStatus, isSupportedWeightUnit, normalizeWeightUnit, resolveWeighingSnapshot };
|
|
62
|
+
export declare const resolveWeighingSnapshot: (dataSource?: Record<string, any> | null) => WeighingSnapshot | undefined;
|
package/lib/weighing.js
CHANGED
|
@@ -1,114 +1,159 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const UNIT_PRICE_PRECISION = 2;
|
|
9
|
-
const MAX_RETAIL_SCALE_WEIGHT_KG = 1e3;
|
|
10
|
-
const WEIGHT_UNIT_SYMBOLS = {
|
|
11
|
-
KILOGRAMS: "kg",
|
|
12
|
-
GRAMS: "g",
|
|
13
|
-
POUNDS: "lb",
|
|
14
|
-
OUNCES: "oz"
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
8
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
21
16
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/weighing.ts
|
|
20
|
+
var weighing_exports = {};
|
|
21
|
+
__export(weighing_exports, {
|
|
22
|
+
INVALID_SCALE_READING_STATUSES: () => INVALID_SCALE_READING_STATUSES,
|
|
23
|
+
MAX_RETAIL_SCALE_WEIGHT_KG: () => MAX_RETAIL_SCALE_WEIGHT_KG,
|
|
24
|
+
STANDARD_WEIGHT_UNIT: () => STANDARD_WEIGHT_UNIT,
|
|
25
|
+
STANDARD_WEIGHT_UNIT_SYMBOL: () => STANDARD_WEIGHT_UNIT_SYMBOL,
|
|
26
|
+
UNIT_PRICE_PRECISION: () => UNIT_PRICE_PRECISION,
|
|
27
|
+
WEIGHT_PRECISION: () => WEIGHT_PRECISION,
|
|
28
|
+
WEIGHT_UNIT_GRAMS: () => WEIGHT_UNIT_GRAMS,
|
|
29
|
+
WEIGHT_UNIT_NAMES: () => WEIGHT_UNIT_NAMES,
|
|
30
|
+
WEIGHT_UNIT_SYMBOLS: () => WEIGHT_UNIT_SYMBOLS,
|
|
31
|
+
formatUnitPriceValue: () => formatUnitPriceValue,
|
|
32
|
+
formatWeightValue: () => formatWeightValue,
|
|
33
|
+
getUsableScaleWeight: () => getUsableScaleWeight,
|
|
34
|
+
getWeightUnitGrams: () => getWeightUnitGrams,
|
|
35
|
+
getWeightUnitPriceConversionFactor: () => getWeightUnitPriceConversionFactor,
|
|
36
|
+
getWeightUnitSymbol: () => getWeightUnitSymbol,
|
|
37
|
+
isInvalidScaleReadingStatus: () => isInvalidScaleReadingStatus,
|
|
38
|
+
isSupportedWeightUnit: () => isSupportedWeightUnit,
|
|
39
|
+
normalizeWeightUnit: () => normalizeWeightUnit,
|
|
40
|
+
resolveWeighingSnapshot: () => resolveWeighingSnapshot
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(weighing_exports);
|
|
43
|
+
var STANDARD_WEIGHT_UNIT = "KILOGRAMS";
|
|
44
|
+
var WEIGHT_PRECISION = 3;
|
|
45
|
+
var UNIT_PRICE_PRECISION = 2;
|
|
46
|
+
var MAX_RETAIL_SCALE_WEIGHT_KG = 1e3;
|
|
47
|
+
var WEIGHT_UNIT_SYMBOLS = {
|
|
48
|
+
KILOGRAMS: "kg",
|
|
49
|
+
GRAMS: "g",
|
|
50
|
+
POUNDS: "lb",
|
|
51
|
+
OUNCES: "oz"
|
|
32
52
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
var WEIGHT_UNIT_NAMES = {
|
|
54
|
+
kg: "KILOGRAMS",
|
|
55
|
+
g: "GRAMS",
|
|
56
|
+
lb: "POUNDS",
|
|
57
|
+
oz: "OUNCES"
|
|
38
58
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
var WEIGHT_UNIT_GRAMS = {
|
|
60
|
+
KILOGRAMS: 1e3,
|
|
61
|
+
GRAMS: 1,
|
|
62
|
+
POUNDS: 453.59237,
|
|
63
|
+
OUNCES: 28.349523125,
|
|
64
|
+
kg: 1e3,
|
|
65
|
+
g: 1,
|
|
66
|
+
lb: 453.59237,
|
|
67
|
+
oz: 28.349523125
|
|
43
68
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const sourceUnitValue = Number((_params$sourceUnitVal = params.sourceUnitValue) !== null && _params$sourceUnitVal !== void 0 ? _params$sourceUnitVal : 1);
|
|
54
|
-
if (!sourceGrams || !targetGrams || !Number.isFinite(sourceUnitValue) || sourceUnitValue <= 0) return;
|
|
55
|
-
return targetGrams / (sourceGrams * sourceUnitValue);
|
|
69
|
+
var STANDARD_WEIGHT_UNIT_SYMBOL = WEIGHT_UNIT_SYMBOLS[STANDARD_WEIGHT_UNIT];
|
|
70
|
+
var normalizeWeightUnit = (unit, fallback = STANDARD_WEIGHT_UNIT) => {
|
|
71
|
+
if (unit && unit in WEIGHT_UNIT_SYMBOLS) {
|
|
72
|
+
return unit;
|
|
73
|
+
}
|
|
74
|
+
if (unit && unit in WEIGHT_UNIT_NAMES) {
|
|
75
|
+
return WEIGHT_UNIT_NAMES[unit];
|
|
76
|
+
}
|
|
77
|
+
return fallback;
|
|
56
78
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
var getWeightUnitSymbol = (unit) => {
|
|
80
|
+
if (unit && unit in WEIGHT_UNIT_SYMBOLS) {
|
|
81
|
+
return WEIGHT_UNIT_SYMBOLS[unit];
|
|
82
|
+
}
|
|
83
|
+
if (unit && unit in WEIGHT_UNIT_NAMES) {
|
|
84
|
+
return unit;
|
|
85
|
+
}
|
|
86
|
+
return unit || STANDARD_WEIGHT_UNIT_SYMBOL;
|
|
61
87
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
var getWeightUnitGrams = (unit) => unit ? WEIGHT_UNIT_GRAMS[unit] : WEIGHT_UNIT_GRAMS[STANDARD_WEIGHT_UNIT];
|
|
89
|
+
var getWeightUnitPriceConversionFactor = (params) => {
|
|
90
|
+
const sourceGrams = getWeightUnitGrams(
|
|
91
|
+
params.sourceUnit || STANDARD_WEIGHT_UNIT
|
|
92
|
+
);
|
|
93
|
+
const targetGrams = getWeightUnitGrams(
|
|
94
|
+
params.targetUnit || STANDARD_WEIGHT_UNIT
|
|
95
|
+
);
|
|
96
|
+
const sourceUnitValue = Number(params.sourceUnitValue ?? 1);
|
|
97
|
+
if (!sourceGrams || !targetGrams || !Number.isFinite(sourceUnitValue) || sourceUnitValue <= 0) {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
return targetGrams / (sourceGrams * sourceUnitValue);
|
|
65
101
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const resolveProductSkuSnapshot = (value) => {
|
|
71
|
-
const snapshot = value;
|
|
72
|
-
return Number(snapshot === null || snapshot === void 0 ? void 0 : snapshot.open_sold_weight) === 1 && hasDisplayWeight(snapshot) ? snapshot : void 0;
|
|
102
|
+
var isSupportedWeightUnit = (unit) => typeof unit === "string" && unit in WEIGHT_UNIT_GRAMS;
|
|
103
|
+
var formatWeightValue = (value, precision = WEIGHT_PRECISION) => {
|
|
104
|
+
const parsedValue = Number(value);
|
|
105
|
+
return (Number.isFinite(parsedValue) ? parsedValue : 0).toFixed(precision);
|
|
73
106
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const resolveWeighingSnapshot = (dataSource) => {
|
|
78
|
-
var _dataSource$_origin, _dataSource$metadata, _dataSource$_origin2, _dataSource$_extend, _dataSource$metadata2;
|
|
79
|
-
if (!dataSource) return void 0;
|
|
80
|
-
const productSkuCandidates = [
|
|
81
|
-
dataSource.product_sku,
|
|
82
|
-
(_dataSource$_origin = dataSource._origin) === null || _dataSource$_origin === void 0 ? void 0 : _dataSource$_origin.product_sku,
|
|
83
|
-
(_dataSource$metadata = dataSource.metadata) === null || _dataSource$metadata === void 0 || (_dataSource$metadata = _dataSource$metadata.origin) === null || _dataSource$metadata === void 0 ? void 0 : _dataSource$metadata.product_sku
|
|
84
|
-
];
|
|
85
|
-
for (const candidate of productSkuCandidates) {
|
|
86
|
-
const snapshot = resolveProductSkuSnapshot(candidate);
|
|
87
|
-
if (snapshot) return snapshot;
|
|
88
|
-
}
|
|
89
|
-
return [
|
|
90
|
-
(_dataSource$_origin2 = dataSource._origin) === null || _dataSource$_origin2 === void 0 || (_dataSource$_origin2 = _dataSource$_origin2._extend) === null || _dataSource$_origin2 === void 0 ? void 0 : _dataSource$_origin2.weighing,
|
|
91
|
-
(_dataSource$_extend = dataSource._extend) === null || _dataSource$_extend === void 0 ? void 0 : _dataSource$_extend.weighing,
|
|
92
|
-
(_dataSource$metadata2 = dataSource.metadata) === null || _dataSource$metadata2 === void 0 || (_dataSource$metadata2 = _dataSource$metadata2.origin) === null || _dataSource$metadata2 === void 0 || (_dataSource$metadata2 = _dataSource$metadata2._extend) === null || _dataSource$metadata2 === void 0 ? void 0 : _dataSource$metadata2.weighing
|
|
93
|
-
].find((candidate) => hasDisplayWeight(candidate));
|
|
107
|
+
var formatUnitPriceValue = (value, precision = UNIT_PRICE_PRECISION) => {
|
|
108
|
+
const parsedValue = Number(value);
|
|
109
|
+
return (Number.isFinite(parsedValue) ? parsedValue : 0).toFixed(precision);
|
|
94
110
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
var INVALID_SCALE_READING_STATUSES = ["overload", "negative"];
|
|
112
|
+
var isInvalidScaleReadingStatus = (status) => INVALID_SCALE_READING_STATUSES.includes(status);
|
|
113
|
+
var getUsableScaleWeight = (status, weight) => isInvalidScaleReadingStatus(status) ? 0 : weight;
|
|
114
|
+
var hasDisplayWeight = (value) => Boolean(value && (Number(value.weight) > 0 || Number(value.net_weight) > 0));
|
|
115
|
+
var resolveProductSkuSnapshot = (value) => {
|
|
116
|
+
const snapshot = value;
|
|
117
|
+
return Number(snapshot == null ? void 0 : snapshot.open_sold_weight) === 1 && hasDisplayWeight(snapshot) ? snapshot : void 0;
|
|
118
|
+
};
|
|
119
|
+
var resolveWeighingSnapshot = (dataSource) => {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
121
|
+
if (!dataSource) return void 0;
|
|
122
|
+
const productSkuCandidates = [
|
|
123
|
+
dataSource.product_sku,
|
|
124
|
+
(_a = dataSource._origin) == null ? void 0 : _a.product_sku,
|
|
125
|
+
(_c = (_b = dataSource.metadata) == null ? void 0 : _b.origin) == null ? void 0 : _c.product_sku
|
|
126
|
+
];
|
|
127
|
+
for (const candidate of productSkuCandidates) {
|
|
128
|
+
const snapshot = resolveProductSkuSnapshot(candidate);
|
|
129
|
+
if (snapshot) return snapshot;
|
|
130
|
+
}
|
|
131
|
+
const legacyCandidates = [
|
|
132
|
+
(_e = (_d = dataSource._origin) == null ? void 0 : _d._extend) == null ? void 0 : _e.weighing,
|
|
133
|
+
(_f = dataSource._extend) == null ? void 0 : _f.weighing,
|
|
134
|
+
(_i = (_h = (_g = dataSource.metadata) == null ? void 0 : _g.origin) == null ? void 0 : _h._extend) == null ? void 0 : _i.weighing
|
|
135
|
+
];
|
|
136
|
+
return legacyCandidates.find((candidate) => hasDisplayWeight(candidate));
|
|
137
|
+
};
|
|
138
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
139
|
+
0 && (module.exports = {
|
|
140
|
+
INVALID_SCALE_READING_STATUSES,
|
|
141
|
+
MAX_RETAIL_SCALE_WEIGHT_KG,
|
|
142
|
+
STANDARD_WEIGHT_UNIT,
|
|
143
|
+
STANDARD_WEIGHT_UNIT_SYMBOL,
|
|
144
|
+
UNIT_PRICE_PRECISION,
|
|
145
|
+
WEIGHT_PRECISION,
|
|
146
|
+
WEIGHT_UNIT_GRAMS,
|
|
147
|
+
WEIGHT_UNIT_NAMES,
|
|
148
|
+
WEIGHT_UNIT_SYMBOLS,
|
|
149
|
+
formatUnitPriceValue,
|
|
150
|
+
formatWeightValue,
|
|
151
|
+
getUsableScaleWeight,
|
|
152
|
+
getWeightUnitGrams,
|
|
153
|
+
getWeightUnitPriceConversionFactor,
|
|
154
|
+
getWeightUnitSymbol,
|
|
155
|
+
isInvalidScaleReadingStatus,
|
|
156
|
+
isSupportedWeightUnit,
|
|
157
|
+
normalizeWeightUnit,
|
|
158
|
+
resolveWeighingSnapshot
|
|
159
|
+
});
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/asyncToGenerator.js
|
|
2
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
3
|
-
try {
|
|
4
|
-
var i = n[a](c), u = i.value;
|
|
5
|
-
} catch (n) {
|
|
6
|
-
e(n);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
10
|
-
}
|
|
11
|
-
function _asyncToGenerator(n) {
|
|
12
|
-
return function() {
|
|
13
|
-
var t = this, e = arguments;
|
|
14
|
-
return new Promise(function(r, o) {
|
|
15
|
-
var a = n.apply(t, e);
|
|
16
|
-
function _next(n) {
|
|
17
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
18
|
-
}
|
|
19
|
-
function _throw(n) {
|
|
20
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
21
|
-
}
|
|
22
|
-
_next(void 0);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { _asyncToGenerator };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { toPropertyKey } from "./toPropertyKey.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
|
|
3
|
-
function _defineProperty(e, r, t) {
|
|
4
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
-
value: t,
|
|
6
|
-
enumerable: !0,
|
|
7
|
-
configurable: !0,
|
|
8
|
-
writable: !0
|
|
9
|
-
}) : e[r] = t, e;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { _defineProperty };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { _defineProperty } from "./defineProperty.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/objectSpread2.js
|
|
3
|
-
function ownKeys(e, r) {
|
|
4
|
-
var t = Object.keys(e);
|
|
5
|
-
if (Object.getOwnPropertySymbols) {
|
|
6
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
7
|
-
r && (o = o.filter(function(r) {
|
|
8
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
9
|
-
})), t.push.apply(t, o);
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
function _objectSpread2(e) {
|
|
14
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
15
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
16
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
17
|
-
_defineProperty(e, r, t[r]);
|
|
18
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
19
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return e;
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
export { _objectSpread2 };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/toPrimitive.js
|
|
3
|
-
function toPrimitive(t, r) {
|
|
4
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
-
var e = t[Symbol.toPrimitive];
|
|
6
|
-
if (void 0 !== e) {
|
|
7
|
-
var i = e.call(t, r || "default");
|
|
8
|
-
if ("object" != _typeof(i)) return i;
|
|
9
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
-
}
|
|
11
|
-
return ("string" === r ? String : Number)(t);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { toPrimitive };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { _typeof } from "./typeof.js";
|
|
2
|
-
import { toPrimitive } from "./toPrimitive.js";
|
|
3
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/toPropertyKey.js
|
|
4
|
-
function toPropertyKey(t) {
|
|
5
|
-
var i = toPrimitive(t, "string");
|
|
6
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { toPropertyKey };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/typeof.js
|
|
2
|
-
function _typeof(o) {
|
|
3
|
-
"@babel/helpers - typeof";
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
-
return typeof o;
|
|
6
|
-
} : function(o) {
|
|
7
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { _typeof };
|
package/es/date.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//#region src/date.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* @title: 格式化日期
|
|
4
|
-
* @description:
|
|
5
|
-
* @param {string} date
|
|
6
|
-
* @param {string} format
|
|
7
|
-
* @return {*}
|
|
8
|
-
* @Author: zhiwei.Wang
|
|
9
|
-
* @Date: 2023-07-21 10:49
|
|
10
|
-
*/
|
|
11
|
-
declare const formatDate: (date: string | Date, format?: string) => string;
|
|
12
|
-
/**
|
|
13
|
-
* @title: excel日期 转 js日期
|
|
14
|
-
* @description:
|
|
15
|
-
* @param {number} excelDate
|
|
16
|
-
* @return {*}
|
|
17
|
-
* @Author: zhiwei.Wang
|
|
18
|
-
* @Date: 2023-07-21 10:49
|
|
19
|
-
*/
|
|
20
|
-
declare const excelDateToJSDate: (excelDate: number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* @title: js日期 转 excel日期
|
|
23
|
-
* @description:
|
|
24
|
-
* @param {string} jsDate
|
|
25
|
-
* @return {*}
|
|
26
|
-
* @Author: zhiwei.Wang
|
|
27
|
-
* @Date: 2023-07-21 10:49
|
|
28
|
-
*/
|
|
29
|
-
declare const jsDateToExcelDate: (jsDate: string) => number;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { excelDateToJSDate, formatDate, jsDateToExcelDate };
|
package/es/document.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/document.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* @Title: 设置主题
|
|
4
|
-
* @Describe: 传入字符串键值对
|
|
5
|
-
* @Author: Wzw
|
|
6
|
-
*/
|
|
7
|
-
declare const setTheme: (themes: {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
}) => void;
|
|
10
|
-
/**
|
|
11
|
-
* 复制到剪切板
|
|
12
|
-
* @param text
|
|
13
|
-
*/
|
|
14
|
-
declare const copyToClipboard: (text: string) => Promise<void>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { copyToClipboard, setTheme };
|
package/es/image.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/image.d.ts
|
|
2
|
-
declare const image: {
|
|
3
|
-
ali: (url: string, w: number) => string;
|
|
4
|
-
getImageSize: (url: string) => {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
ratio: number;
|
|
8
|
-
success: boolean;
|
|
9
|
-
widthRatio: number;
|
|
10
|
-
originRatio: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { image };
|
package/es/typeUtils.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region src/typeUtils.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* 判断是否是函数
|
|
4
|
-
* @param obj
|
|
5
|
-
*/
|
|
6
|
-
declare const isFunction: (obj: any) => obj is Function;
|
|
7
|
-
/**
|
|
8
|
-
* 判断是否是数组
|
|
9
|
-
* @param obj
|
|
10
|
-
*/
|
|
11
|
-
declare const isArr: (obj: any) => obj is any[];
|
|
12
|
-
/**
|
|
13
|
-
* 判断是否是字符串
|
|
14
|
-
* @param obj
|
|
15
|
-
*/
|
|
16
|
-
declare const isString: (obj: any) => obj is string;
|
|
17
|
-
/**
|
|
18
|
-
* 判断是否是数字
|
|
19
|
-
* @param obj
|
|
20
|
-
*/
|
|
21
|
-
declare const isNumber: (obj: any) => obj is number;
|
|
22
|
-
/**
|
|
23
|
-
* 判断是否是undefined
|
|
24
|
-
* @param obj
|
|
25
|
-
*/
|
|
26
|
-
declare const isUndefined: (obj: any) => obj is undefined;
|
|
27
|
-
/**
|
|
28
|
-
* 判断是否是boolean
|
|
29
|
-
* @param obj
|
|
30
|
-
*/
|
|
31
|
-
declare const isBoolean: (obj: any) => obj is boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 判断是否是json字符串
|
|
34
|
-
* @param v
|
|
35
|
-
*/
|
|
36
|
-
declare const isJson: (v: any) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* @Title: 判断是否为对象
|
|
39
|
-
* @Describe:
|
|
40
|
-
* @Author: Wzw
|
|
41
|
-
* @param {any} obj
|
|
42
|
-
*/
|
|
43
|
-
declare const isPlainObject: (obj: any) => boolean;
|
|
44
|
-
//#endregion
|
|
45
|
-
export { isArr, isBoolean, isFunction, isJson, isNumber, isPlainObject, isString, isUndefined };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/asyncToGenerator.js
|
|
2
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
3
|
-
try {
|
|
4
|
-
var i = n[a](c), u = i.value;
|
|
5
|
-
} catch (n) {
|
|
6
|
-
e(n);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
10
|
-
}
|
|
11
|
-
function _asyncToGenerator(n) {
|
|
12
|
-
return function() {
|
|
13
|
-
var t = this, e = arguments;
|
|
14
|
-
return new Promise(function(r, o) {
|
|
15
|
-
var a = n.apply(t, e);
|
|
16
|
-
function _next(n) {
|
|
17
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
18
|
-
}
|
|
19
|
-
function _throw(n) {
|
|
20
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
21
|
-
}
|
|
22
|
-
_next(void 0);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
exports._asyncToGenerator = _asyncToGenerator;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const require_toPropertyKey = require("./toPropertyKey.js");
|
|
2
|
-
//#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
|
|
3
|
-
function _defineProperty(e, r, t) {
|
|
4
|
-
return (r = require_toPropertyKey.toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
-
value: t,
|
|
6
|
-
enumerable: !0,
|
|
7
|
-
configurable: !0,
|
|
8
|
-
writable: !0
|
|
9
|
-
}) : e[r] = t, e;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
exports._defineProperty = _defineProperty;
|