@sd-angular/core 1.3.243 → 1.3.244

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 (98) hide show
  1. package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
  2. package/bundles/sd-angular-core-autocomplete.umd.js +20 -21
  3. package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
  4. package/bundles/sd-angular-core-autocomplete.umd.min.js +1 -15
  5. package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
  6. package/bundles/sd-angular-core-date-full.umd.js +712 -0
  7. package/bundles/sd-angular-core-date-full.umd.js.map +1 -0
  8. package/bundles/sd-angular-core-date-full.umd.min.js +2 -0
  9. package/bundles/sd-angular-core-date-full.umd.min.js.map +1 -0
  10. package/bundles/sd-angular-core-date-time.umd.js +5 -6
  11. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  12. package/bundles/sd-angular-core-date-time.umd.min.js +1 -1
  13. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  14. package/bundles/sd-angular-core-date.umd.js +719 -0
  15. package/bundles/sd-angular-core-date.umd.js.map +1 -0
  16. package/bundles/sd-angular-core-date.umd.min.js +2 -0
  17. package/bundles/sd-angular-core-date.umd.min.js.map +1 -0
  18. package/bundles/sd-angular-core-form.umd.js +10 -4
  19. package/bundles/sd-angular-core-form.umd.js.map +1 -1
  20. package/bundles/sd-angular-core-form.umd.min.js +1 -1
  21. package/bundles/sd-angular-core-form.umd.min.js.map +1 -1
  22. package/bundles/sd-angular-core-input-number.umd.js +7 -10
  23. package/bundles/sd-angular-core-input-number.umd.js.map +1 -1
  24. package/bundles/sd-angular-core-input-number.umd.min.js +2 -2
  25. package/bundles/sd-angular-core-input-number.umd.min.js.map +1 -1
  26. package/bundles/sd-angular-core-month.umd.js +742 -0
  27. package/bundles/sd-angular-core-month.umd.js.map +1 -0
  28. package/bundles/sd-angular-core-month.umd.min.js +2 -0
  29. package/bundles/sd-angular-core-month.umd.min.js.map +1 -0
  30. package/bundles/sd-angular-core.umd.js +4 -4
  31. package/bundles/sd-angular-core.umd.min.js +1 -1
  32. package/bundles/sd-angular-core.umd.min.js.map +1 -1
  33. package/date/index.d.ts +1 -0
  34. package/date/package.json +12 -0
  35. package/date/sd-angular-core-date.d.ts +4 -0
  36. package/date/sd-angular-core-date.metadata.json +1 -0
  37. package/date/src/lib/date.component.d.ts +63 -0
  38. package/date/src/lib/date.module.d.ts +2 -0
  39. package/date/src/public-api.d.ts +2 -0
  40. package/date-full/index.d.ts +1 -0
  41. package/date-full/package.json +12 -0
  42. package/date-full/sd-angular-core-date-full.d.ts +4 -0
  43. package/date-full/sd-angular-core-date-full.metadata.json +1 -0
  44. package/date-full/src/lib/date-full.component.d.ts +64 -0
  45. package/date-full/src/lib/date-full.module.d.ts +2 -0
  46. package/date-full/src/public-api.d.ts +2 -0
  47. package/date-time/sd-angular-core-date-time.metadata.json +1 -1
  48. package/esm2015/autocomplete/src/lib/autocomplete.component.js +2 -2
  49. package/esm2015/autocomplete/src/lib/autocomplete.module.js +8 -10
  50. package/esm2015/date/index.js +2 -0
  51. package/esm2015/date/sd-angular-core-date.js +5 -0
  52. package/esm2015/date/src/lib/date.component.js +310 -0
  53. package/esm2015/date/src/lib/date.module.js +38 -0
  54. package/esm2015/date/src/public-api.js +3 -0
  55. package/esm2015/date-full/index.js +2 -0
  56. package/esm2015/date-full/sd-angular-core-date-full.js +5 -0
  57. package/esm2015/date-full/src/lib/date-full.component.js +303 -0
  58. package/esm2015/date-full/src/lib/date-full.module.js +40 -0
  59. package/esm2015/date-full/src/public-api.js +3 -0
  60. package/esm2015/date-time/src/lib/date-time.component.js +2 -2
  61. package/esm2015/date-time/src/lib/date-time.module.js +10 -12
  62. package/esm2015/form/src/lib/form.module.js +21 -12
  63. package/esm2015/input-number/src/lib/input-number.component.js +2 -2
  64. package/esm2015/input-number/src/lib/input-number.module.js +3 -7
  65. package/esm2015/month/index.js +2 -0
  66. package/esm2015/month/sd-angular-core-month.js +5 -0
  67. package/esm2015/month/src/lib/month.component.js +334 -0
  68. package/esm2015/month/src/lib/month.module.js +40 -0
  69. package/esm2015/month/src/public-api.js +3 -0
  70. package/esm2015/public-api.js +4 -1
  71. package/fesm2015/sd-angular-core-autocomplete.js +8 -10
  72. package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
  73. package/fesm2015/sd-angular-core-date-full.js +344 -0
  74. package/fesm2015/sd-angular-core-date-full.js.map +1 -0
  75. package/fesm2015/sd-angular-core-date-time.js +12 -14
  76. package/fesm2015/sd-angular-core-date-time.js.map +1 -1
  77. package/fesm2015/sd-angular-core-date.js +349 -0
  78. package/fesm2015/sd-angular-core-date.js.map +1 -0
  79. package/fesm2015/sd-angular-core-form.js +19 -10
  80. package/fesm2015/sd-angular-core-form.js.map +1 -1
  81. package/fesm2015/sd-angular-core-input-number.js +3 -7
  82. package/fesm2015/sd-angular-core-input-number.js.map +1 -1
  83. package/fesm2015/sd-angular-core-month.js +374 -0
  84. package/fesm2015/sd-angular-core-month.js.map +1 -0
  85. package/fesm2015/sd-angular-core.js +3 -0
  86. package/fesm2015/sd-angular-core.js.map +1 -1
  87. package/form/sd-angular-core-form.metadata.json +1 -1
  88. package/input-number/sd-angular-core-input-number.metadata.json +1 -1
  89. package/month/index.d.ts +1 -0
  90. package/month/package.json +12 -0
  91. package/month/sd-angular-core-month.d.ts +4 -0
  92. package/month/sd-angular-core-month.metadata.json +1 -0
  93. package/month/src/lib/month.component.d.ts +66 -0
  94. package/month/src/lib/month.module.d.ts +2 -0
  95. package/month/src/public-api.d.ts +2 -0
  96. package/package.json +1 -1
  97. package/public-api.d.ts +3 -0
  98. package/{sd-angular-core-1.3.243.tgz → sd-angular-core-1.3.244.tgz} +0 -0
