jsl-ui 9.4.1 → 9.5.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.
|
@@ -65,3 +65,61 @@ export function DateEditor(args) {
|
|
|
65
65
|
};
|
|
66
66
|
this.init();
|
|
67
67
|
}
|
|
68
|
+
export function TimeEditor(args) {
|
|
69
|
+
var input;
|
|
70
|
+
var defaultValue;
|
|
71
|
+
var scope = this;
|
|
72
|
+
this.init = function () {
|
|
73
|
+
var navOnLR = args.grid.getOptions().editorCellNavOnLRKeys;
|
|
74
|
+
input = document.createElement("input");
|
|
75
|
+
input.type = "time";
|
|
76
|
+
input.className = "editor-text";
|
|
77
|
+
if (args.column.maxLength > 0) {
|
|
78
|
+
input.maxLength = args.column.maxLength;
|
|
79
|
+
}
|
|
80
|
+
input.addEventListener("keydown", navOnLR ? handleKeydownLRNav : handleKeydownLRNoNav);
|
|
81
|
+
args.container.appendChild(input);
|
|
82
|
+
input.focus();
|
|
83
|
+
input.select();
|
|
84
|
+
};
|
|
85
|
+
this.destroy = function () {
|
|
86
|
+
input.parentElement.removeChild(input);
|
|
87
|
+
};
|
|
88
|
+
this.focus = function () {
|
|
89
|
+
input.focus();
|
|
90
|
+
};
|
|
91
|
+
this.getValue = function () {
|
|
92
|
+
return input.value;
|
|
93
|
+
};
|
|
94
|
+
this.setValue = function (val) {
|
|
95
|
+
input.value = val;
|
|
96
|
+
};
|
|
97
|
+
this.loadValue = function (item) {
|
|
98
|
+
defaultValue = item[args.column.field] || "";
|
|
99
|
+
input.value = defaultValue;
|
|
100
|
+
input.defaultValue = defaultValue;
|
|
101
|
+
input.select();
|
|
102
|
+
};
|
|
103
|
+
this.serializeValue = function () {
|
|
104
|
+
return input.value;
|
|
105
|
+
};
|
|
106
|
+
this.applyValue = function (item, state) {
|
|
107
|
+
item[args.column.field] = state;
|
|
108
|
+
};
|
|
109
|
+
this.isValueChanged = function () {
|
|
110
|
+
return (!(input.value == "" && defaultValue == null)) && (input.value != defaultValue);
|
|
111
|
+
};
|
|
112
|
+
this.validate = function () {
|
|
113
|
+
if (args.column.validator) {
|
|
114
|
+
var validationResults = args.column.validator(input.value);
|
|
115
|
+
if (!validationResults.valid) {
|
|
116
|
+
return validationResults;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
valid: true,
|
|
121
|
+
msg: null
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
this.init();
|
|
125
|
+
}
|