@progress/kendo-dateinputs-common 0.1.0 → 0.2.0-dev.202301061353

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 (55) hide show
  1. package/README.md +34 -3
  2. package/dist/cdn/js/kendo-dateinputs-common.js +1 -0
  3. package/dist/cdn/main.js +1 -1
  4. package/dist/es/common/constants.js +6 -0
  5. package/dist/es/common/dateobject.js +1159 -0
  6. package/dist/es/common/key.js +16 -0
  7. package/dist/es/common/keycode.js +16 -0
  8. package/dist/es/common/mask.js +8 -0
  9. package/dist/es/common/observable.js +32 -0
  10. package/dist/es/common/utils.js +128 -0
  11. package/dist/es/dateinput/dateinput.js +1011 -0
  12. package/dist/es/dateinput/interaction-mode.js +6 -0
  13. package/dist/es/dateinput/utils.js +93 -0
  14. package/dist/es/main.js +1 -1
  15. package/dist/es2015/common/constants.js +6 -0
  16. package/dist/es2015/common/dateobject.js +1137 -0
  17. package/dist/es2015/common/key.js +16 -0
  18. package/dist/es2015/common/keycode.js +16 -0
  19. package/dist/es2015/common/mask.js +6 -0
  20. package/dist/es2015/common/observable.js +29 -0
  21. package/dist/es2015/common/utils.js +117 -0
  22. package/dist/es2015/dateinput/dateinput.js +969 -0
  23. package/dist/es2015/dateinput/interaction-mode.js +6 -0
  24. package/dist/es2015/dateinput/utils.js +92 -0
  25. package/dist/es2015/main.js +1 -1
  26. package/dist/npm/common/constants.d.ts +6 -0
  27. package/dist/npm/common/constants.js +8 -0
  28. package/dist/npm/common/dateobject.d.ts +172 -0
  29. package/dist/npm/common/dateobject.js +1161 -0
  30. package/dist/npm/common/key.d.ts +16 -0
  31. package/dist/npm/common/key.js +18 -0
  32. package/dist/npm/common/keycode.d.ts +16 -0
  33. package/dist/npm/common/keycode.js +18 -0
  34. package/dist/npm/common/mask.d.ts +4 -0
  35. package/dist/npm/common/mask.js +10 -0
  36. package/dist/npm/common/observable.d.ts +9 -0
  37. package/dist/npm/common/observable.js +34 -0
  38. package/dist/npm/common/utils.d.ts +60 -0
  39. package/dist/npm/common/utils.js +130 -0
  40. package/dist/npm/dateinput/dateinput.d.ts +204 -0
  41. package/dist/npm/dateinput/dateinput.js +1013 -0
  42. package/dist/npm/dateinput/interaction-mode.d.ts +5 -0
  43. package/dist/npm/dateinput/interaction-mode.js +8 -0
  44. package/dist/npm/dateinput/utils.d.ts +27 -0
  45. package/dist/npm/dateinput/utils.js +95 -0
  46. package/dist/npm/main.d.ts +1 -1
  47. package/dist/npm/main.js +2 -2
  48. package/dist/systemjs/kendo-dateinputs-common.js +1 -0
  49. package/package.json +10 -8
  50. package/dist/cdn/js/kendo-typescript-package-base.js +0 -1
  51. package/dist/es/my-class.js +0 -15
  52. package/dist/es2015/my-class.js +0 -11
  53. package/dist/npm/my-class.d.ts +0 -9
  54. package/dist/npm/my-class.js +0 -17
  55. package/dist/systemjs/kendo-typescript-package-base.js +0 -1
