@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
|
@@ -0,0 +1,29 @@
|
|
|
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 });
|
|
8
|
+
};
|
|
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;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/common/index.ts
|
|
20
|
+
var common_exports = {};
|
|
21
|
+
__export(common_exports, {
|
|
22
|
+
getDisplayState: () => import_stateHelper.getDisplayState
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(common_exports);
|
|
25
|
+
var import_stateHelper = require("./stateHelper");
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
getDisplayState
|
|
29
|
+
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { DisplayState } from
|
|
2
|
-
|
|
3
|
-
//#region src/common/stateHelper.d.ts
|
|
1
|
+
import type { DisplayState } from './types';
|
|
4
2
|
/**
|
|
5
3
|
* 根据 mode 和 disabled 计算组件的显示状态
|
|
6
4
|
*
|
|
@@ -17,6 +15,4 @@ import { DisplayState } from "./types.js";
|
|
|
17
15
|
* getDisplayState('edit', true) // 'disabled'
|
|
18
16
|
* getDisplayState('read', true) // 'disabled'
|
|
19
17
|
*/
|
|
20
|
-
declare function getDisplayState(mode?: 'read' | 'edit', disabled?: boolean): DisplayState;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { getDisplayState };
|
|
18
|
+
export declare function getDisplayState(mode?: 'read' | 'edit', disabled?: boolean): DisplayState;
|
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 });
|
|
8
|
+
};
|
|
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;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/common/stateHelper.ts
|
|
20
|
+
var stateHelper_exports = {};
|
|
21
|
+
__export(stateHelper_exports, {
|
|
22
|
+
getDisplayState: () => getDisplayState
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(stateHelper_exports);
|
|
18
25
|
function getDisplayState(mode, disabled) {
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return "disabled";
|
|
28
|
+
}
|
|
29
|
+
return mode || "edit";
|
|
21
30
|
}
|
|
22
|
-
|
|
23
|
-
exports
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
getDisplayState
|
|
34
|
+
});
|
package/lib/common/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/common/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* 公共类型定义
|
|
4
3
|
* 供所有输入组件使用
|
|
@@ -11,21 +10,19 @@
|
|
|
11
10
|
* - edit: 编辑态,显示输入控件
|
|
12
11
|
* - disabled: 禁用态,禁用的输入控件
|
|
13
12
|
*/
|
|
14
|
-
type DisplayState = 'read' | 'edit' | 'disabled';
|
|
13
|
+
export declare type DisplayState = 'read' | 'edit' | 'disabled';
|
|
15
14
|
/**
|
|
16
15
|
* 校验结果类型
|
|
17
16
|
*
|
|
18
17
|
* 所有输入组件的校验结果统一格式
|
|
19
18
|
*/
|
|
20
|
-
interface ValidationResult {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
export interface ValidationResult {
|
|
20
|
+
/**
|
|
21
|
+
* 是否校验通过
|
|
22
|
+
*/
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 错误信息数组
|
|
26
|
+
*/
|
|
27
|
+
errors: string[];
|
|
29
28
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { DisplayState, ValidationResult };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/common/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
//#region src/componentStorage.d.ts
|
|
2
1
|
/** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
|
|
3
|
-
declare function getStorageKeySuffix(): string;
|
|
2
|
+
export declare function getStorageKeySuffix(): string;
|
|
4
3
|
/**
|
|
5
4
|
* 生成组件实例的存储 key。
|
|
6
5
|
* @param componentId 组件实例 id(如 __id)
|
|
7
6
|
* @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
|
|
8
7
|
*/
|
|
9
|
-
declare function getComponentStorageKey(componentId: string, prefix: string): string;
|
|
10
|
-
interface ColumnSettingStorageItem {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
export declare function getComponentStorageKey(componentId: string, prefix: string): string;
|
|
9
|
+
export interface ColumnSettingStorageItem {
|
|
10
|
+
key: string;
|
|
11
|
+
dataIndex: string;
|
|
12
|
+
title?: unknown;
|
|
13
|
+
titleString?: string;
|
|
14
|
+
isShow: boolean;
|
|
15
|
+
sortIndex?: number;
|
|
16
|
+
fixed?: 'left' | 'right' | boolean;
|
|
18
17
|
}
|
|
19
|
-
declare function saveColumnSettingToLocal(params: {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export declare function saveColumnSettingToLocal(params: {
|
|
19
|
+
componentId: string;
|
|
20
|
+
columnSetting: ColumnSettingStorageItem[];
|
|
22
21
|
}): void;
|
|
23
|
-
declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
|
|
24
|
-
declare function clearColumnSettingFromLocal(componentId?: string): void;
|
|
25
|
-
declare function saveColumnVisibilityToLocal(params: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
|
|
23
|
+
export declare function clearColumnSettingFromLocal(componentId?: string): void;
|
|
24
|
+
export declare function saveColumnVisibilityToLocal(params: {
|
|
25
|
+
componentId: string;
|
|
26
|
+
columnVisibility: Record<string, boolean>;
|
|
27
|
+
/** 列 key 顺序,用于列设置弹层拖拽排序后持久化 */
|
|
28
|
+
columnOrder?: string[];
|
|
29
29
|
}): void;
|
|
30
|
-
declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
|
|
30
|
+
export declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
|
|
31
31
|
/** RecordBoard 列设置(显隐 + 顺序)从 localStorage 读取,用于列设置弹层拖拽排序与显隐持久化 */
|
|
32
|
-
declare function getRecordBoardColumnSettingFromLocal(componentId?: string): {
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
export declare function getRecordBoardColumnSettingFromLocal(componentId?: string): {
|
|
33
|
+
columnVisibility: Record<string, boolean>;
|
|
34
|
+
columnOrder: string[] | null;
|
|
35
35
|
} | null;
|
|
36
|
-
declare function clearColumnVisibilityFromLocal(componentId?: string): void;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { ColumnSettingStorageItem, clearColumnSettingFromLocal, clearColumnVisibilityFromLocal, getColumnSettingFromLocal, getColumnVisibilityFromLocal, getComponentStorageKey, getRecordBoardColumnSettingFromLocal, getStorageKeySuffix, saveColumnSettingToLocal, saveColumnVisibilityToLocal };
|
|
36
|
+
export declare function clearColumnVisibilityFromLocal(componentId?: string): void;
|
package/lib/componentStorage.js
CHANGED
|
@@ -1,114 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
8
|
+
};
|
|
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;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/componentStorage.ts
|
|
20
|
+
var componentStorage_exports = {};
|
|
21
|
+
__export(componentStorage_exports, {
|
|
22
|
+
clearColumnSettingFromLocal: () => clearColumnSettingFromLocal,
|
|
23
|
+
clearColumnVisibilityFromLocal: () => clearColumnVisibilityFromLocal,
|
|
24
|
+
getColumnSettingFromLocal: () => getColumnSettingFromLocal,
|
|
25
|
+
getColumnVisibilityFromLocal: () => getColumnVisibilityFromLocal,
|
|
26
|
+
getComponentStorageKey: () => getComponentStorageKey,
|
|
27
|
+
getRecordBoardColumnSettingFromLocal: () => getRecordBoardColumnSettingFromLocal,
|
|
28
|
+
getStorageKeySuffix: () => getStorageKeySuffix,
|
|
29
|
+
saveColumnSettingToLocal: () => saveColumnSettingToLocal,
|
|
30
|
+
saveColumnVisibilityToLocal: () => saveColumnVisibilityToLocal
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(componentStorage_exports);
|
|
33
|
+
var import_typeUtils = require("./typeUtils");
|
|
9
34
|
function getStorageKeySuffix() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
36
|
+
return "/";
|
|
37
|
+
}
|
|
38
|
+
const { pathname, search } = window.location;
|
|
39
|
+
const appendPath = pathname || "/";
|
|
40
|
+
let memoryKey = "";
|
|
41
|
+
try {
|
|
42
|
+
const params = new URLSearchParams(search || "");
|
|
43
|
+
const mk = params.get("memory_key");
|
|
44
|
+
if (mk && mk.trim() !== "") memoryKey = mk.trim();
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
return memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
|
|
19
48
|
}
|
|
20
|
-
/**
|
|
21
|
-
* 生成组件实例的存储 key。
|
|
22
|
-
* @param componentId 组件实例 id(如 __id)
|
|
23
|
-
* @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
|
|
24
|
-
*/
|
|
25
49
|
function getComponentStorageKey(componentId, prefix) {
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
51
|
+
return `${prefix}-${componentId}`;
|
|
52
|
+
}
|
|
53
|
+
const suffix = getStorageKeySuffix();
|
|
54
|
+
return `${prefix}-${componentId}-${suffix}`;
|
|
28
55
|
}
|
|
29
56
|
function saveColumnSettingToLocal(params) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
40
|
-
} catch (_unused2) {}
|
|
57
|
+
const { componentId, columnSetting } = params;
|
|
58
|
+
if (!componentId) return;
|
|
59
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
60
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
61
|
+
const data = { column_setting: columnSetting, updatedAt: Date.now() };
|
|
62
|
+
try {
|
|
63
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
41
66
|
}
|
|
42
67
|
function getColumnSettingFromLocal(componentId) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
if (!componentId) return null;
|
|
69
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
70
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
71
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
72
|
+
if (raw && (0, import_typeUtils.isJson)(raw)) {
|
|
73
|
+
const data = JSON.parse(raw);
|
|
74
|
+
const arr = data == null ? void 0 : data.column_setting;
|
|
75
|
+
return Array.isArray(arr) ? arr : null;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
53
78
|
}
|
|
54
79
|
function clearColumnSettingFromLocal(componentId) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
if (!componentId) return;
|
|
81
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
82
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
83
|
+
window.localStorage.removeItem(storageKey);
|
|
59
84
|
}
|
|
60
|
-
|
|
85
|
+
var RECORD_BOARD_VISIBILITY_PREFIX = "record-board-column-visibility";
|
|
61
86
|
function saveColumnVisibilityToLocal(params) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
const { componentId, columnVisibility, columnOrder } = params;
|
|
88
|
+
if (!componentId) return;
|
|
89
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
90
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
91
|
+
const data = {
|
|
92
|
+
column_visibility: columnVisibility,
|
|
93
|
+
...columnOrder != null && { column_order: columnOrder },
|
|
94
|
+
updatedAt: Date.now()
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
70
100
|
}
|
|
71
101
|
function getColumnVisibilityFromLocal(componentId) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
if (!componentId) return null;
|
|
103
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
104
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
105
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
106
|
+
if (raw && (0, import_typeUtils.isJson)(raw)) {
|
|
107
|
+
const data = JSON.parse(raw);
|
|
108
|
+
const vis = data == null ? void 0 : data.column_visibility;
|
|
109
|
+
return vis && typeof vis === "object" && vis !== null ? vis : null;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
82
112
|
}
|
|
83
|
-
/** RecordBoard 列设置(显隐 + 顺序)从 localStorage 读取,用于列设置弹层拖拽排序与显隐持久化 */
|
|
84
113
|
function getRecordBoardColumnSettingFromLocal(componentId) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return null;
|
|
114
|
+
if (!componentId) return null;
|
|
115
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
116
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
117
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
118
|
+
if (raw && (0, import_typeUtils.isJson)(raw)) {
|
|
119
|
+
const data = JSON.parse(raw);
|
|
120
|
+
const vis = data == null ? void 0 : data.column_visibility;
|
|
121
|
+
const columnVisibility = vis && typeof vis === "object" && vis !== null ? vis : {};
|
|
122
|
+
const columnOrder = Array.isArray(data == null ? void 0 : data.column_order) ? data.column_order : null;
|
|
123
|
+
return { columnVisibility, columnOrder };
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
98
126
|
}
|
|
99
127
|
function clearColumnVisibilityFromLocal(componentId) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
128
|
+
if (!componentId) return;
|
|
129
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
130
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
131
|
+
window.localStorage.removeItem(storageKey);
|
|
104
132
|
}
|
|
105
|
-
|
|
106
|
-
exports
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
clearColumnSettingFromLocal,
|
|
136
|
+
clearColumnVisibilityFromLocal,
|
|
137
|
+
getColumnSettingFromLocal,
|
|
138
|
+
getColumnVisibilityFromLocal,
|
|
139
|
+
getComponentStorageKey,
|
|
140
|
+
getRecordBoardColumnSettingFromLocal,
|
|
141
|
+
getStorageKeySuffix,
|
|
142
|
+
saveColumnSettingToLocal,
|
|
143
|
+
saveColumnVisibilityToLocal
|
|
144
|
+
});
|
package/lib/constants/index.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 });
|
|
8
|
+
};
|
|
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;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/constants/index.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
webHookApi: () => webHookApi
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(constants_exports);
|
|
25
|
+
var webHookApi = {
|
|
26
|
+
warning_log: {
|
|
27
|
+
// 非生产环境共用一个url
|
|
28
|
+
test: "https://open.feishu.cn/open-apis/bot/v2/hook/985186a7-d939-4daf-9f30-3a3cc9c47d97",
|
|
29
|
+
// 生产环境
|
|
30
|
+
prod: "https://open.feishu.cn/open-apis/bot/v2/hook/887dfff9-2ccc-4513-87ff-a05d8cef953e"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
webHookApi
|
|
36
|
+
});
|
package/lib/date.js
CHANGED
|
@@ -1,46 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param {string} format
|
|
11
|
-
* @return {*}
|
|
12
|
-
* @Author: zhiwei.Wang
|
|
13
|
-
* @Date: 2023-07-21 10:49
|
|
14
|
-
*/
|
|
15
|
-
const formatDate = (date, format) => {
|
|
16
|
-
let _format = format || formatMaps[0];
|
|
17
|
-
if (!date) return date;
|
|
18
|
-
return (0, dayjs.default)(date).format(_format);
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
10
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
const excelDateToJSDate = (excelDate) => {
|
|
29
|
-
const dateOffset = (excelDate - 25569) * 864e5;
|
|
30
|
-
return formatDate(new Date(dateOffset), formatMaps[1]);
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
31
18
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/date.ts
|
|
30
|
+
var date_exports = {};
|
|
31
|
+
__export(date_exports, {
|
|
32
|
+
excelDateToJSDate: () => excelDateToJSDate,
|
|
33
|
+
formatDate: () => formatDate,
|
|
34
|
+
jsDateToExcelDate: () => jsDateToExcelDate
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(date_exports);
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
38
|
+
var formatMaps = [
|
|
39
|
+
// 19 Jul 2023, 09:00am
|
|
40
|
+
"D MMM YYYY, hh:mma",
|
|
41
|
+
// 2023-07-19
|
|
42
|
+
"YYYY-MM-DD"
|
|
43
|
+
];
|
|
44
|
+
var formatDate = (date, format) => {
|
|
45
|
+
let _format = format || formatMaps[0];
|
|
46
|
+
if (!date) {
|
|
47
|
+
return date;
|
|
48
|
+
}
|
|
49
|
+
return (0, import_dayjs.default)(date).format(_format);
|
|
42
50
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
var excelDateToJSDate = (excelDate) => {
|
|
52
|
+
const dateOffset = (excelDate - 25569) * 864e5;
|
|
53
|
+
const jsDate = formatDate(new Date(dateOffset), formatMaps[1]);
|
|
54
|
+
return jsDate;
|
|
55
|
+
};
|
|
56
|
+
var jsDateToExcelDate = (jsDate) => {
|
|
57
|
+
const _jsDate = new Date(jsDate);
|
|
58
|
+
const excelStartDate = new Date(Date.UTC(1900, 0, 1));
|
|
59
|
+
const dateOffset = _jsDate - excelStartDate;
|
|
60
|
+
const excelDate = dateOffset / 864e5 + 25569;
|
|
61
|
+
return excelDate;
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
excelDateToJSDate,
|
|
66
|
+
formatDate,
|
|
67
|
+
jsDateToExcelDate
|
|
68
|
+
});
|