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