nxt-pick-datetime 12.0.1 → 13.0.0

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 (74) hide show
  1. package/{esm2015/lib/class/date-time-adapter.class.js → esm2020/lib/class/date-time-adapter.class.mjs} +0 -0
  2. package/{esm2015/lib/class/date-time-format.class.js → esm2020/lib/class/date-time-format.class.mjs} +1 -1
  3. package/esm2020/lib/class/date-time.class.mjs +161 -0
  4. package/{esm2015/lib/class/dialog-config.class.js → esm2020/lib/class/dialog-config.class.mjs} +0 -0
  5. package/esm2020/lib/class/dialog-ref.class.mjs +121 -0
  6. package/esm2020/lib/date-time/calendar/calendar.component.mjs +345 -0
  7. package/esm2020/lib/date-time/calendar-body/calendar-body.component.mjs +145 -0
  8. package/esm2020/lib/date-time/calendar-month-view/calendar-month-view.component.mjs +438 -0
  9. package/esm2020/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.mjs +359 -0
  10. package/esm2020/lib/date-time/calendar-year-view/calendar-year-view.component.mjs +369 -0
  11. package/esm2020/lib/date-time/date-time-inline/date-time-inline.component.mjs +264 -0
  12. package/{esm2015/lib/date-time/date-time-picker/date-time-picker.component.js → esm2020/lib/date-time/date-time-picker/date-time-picker.component.mjs} +13 -14
  13. package/{esm2015/lib/date-time/date-time-picker-container/date-time-picker-container.animations.js → esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.animations.mjs} +1 -1
  14. package/{esm2015/lib/date-time/date-time-picker-container/date-time-picker-container.component.js → esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.component.mjs} +6 -14
  15. package/esm2020/lib/date-time/date-time-picker-input.directive.mjs +624 -0
  16. package/{esm2015/lib/date-time/date-time-picker-intl.service.js → esm2020/lib/date-time/date-time-picker-intl.service.mjs} +3 -3
  17. package/{esm2015/lib/date-time/date-time-picker-trigger.directive.js → esm2020/lib/date-time/date-time-picker-trigger.directive.mjs} +3 -3
  18. package/{esm2015/lib/date-time/date-time.module.js → esm2020/lib/date-time/date-time.module.mjs} +4 -4
  19. package/{esm2015/lib/date-time/number-fixed-len.pipe.js → esm2020/lib/date-time/number-fixed-len.pipe.mjs} +3 -3
  20. package/{esm2015/lib/date-time/timer/timer.component.js → esm2020/lib/date-time/timer/timer.component.mjs} +5 -12
  21. package/esm2020/lib/date-time/timer-box/timer-box.component.mjs +88 -0
  22. package/{esm2015/lib/dialog/dialog-container/dialog-container.component.js → esm2020/lib/dialog/dialog-container/dialog-container.component.mjs} +6 -10
  23. package/{esm2015/lib/dialog/dialog.module.js → esm2020/lib/dialog/dialog.module.mjs} +4 -4
  24. package/esm2020/lib/dialog/dialog.service.mjs +240 -0
  25. package/{esm2015/lib/utils/object.js → esm2020/lib/utils/object.mjs} +0 -0
  26. package/{esm2015/moment-adapter/date-time-adapter.class.js → esm2020/moment-adapter/date-time-adapter.class.mjs} +4 -4
  27. package/{esm2015/moment-adapter/date-time-format.class.js → esm2020/moment-adapter/date-time-format.class.mjs} +0 -0
  28. package/{esm2015/moment-adapter/moment-adapter.module.js → esm2020/moment-adapter/moment-adapter.module.mjs} +8 -8
  29. package/{esm2015/moment-adapter/nxt-pick-datetime-moment-adapter.js → esm2020/moment-adapter/nxt-pick-datetime-moment-adapter.mjs} +0 -0
  30. package/{esm2015/moment-adapter/public-api.js → esm2020/moment-adapter/public-api.mjs} +0 -0
  31. package/{esm2015/native-adapter/date-time-adapter.class.js → esm2020/native-adapter/date-time-adapter.class.mjs} +5 -5
  32. package/{esm2015/native-adapter/date-time-format.class.js → esm2020/native-adapter/date-time-format.class.mjs} +0 -0
  33. package/{esm2015/native-adapter/native-adapter.module.js → esm2020/native-adapter/native-adapter.module.mjs} +8 -8
  34. package/{esm2015/native-adapter/nxt-pick-datetime-native-adapter.js → esm2020/native-adapter/nxt-pick-datetime-native-adapter.mjs} +0 -0
  35. package/{esm2015/native-adapter/public-api.js → esm2020/native-adapter/public-api.mjs} +0 -0
  36. package/{esm2015/nxt-pick-datetime.js → esm2020/nxt-pick-datetime.mjs} +0 -0
  37. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  38. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs +269 -0
  39. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs.map +1 -0
  40. package/fesm2015/nxt-pick-datetime-native-adapter.mjs +392 -0
  41. package/fesm2015/nxt-pick-datetime-native-adapter.mjs.map +1 -0
  42. package/fesm2015/nxt-pick-datetime.mjs +4974 -0
  43. package/fesm2015/nxt-pick-datetime.mjs.map +1 -0
  44. package/{fesm2015/nxt-pick-datetime-moment-adapter.js → fesm2020/nxt-pick-datetime-moment-adapter.mjs} +11 -12
  45. package/fesm2020/nxt-pick-datetime-moment-adapter.mjs.map +1 -0
  46. package/{fesm2015/nxt-pick-datetime-native-adapter.js → fesm2020/nxt-pick-datetime-native-adapter.mjs} +12 -13
  47. package/fesm2020/nxt-pick-datetime-native-adapter.mjs.map +1 -0
  48. package/{fesm2015/nxt-pick-datetime.js → fesm2020/nxt-pick-datetime.mjs} +128 -193
  49. package/fesm2020/nxt-pick-datetime.mjs.map +1 -0
  50. package/lib/class/dialog-ref.class.d.ts +2 -0
  51. package/lib/dialog/dialog.service.d.ts +2 -1
  52. package/moment-adapter/package.json +5 -5
  53. package/native-adapter/package.json +5 -5
  54. package/package.json +40 -11
  55. package/bundles/nxt-pick-datetime-moment-adapter.umd.js +0 -629
  56. package/bundles/nxt-pick-datetime-moment-adapter.umd.js.map +0 -1
  57. package/bundles/nxt-pick-datetime-native-adapter.umd.js +0 -750
  58. package/bundles/nxt-pick-datetime-native-adapter.umd.js.map +0 -1
  59. package/bundles/nxt-pick-datetime.umd.js +0 -6150
  60. package/bundles/nxt-pick-datetime.umd.js.map +0 -1
  61. package/esm2015/lib/class/date-time.class.js +0 -163
  62. package/esm2015/lib/class/dialog-ref.class.js +0 -113
  63. package/esm2015/lib/date-time/calendar/calendar.component.js +0 -354
  64. package/esm2015/lib/date-time/calendar-body/calendar-body.component.js +0 -153
  65. package/esm2015/lib/date-time/calendar-month-view/calendar-month-view.component.js +0 -447
  66. package/esm2015/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.js +0 -364
  67. package/esm2015/lib/date-time/calendar-year-view/calendar-year-view.component.js +0 -376
  68. package/esm2015/lib/date-time/date-time-inline/date-time-inline.component.js +0 -269
  69. package/esm2015/lib/date-time/date-time-picker-input.directive.js +0 -626
  70. package/esm2015/lib/date-time/timer-box/timer-box.component.js +0 -95
  71. package/esm2015/lib/dialog/dialog.service.js +0 -238
  72. package/fesm2015/nxt-pick-datetime-moment-adapter.js.map +0 -1
  73. package/fesm2015/nxt-pick-datetime-native-adapter.js.map +0 -1
  74. package/fesm2015/nxt-pick-datetime.js.map +0 -1
