datatables.net-datetime 1.6.2 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/dataTables.dateTime.css +1 -1
  2. package/dist/dataTables.dateTime.d.ts +272 -0
  3. package/dist/dataTables.dateTime.js +1540 -1778
  4. package/dist/dataTables.dateTime.min.js +3 -5
  5. package/dist/dataTables.dateTime.min.mjs +3 -5
  6. package/dist/dataTables.dateTime.mjs +1521 -1764
  7. package/dist/interface.d.ts +129 -0
  8. package/dist/interface.js +2 -0
  9. package/dist/types.d.ts +404 -0
  10. package/docs/option/disableDays.xml +1 -1
  11. package/docs/option/firstDay.xml +24 -13
  12. package/examples/index.xml +1 -1
  13. package/examples/initialisation/alwaysVisible.xml +3 -13
  14. package/examples/initialisation/buttons.xml +3 -17
  15. package/examples/initialisation/datetime.xml +3 -13
  16. package/examples/initialisation/dayjs.xml +3 -16
  17. package/examples/initialisation/hidden.xml +3 -11
  18. package/examples/initialisation/i18n.xml +3 -31
  19. package/examples/initialisation/index.xml +1 -1
  20. package/examples/initialisation/luxon.xml +2 -12
  21. package/examples/initialisation/moment.xml +2 -12
  22. package/examples/initialisation/simple.xml +3 -11
  23. package/examples/integration/datatables.xml +2 -42
  24. package/examples/integration/form.xml +2 -34
  25. package/js/{dataTables.dateTime.js → dataTables.dateTime.ts} +845 -682
  26. package/js/interface.ts +172 -0
  27. package/make.sh +17 -5
  28. package/nuget.nuspec +2 -2
  29. package/package.json +4 -1
  30. package/rollup.config.mjs +19 -0
  31. package/test/options/dateTime.disableDays.js +2 -0
  32. package/test/options/dateTime.firstDay.js +2 -0
  33. package/test/options/dateTime.i18n.weekdays.js +2 -0
  34. package/tsconfig.json +20 -0
  35. package/datatables.net-datetime.1.6.1.nupkg +0 -0
  36. package/js/dataTables.dateTime.d.ts +0 -67
