@itcase/ui-core 1.10.48 → 1.10.49
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.
|
@@ -111,36 +111,36 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
111
111
|
cachedDeviceTypeUpperFirst = upperFirst(deviceType);
|
|
112
112
|
}
|
|
113
113
|
const propsForDeviceKey = propKey + cachedDeviceTypeUpperFirst;
|
|
114
|
-
let targetPropsValue = undefined
|
|
115
|
-
if (propsForDeviceKey in propsRef.current) {
|
|
116
|
-
// Value for device from props is first priority
|
|
117
|
-
targetPropsValue = propsRef.current[propsForDeviceKey];
|
|
118
|
-
}
|
|
119
|
-
else if (propKey in propsRef.current) {
|
|
120
|
-
// Value without device from props is second priority
|
|
121
|
-
targetPropsValue = propsRef.current[propKey];
|
|
122
|
-
}
|
|
123
|
-
else if (appearanceConfigRef.current &&
|
|
124
|
-
propsForDeviceKey in appearanceConfigRef.current) {
|
|
125
|
-
// Value for device from appearance config is third priority
|
|
126
|
-
targetPropsValue = appearanceConfigRef.current[propsForDeviceKey];
|
|
127
|
-
}
|
|
128
|
-
else if (appearanceConfigRef.current &&
|
|
129
|
-
propKey in appearanceConfigRef.current) {
|
|
130
|
-
// Value without device from appearance config is last priority
|
|
131
|
-
targetPropsValue = appearanceConfigRef.current[propKey];
|
|
132
|
-
}
|
|
133
|
-
// prettier-ignore
|
|
134
|
-
// const targetPropsValue = (
|
|
114
|
+
// let targetPropsValue: unknown = undefined
|
|
115
|
+
// if (propsForDeviceKey in propsRef.current) {
|
|
135
116
|
// // Value for device from props is first priority
|
|
136
|
-
// propsRef.current[propsForDeviceKey]
|
|
117
|
+
// targetPropsValue = propsRef.current[propsForDeviceKey]
|
|
118
|
+
// } else if (propKey in propsRef.current) {
|
|
137
119
|
// // Value without device from props is second priority
|
|
138
|
-
// propsRef.current[propKey]
|
|
120
|
+
// targetPropsValue = propsRef.current[propKey]
|
|
121
|
+
// } else if (
|
|
122
|
+
// appearanceConfigRef.current &&
|
|
123
|
+
// propsForDeviceKey in appearanceConfigRef.current
|
|
124
|
+
// ) {
|
|
139
125
|
// // Value for device from appearance config is third priority
|
|
140
|
-
// appearanceConfigRef.current
|
|
126
|
+
// targetPropsValue = appearanceConfigRef.current[propsForDeviceKey]
|
|
127
|
+
// } else if (
|
|
128
|
+
// appearanceConfigRef.current &&
|
|
129
|
+
// propKey in appearanceConfigRef.current
|
|
130
|
+
// ) {
|
|
141
131
|
// // Value without device from appearance config is last priority
|
|
142
|
-
// appearanceConfigRef.current
|
|
143
|
-
//
|
|
132
|
+
// targetPropsValue = appearanceConfigRef.current[propKey]
|
|
133
|
+
// }
|
|
134
|
+
// prettier-ignore
|
|
135
|
+
const targetPropsValue = (
|
|
136
|
+
// Value for device from props is first priority
|
|
137
|
+
propsRef.current[propsForDeviceKey] ||
|
|
138
|
+
// Value without device from props is second priority
|
|
139
|
+
propsRef.current[propKey] ||
|
|
140
|
+
// Value for device from appearance config is third priority
|
|
141
|
+
appearanceConfigRef.current?.[propsForDeviceKey] ||
|
|
142
|
+
// Value without device from appearance config is last priority
|
|
143
|
+
appearanceConfigRef.current?.[propKey]);
|
|
144
144
|
return targetPropsValue;
|
|
145
145
|
},
|
|
146
146
|
// eslint-disable-next-line perfectionist/sort-objects
|
|
@@ -109,36 +109,36 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
109
109
|
cachedDeviceTypeUpperFirst = upperFirst(deviceType);
|
|
110
110
|
}
|
|
111
111
|
const propsForDeviceKey = propKey + cachedDeviceTypeUpperFirst;
|
|
112
|
-
let targetPropsValue = undefined
|
|
113
|
-
if (propsForDeviceKey in propsRef.current) {
|
|
114
|
-
// Value for device from props is first priority
|
|
115
|
-
targetPropsValue = propsRef.current[propsForDeviceKey];
|
|
116
|
-
}
|
|
117
|
-
else if (propKey in propsRef.current) {
|
|
118
|
-
// Value without device from props is second priority
|
|
119
|
-
targetPropsValue = propsRef.current[propKey];
|
|
120
|
-
}
|
|
121
|
-
else if (appearanceConfigRef.current &&
|
|
122
|
-
propsForDeviceKey in appearanceConfigRef.current) {
|
|
123
|
-
// Value for device from appearance config is third priority
|
|
124
|
-
targetPropsValue = appearanceConfigRef.current[propsForDeviceKey];
|
|
125
|
-
}
|
|
126
|
-
else if (appearanceConfigRef.current &&
|
|
127
|
-
propKey in appearanceConfigRef.current) {
|
|
128
|
-
// Value without device from appearance config is last priority
|
|
129
|
-
targetPropsValue = appearanceConfigRef.current[propKey];
|
|
130
|
-
}
|
|
131
|
-
// prettier-ignore
|
|
132
|
-
// const targetPropsValue = (
|
|
112
|
+
// let targetPropsValue: unknown = undefined
|
|
113
|
+
// if (propsForDeviceKey in propsRef.current) {
|
|
133
114
|
// // Value for device from props is first priority
|
|
134
|
-
// propsRef.current[propsForDeviceKey]
|
|
115
|
+
// targetPropsValue = propsRef.current[propsForDeviceKey]
|
|
116
|
+
// } else if (propKey in propsRef.current) {
|
|
135
117
|
// // Value without device from props is second priority
|
|
136
|
-
// propsRef.current[propKey]
|
|
118
|
+
// targetPropsValue = propsRef.current[propKey]
|
|
119
|
+
// } else if (
|
|
120
|
+
// appearanceConfigRef.current &&
|
|
121
|
+
// propsForDeviceKey in appearanceConfigRef.current
|
|
122
|
+
// ) {
|
|
137
123
|
// // Value for device from appearance config is third priority
|
|
138
|
-
// appearanceConfigRef.current
|
|
124
|
+
// targetPropsValue = appearanceConfigRef.current[propsForDeviceKey]
|
|
125
|
+
// } else if (
|
|
126
|
+
// appearanceConfigRef.current &&
|
|
127
|
+
// propKey in appearanceConfigRef.current
|
|
128
|
+
// ) {
|
|
139
129
|
// // Value without device from appearance config is last priority
|
|
140
|
-
// appearanceConfigRef.current
|
|
141
|
-
//
|
|
130
|
+
// targetPropsValue = appearanceConfigRef.current[propKey]
|
|
131
|
+
// }
|
|
132
|
+
// prettier-ignore
|
|
133
|
+
const targetPropsValue = (
|
|
134
|
+
// Value for device from props is first priority
|
|
135
|
+
propsRef.current[propsForDeviceKey] ||
|
|
136
|
+
// Value without device from props is second priority
|
|
137
|
+
propsRef.current[propKey] ||
|
|
138
|
+
// Value for device from appearance config is third priority
|
|
139
|
+
appearanceConfigRef.current?.[propsForDeviceKey] ||
|
|
140
|
+
// Value without device from appearance config is last priority
|
|
141
|
+
appearanceConfigRef.current?.[propKey]);
|
|
142
142
|
return targetPropsValue;
|
|
143
143
|
},
|
|
144
144
|
// eslint-disable-next-line perfectionist/sort-objects
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KebabCase, WithClassKeys } from '../../types';
|
|
2
2
|
import type { AppearanceConfig, ComponentProps, GeneratorGetClassParams as GP } from './useDevicePropsGenerator.interface';
|
|
3
3
|
declare function useDevicePropsGenerator<Props extends ComponentProps>(componentProps: Props, appearanceConfig?: AppearanceConfig): Props & {
|
|
4
|
-
getProp(propKey: string):
|
|
4
|
+
getProp(propKey: string): any;
|
|
5
5
|
getClassName<K extends Extract<keyof Props, string>, P extends GP | undefined = undefined>(propKey: K, params?: P): ReturnGetClassName<Props, K, P>;
|
|
6
6
|
} & WithClassKeys<Props>;
|
|
7
7
|
type ReturnGetClassName<Props, K extends keyof Props, Params = undefined> = Params extends undefined ? NonNullable<Props[K]> extends string ? KebabCase<NonNullable<Props[K]>> : string : Props[K];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui-core",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.49",
|
|
4
4
|
"description": "UI shared components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
97
97
|
"rollup-preserve-directives": "^1.1.3"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "ead85bbfc14746e9fdffa79e015842111ff38d8b"
|
|
100
100
|
}
|