Update directive data keyword
parent
89c2d63b6a
commit
95c2dcd54b
|
@ -15,12 +15,13 @@ const BaseDirective = {
|
||||||
: ObjectUtils.getItemValue(options, params);
|
: ObjectUtils.getItemValue(options, params);
|
||||||
},
|
},
|
||||||
_getPTValue: (instance = {}, obj = {}, key = '', params = {}, searchInDefaultPT = true) => {
|
_getPTValue: (instance = {}, obj = {}, key = '', params = {}, searchInDefaultPT = true) => {
|
||||||
const datasetPrefix = 'data-pc-';
|
const name = ObjectUtils.convertToFlatCase(instance.$name);
|
||||||
|
const datasetPrefix = name ? `data-pd-${name}` : '';
|
||||||
const self = BaseDirective._getOptionValue(obj, key, params);
|
const self = BaseDirective._getOptionValue(obj, key, params);
|
||||||
const globalPT = searchInDefaultPT ? BaseDirective._getOptionValue(instance.defaultPT, key, params) : undefined;
|
const globalPT = searchInDefaultPT ? BaseDirective._getOptionValue(instance.defaultPT, key, params) : undefined;
|
||||||
const merged = mergeProps(self, globalPT, {
|
const merged = mergeProps(self, globalPT, {
|
||||||
...(key === 'root' && instance.$name !== 'focustrap' && { [`${datasetPrefix}name`]: ObjectUtils.convertToFlatCase(instance.$name) }),
|
...(key === 'root' && { [datasetPrefix]: true }),
|
||||||
[`${datasetPrefix}section`]: ObjectUtils.convertToFlatCase(key)
|
[`${datasetPrefix}-section`]: ObjectUtils.convertToFlatCase(key)
|
||||||
});
|
});
|
||||||
|
|
||||||
return merged;
|
return merged;
|
||||||
|
|
|
@ -107,11 +107,11 @@ const FocusTrap = BaseFocusTrap.extend('focustrap', {
|
||||||
|
|
||||||
firstFocusableElement.$_pfocustrap_lasthiddenfocusableelement = lastFocusableElement;
|
firstFocusableElement.$_pfocustrap_lasthiddenfocusableelement = lastFocusableElement;
|
||||||
firstFocusableElement.$_pfocustrap_focusableselector = firstFocusableSelector;
|
firstFocusableElement.$_pfocustrap_focusableselector = firstFocusableSelector;
|
||||||
firstFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement');
|
firstFocusableElement.setAttribute('data-pd-focustrap-section', 'firstfocusableelement');
|
||||||
|
|
||||||
lastFocusableElement.$_pfocustrap_firsthiddenfocusableelement = firstFocusableElement;
|
lastFocusableElement.$_pfocustrap_firsthiddenfocusableelement = firstFocusableElement;
|
||||||
lastFocusableElement.$_pfocustrap_focusableselector = lastFocusableSelector;
|
lastFocusableElement.$_pfocustrap_focusableselector = lastFocusableSelector;
|
||||||
lastFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement');
|
lastFocusableElement.setAttribute('data-pd-focustrap-section', 'lastfocusableelement');
|
||||||
|
|
||||||
el.prepend(firstFocusableElement);
|
el.prepend(firstFocusableElement);
|
||||||
el.append(lastFocusableElement);
|
el.append(lastFocusableElement);
|
||||||
|
|
|
@ -91,13 +91,7 @@ const Ripple = BaseRipple.extend('ripple', {
|
||||||
event.currentTarget.setAttribute('data-p-ink-active', 'false');
|
event.currentTarget.setAttribute('data-p-ink-active', 'false');
|
||||||
},
|
},
|
||||||
getInk(el) {
|
getInk(el) {
|
||||||
for (let i = 0; i < el.children.length; i++) {
|
return el && el.children ? [...el.children].find((child) => DomHandler.getAttribute(child, 'data-pd-ripple')) : undefined;
|
||||||
if (el.children[i].getAttribute('data-pc-name') === 'ripple') {
|
|
||||||
return el.children[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue