@itwin/imodel-components-react 4.0.0-dev.3 → 4.0.0-dev.4
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 +91 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +17 -15
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +2 -2
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +12 -11
- package/lib/cjs/imodel-components-react/color/Swatch.scss +5 -4
- package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +4 -3
- package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +4 -3
- package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +7 -6
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +7 -6
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -3
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +3 -3
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +7 -8
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +5 -5
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +11 -9
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +19 -10
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +3 -8
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +6 -11
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +24 -22
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +15 -15
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +1 -1
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +17 -15
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +2 -2
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +12 -11
- package/lib/esm/imodel-components-react/color/Swatch.scss +5 -4
- package/lib/esm/imodel-components-react/editors/ColorEditor.scss +4 -3
- package/lib/esm/imodel-components-react/editors/WeightEditor.scss +4 -3
- package/lib/esm/imodel-components-react/lineweight/Swatch.scss +7 -6
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +7 -6
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -3
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +3 -3
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +7 -8
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +5 -5
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +11 -9
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +20 -11
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +3 -8
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +6 -11
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +24 -22
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +15 -15
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +1 -1
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/package.json +34 -26
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition, isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, } from "@itwin/core-frontend";
|
|
10
|
-
import {
|
|
10
|
+
import { Select } from "@itwin/core-react";
|
|
11
|
+
import { Checkbox, Input } from "@itwin/itwinui-react";
|
|
11
12
|
import { FormatPanel } from "./FormatPanel";
|
|
12
13
|
import { DeepCompare } from "@itwin/core-geometry";
|
|
13
14
|
function createTextInputFormatPropEditor(key, label, inProps, getString, setString, fireFormatChange) {
|
|
@@ -23,8 +24,8 @@ function createSelectFormatPropEditor(key, label, options, inProps, getString, s
|
|
|
23
24
|
const value = getString(inProps);
|
|
24
25
|
return (React.createElement(React.Fragment, { key: `${key}` },
|
|
25
26
|
React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
|
|
26
|
-
React.createElement(Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options,
|
|
27
|
-
const newProps = setString(inProps,
|
|
27
|
+
React.createElement(Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options, onChange: (e) => {
|
|
28
|
+
const newProps = setString(inProps, e.currentTarget.value);
|
|
28
29
|
fireFormatChange(newProps);
|
|
29
30
|
} })));
|
|
30
31
|
}
|
|
@@ -48,20 +49,21 @@ export function QuantityFormatPanel(props) {
|
|
|
48
49
|
const { quantityType, onFormatChange, ...otherProps } = props;
|
|
49
50
|
const [formatProps, setFormatProps] = React.useState();
|
|
50
51
|
const initialFormatProps = React.useRef();
|
|
51
|
-
const [persistenceUnit, setPersistenceUnit] = React.useState()
|
|
52
|
-
React.useEffect(() => {
|
|
53
|
-
const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
|
|
54
|
-
// istanbul ignore else
|
|
55
|
-
if (!initialFormatProps.current)
|
|
56
|
-
initialFormatProps.current = newFormatProps;
|
|
57
|
-
setFormatProps(newFormatProps);
|
|
52
|
+
const [persistenceUnit, setPersistenceUnit] = React.useState(() => {
|
|
58
53
|
const quantityTypeKey = getQuantityTypeKey(quantityType);
|
|
59
54
|
const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
|
|
60
55
|
// istanbul ignore else
|
|
61
56
|
if (quantityTypeDefinition)
|
|
62
|
-
|
|
57
|
+
return quantityTypeDefinition.persistenceUnit;
|
|
63
58
|
else
|
|
64
59
|
throw Error(`Unable to locate a quantity type with type ${quantityType}`);
|
|
60
|
+
});
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
|
|
63
|
+
// istanbul ignore else
|
|
64
|
+
if (!initialFormatProps.current)
|
|
65
|
+
initialFormatProps.current = newFormatProps;
|
|
66
|
+
setFormatProps(newFormatProps);
|
|
65
67
|
}, [quantityType]); // no dependencies defined as we want this to run on every render
|
|
66
68
|
// handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)
|
|
67
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -75,6 +77,13 @@ export function QuantityFormatPanel(props) {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}); // no dependencies defined as we want this to run on every render
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
const quantityTypeKey = getQuantityTypeKey(quantityType);
|
|
82
|
+
const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
|
|
83
|
+
// istanbul ignore else
|
|
84
|
+
if (quantityTypeDefinition)
|
|
85
|
+
setPersistenceUnit(quantityTypeDefinition.persistenceUnit);
|
|
86
|
+
}, [quantityType]);
|
|
78
87
|
const handleOnFormatChanged = React.useCallback(async (newProps) => {
|
|
79
88
|
setFormatProps(newProps);
|
|
80
89
|
onFormatChange && onFormatChange(newProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACuB,kBAAkB,EAAE,SAAS,EAAE,8BAA8B,EAAE,8BAA8B,EACzH,+BAA+B,EAAE,gCAAgC,GAClE,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,+BAA+B,CAAC,GAAW,EAAE,KAAa,EAAE,OAAoB,EACvF,SAAyC,EAAE,SAA6D,EAAE,gBAAiD;IAC3J,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,GAAG,EAAE;QAC3B,8BAAM,GAAG,EAAE,GAAG,GAAG,QAAQ,EAAE,SAAS,EAAE,cAAc,IAAG,KAAK,CAAQ;QACpE,oBAAC,KAA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B,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport {\r\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\r\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\r\n} from \"@itwin/core-frontend\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Checkbox, Input, Select } from \"@itwin/itwinui-react\";\r\nimport { FormatPanel } from \"./FormatPanel\";\r\nimport { DeepCompare } from \"@itwin/core-geometry\";\r\n\r\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n size=\"small\"\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n options={options}\r\n size={\"small\"}\r\n onChange={(newValue) => {\r\n const newProps = setString(inProps, newValue);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const isChecked = getBool(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\r\n checked={isChecked}\r\n onChange={(e) => {\r\n const newProps = setBool(inProps, e.target.checked);\r\n fireFormatChange(newProps);\r\n }} />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\r\n const compare = new DeepCompare();\r\n return compare.compare(obj1, obj2);\r\n}\r\n\r\n/** Properties of [[QuantityFormatPanel]] component.\r\n * @alpha\r\n */\r\nexport interface QuantityFormatPanelProps extends CommonProps {\r\n quantityType: QuantityTypeArg;\r\n onFormatChange?: (format: FormatProps) => void;\r\n /** props below are to be passed on to FormatPanel */\r\n showSample?: boolean;\r\n initialMagnitude?: number;\r\n enableMinimumProperties?: boolean;\r\n}\r\n\r\n/** Component to set properties that control Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\r\n const { quantityType, onFormatChange, ...otherProps } = props;\r\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\r\n const initialFormatProps = React.useRef<FormatProps>();\r\n\r\n const [persistenceUnit, setPersistenceUnit] = React.useState<UnitProps>();\r\n\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (!initialFormatProps.current)\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\r\n else\r\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\r\n }, [quantityType]); // no dependencies defined as we want this to run on every render\r\n\r\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (initialFormatProps.current && newFormatProps) {\r\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }\r\n }\r\n }); // no dependencies defined as we want this to run on every render\r\n\r\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onFormatChange && onFormatChange(newProps);\r\n }, [onFormatChange]);\r\n\r\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n return specs.map((spec, index) => {\r\n if (isCheckboxFormatPropEditorSpec(spec))\r\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\r\n if (isTextSelectFormatPropEditorSpec(spec))\r\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore else */\r\n if (isTextInputFormatPropEditorSpec(spec))\r\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore next */\r\n return <div key={index} />;\r\n });\r\n }, []);\r\n\r\n const providePrimaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.primaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideSecondaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideFormatSpec = React.useCallback(\r\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\r\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\r\n }, [quantityType]);\r\n\r\n return (\r\n <div className=\"components-quantityFormat-quantityPanel\">\r\n {persistenceUnit && formatProps &&\r\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\r\n initialFormat={formatProps}\r\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\r\n persistenceUnit={persistenceUnit}\r\n providePrimaryChildren={providePrimaryChildren}\r\n provideSecondaryChildren={provideSecondaryChildren}\r\n provideFormatSpec={provideFormatSpec}\r\n />}\r\n </div>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACuB,kBAAkB,EAAE,SAAS,EAAE,8BAA8B,EAAE,8BAA8B,EACzH,+BAA+B,EAAE,gCAAgC,GAClE,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,+BAA+B,CAAC,GAAW,EAAE,KAAa,EAAE,OAAoB,EACvF,SAAyC,EAAE,SAA6D,EAAE,gBAAiD;IAC3J,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,GAAG,EAAE;QAC3B,8BAAM,GAAG,EAAE,GAAG,GAAG,QAAQ,EAAE,SAAS,EAAE,cAAc,IAAG,KAAK,CAAQ;QACpE,oBAAC,KAAK,mBAAc,GAAG,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,SAAS,EACvD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAA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U,EAChE,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,SAAS,CAAC,iBAAiB,CAAC,aAAa,EACxD,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,wBAAwB,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport {\r\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\r\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\r\n} from \"@itwin/core-frontend\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps, Select } from \"@itwin/core-react\";\r\nimport { Checkbox, Input } from \"@itwin/itwinui-react\";\r\nimport { FormatPanel } from \"./FormatPanel\";\r\nimport { DeepCompare } from \"@itwin/core-geometry\";\r\n\r\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n size=\"small\"\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n {/* NEEDSWORK - unable to migrate this Select to iTwinUI because no menu items were found */}\r\n {/* eslint-disable-next-line deprecation/deprecation */}\r\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n options={options}\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const isChecked = getBool(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\r\n checked={isChecked}\r\n onChange={(e) => {\r\n const newProps = setBool(inProps, e.target.checked);\r\n fireFormatChange(newProps);\r\n }} />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\r\n const compare = new DeepCompare();\r\n return compare.compare(obj1, obj2);\r\n}\r\n\r\n/** Properties of [[QuantityFormatPanel]] component.\r\n * @alpha\r\n */\r\nexport interface QuantityFormatPanelProps extends CommonProps {\r\n quantityType: QuantityTypeArg;\r\n onFormatChange?: (format: FormatProps) => void;\r\n /** props below are to be passed on to FormatPanel */\r\n showSample?: boolean;\r\n initialMagnitude?: number;\r\n enableMinimumProperties?: boolean;\r\n}\r\n\r\n/** Component to set properties that control Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\r\n const { quantityType, onFormatChange, ...otherProps } = props;\r\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\r\n const initialFormatProps = React.useRef<FormatProps>();\r\n\r\n const [persistenceUnit, setPersistenceUnit] = React.useState(() => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n return quantityTypeDefinition.persistenceUnit;\r\n else\r\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\r\n });\r\n\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (!initialFormatProps.current)\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }, [quantityType]); // no dependencies defined as we want this to run on every render\r\n\r\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (initialFormatProps.current && newFormatProps) {\r\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }\r\n }\r\n }); // no dependencies defined as we want this to run on every render\r\n\r\n React.useEffect(() => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\r\n }, [quantityType]);\r\n\r\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onFormatChange && onFormatChange(newProps);\r\n }, [onFormatChange]);\r\n\r\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n return specs.map((spec, index) => {\r\n if (isCheckboxFormatPropEditorSpec(spec))\r\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\r\n if (isTextSelectFormatPropEditorSpec(spec))\r\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore else */\r\n if (isTextInputFormatPropEditorSpec(spec))\r\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore next */\r\n return <div key={index} />;\r\n });\r\n }, []);\r\n\r\n const providePrimaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.primaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideSecondaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideFormatSpec = React.useCallback(\r\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\r\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\r\n }, [quantityType]);\r\n\r\n return (\r\n <div className=\"components-quantityFormat-quantityPanel\">\r\n {persistenceUnit && formatProps &&\r\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\r\n initialFormat={formatProps}\r\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\r\n persistenceUnit={persistenceUnit}\r\n providePrimaryChildren={providePrimaryChildren}\r\n provideSecondaryChildren={provideSecondaryChildren}\r\n provideFormatSpec={provideFormatSpec}\r\n />}\r\n </div>\r\n );\r\n}\r\n"]}
|
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
justify-content: center;
|
|
13
13
|
font-size: 16px;
|
|
14
14
|
outline: none;
|
|
15
|
-
border-radius:
|
|
15
|
+
border-radius: 3px;
|
|
16
16
|
border: solid 1px $buic-background-5;
|
|
17
17
|
// background-image: linear-gradient(to bottom, $buic-background-1, $buic-background-2);
|
|
18
|
-
background-image: linear-gradient(
|
|
19
|
-
to bottom,
|
|
20
|
-
$buic-background-3,
|
|
21
|
-
$buic-background-3
|
|
22
|
-
),
|
|
23
|
-
linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
18
|
+
background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
24
19
|
color: $buic-foreground-body;
|
|
25
20
|
|
|
26
21
|
cursor: pointer;
|
|
@@ -28,4 +23,4 @@
|
|
|
28
23
|
&:hover {
|
|
29
24
|
color: $buic-foreground-activehover;
|
|
30
25
|
}
|
|
31
|
-
}
|
|
26
|
+
}
|
|
@@ -10,16 +10,11 @@ div.components-timeline-thumb.iui-slider-thumb {
|
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
|
-
background-image: linear-gradient(
|
|
14
|
-
to bottom,
|
|
15
|
-
$buic-background-3,
|
|
16
|
-
$buic-background-3
|
|
17
|
-
),
|
|
18
|
-
linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
13
|
+
background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
19
14
|
box-sizing: border-box;
|
|
20
15
|
width: 38px;
|
|
21
16
|
height: 20px;
|
|
22
|
-
border-radius:
|
|
17
|
+
border-radius: 4px;
|
|
23
18
|
border: 1px solid $buic-background-5;
|
|
24
19
|
transform: translateX(-19.2px);
|
|
25
20
|
top: 4px;
|
|
@@ -69,14 +64,14 @@ div.components-timeline-thumb.iui-slider-thumb {
|
|
|
69
64
|
position: absolute;
|
|
70
65
|
width: 38px;
|
|
71
66
|
height: 20px;
|
|
72
|
-
border-radius:
|
|
67
|
+
border-radius: 4px;
|
|
73
68
|
display: flex;
|
|
74
69
|
align-items: center;
|
|
75
70
|
justify-content: center;
|
|
76
71
|
box-sizing: border-box;
|
|
77
72
|
cursor: pointer;
|
|
78
73
|
|
|
79
|
-
>
|
|
74
|
+
>div {
|
|
80
75
|
width: 1px;
|
|
81
76
|
height: 10px;
|
|
82
77
|
opacity: 0.25;
|
|
@@ -106,7 +101,7 @@ div.components-timeline-thumb.iui-slider-thumb {
|
|
|
106
101
|
.date-marker-default {
|
|
107
102
|
height: 12px;
|
|
108
103
|
width: 3px;
|
|
109
|
-
border-radius:
|
|
104
|
+
border-radius: 4px;
|
|
110
105
|
transform: translateY(1px);
|
|
111
106
|
background-color: $buic-foreground-primary;
|
|
112
|
-
}
|
|
107
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
$top-position: 6px;
|
|
8
8
|
$bottom-position: 4px;
|
|
9
9
|
|
|
10
|
-
.solar-slider.solar-timeline
|
|
10
|
+
.solar-slider.solar-timeline>.iui-slider-container {
|
|
11
11
|
height: 28px;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -22,12 +22,12 @@ $bottom-position: 4px;
|
|
|
22
22
|
color: $buic-foreground-body;
|
|
23
23
|
font-size: 14px;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
>.header {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
28
|
position: relative;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
>.play-button {
|
|
31
31
|
width: 26px;
|
|
32
32
|
height: 26px;
|
|
33
33
|
background: inherit;
|
|
@@ -35,7 +35,7 @@ $bottom-position: 4px;
|
|
|
35
35
|
font-size: 20px;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
>.shadow-settings-button {
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
color: $buic-foreground-body;
|
|
@@ -56,7 +56,7 @@ $bottom-position: 4px;
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
>.current-date {
|
|
60
60
|
min-width: 175px;
|
|
61
61
|
margin-left: 8px;
|
|
62
62
|
margin-right: 4px;
|
|
@@ -69,32 +69,32 @@ $bottom-position: 4px;
|
|
|
69
69
|
font-size: 14px;
|
|
70
70
|
cursor: pointer;
|
|
71
71
|
|
|
72
|
-
>
|
|
72
|
+
>span:nth-child(2) {
|
|
73
73
|
margin: 0 6px;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
>.icon-calendar {
|
|
77
77
|
flex-grow: 1;
|
|
78
78
|
margin-left: auto;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
>.speed-container {
|
|
83
83
|
display: flex;
|
|
84
84
|
align-items: center;
|
|
85
85
|
margin-left: auto;
|
|
86
86
|
cursor: pointer;
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
>.speed {
|
|
89
89
|
margin-left: 12px;
|
|
90
90
|
width: 0;
|
|
91
91
|
opacity: 0;
|
|
92
|
-
transition: all
|
|
92
|
+
transition: all .2s linear;
|
|
93
93
|
margin-right: 10px;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
>.loop-playback {
|
|
98
98
|
color: $buic-foreground-primary;
|
|
99
99
|
font-size: 16px;
|
|
100
100
|
cursor: pointer;
|
|
@@ -108,7 +108,7 @@ $bottom-position: 4px;
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
>.no-loop-playback {
|
|
112
112
|
color: $buic-foreground-body;
|
|
113
113
|
font-size: 16px;
|
|
114
114
|
cursor: pointer;
|
|
@@ -172,14 +172,9 @@ $bottom-position: 4px;
|
|
|
172
172
|
z-index: 4;
|
|
173
173
|
width: 38px;
|
|
174
174
|
height: 20px;
|
|
175
|
-
border-radius:
|
|
175
|
+
border-radius: 3px;
|
|
176
176
|
border: 1px solid $buic-background-5;
|
|
177
|
-
background-image: linear-gradient(
|
|
178
|
-
to bottom,
|
|
179
|
-
$buic-background-3,
|
|
180
|
-
$buic-background-3
|
|
181
|
-
),
|
|
182
|
-
linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
177
|
+
background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
|
|
183
178
|
display: flex;
|
|
184
179
|
align-items: center;
|
|
185
180
|
justify-content: center;
|
|
@@ -187,7 +182,7 @@ $bottom-position: 4px;
|
|
|
187
182
|
transform: translate(-50%, -50%);
|
|
188
183
|
cursor: pointer;
|
|
189
184
|
|
|
190
|
-
>
|
|
185
|
+
>div {
|
|
191
186
|
width: 1px;
|
|
192
187
|
height: 10px;
|
|
193
188
|
opacity: 0.25;
|
|
@@ -225,10 +220,11 @@ $bottom-position: 4px;
|
|
|
225
220
|
color: #ffcf00;
|
|
226
221
|
margin: 0 24px 0 8px;
|
|
227
222
|
}
|
|
223
|
+
|
|
228
224
|
}
|
|
229
225
|
}
|
|
230
226
|
|
|
231
|
-
.solar-timeline-wrapper
|
|
227
|
+
.solar-timeline-wrapper>.header>.speed-container:hover>.speed {
|
|
232
228
|
opacity: 1;
|
|
233
229
|
width: 80px;
|
|
234
230
|
}
|
|
@@ -237,7 +233,7 @@ $bottom-position: 4px;
|
|
|
237
233
|
transform: rotate(180deg);
|
|
238
234
|
}
|
|
239
235
|
|
|
240
|
-
.solar-timeline-wrapper.expanded
|
|
236
|
+
.solar-timeline-wrapper.expanded>.header>.current-date {
|
|
241
237
|
margin-left: 70px;
|
|
242
238
|
}
|
|
243
239
|
|
|
@@ -254,6 +250,8 @@ $bottom-position: 4px;
|
|
|
254
250
|
height: 100px;
|
|
255
251
|
}
|
|
256
252
|
|
|
253
|
+
|
|
254
|
+
|
|
257
255
|
.shadow-settings-color-top {
|
|
258
256
|
display: inline;
|
|
259
257
|
}
|
|
@@ -354,3 +352,7 @@ $bottom-position: 4px;
|
|
|
354
352
|
border-color: #222 transparent transparent transparent;
|
|
355
353
|
}
|
|
356
354
|
}
|
|
355
|
+
|
|
356
|
+
.core-tooltip-tooltip.components-rail-tooltip {
|
|
357
|
+
pointer-events: none;
|
|
358
|
+
}
|
|
@@ -14,27 +14,27 @@
|
|
|
14
14
|
padding: 8px 16px;
|
|
15
15
|
min-width: 275px;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
>.header {
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
height: 38px;
|
|
21
21
|
position: relative;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
border-radius:
|
|
23
|
+
>.play-backward {
|
|
24
|
+
border-radius: 3px 0 0 3px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
>.play-button-step {
|
|
28
28
|
border-left: none;
|
|
29
29
|
border-right: none;
|
|
30
30
|
border-radius: 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
border-radius: 0px
|
|
33
|
+
>.play-forward {
|
|
34
|
+
border-radius: 0px 3px 3px 0;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
>.current-date {
|
|
38
38
|
font-size: 14px;
|
|
39
39
|
min-width: 180px;
|
|
40
40
|
padding: 8px;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
position: absolute;
|
|
43
43
|
left: 50%;
|
|
44
44
|
transform: translateX(-50%);
|
|
45
|
-
border-radius:
|
|
45
|
+
border-radius: 3px;
|
|
46
46
|
border: solid 1px $buic-background-5;
|
|
47
47
|
background-color: $buic-background-1;
|
|
48
48
|
text-align: center;
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
margin-right: 10px;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
>.timeline-timeline {
|
|
61
61
|
margin: 8px 0;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
>.scrubber {
|
|
65
65
|
min-height: 20px;
|
|
66
66
|
display: flex;
|
|
67
67
|
align-items: center;
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
.timeline-component.has-dates .start-time-container {
|
|
131
|
-
margin-right: 8px
|
|
131
|
+
margin-right: 8px
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.timeline-component.has-dates .end-time-container {
|
|
135
|
-
margin-left: 8px
|
|
135
|
+
margin-left: 8px
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
.timeline-component.minimized .header,
|
|
@@ -147,11 +147,11 @@
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
.separator {
|
|
150
|
-
padding:
|
|
150
|
+
padding: .5em 0;
|
|
151
151
|
position: relative;
|
|
152
152
|
|
|
153
153
|
&:before {
|
|
154
|
-
content:
|
|
154
|
+
content: '';
|
|
155
155
|
position: absolute;
|
|
156
156
|
top: 50%;
|
|
157
157
|
left: 4px;
|
|
@@ -161,4 +161,4 @@
|
|
|
161
161
|
background: #dce0e3;
|
|
162
162
|
transform: translateY(-50%);
|
|
163
163
|
}
|
|
164
|
-
}
|
|
164
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAsCH;;GAEG;AACH,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,iBAAiB;IACjB,mDAAK,CAAA;IACL,oBAAoB;IACpB,yDAAQ,CAAA;IACR,kBAAkB;IAClB,qDAAM,CAAA;IACN,gBAAgB;IAChB,iDAAI,CAAA;IACJ,iBAAiB;IACjB,mDAAK,CAAA;AACP,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,qDAAqD;IACrD,yEAAU,CAAA;IACV,sEAAsE;IACtE,2EAAW,CAAA;AACb,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAoCD;;GAEG;AACH,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,qEAAI,CAAA;AACN,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Timeline\r\n */\r\n\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { GenericUiEventArgs } from \"@itwin/appui-abstract\";\r\n\r\n/**\r\n * A range of time which can be used to focus in on activities scheduled around a milestone.\r\n * @public\r\n */\r\nexport interface MilestoneRange {\r\n start: Date;\r\n end: Date;\r\n}\r\n\r\n/**\r\n * A Milestone event that is to be noted in the timeline.\r\n * @internal\r\n * @deprecated
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/interfaces.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAsCH;;GAEG;AACH,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,iBAAiB;IACjB,mDAAK,CAAA;IACL,oBAAoB;IACpB,yDAAQ,CAAA;IACR,kBAAkB;IAClB,qDAAM,CAAA;IACN,gBAAgB;IAChB,iDAAI,CAAA;IACJ,iBAAiB;IACjB,mDAAK,CAAA;AACP,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,qDAAqD;IACrD,yEAAU,CAAA;IACV,sEAAsE;IACtE,2EAAW,CAAA;AACb,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAoCD;;GAEG;AACH,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,qEAAI,CAAA;AACN,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Timeline\r\n */\r\n\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { GenericUiEventArgs } from \"@itwin/appui-abstract\";\r\n\r\n/**\r\n * A range of time which can be used to focus in on activities scheduled around a milestone.\r\n * @public\r\n */\r\nexport interface MilestoneRange {\r\n start: Date;\r\n end: Date;\r\n}\r\n\r\n/**\r\n * A Milestone event that is to be noted in the timeline.\r\n * @internal\r\n * @deprecated in 3.0.\r\n */\r\nexport interface Milestone {\r\n /** uniqueId of milestone */\r\n id: string;\r\n /** milestone date */\r\n date: Date;\r\n parentId?: string;\r\n /** Milestone label that is display if space allows */\r\n label?: string;\r\n /** Milestone description that is show as tooltip */\r\n description?: string;\r\n /** animation range that includes milestone */\r\n range?: MilestoneRange;\r\n /** Set to true if read only. */\r\n readonly?: boolean;\r\n // eslint-disable-next-line deprecation/deprecation\r\n children?: Milestone[];\r\n}\r\n\r\n/** The timeline scale.\r\n * @public\r\n */\r\nexport enum TimelineScale {\r\n /** Show years */\r\n Years,\r\n /** Show quarters */\r\n Quarters,\r\n /** Show months */\r\n Months,\r\n /** Show days */\r\n Days,\r\n /** Show hours */\r\n Hours,\r\n}\r\n\r\n/** Determines if data displayed to use is the actual date or the amount of time elapsed since project start.\r\n * @public\r\n */\r\nexport enum TimelineDateDisplay {\r\n /** Display time axis using actual start/end dates */\r\n ActualTime,\r\n /** Display time axis using time relative to actual start/end dates */\r\n ProjectTime,\r\n}\r\n\r\n/**\r\n * Playback Settings.\r\n * @public\r\n */\r\nexport interface PlaybackSettings {\r\n /** time in milliseconds to play animation from start date to end date */\r\n duration?: number;\r\n /** Set to True if animation to restart each time playbackEnd is reached. Defaults to false. */\r\n loop?: boolean;\r\n /** If true a minimal set of data is displayed. */\r\n minimized?: boolean;\r\n /** Playback start. If defined must be within start-end range. If not define 'start' is used. */\r\n playbackStart?: Date;\r\n /** Playback end. If defined must be within start-end range and later than playbackStart. If not define 'end' is used. */\r\n playbackEnd?: Date;\r\n /** Set to True if user should be allowed to insert milestone dates. Defaults to false */\r\n allowMilestoneEdits?: boolean;\r\n /** Define if actual date/times are used or date/times relative to project are used to draw timeline axis. */\r\n dateDisplay?: TimelineDateDisplay;\r\n}\r\n\r\n/**\r\n * An interface used to notify Handlers of the current pointer position in the timeline playback. Valid range is 0 to 1 and it determines percentage complete.\r\n * @public\r\n */\r\nexport type AnimationFractionChangeHandler = (animationFraction: number) => void;\r\n\r\n/**\r\n * An interface used to notify Handlers of Playback Settings changes.\r\n * Contains the settings to be used.\r\n * @public\r\n */\r\nexport type PlaybackSettingsChangeHandler = (settingsChange: PlaybackSettings) => void;\r\n\r\n/** Actions for Pause/Play event\r\n * @public\r\n */\r\nexport enum TimelinePausePlayAction {\r\n Toggle,\r\n Pause,\r\n Play,\r\n}\r\n/** Args for event to pause or play the timeline component\r\n * @public\r\n */\r\nexport interface TimelinePausePlayArgs extends GenericUiEventArgs {\r\n timelineAction: TimelinePausePlayAction;\r\n}\r\n/** Interface for a timeline data provider class\r\n * @public\r\n */\r\nexport interface TimelineDataProvider {\r\n /** uniqueId of provider */\r\n id: string;\r\n /** view id when viewport is initially assigned */\r\n viewId: string;\r\n /** returns true if the provider has timeline animation data available */\r\n supportsTimelineAnimation: boolean;\r\n /** Starting date for entire timeline */\r\n start?: Date;\r\n /** End date for entire timeline */\r\n end?: Date;\r\n /** Current animation fraction from 0.0 to 1.0 */\r\n animationFraction?: number;\r\n getSettings(): PlaybackSettings;\r\n /** Called to get the initial scrubber location. This must be a value between 0 and the duration in PlaybackSettings. */\r\n initialDuration: number;\r\n /** Called to get the duration of the Playback. */\r\n duration: number;\r\n /** If true the playback will continuously loop. */\r\n loop: boolean;\r\n /** Called to save the playback settings */\r\n updateSettings(settings: PlaybackSettings): void;\r\n /** Async call to load milestone and settings data */\r\n loadTimelineData(): Promise<boolean>;\r\n /** Called when an internal process has defined the playback settings and the UI needs to be updated */\r\n onPlaybackSettingChanged?: PlaybackSettingsChangeHandler;\r\n /** Called when the an internal process has defined the playback settings and the UI needs to be updated */\r\n onAnimationFractionChanged?: AnimationFractionChangeHandler;\r\n /** viewport to show animation */\r\n viewport?: ScreenViewport;\r\n}\r\n\r\n/**\r\n * An interface used to notify Handlers of Playback progress.\r\n * Contains the settings to be used.\r\n * @alpha\r\n */\r\nexport type SolarPlaybackProgressHandler = (time: Date) => void;\r\n\r\n/** Data Provider interface for getting and setting solar position\r\n * @alpha\r\n */\r\nexport interface SolarDataProvider {\r\n // View Id used to determine sunrise and sunset\r\n viewId: string;\r\n /** returns true if the provider has timeline animation data available */\r\n supportsTimelineAnimation: boolean;\r\n // set to true is timeline should be shown - return false if view is not set to display shadow.\r\n readonly shouldShowTimeline: boolean;\r\n /** Starting date for entire timeline */\r\n day: Date;\r\n /** Starting time for day in milliseconds */\r\n readonly dayStartMs: number;\r\n /** Time of day for sun */\r\n readonly timeOfDay: Date;\r\n /** Called during playback to update animation */\r\n onTimeChanged?: SolarPlaybackProgressHandler;\r\n /** viewport to show animation */\r\n viewport?: ScreenViewport;\r\n /** Time of Sunrise to nearest minute */\r\n readonly sunrise: Date;\r\n /** time of Sunrise to nearest minute */\r\n readonly sunset: Date;\r\n /** shadow color */\r\n shadowColor: ColorDef;\r\n /** timezone offset for local project time */\r\n readonly timeZoneOffset: number;\r\n /** set date for shadow study. If isProjectDate is false the is assume to be in users\r\n * current time and the value is adjusted to be the same date and time at the project location. */\r\n setDateAndTime: (day: Date, isProjectDate?: boolean) => void;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.4",
|
|
4
4
|
"description": "iTwin.js UI IModel Components",
|
|
5
5
|
"main": "lib/cjs/imodel-components-react.js",
|
|
6
6
|
"module": "lib/esm/imodel-components-react.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/iTwin/
|
|
11
|
+
"url": "https://github.com/iTwin/itwinjs-core/tree/master/ui/imodel-components-react"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"Bentley",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"url": "http://www.bentley.com"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@itwin/appui-abstract": "^4.0.0-dev.
|
|
24
|
-
"@itwin/components-react": "^4.0.0-dev.
|
|
25
|
-
"@itwin/core-bentley": "^
|
|
26
|
-
"@itwin/core-common": "^
|
|
27
|
-
"@itwin/core-frontend": "^
|
|
28
|
-
"@itwin/core-geometry": "^
|
|
29
|
-
"@itwin/core-quantity": "^
|
|
30
|
-
"@itwin/core-react": "^4.0.0-dev.
|
|
23
|
+
"@itwin/appui-abstract": "^4.0.0-dev.4",
|
|
24
|
+
"@itwin/components-react": "^4.0.0-dev.4",
|
|
25
|
+
"@itwin/core-bentley": "^4.0.0-dev.4",
|
|
26
|
+
"@itwin/core-common": "^4.0.0-dev.4",
|
|
27
|
+
"@itwin/core-frontend": "^4.0.0-dev.4",
|
|
28
|
+
"@itwin/core-geometry": "^4.0.0-dev.4",
|
|
29
|
+
"@itwin/core-quantity": "^4.0.0-dev.4",
|
|
30
|
+
"@itwin/core-react": "^4.0.0-dev.4",
|
|
31
31
|
"react": "^17.0.0",
|
|
32
32
|
"react-dom": "^17.0.0"
|
|
33
33
|
},
|
|
@@ -36,27 +36,28 @@
|
|
|
36
36
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@itwin/appui-abstract": "4.0.0-dev.
|
|
40
|
-
"@itwin/build-tools": "
|
|
41
|
-
"@itwin/components-react": "4.0.0-dev.
|
|
42
|
-
"@itwin/core-bentley": "
|
|
43
|
-
"@itwin/core-common": "
|
|
44
|
-
"@itwin/core-frontend": "
|
|
45
|
-
"@itwin/core-geometry": "
|
|
46
|
-
"@itwin/core-
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/
|
|
49
|
-
"@itwin/eslint-plugin": "^3.5.1",
|
|
50
|
-
"@itwin/webgl-compatibility": "^3.5.1",
|
|
39
|
+
"@itwin/appui-abstract": "4.0.0-dev.4",
|
|
40
|
+
"@itwin/build-tools": "4.0.0-dev.4",
|
|
41
|
+
"@itwin/components-react": "4.0.0-dev.4",
|
|
42
|
+
"@itwin/core-bentley": "4.0.0-dev.4",
|
|
43
|
+
"@itwin/core-common": "4.0.0-dev.4",
|
|
44
|
+
"@itwin/core-frontend": "4.0.0-dev.4",
|
|
45
|
+
"@itwin/core-geometry": "4.0.0-dev.4",
|
|
46
|
+
"@itwin/core-quantity": "4.0.0-dev.4",
|
|
47
|
+
"@itwin/core-react": "4.0.0-dev.4",
|
|
48
|
+
"@itwin/eslint-plugin": "4.0.0-dev.4",
|
|
51
49
|
"@testing-library/dom": "^8.11.2",
|
|
52
50
|
"@testing-library/react": "^12.0.0",
|
|
53
51
|
"@testing-library/react-hooks": "^7.0.2",
|
|
54
52
|
"@testing-library/user-event": "^14.4.2",
|
|
55
53
|
"@types/chai": "4.3.1",
|
|
56
54
|
"@types/chai-as-promised": "^7",
|
|
55
|
+
"@types/chai-jest-snapshot": "^1.3.0",
|
|
57
56
|
"@types/chai-spies": "^1.0.0",
|
|
58
57
|
"@types/chai-string": "^1.4.1",
|
|
58
|
+
"@types/enzyme": "3.9.3",
|
|
59
59
|
"@types/faker": "^4.1.0",
|
|
60
|
+
"@types/lodash": "^4.14.0",
|
|
60
61
|
"@types/mocha": "^8.2.2",
|
|
61
62
|
"@types/node": "18.11.5",
|
|
62
63
|
"@types/react": "^17.0.37",
|
|
@@ -65,9 +66,13 @@
|
|
|
65
66
|
"@types/sinon-chai": "^3.2.0",
|
|
66
67
|
"chai": "^4.1.2",
|
|
67
68
|
"chai-as-promised": "^7",
|
|
69
|
+
"chai-jest-snapshot": "^2.0.0",
|
|
68
70
|
"chai-spies": "1.0.0",
|
|
69
71
|
"chai-string": "^1.5.0",
|
|
70
72
|
"cpx2": "^3.0.0",
|
|
73
|
+
"enzyme": "3.10.0",
|
|
74
|
+
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
|
75
|
+
"enzyme-to-json": "^3.3.4",
|
|
71
76
|
"eslint": "^7.11.0",
|
|
72
77
|
"faker": "^4.1.0",
|
|
73
78
|
"ignore-styles": "^5.0.1",
|
|
@@ -94,10 +99,13 @@
|
|
|
94
99
|
"dependencies": {
|
|
95
100
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
96
101
|
"@itwin/itwinui-css": "0.x",
|
|
97
|
-
"@itwin/itwinui-
|
|
98
|
-
"
|
|
99
|
-
"classnames": "2.3.1",
|
|
100
|
-
"
|
|
102
|
+
"@itwin/itwinui-react": "~1.46.0",
|
|
103
|
+
"callable-instance2": "1.0.0",
|
|
104
|
+
"classnames": "^2.3.1",
|
|
105
|
+
"eventemitter2": "^5.0.1",
|
|
106
|
+
"immer": "9.0.6",
|
|
107
|
+
"immutable": "^3.8.2",
|
|
108
|
+
"ts-key-enum": "^2.0.0"
|
|
101
109
|
},
|
|
102
110
|
"nyc": {
|
|
103
111
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|