@react-fabric/date 1.0.0-beta.31 → 1.0.0-beta.33
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/README.md +2 -9
- package/dist/cjs/hijri/DateConverter.js +154 -0
- package/dist/cjs/hijri/FormatDate.js +115 -0
- package/dist/cjs/hijri/HijriDate.js +531 -0
- package/dist/cjs/hijri/StringDateParser.js +74 -0
- package/dist/cjs/hijri/index.js +17 -1025
- package/dist/cjs/hijri/initializer.js +113 -0
- package/dist/cjs/hijri/locales.js +19 -0
- package/dist/cjs/hijri/safe.js +17 -0
- package/dist/cjs/i18n/index.js +0 -6
- package/dist/cjs/index.js +11 -2
- package/dist/cjs/{superdate → panels}/EventPanel.js +1 -1
- package/dist/esm/hijri/DateConverter.js +152 -0
- package/dist/esm/hijri/FormatDate.js +112 -0
- package/dist/esm/hijri/HijriDate.js +528 -0
- package/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/esm/hijri/index.js +17 -1025
- package/dist/esm/hijri/initializer.js +113 -0
- package/dist/esm/hijri/locales.js +18 -0
- package/dist/esm/hijri/safe.js +14 -0
- package/dist/esm/i18n/index.js +0 -6
- package/dist/esm/index.js +5 -1
- package/dist/esm/{superdate → panels}/EventPanel.js +1 -1
- package/dist/types/hijri/DateConverter.d.ts +13 -0
- package/dist/types/hijri/FormatDate.d.ts +19 -0
- package/dist/types/hijri/HijriDate.d.ts +214 -0
- package/dist/types/hijri/StringDateParser.d.ts +11 -0
- package/dist/types/hijri/index.d.ts +2 -2
- package/dist/types/hijri/initializer.d.ts +129 -0
- package/dist/types/hijri/locales.d.ts +19 -0
- package/dist/types/hijri/safe.d.ts +3 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/panels/EventPanel.d.ts +17 -0
- package/dist/types/types/index.d.ts +8 -40
- package/package.json +4 -6
- package/src/hijri/DateConverter.js +175 -0
- package/src/hijri/FormatDate.js +132 -0
- package/src/hijri/HijriDate.js +477 -0
- package/src/hijri/StringDateParser.js +68 -0
- package/src/hijri/index.js +16 -1535
- package/src/hijri/initializer.js +96 -0
- package/src/hijri/locales.js +109 -0
- package/src/hijri/safe.js +16 -0
- package/src/i18n/index.ts +0 -3
- package/src/index.ts +6 -1
- package/src/{superdate → panels}/EventPanel.tsx +20 -3
- package/src/types/index.ts +8 -43
- package/src/utils/dateUtil.ts +0 -1
- package/dist/cjs/i18n/superdate/ar.json.js +0 -86
- package/dist/cjs/i18n/superdate/en.json.js +0 -93
- package/dist/cjs/superdate/QuickSelect.js +0 -134
- package/dist/cjs/superdate/RelativeInput.js +0 -79
- package/dist/cjs/superdate/RelativePanel.js +0 -91
- package/dist/cjs/superdate/SuperDate.module.css +0 -1
- package/dist/cjs/superdate/Superdate.js +0 -177
- package/dist/esm/i18n/superdate/ar.json.js +0 -79
- package/dist/esm/i18n/superdate/en.json.js +0 -85
- package/dist/esm/superdate/QuickSelect.js +0 -134
- package/dist/esm/superdate/RelativeInput.js +0 -79
- package/dist/esm/superdate/RelativePanel.js +0 -91
- package/dist/esm/superdate/SuperDate.module.css +0 -1
- package/dist/esm/superdate/Superdate.js +0 -176
- package/dist/types/superdate/EventPanel.d.ts +0 -4
- package/dist/types/superdate/QuickSelect.d.ts +0 -1
- package/dist/types/superdate/RelativeInput.d.ts +0 -1
- package/dist/types/superdate/RelativePanel.d.ts +0 -1
- package/dist/types/superdate/Superdate.d.ts +0 -17
- package/src/i18n/superdate/ar.json +0 -70
- package/src/i18n/superdate/en.json +0 -75
- package/src/superdate/QuickSelect.tsx +0 -121
- package/src/superdate/RelativeInput.tsx +0 -64
- package/src/superdate/RelativePanel.tsx +0 -103
- package/src/superdate/SuperDate.module.css +0 -30
- package/src/superdate/Superdate.tsx +0 -198
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GregToHijri
|
|
3
|
+
} from './DateConverter';
|
|
4
|
+
import StringDateParser from './StringDateParser';
|
|
5
|
+
|
|
6
|
+
const defaultFormat = 'yyyy/mm/dd';
|
|
7
|
+
const defaultProps ={
|
|
8
|
+
month:1,
|
|
9
|
+
date:1,
|
|
10
|
+
hours:0,
|
|
11
|
+
minutes:0,
|
|
12
|
+
seconds:0,
|
|
13
|
+
milliseconds:0
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class Initializer {
|
|
17
|
+
|
|
18
|
+
static initDefault() {
|
|
19
|
+
return GregToHijri(new Date());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static init_number (number) {
|
|
23
|
+
return GregToHijri(new Date(number));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static init_number_number (year, month) {
|
|
27
|
+
|
|
28
|
+
return this.init_number_number_number(year, month, 1);
|
|
29
|
+
}
|
|
30
|
+
static init_number_number_number () {
|
|
31
|
+
return this.initFromNumbers(...arguments);
|
|
32
|
+
}
|
|
33
|
+
static init_number_number_number_number () {
|
|
34
|
+
return this.initFromNumbers(...arguments);
|
|
35
|
+
}
|
|
36
|
+
static init_number_number_number_number_number () {
|
|
37
|
+
return this.initFromNumbers(...arguments);
|
|
38
|
+
}
|
|
39
|
+
static init_number_number_number_number_number_number () {
|
|
40
|
+
return this.initFromNumbers(...arguments);
|
|
41
|
+
}
|
|
42
|
+
static init_number_number_number_number_number_number_number () {
|
|
43
|
+
return this.initFromNumbers(...arguments);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static init_string() {
|
|
47
|
+
return this.initFromStrings(...arguments);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static init_string_string() {
|
|
51
|
+
return this.initFromStrings(...arguments);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static init_object(object) {
|
|
55
|
+
return Object.assign({}, defaultProps, object);
|
|
56
|
+
}
|
|
57
|
+
static initFromNumbers(year,
|
|
58
|
+
month,
|
|
59
|
+
date,
|
|
60
|
+
hours = 0,
|
|
61
|
+
minutes = 0,
|
|
62
|
+
seconds = 0,
|
|
63
|
+
milliseconds = 0)
|
|
64
|
+
{
|
|
65
|
+
Array.from(arguments).forEach((arg, index) => {
|
|
66
|
+
arguments[index] = parseInt(arg);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
year,
|
|
71
|
+
month,
|
|
72
|
+
date,
|
|
73
|
+
hours,
|
|
74
|
+
minutes,
|
|
75
|
+
seconds,
|
|
76
|
+
milliseconds
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
//TODO
|
|
82
|
+
static initFromStrings(dateString, format = defaultFormat) {
|
|
83
|
+
const props = {};
|
|
84
|
+
props.year= StringDateParser.extractYear(dateString, format);
|
|
85
|
+
props.month= StringDateParser.extractMonth(dateString, format);
|
|
86
|
+
props.date= StringDateParser.extractDate(dateString, format);
|
|
87
|
+
return Object.assign({}, defaultProps, props);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Initializer.defaultFormat = defaultFormat;
|
|
95
|
+
|
|
96
|
+
export default Initializer;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export const ar = {
|
|
2
|
+
dayNames: [
|
|
3
|
+
"ح",
|
|
4
|
+
"ن",
|
|
5
|
+
"ث",
|
|
6
|
+
"ر",
|
|
7
|
+
"خ",
|
|
8
|
+
"ج",
|
|
9
|
+
"س",
|
|
10
|
+
"أحد",
|
|
11
|
+
"اثن",
|
|
12
|
+
"ثلا",
|
|
13
|
+
"ارب",
|
|
14
|
+
"خم",
|
|
15
|
+
"جم",
|
|
16
|
+
"سبت",
|
|
17
|
+
"الأحد",
|
|
18
|
+
"الإثنين",
|
|
19
|
+
"الثلاثاء",
|
|
20
|
+
"الإربعاء",
|
|
21
|
+
"الخميس",
|
|
22
|
+
"الجمعة",
|
|
23
|
+
"السبت",
|
|
24
|
+
],
|
|
25
|
+
monthNames: [
|
|
26
|
+
"مح",
|
|
27
|
+
"صف",
|
|
28
|
+
"ربع١",
|
|
29
|
+
"ربع٢",
|
|
30
|
+
"جم١",
|
|
31
|
+
"جم٢",
|
|
32
|
+
"رجب",
|
|
33
|
+
"شعب",
|
|
34
|
+
"رمض",
|
|
35
|
+
"شو",
|
|
36
|
+
"ذو ق",
|
|
37
|
+
"ذو ح",
|
|
38
|
+
"محرّم",
|
|
39
|
+
"صفر",
|
|
40
|
+
"ربيع أول",
|
|
41
|
+
"ربيع الآخر",
|
|
42
|
+
"جمادى أولى",
|
|
43
|
+
"جمادى الآخرة",
|
|
44
|
+
"رجب",
|
|
45
|
+
"شعبان",
|
|
46
|
+
"رمضان",
|
|
47
|
+
"شوال",
|
|
48
|
+
"ذو القعدة",
|
|
49
|
+
"ذو الحجّة",
|
|
50
|
+
],
|
|
51
|
+
separator: "عند",
|
|
52
|
+
am: "ص",
|
|
53
|
+
pm: "م",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const en = {
|
|
57
|
+
dayNames: [
|
|
58
|
+
"Su",
|
|
59
|
+
"Mo",
|
|
60
|
+
"Tu",
|
|
61
|
+
"We",
|
|
62
|
+
"Th",
|
|
63
|
+
"Fr",
|
|
64
|
+
"Sa",
|
|
65
|
+
"Sun",
|
|
66
|
+
"Mon",
|
|
67
|
+
"Tue",
|
|
68
|
+
"Wed",
|
|
69
|
+
"Thu",
|
|
70
|
+
"Fri",
|
|
71
|
+
"Sat",
|
|
72
|
+
"Sunday",
|
|
73
|
+
"Monday",
|
|
74
|
+
"Tuesday",
|
|
75
|
+
"Wednesday",
|
|
76
|
+
"Thursday",
|
|
77
|
+
"Friday",
|
|
78
|
+
"Saturday",
|
|
79
|
+
],
|
|
80
|
+
monthNames: [
|
|
81
|
+
"Muha",
|
|
82
|
+
"Saf",
|
|
83
|
+
"Rab1",
|
|
84
|
+
"Rab2",
|
|
85
|
+
"Jumd1",
|
|
86
|
+
"Jumd2",
|
|
87
|
+
"Rajb",
|
|
88
|
+
"Shbn",
|
|
89
|
+
"Rmdn",
|
|
90
|
+
"Shwl",
|
|
91
|
+
"Qada",
|
|
92
|
+
"Hija",
|
|
93
|
+
"Muharram",
|
|
94
|
+
"Safar",
|
|
95
|
+
"Rabi'ul Awwal",
|
|
96
|
+
"Rabi'ul Akhir",
|
|
97
|
+
"Jumadal Ula",
|
|
98
|
+
"Jumadal Akhira",
|
|
99
|
+
"Rajab",
|
|
100
|
+
"Sha'ban",
|
|
101
|
+
"Ramadan",
|
|
102
|
+
"Shawwal",
|
|
103
|
+
"Dhul Qa'ada",
|
|
104
|
+
"Dhul Hijja",
|
|
105
|
+
],
|
|
106
|
+
separator: "at",
|
|
107
|
+
am: "am",
|
|
108
|
+
pm: "pm",
|
|
109
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import HijriDate from './HijriDate';
|
|
2
|
+
import {GregToHijri} from './DateConverter';
|
|
3
|
+
|
|
4
|
+
export const toHijri = ((gregDate) => {
|
|
5
|
+
const {year, month, date} = GregToHijri(gregDate);
|
|
6
|
+
return new HijriDate(
|
|
7
|
+
year,
|
|
8
|
+
month,
|
|
9
|
+
date,
|
|
10
|
+
gregDate.getHours(),
|
|
11
|
+
gregDate.getMinutes(),
|
|
12
|
+
gregDate.getSeconds(),
|
|
13
|
+
gregDate.getMilliseconds()
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
export default HijriDate;
|
package/src/i18n/index.ts
CHANGED
|
@@ -24,8 +24,5 @@
|
|
|
24
24
|
import { addTranslationBundle } from "@react-fabric/core";
|
|
25
25
|
import ar from "./ar.json";
|
|
26
26
|
import en from "./en.json";
|
|
27
|
-
import arSuper from "./superdate/ar.json";
|
|
28
|
-
import enSuper from "./superdate/en.json";
|
|
29
27
|
|
|
30
28
|
addTranslationBundle("date", { en, ar });
|
|
31
|
-
addTranslationBundle("superdate", { en: enSuper, ar: arSuper });
|
package/src/index.ts
CHANGED
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
import "./hijri";
|
|
25
25
|
import "./i18n";
|
|
26
26
|
|
|
27
|
+
export { DateHeader } from "./components/DateHeader";
|
|
28
|
+
export { DecadePage } from "./components/DecadePage";
|
|
29
|
+
export { YearPage } from "./components/YearPage";
|
|
27
30
|
export { DateDisplay } from "./display/DateDisplay";
|
|
28
31
|
export { DatePanel } from "./panels/DatePanel";
|
|
32
|
+
export { EventPanel } from "./panels/EventPanel";
|
|
29
33
|
export { RangePanel } from "./panels/RangePanel";
|
|
30
|
-
export { SuperDate } from "./superdate/Superdate";
|
|
31
34
|
|
|
32
35
|
export { DateUtil } from "./utils/dateUtil";
|
|
36
|
+
|
|
37
|
+
export * from "./types";
|
|
@@ -30,7 +30,7 @@ import { useTranslation } from "react-i18next";
|
|
|
30
30
|
import { DateHeader } from "../components/DateHeader";
|
|
31
31
|
import { DecadePage } from "../components/DecadePage";
|
|
32
32
|
import { YearPage } from "../components/YearPage";
|
|
33
|
-
import { type EventType, PageType
|
|
33
|
+
import { type EventType, PageType } from "../types";
|
|
34
34
|
import { DateUtil } from "../utils/dateUtil";
|
|
35
35
|
|
|
36
36
|
interface EventState {
|
|
@@ -90,12 +90,29 @@ const makeList = (
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
+
export interface EventProps {
|
|
94
|
+
isHijri?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* list of calendar events
|
|
97
|
+
*/
|
|
98
|
+
events?: EventType[];
|
|
99
|
+
/**
|
|
100
|
+
* list of calendar events
|
|
101
|
+
*/
|
|
102
|
+
recurringEvents?: EventType[];
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* change handler
|
|
106
|
+
*/
|
|
107
|
+
onChange?: (value: string, dates: [string, string]) => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
export const EventPanel = ({
|
|
94
111
|
isHijri,
|
|
95
112
|
onChange,
|
|
96
113
|
events = EMPTY_ARRAY,
|
|
97
114
|
recurringEvents = EMPTY_ARRAY,
|
|
98
|
-
}:
|
|
115
|
+
}: EventProps) => {
|
|
99
116
|
const { t } = useTranslation();
|
|
100
117
|
const [predefined, setPredefined] = useState<
|
|
101
118
|
KeyValue<Array<EventType<Date>>>
|
|
@@ -114,7 +131,7 @@ export const EventPanel = ({
|
|
|
114
131
|
if (action.type === "changePageDate") {
|
|
115
132
|
resetList = true;
|
|
116
133
|
state.pageDate = action.date;
|
|
117
|
-
if (action.changePage
|
|
134
|
+
if (action.changePage) {
|
|
118
135
|
state.page = Math.max(state.page - 1, PageType.MONTH);
|
|
119
136
|
}
|
|
120
137
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
|
-
type ColorType,
|
|
26
25
|
type CssProp,
|
|
27
26
|
type TestProps,
|
|
28
27
|
} from "@react-fabric/core/dist/types/types";
|
|
@@ -63,6 +62,14 @@ format?:
|
|
|
63
62
|
| string;
|
|
64
63
|
*/
|
|
65
64
|
|
|
65
|
+
export interface EventType<D = DateLike> {
|
|
66
|
+
label: string;
|
|
67
|
+
icon?: string;
|
|
68
|
+
start: D;
|
|
69
|
+
end: D;
|
|
70
|
+
hijri?: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
66
73
|
export interface BaseProps {
|
|
67
74
|
min?: DateLike;
|
|
68
75
|
max?: DateLike;
|
|
@@ -82,45 +89,3 @@ export interface RangeProps extends BaseProps, CssProp, TestProps {
|
|
|
82
89
|
onChange?: (dates: [start: string, end: string]) => void;
|
|
83
90
|
presets?: Record<string, [DateLike, DateLike]>;
|
|
84
91
|
}
|
|
85
|
-
|
|
86
|
-
export interface EventType<D = DateLike> {
|
|
87
|
-
label: string;
|
|
88
|
-
icon?: string;
|
|
89
|
-
start: D;
|
|
90
|
-
end: D;
|
|
91
|
-
hijri?: boolean;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface PresetType {
|
|
95
|
-
value: string;
|
|
96
|
-
label: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface SuperDateProps extends TestProps {
|
|
100
|
-
as?: "button" | "chip";
|
|
101
|
-
color?: ColorType;
|
|
102
|
-
variant?: "solid" | "outline" | "link";
|
|
103
|
-
disabled?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* relative date value
|
|
106
|
-
*/
|
|
107
|
-
value?: string;
|
|
108
|
-
/**
|
|
109
|
-
* change handler
|
|
110
|
-
*/
|
|
111
|
-
onChange?: (value: string, dates: [string, string]) => void;
|
|
112
|
-
/**
|
|
113
|
-
* list of calendar events
|
|
114
|
-
*/
|
|
115
|
-
events?: EventType[];
|
|
116
|
-
/**
|
|
117
|
-
* list of calendar events
|
|
118
|
-
*/
|
|
119
|
-
recurringEvents?: EventType[];
|
|
120
|
-
/**
|
|
121
|
-
* list of relative presets
|
|
122
|
-
*
|
|
123
|
-
* {value:'$year-5|$year', label:'last 5 years'}
|
|
124
|
-
*/
|
|
125
|
-
presets?: PresetType[];
|
|
126
|
-
}
|
package/src/utils/dateUtil.ts
CHANGED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var separator = " ⇽ ";
|
|
6
|
-
var label = {
|
|
7
|
-
quick: "حدد مسرعا",
|
|
8
|
-
relative: "نسبيا",
|
|
9
|
-
events: "الأحداث",
|
|
10
|
-
absolute: "مطلق",
|
|
11
|
-
preset: "المسبقة",
|
|
12
|
-
current: "تيار",
|
|
13
|
-
previous: "السابق",
|
|
14
|
-
from: "من عند",
|
|
15
|
-
to: "إلى",
|
|
16
|
-
"+": "من الان",
|
|
17
|
-
"-": "منذ",
|
|
18
|
-
apply: "يتقدم",
|
|
19
|
-
$now: "الآن",
|
|
20
|
-
$minute: "دقيقة",
|
|
21
|
-
$hour: "ساعة",
|
|
22
|
-
$day: "يوم",
|
|
23
|
-
$week: "أسبوع",
|
|
24
|
-
$month: "شهر",
|
|
25
|
-
$quarter: "ربع",
|
|
26
|
-
$year: "عام",
|
|
27
|
-
$decade: "عقد"
|
|
28
|
-
};
|
|
29
|
-
var now = {
|
|
30
|
-
$day: "اليوم",
|
|
31
|
-
$week: "هذا الاسبوع",
|
|
32
|
-
$month: "هذا الشهر",
|
|
33
|
-
$quarter: "هذا الربع",
|
|
34
|
-
$year: "هذه السنة",
|
|
35
|
-
$decade: "هذا العقد"
|
|
36
|
-
};
|
|
37
|
-
var next = {
|
|
38
|
-
$day: "غدا",
|
|
39
|
-
$week: "الاسبوع القادم",
|
|
40
|
-
$month: "الشهر القادم",
|
|
41
|
-
$quarter: "الربع القادم",
|
|
42
|
-
$year: "العام القادم",
|
|
43
|
-
$decade: "العقد القادم",
|
|
44
|
-
$minute: "بعد دقيقة",
|
|
45
|
-
$hour: "بعد ساعة",
|
|
46
|
-
$minute_plural: "بعد {{count}} دقائق",
|
|
47
|
-
$hour_plural: "بعد {{count}} ساعات",
|
|
48
|
-
$day_plural: "بعد {{count}} أيام",
|
|
49
|
-
$week_plural: "بعد {{count}} أسابيع",
|
|
50
|
-
$month_plural: "بعد {{count}} أشهر",
|
|
51
|
-
$quarter_plural: "بعد {{count}} أرباع",
|
|
52
|
-
$year_plural: "بعد {{count}} سنوات",
|
|
53
|
-
$decade_plural: "بعد {{count}} عقود"
|
|
54
|
-
};
|
|
55
|
-
var prev = {
|
|
56
|
-
$day: "في الامس",
|
|
57
|
-
$week: "الاسبوع الماضي",
|
|
58
|
-
$month: "الشهر الماضي",
|
|
59
|
-
$quarter: "الربع الأخير",
|
|
60
|
-
$year: "العام الماضي",
|
|
61
|
-
$decade: "العقد الماضي",
|
|
62
|
-
$minute: "منذ دقيقة",
|
|
63
|
-
$hour: "منذ ساعة",
|
|
64
|
-
$minute_plural: "منذ {{count}} دقيقة",
|
|
65
|
-
$hour_plural: "منذ {{count}} ساعات",
|
|
66
|
-
$day_plural: "منذ {{count}} أيام",
|
|
67
|
-
$week_plural: "من {{count}} اسابيع",
|
|
68
|
-
$month_plural: "قبل {{count}} أشهر",
|
|
69
|
-
$quarter_plural: "منذ {{count}} أرباع",
|
|
70
|
-
$year_plural: "منذ {{count}} سنوات",
|
|
71
|
-
$decade_plural: "منذ {{count}} عقود"
|
|
72
|
-
};
|
|
73
|
-
var arSuper = {
|
|
74
|
-
separator: separator,
|
|
75
|
-
label: label,
|
|
76
|
-
now: now,
|
|
77
|
-
next: next,
|
|
78
|
-
prev: prev
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
exports.default = arSuper;
|
|
82
|
-
exports.label = label;
|
|
83
|
-
exports.next = next;
|
|
84
|
-
exports.now = now;
|
|
85
|
-
exports.prev = prev;
|
|
86
|
-
exports.separator = separator;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var separator = " ⇾ ";
|
|
6
|
-
var event = {
|
|
7
|
-
ramadan: "Ramadan",
|
|
8
|
-
christmas: "Christmas",
|
|
9
|
-
newYear: "New Year"
|
|
10
|
-
};
|
|
11
|
-
var label = {
|
|
12
|
-
quick: "Quick Select",
|
|
13
|
-
relative: "Relative",
|
|
14
|
-
absolute: "Absolute",
|
|
15
|
-
events: "Events",
|
|
16
|
-
preset: "Presets",
|
|
17
|
-
current: "Current",
|
|
18
|
-
previous: "Previous",
|
|
19
|
-
from: "From",
|
|
20
|
-
to: "To",
|
|
21
|
-
"+": "From now",
|
|
22
|
-
"-": "Ago",
|
|
23
|
-
apply: "Apply",
|
|
24
|
-
$now: "Now",
|
|
25
|
-
$minute: "Minute",
|
|
26
|
-
$hour: "Hour",
|
|
27
|
-
$day: "Day",
|
|
28
|
-
$week: "Week",
|
|
29
|
-
$month: "Month",
|
|
30
|
-
$quarter: "Quarter",
|
|
31
|
-
$year: "Year",
|
|
32
|
-
$decade: "Decade"
|
|
33
|
-
};
|
|
34
|
-
var now = {
|
|
35
|
-
$day: "Today",
|
|
36
|
-
$week: "This week",
|
|
37
|
-
$month: "This month",
|
|
38
|
-
$quarter: "This quarter",
|
|
39
|
-
$year: "This year",
|
|
40
|
-
$decade: "This decade"
|
|
41
|
-
};
|
|
42
|
-
var next = {
|
|
43
|
-
$day: "Tomorrow",
|
|
44
|
-
$week: "Next week",
|
|
45
|
-
$month: "Next month",
|
|
46
|
-
$quarter: "Next quarter",
|
|
47
|
-
$year: "Next year",
|
|
48
|
-
$decade: "Next decade",
|
|
49
|
-
$minute: "A minute later",
|
|
50
|
-
$hour: "An hour later",
|
|
51
|
-
$minute_other: "{{count}} minutes later",
|
|
52
|
-
$hour_other: "{{count}} hours later",
|
|
53
|
-
$day_other: "{{count}} days later",
|
|
54
|
-
$week_other: "{{count}} weeks later",
|
|
55
|
-
$month_other: "{{count}} months later",
|
|
56
|
-
$quarter_other: "{{count}} quarters later",
|
|
57
|
-
$year_other: "{{count}} years later",
|
|
58
|
-
$decade_other: "{{count}} decades later"
|
|
59
|
-
};
|
|
60
|
-
var prev = {
|
|
61
|
-
$day: "Yesterday",
|
|
62
|
-
$week: "Last week",
|
|
63
|
-
$month: "Last month",
|
|
64
|
-
$quarter: "Last quarter",
|
|
65
|
-
$year: "Last year",
|
|
66
|
-
$decade: "Last decade",
|
|
67
|
-
$minute: "A minute ago",
|
|
68
|
-
$hour: "An hour ago",
|
|
69
|
-
$minute_other: "{{count}} minutes ago",
|
|
70
|
-
$hour_other: "{{count}} hours ago",
|
|
71
|
-
$day_other: "{{count}} days ago",
|
|
72
|
-
$week_other: "{{count}} weeks ago",
|
|
73
|
-
$month_other: "{{count}} months ago",
|
|
74
|
-
$quarter_other: "{{count}} quarters ago",
|
|
75
|
-
$year_other: "{{count}} years ago",
|
|
76
|
-
$decade_other: "{{count}} decades ago"
|
|
77
|
-
};
|
|
78
|
-
var enSuper = {
|
|
79
|
-
separator: separator,
|
|
80
|
-
event: event,
|
|
81
|
-
label: label,
|
|
82
|
-
now: now,
|
|
83
|
-
next: next,
|
|
84
|
-
prev: prev
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.default = enSuper;
|
|
88
|
-
exports.event = event;
|
|
89
|
-
exports.label = label;
|
|
90
|
-
exports.next = next;
|
|
91
|
-
exports.now = now;
|
|
92
|
-
exports.prev = prev;
|
|
93
|
-
exports.separator = separator;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
-
var core = require('@react-fabric/core');
|
|
5
|
-
var form = require('@react-fabric/form');
|
|
6
|
-
var utilities = require('@react-fabric/utilities');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
var reactI18next = require('react-i18next');
|
|
9
|
-
var index = require('../types/index.js');
|
|
10
|
-
var RelativeInput = require('./RelativeInput.js');
|
|
11
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
-
|
|
13
|
-
var DEFAULT_PRESETS = [{
|
|
14
|
-
value: "$day",
|
|
15
|
-
label: "superdate:now.$day"
|
|
16
|
-
}, {
|
|
17
|
-
value: "$day-1",
|
|
18
|
-
label: "superdate:prev.$day"
|
|
19
|
-
}, {
|
|
20
|
-
value: "$day+1",
|
|
21
|
-
label: "superdate:next.$day"
|
|
22
|
-
}, {
|
|
23
|
-
value: "$week",
|
|
24
|
-
label: "superdate:now.$week"
|
|
25
|
-
}, {
|
|
26
|
-
value: "$week-1",
|
|
27
|
-
label: "superdate:prev.$week"
|
|
28
|
-
}, {
|
|
29
|
-
value: "$week+1",
|
|
30
|
-
label: "superdate:next.$week"
|
|
31
|
-
}, {
|
|
32
|
-
value: "$month",
|
|
33
|
-
label: "superdate:now.$month"
|
|
34
|
-
}, {
|
|
35
|
-
value: "$month-1",
|
|
36
|
-
label: "superdate:prev.$month"
|
|
37
|
-
}, {
|
|
38
|
-
value: "$month+1",
|
|
39
|
-
label: "superdate:next.$month"
|
|
40
|
-
}, {
|
|
41
|
-
value: "$quarter",
|
|
42
|
-
label: "superdate:now.$quarter"
|
|
43
|
-
}, {
|
|
44
|
-
value: "$quarter-1",
|
|
45
|
-
label: "superdate:prev.$quarter"
|
|
46
|
-
}, {
|
|
47
|
-
value: "$quarter+1",
|
|
48
|
-
label: "superdate:next.$quarter"
|
|
49
|
-
}, {
|
|
50
|
-
value: "$year",
|
|
51
|
-
label: "superdate:now.$year"
|
|
52
|
-
}, {
|
|
53
|
-
value: "$year-1",
|
|
54
|
-
label: "superdate:prev.$year"
|
|
55
|
-
}, {
|
|
56
|
-
value: "$year+1",
|
|
57
|
-
label: "superdate:next.$year"
|
|
58
|
-
}];
|
|
59
|
-
var schema = utilities.yup.object({
|
|
60
|
-
rel: utilities.yup.object({
|
|
61
|
-
diff: utilities.yup.number().required().label("Difference"),
|
|
62
|
-
op: utilities.yup.string().required().oneOf(["+", "-"]).label("Operator"),
|
|
63
|
-
part: utilities.yup.string().required().oneOf(Object.values(index.DatePart)).label("Date part")
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
var QuickSelect = function QuickSelect(_ref) {
|
|
67
|
-
var _ref$presets = _ref.presets,
|
|
68
|
-
presets = _ref$presets === void 0 ? DEFAULT_PRESETS : _ref$presets,
|
|
69
|
-
_ref$value = _ref.value,
|
|
70
|
-
value = _ref$value === void 0 ? "" : _ref$value,
|
|
71
|
-
onChange = _ref.onChange;
|
|
72
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
73
|
-
t = _useTranslation.t;
|
|
74
|
-
var handleChange = react.useCallback(function (_ref2) {
|
|
75
|
-
var _ref2$rel = _ref2.rel,
|
|
76
|
-
part = _ref2$rel.part,
|
|
77
|
-
diff = _ref2$rel.diff,
|
|
78
|
-
op = _ref2$rel.op;
|
|
79
|
-
onChange("".concat(part).concat(op).concat(diff, "|").concat(index.DatePart.NOW));
|
|
80
|
-
}, []);
|
|
81
|
-
var defaultValue = react.useMemo(function () {
|
|
82
|
-
if (value !== null && value !== void 0 && value.endsWith(index.DatePart.NOW)) {
|
|
83
|
-
var _value$split$shift$ma;
|
|
84
|
-
var _ref3 = (_value$split$shift$ma = value.split("|").shift().match(/^(\$\w+)([+-])(\d+)?$/)) !== null && _value$split$shift$ma !== void 0 ? _value$split$shift$ma : [],
|
|
85
|
-
_ref4 = _slicedToArray(_ref3, 4),
|
|
86
|
-
part = _ref4[1],
|
|
87
|
-
op = _ref4[2],
|
|
88
|
-
_ref4$ = _ref4[3],
|
|
89
|
-
diff = _ref4$ === void 0 ? "0" : _ref4$;
|
|
90
|
-
return {
|
|
91
|
-
rel: {
|
|
92
|
-
part: part,
|
|
93
|
-
op: op,
|
|
94
|
-
diff: diff
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}, [value]);
|
|
99
|
-
return /*#__PURE__*/jsxRuntime.jsxs(core.Content, {
|
|
100
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
101
|
-
className: "inline-block origin-left rtl:origin-right",
|
|
102
|
-
style: {
|
|
103
|
-
zoom: 0.85
|
|
104
|
-
},
|
|
105
|
-
children: /*#__PURE__*/jsxRuntime.jsx(form.Form, {
|
|
106
|
-
schema: schema,
|
|
107
|
-
onSubmit: handleChange,
|
|
108
|
-
defaultValues: defaultValue,
|
|
109
|
-
children: /*#__PURE__*/jsxRuntime.jsx(RelativeInput.RelativeInput, {
|
|
110
|
-
label: t("superdate:label.relative"),
|
|
111
|
-
prefix: "rel",
|
|
112
|
-
showApply: true
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
}), /*#__PURE__*/jsxRuntime.jsx(core.Divider, {
|
|
116
|
-
children: t("superdate:label.preset")
|
|
117
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
118
|
-
className: "grid grid-cols-3 flex-row text-sm gap-2",
|
|
119
|
-
children: presets.map(function (pr) {
|
|
120
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
121
|
-
className: "link appearance-none text-start",
|
|
122
|
-
onClick: function onClick() {
|
|
123
|
-
return onChange === null || onChange === void 0 ? void 0 : onChange(pr.value);
|
|
124
|
-
},
|
|
125
|
-
children: t(pr.label, {
|
|
126
|
-
defaultValue: pr.label
|
|
127
|
-
})
|
|
128
|
-
}, pr.value);
|
|
129
|
-
})
|
|
130
|
-
})]
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
exports.QuickSelect = QuickSelect;
|