@@ -319,4 +319,4 @@ html.dark.inline,
319
319
  :root[data-bs-theme=dark].inline {
320
320
  box-shadow: none;
321
321
  border: none;
322
- }
322
+ }
@@ -0,0 +1,272 @@
1
+ /*! DateTime for DataTables.net
2
+ * Copyright (c) SpryMedia Ltd - datatables.net/license
3
+ */
4
+ import './interface';
5
+ import { Defaults } from './interface';
6
+ export declare class DateTime {
7
+ /**
8
+ * Use a specific compatible date library
9
+ */
10
+ static use(lib: any): void;
11
+ /**
12
+ * For generating unique namespaces
13
+ */
14
+ private static _instance;
15
+ /**
16
+ * To indicate to DataTables what type of library this is
17
+ */
18
+ static type: string;
19
+ /**
20
+ * Defaults for the date time picker
21
+ */
22
+ static defaults: Defaults;
23
+ static version: string;
24
+ /**
25
+ * Destroy the control
26
+ */
27
+ destroy(): void;
28
+ display(year: any, month: any): this | {
29
+ month: number;
30
+ year: number;
31
+ };
32
+ errorMsg(msg: any): this;
33
+ hide(): this;
34
+ max(date: any): this;
35
+ min(date: any): this;
36
+ /**
37
+ * Check if an element belongs to this control
38
+ *
39
+ * @param {node} node Element to check
40
+ * @return {boolean} true if owned by this control, false otherwise
41
+ */
42
+ owns(node: any): boolean;
43
+ /**
44
+ * Get the value
45
+ */
46
+ val(): Date;
47
+ /**
48
+ * Set the value
49
+ *
50
+ * @param set Value to set
51
+ * @param write Flag to indicate if the formatted value
52
+ * should be written into the input element
53
+ */
54
+ val(set: string | Date, write?: boolean): any;
55
+ /**
56
+ * Similar to `val()` but uses a given date / time format
57
+ *
58
+ * @param format Format to get the data as (getter) or that is input
59
+ * (setter)
60
+ * @param val Value to write (if undefined, used as a getter)
61
+ * @returns
62
+ */
63
+ valFormat(format: any, val: any): any;
64
+ private dom;
65
+ private c;
66
+ private s;
67
+ constructor(input: any, opts: any);
68
+ /**
69
+ * Build the control and assign initial event handlers
70
+ */
71
+ private _init;
72
+ /**
73
+ * Compare the date part only of two dates - this is made super easy by the
74
+ * toDateString method!
75
+ *
76
+ * @param a Date 1
77
+ * @param b Date 2
78
+ */
79
+ private _compareDates;
80
+ /**
81
+ * Convert from one format to another
82
+ *
83
+ * @param val Value
84
+ * @param from Format to convert from. If null a `Date` must be given
85
+ * @param to Format to convert to. If null a `Date` will be returned
86
+ * @returns Converted value
87
+ */
88
+ private _convert;
89
+ /**
90
+ * When changing month, take account of the fact that some months don't have
91
+ * the same number of days. For example going from January to February you
92
+ * can have the 31st of Jan selected and just add a month since the date
93
+ * would still be 31, and thus drop you into March.
94
+ *
95
+ * @param date Date - will be modified
96
+ * @param month Month to set
97
+ */
98
+ private _correctMonth;
99
+ /**
100
+ * Get the number of days in a method. Based on
101
+ * http://stackoverflow.com/a/4881951 by Matti Virkkunen
102
+ *
103
+ * @param year Year
104
+ * @param month Month (starting at 0)
105
+ */
106
+ private _daysInMonth;
107
+ /**
108
+ * Create a new date object which has the UTC values set to the local time.
109
+ * This allows the local time to be used directly for the library which
110
+ * always bases its calculations and display on UTC.
111
+ *
112
+ * @param s Date to "convert"
113
+ * @return Shifted date
114
+ */
115
+ private _dateToUtc;
116
+ /**
117
+ * Create a UTC ISO8601 date part from a date object
118
+ *
119
+ * @param d Date to "convert"
120
+ * @return ISO formatted date
121
+ */
122
+ private _dateToUtcString;
123
+ /**
124
+ * Hide the control and remove events related to its display
125
+ *
126
+ * @param destroy Flag to indicate that the instance is being destroyed
127
+ */
128
+ private _hide;
129
+ /**
130
+ * Convert a 24 hour value to a 12 hour value
131
+ *
132
+ * @param val 24 hour value
133
+ * @return 12 hour value
134
+ */
135
+ private _hours24To12;
136
+ /**
137
+ * Generate the HTML for a single day in the calendar - this is basically
138
+ * and HTML cell with a button that has data attributes so we know what was
139
+ * clicked on (if it is clicked on) and a bunch of classes for styling.
140
+ *
141
+ * @param {object} day Day object from the `_htmlMonth` method
142
+ * @return {string} HTML cell
143
+ */
144
+ private _htmlDay;
145
+ /**
146
+ * Create the HTML for a month to be displayed in the calendar table.
147
+ *
148
+ * Based upon the logic used in Pikaday - MIT licensed
149
+ * Copyright (c) 2014 David Bushell
150
+ * https://github.com/dbushell/Pikaday
151
+ *
152
+ * @param year Year
153
+ * @param month Month (starting at 0)
154
+ * @return Calendar month HTML
155
+ */
156
+ private _htmlMonth;
157
+ /**
158
+ * Create the calendar table's header (week days)
159
+ *
160
+ * @return {string} HTML cells for the row
161
+ */
162
+ private _htmlMonthHead;
163
+ /**
164
+ * Create a cell that contains week of the year - ISO8601
165
+ *
166
+ * Based on https://stackoverflow.com/questions/6117814/ and
167
+ * http://techblog.procurios.nl/k/n618/news/view/33796/14863/
168
+ *
169
+ * @param d Day of month
170
+ * @param m Month of year (zero index)
171
+ * @param y Year
172
+ * @return HTML string for a day
173
+ */
174
+ private _htmlWeekOfYear;
175
+ /**
176
+ * Determine if Luxon is being used
177
+ *
178
+ * @returns Flag for Luxon
179
+ */
180
+ private _isLuxon;
181
+ /**
182
+ * Determine if Moment is being used
183
+ *
184
+ * @returns Flag for Moment
185
+ */
186
+ private _isMoment;
187
+ /**
188
+ * Determine the first day of the week based on the current locale
189
+ */
190
+ private _localeFirstDay;
191
+ /**
192
+ * Check if the instance has a date object value - it might be null.
193
+ * If is doesn't set one to now.
194
+ * @returns A Date object
195
+ */
196
+ private _needValue;
197
+ /**
198
+ * Create option elements from a range in an array
199
+ *
200
+ * @param selector Class name unique to the select element to use
201
+ * @param values Array of values
202
+ * @param labels Array of labels. If given must be the same length as the
203
+ * values parameter.
204
+ */
205
+ private _options;
206
+ /**
207
+ * Set an option and update the option's span pair (since the select element
208
+ * has opacity 0 for styling)
209
+ *
210
+ * @param selector Class name unique to the select element to use
211
+ * @param val Value to set
212
+ */
213
+ private _optionSet;
214
+ /**
215
+ * Create time options list.
216
+ *
217
+ * @param unit Time unit - hours, minutes or seconds
218
+ * @param count Count range - 12, 24 or 60
219
+ * @param val Existing value for this unit
220
+ * @param allowed Values allow for selection
221
+ * @param range Override range
222
+ */
223
+ private _optionsTime;
224
+ /**
225
+ * Create the options for the month and year
226
+ */
227
+ private _optionsTitle;
228
+ /**
229
+ * Simple two digit pad
230
+ *
231
+ * @param {integer} i Value that might need padding
232
+ * @return {string|integer} Padded value
233
+ */
234
+ private _pad;
235
+ /**
236
+ * Position the calendar to look attached to the input element
237
+ */
238
+ private _position;
239
+ /**
240
+ * Create a simple array with a range of values
241
+ *
242
+ * @param start Start value (inclusive)
243
+ * @param end End value (inclusive)
244
+ * @param inc Increment value
245
+ * @return Created array
246
+ */
247
+ private _range;
248
+ /**
249
+ * Redraw the calendar based on the display date - this is a destructive
250
+ * operation
251
+ */
252
+ private _setCalander;
253
+ /**
254
+ * Set the month and year for the calendar based on the current display date
255
+ */
256
+ private _setTitle;
257
+ /**
258
+ * Set the time based on the current value of the widget
259
+ */
260
+ private _setTime;
261
+ /**
262
+ * Show the widget and add events to the document required only while it
263
+ * is displayed
264
+ *
265
+ */
266
+ private _show;
267
+ /**
268
+ * Write the formatted string to the input element this control is attached
269
+ * to
270
+ */
271
+ private _writeOutput;
272
+ }