@map-colonies/react-components 3.10.2 → 3.10.5
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/CHANGELOG.md +34 -0
- package/dist/autocomplete/autocomplete.d.ts +2 -2
- package/dist/autocomplete/autocomplete.js +16 -18
- package/dist/cesium-map/proxied.types.d.ts +4 -1
- package/dist/cesium-map/proxied.types.js +12 -1
- package/dist/file-picker/file-picker.css +2 -1
- package/dist/file-picker/file-picker.d.ts +1 -1
- package/package.json +2 -2
- package/src/lib/autocomplete/autocomplete.tsx +16 -18
- package/src/lib/cesium-map/proxied.types.ts +6 -0
- package/src/lib/file-picker/file-picker.css +2 -1
- package/src/lib/file-picker/file-picker.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.10.5](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.4...@map-colonies/react-components@3.10.5) (2022-03-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* folderchain alignment ([#125](https://github.com/MapColonies/shared-components/issues/125)) ([01c3670](https://github.com/MapColonies/shared-components/commit/01c3670567b67b81ad98a10705eb1a8a0bc74206))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.10.4](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.3...@map-colonies/react-components@3.10.4) (2022-03-02)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* for poi ([#122](https://github.com/MapColonies/shared-components/issues/122)) ([ef849eb](https://github.com/MapColonies/shared-components/commit/ef849eb488a19a072e32de7af9d3038bc7e22656))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [3.10.3](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.2...@map-colonies/react-components@3.10.3) (2022-02-22)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* auto complete input bug ([cdb9220](https://github.com/MapColonies/shared-components/commit/cdb9220177e81087b90eacdf05a5f80b04e2ed67))
|
|
34
|
+
* autocomplete prettier ([eff39e8](https://github.com/MapColonies/shared-components/commit/eff39e8e469d6d9ca831be3718204ad58e77d850))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
## [3.10.2](https://github.com/MapColonies/shared-components/compare/@map-colonies/react-components@3.10.1...@map-colonies/react-components@3.10.2) (2022-02-20)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -3,10 +3,10 @@ import './autocomplete.css';
|
|
|
3
3
|
export interface IAutocompleteProps {
|
|
4
4
|
Component: React.ReactElement;
|
|
5
5
|
ComponentProps: Record<string, unknown>;
|
|
6
|
-
defaultValue: string;
|
|
6
|
+
defaultValue: string | undefined;
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
maxOptions: number;
|
|
9
|
-
onBlur: () => void;
|
|
9
|
+
onBlur: (evt: any) => void;
|
|
10
10
|
onChange: (val: string) => void;
|
|
11
11
|
onKeyDown: (evt: any) => void;
|
|
12
12
|
onRequestOptions: (val: string) => void;
|
|
@@ -59,9 +59,10 @@ var KEY_TAB = 9;
|
|
|
59
59
|
var OPTION_LIST_Y_OFFSET = 10;
|
|
60
60
|
var OPTION_LIST_MIN_WIDTH = 100;
|
|
61
61
|
var Autocomplete = function (props) {
|
|
62
|
-
var _a
|
|
63
|
-
var _b = react_1.useState(
|
|
64
|
-
var _c = react_1.useState(
|
|
62
|
+
var _a;
|
|
63
|
+
var _b = react_1.useState((_a = props.defaultValue) !== null && _a !== void 0 ? _a : ''), recentValue = _b[0], setRecentValue = _b[1];
|
|
64
|
+
var _c = react_1.useState(false), enableSpaceRemovers = _c[0], setEnableSpaceRemovers = _c[1];
|
|
65
|
+
var _d = react_1.useState({
|
|
65
66
|
helperVisible: false,
|
|
66
67
|
left: 0,
|
|
67
68
|
right: 0,
|
|
@@ -74,7 +75,7 @@ var Autocomplete = function (props) {
|
|
|
74
75
|
value: '',
|
|
75
76
|
caret: 0,
|
|
76
77
|
width: 'unset',
|
|
77
|
-
}), state =
|
|
78
|
+
}), state = _d[0], setState = _d[1];
|
|
78
79
|
var refInput = react_1.useRef(null);
|
|
79
80
|
react_1.useEffect(function () {
|
|
80
81
|
window.addEventListener('resize', handleResize);
|
|
@@ -87,6 +88,14 @@ var Autocomplete = function (props) {
|
|
|
87
88
|
}
|
|
88
89
|
};
|
|
89
90
|
}, []);
|
|
91
|
+
react_1.useEffect(function () {
|
|
92
|
+
if (typeof props.value !== 'undefined') {
|
|
93
|
+
setRecentValue(props.value);
|
|
94
|
+
}
|
|
95
|
+
if (typeof props.defaultValue !== 'undefined') {
|
|
96
|
+
setRecentValue(props.defaultValue);
|
|
97
|
+
}
|
|
98
|
+
}, [props.value, props.defaultValue]);
|
|
90
99
|
react_1.useEffect(function () {
|
|
91
100
|
var options = props.options;
|
|
92
101
|
var caret = state.caret;
|
|
@@ -421,32 +430,21 @@ var Autocomplete = function (props) {
|
|
|
421
430
|
return (react_1.default.createElement("ul", { className: "react-autocomplete-input", style: __assign(__assign({}, horizontalPosition), { top: top + offsetY, width: width }) }, helperOptions));
|
|
422
431
|
};
|
|
423
432
|
var Component = props.Component, ComponentProps = props.ComponentProps, defaultValue = props.defaultValue, disabled = props.disabled, onBlur = props.onBlur, value = props.value, rest = __rest(props, ["Component", "ComponentProps", "defaultValue", "disabled", "onBlur", "value"]);
|
|
424
|
-
var stateValue = recentValue; //state.value;
|
|
425
433
|
var propagated = Object.assign({}, rest);
|
|
426
434
|
Object.keys(props).forEach(function (k) {
|
|
427
435
|
delete propagated[k];
|
|
428
436
|
});
|
|
429
|
-
var val = '';
|
|
430
|
-
if (stateValue) {
|
|
431
|
-
val = stateValue;
|
|
432
|
-
}
|
|
433
|
-
else if (defaultValue) {
|
|
434
|
-
val = defaultValue;
|
|
435
|
-
}
|
|
436
|
-
else if (value !== undefined) {
|
|
437
|
-
val = value;
|
|
438
|
-
}
|
|
439
437
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
440
|
-
react_1.default.cloneElement(Component, __assign(__assign({ disabled: disabled, onBlur: onBlur, onChange: handleChange, onKeyDown: handleKeyDown, ref: refInput, value:
|
|
438
|
+
react_1.default.cloneElement(Component, __assign(__assign({ disabled: disabled, onBlur: onBlur, onChange: handleChange, onKeyDown: handleKeyDown, ref: refInput, value: recentValue }, propagated), ComponentProps)),
|
|
441
439
|
renderAutocompleteList()));
|
|
442
440
|
};
|
|
443
441
|
var defaultProps = {
|
|
444
442
|
Component: react_1.default.createElement("textarea", null),
|
|
445
443
|
ComponentProps: {},
|
|
446
|
-
defaultValue:
|
|
444
|
+
defaultValue: undefined,
|
|
447
445
|
disabled: false,
|
|
448
446
|
maxOptions: 6,
|
|
449
|
-
onBlur: function () { },
|
|
447
|
+
onBlur: function (evt) { },
|
|
450
448
|
onChange: function (val) { },
|
|
451
449
|
onKeyDown: function (evt) { },
|
|
452
450
|
onRequestOptions: function (val) { },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PolylineDashMaterialProperty, ConstantProperty, VerticalOrigin, LabelStyle, Cartesian2, Cartesian3, BoundingSphere, Ellipsoid, ConstantPositionProperty, GeographicTilingScheme } from 'cesium';
|
|
1
|
+
import { PolylineDashMaterialProperty, ConstantProperty, VerticalOrigin, LabelStyle, Cartesian2, Cartesian3, BoundingSphere, Ellipsoid, ConstantPositionProperty, GeographicTilingScheme, Cartographic } from 'cesium';
|
|
2
2
|
export declare class CesiumPolylineDashMaterialProperty extends PolylineDashMaterialProperty {
|
|
3
3
|
}
|
|
4
4
|
export declare class CesiumConstantProperty extends ConstantProperty {
|
|
@@ -9,6 +9,8 @@ export declare class CesiumCartesian2 extends Cartesian2 {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class CesiumCartesian3 extends Cartesian3 {
|
|
11
11
|
}
|
|
12
|
+
export declare class CesiumCartographic extends Cartographic {
|
|
13
|
+
}
|
|
12
14
|
export declare class CesiumBoundingSphere extends BoundingSphere {
|
|
13
15
|
}
|
|
14
16
|
export declare class CesiumEllipsoid extends Ellipsoid {
|
|
@@ -17,3 +19,4 @@ export declare class CesiumGeographicTilingScheme extends GeographicTilingScheme
|
|
|
17
19
|
}
|
|
18
20
|
export declare const CesiumVerticalOrigin: typeof VerticalOrigin;
|
|
19
21
|
export declare const CesiumLabelStyle: typeof LabelStyle;
|
|
22
|
+
export { sampleTerrainMostDetailed as cesiumSampleTerrainMostDetailed } from 'cesium';
|
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.CesiumLabelStyle = exports.CesiumVerticalOrigin = exports.CesiumGeographicTilingScheme = exports.CesiumEllipsoid = exports.CesiumBoundingSphere = exports.CesiumCartesian3 = exports.CesiumCartesian2 = exports.CesiumConstantPositionProperty = exports.CesiumConstantProperty = exports.CesiumPolylineDashMaterialProperty = void 0;
|
|
18
|
+
exports.cesiumSampleTerrainMostDetailed = exports.CesiumLabelStyle = exports.CesiumVerticalOrigin = exports.CesiumGeographicTilingScheme = exports.CesiumEllipsoid = exports.CesiumBoundingSphere = exports.CesiumCartographic = exports.CesiumCartesian3 = exports.CesiumCartesian2 = exports.CesiumConstantPositionProperty = exports.CesiumConstantProperty = exports.CesiumPolylineDashMaterialProperty = void 0;
|
|
19
19
|
var cesium_1 = require("cesium");
|
|
20
20
|
// PROXIED CLASSES
|
|
21
21
|
var CesiumPolylineDashMaterialProperty = /** @class */ (function (_super) {
|
|
@@ -58,6 +58,14 @@ var CesiumCartesian3 = /** @class */ (function (_super) {
|
|
|
58
58
|
return CesiumCartesian3;
|
|
59
59
|
}(cesium_1.Cartesian3));
|
|
60
60
|
exports.CesiumCartesian3 = CesiumCartesian3;
|
|
61
|
+
var CesiumCartographic = /** @class */ (function (_super) {
|
|
62
|
+
__extends(CesiumCartographic, _super);
|
|
63
|
+
function CesiumCartographic() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
+
}
|
|
66
|
+
return CesiumCartographic;
|
|
67
|
+
}(cesium_1.Cartographic));
|
|
68
|
+
exports.CesiumCartographic = CesiumCartographic;
|
|
61
69
|
var CesiumBoundingSphere = /** @class */ (function (_super) {
|
|
62
70
|
__extends(CesiumBoundingSphere, _super);
|
|
63
71
|
function CesiumBoundingSphere() {
|
|
@@ -87,3 +95,6 @@ exports.CesiumGeographicTilingScheme = CesiumGeographicTilingScheme;
|
|
|
87
95
|
exports.CesiumVerticalOrigin = cesium_1.VerticalOrigin;
|
|
88
96
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
89
97
|
exports.CesiumLabelStyle = cesium_1.LabelStyle;
|
|
98
|
+
// PROXIED FUNCTIONS
|
|
99
|
+
var cesium_2 = require("cesium");
|
|
100
|
+
Object.defineProperty(exports, "cesiumSampleTerrainMostDetailed", { enumerable: true, get: function () { return cesium_2.sampleTerrainMostDetailed; } });
|
|
@@ -4,7 +4,8 @@ body[dir='rtl'] .chonky-fileListWrapper [class^='listContainer-'] {
|
|
|
4
4
|
|
|
5
5
|
body[dir='rtl']
|
|
6
6
|
.chonky-fileEntryClickableWrapper
|
|
7
|
-
[class^='listFileEntryProperty-']
|
|
7
|
+
[class^='listFileEntryProperty-'],
|
|
8
|
+
body[dir='rtl'] .chonky-navbarContainer {
|
|
8
9
|
direction: ltr !important;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -273,4 +273,4 @@ export interface FilePickerProps extends Partial<FileBrowserProps> {
|
|
|
273
273
|
readOnlyMode?: boolean;
|
|
274
274
|
locale?: SupportedLocales;
|
|
275
275
|
}
|
|
276
|
-
export declare const FilePicker: React.
|
|
276
|
+
export declare const FilePicker: React.MemoExoticComponent<React.ForwardRefExoticComponent<FilePickerProps & React.RefAttributes<FileBrowserHandle>>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@map-colonies/react-components",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.5",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"jest-enzyme": "^7.1.2",
|
|
94
94
|
"react-test-renderer": "^16.13.1"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "3c0fc22a8e42017e804bdc95c10d797eb898b7cb",
|
|
97
97
|
"jest": {
|
|
98
98
|
"coverageReporters": [
|
|
99
99
|
"text",
|
|
@@ -24,10 +24,10 @@ const OPTION_LIST_MIN_WIDTH = 100;
|
|
|
24
24
|
export interface IAutocompleteProps {
|
|
25
25
|
Component: React.ReactElement;
|
|
26
26
|
ComponentProps: Record<string, unknown>;
|
|
27
|
-
defaultValue: string;
|
|
27
|
+
defaultValue: string | undefined;
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
maxOptions: number;
|
|
30
|
-
onBlur: () => void;
|
|
30
|
+
onBlur: (evt: any) => void;
|
|
31
31
|
onChange: (val: string) => void;
|
|
32
32
|
onKeyDown: (evt: any) => void;
|
|
33
33
|
onRequestOptions: (val: string) => void;
|
|
@@ -50,7 +50,7 @@ export interface IAutocompleteProps {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const Autocomplete: React.FC<IAutocompleteProps> = (props) => {
|
|
53
|
-
const [recentValue, setRecentValue] = useState(props.defaultValue);
|
|
53
|
+
const [recentValue, setRecentValue] = useState(props.defaultValue ?? '');
|
|
54
54
|
const [enableSpaceRemovers, setEnableSpaceRemovers] = useState(false);
|
|
55
55
|
|
|
56
56
|
const [state, setState] = useState({
|
|
@@ -80,6 +80,16 @@ const Autocomplete: React.FC<IAutocompleteProps> = (props) => {
|
|
|
80
80
|
};
|
|
81
81
|
}, []);
|
|
82
82
|
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (typeof props.value !== 'undefined') {
|
|
85
|
+
setRecentValue(props.value);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (typeof props.defaultValue !== 'undefined') {
|
|
89
|
+
setRecentValue(props.defaultValue);
|
|
90
|
+
}
|
|
91
|
+
}, [props.value, props.defaultValue]);
|
|
92
|
+
|
|
83
93
|
useEffect(() => {
|
|
84
94
|
const { options } = props;
|
|
85
95
|
const { caret } = state;
|
|
@@ -599,23 +609,11 @@ const Autocomplete: React.FC<IAutocompleteProps> = (props) => {
|
|
|
599
609
|
...rest
|
|
600
610
|
} = props;
|
|
601
611
|
|
|
602
|
-
const stateValue = recentValue; //state.value;
|
|
603
|
-
|
|
604
612
|
const propagated: any = Object.assign({}, rest);
|
|
605
613
|
Object.keys(props).forEach((k) => {
|
|
606
614
|
delete (propagated as Record<string, unknown>)[k];
|
|
607
615
|
});
|
|
608
616
|
|
|
609
|
-
let val = '';
|
|
610
|
-
|
|
611
|
-
if (stateValue) {
|
|
612
|
-
val = stateValue;
|
|
613
|
-
} else if (defaultValue) {
|
|
614
|
-
val = defaultValue;
|
|
615
|
-
} else if (value !== undefined) {
|
|
616
|
-
val = value;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
617
|
return (
|
|
620
618
|
<>
|
|
621
619
|
{React.cloneElement(Component, {
|
|
@@ -624,7 +622,7 @@ const Autocomplete: React.FC<IAutocompleteProps> = (props) => {
|
|
|
624
622
|
onChange: handleChange,
|
|
625
623
|
onKeyDown: handleKeyDown,
|
|
626
624
|
ref: refInput,
|
|
627
|
-
value:
|
|
625
|
+
value: recentValue,
|
|
628
626
|
...propagated,
|
|
629
627
|
...ComponentProps,
|
|
630
628
|
})}
|
|
@@ -636,10 +634,10 @@ const Autocomplete: React.FC<IAutocompleteProps> = (props) => {
|
|
|
636
634
|
const defaultProps: IAutocompleteProps = {
|
|
637
635
|
Component: <textarea />,
|
|
638
636
|
ComponentProps: {},
|
|
639
|
-
defaultValue:
|
|
637
|
+
defaultValue: undefined,
|
|
640
638
|
disabled: false,
|
|
641
639
|
maxOptions: 6,
|
|
642
|
-
onBlur: () => {},
|
|
640
|
+
onBlur: (evt: any) => {},
|
|
643
641
|
onChange: (val: string) => {},
|
|
644
642
|
onKeyDown: (evt: any) => {},
|
|
645
643
|
onRequestOptions: (val: string) => {},
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Ellipsoid,
|
|
10
10
|
ConstantPositionProperty,
|
|
11
11
|
GeographicTilingScheme,
|
|
12
|
+
Cartographic,
|
|
12
13
|
} from 'cesium';
|
|
13
14
|
|
|
14
15
|
// PROXIED CLASSES
|
|
@@ -22,6 +23,8 @@ export class CesiumCartesian2 extends Cartesian2 {}
|
|
|
22
23
|
|
|
23
24
|
export class CesiumCartesian3 extends Cartesian3 {}
|
|
24
25
|
|
|
26
|
+
export class CesiumCartographic extends Cartographic {}
|
|
27
|
+
|
|
25
28
|
export class CesiumBoundingSphere extends BoundingSphere {}
|
|
26
29
|
|
|
27
30
|
export class CesiumEllipsoid extends Ellipsoid {}
|
|
@@ -34,3 +37,6 @@ export const CesiumVerticalOrigin = VerticalOrigin;
|
|
|
34
37
|
|
|
35
38
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
39
|
export const CesiumLabelStyle = LabelStyle;
|
|
40
|
+
|
|
41
|
+
// PROXIED FUNCTIONS
|
|
42
|
+
export { sampleTerrainMostDetailed as cesiumSampleTerrainMostDetailed } from 'cesium';
|
|
@@ -4,7 +4,8 @@ body[dir='rtl'] .chonky-fileListWrapper [class^='listContainer-'] {
|
|
|
4
4
|
|
|
5
5
|
body[dir='rtl']
|
|
6
6
|
.chonky-fileEntryClickableWrapper
|
|
7
|
-
[class^='listFileEntryProperty-']
|
|
7
|
+
[class^='listFileEntryProperty-'],
|
|
8
|
+
body[dir='rtl'] .chonky-navbarContainer {
|
|
8
9
|
direction: ltr !important;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -62,7 +62,7 @@ export interface FilePickerProps extends Partial<FileBrowserProps> {
|
|
|
62
62
|
locale?: SupportedLocales;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
export const FilePicker
|
|
65
|
+
export const FilePicker = React.memo(
|
|
66
66
|
React.forwardRef<FileBrowserHandle, FilePickerProps>(
|
|
67
67
|
(
|
|
68
68
|
{
|