@pisell/pisellos 0.0.569 → 0.10.2
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 +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,67 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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 });
|
|
10
|
+
};
|
|
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;
|
|
18
|
+
};
|
|
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/modules/Schedule/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
calcCalendarDataByDesignation: () => calcCalendarDataByDesignation,
|
|
33
|
+
calcCalendarDataBySchedule: () => calcCalendarDataBySchedule,
|
|
34
|
+
calcCalendarDataByScheduleResult: () => calcCalendarDataByScheduleResult,
|
|
35
|
+
calcCalendarDataBySchedules: () => calcCalendarDataBySchedules,
|
|
36
|
+
calcCalendarDataByStandard: () => calcCalendarDataByStandard,
|
|
37
|
+
calcCalendarDataByTimeSlots: () => calcCalendarDataByTimeSlots,
|
|
38
|
+
calcMinTimeMaxTimeBySchedules: () => calcMinTimeMaxTimeBySchedules,
|
|
39
|
+
calcScheduleDateRange: () => calcScheduleDateRange,
|
|
40
|
+
formatScheduleData: () => formatScheduleData,
|
|
41
|
+
formatScheduleResult: () => formatScheduleResult,
|
|
42
|
+
getAllSortedDateRanges: () => getAllSortedDateRanges,
|
|
43
|
+
getDaysByStartEnd: () => getDaysByStartEnd,
|
|
44
|
+
isAllDay: () => isAllDay
|
|
5
45
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
/**
|
|
12
|
-
* 根据日程配置生成日历数据
|
|
13
|
-
* @param values
|
|
14
|
-
* @param others
|
|
15
|
-
* @param type
|
|
16
|
-
*/
|
|
17
|
-
const calcCalendarDataBySchedule = (values, others, type) => {
|
|
18
|
-
if (type === 'time-slots') {
|
|
46
|
+
module.exports = __toCommonJS(utils_exports);
|
|
47
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
48
|
+
var calcCalendarDataBySchedule = (values, others, type) => {
|
|
49
|
+
if (type === "time-slots") {
|
|
19
50
|
return calcCalendarDataByTimeSlots(values, others);
|
|
20
51
|
}
|
|
21
|
-
if (type ===
|
|
52
|
+
if (type === "designation") {
|
|
22
53
|
return calcCalendarDataByDesignation(values, others);
|
|
23
54
|
}
|
|
24
55
|
return calcCalendarDataByStandard(values, others);
|
|
25
56
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* @param startDate
|
|
30
|
-
* @param endDate
|
|
31
|
-
*/
|
|
32
|
-
exports.calcCalendarDataBySchedule = calcCalendarDataBySchedule;
|
|
33
|
-
const getDaysByStartEnd = (startDate, endDate) => {
|
|
34
|
-
let start = (0, _dayjs.default)(startDate);
|
|
35
|
-
const end = (0, _dayjs.default)(endDate);
|
|
57
|
+
var getDaysByStartEnd = (startDate, endDate) => {
|
|
58
|
+
let start = (0, import_dayjs.default)(startDate);
|
|
59
|
+
const end = (0, import_dayjs.default)(endDate);
|
|
36
60
|
const daysArray = [];
|
|
37
|
-
while (start.isBefore(end,
|
|
38
|
-
daysArray.push(start.format(
|
|
39
|
-
start = start.add(1,
|
|
61
|
+
while (start.isBefore(end, "day") || start.isSame(end, "day")) {
|
|
62
|
+
daysArray.push(start.format("YYYY-MM-DD"));
|
|
63
|
+
start = start.add(1, "day");
|
|
40
64
|
}
|
|
41
65
|
return daysArray;
|
|
42
66
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* @param date
|
|
47
|
-
* @param time
|
|
48
|
-
*/
|
|
49
|
-
exports.getDaysByStartEnd = getDaysByStartEnd;
|
|
50
|
-
const mergeDateTime = (date, time) => {
|
|
51
|
-
const dateStr = `${(0, _dayjs.default)(date).format('YYYY-MM-DD')}${time ? (0, _dayjs.default)(time).format(' HH:MM') : ''}`;
|
|
52
|
-
return (0, _dayjs.default)(dateStr);
|
|
67
|
+
var mergeDateTime = (date, time) => {
|
|
68
|
+
const dateStr = `${(0, import_dayjs.default)(date).format("YYYY-MM-DD")}${time ? (0, import_dayjs.default)(time).format(" HH:MM") : ""}`;
|
|
69
|
+
return (0, import_dayjs.default)(dateStr);
|
|
53
70
|
};
|
|
54
|
-
|
|
71
|
+
var getDataRange = ({
|
|
55
72
|
start,
|
|
56
73
|
end,
|
|
57
74
|
type,
|
|
58
75
|
time_slot
|
|
59
76
|
}) => {
|
|
60
|
-
if (type ===
|
|
77
|
+
if (type === "time-slots") {
|
|
61
78
|
let dateRange = [];
|
|
62
79
|
const dateStr = getDaysByStartEnd(start, end);
|
|
63
|
-
dateStr.forEach(str => {
|
|
64
|
-
time_slot
|
|
80
|
+
dateStr.forEach((str) => {
|
|
81
|
+
time_slot == null ? void 0 : time_slot.forEach((time) => {
|
|
65
82
|
dateRange.push({
|
|
66
83
|
start: `${str} ${time.start_time}`,
|
|
67
84
|
end: `${str} ${time.end_time}`
|
|
@@ -70,35 +87,24 @@ const getDataRange = ({
|
|
|
70
87
|
});
|
|
71
88
|
return dateRange;
|
|
72
89
|
}
|
|
73
|
-
return [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
return [
|
|
91
|
+
{
|
|
92
|
+
start: start.format("YYYY-MM-DD HH:mm:ss"),
|
|
93
|
+
end: end.format("YYYY-MM-DD HH:mm:ss")
|
|
94
|
+
}
|
|
95
|
+
];
|
|
77
96
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*/
|
|
83
|
-
const getDaysByRepeatDay = (params, isGetRange) => {
|
|
84
|
-
const {
|
|
85
|
-
start,
|
|
86
|
-
end,
|
|
87
|
-
deadline,
|
|
88
|
-
frequency,
|
|
89
|
-
type,
|
|
90
|
-
time_slot,
|
|
91
|
-
excludedDays
|
|
92
|
-
} = params;
|
|
93
|
-
const scheduleDiff = end.diff(start, 'second');
|
|
94
|
-
const excludedDaysMap = new Map(excludedDays.map(day => [day, true]));
|
|
97
|
+
var getDaysByRepeatDay = (params, isGetRange) => {
|
|
98
|
+
const { start, end, deadline, frequency, type, time_slot, excludedDays } = params;
|
|
99
|
+
const scheduleDiff = end.diff(start, "second");
|
|
100
|
+
const excludedDaysMap = new Map(excludedDays.map((day) => [day, true]));
|
|
95
101
|
let startTmp = getMaxStart(start);
|
|
96
102
|
const daysArr = [];
|
|
97
|
-
while (startTmp.isBefore(deadline,
|
|
98
|
-
const e = startTmp.add(scheduleDiff,
|
|
103
|
+
while (startTmp.isBefore(deadline, "day") || startTmp.isSame(deadline, "day")) {
|
|
104
|
+
const e = startTmp.add(scheduleDiff, "second");
|
|
99
105
|
if (isGetRange) {
|
|
100
|
-
if (excludedDaysMap.has(startTmp.format(
|
|
101
|
-
startTmp = startTmp.add(frequency,
|
|
106
|
+
if (excludedDaysMap.has(startTmp.format("YYYY-MM-DD"))) {
|
|
107
|
+
startTmp = startTmp.add(frequency, "day");
|
|
102
108
|
continue;
|
|
103
109
|
}
|
|
104
110
|
const arr = getDataRange({
|
|
@@ -111,16 +117,11 @@ const getDaysByRepeatDay = (params, isGetRange) => {
|
|
|
111
117
|
} else {
|
|
112
118
|
daysArr.push(...getDaysByStartEnd(startTmp, e));
|
|
113
119
|
}
|
|
114
|
-
startTmp = startTmp.add(frequency,
|
|
120
|
+
startTmp = startTmp.add(frequency, "day");
|
|
115
121
|
}
|
|
116
122
|
return Array.from(new Set(daysArr));
|
|
117
123
|
};
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* 按周重复配置获取日期
|
|
121
|
-
* @param params
|
|
122
|
-
*/
|
|
123
|
-
const getDaysByRepeatWeek = (params, isGetRange) => {
|
|
124
|
+
var getDaysByRepeatWeek = (params, isGetRange) => {
|
|
124
125
|
const {
|
|
125
126
|
start,
|
|
126
127
|
end,
|
|
@@ -131,28 +132,24 @@ const getDaysByRepeatWeek = (params, isGetRange) => {
|
|
|
131
132
|
time_slot,
|
|
132
133
|
excludedDays
|
|
133
134
|
} = params;
|
|
134
|
-
const scheduleDiff = end.diff(start,
|
|
135
|
-
const excludedDaysMap = new Map(excludedDays.map(day => [day, true]));
|
|
135
|
+
const scheduleDiff = end.diff(start, "second");
|
|
136
|
+
const excludedDaysMap = new Map(excludedDays.map((day) => [day, true]));
|
|
136
137
|
let startTmp = getMaxStart(start);
|
|
137
138
|
const daysArr = [];
|
|
138
|
-
while (startTmp.isBefore(deadline,
|
|
139
|
+
while (startTmp.isBefore(deadline, "day") || startTmp.isSame(deadline, "day")) {
|
|
139
140
|
for (let i = 0; i < frequency_date.length; i++) {
|
|
140
141
|
const item = frequency_date[i];
|
|
141
142
|
let _start = startTmp.day(item);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (_start.isBefore(startTmp, 'day')) {
|
|
145
|
-
_start = _start.add(1, 'week');
|
|
143
|
+
if (_start.isBefore(startTmp, "day")) {
|
|
144
|
+
_start = _start.add(1, "week");
|
|
146
145
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
let _end = _start.add(scheduleDiff, 'second');
|
|
150
|
-
if (_end.isAfter(deadline, 'day')) {
|
|
146
|
+
let _end = _start.add(scheduleDiff, "second");
|
|
147
|
+
if (_end.isAfter(deadline, "day")) {
|
|
151
148
|
_end = deadline;
|
|
152
149
|
}
|
|
153
150
|
if (isGetRange) {
|
|
154
|
-
if (excludedDaysMap.has(_start.format(
|
|
155
|
-
startTmp = startTmp.day(1).add(frequency,
|
|
151
|
+
if (excludedDaysMap.has(_start.format("YYYY-MM-DD"))) {
|
|
152
|
+
startTmp = startTmp.day(1).add(frequency, "day");
|
|
156
153
|
continue;
|
|
157
154
|
}
|
|
158
155
|
const arr = getDataRange({
|
|
@@ -166,71 +163,32 @@ const getDaysByRepeatWeek = (params, isGetRange) => {
|
|
|
166
163
|
daysArr.push(...getDaysByStartEnd(_start, _end));
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
|
-
startTmp = startTmp.add(frequency,
|
|
166
|
+
startTmp = startTmp.add(frequency, "week");
|
|
170
167
|
}
|
|
171
168
|
return Array.from(new Set(daysArr));
|
|
172
169
|
};
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* 日期和排除日期格式化日历所需数据格式
|
|
176
|
-
* @param days
|
|
177
|
-
* @param color
|
|
178
|
-
* @param excludedDays
|
|
179
|
-
*/
|
|
180
|
-
const formatDayColor = ({
|
|
170
|
+
var formatDayColor = ({
|
|
181
171
|
days,
|
|
182
172
|
color,
|
|
183
173
|
excludedDays
|
|
184
174
|
}) => {
|
|
185
175
|
const excludedDaysSet = new Set(excludedDays);
|
|
186
|
-
return days.map(item => ({
|
|
176
|
+
return days.map((item) => ({
|
|
187
177
|
date: item,
|
|
188
178
|
color: [color],
|
|
189
179
|
isExcluded: excludedDaysSet.has(item)
|
|
190
180
|
}));
|
|
191
181
|
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 获取开始结束时间数组的所有日期
|
|
195
|
-
* @param arr
|
|
196
|
-
*/
|
|
197
|
-
const getDaysByStartEndArr = (arr = []) => {
|
|
182
|
+
var getDaysByStartEndArr = (arr = []) => {
|
|
198
183
|
const daysArr = [];
|
|
199
|
-
arr.forEach(item => {
|
|
184
|
+
arr.forEach((item) => {
|
|
200
185
|
if (item && item.start && item.end) {
|
|
201
186
|
daysArr.push(...getDaysByStartEnd(item.start, item.end));
|
|
202
187
|
}
|
|
203
188
|
});
|
|
204
189
|
return Array.from(new Set(daysArr));
|
|
205
190
|
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* 过滤排除日期
|
|
209
|
-
* @param daysArr
|
|
210
|
-
* @param excludedArr
|
|
211
|
-
*/
|
|
212
|
-
const filterExcludedDays = (daysArr, excludedArr) => {
|
|
213
|
-
const excludeSet = new Set(excludedArr);
|
|
214
|
-
if (!excludedArr.length) return daysArr;
|
|
215
|
-
return daysArr.filter(item => !excludeSet.has(item));
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* 处理日期重复逻辑
|
|
220
|
-
* @param repeat_type
|
|
221
|
-
* @param start
|
|
222
|
-
* @param end
|
|
223
|
-
* @param color
|
|
224
|
-
* @param endRadio
|
|
225
|
-
* @param end_date
|
|
226
|
-
* @param excluded_date
|
|
227
|
-
* @param included_date
|
|
228
|
-
* @param frequency
|
|
229
|
-
* @param excludedStatus
|
|
230
|
-
* @param includeStatus
|
|
231
|
-
* @param frequency_date
|
|
232
|
-
*/
|
|
233
|
-
const processDateRange = ({
|
|
191
|
+
var processDateRange = ({
|
|
234
192
|
repeat_type,
|
|
235
193
|
start,
|
|
236
194
|
end,
|
|
@@ -246,83 +204,77 @@ const processDateRange = ({
|
|
|
246
204
|
type,
|
|
247
205
|
time_slot
|
|
248
206
|
}, isGetRange) => {
|
|
249
|
-
/** 时间范围或天 */
|
|
250
207
|
let days = [];
|
|
251
208
|
const excludedDays = getDaysByStartEndArr(excluded_date);
|
|
252
209
|
const includedDays = getDaysByStartEndArr(included_date);
|
|
253
|
-
|
|
254
|
-
// 不重复
|
|
255
|
-
if (repeat_type === '0') {
|
|
210
|
+
if (repeat_type === "0") {
|
|
256
211
|
if (isGetRange) {
|
|
257
|
-
if (type ===
|
|
258
|
-
days = time_slot
|
|
212
|
+
if (type === "time-slots") {
|
|
213
|
+
days = (time_slot == null ? void 0 : time_slot.map((item) => ({
|
|
259
214
|
start: start.format(`YYYY-MM-DD ${item.start_time}`),
|
|
260
215
|
end: end.format(`YYYY-MM-DD ${item.end_time}`)
|
|
261
|
-
})) || [];
|
|
216
|
+
}))) || [];
|
|
262
217
|
} else {
|
|
263
|
-
days = [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
218
|
+
days = [
|
|
219
|
+
{
|
|
220
|
+
start: start.format("YYYY-MM-DD HH:mm:ss"),
|
|
221
|
+
end: end.format("YYYY-MM-DD HH:mm:ss")
|
|
222
|
+
}
|
|
223
|
+
];
|
|
267
224
|
}
|
|
268
225
|
} else {
|
|
269
226
|
days = getDaysByStartEnd(start, end);
|
|
270
227
|
}
|
|
271
228
|
} else {
|
|
272
|
-
let endDate = (0,
|
|
273
|
-
|
|
274
|
-
// 截止时间 如果永不截止取18个月截止
|
|
229
|
+
let endDate = (0, import_dayjs.default)(end_date);
|
|
275
230
|
if (endRadio === 1) {
|
|
276
|
-
endDate = isGetRange ? (0,
|
|
231
|
+
endDate = isGetRange ? (0, import_dayjs.default)().add(12, "month") : (0, import_dayjs.default)().add(18, "month");
|
|
277
232
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
} else if (repeat_type ===
|
|
292
|
-
days = getDaysByRepeatWeek(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
233
|
+
if (repeat_type === "1") {
|
|
234
|
+
days = getDaysByRepeatDay(
|
|
235
|
+
{
|
|
236
|
+
start,
|
|
237
|
+
end,
|
|
238
|
+
deadline: endDate,
|
|
239
|
+
frequency,
|
|
240
|
+
type,
|
|
241
|
+
time_slot,
|
|
242
|
+
excludedDays
|
|
243
|
+
},
|
|
244
|
+
isGetRange
|
|
245
|
+
);
|
|
246
|
+
} else if (repeat_type === "2") {
|
|
247
|
+
days = getDaysByRepeatWeek(
|
|
248
|
+
{
|
|
249
|
+
start,
|
|
250
|
+
end,
|
|
251
|
+
deadline: endDate,
|
|
252
|
+
frequency,
|
|
253
|
+
frequency_date,
|
|
254
|
+
type,
|
|
255
|
+
time_slot,
|
|
256
|
+
excludedDays
|
|
257
|
+
},
|
|
258
|
+
isGetRange
|
|
259
|
+
);
|
|
302
260
|
}
|
|
303
261
|
}
|
|
304
262
|
if (isGetRange) {
|
|
305
|
-
// 如果有包含的天再把包含的天的时间段插入
|
|
306
263
|
if (includedDays.length) {
|
|
307
264
|
for (let i = 0; i < includedDays.length; i++) {
|
|
308
265
|
const includedDay = includedDays[i];
|
|
309
|
-
days.push(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
266
|
+
days.push(
|
|
267
|
+
...getDataRange({
|
|
268
|
+
start: (0, import_dayjs.default)(includedDay),
|
|
269
|
+
end: (0, import_dayjs.default)(includedDay),
|
|
270
|
+
type,
|
|
271
|
+
time_slot
|
|
272
|
+
})
|
|
273
|
+
);
|
|
315
274
|
}
|
|
316
275
|
}
|
|
317
276
|
return days;
|
|
318
277
|
}
|
|
319
|
-
|
|
320
|
-
// 开启了排除日期
|
|
321
|
-
// if (excludedStatus) {
|
|
322
|
-
// days = filterExcludedDays(days, excludedDays);
|
|
323
|
-
// }
|
|
324
|
-
|
|
325
|
-
// 开启了包含日期
|
|
326
278
|
if (includeStatus) {
|
|
327
279
|
days = days.concat(includedDays);
|
|
328
280
|
}
|
|
@@ -332,13 +284,7 @@ const processDateRange = ({
|
|
|
332
284
|
excludedDays: excludedStatus ? excludedDays : []
|
|
333
285
|
});
|
|
334
286
|
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* 根据标准日程计算日历数据
|
|
338
|
-
* @param values
|
|
339
|
-
* @param others
|
|
340
|
-
*/
|
|
341
|
-
const calcCalendarDataByStandard = (values, others, isGetRange) => {
|
|
287
|
+
var calcCalendarDataByStandard = (values, others, isGetRange) => {
|
|
342
288
|
const {
|
|
343
289
|
color,
|
|
344
290
|
excluded_date,
|
|
@@ -352,99 +298,42 @@ const calcCalendarDataByStandard = (values, others, isGetRange) => {
|
|
|
352
298
|
start_time,
|
|
353
299
|
end_time
|
|
354
300
|
} = values;
|
|
355
|
-
const {
|
|
356
|
-
endRadio,
|
|
357
|
-
isAllDay,
|
|
358
|
-
includeStatus,
|
|
359
|
-
excludedStatus
|
|
360
|
-
} = others;
|
|
301
|
+
const { endRadio, isAllDay: isAllDay2, includeStatus, excludedStatus } = others;
|
|
361
302
|
if (Array.isArray(designation)) {
|
|
362
303
|
return [];
|
|
363
304
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
// frequency,
|
|
389
|
-
// });
|
|
390
|
-
//
|
|
391
|
-
// // 开启了排除日期
|
|
392
|
-
// if (excludedStatus) {
|
|
393
|
-
// days = filterExcludedDays(days, excludedDays);
|
|
394
|
-
// }
|
|
395
|
-
//
|
|
396
|
-
// // 开启了包含日期
|
|
397
|
-
// if (includeStatus) {
|
|
398
|
-
// days = days.concat(includedDays);
|
|
399
|
-
// }
|
|
400
|
-
//
|
|
401
|
-
// return formatDayColor(days, color);
|
|
402
|
-
// }
|
|
403
|
-
//
|
|
404
|
-
// // 按周重复
|
|
405
|
-
// if (repeat_type === "2") {
|
|
406
|
-
// let days = getDaysByRepeatWeek({
|
|
407
|
-
// start,
|
|
408
|
-
// end,
|
|
409
|
-
// deadline: endDate,
|
|
410
|
-
// frequency,
|
|
411
|
-
// frequency_date,
|
|
412
|
-
// });
|
|
413
|
-
// }
|
|
414
|
-
//
|
|
415
|
-
// return [];
|
|
416
|
-
|
|
417
|
-
return processDateRange({
|
|
418
|
-
repeat_type,
|
|
419
|
-
start,
|
|
420
|
-
end,
|
|
421
|
-
color,
|
|
422
|
-
endRadio,
|
|
423
|
-
end_date,
|
|
424
|
-
excluded_date,
|
|
425
|
-
excludedStatus,
|
|
426
|
-
frequency,
|
|
427
|
-
frequency_date,
|
|
428
|
-
included_date,
|
|
429
|
-
includeStatus,
|
|
430
|
-
time_slot,
|
|
431
|
-
type: 'standard'
|
|
432
|
-
}, isGetRange);
|
|
305
|
+
const start = designation ? mergeDateTime(
|
|
306
|
+
designation.start_date,
|
|
307
|
+
isAllDay2 ? designation.start_time : ""
|
|
308
|
+
) : (0, import_dayjs.default)(start_time);
|
|
309
|
+
const end = designation ? mergeDateTime(designation.end_date, isAllDay2 ? designation.end_time : "") : (0, import_dayjs.default)(end_time);
|
|
310
|
+
return processDateRange(
|
|
311
|
+
{
|
|
312
|
+
repeat_type,
|
|
313
|
+
start,
|
|
314
|
+
end,
|
|
315
|
+
color,
|
|
316
|
+
endRadio,
|
|
317
|
+
end_date,
|
|
318
|
+
excluded_date,
|
|
319
|
+
excludedStatus,
|
|
320
|
+
frequency,
|
|
321
|
+
frequency_date,
|
|
322
|
+
included_date,
|
|
323
|
+
includeStatus,
|
|
324
|
+
time_slot,
|
|
325
|
+
type: "standard"
|
|
326
|
+
},
|
|
327
|
+
isGetRange
|
|
328
|
+
);
|
|
433
329
|
};
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
const
|
|
437
|
-
const currentYearStart = (0, _dayjs.default)().startOf('year').set('hour', valueStart.get('hour')).set('minute', valueStart.get('minutes')).set('second', valueStart.get('second'));
|
|
330
|
+
var getMaxStart = (start_time) => {
|
|
331
|
+
const valueStart = (0, import_dayjs.default)(start_time);
|
|
332
|
+
const currentYearStart = (0, import_dayjs.default)().startOf("year").set("hour", valueStart.get("hour")).set("minute", valueStart.get("minutes")).set("second", valueStart.get("second"));
|
|
438
333
|
const start = valueStart.isBefore(currentYearStart) ? currentYearStart : valueStart;
|
|
439
334
|
return start;
|
|
440
335
|
};
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* 根据多时间段计算日历数据
|
|
444
|
-
* @param values
|
|
445
|
-
* @param others
|
|
446
|
-
*/
|
|
447
|
-
const calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
|
|
336
|
+
var calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
|
|
448
337
|
const {
|
|
449
338
|
color,
|
|
450
339
|
excluded_date,
|
|
@@ -456,50 +345,37 @@ const calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
|
|
|
456
345
|
start_time,
|
|
457
346
|
time_slot
|
|
458
347
|
} = values;
|
|
459
|
-
const {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
348
|
+
const { endRadio, excludedStatus, includeStatus } = others;
|
|
349
|
+
if (!start_time)
|
|
350
|
+
return [];
|
|
351
|
+
const start = (0, import_dayjs.default)(start_time);
|
|
352
|
+
const end = (0, import_dayjs.default)(start_time);
|
|
353
|
+
return processDateRange(
|
|
354
|
+
{
|
|
355
|
+
repeat_type,
|
|
356
|
+
start,
|
|
357
|
+
end,
|
|
358
|
+
color,
|
|
359
|
+
endRadio,
|
|
360
|
+
end_date,
|
|
361
|
+
excluded_date,
|
|
362
|
+
excludedStatus,
|
|
363
|
+
frequency,
|
|
364
|
+
frequency_date,
|
|
365
|
+
included_date,
|
|
366
|
+
includeStatus,
|
|
367
|
+
time_slot,
|
|
368
|
+
type: "time-slots"
|
|
369
|
+
},
|
|
370
|
+
isGetRange
|
|
371
|
+
);
|
|
483
372
|
};
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
* 根据指定日期计算日历数据
|
|
487
|
-
* @param values
|
|
488
|
-
* @param others
|
|
489
|
-
*/
|
|
490
|
-
exports.calcCalendarDataByTimeSlots = calcCalendarDataByTimeSlots;
|
|
491
|
-
const calcCalendarDataByDesignation = (values, others, isGetRange) => {
|
|
492
|
-
const {
|
|
493
|
-
designation,
|
|
494
|
-
color
|
|
495
|
-
} = values;
|
|
373
|
+
var calcCalendarDataByDesignation = (values, others, isGetRange) => {
|
|
374
|
+
const { designation, color } = values;
|
|
496
375
|
const days = [];
|
|
497
376
|
if (Array.isArray(designation)) {
|
|
498
|
-
designation.forEach(item => {
|
|
499
|
-
// 日程开始时间
|
|
377
|
+
designation.forEach((item) => {
|
|
500
378
|
const start = mergeDateTime(item.start_date, item.start_time);
|
|
501
|
-
|
|
502
|
-
// 日程结束时间
|
|
503
379
|
const end = mergeDateTime(item.end_date, item.end_time);
|
|
504
380
|
if (isGetRange) {
|
|
505
381
|
days.push({
|
|
@@ -520,39 +396,27 @@ const calcCalendarDataByDesignation = (values, others, isGetRange) => {
|
|
|
520
396
|
excludedDays: []
|
|
521
397
|
});
|
|
522
398
|
};
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
return (0, _dayjs.default)(value.start_time).format('HH:mm:ss') === '00:00:00' && (0, _dayjs.default)(value.end_time).format('HH:mm:ss') === '23:59:59';
|
|
399
|
+
var isAllDay = (value) => {
|
|
400
|
+
return (0, import_dayjs.default)(value.start_time).format("HH:mm:ss") === "00:00:00" && (0, import_dayjs.default)(value.end_time).format("HH:mm:ss") === "23:59:59";
|
|
526
401
|
};
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
weekly: '2'
|
|
402
|
+
var repeatTypeMap = {
|
|
403
|
+
none: "0",
|
|
404
|
+
daily: "1",
|
|
405
|
+
weekly: "2"
|
|
532
406
|
};
|
|
533
|
-
|
|
407
|
+
var endTypeMap = {
|
|
534
408
|
never: 1,
|
|
535
409
|
date: 2
|
|
536
410
|
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
* @param schedule
|
|
541
|
-
*/
|
|
542
|
-
const calcCalendarDataByScheduleResult = schedule => {
|
|
543
|
-
const {
|
|
411
|
+
var calcCalendarDataByScheduleResult = (schedule) => {
|
|
412
|
+
const { scheduleFormData, scheduleFormOtherValue } = formatScheduleResult(schedule);
|
|
413
|
+
return calcCalendarDataBySchedule(
|
|
544
414
|
scheduleFormData,
|
|
545
|
-
scheduleFormOtherValue
|
|
546
|
-
|
|
547
|
-
|
|
415
|
+
scheduleFormOtherValue,
|
|
416
|
+
schedule.type
|
|
417
|
+
);
|
|
548
418
|
};
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* 接口返回schedule转换格式
|
|
552
|
-
* @param schedule
|
|
553
|
-
*/
|
|
554
|
-
exports.calcCalendarDataByScheduleResult = calcCalendarDataByScheduleResult;
|
|
555
|
-
const formatScheduleResult = schedule => {
|
|
419
|
+
var formatScheduleResult = (schedule) => {
|
|
556
420
|
const {
|
|
557
421
|
color,
|
|
558
422
|
name,
|
|
@@ -565,13 +429,7 @@ const formatScheduleResult = schedule => {
|
|
|
565
429
|
type,
|
|
566
430
|
time_slot
|
|
567
431
|
} = schedule;
|
|
568
|
-
const {
|
|
569
|
-
frequency,
|
|
570
|
-
end,
|
|
571
|
-
frequency_date,
|
|
572
|
-
included_date,
|
|
573
|
-
excluded_date
|
|
574
|
-
} = repeat_rule || {};
|
|
432
|
+
const { frequency, end, frequency_date, included_date, excluded_date } = repeat_rule || {};
|
|
575
433
|
return {
|
|
576
434
|
scheduleFormData: {
|
|
577
435
|
color,
|
|
@@ -585,62 +443,69 @@ const formatScheduleResult = schedule => {
|
|
|
585
443
|
excluded_date,
|
|
586
444
|
included_date,
|
|
587
445
|
time_slot,
|
|
588
|
-
end_date: end
|
|
446
|
+
end_date: end == null ? void 0 : end.end_date
|
|
589
447
|
},
|
|
590
448
|
scheduleFormOtherValue: {
|
|
591
|
-
endRadio: endTypeMap[end
|
|
449
|
+
endRadio: endTypeMap[(end == null ? void 0 : end.type) || "never"],
|
|
592
450
|
isAllDay: !!is_all,
|
|
593
451
|
type,
|
|
594
|
-
excludedStatus: !!excluded_date
|
|
595
|
-
includeStatus: !!included_date
|
|
452
|
+
excludedStatus: !!(excluded_date == null ? void 0 : excluded_date.length),
|
|
453
|
+
includeStatus: !!(included_date == null ? void 0 : included_date.length)
|
|
596
454
|
}
|
|
597
455
|
};
|
|
598
456
|
};
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
457
|
+
var calcScheduleDateRange = (schedule) => {
|
|
458
|
+
const { scheduleFormData, scheduleFormOtherValue } = formatScheduleResult(schedule);
|
|
459
|
+
if (schedule.type === "time-slots") {
|
|
460
|
+
return calcCalendarDataByTimeSlots(
|
|
461
|
+
scheduleFormData,
|
|
462
|
+
scheduleFormOtherValue,
|
|
463
|
+
true
|
|
464
|
+
);
|
|
607
465
|
}
|
|
608
|
-
if (schedule.type ===
|
|
609
|
-
return calcCalendarDataByDesignation(
|
|
466
|
+
if (schedule.type === "designation") {
|
|
467
|
+
return calcCalendarDataByDesignation(
|
|
468
|
+
scheduleFormData,
|
|
469
|
+
scheduleFormOtherValue,
|
|
470
|
+
true
|
|
471
|
+
);
|
|
610
472
|
}
|
|
611
|
-
return calcCalendarDataByStandard(
|
|
473
|
+
return calcCalendarDataByStandard(
|
|
474
|
+
scheduleFormData,
|
|
475
|
+
scheduleFormOtherValue,
|
|
476
|
+
true
|
|
477
|
+
);
|
|
612
478
|
};
|
|
613
|
-
|
|
614
|
-
const calcCalendarDataBySchedules = schedules => {
|
|
479
|
+
var calcCalendarDataBySchedules = (schedules) => {
|
|
615
480
|
const allSchedules = [];
|
|
616
|
-
schedules.forEach(item => {
|
|
481
|
+
schedules.forEach((item) => {
|
|
617
482
|
allSchedules.push(...calcCalendarDataByScheduleResult(item));
|
|
618
483
|
});
|
|
619
484
|
const dateMap = allSchedules.reduce((pre, cur) => {
|
|
485
|
+
var _a, _b;
|
|
620
486
|
return {
|
|
621
487
|
...pre,
|
|
622
488
|
[cur.date]: {
|
|
623
489
|
...cur,
|
|
624
|
-
color: [...(pre[cur.date]
|
|
625
|
-
isExcluded: pre[cur.date]
|
|
490
|
+
color: [...((_a = pre[cur.date]) == null ? void 0 : _a.color) || [], ...cur.color],
|
|
491
|
+
isExcluded: ((_b = pre[cur.date]) == null ? void 0 : _b.isExcluded) || cur.isExcluded
|
|
626
492
|
}
|
|
627
493
|
};
|
|
628
494
|
}, {});
|
|
629
495
|
return Object.values(dateMap);
|
|
630
496
|
};
|
|
631
|
-
|
|
632
|
-
const calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) => {
|
|
497
|
+
var calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) => {
|
|
633
498
|
return schedules.reduce((pre, cur) => {
|
|
634
|
-
|
|
499
|
+
var _a;
|
|
500
|
+
let dateRange = ((_a = scheduleAllMap == null ? void 0 : scheduleAllMap[cur.id]) == null ? void 0 : _a.dateRange) || calcScheduleDateRange(cur);
|
|
635
501
|
let dateRangeFormat = [];
|
|
636
502
|
if (selectDate) {
|
|
637
503
|
const dateRangeTmp = [];
|
|
638
504
|
const dateRangeFormatTmp = [];
|
|
639
505
|
for (let i = 0; i < dateRange.length; i++) {
|
|
640
506
|
const range = dateRange[i];
|
|
641
|
-
const start = (0,
|
|
642
|
-
const end = (0,
|
|
643
|
-
// includes 比 dayjs isSame方法会快一些
|
|
507
|
+
const start = (0, import_dayjs.default)(range.start);
|
|
508
|
+
const end = (0, import_dayjs.default)(range.end);
|
|
644
509
|
const isSameStart = range.start.includes(selectDate);
|
|
645
510
|
const isSameEnd = range.end.includes(selectDate);
|
|
646
511
|
if (isSameStart || isSameEnd) {
|
|
@@ -648,11 +513,11 @@ const calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) =>
|
|
|
648
513
|
if (isSameStart && !isSameEnd) {
|
|
649
514
|
dateRangeFormatTmp.push({
|
|
650
515
|
start: range.start,
|
|
651
|
-
end: end.format(
|
|
516
|
+
end: end.format("YYYY-MM-DD 23:59:59")
|
|
652
517
|
});
|
|
653
518
|
} else if (!isSameStart && isSameEnd) {
|
|
654
519
|
dateRangeFormatTmp.push({
|
|
655
|
-
start: start.format(
|
|
520
|
+
start: start.format("YYYY-MM-DD 00:00:00"),
|
|
656
521
|
end: range.end
|
|
657
522
|
});
|
|
658
523
|
} else {
|
|
@@ -666,89 +531,82 @@ const calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) =>
|
|
|
666
531
|
let minTime = null;
|
|
667
532
|
let maxTime = null;
|
|
668
533
|
if (dateRange.length) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
maxTime = (0, _dayjs.default)(dateRange[dateRange.length - 1].end);
|
|
534
|
+
minTime = (0, import_dayjs.default)(dateRange[0].start);
|
|
535
|
+
maxTime = (0, import_dayjs.default)(dateRange[dateRange.length - 1].end);
|
|
672
536
|
}
|
|
673
537
|
return {
|
|
674
538
|
...pre,
|
|
675
539
|
[cur.id]: {
|
|
676
540
|
minTime,
|
|
677
541
|
maxTime,
|
|
678
|
-
minTimeStr: minTime
|
|
679
|
-
maxTimeStr: maxTime
|
|
542
|
+
minTimeStr: (minTime == null ? void 0 : minTime.format("YYYY-MM-DD HH:mm:ss")) || null,
|
|
543
|
+
maxTimeStr: (maxTime == null ? void 0 : maxTime.format("YYYY-MM-DD HH:mm:ss")) || null,
|
|
680
544
|
dateRange,
|
|
681
545
|
dateRangeFormat
|
|
682
546
|
}
|
|
683
547
|
};
|
|
684
548
|
}, {});
|
|
685
549
|
};
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* @title: 格式化日程数据
|
|
689
|
-
* @description:
|
|
690
|
-
* @param {Array} relation 资源列表
|
|
691
|
-
* @param {string} table_type 关联表类型
|
|
692
|
-
* @param {string} item_type 资源类型
|
|
693
|
-
* @param {boolean} isExcluded 是否排除
|
|
694
|
-
* @return {*}
|
|
695
|
-
* @Author: WangHan
|
|
696
|
-
* @Date: 2024-09-04 11:54
|
|
697
|
-
*/
|
|
698
|
-
exports.calcMinTimeMaxTimeBySchedules = calcMinTimeMaxTimeBySchedules;
|
|
699
|
-
const formatScheduleData = (relation, table_type, item_type, isExcluded) => {
|
|
550
|
+
var formatScheduleData = (relation, table_type, item_type, isExcluded) => {
|
|
700
551
|
const _relation = relation || [];
|
|
701
|
-
// 有关联表类型和资源类型并且排除
|
|
702
552
|
if (table_type && item_type && isExcluded) {
|
|
703
|
-
return _relation.find(
|
|
553
|
+
return _relation.find(
|
|
554
|
+
(item) => (item == null ? void 0 : item.relation_table_type) === table_type && (item == null ? void 0 : item.item_type) !== item_type
|
|
555
|
+
);
|
|
704
556
|
}
|
|
705
|
-
|
|
706
|
-
// 有关联表类型和资源类型
|
|
707
557
|
if (table_type && item_type) {
|
|
708
|
-
return _relation.find(
|
|
558
|
+
return _relation.find(
|
|
559
|
+
(item) => (item == null ? void 0 : item.relation_table_type) === table_type && (item == null ? void 0 : item.item_type) === item_type
|
|
560
|
+
);
|
|
709
561
|
}
|
|
710
|
-
|
|
711
|
-
// 有关联表类型
|
|
712
562
|
if (table_type) {
|
|
713
|
-
return _relation.some(
|
|
563
|
+
return _relation.some(
|
|
564
|
+
(item) => (item == null ? void 0 : item.relation_table_type) === table_type
|
|
565
|
+
);
|
|
714
566
|
}
|
|
715
|
-
|
|
716
|
-
// 有关联资源类型
|
|
717
567
|
if (item_type) {
|
|
718
|
-
return _relation.find(item => item
|
|
568
|
+
return _relation.find((item) => (item == null ? void 0 : item.item_type) === item_type);
|
|
719
569
|
}
|
|
720
570
|
};
|
|
721
|
-
exports.formatScheduleData = formatScheduleData;
|
|
722
571
|
function getAllSortedDateRanges(schedules) {
|
|
723
|
-
// 收集所有 dateRange
|
|
724
572
|
const allDateRanges = [];
|
|
725
|
-
|
|
726
|
-
// 遍历所有对象,收集 dateRange
|
|
727
|
-
Object.values(schedules).forEach(schedule => {
|
|
573
|
+
Object.values(schedules).forEach((schedule) => {
|
|
728
574
|
if (schedule.dateRange && Array.isArray(schedule.dateRange)) {
|
|
729
575
|
allDateRanges.push(...schedule.dateRange);
|
|
730
576
|
}
|
|
731
577
|
});
|
|
732
|
-
|
|
733
|
-
// 如果没有找到任何 dateRange,返回空数组
|
|
734
578
|
if (allDateRanges.length === 0) {
|
|
579
|
+
console.log("No dateRanges found in schedules:", schedules);
|
|
735
580
|
return [];
|
|
736
581
|
}
|
|
737
|
-
|
|
738
|
-
// 按照开始时间和时长排序
|
|
739
582
|
let sortedDateRanges = allDateRanges.sort((a, b) => {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
const durationA = (0, _dayjs.default)(a.end).valueOf() - (0, _dayjs.default)(a.start).valueOf();
|
|
746
|
-
const durationB = (0, _dayjs.default)(b.end).valueOf() - (0, _dayjs.default)(b.start).valueOf();
|
|
583
|
+
const startTimeCompare = (0, import_dayjs.default)(a.start).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
|
|
584
|
+
if (startTimeCompare !== 0)
|
|
585
|
+
return startTimeCompare;
|
|
586
|
+
const durationA = (0, import_dayjs.default)(a.end).valueOf() - (0, import_dayjs.default)(a.start).valueOf();
|
|
587
|
+
const durationB = (0, import_dayjs.default)(b.end).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
|
|
747
588
|
return durationA - durationB;
|
|
748
589
|
});
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
590
|
+
const uniqueDateRanges = sortedDateRanges.filter(
|
|
591
|
+
(range, index, self) => index === self.findIndex(
|
|
592
|
+
(t) => (0, import_dayjs.default)(t.start).isSame((0, import_dayjs.default)(range.start)) && (0, import_dayjs.default)(t.end).isSame((0, import_dayjs.default)(range.end))
|
|
593
|
+
)
|
|
594
|
+
);
|
|
753
595
|
return uniqueDateRanges;
|
|
754
|
-
}
|
|
596
|
+
}
|
|
597
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
598
|
+
0 && (module.exports = {
|
|
599
|
+
calcCalendarDataByDesignation,
|
|
600
|
+
calcCalendarDataBySchedule,
|
|
601
|
+
calcCalendarDataByScheduleResult,
|
|
602
|
+
calcCalendarDataBySchedules,
|
|
603
|
+
calcCalendarDataByStandard,
|
|
604
|
+
calcCalendarDataByTimeSlots,
|
|
605
|
+
calcMinTimeMaxTimeBySchedules,
|
|
606
|
+
calcScheduleDateRange,
|
|
607
|
+
formatScheduleData,
|
|
608
|
+
formatScheduleResult,
|
|
609
|
+
getAllSortedDateRanges,
|
|
610
|
+
getDaysByStartEnd,
|
|
611
|
+
isAllDay
|
|
612
|
+
});
|