@ray-js/lamp-schedule-core 1.0.0 → 1.0.1-beta-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.
@@ -237,7 +237,7 @@ function mergeListByOtherId(list) {
237
237
  return Object.values(mergedData);
238
238
  }
239
239
 
240
- // 冲突检测核心函数(修改后的版本)
240
+ // 冲突检测核心函数
241
241
  export function checkConflicts(scheduleList, currentSchedule) {
242
242
  let rule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultRule;
243
243
  const currentRanges = convertToTimeRanges([currentSchedule]);
@@ -260,6 +260,11 @@ export function checkConflicts(scheduleList, currentSchedule) {
260
260
  const currentPreId = current === null || current === void 0 || (_current$originalSche = current.originalSchedule) === null || _current$originalSche === void 0 ? void 0 : _current$originalSche.prevId;
261
261
  const currentId = current === null || current === void 0 || (_current$originalSche2 = current.originalSchedule) === null || _current$originalSche2 === void 0 ? void 0 : _current$originalSche2.id;
262
262
  const otherId = other.id;
263
+ // 针对定时,如果当前定时自身修改 且 与自身冲突 则忽略
264
+ if (currentPreId && currentId === currentPreId && current.type === 'timer') {
265
+ return;
266
+ }
267
+ // FIXME:还是存在bug
263
268
  // 如果当前定时自身修改 且 与自身冲突 并且其他定时不等于当前定时id 则忽略
264
269
  if (currentPreId && currentId === currentPreId && otherId !== currentId) {
265
270
  return;
@@ -23,10 +23,15 @@ export const timerDataToSchedule = data => {
23
23
  status: (_data$status = data.status) !== null && _data$status !== void 0 ? _data$status : false,
24
24
  weeks: data.loops.split('').map(item => Number(item)),
25
25
  startTime: data.time,
26
- endTime: data.time
26
+ endTime: data.time,
27
+ dps: data.dps,
28
+ aliasName: data.aliasName || '',
29
+ isAppPush: data.isAppPush || false,
30
+ id: (data === null || data === void 0 ? void 0 : data.id) || data.timerId
27
31
  };
32
+ const timerId = `${EScheduleFunctionType.TIMER}_${_data.id}`;
28
33
  return {
29
- id: objectToId(_data, `${EScheduleFunctionType.TIMER}_`),
34
+ id: timerId || objectToId(_data, `${EScheduleFunctionType.TIMER}_`),
30
35
  type: EScheduleFunctionType.TIMER,
31
36
  data: _data
32
37
  };
package/lib/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { useWakeUpDp } from './hooks/useWakeUpDp';
19
19
  export { useRandomDp } from './hooks/useRandomDp';
20
20
  export { useCycleDp } from './hooks/useCycleDp';
21
21
  export { useWakeUpSupport } from './hooks/useWakeUpSupport';
22
- export { useBaseLightDp, useFetchDpDataByMesh, getDpDataByMesh, useFetchDpData } from './hooks/useBaseLightDp';
22
+ export { useBaseLightDp, useFetchDpDataByMesh, getDpDataByMesh, useFetchDpData, } from './hooks/useBaseLightDp';
23
23
  export { useTimerReportDp, useTimerReportDpPull } from './hooks/useTimerReportDp';
24
24
  /** Conflict 冲突判断 */
25
25
  export { transScheduleListToConflictList } from './conflict/transform';
@@ -24,7 +24,9 @@ export const objectToId = function (obj) {
24
24
  // 简单哈希算法
25
25
  let hash = 5381;
26
26
  for (let i = 0; i < str.length; i++) {
27
+ // eslint-disable-next-line no-bitwise
27
28
  hash = (hash << 5) + hash + str.charCodeAt(i);
29
+ // eslint-disable-next-line operator-assignment, no-bitwise
28
30
  hash = hash & hash; // 转换为32位整数
29
31
  }
30
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta-1",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [