@pisell/pisellos 2.0.67 → 2.1.1
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/index.js +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/ProductList/index.d.ts +2 -12
- package/dist/modules/ProductList/index.js +8 -28
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/utils/resources.js +12 -4
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +0 -1
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/ProductList/index.d.ts +2 -12
- package/lib/modules/ProductList/index.js +6 -30
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/utils/resources.js +12 -4
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +0 -2
- package/lib/types/index.d.ts +1 -3
- package/package.json +1 -1
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
package/lib/utils/watch.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
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/utils/watch.ts
|
|
20
|
-
var watch_exports = {};
|
|
21
|
-
__export(watch_exports, {
|
|
22
|
-
default: () => watch_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(watch_exports);
|
|
25
|
-
var Watch = class {
|
|
26
|
-
constructor() {
|
|
27
|
-
// 监听列表
|
|
28
|
-
this.events = /* @__PURE__ */ new Map();
|
|
29
|
-
// 启用列表 - 使用数组保持顺序
|
|
30
|
-
this.enableListMap = /* @__PURE__ */ new Map();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 订阅事件
|
|
34
|
-
* @param event 事件名称
|
|
35
|
-
* @param callback 回调函数
|
|
36
|
-
* @returns 订阅对象,可用于取消订阅
|
|
37
|
-
*/
|
|
38
|
-
subscribe(watchKey, event) {
|
|
39
|
-
if (!this.events.has(watchKey)) {
|
|
40
|
-
this.events.set(watchKey, /* @__PURE__ */ new Map());
|
|
41
|
-
}
|
|
42
|
-
const callbacks = this.events.get(watchKey);
|
|
43
|
-
callbacks.set(event.key, event.callback);
|
|
44
|
-
this.enableEvent(watchKey, event.key);
|
|
45
|
-
return {
|
|
46
|
-
// 取消订阅
|
|
47
|
-
unsubscribe: () => {
|
|
48
|
-
this.unsubscribe(watchKey, event);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 启用事件
|
|
54
|
-
* @param watchKey 监听的key
|
|
55
|
-
* @param event 事件名称
|
|
56
|
-
*/
|
|
57
|
-
enableEvent(watchKey, eventKey) {
|
|
58
|
-
const enableList = this.enableListMap.get(watchKey);
|
|
59
|
-
if (enableList) {
|
|
60
|
-
if (enableList.includes(eventKey)) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
enableList.push(eventKey);
|
|
64
|
-
} else {
|
|
65
|
-
this.enableListMap.set(watchKey, [eventKey]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 禁用某个事件
|
|
70
|
-
* @param watchKey 监听的key
|
|
71
|
-
* @param eventKey 事件名称
|
|
72
|
-
*/
|
|
73
|
-
disableEvent(watchKey, eventKey) {
|
|
74
|
-
const enableList = this.enableListMap.get(watchKey);
|
|
75
|
-
if (enableList) {
|
|
76
|
-
const index = enableList.indexOf(eventKey);
|
|
77
|
-
if (index !== -1) {
|
|
78
|
-
enableList.splice(index);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 冻结某个监听下的所有事件
|
|
84
|
-
* @param watchKey 监听的key
|
|
85
|
-
*/
|
|
86
|
-
disabledAllEventByWatchKey(watchKey) {
|
|
87
|
-
this.enableListMap.set(watchKey, []);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 启用某个监听下的所有事件
|
|
91
|
-
* @param watchKey 监听的key
|
|
92
|
-
*/
|
|
93
|
-
enableAllEventByWatchKey(watchKey) {
|
|
94
|
-
var _a;
|
|
95
|
-
this.enableListMap.set(
|
|
96
|
-
watchKey,
|
|
97
|
-
Array.from(((_a = this.events.get(watchKey)) == null ? void 0 : _a.keys()) || [])
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* 取消订阅事件
|
|
102
|
-
* @param event 事件名称
|
|
103
|
-
* @param callback 回调函数
|
|
104
|
-
* @returns 是否成功取消订阅
|
|
105
|
-
*/
|
|
106
|
-
unsubscribe(watchKey, event) {
|
|
107
|
-
const callbacks = this.events.get(watchKey);
|
|
108
|
-
if (!callbacks) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
this.disableEvent(watchKey, event.key);
|
|
112
|
-
callbacks.delete(event.key);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 发布事件
|
|
117
|
-
* @param event 事件名称
|
|
118
|
-
* @param args 事件参数
|
|
119
|
-
*/
|
|
120
|
-
publish(watchKey, ...args) {
|
|
121
|
-
var _a;
|
|
122
|
-
const callbacks = this.events.get(watchKey);
|
|
123
|
-
if (!callbacks) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const enableList = this.enableListMap.get(watchKey);
|
|
127
|
-
if (!enableList || enableList.length === 0) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const lastCallbackKey = enableList.at(-1);
|
|
131
|
-
if (lastCallbackKey) {
|
|
132
|
-
try {
|
|
133
|
-
(_a = callbacks.get(lastCallbackKey)) == null ? void 0 : _a(...args);
|
|
134
|
-
} catch (error) {
|
|
135
|
-
console.error(`执行事件"${watchKey}"的回调时出错:`, error);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* 根据事件名称发布事件
|
|
141
|
-
* @param watchKey 监听的key
|
|
142
|
-
* @param eventKey 事件名称
|
|
143
|
-
* @param args 事件参数
|
|
144
|
-
*/
|
|
145
|
-
publishByEventKey(watchKey, eventKey, ...args) {
|
|
146
|
-
var _a;
|
|
147
|
-
const callbacks = this.events.get(watchKey);
|
|
148
|
-
if (!callbacks) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
(_a = callbacks.get(eventKey)) == null ? void 0 : _a(...args);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* 获取最后一个启用的事件
|
|
155
|
-
* @param watchKey 监听的key
|
|
156
|
-
* @returns 最后一个启用的事件
|
|
157
|
-
*/
|
|
158
|
-
getLastEnableEventKey(watchKey) {
|
|
159
|
-
const enableList = this.enableListMap.get(watchKey);
|
|
160
|
-
console.log("enableList", enableList);
|
|
161
|
-
if (!enableList) {
|
|
162
|
-
return void 0;
|
|
163
|
-
}
|
|
164
|
-
return enableList.at(-1) || void 0;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* 移除某个事件的所有订阅
|
|
168
|
-
* @param event 事件名称
|
|
169
|
-
* @returns 是否成功移除
|
|
170
|
-
*/
|
|
171
|
-
clearEvent(watchKey) {
|
|
172
|
-
this.disabledAllEventByWatchKey(watchKey);
|
|
173
|
-
this.events.delete(watchKey);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* 移除所有事件订阅
|
|
177
|
-
*/
|
|
178
|
-
clearAllEvents() {
|
|
179
|
-
this.events.clear();
|
|
180
|
-
this.enableListMap.clear();
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* 获取事件的订阅数量
|
|
184
|
-
* @param event 事件名称
|
|
185
|
-
* @returns 订阅数量
|
|
186
|
-
*/
|
|
187
|
-
getSubscriberCount(event) {
|
|
188
|
-
const callbacks = this.events.get(event);
|
|
189
|
-
return callbacks ? callbacks.size : 0;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* 检查事件是否有订阅者
|
|
193
|
-
* @param event 事件名称
|
|
194
|
-
* @returns 是否有订阅者
|
|
195
|
-
*/
|
|
196
|
-
hasSubscribers(event) {
|
|
197
|
-
return this.getSubscriberCount(event) > 0;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* 一次性订阅事件,事件触发后自动取消订阅
|
|
201
|
-
* @param event 事件名称
|
|
202
|
-
* @param callback 回调函数
|
|
203
|
-
* @returns 订阅对象,可用于取消订阅
|
|
204
|
-
*/
|
|
205
|
-
once(watchKey, event) {
|
|
206
|
-
const wrappedCallback = (...args) => {
|
|
207
|
-
this.unsubscribe(watchKey, { key: event.key, callback: wrappedCallback });
|
|
208
|
-
event.callback(...args);
|
|
209
|
-
};
|
|
210
|
-
return this.subscribe(watchKey, {
|
|
211
|
-
key: event.key,
|
|
212
|
-
callback: wrappedCallback
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
var watch = new Watch();
|
|
217
|
-
var watch_default = watch;
|