@@ -0,0 +1,6 @@
1
+ export var DateInputInteractionMode;
2
+ (function (DateInputInteractionMode) {
3
+ DateInputInteractionMode["None"] = "none";
4
+ DateInputInteractionMode["Caret"] = "caret";
5
+ DateInputInteractionMode["Selection"] = "selection";
6
+ })(DateInputInteractionMode || (DateInputInteractionMode = {}));
@@ -0,0 +1,93 @@
1
+ import { Constants } from '../common/constants';
2
+ import { Key } from '../common/key';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export var padZero = function (length) { return new Array(Math.max(length, 0)).fill('0').join(''); };
7
+ /**
8
+ * @hidden
9
+ */
10
+ export var unpadZero = function (value) { return value.replace(/^0*/, ''); };
11
+ /**
12
+ * @hidden
13
+ */
14
+ export var approximateStringMatching = function (_a) {
15
+ /*
16
+ Remove the right part of the cursor.
17
+ oldFormat = oldFormat.substring(0, caret + oldText.length - newText.length);
18
+ */
19
+ var oldText = _a.oldText, newText = _a.newText, formatPattern = _a.formatPattern, selectionStart = _a.selectionStart, isInCaretMode = _a.isInCaretMode, keyEvent = _a.keyEvent;
20
+ var oldTextSeparator = oldText[selectionStart + oldText.length - newText.length];
21
+ var oldSegmentText = oldText.substring(0, selectionStart + oldText.length - newText.length);
22
+ var newSegmentText = newText.substring(0, selectionStart);
23
+ var diff = [];
24
+ /* Handle the typing of a single character over the same selection. */
25
+ if (oldSegmentText === newSegmentText && selectionStart > 0) {
26
+ diff.push([formatPattern[selectionStart - 1], newSegmentText[selectionStart - 1]]);
27
+ return diff;
28
+ }
29
+ if (oldSegmentText.indexOf(newSegmentText) === 0 && (isInCaretMode &&
30
+ (keyEvent.key === Key.DELETE || keyEvent.key === Key.BACKSPACE)) ||
31
+ (oldSegmentText.indexOf(newSegmentText) === 0 && !isInCaretMode &&
32
+ (newSegmentText.length === 0 ||
33
+ formatPattern[newSegmentText.length - 1] !== formatPattern[newSegmentText.length]))) {
34
+ /* Handle Delete/Backspace. */
35
+ var deletedSymbol = '';
36
+ /*
37
+ The whole text is replaced by the same character.
38
+ A nasty patch is required to keep the selection in the first segment.
39
+ */
40
+ if (!isInCaretMode && newSegmentText.length === 1) {
41
+ diff.push([formatPattern[0], newSegmentText[0]]);
42
+ }
43
+ for (var i = newSegmentText.length; i < oldSegmentText.length; i++) {
44
+ if (formatPattern[i] !== deletedSymbol && formatPattern[i] !== Constants.formatSeparator) {
45
+ deletedSymbol = formatPattern[i];
46
+ diff.push([deletedSymbol, '']);
47
+ }
48
+ }
49
+ return diff;
50
+ }
51
+ /*
52
+ Handle the insertion of the text (the new text is longer than the previous one).
53
+ Handle the typing over a literal as well.
54
+ */
55
+ if ((isInCaretMode &&
56
+ newSegmentText.indexOf(oldSegmentText) === 0 && formatPattern[selectionStart - 1]) ||
57
+ (!isInCaretMode &&
58
+ (newSegmentText.indexOf(oldSegmentText) === 0 ||
59
+ formatPattern[selectionStart - 1] === Constants.formatSeparator))) {
60
+ if (isInCaretMode) {
61
+ var symbol = formatPattern[selectionStart - 1];
62
+ return [[symbol, newSegmentText[selectionStart - 1]]];
63
+ }
64
+ else {
65
+ var symbol = formatPattern[0];
66
+ for (var i = Math.max(0, oldSegmentText.length - 1); i < formatPattern.length; i++) {
67
+ if (formatPattern[i] !== Constants.formatSeparator) {
68
+ symbol = formatPattern[i];
69
+ break;
70
+ }
71
+ }
72
+ return [[symbol, newSegmentText[selectionStart - 1]]];
73
+ }
74
+ }
75
+ /* Handle the entering of a space or a separator for navigating to the next item. */
76
+ if (newSegmentText[newSegmentText.length - 1] === ' ' || newSegmentText[newSegmentText.length - 1] === oldTextSeparator) {
77
+ return [[formatPattern[selectionStart - 1], Constants.formatSeparator]];
78
+ }
79
+ /* Handle typing over a correctly selected part. */
80
+ var result = [[formatPattern[selectionStart - 1], newSegmentText[selectionStart - 1]]];
81
+ return result;
82
+ };
83
+ /**
84
+ * @hidden
85
+ */
86
+ export var dateSymbolMap = function (map, part) {
87
+ map[part.pattern[0]] = part.type;
88
+ return map;
89
+ };
90
+ /**
91
+ * @hidden
92
+ */
93
+ export var isInRange = function (candidate, min, max) { return (candidate === null || !((min && min > candidate) || (max && max < candidate))); };
package/dist/es/main.js CHANGED
@@ -1 +1 @@
1
- export { MyClass } from './my-class';
1
+ export { DateInput } from './dateinput/dateinput';
@@ -0,0 +1,6 @@
1
+ export const Constants = {
2
+ formatSeparator: "_",
3
+ twoDigitYearMax: 68,
4
+ defaultDateFormat: "d",
5
+ defaultLocaleId: "en"
6
+ };