@cleanweb/oore 1.2.0-alpha.8 → 1.2.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.
- package/build/slots/hook.js +11 -15
- package/package.json +1 -1
package/build/slots/hook.js
CHANGED
|
@@ -23,16 +23,7 @@ var isElementChild = function (child) {
|
|
|
23
23
|
};
|
|
24
24
|
exports.isElementChild = isElementChild;
|
|
25
25
|
var getComponentSlotName = function (TargetComponent, child) {
|
|
26
|
-
if (
|
|
27
|
-
return TargetComponent;
|
|
28
|
-
}
|
|
29
|
-
else if ('slotName' in TargetComponent) {
|
|
30
|
-
return TargetComponent.slotName;
|
|
31
|
-
}
|
|
32
|
-
else if ('displayName' in TargetComponent) {
|
|
33
|
-
return TargetComponent.displayName;
|
|
34
|
-
}
|
|
35
|
-
else if (child) {
|
|
26
|
+
if (child) {
|
|
36
27
|
var keyTypes = ['string', 'number', 'symbol'];
|
|
37
28
|
var slotName = child.props['data-slot-name'];
|
|
38
29
|
if (keyTypes.includes(typeof slotName)) {
|
|
@@ -41,11 +32,17 @@ var getComponentSlotName = function (TargetComponent, child) {
|
|
|
41
32
|
}
|
|
42
33
|
return slotName;
|
|
43
34
|
}
|
|
44
|
-
else
|
|
45
|
-
return undefined;
|
|
46
35
|
}
|
|
47
|
-
|
|
48
|
-
return
|
|
36
|
+
if (typeof TargetComponent === 'string') {
|
|
37
|
+
return TargetComponent;
|
|
38
|
+
}
|
|
39
|
+
else if ('slotName' in TargetComponent) {
|
|
40
|
+
return TargetComponent.slotName;
|
|
41
|
+
}
|
|
42
|
+
else if ('displayName' in TargetComponent) {
|
|
43
|
+
return TargetComponent.displayName;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
49
46
|
};
|
|
50
47
|
exports.getComponentSlotName = getComponentSlotName;
|
|
51
48
|
var useSlots = function (children, slotComponents, _requiredSlots) {
|
|
@@ -88,7 +85,6 @@ var useSlots = function (children, slotComponents, _requiredSlots) {
|
|
|
88
85
|
var slotName = (0, exports.getComponentSlotName)(child.type, child);
|
|
89
86
|
return slotName ? slotsAliasLookup[slotName] : null;
|
|
90
87
|
})();
|
|
91
|
-
console.log('match:', { key: slotAlias });
|
|
92
88
|
if (slotAlias && (typeof slotComponents[slotAlias] !== 'string')) {
|
|
93
89
|
if (slotComponents[slotAlias].isRequiredSlot) {
|
|
94
90
|
requiredSlots.push(slotAlias);
|