@itwin/imodel-components-react 4.0.0-dev.8 → 4.0.0-dev.9
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 +1 -91
- 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 +15 -17
- 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 +11 -12
- package/lib/cjs/imodel-components-react/color/Swatch.scss +4 -5
- package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +3 -4
- package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +3 -4
- package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +6 -7
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +6 -7
- 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 +8 -7
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +5 -5
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +9 -11
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +10 -19
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +8 -3
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +11 -6
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +22 -24
- 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 +15 -17
- 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 +11 -12
- package/lib/esm/imodel-components-react/color/Swatch.scss +4 -5
- package/lib/esm/imodel-components-react/editors/ColorEditor.scss +3 -4
- package/lib/esm/imodel-components-react/editors/WeightEditor.scss +3 -4
- package/lib/esm/imodel-components-react/lineweight/Swatch.scss +6 -7
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +6 -7
- 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 +8 -7
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +5 -5
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +9 -11
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +11 -20
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +8 -3
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +11 -6
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +22 -24
- 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 +31 -38
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition, isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, } from "@itwin/core-frontend";
|
|
10
|
-
import { Select } from "@itwin/
|
|
11
|
-
import { Checkbox, Input } from "@itwin/itwinui-react";
|
|
10
|
+
import { Checkbox, Input, Select } from "@itwin/itwinui-react";
|
|
12
11
|
import { FormatPanel } from "./FormatPanel";
|
|
13
12
|
import { DeepCompare } from "@itwin/core-geometry";
|
|
14
13
|
function createTextInputFormatPropEditor(key, label, inProps, getString, setString, fireFormatChange) {
|
|
@@ -24,8 +23,8 @@ function createSelectFormatPropEditor(key, label, options, inProps, getString, s
|
|
|
24
23
|
const value = getString(inProps);
|
|
25
24
|
return (React.createElement(React.Fragment, { key: `${key}` },
|
|
26
25
|
React.createElement("span", { key: `${key}-label`, className: "uicore-label" }, label),
|
|
27
|
-
React.createElement(Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options, onChange: (
|
|
28
|
-
const newProps = setString(inProps,
|
|
26
|
+
React.createElement(Select, { "data-testid": `${key}-editor`, key: `${key}-editor`, value: value, options: options, size: "small", onChange: (newValue) => {
|
|
27
|
+
const newProps = setString(inProps, newValue);
|
|
29
28
|
fireFormatChange(newProps);
|
|
30
29
|
} })));
|
|
31
30
|
}
|
|
@@ -49,21 +48,20 @@ export function QuantityFormatPanel(props) {
|
|
|
49
48
|
const { quantityType, onFormatChange, ...otherProps } = props;
|
|
50
49
|
const [formatProps, setFormatProps] = React.useState();
|
|
51
50
|
const initialFormatProps = React.useRef();
|
|
52
|
-
const [persistenceUnit, setPersistenceUnit] = React.useState(
|
|
53
|
-
const quantityTypeKey = getQuantityTypeKey(quantityType);
|
|
54
|
-
const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
|
|
55
|
-
// istanbul ignore else
|
|
56
|
-
if (quantityTypeDefinition)
|
|
57
|
-
return quantityTypeDefinition.persistenceUnit;
|
|
58
|
-
else
|
|
59
|
-
throw Error(`Unable to locate a quantity type with type ${quantityType}`);
|
|
60
|
-
});
|
|
51
|
+
const [persistenceUnit, setPersistenceUnit] = React.useState();
|
|
61
52
|
React.useEffect(() => {
|
|
62
53
|
const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);
|
|
63
54
|
// istanbul ignore else
|
|
64
55
|
if (!initialFormatProps.current)
|
|
65
56
|
initialFormatProps.current = newFormatProps;
|
|
66
57
|
setFormatProps(newFormatProps);
|
|
58
|
+
const quantityTypeKey = getQuantityTypeKey(quantityType);
|
|
59
|
+
const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);
|
|
60
|
+
// istanbul ignore else
|
|
61
|
+
if (quantityTypeDefinition)
|
|
62
|
+
setPersistenceUnit(quantityTypeDefinition.persistenceUnit);
|
|
63
|
+
else
|
|
64
|
+
throw Error(`Unable to locate a quantity type with type ${quantityType}`);
|
|
67
65
|
}, [quantityType]); // no dependencies defined as we want this to run on every render
|
|
68
66
|
// handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)
|
|
69
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -77,13 +75,6 @@ export function QuantityFormatPanel(props) {
|
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
77
|
}); // 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]);
|
|
87
78
|
const handleOnFormatChanged = React.useCallback(async (newProps) => {
|
|
88
79
|
setFormatProps(newProps);
|
|
89
80
|
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;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,E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AC,WAAW,CACzC,KAAK,EAAE,OAAoB,EAAE,gBAA2B,EAAE,cAA6B,EAAE,EAAE;QACzF,OAAO,SAAS,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,WAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,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"]}
|
|
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;AA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AAC;IAE9C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,KAAK,EAAE,OAAoB,EAAE,gBAA2B,EAAE,cAA6B,EAAE,EAAE;QACzF,OAAO,SAAS,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,WAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,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 } 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"]}
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
justify-content: center;
|
|
13
13
|
font-size: 16px;
|
|
14
14
|
outline: none;
|
|
15
|
-
border-radius:
|
|
15
|
+
border-radius: var(--iui-border-radius-1);
|
|
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(
|
|
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);
|
|
19
24
|
color: $buic-foreground-body;
|
|
20
25
|
|
|
21
26
|
cursor: pointer;
|
|
@@ -23,4 +28,4 @@
|
|
|
23
28
|
&:hover {
|
|
24
29
|
color: $buic-foreground-activehover;
|
|
25
30
|
}
|
|
26
|
-
}
|
|
31
|
+
}
|
|
@@ -10,11 +10,16 @@ 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(
|
|
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);
|
|
14
19
|
box-sizing: border-box;
|
|
15
20
|
width: 38px;
|
|
16
21
|
height: 20px;
|
|
17
|
-
border-radius:
|
|
22
|
+
border-radius: var(--iui-border-radius-1);
|
|
18
23
|
border: 1px solid $buic-background-5;
|
|
19
24
|
transform: translateX(-19.2px);
|
|
20
25
|
top: 4px;
|
|
@@ -64,14 +69,14 @@ div.components-timeline-thumb.iui-slider-thumb {
|
|
|
64
69
|
position: absolute;
|
|
65
70
|
width: 38px;
|
|
66
71
|
height: 20px;
|
|
67
|
-
border-radius:
|
|
72
|
+
border-radius: var(--iui-border-radius-1);
|
|
68
73
|
display: flex;
|
|
69
74
|
align-items: center;
|
|
70
75
|
justify-content: center;
|
|
71
76
|
box-sizing: border-box;
|
|
72
77
|
cursor: pointer;
|
|
73
78
|
|
|
74
|
-
>div {
|
|
79
|
+
> div {
|
|
75
80
|
width: 1px;
|
|
76
81
|
height: 10px;
|
|
77
82
|
opacity: 0.25;
|
|
@@ -101,7 +106,7 @@ div.components-timeline-thumb.iui-slider-thumb {
|
|
|
101
106
|
.date-marker-default {
|
|
102
107
|
height: 12px;
|
|
103
108
|
width: 3px;
|
|
104
|
-
border-radius:
|
|
109
|
+
border-radius: var(--iui-border-radius-1);
|
|
105
110
|
transform: translateY(1px);
|
|
106
111
|
background-color: $buic-foreground-primary;
|
|
107
|
-
}
|
|
112
|
+
}
|
|
@@ -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
|
-
>span:nth-child(2) {
|
|
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 .2s linear;
|
|
92
|
+
transition: all 0.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,9 +172,14 @@ $bottom-position: 4px;
|
|
|
172
172
|
z-index: 4;
|
|
173
173
|
width: 38px;
|
|
174
174
|
height: 20px;
|
|
175
|
-
border-radius:
|
|
175
|
+
border-radius: var(--iui-border-radius-1);
|
|
176
176
|
border: 1px solid $buic-background-5;
|
|
177
|
-
background-image: linear-gradient(
|
|
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);
|
|
178
183
|
display: flex;
|
|
179
184
|
align-items: center;
|
|
180
185
|
justify-content: center;
|
|
@@ -182,7 +187,7 @@ $bottom-position: 4px;
|
|
|
182
187
|
transform: translate(-50%, -50%);
|
|
183
188
|
cursor: pointer;
|
|
184
189
|
|
|
185
|
-
>div {
|
|
190
|
+
> div {
|
|
186
191
|
width: 1px;
|
|
187
192
|
height: 10px;
|
|
188
193
|
opacity: 0.25;
|
|
@@ -220,11 +225,10 @@ $bottom-position: 4px;
|
|
|
220
225
|
color: #ffcf00;
|
|
221
226
|
margin: 0 24px 0 8px;
|
|
222
227
|
}
|
|
223
|
-
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
230
|
|
|
227
|
-
.solar-timeline-wrapper
|
|
231
|
+
.solar-timeline-wrapper > .header > .speed-container:hover > .speed {
|
|
228
232
|
opacity: 1;
|
|
229
233
|
width: 80px;
|
|
230
234
|
}
|
|
@@ -233,7 +237,7 @@ $bottom-position: 4px;
|
|
|
233
237
|
transform: rotate(180deg);
|
|
234
238
|
}
|
|
235
239
|
|
|
236
|
-
.solar-timeline-wrapper.expanded
|
|
240
|
+
.solar-timeline-wrapper.expanded > .header > .current-date {
|
|
237
241
|
margin-left: 70px;
|
|
238
242
|
}
|
|
239
243
|
|
|
@@ -250,8 +254,6 @@ $bottom-position: 4px;
|
|
|
250
254
|
height: 100px;
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
|
|
254
|
-
|
|
255
257
|
.shadow-settings-color-top {
|
|
256
258
|
display: inline;
|
|
257
259
|
}
|
|
@@ -352,7 +354,3 @@ $bottom-position: 4px;
|
|
|
352
354
|
border-color: #222 transparent transparent transparent;
|
|
353
355
|
}
|
|
354
356
|
}
|
|
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: var(--iui-border-radius-1) 0 0 var(--iui-border-radius-1);
|
|
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 var(--iui-border-radius-1) var(--iui-border-radius-1) 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: var(--iui-border-radius-1);
|
|
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: .5em 0;
|
|
150
|
+
padding: 0.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\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.9",
|
|
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/appui/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.9",
|
|
24
|
+
"@itwin/components-react": "^4.0.0-dev.9",
|
|
25
|
+
"@itwin/core-bentley": "^3.5.1",
|
|
26
|
+
"@itwin/core-common": "^3.5.1",
|
|
27
|
+
"@itwin/core-frontend": "^3.5.1",
|
|
28
|
+
"@itwin/core-geometry": "^3.5.1",
|
|
29
|
+
"@itwin/core-quantity": "^3.5.1",
|
|
30
|
+
"@itwin/core-react": "^4.0.0-dev.9",
|
|
31
31
|
"react": "^17.0.0",
|
|
32
32
|
"react-dom": "^17.0.0"
|
|
33
33
|
},
|
|
@@ -36,28 +36,27 @@
|
|
|
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/
|
|
39
|
+
"@itwin/appui-abstract": "4.0.0-dev.9",
|
|
40
|
+
"@itwin/build-tools": "^3.5.1",
|
|
41
|
+
"@itwin/components-react": "4.0.0-dev.9",
|
|
42
|
+
"@itwin/core-bentley": "^3.5.1",
|
|
43
|
+
"@itwin/core-common": "^3.5.1",
|
|
44
|
+
"@itwin/core-frontend": "^3.5.1",
|
|
45
|
+
"@itwin/core-geometry": "^3.5.1",
|
|
46
|
+
"@itwin/core-orbitgt": "^3.5.1",
|
|
47
|
+
"@itwin/core-quantity": "^3.5.1",
|
|
48
|
+
"@itwin/core-react": "4.0.0-dev.9",
|
|
49
|
+
"@itwin/eslint-plugin": "^3.5.1",
|
|
50
|
+
"@itwin/webgl-compatibility": "^3.5.1",
|
|
49
51
|
"@testing-library/dom": "^8.11.2",
|
|
50
52
|
"@testing-library/react": "^12.0.0",
|
|
51
53
|
"@testing-library/react-hooks": "^7.0.2",
|
|
52
54
|
"@testing-library/user-event": "^14.4.2",
|
|
53
55
|
"@types/chai": "4.3.1",
|
|
54
56
|
"@types/chai-as-promised": "^7",
|
|
55
|
-
"@types/chai-jest-snapshot": "^1.3.0",
|
|
56
57
|
"@types/chai-spies": "^1.0.0",
|
|
57
58
|
"@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",
|
|
61
60
|
"@types/mocha": "^8.2.2",
|
|
62
61
|
"@types/node": "18.11.5",
|
|
63
62
|
"@types/react": "^17.0.37",
|
|
@@ -66,13 +65,9 @@
|
|
|
66
65
|
"@types/sinon-chai": "^3.2.0",
|
|
67
66
|
"chai": "^4.1.2",
|
|
68
67
|
"chai-as-promised": "^7",
|
|
69
|
-
"chai-jest-snapshot": "^2.0.0",
|
|
70
68
|
"chai-spies": "1.0.0",
|
|
71
69
|
"chai-string": "^1.5.0",
|
|
72
70
|
"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",
|
|
76
71
|
"eslint": "^7.11.0",
|
|
77
72
|
"faker": "^4.1.0",
|
|
78
73
|
"ignore-styles": "^5.0.1",
|
|
@@ -99,13 +94,10 @@
|
|
|
99
94
|
"dependencies": {
|
|
100
95
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
101
96
|
"@itwin/itwinui-css": "0.x",
|
|
102
|
-
"@itwin/itwinui-
|
|
103
|
-
"
|
|
104
|
-
"classnames": "
|
|
105
|
-
"
|
|
106
|
-
"immer": "9.0.6",
|
|
107
|
-
"immutable": "^3.8.2",
|
|
108
|
-
"ts-key-enum": "^2.0.0"
|
|
97
|
+
"@itwin/itwinui-variables": "^1.0.0",
|
|
98
|
+
"@itwin/itwinui-react": "~1.42.0",
|
|
99
|
+
"classnames": "2.3.1",
|
|
100
|
+
"immer": "9.0.6"
|
|
109
101
|
},
|
|
110
102
|
"nyc": {
|
|
111
103
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|
|
@@ -131,8 +123,7 @@
|
|
|
131
123
|
]
|
|
132
124
|
},
|
|
133
125
|
"scripts": {
|
|
134
|
-
"build": "npm run -s copy:locale && npm run -s build:cjs",
|
|
135
|
-
"build:ci": "npm run -s build && npm run -s build:esm",
|
|
126
|
+
"build": "npm run -s copy:locale && npm run -s build:cjs && npm run -s build:esm",
|
|
136
127
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs && npm run -s copy:cjs",
|
|
137
128
|
"build:esm": "tsc 1>&2 --module ES2020 --outDir lib/esm && npm run -s copy:esm",
|
|
138
129
|
"copy:locale": "cpx \"./public/**/*\" ./lib/public",
|
|
@@ -141,11 +132,13 @@
|
|
|
141
132
|
"pseudolocalize": "betools pseudolocalize --englishDir ./public/locales/en --out ./public/locales/en-PSEUDO",
|
|
142
133
|
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
143
134
|
"cover": "nyc npm -s test",
|
|
144
|
-
"docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/ui/imodel-components-react/file.json --tsIndexFile=./imodel-components-react.ts --onlyJson",
|
|
145
135
|
"lint": "eslint -f visualstudio \"./src/**/*.{ts,tsx}\" 1>&2",
|
|
146
136
|
"extract-api": "betools extract-api --entry=imodel-components-react",
|
|
147
137
|
"test": "mocha --config ../.mocharc.json \"./lib/cjs/test/**/*.test.js\"",
|
|
148
|
-
"test:watch": "npm -s test -- --reporter min --watch-extensions ts,tsx --watch"
|
|
138
|
+
"test:watch": "npm -s test -- --reporter min --watch-extensions ts,tsx --watch",
|
|
139
|
+
"docs": "npm run -s docs:reference && npm run -s docs:changelog",
|
|
140
|
+
"docs:changelog": "cpx ./CHANGELOG.md ../../generated-docs/ui/imodel-components-react",
|
|
141
|
+
"docs:reference": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/ui/imodel-components-react/file.json --tsIndexFile=./imodel-components-react.ts --onlyJson"
|
|
149
142
|
},
|
|
150
143
|
"readme": "# @itwin/imodel-components-react\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe __@itwin/imodel-components-react__ package contains React components that depend on the imodeljs-frontend, imodeljs-common or imodeljs-quantity packages.\r\n\r\n## Documentation\r\n\r\nSee the [iTwin.js](https://www.itwinjs.org) documentation for more information.\r\n"
|
|
151
144
|
}
|