calendar-2k 1.0.2 → 1.0.5
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/package.json +13 -7
- package/src/Calendar2kModule.ts +5 -3
- package/build/Calendar2k.types.d.ts +0 -29
- package/build/Calendar2k.types.js +0 -2
- package/build/Calendar2kModule.d.ts +0 -6
- package/build/Calendar2kModule.js +0 -4
- package/build/Calendar2kModule.web.d.ts +0 -6
- package/build/Calendar2kModule.web.js +0 -26
- package/build/Calendar2kView.d.ts +0 -3
- package/build/Calendar2kView.js +0 -279
- package/build/Calendar2kView.web.d.ts +0 -3
- package/build/Calendar2kView.web.js +0 -16
- package/build/components/ArrowButton.d.ts +0 -8
- package/build/components/ArrowButton.js +0 -19
- package/build/components/Backdrop.d.ts +0 -5
- package/build/components/Backdrop.js +0 -25
- package/build/components/DayLabel.d.ts +0 -6
- package/build/components/DayLabel.js +0 -13
- package/build/components/Icon.d.ts +0 -6
- package/build/components/Icon.js +0 -16
- package/build/components/SwipeIcon.d.ts +0 -5
- package/build/components/SwipeIcon.js +0 -8
- package/build/components/Time.d.ts +0 -10
- package/build/components/Time.js +0 -59
- package/build/components/TimeView.d.ts +0 -9
- package/build/components/TimeView.js +0 -22
- package/build/hooks/useCalendarDisclose.d.ts +0 -4
- package/build/hooks/useCalendarDisclose.js +0 -9
- package/build/libs/format.d.ts +0 -4
- package/build/libs/format.js +0 -50
- package/build/libs/formatNb.d.ts +0 -1
- package/build/libs/formatNb.js +0 -6
- package/build/libs/getDayMatrix.d.ts +0 -1
- package/build/libs/getDayMatrix.js +0 -74
- package/build/libs/getStatus.d.ts +0 -17
- package/build/libs/getStatus.js +0 -33
- package/build/libs/getStyle.d.ts +0 -14
- package/build/libs/getStyle.js +0 -32
- package/build/libs/isActive.d.ts +0 -8
- package/build/libs/isActive.js +0 -17
- package/build/libs/isToday.d.ts +0 -1
- package/build/libs/isToday.js +0 -9
- package/build/libs/resetTime.d.ts +0 -1
- package/build/libs/resetTime.js +0 -6
- package/build/libs/toHexColor.d.ts +0 -1
- package/build/libs/toHexColor.js +0 -13
- package/build/ui/index.d.ts +0 -15
- package/build/ui/index.js +0 -35
- /package/src/{index.tsx → Calendar2kView.tsx} +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calendar-2k",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "The fastest fully customizable Expo date & time picker, written in TypeScript, supporting Expo Go, single date, time, date range, time range, datetime range selection, flexible date disabling, and dynamic color theming for iOS and Android.",
|
|
5
5
|
"main": "Calendar2kView.js",
|
|
6
6
|
"types": "build/Calendar2k.types.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./build/Calendar2kView.js",
|
|
13
|
+
"require": "./build/Calendar2kView.js",
|
|
14
|
+
"types": "./build/Calendar2k.types.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
7
17
|
"keywords": [
|
|
8
18
|
"expo",
|
|
9
19
|
"expo-module",
|
|
@@ -37,9 +47,5 @@
|
|
|
37
47
|
"expo-calendar",
|
|
38
48
|
"expo-go",
|
|
39
49
|
"expo-go-compatible"
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/ainasoa/my-date-time-picker.git"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
50
|
+
]
|
|
51
|
+
}
|
package/src/Calendar2kModule.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { NativeModule, requireNativeModule } from
|
|
1
|
+
import { NativeModule, requireNativeModule } from "expo";
|
|
2
2
|
|
|
3
|
-
import { Calendar2kModuleEvents } from
|
|
3
|
+
import { Calendar2kModuleEvents } from "./Calendar2k.types";
|
|
4
4
|
|
|
5
5
|
declare class Calendar2kModule extends NativeModule<Calendar2kModuleEvents> {}
|
|
6
6
|
|
|
7
|
-
export default requireNativeModule<Calendar2kModule>(
|
|
7
|
+
export default requireNativeModule<Calendar2kModule>("Calendar2k");
|
|
8
|
+
export * from "./Calendar2k.types";
|
|
9
|
+
export { default as Calendar2kView } from "./Calendar2kView";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type Calendar2kModuleEvents = {
|
|
2
|
-
onChange: (params: ChangeEventPayload) => void;
|
|
3
|
-
};
|
|
4
|
-
export type ChangeEventPayload = {
|
|
5
|
-
value: string;
|
|
6
|
-
};
|
|
7
|
-
export type OnTapEventPayload = Record<string, never>;
|
|
8
|
-
export type Calendar2kViewProps = {
|
|
9
|
-
onChangeDate?: (date: DateValueType) => void;
|
|
10
|
-
value?: DateValueType;
|
|
11
|
-
locales?: Intl.LocalesArgument;
|
|
12
|
-
mode?: "date" | "time" | "datetime";
|
|
13
|
-
color?: string;
|
|
14
|
-
min?: Date;
|
|
15
|
-
max?: Date;
|
|
16
|
-
disableDate?: (date: Date) => boolean;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
};
|
|
19
|
-
export type DayColumnProps = {
|
|
20
|
-
label: string;
|
|
21
|
-
dayNumber: number;
|
|
22
|
-
};
|
|
23
|
-
export type DayProps = {
|
|
24
|
-
date: Date;
|
|
25
|
-
};
|
|
26
|
-
export type DateValueType = Date | {
|
|
27
|
-
start: Date;
|
|
28
|
-
end?: Date;
|
|
29
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var expo_1 = require("expo");
|
|
19
|
-
var Calendar2kModule = /** @class */ (function (_super) {
|
|
20
|
-
__extends(Calendar2kModule, _super);
|
|
21
|
-
function Calendar2kModule() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
}
|
|
24
|
-
return Calendar2kModule;
|
|
25
|
-
}(expo_1.NativeModule));
|
|
26
|
-
exports.default = (0, expo_1.registerWebModule)(Calendar2kModule, 'Calendar2kModule');
|
package/build/Calendar2kView.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.default = Calendar2kView;
|
|
51
|
-
var React = require("react");
|
|
52
|
-
var react_1 = require("react");
|
|
53
|
-
var react_native_1 = require("react-native");
|
|
54
|
-
var react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
55
|
-
var ArrowButton_1 = require("./components/ArrowButton");
|
|
56
|
-
var Backdrop_1 = require("./components/Backdrop");
|
|
57
|
-
var DayLabel_1 = require("./components/DayLabel");
|
|
58
|
-
var Icon_1 = require("./components/Icon");
|
|
59
|
-
var SwipeIcon_1 = require("./components/SwipeIcon");
|
|
60
|
-
var Time_1 = require("./components/Time");
|
|
61
|
-
var TimeView_1 = require("./components/TimeView");
|
|
62
|
-
var useCalendarDisclose_1 = require("./hooks/useCalendarDisclose");
|
|
63
|
-
var format_1 = require("./libs/format");
|
|
64
|
-
var getDayMatrix_1 = require("./libs/getDayMatrix");
|
|
65
|
-
var getStyle_1 = require("./libs/getStyle");
|
|
66
|
-
var isActive_1 = require("./libs/isActive");
|
|
67
|
-
var toHexColor_1 = require("./libs/toHexColor");
|
|
68
|
-
var ui_1 = require("./ui");
|
|
69
|
-
function Calendar2kView(_a) {
|
|
70
|
-
var _this = this;
|
|
71
|
-
var onChangeDate = _a.onChangeDate, value = _a.value, locales = _a.locales, color = _a.color, min = _a.min, max = _a.max, disableDate = _a.disableDate, placeholder = _a.placeholder, _b = _a.mode, mode = _b === void 0 ? "datetime" : _b;
|
|
72
|
-
color = (0, toHexColor_1.toHexColor)(color);
|
|
73
|
-
var modeHasTime = mode === null || mode === void 0 ? void 0 : mode.includes("time");
|
|
74
|
-
var modeHasDate = mode === null || mode === void 0 ? void 0 : mode.includes("date");
|
|
75
|
-
var _c = (0, useCalendarDisclose_1.default)(), isOpen = _c.isOpen, onToggle = _c.onToggle;
|
|
76
|
-
var _d = (0, react_1.useState)(value !== null && value !== void 0 ? value : new Date()), selectedDate = _d[0], setSelectedDate = _d[1];
|
|
77
|
-
var isDate = selectedDate instanceof Date;
|
|
78
|
-
var _e = (0, react_1.useState)(new Date(isDate ? selectedDate : (selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.start) || new Date())), shortDate = _e[0], setShortDate = _e[1];
|
|
79
|
-
var matrix = (0, getDayMatrix_1.default)(shortDate);
|
|
80
|
-
var weekDays = Array.from({ length: 7 }).map(function (_, i) {
|
|
81
|
-
return (0, format_1.getWeekDay)(new Date(2026, 4, 3 + i), locales);
|
|
82
|
-
});
|
|
83
|
-
var datetimeOuput = (0, react_1.useMemo)(function () {
|
|
84
|
-
if (!value) {
|
|
85
|
-
if (placeholder)
|
|
86
|
-
return placeholder;
|
|
87
|
-
placeholder = "Select date and time";
|
|
88
|
-
if (mode === "date")
|
|
89
|
-
return "Select date";
|
|
90
|
-
if (mode === "time")
|
|
91
|
-
return "Select time";
|
|
92
|
-
return placeholder;
|
|
93
|
-
}
|
|
94
|
-
if (value instanceof Date)
|
|
95
|
-
return (0, format_1.formatDate)(value, locales, mode);
|
|
96
|
-
var date = (0, format_1.formatDate)(value.start, locales, mode);
|
|
97
|
-
if (value.end)
|
|
98
|
-
date = date.concat(" - ").concat((0, format_1.formatDate)(value.end, locales, mode));
|
|
99
|
-
return date;
|
|
100
|
-
}, [value, locales, mode]);
|
|
101
|
-
var changeYear = function (year) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
102
|
-
return [2 /*return*/, setShortDate(function (v) { return new Date(year, v.getMonth(), v.getDate()); })];
|
|
103
|
-
}); }); };
|
|
104
|
-
var changeMonth = function (nb) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
105
|
-
return __generator(this, function (_a) {
|
|
106
|
-
return [2 /*return*/, setShortDate(function (v) { return new Date(v.getFullYear(), v.getMonth() + nb, v.getDate()); })];
|
|
107
|
-
});
|
|
108
|
-
}); }; };
|
|
109
|
-
var selectDate = function (date) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
110
|
-
var newDate, isBeforeStart;
|
|
111
|
-
return __generator(this, function (_a) {
|
|
112
|
-
newDate = new Date(date);
|
|
113
|
-
if (isDate) {
|
|
114
|
-
if (modeHasTime) {
|
|
115
|
-
newDate.setHours(selectedDate.getHours());
|
|
116
|
-
newDate.setMinutes(selectedDate.getMinutes());
|
|
117
|
-
}
|
|
118
|
-
setSelectedDate(newDate);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
isBeforeStart = selectedDate.start.getTime() > newDate.getTime();
|
|
122
|
-
if (selectedDate.end || isBeforeStart) {
|
|
123
|
-
if (modeHasTime) {
|
|
124
|
-
newDate.setHours(selectedDate.start.getHours());
|
|
125
|
-
newDate.setMinutes(selectedDate.start.getMinutes());
|
|
126
|
-
}
|
|
127
|
-
setSelectedDate({ start: newDate, end: undefined });
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
if (modeHasTime) {
|
|
131
|
-
newDate.setHours(selectedDate.start.getHours());
|
|
132
|
-
newDate.setMinutes(selectedDate.start.getMinutes());
|
|
133
|
-
}
|
|
134
|
-
setSelectedDate(function (v) { return (__assign(__assign({}, v), { end: newDate })); });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return [2 /*return*/];
|
|
138
|
-
});
|
|
139
|
-
}); }; };
|
|
140
|
-
var changeTime = function (key, endTime) {
|
|
141
|
-
if (key === void 0) { key = "h"; }
|
|
142
|
-
return function (time) { return __awaiter(_this, void 0, void 0, function () {
|
|
143
|
-
var date, date, date;
|
|
144
|
-
return __generator(this, function (_a) {
|
|
145
|
-
if (isDate) {
|
|
146
|
-
date = new Date(selectedDate);
|
|
147
|
-
if (key === "h")
|
|
148
|
-
date.setHours(time);
|
|
149
|
-
if (key === "min")
|
|
150
|
-
date.setMinutes(time);
|
|
151
|
-
setSelectedDate(date);
|
|
152
|
-
}
|
|
153
|
-
else if (selectedDate.end && endTime) {
|
|
154
|
-
date = new Date(selectedDate.end);
|
|
155
|
-
if (key === "h")
|
|
156
|
-
date.setHours(time);
|
|
157
|
-
if (key === "min")
|
|
158
|
-
date.setMinutes(time);
|
|
159
|
-
setSelectedDate(date);
|
|
160
|
-
}
|
|
161
|
-
else if (selectedDate.start) {
|
|
162
|
-
date = new Date(selectedDate.start);
|
|
163
|
-
if (key === "h")
|
|
164
|
-
date.setHours(time);
|
|
165
|
-
if (key === "min")
|
|
166
|
-
date.setMinutes(time);
|
|
167
|
-
setSelectedDate(date);
|
|
168
|
-
}
|
|
169
|
-
return [2 /*return*/];
|
|
170
|
-
});
|
|
171
|
-
}); };
|
|
172
|
-
};
|
|
173
|
-
var save = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
174
|
-
return __generator(this, function (_a) {
|
|
175
|
-
onChangeDate === null || onChangeDate === void 0 ? void 0 : onChangeDate(selectedDate);
|
|
176
|
-
onToggle();
|
|
177
|
-
return [2 /*return*/];
|
|
178
|
-
});
|
|
179
|
-
}); };
|
|
180
|
-
function Day(_a) {
|
|
181
|
-
var date = _a.date;
|
|
182
|
-
var active = (0, isActive_1.default)({ min: min, max: max, date: date, disableDate: disableDate });
|
|
183
|
-
var style = (0, getStyle_1.default)({
|
|
184
|
-
date: date,
|
|
185
|
-
shortDate: shortDate,
|
|
186
|
-
selectedDate: selectedDate,
|
|
187
|
-
color: color,
|
|
188
|
-
active: active,
|
|
189
|
-
});
|
|
190
|
-
return (<ui_1.KTouchableOpacity paddingHorizontal={16} paddingVertical={10} alignItems="center" justifyContent="center" nativeProps={{ onPress: selectDate(date), disabled: !active }} {...style.touchableOpacity}>
|
|
191
|
-
<ui_1.KText textAlign="center" fontSize={16} {...style.text}>
|
|
192
|
-
{date.getDate()}
|
|
193
|
-
</ui_1.KText>
|
|
194
|
-
</ui_1.KTouchableOpacity>);
|
|
195
|
-
}
|
|
196
|
-
function DayColumn(_a) {
|
|
197
|
-
var label = _a.label, dayNumber = _a.dayNumber;
|
|
198
|
-
return (<ui_1.KView rowGap={3} flex={1} alignItems="stretch">
|
|
199
|
-
<DayLabel_1.default color={color}>{label}</DayLabel_1.default>
|
|
200
|
-
<Day date={matrix[dayNumber][0]}/>
|
|
201
|
-
<Day date={matrix[dayNumber][1]}/>
|
|
202
|
-
<Day date={matrix[dayNumber][2]}/>
|
|
203
|
-
<Day date={matrix[dayNumber][3]}/>
|
|
204
|
-
<Day date={matrix[dayNumber][4]}/>
|
|
205
|
-
</ui_1.KView>);
|
|
206
|
-
}
|
|
207
|
-
return (<>
|
|
208
|
-
<react_native_1.Pressable onPress={onToggle} style={{
|
|
209
|
-
width: "100%",
|
|
210
|
-
borderWidth: 1,
|
|
211
|
-
borderColor: "#0003",
|
|
212
|
-
paddingHorizontal: 16,
|
|
213
|
-
paddingVertical: 10,
|
|
214
|
-
borderRadius: 8,
|
|
215
|
-
backgroundColor: "white",
|
|
216
|
-
flexDirection: "row",
|
|
217
|
-
gap: 10,
|
|
218
|
-
alignItems: "center",
|
|
219
|
-
}}>
|
|
220
|
-
<Icon_1.default mode={mode}/>
|
|
221
|
-
<ui_1.KText fontSize={16} color={value ? undefined : "#0007"}>
|
|
222
|
-
{datetimeOuput}
|
|
223
|
-
</ui_1.KText>
|
|
224
|
-
</react_native_1.Pressable>
|
|
225
|
-
<react_native_1.Modal animationType="slide" visible={isOpen} transparent onRequestClose={onToggle}>
|
|
226
|
-
<ui_1.KView flex={1} justifyContent="flex-end">
|
|
227
|
-
{isOpen && <Backdrop_1.default onPress={onToggle}/>}
|
|
228
|
-
<react_native_safe_area_context_1.SafeAreaView style={{
|
|
229
|
-
minHeight: modeHasDate ? 470 : 200,
|
|
230
|
-
backgroundColor: "white",
|
|
231
|
-
padding: 20,
|
|
232
|
-
gap: 16,
|
|
233
|
-
}}>
|
|
234
|
-
<ui_1.KView flexDirection="row" justifyContent={modeHasTime ? "space-between" : "flex-end"} alignItems="center">
|
|
235
|
-
{modeHasTime && (<ui_1.KView flexDirection="row" justifyContent="space-between" alignItems="center" gap={8}>
|
|
236
|
-
<TimeView_1.default date={isDate ? selectedDate : selectedDate.start} onChangeHours={changeTime("h")} onChangeMinutes={changeTime("min")} showDate={modeHasDate} color={color}/>
|
|
237
|
-
{(selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.end) && (<>
|
|
238
|
-
<ui_1.KView width={10} borderWidth={2} borderColor={color}/>
|
|
239
|
-
<TimeView_1.default date={selectedDate.end} onChangeHours={changeTime("h", true)} onChangeMinutes={changeTime("min", true)} showDate={modeHasDate} color={color}/>
|
|
240
|
-
</>)}
|
|
241
|
-
<SwipeIcon_1.default color={color}/>
|
|
242
|
-
</ui_1.KView>)}
|
|
243
|
-
<ui_1.KTouchableOpacity nativeProps={{ onPress: save }} alignItems="center" justifyContent="center" borderWidth={3} paddingHorizontal={14} paddingVertical={14} borderColor={color}>
|
|
244
|
-
<ui_1.KText fontSize={20} fontWeight="bold" color={color}>
|
|
245
|
-
OK
|
|
246
|
-
</ui_1.KText>
|
|
247
|
-
</ui_1.KTouchableOpacity>
|
|
248
|
-
</ui_1.KView>
|
|
249
|
-
<ui_1.KView borderTopWidth={1} width="100%" borderColor={"".concat(color, "11")}/>
|
|
250
|
-
{modeHasDate && (<>
|
|
251
|
-
<ui_1.KView flexDirection="row" justifyContent="space-between" alignItems="center">
|
|
252
|
-
<ArrowButton_1.default color={color} onPress={changeMonth(-1)} direction="left"/>
|
|
253
|
-
<ui_1.KView flexDirection="row" alignItems="center" gap={4}>
|
|
254
|
-
<ui_1.KText fontWeight="bold" fontSize={16} textTransform="capitalize" color={color} minWidth={100} textAlign="right">
|
|
255
|
-
{(0, format_1.formatMonth)(shortDate, locales)} -
|
|
256
|
-
</ui_1.KText>
|
|
257
|
-
<ui_1.KView height={40} backgroundColor={"".concat(color, "11")} paddingHorizontal={10} borderColor={"".concat(color, "11")} flexDirection="row" alignItems="center">
|
|
258
|
-
<Time_1.default length={1000} index={shortDate.getFullYear()} height={40} start={new Date().getFullYear() - 500} onScrollEnd={changeYear} color={color}/>
|
|
259
|
-
<SwipeIcon_1.default color={color}/>
|
|
260
|
-
</ui_1.KView>
|
|
261
|
-
</ui_1.KView>
|
|
262
|
-
<ArrowButton_1.default color={color} onPress={changeMonth(1)} direction="right"/>
|
|
263
|
-
</ui_1.KView>
|
|
264
|
-
<ui_1.KView borderTopWidth={1} width="100%" borderColor={"".concat(color, "22")}/>
|
|
265
|
-
<ui_1.KView flexDirection="row" flex={1}>
|
|
266
|
-
<DayColumn label={weekDays[0]} dayNumber={6}/>
|
|
267
|
-
<DayColumn label={weekDays[1]} dayNumber={0}/>
|
|
268
|
-
<DayColumn label={weekDays[2]} dayNumber={1}/>
|
|
269
|
-
<DayColumn label={weekDays[3]} dayNumber={2}/>
|
|
270
|
-
<DayColumn label={weekDays[4]} dayNumber={3}/>
|
|
271
|
-
<DayColumn label={weekDays[5]} dayNumber={4}/>
|
|
272
|
-
<DayColumn label={weekDays[6]} dayNumber={5}/>
|
|
273
|
-
</ui_1.KView>
|
|
274
|
-
</>)}
|
|
275
|
-
</react_native_safe_area_context_1.SafeAreaView>
|
|
276
|
-
</ui_1.KView>
|
|
277
|
-
</react_native_1.Modal>
|
|
278
|
-
</>);
|
|
279
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Calendar2kView;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
function Calendar2kView(_props) {
|
|
6
|
-
return (<div style={{
|
|
7
|
-
backgroundColor: '#aabbcc',
|
|
8
|
-
flex: 1,
|
|
9
|
-
display: 'flex',
|
|
10
|
-
flexDirection: 'column',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
}}>
|
|
14
|
-
<span>Calendar2k - native view</span>
|
|
15
|
-
</div>);
|
|
16
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
onPress: () => void;
|
|
4
|
-
color?: string;
|
|
5
|
-
direction?: "right" | "left";
|
|
6
|
-
} & PropsWithChildren;
|
|
7
|
-
export default function ArrowButton({ onPress, children, color, direction, }: Props): import("react").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = ArrowButton;
|
|
4
|
-
var react_native_1 = require("react-native");
|
|
5
|
-
var ui_1 = require("../ui");
|
|
6
|
-
function ArrowButton(_a) {
|
|
7
|
-
var onPress = _a.onPress, children = _a.children, color = _a.color, _b = _a.direction, direction = _b === void 0 ? "right" : _b;
|
|
8
|
-
var source = function () {
|
|
9
|
-
switch (direction) {
|
|
10
|
-
case "right":
|
|
11
|
-
return require("@/components/MyCalendar/assets/images/chevron-right.png");
|
|
12
|
-
case "left":
|
|
13
|
-
return require("@/components/MyCalendar/assets/images/chevron-left.png");
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
return (<ui_1.KTouchableOpacity backgroundColor={color} width={35} height={35} alignItems="center" justifyContent="center" nativeProps={{ onPress: onPress }}>
|
|
17
|
-
<react_native_1.Image source={source()} style={{ width: 12, height: 12, tintColor: "white" }}/>
|
|
18
|
-
</ui_1.KTouchableOpacity>);
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Backdrop;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var react_native_1 = require("react-native");
|
|
6
|
-
var ui_1 = require("../ui");
|
|
7
|
-
function Backdrop(_a) {
|
|
8
|
-
var onPress = _a.onPress;
|
|
9
|
-
var fadeAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
10
|
-
(0, react_1.useEffect)(function () {
|
|
11
|
-
react_native_1.Animated.timing(fadeAnim, {
|
|
12
|
-
toValue: 1,
|
|
13
|
-
duration: 800,
|
|
14
|
-
delay: 100,
|
|
15
|
-
useNativeDriver: true,
|
|
16
|
-
}).start();
|
|
17
|
-
}, []);
|
|
18
|
-
return (<react_native_1.Animated.View style={{
|
|
19
|
-
opacity: fadeAnim,
|
|
20
|
-
flex: 1,
|
|
21
|
-
backgroundColor: "#0003",
|
|
22
|
-
}}>
|
|
23
|
-
<ui_1.KTouchableOpacity flex={1} nativeProps={{ onPress: onPress }}/>
|
|
24
|
-
</react_native_1.Animated.View>);
|
|
25
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = DayLabel;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var ui_1 = require("../ui");
|
|
6
|
-
function DayLabel(_a) {
|
|
7
|
-
var children = _a.children, color = _a.color;
|
|
8
|
-
return (<ui_1.KView padding={4}>
|
|
9
|
-
<ui_1.KText textAlign="center" fontWeight="bold" textTransform="uppercase" color={color}>
|
|
10
|
-
{children}
|
|
11
|
-
</ui_1.KText>
|
|
12
|
-
</ui_1.KView>);
|
|
13
|
-
}
|
package/build/components/Icon.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Icon;
|
|
4
|
-
var react_native_1 = require("react-native");
|
|
5
|
-
function Icon(_a) {
|
|
6
|
-
var color = _a.color, mode = _a.mode;
|
|
7
|
-
var source = function () {
|
|
8
|
-
switch (mode) {
|
|
9
|
-
case "time":
|
|
10
|
-
return require("@/components/MyCalendar/assets/images/clock.png");
|
|
11
|
-
default:
|
|
12
|
-
return require("@/components/MyCalendar/assets/images/calendar.png");
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
return (<react_native_1.Image source={source()} style={{ width: 25, height: 25, tintColor: "#A1A1A1" }}/>);
|
|
16
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = SwipeIcon;
|
|
4
|
-
var react_native_1 = require("react-native");
|
|
5
|
-
function SwipeIcon(_a) {
|
|
6
|
-
var color = _a.color;
|
|
7
|
-
return (<react_native_1.Image source={require("@/components/MyCalendar/assets/images/swipe.png")} style={{ width: 30, height: 30, tintColor: color }}/>);
|
|
8
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function Time({ length, onScrollEnd, color, index, height, start, }: Props): any;
|
|
2
|
-
type Props = {
|
|
3
|
-
length: number;
|
|
4
|
-
index?: number;
|
|
5
|
-
onScrollEnd?: (index: number) => void;
|
|
6
|
-
height?: number;
|
|
7
|
-
start?: number;
|
|
8
|
-
color?: string;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
package/build/components/Time.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Time;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var react_native_1 = require("react-native");
|
|
6
|
-
var formatNb_1 = require("../libs/formatNb");
|
|
7
|
-
var ui_1 = require("../ui");
|
|
8
|
-
function Time(_a) {
|
|
9
|
-
var length = _a.length, onScrollEnd = _a.onScrollEnd, color = _a.color, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 46 : _c, _d = _a.start, start = _d === void 0 ? 0 : _d;
|
|
10
|
-
var flatListRef = (0, react_1.useRef)(null);
|
|
11
|
-
var data = (0, react_1.useMemo)(function () {
|
|
12
|
-
var data = Array.from({ length: length });
|
|
13
|
-
if (start)
|
|
14
|
-
data = data.map(function (_, i) { return i + start; });
|
|
15
|
-
return data;
|
|
16
|
-
}, [start]);
|
|
17
|
-
(0, react_1.useEffect)(function () {
|
|
18
|
-
var _a;
|
|
19
|
-
if (start)
|
|
20
|
-
index = data.findIndex(function (d) { return d === index; });
|
|
21
|
-
(_a = flatListRef.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex({ index: index, animated: true });
|
|
22
|
-
}, [flatListRef.current, data, start, index]);
|
|
23
|
-
var onMomentumScrollEnd = function (event) {
|
|
24
|
-
var _a = event.nativeEvent, contentOffset = _a.contentOffset, layoutMeasurement = _a.layoutMeasurement;
|
|
25
|
-
var value = Math.round(contentOffset.y / layoutMeasurement.height);
|
|
26
|
-
if (start)
|
|
27
|
-
value = Number(data[value]);
|
|
28
|
-
onScrollEnd === null || onScrollEnd === void 0 ? void 0 : onScrollEnd(value);
|
|
29
|
-
};
|
|
30
|
-
var onScrollEndDrag = function (event) {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
var contentOffset = event.nativeEvent.contentOffset;
|
|
33
|
-
var currentIndex = Math.round(contentOffset.y / height);
|
|
34
|
-
if (currentIndex === -1) {
|
|
35
|
-
(_a = flatListRef.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex({
|
|
36
|
-
index: data.length - 1,
|
|
37
|
-
animated: false,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
else if (currentIndex === data.length) {
|
|
41
|
-
(_b = flatListRef.current) === null || _b === void 0 ? void 0 : _b.scrollToIndex({
|
|
42
|
-
index: 0,
|
|
43
|
-
animated: false,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
return (<react_native_1.FlatList pagingEnabled ref={flatListRef} data={data} showsVerticalScrollIndicator={false} onScrollEndDrag={onScrollEndDrag} onMomentumScrollEnd={onMomentumScrollEnd} renderItem={function (_a) {
|
|
48
|
-
var item = _a.item, index = _a.index;
|
|
49
|
-
return (<ui_1.KView height={height} justifyContent="center" alignItems="center">
|
|
50
|
-
<ui_1.KText fontSize={24} fontWeight="bold" color={color}>
|
|
51
|
-
{(0, formatNb_1.default)(item || index)}
|
|
52
|
-
</ui_1.KText>
|
|
53
|
-
</ui_1.KView>);
|
|
54
|
-
}} getItemLayout={function (_, index) { return ({
|
|
55
|
-
length: height,
|
|
56
|
-
offset: height * index,
|
|
57
|
-
index: index,
|
|
58
|
-
}); }}/>);
|
|
59
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
date: Date;
|
|
3
|
-
showDate?: boolean;
|
|
4
|
-
onChangeHours?: (hours: number) => void;
|
|
5
|
-
onChangeMinutes?: (minutes: number) => void;
|
|
6
|
-
color?: string;
|
|
7
|
-
};
|
|
8
|
-
export default function TimeView({ date, onChangeHours, onChangeMinutes, showDate, color, }: Props): any;
|
|
9
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = TimeView;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var format_1 = require("../libs/format");
|
|
6
|
-
var ui_1 = require("../ui");
|
|
7
|
-
var Time_1 = require("./Time");
|
|
8
|
-
function TimeView(_a) {
|
|
9
|
-
var date = _a.date, onChangeHours = _a.onChangeHours, onChangeMinutes = _a.onChangeMinutes, showDate = _a.showDate, color = _a.color;
|
|
10
|
-
return (<ui_1.KView flexDirection="row" height={54} backgroundColor={"".concat(color, "11")} alignItems="center" width={120} alignSelf="center" paddingHorizontal={8} paddingVertical={4}
|
|
11
|
-
// borderWidth={3}
|
|
12
|
-
borderColor={"".concat(color, "11")}>
|
|
13
|
-
{showDate && (<ui_1.KView backgroundColor={color} paddingHorizontal={10} paddingVertical={1} position="absolute" top={-12} left={19} borderWidth={1} borderColor="white">
|
|
14
|
-
<ui_1.KText color="white">{(0, format_1.formatShortDate)(date)}</ui_1.KText>
|
|
15
|
-
</ui_1.KView>)}
|
|
16
|
-
<Time_1.default length={24} index={date.getHours()} onScrollEnd={onChangeHours} color={color}/>
|
|
17
|
-
<ui_1.KText fontSize={18} textAlign="center" fontWeight="bold" color={color}>
|
|
18
|
-
h
|
|
19
|
-
</ui_1.KText>
|
|
20
|
-
<Time_1.default length={60} index={date.getMinutes()} onScrollEnd={onChangeMinutes} color={color}/>
|
|
21
|
-
</ui_1.KView>);
|
|
22
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = useCalendarDisclose;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
function useCalendarDisclose() {
|
|
6
|
-
var _a = (0, react_1.useState)(false), isOpen = _a[0], setIsOpen = _a[1];
|
|
7
|
-
var onToggle = function () { return setIsOpen(function (v) { return !v; }); };
|
|
8
|
-
return { isOpen: isOpen, onToggle: onToggle };
|
|
9
|
-
}
|
package/build/libs/format.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function formatDate(date: Date, locales?: Intl.LocalesArgument, mode?: "date" | "time" | "datetime"): string;
|
|
2
|
-
export declare function formatMonth(date: Date, locales?: Intl.LocalesArgument): string;
|
|
3
|
-
export declare function formatShortDate(date: Date, locales?: Intl.LocalesArgument): string;
|
|
4
|
-
export declare const getWeekDay: (date: Date, locales?: Intl.LocalesArgument) => string;
|
package/build/libs/format.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWeekDay = void 0;
|
|
4
|
-
exports.formatDate = formatDate;
|
|
5
|
-
exports.formatMonth = formatMonth;
|
|
6
|
-
exports.formatShortDate = formatShortDate;
|
|
7
|
-
function formatDate(date, locales, mode) {
|
|
8
|
-
if (locales === void 0) { locales = "fr-FR"; }
|
|
9
|
-
if (mode === void 0) { mode = "date"; }
|
|
10
|
-
switch (mode) {
|
|
11
|
-
case "time":
|
|
12
|
-
return date.toLocaleTimeString(locales, {
|
|
13
|
-
hour: "2-digit",
|
|
14
|
-
minute: "2-digit",
|
|
15
|
-
});
|
|
16
|
-
case "date":
|
|
17
|
-
return date.toLocaleDateString(locales, {
|
|
18
|
-
day: "2-digit",
|
|
19
|
-
month: "2-digit",
|
|
20
|
-
year: "numeric",
|
|
21
|
-
});
|
|
22
|
-
default:
|
|
23
|
-
return date.toLocaleDateString(locales, {
|
|
24
|
-
day: "2-digit",
|
|
25
|
-
month: "2-digit",
|
|
26
|
-
year: "numeric",
|
|
27
|
-
hour: "2-digit",
|
|
28
|
-
minute: "2-digit",
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function formatMonth(date, locales) {
|
|
33
|
-
if (locales === void 0) { locales = "fr-FR"; }
|
|
34
|
-
return date.toLocaleDateString(locales, {
|
|
35
|
-
month: "long",
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function formatShortDate(date, locales) {
|
|
39
|
-
if (locales === void 0) { locales = "fr-FR"; }
|
|
40
|
-
return date.toLocaleDateString(locales, {
|
|
41
|
-
day: "2-digit",
|
|
42
|
-
month: "2-digit",
|
|
43
|
-
year: "2-digit",
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
var getWeekDay = function (date, locales) {
|
|
47
|
-
if (locales === void 0) { locales = "fr-FR"; }
|
|
48
|
-
return date.toLocaleString(locales, { weekday: "short" }).slice(0, 3);
|
|
49
|
-
};
|
|
50
|
-
exports.getWeekDay = getWeekDay;
|
package/build/libs/formatNb.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function formatNb(nb: number): string;
|
package/build/libs/formatNb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function getDayMatrix(value: Date): Date[][];
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = getDayMatrix;
|
|
4
|
-
function getDayMatrix(value) {
|
|
5
|
-
var year = value.getFullYear();
|
|
6
|
-
var month = value.getMonth();
|
|
7
|
-
var offset = new Date(year, month, 1).getDay() - 1;
|
|
8
|
-
var getDate = function (date) { return new Date(year, month, date - offset); };
|
|
9
|
-
return [
|
|
10
|
-
[
|
|
11
|
-
getDate(1),
|
|
12
|
-
getDate(8),
|
|
13
|
-
getDate(15),
|
|
14
|
-
getDate(22),
|
|
15
|
-
getDate(29),
|
|
16
|
-
getDate(36),
|
|
17
|
-
getDate(43),
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
getDate(2),
|
|
21
|
-
getDate(9),
|
|
22
|
-
getDate(16),
|
|
23
|
-
getDate(23),
|
|
24
|
-
getDate(30),
|
|
25
|
-
getDate(37),
|
|
26
|
-
getDate(44),
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
getDate(3),
|
|
30
|
-
getDate(10),
|
|
31
|
-
getDate(17),
|
|
32
|
-
getDate(24),
|
|
33
|
-
getDate(31),
|
|
34
|
-
getDate(38),
|
|
35
|
-
getDate(45),
|
|
36
|
-
],
|
|
37
|
-
[
|
|
38
|
-
getDate(4),
|
|
39
|
-
getDate(11),
|
|
40
|
-
getDate(18),
|
|
41
|
-
getDate(25),
|
|
42
|
-
getDate(32),
|
|
43
|
-
getDate(39),
|
|
44
|
-
getDate(46),
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
getDate(5),
|
|
48
|
-
getDate(12),
|
|
49
|
-
getDate(19),
|
|
50
|
-
getDate(26),
|
|
51
|
-
getDate(33),
|
|
52
|
-
getDate(40),
|
|
53
|
-
getDate(47),
|
|
54
|
-
],
|
|
55
|
-
[
|
|
56
|
-
getDate(6),
|
|
57
|
-
getDate(13),
|
|
58
|
-
getDate(20),
|
|
59
|
-
getDate(27),
|
|
60
|
-
getDate(34),
|
|
61
|
-
getDate(41),
|
|
62
|
-
getDate(48),
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
getDate(0),
|
|
66
|
-
getDate(7),
|
|
67
|
-
getDate(14),
|
|
68
|
-
getDate(21),
|
|
69
|
-
getDate(28),
|
|
70
|
-
getDate(35),
|
|
71
|
-
getDate(42),
|
|
72
|
-
],
|
|
73
|
-
];
|
|
74
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare const getStatus: ({ date, shortDate, selectedDate }: ArgType) => {
|
|
2
|
-
isToday: boolean;
|
|
3
|
-
isStartBorn: boolean;
|
|
4
|
-
isEndBorn: boolean;
|
|
5
|
-
isSelected: boolean;
|
|
6
|
-
isForCurrentMonth: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type DateValueType = Date | {
|
|
9
|
-
start: Date;
|
|
10
|
-
end?: Date;
|
|
11
|
-
};
|
|
12
|
-
export default getStatus;
|
|
13
|
-
type ArgType = {
|
|
14
|
-
date: Date;
|
|
15
|
-
shortDate: Date;
|
|
16
|
-
selectedDate?: DateValueType;
|
|
17
|
-
};
|
package/build/libs/getStatus.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var isToday_1 = require("./isToday");
|
|
4
|
-
var resetTime_1 = require("./resetTime");
|
|
5
|
-
var getStatus = function (_a) {
|
|
6
|
-
var date = _a.date, shortDate = _a.shortDate, selectedDate = _a.selectedDate;
|
|
7
|
-
var status = {
|
|
8
|
-
isToday: (0, isToday_1.default)(date),
|
|
9
|
-
isStartBorn: false,
|
|
10
|
-
isEndBorn: false,
|
|
11
|
-
isSelected: false,
|
|
12
|
-
isForCurrentMonth: date.getMonth() === shortDate.getMonth(),
|
|
13
|
-
};
|
|
14
|
-
if (selectedDate instanceof Date) {
|
|
15
|
-
var valueDate = (0, resetTime_1.default)(selectedDate);
|
|
16
|
-
status.isSelected = date.getTime() === valueDate.getTime();
|
|
17
|
-
}
|
|
18
|
-
else if (selectedDate instanceof Object) {
|
|
19
|
-
var start = (0, resetTime_1.default)(selectedDate.start);
|
|
20
|
-
status.isStartBorn = start.getTime() === date.getTime();
|
|
21
|
-
if (selectedDate.end) {
|
|
22
|
-
var end = (0, resetTime_1.default)(selectedDate.end);
|
|
23
|
-
status.isSelected = start <= date && date <= end;
|
|
24
|
-
if (status.isSelected)
|
|
25
|
-
status.isEndBorn = date.getTime() === end.getTime();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
status.isSelected = status.isStartBorn;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return status;
|
|
32
|
-
};
|
|
33
|
-
exports.default = getStatus;
|
package/build/libs/getStyle.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TextStyle, ViewStyle } from "react-native";
|
|
2
|
-
import { DateValueType } from "./getStatus";
|
|
3
|
-
declare const getStyle: ({ date, shortDate, selectedDate, color, active, }: ArgType) => {
|
|
4
|
-
touchableOpacity: ViewStyle;
|
|
5
|
-
text: TextStyle;
|
|
6
|
-
};
|
|
7
|
-
export default getStyle;
|
|
8
|
-
type ArgType = {
|
|
9
|
-
date: Date;
|
|
10
|
-
shortDate: Date;
|
|
11
|
-
active?: boolean;
|
|
12
|
-
selectedDate?: DateValueType;
|
|
13
|
-
color?: string;
|
|
14
|
-
};
|
package/build/libs/getStyle.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var getStatus_1 = require("./getStatus");
|
|
4
|
-
var getStyle = function (_a) {
|
|
5
|
-
var date = _a.date, shortDate = _a.shortDate, selectedDate = _a.selectedDate, color = _a.color, active = _a.active;
|
|
6
|
-
var status = (0, getStatus_1.default)({ date: date, shortDate: shortDate, selectedDate: selectedDate });
|
|
7
|
-
var style = { touchableOpacity: {}, text: {} };
|
|
8
|
-
style.text.color = color;
|
|
9
|
-
if (!status.isForCurrentMonth)
|
|
10
|
-
style.text.color = "".concat(color, "55");
|
|
11
|
-
if (!active)
|
|
12
|
-
style.text.color = "".concat(color, "22");
|
|
13
|
-
if (status.isToday) {
|
|
14
|
-
style.touchableOpacity.backgroundColor = color;
|
|
15
|
-
style.text.color = "white";
|
|
16
|
-
style.text.fontWeight = "bold";
|
|
17
|
-
}
|
|
18
|
-
if (status.isSelected) {
|
|
19
|
-
style.touchableOpacity.backgroundColor = "".concat(color, "22");
|
|
20
|
-
style.text.fontWeight = "bold";
|
|
21
|
-
}
|
|
22
|
-
if (status.isStartBorn) {
|
|
23
|
-
style.touchableOpacity.borderTopLeftRadius = 10;
|
|
24
|
-
style.touchableOpacity.borderBottomLeftRadius = 10;
|
|
25
|
-
}
|
|
26
|
-
if (status.isEndBorn) {
|
|
27
|
-
style.touchableOpacity.borderTopRightRadius = 10;
|
|
28
|
-
style.touchableOpacity.borderBottomRightRadius = 10;
|
|
29
|
-
}
|
|
30
|
-
return style;
|
|
31
|
-
};
|
|
32
|
-
exports.default = getStyle;
|
package/build/libs/isActive.d.ts
DELETED
package/build/libs/isActive.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = isActive;
|
|
4
|
-
function isActive(_a) {
|
|
5
|
-
var min = _a.min, max = _a.max, date = _a.date, disableDate = _a.disableDate;
|
|
6
|
-
if (!date)
|
|
7
|
-
return false;
|
|
8
|
-
if (min && max)
|
|
9
|
-
return date.getTime() >= min.getTime() && date.getTime() <= max.getTime();
|
|
10
|
-
if (min)
|
|
11
|
-
return date.getTime() >= min.getTime();
|
|
12
|
-
if (max)
|
|
13
|
-
return date.getTime() <= max.getTime();
|
|
14
|
-
if (disableDate)
|
|
15
|
-
return !disableDate(date);
|
|
16
|
-
return true;
|
|
17
|
-
}
|
package/build/libs/isToday.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function isToday(date: Date): boolean;
|
package/build/libs/isToday.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = isToday;
|
|
4
|
-
function isToday(date) {
|
|
5
|
-
var today = new Date();
|
|
6
|
-
return (today.getDate() === date.getDate() &&
|
|
7
|
-
today.getMonth() === date.getMonth() &&
|
|
8
|
-
today.getFullYear() === date.getFullYear());
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function resetTime(date: Date): Date;
|
package/build/libs/resetTime.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function toHexColor(color?: string): string;
|
package/build/libs/toHexColor.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toHexColor = toHexColor;
|
|
4
|
-
var react_native_1 = require("react-native");
|
|
5
|
-
function toHexColor(color) {
|
|
6
|
-
if (!color)
|
|
7
|
-
return "#000000";
|
|
8
|
-
var processed = (0, react_native_1.processColor)(color);
|
|
9
|
-
if (!processed)
|
|
10
|
-
return "#000000";
|
|
11
|
-
var hex = processed.toString(16).padStart(8, "0");
|
|
12
|
-
return "#".concat(hex.slice(2));
|
|
13
|
-
}
|
package/build/ui/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { TextProps, TextStyle, TouchableOpacityProps, ViewProps, ViewStyle } from "react-native";
|
|
3
|
-
type KViewProps = ViewStyle & PropsWithChildren & {
|
|
4
|
-
nativeProps?: ViewProps;
|
|
5
|
-
};
|
|
6
|
-
export declare function KView({ nativeProps, children, ...style }: KViewProps): import("react").JSX.Element;
|
|
7
|
-
type KTouchableOpacityProps = ViewStyle & PropsWithChildren & {
|
|
8
|
-
nativeProps?: TouchableOpacityProps;
|
|
9
|
-
};
|
|
10
|
-
export declare function KTouchableOpacity({ nativeProps, children, ...style }: KTouchableOpacityProps): import("react").JSX.Element;
|
|
11
|
-
type KTextProps = TextStyle & PropsWithChildren & {
|
|
12
|
-
nativeProps?: TextProps;
|
|
13
|
-
};
|
|
14
|
-
export declare function KText({ nativeProps, children, ...style }: KTextProps): import("react").JSX.Element;
|
|
15
|
-
export {};
|
package/build/ui/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.KView = KView;
|
|
15
|
-
exports.KTouchableOpacity = KTouchableOpacity;
|
|
16
|
-
exports.KText = KText;
|
|
17
|
-
var react_native_1 = require("react-native");
|
|
18
|
-
function KView(_a) {
|
|
19
|
-
var nativeProps = _a.nativeProps, children = _a.children, style = __rest(_a, ["nativeProps", "children"]);
|
|
20
|
-
return (<react_native_1.View style={style} {...nativeProps}>
|
|
21
|
-
{children}
|
|
22
|
-
</react_native_1.View>);
|
|
23
|
-
}
|
|
24
|
-
function KTouchableOpacity(_a) {
|
|
25
|
-
var nativeProps = _a.nativeProps, children = _a.children, style = __rest(_a, ["nativeProps", "children"]);
|
|
26
|
-
return (<react_native_1.TouchableOpacity style={style} {...nativeProps}>
|
|
27
|
-
{children}
|
|
28
|
-
</react_native_1.TouchableOpacity>);
|
|
29
|
-
}
|
|
30
|
-
function KText(_a) {
|
|
31
|
-
var nativeProps = _a.nativeProps, children = _a.children, style = __rest(_a, ["nativeProps", "children"]);
|
|
32
|
-
return (<react_native_1.Text style={style} {...nativeProps}>
|
|
33
|
-
{children}
|
|
34
|
-
</react_native_1.Text>);
|
|
35
|
-
}
|
|
File without changes
|