@pisell/private-materials 3.3.61 → 3.3.62
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.js +5 -5
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +120 -1
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/locales.d.ts +164 -146
- package/es/components/ticketBooking/locales.js +195 -147
- package/es/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
- package/es/components/ticketBooking/utils/formatProductMessage.js +53 -0
- package/es/components/ticketBooking/utils/formatTime.d.ts +31 -0
- package/es/components/ticketBooking/utils/formatTime.js +144 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +120 -1
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/locales.d.ts +164 -146
- package/lib/components/ticketBooking/locales.js +22 -4
- package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
- package/lib/components/ticketBooking/utils/formatProductMessage.js +76 -0
- package/lib/components/ticketBooking/utils/formatTime.d.ts +31 -0
- package/lib/components/ticketBooking/utils/formatTime.js +139 -0
- package/package.json +2 -2
|
@@ -0,0 +1,139 @@
|
|
|
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/components/ticketBooking/utils/formatTime.ts
|
|
30
|
+
var formatTime_exports = {};
|
|
31
|
+
__export(formatTime_exports, {
|
|
32
|
+
formatMultiDayDate: () => formatMultiDayDate,
|
|
33
|
+
getServiceTime: () => getServiceTime,
|
|
34
|
+
isEn: () => isEn
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(formatTime_exports);
|
|
37
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
38
|
+
var import_utils = require("@pisell/utils");
|
|
39
|
+
var import_zh_cn = require("dayjs/locale/zh-cn");
|
|
40
|
+
var import_en = require("dayjs/locale/en");
|
|
41
|
+
var import_zh_tw = require("dayjs/locale/zh-tw");
|
|
42
|
+
var isEn = (item) => {
|
|
43
|
+
const locale = (item == null ? void 0 : item.locale) || "en-US";
|
|
44
|
+
const _isEn = locale === "en-US" || locale === "en";
|
|
45
|
+
const localeTypes = {
|
|
46
|
+
"en-US": "en",
|
|
47
|
+
"zh-CN": "zh-cn",
|
|
48
|
+
"zh-HK": "zh-tw"
|
|
49
|
+
};
|
|
50
|
+
import_dayjs.default.locale(localeTypes[locale]);
|
|
51
|
+
return _isEn;
|
|
52
|
+
};
|
|
53
|
+
var formatMultiDayDate = (item) => {
|
|
54
|
+
const _isEn = isEn(item);
|
|
55
|
+
const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
|
|
56
|
+
const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
|
|
57
|
+
const _format = _isEn ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
|
|
58
|
+
const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
|
|
59
|
+
return date;
|
|
60
|
+
};
|
|
61
|
+
var getServiceTime = (item, currentDate, utils) => {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
if (!(0, import_dayjs.default)(currentDate).isValid()) return "";
|
|
64
|
+
const locale = (item == null ? void 0 : item.locale) || ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en-US";
|
|
65
|
+
const isEn2 = locale === "en-US" || locale === "en";
|
|
66
|
+
const localeTypes = {
|
|
67
|
+
"en-US": "en",
|
|
68
|
+
"zh-CN": "zh-cn",
|
|
69
|
+
"zh-HK": "zh-tw"
|
|
70
|
+
};
|
|
71
|
+
import_dayjs.default.locale(localeTypes[locale]);
|
|
72
|
+
let startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
|
|
73
|
+
let endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
|
|
74
|
+
let diffInDays = (item == null ? void 0 : item.custom_day_count) || endDate.diff(startDate, "day");
|
|
75
|
+
if (item == null ? void 0 : item.duration_type) {
|
|
76
|
+
const sameDay = startDate.isSame(endDate, "day");
|
|
77
|
+
const dateFormat = isEn2 ? "DD/MM/YYYY" : "YYYY-MM-DD";
|
|
78
|
+
const timeFormat = "HH:mm";
|
|
79
|
+
const startTime = (item == null ? void 0 : item.start_time) || startDate.format(timeFormat);
|
|
80
|
+
const endTime = (item == null ? void 0 : item.end_time) || endDate.format(timeFormat);
|
|
81
|
+
let dateTime = "";
|
|
82
|
+
if (sameDay) {
|
|
83
|
+
if (isEn2) {
|
|
84
|
+
dateTime = `${startTime} ~ ${endTime} ${startDate.format(dateFormat)}`;
|
|
85
|
+
} else {
|
|
86
|
+
dateTime = `${startDate.format(dateFormat)} ${startTime} ~ ${endTime}`;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
if (isEn2) {
|
|
90
|
+
dateTime = `${startTime} ${startDate.format(dateFormat)} ~ ${endTime} ${endDate.format(dateFormat)}`;
|
|
91
|
+
} else {
|
|
92
|
+
dateTime = `${startDate.format(dateFormat)} ${startTime} ~ ${endDate.format(dateFormat)} ${endTime}`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const startDateTime = `${startDate.format("YYYY-MM-DD")} ${startTime}`;
|
|
96
|
+
const endDateTime = `${endDate.format("YYYY-MM-DD")} ${endTime}`;
|
|
97
|
+
let _duration = (0, import_dayjs.default)(endDateTime).diff((0, import_dayjs.default)(startDateTime), item == null ? void 0 : item.duration_type);
|
|
98
|
+
let durationText = "";
|
|
99
|
+
if ((item == null ? void 0 : item.duration_type) === "minutes") {
|
|
100
|
+
const hours = Math.floor(_duration / 60);
|
|
101
|
+
const minutes = _duration % 60;
|
|
102
|
+
durationText = import_utils.locales.getText("pisell2.product.card.hour.minute")(hours, minutes);
|
|
103
|
+
} else if ((item == null ? void 0 : item.duration_type) === "days") {
|
|
104
|
+
durationText = import_utils.locales.getText("pisell2.product.card.day")(_duration);
|
|
105
|
+
} else {
|
|
106
|
+
durationText = `${_duration}`;
|
|
107
|
+
}
|
|
108
|
+
return `${dateTime} (${durationText})`;
|
|
109
|
+
}
|
|
110
|
+
let _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
|
|
111
|
+
if ((item == null ? void 0 : item.hasOwnProperty("format")) && ((_b = item == null ? void 0 : item.format) == null ? void 0 : _b.length) > 0) {
|
|
112
|
+
_format = isEn2 ? (_c = item == null ? void 0 : item.format) == null ? void 0 : _c[0] : (_d = item == null ? void 0 : item.format) == null ? void 0 : _d[1];
|
|
113
|
+
}
|
|
114
|
+
if (item == null ? void 0 : item.show_time) {
|
|
115
|
+
startDate = (0, import_dayjs.default)((item == null ? void 0 : item.start_time) ? `${item == null ? void 0 : item.start_date} ${item == null ? void 0 : item.start_time}` : startDate.format("YYYY-MM-DD HH:mm"));
|
|
116
|
+
endDate = (0, import_dayjs.default)((item == null ? void 0 : item.end_time) ? `${item == null ? void 0 : item.end_date} ${item == null ? void 0 : item.end_time}` : endDate.format("YYYY-MM-DD HH:mm"));
|
|
117
|
+
}
|
|
118
|
+
if ((item == null ? void 0 : item.duration_type) === "minutes") {
|
|
119
|
+
diffInDays = endDate.diff(startDate, "minute");
|
|
120
|
+
}
|
|
121
|
+
const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
|
|
122
|
+
let text = import_utils.locales.getText("pisell2.product.card.day")(diffInDays);
|
|
123
|
+
if (item == null ? void 0 : item.custom_day_count) {
|
|
124
|
+
text = import_utils.locales.getText("pisell2.product.card.day.event")(diffInDays);
|
|
125
|
+
}
|
|
126
|
+
const textTypes = {
|
|
127
|
+
"minutes": import_utils.locales.getText("pisell2.product.card.minute")(diffInDays),
|
|
128
|
+
"event": import_utils.locales.getText("pisell2.product.card.day.event")(diffInDays)
|
|
129
|
+
};
|
|
130
|
+
text = (textTypes == null ? void 0 : textTypes[item == null ? void 0 : item.duration_type]) || text;
|
|
131
|
+
let duration = `${diffInDays}${text}`;
|
|
132
|
+
return `${date} (${duration})`;
|
|
133
|
+
};
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
formatMultiDayDate,
|
|
137
|
+
getServiceTime,
|
|
138
|
+
isEn
|
|
139
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.62",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
|
61
61
|
"decimal.js": "^10.4.3",
|
|
62
62
|
"@pisell/utils": "1.0.42",
|
|
63
|
-
"@pisell/materials": "3.3.22",
|
|
64
63
|
"@pisell/icon": "0.0.11",
|
|
64
|
+
"@pisell/materials": "3.3.22",
|
|
65
65
|
"@pisell/date-picker": "3.0.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|