@@ -1,750 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/platform'), require('@angular/core'), require('nxt-pick-datetime')) :
3
- typeof define === 'function' && define.amd ? define('nxt-pick-datetime/native-adapter', ['exports', '@angular/cdk/platform', '@angular/core', 'nxt-pick-datetime'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['nxt-pick-datetime'] = global['nxt-pick-datetime'] || {}, global['nxt-pick-datetime']['native-adapter'] = {}), global.ng.cdk.platform, global.ng.core, global['nxt-pick-datetime']));
5
- }(this, (function (exports, i1, i0, nxtPickDatetime) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
29
-
30
- /*! *****************************************************************************
31
- Copyright (c) Microsoft Corporation.
32
-
33
- Permission to use, copy, modify, and/or distribute this software for any
34
- purpose with or without fee is hereby granted.
35
-
36
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
- PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */
44
- /* global Reflect, Promise */
45
- var extendStatics = function (d, b) {
46
- extendStatics = Object.setPrototypeOf ||
47
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48
- function (d, b) { for (var p in b)
49
- if (Object.prototype.hasOwnProperty.call(b, p))
50
- d[p] = b[p]; };
51
- return extendStatics(d, b);
52
- };
53
- function __extends(d, b) {
54
- if (typeof b !== "function" && b !== null)
55
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
56
- extendStatics(d, b);
57
- function __() { this.constructor = d; }
58
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59
- }
60
- var __assign = function () {
61
- __assign = Object.assign || function __assign(t) {
62
- for (var s, i = 1, n = arguments.length; i < n; i++) {
63
- s = arguments[i];
64
- for (var p in s)
65
- if (Object.prototype.hasOwnProperty.call(s, p))
66
- t[p] = s[p];
67
- }
68
- return t;
69
- };
70
- return __assign.apply(this, arguments);
71
- };
72
- function __rest(s, e) {
73
- var t = {};
74
- for (var p in s)
75
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
76
- t[p] = s[p];
77
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
78
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
79
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
80
- t[p[i]] = s[p[i]];
81
- }
82
- return t;
83
- }
84
- function __decorate(decorators, target, key, desc) {
85
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
86
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
87
- r = Reflect.decorate(decorators, target, key, desc);
88
- else
89
- for (var i = decorators.length - 1; i >= 0; i--)
90
- if (d = decorators[i])
91
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
92
- return c > 3 && r && Object.defineProperty(target, key, r), r;
93
- }
94
- function __param(paramIndex, decorator) {
95
- return function (target, key) { decorator(target, key, paramIndex); };
96
- }
97
- function __metadata(metadataKey, metadataValue) {
98
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
99
- return Reflect.metadata(metadataKey, metadataValue);
100
- }
101
- function __awaiter(thisArg, _arguments, P, generator) {
102
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
103
- return new (P || (P = Promise))(function (resolve, reject) {
104
- function fulfilled(value) { try {
105
- step(generator.next(value));
106
- }
107
- catch (e) {
108
- reject(e);
109
- } }
110
- function rejected(value) { try {
111
- step(generator["throw"](value));
112
- }
113
- catch (e) {
114
- reject(e);
115
- } }
116
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
117
- step((generator = generator.apply(thisArg, _arguments || [])).next());
118
- });
119
- }
120
- function __generator(thisArg, body) {
121
- var _ = { label: 0, sent: function () { if (t[0] & 1)
122
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
123
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
124
- function verb(n) { return function (v) { return step([n, v]); }; }
125
- function step(op) {
126
- if (f)
127
- throw new TypeError("Generator is already executing.");
128
- while (_)
129
- try {
130
- 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)
131
- return t;
132
- if (y = 0, t)
133
- op = [op[0] & 2, t.value];
134
- switch (op[0]) {
135
- case 0:
136
- case 1:
137
- t = op;
138
- break;
139
- case 4:
140
- _.label++;
141
- return { value: op[1], done: false };
142
- case 5:
143
- _.label++;
144
- y = op[1];
145
- op = [0];
146
- continue;
147
- case 7:
148
- op = _.ops.pop();
149
- _.trys.pop();
150
- continue;
151
- default:
152
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
153
- _ = 0;
154
- continue;
155
- }
156
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
157
- _.label = op[1];
158
- break;
159
- }
160
- if (op[0] === 6 && _.label < t[1]) {
161
- _.label = t[1];
162
- t = op;
163
- break;
164
- }
165
- if (t && _.label < t[2]) {
166
- _.label = t[2];
167
- _.ops.push(op);
168
- break;
169
- }
170
- if (t[2])
171
- _.ops.pop();
172
- _.trys.pop();
173
- continue;
174
- }
175
- op = body.call(thisArg, _);
176
- }
177
- catch (e) {
178
- op = [6, e];
179
- y = 0;
180
- }
181
- finally {
182
- f = t = 0;
183
- }
184
- if (op[0] & 5)
185
- throw op[1];
186
- return { value: op[0] ? op[1] : void 0, done: true };
187
- }
188
- }
189
- var __createBinding = Object.create ? (function (o, m, k, k2) {
190
- if (k2 === undefined)
191
- k2 = k;
192
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
193
- }) : (function (o, m, k, k2) {
194
- if (k2 === undefined)
195
- k2 = k;
196
- o[k2] = m[k];
197
- });
198
- function __exportStar(m, o) {
199
- for (var p in m)
200
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
201
- __createBinding(o, m, p);
202
- }
203
- function __values(o) {
204
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
205
- if (m)
206
- return m.call(o);
207
- if (o && typeof o.length === "number")
208
- return {
209
- next: function () {
210
- if (o && i >= o.length)
211
- o = void 0;
212
- return { value: o && o[i++], done: !o };
213
- }
214
- };
215
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
216
- }
217
- function __read(o, n) {
218
- var m = typeof Symbol === "function" && o[Symbol.iterator];
219
- if (!m)
220
- return o;
221
- var i = m.call(o), r, ar = [], e;
222
- try {
223
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
224
- ar.push(r.value);
225
- }
226
- catch (error) {
227
- e = { error: error };
228
- }
229
- finally {
230
- try {
231
- if (r && !r.done && (m = i["return"]))
232
- m.call(i);
233
- }
234
- finally {
235
- if (e)
236
- throw e.error;
237
- }
238
- }
239
- return ar;
240
- }
241
- /** @deprecated */
242
- function __spread() {
243
- for (var ar = [], i = 0; i < arguments.length; i++)
244
- ar = ar.concat(__read(arguments[i]));
245
- return ar;
246
- }
247
- /** @deprecated */
248
- function __spreadArrays() {
249
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
250
- s += arguments[i].length;
251
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
252
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
253
- r[k] = a[j];
254
- return r;
255
- }
256
- function __spreadArray(to, from) {
257
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
258
- to[j] = from[i];
259
- return to;
260
- }
261
- function __await(v) {
262
- return this instanceof __await ? (this.v = v, this) : new __await(v);
263
- }
264
- function __asyncGenerator(thisArg, _arguments, generator) {
265
- if (!Symbol.asyncIterator)
266
- throw new TypeError("Symbol.asyncIterator is not defined.");
267
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
268
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
269
- function verb(n) { if (g[n])
270
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
271
- function resume(n, v) { try {
272
- step(g[n](v));
273
- }
274
- catch (e) {
275
- settle(q[0][3], e);
276
- } }
277
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
278
- function fulfill(value) { resume("next", value); }
279
- function reject(value) { resume("throw", value); }
280
- function settle(f, v) { if (f(v), q.shift(), q.length)
281
- resume(q[0][0], q[0][1]); }
282
- }
283
- function __asyncDelegator(o) {
284
- var i, p;
285
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
286
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
287
- }
288
- function __asyncValues(o) {
289
- if (!Symbol.asyncIterator)
290
- throw new TypeError("Symbol.asyncIterator is not defined.");
291
- var m = o[Symbol.asyncIterator], i;
292
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
293
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
294
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
295
- }
296
- function __makeTemplateObject(cooked, raw) {
297
- if (Object.defineProperty) {
298
- Object.defineProperty(cooked, "raw", { value: raw });
299
- }
300
- else {
301
- cooked.raw = raw;
302
- }
303
- return cooked;
304
- }
305
- ;
306
- var __setModuleDefault = Object.create ? (function (o, v) {
307
- Object.defineProperty(o, "default", { enumerable: true, value: v });
308
- }) : function (o, v) {
309
- o["default"] = v;
310
- };
311
- function __importStar(mod) {
312
- if (mod && mod.__esModule)
313
- return mod;
314
- var result = {};
315
- if (mod != null)
316
- for (var k in mod)
317
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
318
- __createBinding(result, mod, k);
319
- __setModuleDefault(result, mod);
320
- return result;
321
- }
322
- function __importDefault(mod) {
323
- return (mod && mod.__esModule) ? mod : { default: mod };
324
- }
325
- function __classPrivateFieldGet(receiver, state, kind, f) {
326
- if (kind === "a" && !f)
327
- throw new TypeError("Private accessor was defined without a getter");
328
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
329
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
330
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
331
- }
332
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
333
- if (kind === "m")
334
- throw new TypeError("Private method is not writable");
335
- if (kind === "a" && !f)
336
- throw new TypeError("Private accessor was defined without a setter");
337
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
338
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
339
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
340
- }
341
-
342
- /** The default month names to use if Intl API is not available. */
343
- var DEFAULT_MONTH_NAMES = {
344
- long: [
345
- 'January',
346
- 'February',
347
- 'March',
348
- 'April',
349
- 'May',
350
- 'June',
351
- 'July',
352
- 'August',
353
- 'September',
354
- 'October',
355
- 'November',
356
- 'December'
357
- ],
358
- short: [
359
- 'Jan',
360
- 'Feb',
361
- 'Mar',
362
- 'Apr',
363
- 'May',
364
- 'Jun',
365
- 'Jul',
366
- 'Aug',
367
- 'Sep',
368
- 'Oct',
369
- 'Nov',
370
- 'Dec'
371
- ],
372
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']
373
- };
374
- /** The default day of the week names to use if Intl API is not available. */
375
- var DEFAULT_DAY_OF_WEEK_NAMES = {
376
- long: [
377
- 'Sunday',
378
- 'Monday',
379
- 'Tuesday',
380
- 'Wednesday',
381
- 'Thursday',
382
- 'Friday',
383
- 'Saturday'
384
- ],
385
- short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
386
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
387
- };
388
- /** The default date names to use if Intl API is not available. */
389
- var DEFAULT_DATE_NAMES = range(31, function (i) { return String(i + 1); });
390
- /** Whether the browser supports the Intl API. */
391
- var SUPPORTS_INTL_API = typeof Intl !== 'undefined';
392
- /**
393
- * Matches strings that have the form of a valid RFC 3339 string
394
- * (https://tools.ietf.org/html/rfc3339). Note that the string may not actually be a valid date
395
- * because the regex will match strings an with out of bounds month, date, etc.
396
- */
397
- var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
398
- /** Creates an array and fills it with values. */
399
- function range(length, valueFunction) {
400
- var valuesArray = Array(length);
401
- for (var i = 0; i < length; i++) {
402
- valuesArray[i] = valueFunction(i);
403
- }
404
- return valuesArray;
405
- }
406
- var NativeDateTimeAdapter = /** @class */ (function (_super) {
407
- __extends(NativeDateTimeAdapter, _super);
408
- function NativeDateTimeAdapter(platform, owlDateTimeLocale) {
409
- var _this = _super.call(this) || this;
410
- _super.prototype.setLocale.call(_this, owlDateTimeLocale);
411
- // IE does its own time zone correction, so we disable this on IE.
412
- _this.useUtcForDisplay = !platform.TRIDENT;
413
- _this._clampDate = platform.TRIDENT || platform.EDGE;
414
- return _this;
415
- }
416
- NativeDateTimeAdapter.prototype.getYear = function (date) {
417
- return date.getFullYear();
418
- };
419
- NativeDateTimeAdapter.prototype.getMonth = function (date) {
420
- return date.getMonth();
421
- };
422
- NativeDateTimeAdapter.prototype.getDay = function (date) {
423
- return date.getDay();
424
- };
425
- NativeDateTimeAdapter.prototype.getDate = function (date) {
426
- return date.getDate();
427
- };
428
- NativeDateTimeAdapter.prototype.getHours = function (date) {
429
- return date.getHours();
430
- };
431
- NativeDateTimeAdapter.prototype.getMinutes = function (date) {
432
- return date.getMinutes();
433
- };
434
- NativeDateTimeAdapter.prototype.getSeconds = function (date) {
435
- return date.getSeconds();
436
- };
437
- NativeDateTimeAdapter.prototype.getTime = function (date) {
438
- return date.getTime();
439
- };
440
- NativeDateTimeAdapter.prototype.getNumDaysInMonth = function (date) {
441
- var lastDateOfMonth = this.createDateWithOverflow(this.getYear(date), this.getMonth(date) + 1, 0);
442
- return this.getDate(lastDateOfMonth);
443
- };
444
- NativeDateTimeAdapter.prototype.differenceInCalendarDays = function (dateLeft, dateRight) {
445
- if (this.isValid(dateLeft) && this.isValid(dateRight)) {
446
- var dateLeftStartOfDay = this.createDate(this.getYear(dateLeft), this.getMonth(dateLeft), this.getDate(dateLeft));
447
- var dateRightStartOfDay = this.createDate(this.getYear(dateRight), this.getMonth(dateRight), this.getDate(dateRight));
448
- var timeStampLeft = this.getTime(dateLeftStartOfDay) -
449
- dateLeftStartOfDay.getTimezoneOffset() *
450
- this.milliseondsInMinute;
451
- var timeStampRight = this.getTime(dateRightStartOfDay) -
452
- dateRightStartOfDay.getTimezoneOffset() *
453
- this.milliseondsInMinute;
454
- return Math.round((timeStampLeft - timeStampRight) / this.millisecondsInDay);
455
- }
456
- else {
457
- return null;
458
- }
459
- };
460
- NativeDateTimeAdapter.prototype.getYearName = function (date) {
461
- if (SUPPORTS_INTL_API) {
462
- var dtf = new Intl.DateTimeFormat(this.locale, {
463
- year: 'numeric',
464
- timeZone: 'utc'
465
- });
466
- return this.stripDirectionalityCharacters(this._format(dtf, date));
467
- }
468
- return String(this.getYear(date));
469
- };
470
- NativeDateTimeAdapter.prototype.getMonthNames = function (style) {
471
- var _this = this;
472
- if (SUPPORTS_INTL_API) {
473
- var dtf_1 = new Intl.DateTimeFormat(this.locale, {
474
- month: style,
475
- timeZone: 'utc'
476
- });
477
- return range(12, function (i) { return _this.stripDirectionalityCharacters(_this._format(dtf_1, new Date(2017, i, 1))); });
478
- }
479
- return DEFAULT_MONTH_NAMES[style];
480
- };
481
- NativeDateTimeAdapter.prototype.getDayOfWeekNames = function (style) {
482
- var _this = this;
483
- if (SUPPORTS_INTL_API) {
484
- var dtf_2 = new Intl.DateTimeFormat(this.locale, {
485
- weekday: style,
486
- timeZone: 'utc'
487
- });
488
- return range(7, function (i) { return _this.stripDirectionalityCharacters(_this._format(dtf_2, new Date(2017, 0, i + 1))); });
489
- }
490
- return DEFAULT_DAY_OF_WEEK_NAMES[style];
491
- };
492
- NativeDateTimeAdapter.prototype.getDateNames = function () {
493
- var _this = this;
494
- if (SUPPORTS_INTL_API) {
495
- var dtf_3 = new Intl.DateTimeFormat(this.locale, {
496
- day: 'numeric',
497
- timeZone: 'utc'
498
- });
499
- return range(31, function (i) { return _this.stripDirectionalityCharacters(_this._format(dtf_3, new Date(2017, 0, i + 1))); });
500
- }
501
- return DEFAULT_DATE_NAMES;
502
- };
503
- NativeDateTimeAdapter.prototype.toIso8601 = function (date) {
504
- return date.toISOString();
505
- };
506
- NativeDateTimeAdapter.prototype.isEqual = function (dateLeft, dateRight) {
507
- if (this.isValid(dateLeft) && this.isValid(dateRight)) {
508
- return dateLeft.getTime() === dateRight.getTime();
509
- }
510
- else {
511
- return false;
512
- }
513
- };
514
- NativeDateTimeAdapter.prototype.isSameDay = function (dateLeft, dateRight) {
515
- if (this.isValid(dateLeft) && this.isValid(dateRight)) {
516
- var dateLeftStartOfDay = this.clone(dateLeft);
517
- var dateRightStartOfDay = this.clone(dateRight);
518
- dateLeftStartOfDay.setHours(0, 0, 0, 0);
519
- dateRightStartOfDay.setHours(0, 0, 0, 0);
520
- return (dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime());
521
- }
522
- else {
523
- return false;
524
- }
525
- };
526
- NativeDateTimeAdapter.prototype.isValid = function (date) {
527
- return date && !isNaN(date.getTime());
528
- };
529
- NativeDateTimeAdapter.prototype.invalid = function () {
530
- return new Date(NaN);
531
- };
532
- NativeDateTimeAdapter.prototype.isDateInstance = function (obj) {
533
- return obj instanceof Date;
534
- };
535
- NativeDateTimeAdapter.prototype.addCalendarYears = function (date, amount) {
536
- return this.addCalendarMonths(date, amount * 12);
537
- };
538
- NativeDateTimeAdapter.prototype.addCalendarMonths = function (date, amount) {
539
- var result = this.clone(date);
540
- amount = Number(amount);
541
- var desiredMonth = result.getMonth() + amount;
542
- var dateWithDesiredMonth = new Date(0);
543
- dateWithDesiredMonth.setFullYear(result.getFullYear(), desiredMonth, 1);
544
- dateWithDesiredMonth.setHours(0, 0, 0, 0);
545
- var daysInMonth = this.getNumDaysInMonth(dateWithDesiredMonth);
546
- // Set the last day of the new month
547
- // if the original date was the last day of the longer month
548
- result.setMonth(desiredMonth, Math.min(daysInMonth, result.getDate()));
549
- return result;
550
- };
551
- NativeDateTimeAdapter.prototype.addCalendarDays = function (date, amount) {
552
- var result = this.clone(date);
553
- amount = Number(amount);
554
- result.setDate(result.getDate() + amount);
555
- return result;
556
- };
557
- NativeDateTimeAdapter.prototype.setHours = function (date, amount) {
558
- var result = this.clone(date);
559
- result.setHours(amount);
560
- return result;
561
- };
562
- NativeDateTimeAdapter.prototype.setMinutes = function (date, amount) {
563
- var result = this.clone(date);
564
- result.setMinutes(amount);
565
- return result;
566
- };
567
- NativeDateTimeAdapter.prototype.setSeconds = function (date, amount) {
568
- var result = this.clone(date);
569
- result.setSeconds(amount);
570
- return result;
571
- };
572
- NativeDateTimeAdapter.prototype.createDate = function (year, month, date, hours, minutes, seconds) {
573
- if (hours === void 0) { hours = 0; }
574
- if (minutes === void 0) { minutes = 0; }
575
- if (seconds === void 0) { seconds = 0; }
576
- if (month < 0 || month > 11) {
577
- throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
578
- }
579
- if (date < 1) {
580
- throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
581
- }
582
- if (hours < 0 || hours > 23) {
583
- throw Error("Invalid hours \"" + hours + "\". Hours has to be between 0 and 23.");
584
- }
585
- if (minutes < 0 || minutes > 59) {
586
- throw Error("Invalid minutes \"" + minutes + "\". Minutes has to between 0 and 59.");
587
- }
588
- if (seconds < 0 || seconds > 59) {
589
- throw Error("Invalid seconds \"" + seconds + "\". Seconds has to be between 0 and 59.");
590
- }
591
- var result = this.createDateWithOverflow(year, month, date, hours, minutes, seconds);
592
- // Check that the date wasn't above the upper bound for the month, causing the month to overflow
593
- // For example, createDate(2017, 1, 31) would try to create a date 2017/02/31 which is invalid
594
- if (result.getMonth() !== month) {
595
- throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
596
- }
597
- return result;
598
- };
599
- NativeDateTimeAdapter.prototype.clone = function (date) {
600
- return this.createDate(this.getYear(date), this.getMonth(date), this.getDate(date), this.getHours(date), this.getMinutes(date), this.getSeconds(date));
601
- };
602
- NativeDateTimeAdapter.prototype.now = function () {
603
- return new Date();
604
- };
605
- NativeDateTimeAdapter.prototype.format = function (date, displayFormat) {
606
- if (!this.isValid(date)) {
607
- throw Error('JSNativeDate: Cannot format invalid date.');
608
- }
609
- if (SUPPORTS_INTL_API) {
610
- if (this._clampDate &&
611
- (date.getFullYear() < 1 || date.getFullYear() > 9999)) {
612
- date = this.clone(date);
613
- date.setFullYear(Math.max(1, Math.min(9999, date.getFullYear())));
614
- }
615
- displayFormat = Object.assign(Object.assign({}, displayFormat), { timeZone: 'utc' });
616
- var dtf = new Intl.DateTimeFormat(this.locale, displayFormat);
617
- return this.stripDirectionalityCharacters(this._format(dtf, date));
618
- }
619
- return this.stripDirectionalityCharacters(date.toDateString());
620
- };
621
- NativeDateTimeAdapter.prototype.parse = function (value, _parseFormat) {
622
- // There is no way using the native JS Date to set the parse format or locale
623
- if (typeof value === 'number') {
624
- return new Date(value);
625
- }
626
- return value ? new Date(Date.parse(value)) : null;
627
- };
628
- /**
629
- * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
630
- * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
631
- * invalid date for all other values.
632
- */
633
- NativeDateTimeAdapter.prototype.deserialize = function (value) {
634
- if (typeof value === 'string') {
635
- if (!value) {
636
- return null;
637
- }
638
- // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the
639
- // string is the right format first.
640
- if (ISO_8601_REGEX.test(value)) {
641
- var date = new Date(value);
642
- if (this.isValid(date)) {
643
- return date;
644
- }
645
- }
646
- }
647
- return _super.prototype.deserialize.call(this, value);
648
- };
649
- /**
650
- * Creates a date but allows the month and date to overflow.
651
- */
652
- NativeDateTimeAdapter.prototype.createDateWithOverflow = function (year, month, date, hours, minutes, seconds) {
653
- if (hours === void 0) { hours = 0; }
654
- if (minutes === void 0) { minutes = 0; }
655
- if (seconds === void 0) { seconds = 0; }
656
- var result = new Date(year, month, date, hours, minutes, seconds);
657
- if (year >= 0 && year < 100) {
658
- result.setFullYear(this.getYear(result) - 1900);
659
- }
660
- return result;
661
- };
662
- /**
663
- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
664
- * other browsers do not. We remove them to make output consistent and because they interfere with
665
- * date parsing.
666
- */
667
- NativeDateTimeAdapter.prototype.stripDirectionalityCharacters = function (str) {
668
- return str.replace(/[\u200e\u200f]/g, '');
669
- };
670
- /**
671
- * When converting Date object to string, javascript built-in functions may return wrong
672
- * results because it applies its internal DST rules. The DST rules around the world change
673
- * very frequently, and the current valid rule is not always valid in previous years though.
674
- * We work around this problem building a new Date object which has its internal UTC
675
- * representation with the local date and time.
676
- */
677
- NativeDateTimeAdapter.prototype._format = function (dtf, date) {
678
- var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
679
- return dtf.format(d);
680
- };
681
- return NativeDateTimeAdapter;
682
- }(nxtPickDatetime.DateTimeAdapter));
683
- NativeDateTimeAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeAdapter, deps: [{ token: i1__namespace.Platform }, { token: nxtPickDatetime.OWL_DATE_TIME_LOCALE, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
684
- NativeDateTimeAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeAdapter });
685
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeAdapter, decorators: [{
686
- type: i0.Injectable
687
- }], ctorParameters: function () {
688
- return [{ type: i1__namespace.Platform }, { type: undefined, decorators: [{
689
- type: i0.Optional
690
- }, {
691
- type: i0.Inject,
692
- args: [nxtPickDatetime.OWL_DATE_TIME_LOCALE]
693
- }] }];
694
- } });
695
-
696
- var OWL_NATIVE_DATE_TIME_FORMATS = {
697
- parseInput: null,
698
- fullPickerInput: { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' },
699
- datePickerInput: { year: 'numeric', month: 'numeric', day: 'numeric' },
700
- timePickerInput: { hour: 'numeric', minute: 'numeric' },
701
- monthYearLabel: { year: 'numeric', month: 'short' },
702
- dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
703
- monthYearA11yLabel: { year: 'numeric', month: 'long' }
704
- };
705
-
706
- var NativeDateTimeModule = /** @class */ (function () {
707
- function NativeDateTimeModule() {
708
- }
709
- return NativeDateTimeModule;
710
- }());
711
- NativeDateTimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
712
- NativeDateTimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeModule, imports: [i1.PlatformModule] });
713
- NativeDateTimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeModule, providers: [
714
- { provide: nxtPickDatetime.DateTimeAdapter, useClass: NativeDateTimeAdapter }
715
- ], imports: [[i1.PlatformModule]] });
716
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: NativeDateTimeModule, decorators: [{
717
- type: i0.NgModule,
718
- args: [{
719
- imports: [i1.PlatformModule],
720
- providers: [
721
- { provide: nxtPickDatetime.DateTimeAdapter, useClass: NativeDateTimeAdapter }
722
- ]
723
- }]
724
- }] });
725
- var OwlNativeDateTimeModule = /** @class */ (function () {
726
- function OwlNativeDateTimeModule() {
727
- }
728
- return OwlNativeDateTimeModule;
729
- }());
730
- OwlNativeDateTimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OwlNativeDateTimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
731
- OwlNativeDateTimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OwlNativeDateTimeModule, imports: [NativeDateTimeModule] });
732
- OwlNativeDateTimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OwlNativeDateTimeModule, providers: [{ provide: nxtPickDatetime.OWL_DATE_TIME_FORMATS, useValue: OWL_NATIVE_DATE_TIME_FORMATS }], imports: [[NativeDateTimeModule]] });
733
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OwlNativeDateTimeModule, decorators: [{
734
- type: i0.NgModule,
735
- args: [{
736
- imports: [NativeDateTimeModule],
737
- providers: [{ provide: nxtPickDatetime.OWL_DATE_TIME_FORMATS, useValue: OWL_NATIVE_DATE_TIME_FORMATS }]
738
- }]
739
- }] });
740
-
741
- /**
742
- * Generated bundle index. Do not edit.
743
- */
744
-
745
- exports.OwlNativeDateTimeModule = OwlNativeDateTimeModule;
746
-
747
- Object.defineProperty(exports, '__esModule', { value: true });
748
-
749
- })));
750
- //# sourceMappingURL=nxt-pick-datetime-native-adapter.umd.js.map