@@ -0,0 +1,719 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@sd-angular/core/button'), require('@sd-angular/core/common'), require('@sd-angular/core/translate'), require('@angular/material/core'), require('moment'), require('ngx-device-detector'), require('object-hash'), require('rxjs'), require('uuid')) :
3
+ typeof define === 'function' && define.amd ? define('@sd-angular/core/date', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@sd-angular/core/button', '@sd-angular/core/common', '@sd-angular/core/translate', '@angular/material/core', 'moment', 'ngx-device-detector', 'object-hash', 'rxjs', 'uuid'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core.date = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global['sd-angular'].core.button, global['sd-angular'].core.common, global['sd-angular'].core.translate, global.ng.material.core, global.moment, global['ngx-device-detector'], global.hash, global.rxjs, global.uuid));
5
+ }(this, (function (exports, common$1, core, forms, datepicker, formField, icon, input, button, common, translate, core$1, moment, ngxDeviceDetector, hash, rxjs, uuid) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
10
+ var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
11
+
12
+ /*! *****************************************************************************
13
+ Copyright (c) Microsoft Corporation.
14
+
15
+ Permission to use, copy, modify, and/or distribute this software for any
16
+ purpose with or without fee is hereby granted.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
+ PERFORMANCE OF THIS SOFTWARE.
25
+ ***************************************************************************** */
26
+ /* global Reflect, Promise */
27
+ var extendStatics = function (d, b) {
28
+ extendStatics = Object.setPrototypeOf ||
29
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
+ function (d, b) { for (var p in b)
31
+ if (Object.prototype.hasOwnProperty.call(b, p))
32
+ d[p] = b[p]; };
33
+ return extendStatics(d, b);
34
+ };
35
+ function __extends(d, b) {
36
+ if (typeof b !== "function" && b !== null)
37
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
38
+ extendStatics(d, b);
39
+ function __() { this.constructor = d; }
40
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41
+ }
42
+ var __assign = function () {
43
+ __assign = Object.assign || function __assign(t) {
44
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
45
+ s = arguments[i];
46
+ for (var p in s)
47
+ if (Object.prototype.hasOwnProperty.call(s, p))
48
+ t[p] = s[p];
49
+ }
50
+ return t;
51
+ };
52
+ return __assign.apply(this, arguments);
53
+ };
54
+ function __rest(s, e) {
55
+ var t = {};
56
+ for (var p in s)
57
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
58
+ t[p] = s[p];
59
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
60
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
62
+ t[p[i]] = s[p[i]];
63
+ }
64
+ return t;
65
+ }
66
+ function __decorate(decorators, target, key, desc) {
67
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
68
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
69
+ r = Reflect.decorate(decorators, target, key, desc);
70
+ else
71
+ for (var i = decorators.length - 1; i >= 0; i--)
72
+ if (d = decorators[i])
73
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
74
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
75
+ }
76
+ function __param(paramIndex, decorator) {
77
+ return function (target, key) { decorator(target, key, paramIndex); };
78
+ }
79
+ function __metadata(metadataKey, metadataValue) {
80
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
81
+ return Reflect.metadata(metadataKey, metadataValue);
82
+ }
83
+ function __awaiter(thisArg, _arguments, P, generator) {
84
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
85
+ return new (P || (P = Promise))(function (resolve, reject) {
86
+ function fulfilled(value) { try {
87
+ step(generator.next(value));
88
+ }
89
+ catch (e) {
90
+ reject(e);
91
+ } }
92
+ function rejected(value) { try {
93
+ step(generator["throw"](value));
94
+ }
95
+ catch (e) {
96
+ reject(e);
97
+ } }
98
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
99
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
100
+ });
101
+ }
102
+ function __generator(thisArg, body) {
103
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
104
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
105
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
106
+ function verb(n) { return function (v) { return step([n, v]); }; }
107
+ function step(op) {
108
+ if (f)
109
+ throw new TypeError("Generator is already executing.");
110
+ while (_)
111
+ try {
112
+ 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)
113
+ return t;
114
+ if (y = 0, t)
115
+ op = [op[0] & 2, t.value];
116
+ switch (op[0]) {
117
+ case 0:
118
+ case 1:
119
+ t = op;
120
+ break;
121
+ case 4:
122
+ _.label++;
123
+ return { value: op[1], done: false };
124
+ case 5:
125
+ _.label++;
126
+ y = op[1];
127
+ op = [0];
128
+ continue;
129
+ case 7:
130
+ op = _.ops.pop();
131
+ _.trys.pop();
132
+ continue;
133
+ default:
134
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
135
+ _ = 0;
136
+ continue;
137
+ }
138
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
139
+ _.label = op[1];
140
+ break;
141
+ }
142
+ if (op[0] === 6 && _.label < t[1]) {
143
+ _.label = t[1];
144
+ t = op;
145
+ break;
146
+ }
147
+ if (t && _.label < t[2]) {
148
+ _.label = t[2];
149
+ _.ops.push(op);
150
+ break;
151
+ }
152
+ if (t[2])
153
+ _.ops.pop();
154
+ _.trys.pop();
155
+ continue;
156
+ }
157
+ op = body.call(thisArg, _);
158
+ }
159
+ catch (e) {
160
+ op = [6, e];
161
+ y = 0;
162
+ }
163
+ finally {
164
+ f = t = 0;
165
+ }
166
+ if (op[0] & 5)
167
+ throw op[1];
168
+ return { value: op[0] ? op[1] : void 0, done: true };
169
+ }
170
+ }
171
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
172
+ if (k2 === undefined)
173
+ k2 = k;
174
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
175
+ }) : (function (o, m, k, k2) {
176
+ if (k2 === undefined)
177
+ k2 = k;
178
+ o[k2] = m[k];
179
+ });
180
+ function __exportStar(m, o) {
181
+ for (var p in m)
182
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
183
+ __createBinding(o, m, p);
184
+ }
185
+ function __values(o) {
186
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
187
+ if (m)
188
+ return m.call(o);
189
+ if (o && typeof o.length === "number")
190
+ return {
191
+ next: function () {
192
+ if (o && i >= o.length)
193
+ o = void 0;
194
+ return { value: o && o[i++], done: !o };
195
+ }
196
+ };
197
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
198
+ }
199
+ function __read(o, n) {
200
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
201
+ if (!m)
202
+ return o;
203
+ var i = m.call(o), r, ar = [], e;
204
+ try {
205
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
206
+ ar.push(r.value);
207
+ }
208
+ catch (error) {
209
+ e = { error: error };
210
+ }
211
+ finally {
212
+ try {
213
+ if (r && !r.done && (m = i["return"]))
214
+ m.call(i);
215
+ }
216
+ finally {
217
+ if (e)
218
+ throw e.error;
219
+ }
220
+ }
221
+ return ar;
222
+ }
223
+ /** @deprecated */
224
+ function __spread() {
225
+ for (var ar = [], i = 0; i < arguments.length; i++)
226
+ ar = ar.concat(__read(arguments[i]));
227
+ return ar;
228
+ }
229
+ /** @deprecated */
230
+ function __spreadArrays() {
231
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
232
+ s += arguments[i].length;
233
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
234
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
235
+ r[k] = a[j];
236
+ return r;
237
+ }
238
+ function __spreadArray(to, from, pack) {
239
+ if (pack || arguments.length === 2)
240
+ for (var i = 0, l = from.length, ar; i < l; i++) {
241
+ if (ar || !(i in from)) {
242
+ if (!ar)
243
+ ar = Array.prototype.slice.call(from, 0, i);
244
+ ar[i] = from[i];
245
+ }
246
+ }
247
+ return to.concat(ar || Array.prototype.slice.call(from));
248
+ }
249
+ function __await(v) {
250
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
251
+ }
252
+ function __asyncGenerator(thisArg, _arguments, generator) {
253
+ if (!Symbol.asyncIterator)
254
+ throw new TypeError("Symbol.asyncIterator is not defined.");
255
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
256
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
257
+ function verb(n) { if (g[n])
258
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
259
+ function resume(n, v) { try {
260
+ step(g[n](v));
261
+ }
262
+ catch (e) {
263
+ settle(q[0][3], e);
264
+ } }
265
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
266
+ function fulfill(value) { resume("next", value); }
267
+ function reject(value) { resume("throw", value); }
268
+ function settle(f, v) { if (f(v), q.shift(), q.length)
269
+ resume(q[0][0], q[0][1]); }
270
+ }
271
+ function __asyncDelegator(o) {
272
+ var i, p;
273
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
274
+ 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; }
275
+ }
276
+ function __asyncValues(o) {
277
+ if (!Symbol.asyncIterator)
278
+ throw new TypeError("Symbol.asyncIterator is not defined.");
279
+ var m = o[Symbol.asyncIterator], i;
280
+ 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);
281
+ 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); }); }; }
282
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
283
+ }
284
+ function __makeTemplateObject(cooked, raw) {
285
+ if (Object.defineProperty) {
286
+ Object.defineProperty(cooked, "raw", { value: raw });
287
+ }
288
+ else {
289
+ cooked.raw = raw;
290
+ }
291
+ return cooked;
292
+ }
293
+ ;
294
+ var __setModuleDefault = Object.create ? (function (o, v) {
295
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
296
+ }) : function (o, v) {
297
+ o["default"] = v;
298
+ };
299
+ function __importStar(mod) {
300
+ if (mod && mod.__esModule)
301
+ return mod;
302
+ var result = {};
303
+ if (mod != null)
304
+ for (var k in mod)
305
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
306
+ __createBinding(result, mod, k);
307
+ __setModuleDefault(result, mod);
308
+ return result;
309
+ }
310
+ function __importDefault(mod) {
311
+ return (mod && mod.__esModule) ? mod : { default: mod };
312
+ }
313
+ function __classPrivateFieldGet(receiver, state, kind, f) {
314
+ if (kind === "a" && !f)
315
+ throw new TypeError("Private accessor was defined without a getter");
316
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
317
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
318
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
319
+ }
320
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
321
+ if (kind === "m")
322
+ throw new TypeError("Private method is not writable");
323
+ if (kind === "a" && !f)
324
+ throw new TypeError("Private accessor was defined without a setter");
325
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
326
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
327
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
328
+ }
329
+
330
+ var _date, _name, _form, _subscription;
331
+ var CUSTOM_DATE_FORMATS = {
332
+ parse: {
333
+ dateInput: 'DD/MM/YYYY',
334
+ },
335
+ display: {
336
+ dateInput: 'DD/MM/YYYY',
337
+ monthYearLabel: 'MMM YYYY',
338
+ dateA11yLabel: 'LL',
339
+ monthYearA11yLabel: 'MMMM YYYY',
340
+ },
341
+ };
342
+ var ɵ0 = CUSTOM_DATE_FORMATS;
343
+ var SdDate = /** @class */ (function () {
344
+ function SdDate(ref, deviceService, formConfig) {
345
+ var _this = this;
346
+ this.ref = ref;
347
+ this.formConfig = formConfig;
348
+ this.id = "I" + uuid.v4();
349
+ this.isMobileOrTablet = false;
350
+ _date.set(this, void 0);
351
+ _name.set(this, uuid.v4());
352
+ this.disableErrorMessage = false;
353
+ this.formControl = new common.SdFormControl();
354
+ _form.set(this, void 0);
355
+ this.required = false;
356
+ this.sdChange = new core.EventEmitter();
357
+ this.sdFocus = new core.EventEmitter();
358
+ this.modelChange = new core.EventEmitter();
359
+ _subscription.set(this, new rxjs.Subscription());
360
+ this.isFocused = false;
361
+ this.onFocus = function () {
362
+ _this.isFocused = true;
363
+ _this.sdFocus.emit();
364
+ };
365
+ this.onBlur = function () {
366
+ _this.isFocused = false;
367
+ };
368
+ this.onClick = function () {
369
+ var _a;
370
+ if ((_a = _this.sdView) === null || _a === void 0 ? void 0 : _a.templateRef) {
371
+ if (!_this.formControl.disabled && !_this.isFocused) {
372
+ _this.focus();
373
+ }
374
+ }
375
+ };
376
+ this.blur = function () {
377
+ var _a, _b;
378
+ (_b = (_a = _this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.blur();
379
+ };
380
+ this.focus = function () {
381
+ _this.isFocused = true;
382
+ setTimeout(function () {
383
+ var _a, _b, _c;
384
+ (_b = (_a = _this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
385
+ (_c = _this.datePicker) === null || _c === void 0 ? void 0 : _c.open();
386
+ //
387
+ }, 100);
388
+ };
389
+ this.onKeyDown = function (event) {
390
+ var key = event.keyCode || event.charCode;
391
+ var isShift = false;
392
+ if (key === 16) {
393
+ isShift = true;
394
+ }
395
+ // cho phép copy parse
396
+ if (event.ctrlKey && (key === 67 || key === 86)) {
397
+ console.log('action copy parse... datepicker');
398
+ return true;
399
+ }
400
+ // Allow only Numeric Keys.
401
+ if (((key >= 48 && key <= 57) ||
402
+ key === 8 ||
403
+ key <= 37 ||
404
+ key <= 39 ||
405
+ (key >= 96 && key <= 105) ||
406
+ key === 191 ||
407
+ key === 186 ||
408
+ key === 59) &&
409
+ isShift === false) {
410
+ return true;
411
+ }
412
+ else {
413
+ return false;
414
+ }
415
+ };
416
+ this.onKeyup = function (event) {
417
+ var currentVal = event.target.value;
418
+ var formControl = _this.formControl;
419
+ var regex = /^([1-9]|([012][0-9])|(3[01]))\/([0]{0,1}[1-9]|1[012])\/\d\d\d\d$/g;
420
+ if (currentVal && !regex.test(currentVal)) {
421
+ setTimeout(function () {
422
+ _this.isValid = true;
423
+ formControl.markAsDirty();
424
+ formControl.markAsTouched();
425
+ formControl.setErrors(Object.assign(Object.assign({}, formControl.errors), { date: "Ch\u01B0a \u0111\u00FAng \u0111\u1ECBnh d\u1EA1ng 'dd/MM/yyyy'" }));
426
+ }, 0);
427
+ }
428
+ else {
429
+ setTimeout(function () {
430
+ _this.isValid = false;
431
+ formControl.setErrors(Object.assign(Object.assign({}, formControl.errors), { date: null }));
432
+ _this.formControl.updateValueAndValidity();
433
+ }, 0);
434
+ }
435
+ };
436
+ this.onChange = function (event) {
437
+ var _a, _b, _c;
438
+ var value = (_a = event.value) === null || _a === void 0 ? void 0 : _a.toDate();
439
+ (_c = (_b = _this.input) === null || _b === void 0 ? void 0 : _b.nativeElement) === null || _c === void 0 ? void 0 : _c.focus();
440
+ if (!_this.isValid) {
441
+ if (new Date(__classPrivateFieldGet(_this, _date)) !== value) {
442
+ _this.modelChange.emit(value);
443
+ _this.sdChange.emit(value);
444
+ }
445
+ }
446
+ else {
447
+ _this.isValid = false;
448
+ _this.formControl.setValue(null);
449
+ _this.modelChange.emit(null);
450
+ _this.sdChange.emit(null);
451
+ }
452
+ };
453
+ this.clear = function ($event) {
454
+ $event === null || $event === void 0 ? void 0 : $event.stopPropagation();
455
+ if (_this.formControl.value) {
456
+ _this.formControl.setValue(null);
457
+ _this.modelChange.emit(null);
458
+ _this.sdChange.emit(null);
459
+ }
460
+ };
461
+ this.isMobileOrTablet = !deviceService.isDesktop();
462
+ }
463
+ Object.defineProperty(SdDate.prototype, "name", {
464
+ set: function (val) {
465
+ if (val) {
466
+ __classPrivateFieldSet(this, _name, val);
467
+ }
468
+ },
469
+ enumerable: false,
470
+ configurable: true
471
+ });
472
+ Object.defineProperty(SdDate.prototype, "_disableErrorMessage", {
473
+ set: function (val) {
474
+ this.disableErrorMessage = val === '' || val;
475
+ val = val === '' || val;
476
+ },
477
+ enumerable: false,
478
+ configurable: true
479
+ });
480
+ Object.defineProperty(SdDate.prototype, "_min", {
481
+ set: function (val) {
482
+ if (Date.isDate(val)) {
483
+ this.min = new Date(val);
484
+ }
485
+ else {
486
+ this.min = null;
487
+ }
488
+ },
489
+ enumerable: false,
490
+ configurable: true
491
+ });
492
+ Object.defineProperty(SdDate.prototype, "_max", {
493
+ set: function (val) {
494
+ if (Date.isDate(val)) {
495
+ this.max = new Date(val);
496
+ }
497
+ else {
498
+ this.max = null;
499
+ }
500
+ },
501
+ enumerable: false,
502
+ configurable: true
503
+ });
504
+ Object.defineProperty(SdDate.prototype, "form", {
505
+ set: function (val) {
506
+ if (val) {
507
+ if (val instanceof forms.NgForm) {
508
+ __classPrivateFieldSet(this, _form, val.form);
509
+ }
510
+ else {
511
+ __classPrivateFieldSet(this, _form, val);
512
+ }
513
+ }
514
+ },
515
+ enumerable: false,
516
+ configurable: true
517
+ });
518
+ Object.defineProperty(SdDate.prototype, "disabled", {
519
+ set: function (val) {
520
+ val = val === '' || val;
521
+ if (val) {
522
+ this.formControl.disable();
523
+ }
524
+ else {
525
+ this.formControl.enable();
526
+ }
527
+ },
528
+ enumerable: false,
529
+ configurable: true
530
+ });
531
+ Object.defineProperty(SdDate.prototype, "_required", {
532
+ set: function (val) {
533
+ this.required = val === '' || val;
534
+ if (this.required) {
535
+ this.formControl.setValidators([forms.Validators.required]);
536
+ }
537
+ else {
538
+ this.formControl.clearValidators();
539
+ }
540
+ },
541
+ enumerable: false,
542
+ configurable: true
543
+ });
544
+ Object.defineProperty(SdDate.prototype, "_inlineError", {
545
+ set: function (val) {
546
+ this.inlineError = val;
547
+ // this.#updateValidator();
548
+ if (this.inlineError) {
549
+ this.formControl.setValidators([this.customInlineErrorValidator()]);
550
+ this.formControl.updateValueAndValidity();
551
+ }
552
+ else {
553
+ this.formControl.clearValidators();
554
+ this.formControl.updateValueAndValidity();
555
+ }
556
+ },
557
+ enumerable: false,
558
+ configurable: true
559
+ });
560
+ Object.defineProperty(SdDate.prototype, "_label", {
561
+ set: function (val) {
562
+ this.label = val;
563
+ this.qcId = hash__default['default']({
564
+ selector: 'sd-date',
565
+ label: val,
566
+ });
567
+ },
568
+ enumerable: false,
569
+ configurable: true
570
+ });
571
+ Object.defineProperty(SdDate.prototype, "minDate", {
572
+ set: function (val) {
573
+ if (Date.isDate(val)) {
574
+ this.min = new Date(val);
575
+ }
576
+ else {
577
+ this.min = null;
578
+ }
579
+ },
580
+ enumerable: false,
581
+ configurable: true
582
+ });
583
+ Object.defineProperty(SdDate.prototype, "maxDate", {
584
+ set: function (val) {
585
+ if (Date.isDate(val)) {
586
+ this.max = new Date(val);
587
+ }
588
+ else {
589
+ this.max = null;
590
+ }
591
+ },
592
+ enumerable: false,
593
+ configurable: true
594
+ });
595
+ Object.defineProperty(SdDate.prototype, "model", {
596
+ set: function (val) {
597
+ if (!Date.isDate(val)) {
598
+ val = null;
599
+ }
600
+ if (__classPrivateFieldGet(this, _date) !== val) {
601
+ __classPrivateFieldSet(this, _date, val);
602
+ var date = Date.isDate(__classPrivateFieldGet(this, _date)) ? moment__default['default'](Date.toFormat(__classPrivateFieldGet(this, _date), 'MM/dd/yyyy HH:mm:ss'), 'MM/DD/YYYY HH:mm:ss') : null;
603
+ this.formControl.setValue(date);
604
+ }
605
+ },
606
+ enumerable: false,
607
+ configurable: true
608
+ });
609
+ SdDate.prototype.ngOnDestroy = function () {
610
+ var _a;
611
+ (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
612
+ __classPrivateFieldGet(this, _subscription).unsubscribe();
613
+ };
614
+ SdDate.prototype.ngOnInit = function () {
615
+ var _this = this;
616
+ var _a, _b;
617
+ this.appearance = this.appearance || ((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.appearance);
618
+ __classPrivateFieldGet(this, _subscription).add(this.formControl.sdChanges.subscribe(function () {
619
+ // this.formControl.updateValueAndValidity();
620
+ _this.ref.markForCheck();
621
+ }));
622
+ (_b = __classPrivateFieldGet(this, _form)) === null || _b === void 0 ? void 0 : _b.addControl(__classPrivateFieldGet(this, _name), this.formControl);
623
+ };
624
+ // Hàm tạo Validators tùy chỉnh cho inlineError
625
+ SdDate.prototype.customInlineErrorValidator = function () {
626
+ return function (control) {
627
+ return { inlineError: true };
628
+ };
629
+ };
630
+ SdDate.prototype.ngAfterViewInit = function () { };
631
+ SdDate.prototype.focusInputElement = function () {
632
+ var _a, _b;
633
+ (_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.focus();
634
+ };
635
+ return SdDate;
636
+ }());
637
+ _date = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _subscription = new WeakMap();
638
+ SdDate.decorators = [
639
+ { type: core.Component, args: [{
640
+ selector: 'sd-date',
641
+ template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\"> </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\"\r\n >{{ label }} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label\r\n>\r\n<div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdView?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused && !datePicker?.opened; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field\r\n class=\"sd-md\"\r\n [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage }\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{ label }}</mat-label>\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n matInput\r\n (keyup)=\"onKeyup($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [formControl]=\"formControl\"\r\n [required]=\"required\"\r\n [matDatepicker]=\"picker2\"\r\n [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\"\r\n #input\r\n [maxLength]=\"10\" />\r\n <ng-content select=\"[sdSuffixIcon]\" matSuffix></ng-content>\r\n <mat-icon\r\n *ngIf=\"formControl?.value && !required && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\"\r\n (click)=\"clear($event)\"\r\n matSuffix\r\n >cancel\r\n </mat-icon>\r\n\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl?.disabled && picker2.open()\" #btn matSuffix>today </mat-icon>\r\n\r\n <mat-datepicker #picker2 [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n <mat-error *ngIf=\"formControl?.errors?.required && formControl?.touched\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ 'This field is required' | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.matDatepickerMin && formControl?.touched && !isFocused\">\r\n <ng-container *ngIf=\"!disableErrorMessage\"\r\n >{{ 'Min date' | sdTranslate }}:\r\n <strong>{{ min | date : 'dd/MM/yyyy HH:mm' }}</strong>\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.matDatepickerMax && formControl?.touched && !isFocused\">\r\n <ng-container *ngIf=\"!disableErrorMessage\"\r\n >{{ 'Max date' | sdTranslate }}:\r\n <strong>{{ max | date : 'dd/MM/yyyy HH:mm' }}</strong>\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.matDatetimePickerParse && formControl?.touched && !isFocused\">\r\n <ng-container *ngIf=\"!disableErrorMessage\"\r\n >{{ 'Parse error' | sdTranslate }}:\r\n <strong>{{ formControl?.errors?.matDatetimePickerParse?.text }}</strong>\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && formControl?.touched && !disableErrorMessage\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.customValidator }} </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.date && formControl?.touched && !disableErrorMessage\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.date }} </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError && formControl?.touched && !disableErrorMessage\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ inlineError }}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>\r\n",
642
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
643
+ providers: [{ provide: core$1.MAT_DATE_FORMATS, useValue: ɵ0 }],
644
+ styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}"]
645
+ },] }
646
+ ];
647
+ SdDate.ctorParameters = function () { return [
648
+ { type: core.ChangeDetectorRef },
649
+ { type: ngxDeviceDetector.DeviceDetectorService },
650
+ { type: undefined, decorators: [{ type: core.Inject, args: [common.FORM_CONFIG,] }, { type: core.Optional }] }
651
+ ]; };
652
+ SdDate.propDecorators = {
653
+ name: [{ type: core.Input }],
654
+ appearance: [{ type: core.Input }],
655
+ _disableErrorMessage: [{ type: core.Input, args: ['disableErrorMessage',] }],
656
+ _min: [{ type: core.Input, args: ['min',] }],
657
+ _max: [{ type: core.Input, args: ['max',] }],
658
+ size: [{ type: core.Input }],
659
+ form: [{ type: core.Input }],
660
+ disabled: [{ type: core.Input }],
661
+ _required: [{ type: core.Input, args: ['required',] }],
662
+ _inlineError: [{ type: core.Input, args: ['inlineError',] }],
663
+ _label: [{ type: core.Input, args: ['label',] }],
664
+ placeholder: [{ type: core.Input }],
665
+ defaultTime: [{ type: core.Input }],
666
+ minDate: [{ type: core.Input }],
667
+ maxDate: [{ type: core.Input }],
668
+ validator: [{ type: core.Input }],
669
+ sdChange: [{ type: core.Output }],
670
+ sdFocus: [{ type: core.Output }],
671
+ model: [{ type: core.Input }],
672
+ modelChange: [{ type: core.Output }],
673
+ sdView: [{ type: core.ContentChild, args: [common.SdViewDefDirective,] }],
674
+ sdLabelDef: [{ type: core.ContentChild, args: [common.SdLabelDefDirective,] }],
675
+ input: [{ type: core.ViewChild, args: ['input',] }],
676
+ datePicker: [{ type: core.ViewChild, args: [datepicker.MatDatepicker,] }]
677
+ };
678
+
679
+ var SdDateModule = /** @class */ (function () {
680
+ function SdDateModule() {
681
+ }
682
+ return SdDateModule;
683
+ }());
684
+ SdDateModule.decorators = [
685
+ { type: core.NgModule, args: [{
686
+ imports: [
687
+ common$1.CommonModule,
688
+ forms.FormsModule,
689
+ forms.ReactiveFormsModule,
690
+ input.MatInputModule,
691
+ icon.MatIconModule,
692
+ formField.MatFormFieldModule,
693
+ datepicker.MatDatepickerModule,
694
+ translate.SdTranslateModule,
695
+ common.SdCommonModule,
696
+ button.SdButtonModule
697
+ ],
698
+ declarations: [
699
+ SdDate
700
+ ],
701
+ exports: [
702
+ common.SdCommonModule,
703
+ SdDate
704
+ ],
705
+ providers: []
706
+ },] }
707
+ ];
708
+
709
+ /**
710
+ * Generated bundle index. Do not edit.
711
+ */
712
+
713
+ exports.SdDate = SdDate;
714
+ exports.SdDateModule = SdDateModule;
715
+
716
+ Object.defineProperty(exports, '__esModule', { value: true });
717
+
718
+ })));
719
+ //# sourceMappingURL=sd-angular-core-date.umd.js.map