ag-common 0.0.102 → 0.0.103
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.
|
@@ -102,17 +102,20 @@ function DropdownList({ options, value, onChange, placeholder, className, render
|
|
|
102
102
|
if (JSON.stringify(newv) !== JSON.stringify(value))
|
|
103
103
|
setState(newv);
|
|
104
104
|
}, [options, value]);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
let style = {};
|
|
106
|
+
if (open) {
|
|
107
|
+
const maxLen = Math.max(...options.map((s) => renderF(s).length));
|
|
108
|
+
style = {
|
|
109
|
+
width: `calc(${maxLen}ch + 2rem)`,
|
|
110
|
+
};
|
|
111
|
+
const minLeft = (0, dom_1.convertRemToPixels)(2 + maxLen / 2);
|
|
112
|
+
const offsetList = (_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0;
|
|
113
|
+
if (offsetList < minLeft) {
|
|
114
|
+
style.left = 0;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
style.right = 0;
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
return (react_1.default.createElement(SBase, { className: className, ref: ref, title: placeholder, onClick: (e) => {
|
|
118
121
|
e.stopPropagation();
|
package/dist/ui/helpers/dom.js
CHANGED
|
@@ -8,5 +8,11 @@ const domContains = (e, x, y) => {
|
|
|
8
8
|
return e.x <= x && x <= e.x + e.width && e.y <= y && y <= e.y + e.height;
|
|
9
9
|
};
|
|
10
10
|
exports.domContains = domContains;
|
|
11
|
-
const convertRemToPixels = (rem) =>
|
|
11
|
+
const convertRemToPixels = (rem) => {
|
|
12
|
+
let fontSize = '16px';
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
fontSize = getComputedStyle(document.documentElement).fontSize;
|
|
15
|
+
}
|
|
16
|
+
return rem * parseFloat(fontSize);
|
|
17
|
+
};
|
|
12
18
|
exports.convertRemToPixels = convertRemToPixels;
|
|
@@ -4,7 +4,5 @@ declare type AxiosWrapperWrap<T> = AxiosWrapper<T | undefined> & {
|
|
|
4
4
|
loaded: boolean;
|
|
5
5
|
loadcount: number;
|
|
6
6
|
};
|
|
7
|
-
export declare const useCallOpenApi: <T, TDefaultApi>(p: ICallOpenApi<T, TDefaultApi>
|
|
8
|
-
cacheKey: string;
|
|
9
|
-
}) => AxiosWrapperWrap<T>;
|
|
7
|
+
export declare const useCallOpenApi: <T, TDefaultApi>(p: ICallOpenApi<T, TDefaultApi>) => AxiosWrapperWrap<T>;
|
|
10
8
|
export {};
|