1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | 1×
1×
1×
1×
1×
56745×
56745×
53867×
1×
203×
1×
1458×
1×
4119×
4119×
1×
6×
1×
6×
1×
1×
1×
63778×
4018×
4018×
59760×
59551×
1×
| define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AriaService = (function () {
function AriaService() {
}
AriaService.prototype.setOptions = function (target, options) {
var props = Object.keys(options);
for (var i = 0; i < props.length; i++) {
setStateAndProperties(target, config[props[parseInt(i.toString(), 10)]], options[props[parseInt(i.toString(), 10)]]);
}
};
AriaService.prototype.setExpand = function (target, expand) {
setStateAndProperties(target, config.expand, expand);
};
AriaService.prototype.setSort = function (target, direction) {
setStateAndProperties(target, config.sort, direction, typeof direction === 'boolean');
};
AriaService.prototype.setBusy = function (target, isBusy) {
setStateAndProperties(target, config.busy, isBusy);
setStateAndProperties(target, config.invalid, null, true);
};
AriaService.prototype.setGrabbed = function (target, isGrabbed, remove) {
setStateAndProperties(target, config.grabbed, isGrabbed, remove);
};
AriaService.prototype.setDropTarget = function (target, isTarget) {
setStateAndProperties(target, config.dropeffect, 'copy', !isTarget);
};
return AriaService;
}());
exports.AriaService = AriaService;
function setStateAndProperties(target, attribute, value, remove) {
if (remove && target) {
target.removeAttribute(attribute);
return;
}
if (target) {
target.setAttribute(attribute, value);
}
}
var config = {
expand: 'aria-expanded',
role: 'role',
datarole: 'data-role',
selected: 'aria-selected',
multiselectable: 'aria-multiselectable',
sort: 'aria-sort',
busy: 'aria-busy',
invalid: 'aria-invalid',
grabbed: 'aria-grabbed',
dropeffect: 'aria-dropeffect',
haspopup: 'aria-haspopup',
level: 'aria-level',
colcount: 'aria-colcount',
rowcount: 'aria-rowcount'
};
});
|