@itwin/grouping-mapping-widget 0.3.2 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/formula/FormulaFunctionProvider.d.ts +18 -0
- package/lib/cjs/formula/FormulaFunctionProvider.js +136 -0
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -0
- package/lib/cjs/formula/FormulaOperatorsProvider.d.ts +34 -0
- package/lib/cjs/formula/FormulaOperatorsProvider.js +185 -0
- package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -0
- package/lib/cjs/formula/FormulaSplitter.d.ts +2 -0
- package/lib/cjs/formula/FormulaSplitter.js +140 -0
- package/lib/cjs/formula/FormulaSplitter.js.map +1 -0
- package/lib/cjs/formula/FormulaTokensValidator.d.ts +5 -0
- package/lib/cjs/formula/FormulaTokensValidator.js +137 -0
- package/lib/cjs/formula/FormulaTokensValidator.js.map +1 -0
- package/lib/cjs/formula/FormulaValidator.d.ts +3 -0
- package/lib/cjs/formula/FormulaValidator.js +35 -0
- package/lib/cjs/formula/FormulaValidator.js.map +1 -0
- package/lib/cjs/formula/IResult.d.ts +5 -0
- package/lib/cjs/formula/IResult.js +3 -0
- package/lib/cjs/formula/IResult.js.map +1 -0
- package/lib/cjs/formula/InfixToPostfixConverter.d.ts +18 -0
- package/lib/cjs/formula/InfixToPostfixConverter.js +299 -0
- package/lib/cjs/formula/InfixToPostfixConverter.js.map +1 -0
- package/lib/cjs/formula/InputStream.d.ts +12 -0
- package/lib/cjs/formula/InputStream.js +36 -0
- package/lib/cjs/formula/InputStream.js.map +1 -0
- package/lib/cjs/formula/ParenthesisValidator.d.ts +7 -0
- package/lib/cjs/formula/ParenthesisValidator.js +34 -0
- package/lib/cjs/formula/ParenthesisValidator.js.map +1 -0
- package/lib/cjs/formula/Queue.d.ts +11 -0
- package/lib/cjs/formula/Queue.js +42 -0
- package/lib/cjs/formula/Queue.js.map +1 -0
- package/lib/cjs/formula/Stack.d.ts +14 -0
- package/lib/cjs/formula/Stack.js +71 -0
- package/lib/cjs/formula/Stack.js.map +1 -0
- package/lib/cjs/formula/StringBuilder.d.ts +9 -0
- package/lib/cjs/formula/StringBuilder.js +26 -0
- package/lib/cjs/formula/StringBuilder.js.map +1 -0
- package/lib/cjs/formula/Types.d.ts +8 -0
- package/lib/cjs/formula/Types.js +3 -0
- package/lib/cjs/formula/Types.js.map +1 -0
- package/lib/cjs/formula/Utils.d.ts +7 -0
- package/lib/cjs/formula/Utils.js +39 -0
- package/lib/cjs/formula/Utils.js.map +1 -0
- package/lib/cjs/widget/components/BlockingOverlay.d.ts +7 -0
- package/lib/cjs/widget/components/BlockingOverlay.js +21 -0
- package/lib/cjs/widget/components/BlockingOverlay.js.map +1 -0
- package/lib/cjs/widget/components/BlockingOverlay.scss +26 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +4 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +5 -2
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +5 -29
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -2
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +4 -2
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +4 -2
- package/lib/cjs/widget/components/CustomCalculationAction.js +10 -6
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +5 -2
- package/lib/cjs/widget/components/CustomCalculationTable.js +5 -29
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +3 -12
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js +5 -6
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +5 -2
- package/lib/cjs/widget/components/GroupPropertyTable.js +5 -29
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +2 -3
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.js +26 -5
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +10 -13
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +6 -2
- package/lib/cjs/widget/components/PropertyMenu.js +77 -21
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +2 -1
- package/lib/cjs/widget/components/SelectMapping.scss +2 -1
- package/lib/cjs/widget/components/SelectMappings.js +1 -2
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.js +9 -9
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.scss +3 -8
- package/lib/cjs/widget/components/utils.d.ts +2 -0
- package/lib/cjs/widget/components/utils.js +13 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFetchData.d.ts +9 -0
- package/lib/cjs/widget/hooks/useFetchData.js +41 -0
- package/lib/cjs/widget/hooks/useFetchData.js.map +1 -0
- package/lib/cjs/widget/hooks/useFormulaValidation.d.ts +6 -0
- package/lib/cjs/widget/hooks/useFormulaValidation.js +29 -0
- package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -0
- package/lib/cjs/widget/utils.d.ts +1 -0
- package/lib/cjs/widget/utils.js +9 -0
- package/lib/cjs/widget/utils.js.map +1 -1
- package/lib/esm/formula/FormulaFunctionProvider.d.ts +18 -0
- package/lib/esm/formula/FormulaFunctionProvider.js +130 -0
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -0
- package/lib/esm/formula/FormulaOperatorsProvider.d.ts +34 -0
- package/lib/esm/formula/FormulaOperatorsProvider.js +174 -0
- package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -0
- package/lib/esm/formula/FormulaSplitter.d.ts +2 -0
- package/lib/esm/formula/FormulaSplitter.js +136 -0
- package/lib/esm/formula/FormulaSplitter.js.map +1 -0
- package/lib/esm/formula/FormulaTokensValidator.d.ts +5 -0
- package/lib/esm/formula/FormulaTokensValidator.js +133 -0
- package/lib/esm/formula/FormulaTokensValidator.js.map +1 -0
- package/lib/esm/formula/FormulaValidator.d.ts +3 -0
- package/lib/esm/formula/FormulaValidator.js +31 -0
- package/lib/esm/formula/FormulaValidator.js.map +1 -0
- package/lib/esm/formula/IResult.d.ts +5 -0
- package/lib/esm/formula/IResult.js +2 -0
- package/lib/esm/formula/IResult.js.map +1 -0
- package/lib/esm/formula/InfixToPostfixConverter.d.ts +18 -0
- package/lib/esm/formula/InfixToPostfixConverter.js +295 -0
- package/lib/esm/formula/InfixToPostfixConverter.js.map +1 -0
- package/lib/esm/formula/InputStream.d.ts +12 -0
- package/lib/esm/formula/InputStream.js +32 -0
- package/lib/esm/formula/InputStream.js.map +1 -0
- package/lib/esm/formula/ParenthesisValidator.d.ts +7 -0
- package/lib/esm/formula/ParenthesisValidator.js +30 -0
- package/lib/esm/formula/ParenthesisValidator.js.map +1 -0
- package/lib/esm/formula/Queue.d.ts +11 -0
- package/lib/esm/formula/Queue.js +38 -0
- package/lib/esm/formula/Queue.js.map +1 -0
- package/lib/esm/formula/Stack.d.ts +14 -0
- package/lib/esm/formula/Stack.js +67 -0
- package/lib/esm/formula/Stack.js.map +1 -0
- package/lib/esm/formula/StringBuilder.d.ts +9 -0
- package/lib/esm/formula/StringBuilder.js +22 -0
- package/lib/esm/formula/StringBuilder.js.map +1 -0
- package/lib/esm/formula/Types.d.ts +8 -0
- package/lib/esm/formula/Types.js +2 -0
- package/lib/esm/formula/Types.js.map +1 -0
- package/lib/esm/formula/Utils.d.ts +7 -0
- package/lib/esm/formula/Utils.js +30 -0
- package/lib/esm/formula/Utils.js.map +1 -0
- package/lib/esm/widget/components/BlockingOverlay.d.ts +7 -0
- package/lib/esm/widget/components/BlockingOverlay.js +14 -0
- package/lib/esm/widget/components/BlockingOverlay.js.map +1 -0
- package/lib/esm/widget/components/BlockingOverlay.scss +26 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.js +5 -6
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +5 -2
- package/lib/esm/widget/components/CalculatedPropertyTable.js +6 -30
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +2 -3
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +4 -2
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +4 -2
- package/lib/esm/widget/components/CustomCalculationAction.js +11 -7
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +5 -2
- package/lib/esm/widget/components/CustomCalculationTable.js +6 -30
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +4 -13
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.js +6 -7
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +5 -2
- package/lib/esm/widget/components/GroupPropertyTable.js +6 -30
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +3 -4
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.js +28 -7
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +12 -15
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.scss +6 -2
- package/lib/esm/widget/components/PropertyMenu.js +79 -23
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +2 -1
- package/lib/esm/widget/components/SelectMapping.scss +2 -1
- package/lib/esm/widget/components/SelectMappings.js +2 -3
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.js +9 -9
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.scss +3 -8
- package/lib/esm/widget/components/utils.d.ts +2 -0
- package/lib/esm/widget/components/utils.js +11 -0
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/hooks/useFetchData.d.ts +9 -0
- package/lib/esm/widget/hooks/useFetchData.js +35 -0
- package/lib/esm/widget/hooks/useFetchData.js.map +1 -0
- package/lib/esm/widget/hooks/useFormulaValidation.d.ts +6 -0
- package/lib/esm/widget/hooks/useFormulaValidation.js +25 -0
- package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -0
- package/lib/esm/widget/utils.d.ts +1 -0
- package/lib/esm/widget/utils.js +7 -1
- package/lib/esm/widget/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InputStream = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
class InputStream {
|
|
9
|
+
constructor(_stream) {
|
|
10
|
+
this._stream = _stream;
|
|
11
|
+
this._nextIndex = 0;
|
|
12
|
+
this._current = "";
|
|
13
|
+
}
|
|
14
|
+
get next() {
|
|
15
|
+
this._current = this.isEOF ? "" : this._stream[this._nextIndex++];
|
|
16
|
+
return this.current;
|
|
17
|
+
}
|
|
18
|
+
get undo() {
|
|
19
|
+
if (this._nextIndex === 0)
|
|
20
|
+
return this.current;
|
|
21
|
+
this._nextIndex--;
|
|
22
|
+
this._current = this._nextIndex === 0 ? "" : this._stream[this._nextIndex - 1];
|
|
23
|
+
return this.current;
|
|
24
|
+
}
|
|
25
|
+
get current() {
|
|
26
|
+
return this._current;
|
|
27
|
+
}
|
|
28
|
+
get peek() {
|
|
29
|
+
return this.isEOF ? "" : this._stream[this._nextIndex];
|
|
30
|
+
}
|
|
31
|
+
get isEOF() {
|
|
32
|
+
return this._nextIndex >= this._stream.length;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.InputStream = InputStream;
|
|
36
|
+
//# sourceMappingURL=InputStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputStream.js","sourceRoot":"","sources":["../../../src/formula/InputStream.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,MAAa,WAAW;IAItB,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAHpC,eAAU,GAAG,CAAC,CAAC;QACf,aAAQ,GAAG,EAAE,CAAC;IAE0B,CAAC;IAEjD,IAAW,IAAI;QACb,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAW,IAAI;QACb,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC;QAEtB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAChD,CAAC;CACF;AA/BD,kCA+BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport class InputStream {\n private _nextIndex = 0;\n private _current = \"\";\n\n constructor(private readonly _stream: string) { }\n\n public get next(): string {\n this._current = this.isEOF ? \"\" : this._stream[this._nextIndex++];\n return this.current;\n }\n\n public get undo(): string {\n if (this._nextIndex === 0)\n return this.current;\n\n this._nextIndex--;\n this._current = this._nextIndex === 0 ? \"\" : this._stream[this._nextIndex - 1];\n return this.current;\n }\n\n public get current(): string {\n return this._current;\n }\n\n public get peek(): string {\n return this.isEOF ? \"\" : this._stream[this._nextIndex];\n }\n\n public get isEOF(): boolean {\n return this._nextIndex >= this._stream.length;\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateParenthesis = exports.ParenthesisState = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Stack_1 = require("./Stack");
|
|
9
|
+
var ParenthesisState;
|
|
10
|
+
(function (ParenthesisState) {
|
|
11
|
+
ParenthesisState[ParenthesisState["Valid"] = 0] = "Valid";
|
|
12
|
+
ParenthesisState[ParenthesisState["NotClosed"] = 1] = "NotClosed";
|
|
13
|
+
ParenthesisState[ParenthesisState["NotOpened"] = 2] = "NotOpened";
|
|
14
|
+
})(ParenthesisState = exports.ParenthesisState || (exports.ParenthesisState = {}));
|
|
15
|
+
function validateParenthesis(infixFormula) {
|
|
16
|
+
const s = new Stack_1.Stack();
|
|
17
|
+
for (const c of infixFormula) {
|
|
18
|
+
if (c === "(") {
|
|
19
|
+
s.push("(");
|
|
20
|
+
}
|
|
21
|
+
else if (c === ")") {
|
|
22
|
+
if (s.peek() === undefined) {
|
|
23
|
+
return ParenthesisState.NotOpened;
|
|
24
|
+
}
|
|
25
|
+
s.pop();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (s.length !== 0) {
|
|
29
|
+
return ParenthesisState.NotClosed;
|
|
30
|
+
}
|
|
31
|
+
return ParenthesisState.Valid;
|
|
32
|
+
}
|
|
33
|
+
exports.validateParenthesis = validateParenthesis;
|
|
34
|
+
//# sourceMappingURL=ParenthesisValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParenthesisValidator.js","sourceRoot":"","sources":["../../../src/formula/ParenthesisValidator.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,mCAAgC;AAEhC,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,yDAAS,CAAA;IACT,iEAAa,CAAA;IACb,iEAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,SAAgB,mBAAmB,CAAC,YAAoB;IACtD,MAAM,CAAC,GAAG,IAAI,aAAK,EAAU,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;QAC5B,IAAI,CAAC,KAAK,GAAG,EAAE;YACb,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACb;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE;YACpB,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,SAAS,EAAE;gBAC1B,OAAO,gBAAgB,CAAC,SAAS,CAAC;aACnC;YACD,CAAC,CAAC,GAAG,EAAE,CAAC;SACT;KACF;IACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAClB,OAAO,gBAAgB,CAAC,SAAS,CAAC;KACnC;IACD,OAAO,gBAAgB,CAAC,KAAK,CAAC;AAChC,CAAC;AAhBD,kDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Stack } from \"./Stack\";\n\nexport enum ParenthesisState {\n Valid = 0,\n NotClosed = 1,\n NotOpened = 2,\n}\n\nexport function validateParenthesis(infixFormula: string): ParenthesisState {\n const s = new Stack<string>();\n for (const c of infixFormula) {\n if (c === \"(\") {\n s.push(\"(\");\n } else if (c === \")\") {\n if (s.peek() === undefined) {\n return ParenthesisState.NotOpened;\n }\n s.pop();\n }\n }\n if (s.length !== 0) {\n return ParenthesisState.NotClosed;\n }\n return ParenthesisState.Valid;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class Queue<TData> {
|
|
2
|
+
private _dataStore;
|
|
3
|
+
constructor(_dataStore?: TData[]);
|
|
4
|
+
enqueue(element: TData): Queue<TData>;
|
|
5
|
+
dequeue(): TData | undefined;
|
|
6
|
+
dequeueN(n: number): TData[];
|
|
7
|
+
peek(): TData | undefined;
|
|
8
|
+
get length(): number;
|
|
9
|
+
get asArray(): TData[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Queue.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Queue = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
class Queue {
|
|
9
|
+
constructor(_dataStore = []) {
|
|
10
|
+
this._dataStore = _dataStore;
|
|
11
|
+
}
|
|
12
|
+
enqueue(element) {
|
|
13
|
+
this._dataStore.push(element);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
dequeue() {
|
|
17
|
+
if (this._dataStore.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return this._dataStore.splice(0, 1)[0];
|
|
21
|
+
}
|
|
22
|
+
dequeueN(n) {
|
|
23
|
+
if (n <= 0 || this._dataStore.length === 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return this._dataStore.splice(0, n);
|
|
27
|
+
}
|
|
28
|
+
peek() {
|
|
29
|
+
if (this._dataStore.length === 0) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return this._dataStore[0];
|
|
33
|
+
}
|
|
34
|
+
get length() {
|
|
35
|
+
return this._dataStore.length;
|
|
36
|
+
}
|
|
37
|
+
get asArray() {
|
|
38
|
+
return [...this._dataStore];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.Queue = Queue;
|
|
42
|
+
//# sourceMappingURL=Queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue.js","sourceRoot":"","sources":["../../../src/formula/Queue.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,MAAa,KAAK;IAChB,YAAoB,aAAsB,EAAE;QAAxB,eAAU,GAAV,UAAU,CAAc;IAAI,CAAC;IAE1C,OAAO,CAAC,OAAc;QAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO;QACZ,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAEM,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,EAAE,CAAC;SACX;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAEM,IAAI;QACT,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;CACF;AAtCD,sBAsCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport class Queue<TData> {\n constructor(private _dataStore: TData[] = []) { }\n\n public enqueue(element: TData): Queue<TData> {\n this._dataStore.push(element);\n return this;\n }\n\n public dequeue(): TData | undefined {\n if (this._dataStore.length === 0) {\n return undefined;\n }\n\n return this._dataStore.splice(0, 1)[0];\n }\n\n public dequeueN(n: number): TData[] {\n if (n <= 0 || this._dataStore.length === 0) {\n return [];\n }\n\n return this._dataStore.splice(0, n);\n }\n\n public peek(): TData | undefined {\n if (this._dataStore.length === 0) {\n return undefined;\n }\n return this._dataStore[0];\n }\n\n public get length(): number {\n return this._dataStore.length;\n }\n\n public get asArray(): TData[] {\n return [...this._dataStore];\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class Stack<TData> {
|
|
2
|
+
private _dataStore;
|
|
3
|
+
constructor();
|
|
4
|
+
push(element: TData): Stack<TData>;
|
|
5
|
+
pop(): TData | undefined;
|
|
6
|
+
popN(n: number): TData[];
|
|
7
|
+
peek(): TData | undefined;
|
|
8
|
+
peekN(n: number): TData[];
|
|
9
|
+
indexOf(element: TData): number;
|
|
10
|
+
findIndex(filter: (element: TData) => boolean): number;
|
|
11
|
+
get length(): number;
|
|
12
|
+
get asArray(): TData[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stack = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
class Stack {
|
|
9
|
+
constructor() {
|
|
10
|
+
this._dataStore = [];
|
|
11
|
+
}
|
|
12
|
+
push(element) {
|
|
13
|
+
this._dataStore.push(element);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
pop() {
|
|
17
|
+
if (this._dataStore.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return this._dataStore.pop();
|
|
21
|
+
}
|
|
22
|
+
popN(n) {
|
|
23
|
+
if (n <= 0 || this._dataStore.length === 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
if (this._dataStore.length >= n) {
|
|
27
|
+
return [...this._dataStore.splice(this._dataStore.length - n)].reverse();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const result = [...this._dataStore];
|
|
31
|
+
this._dataStore = [];
|
|
32
|
+
return result.reverse();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
peek() {
|
|
36
|
+
if (this._dataStore.length === 0) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return this._dataStore[this._dataStore.length - 1];
|
|
40
|
+
}
|
|
41
|
+
peekN(n) {
|
|
42
|
+
if (n <= 0 || this._dataStore.length === 0) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
if (this._dataStore.length >= n) {
|
|
46
|
+
return this._dataStore.slice(-n).reverse();
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return [...this._dataStore].reverse();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
indexOf(element) {
|
|
53
|
+
return this.findIndex((e) => e === element);
|
|
54
|
+
}
|
|
55
|
+
findIndex(filter) {
|
|
56
|
+
for (let i = 0; i < this._dataStore.length; i++) {
|
|
57
|
+
if (filter(this._dataStore[this._dataStore.length - 1 - i])) {
|
|
58
|
+
return i;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return -1;
|
|
62
|
+
}
|
|
63
|
+
get length() {
|
|
64
|
+
return this._dataStore.length;
|
|
65
|
+
}
|
|
66
|
+
get asArray() {
|
|
67
|
+
return [...this._dataStore].reverse();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.Stack = Stack;
|
|
71
|
+
//# sourceMappingURL=Stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../../src/formula/Stack.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,MAAa,KAAK;IAEhB;QADQ,eAAU,GAAY,EAAE,CAAC;IACjB,CAAC;IAEV,IAAI,CAAC,OAAc;QACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,GAAG;QACR,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEM,IAAI,CAAC,CAAS;QACnB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,EAAE,CAAC;SACX;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;YAC/B,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC1E;aAAM;YACL,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;YACpC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC;SACzB;IACH,CAAC;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AC;CACF;AArED,sBAqEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport class Stack<TData> {\n private _dataStore: TData[] = [];\n constructor() { }\n\n public push(element: TData): Stack<TData> {\n this._dataStore.push(element);\n return this;\n }\n\n public pop(): TData | undefined {\n if (this._dataStore.length === 0) {\n return undefined;\n }\n return this._dataStore.pop();\n }\n\n public popN(n: number): TData[] {\n if (n <= 0 || this._dataStore.length === 0) {\n return [];\n }\n\n if (this._dataStore.length >= n) {\n return [...this._dataStore.splice(this._dataStore.length - n)].reverse();\n } else {\n const result = [...this._dataStore];\n this._dataStore = [];\n return result.reverse();\n }\n }\n\n public peek(): TData | undefined {\n if (this._dataStore.length === 0) {\n return undefined;\n }\n return this._dataStore[this._dataStore.length - 1];\n }\n\n public peekN(n: number): TData[] {\n if (n <= 0 || this._dataStore.length === 0) {\n return [];\n }\n\n if (this._dataStore.length >= n) {\n return this._dataStore.slice(-n).reverse();\n } else {\n return [...this._dataStore].reverse();\n }\n }\n\n public indexOf(element: TData): number {\n return this.findIndex((e) => e === element);\n }\n\n public findIndex(filter: (element: TData) => boolean): number {\n for (let i = 0; i < this._dataStore.length; i++) {\n if (filter(this._dataStore[this._dataStore.length - 1 - i])) {\n return i;\n }\n }\n return -1;\n }\n\n public get length(): number {\n return this._dataStore.length;\n }\n\n public get asArray(): TData[] {\n return [...this._dataStore].reverse();\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringBuilder = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
class StringBuilder {
|
|
9
|
+
constructor(...initial) {
|
|
10
|
+
this._stringParts = initial.filter((v) => !!v);
|
|
11
|
+
}
|
|
12
|
+
push(value) {
|
|
13
|
+
value && this._stringParts.push(value);
|
|
14
|
+
}
|
|
15
|
+
pop() {
|
|
16
|
+
return this._stringParts.pop();
|
|
17
|
+
}
|
|
18
|
+
get length() {
|
|
19
|
+
return this._stringParts.length;
|
|
20
|
+
}
|
|
21
|
+
get value() {
|
|
22
|
+
return this._stringParts.join("");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.StringBuilder = StringBuilder;
|
|
26
|
+
//# sourceMappingURL=StringBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringBuilder.js","sourceRoot":"","sources":["../../../src/formula/StringBuilder.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,MAAa,aAAa;IAGxB,YAAY,GAAG,OAAiB;QAC9B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAEM,IAAI,CAAC,KAAa;QACvB,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAEM,GAAG;QACR,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IAClC,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACF;AAtBD,sCAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport class StringBuilder {\n private readonly _stringParts: string[];\n\n constructor(...initial: string[]) {\n this._stringParts = initial.filter((v) => !!v);\n }\n\n public push(value: string) {\n value && this._stringParts.push(value);\n }\n\n public pop() {\n return this._stringParts.pop();\n }\n\n public get length() {\n return this._stringParts.length;\n }\n\n public get value() {\n return this._stringParts.join(\"\");\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type ValueType = number | string | boolean;
|
|
2
|
+
export declare type PossibleValueType = ValueType | undefined;
|
|
3
|
+
export declare type DataType = "number" | "string" | "boolean";
|
|
4
|
+
export declare type PossibleDataType = DataType | "undefined";
|
|
5
|
+
export interface PropertyMap {
|
|
6
|
+
[key: string]: PossibleDataType;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../src/formula/Types.ts"],"names":[],"mappings":"","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport type ValueType = number | string | boolean;\n\nexport type PossibleValueType = ValueType | undefined;\n\nexport type DataType = \"number\" | \"string\" | \"boolean\";\n\nexport type PossibleDataType = DataType | \"undefined\";\n\nexport interface PropertyMap { [key: string]: PossibleDataType }\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function isDigit(char: string): boolean;
|
|
2
|
+
export declare function isLetterOrUnderscore(char: string): boolean;
|
|
3
|
+
export declare function isStringDelimiter(char: string): boolean;
|
|
4
|
+
export declare function isWhitespace(char: string): boolean;
|
|
5
|
+
export declare function isDecimalSeparator(char: string): boolean;
|
|
6
|
+
export declare function formatNumericalPositionString(num: number): string;
|
|
7
|
+
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatNumericalPositionString = exports.isDecimalSeparator = exports.isWhitespace = exports.isStringDelimiter = exports.isLetterOrUnderscore = exports.isDigit = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
function isDigit(char) {
|
|
9
|
+
return /^\d/.test(char);
|
|
10
|
+
}
|
|
11
|
+
exports.isDigit = isDigit;
|
|
12
|
+
function isLetterOrUnderscore(char) {
|
|
13
|
+
return /^[\p{L}_]/u.test(char);
|
|
14
|
+
}
|
|
15
|
+
exports.isLetterOrUnderscore = isLetterOrUnderscore;
|
|
16
|
+
function isStringDelimiter(char) {
|
|
17
|
+
return ["\"", "'", "`"].includes(char);
|
|
18
|
+
}
|
|
19
|
+
exports.isStringDelimiter = isStringDelimiter;
|
|
20
|
+
function isWhitespace(char) {
|
|
21
|
+
return /^\s/.test(char);
|
|
22
|
+
}
|
|
23
|
+
exports.isWhitespace = isWhitespace;
|
|
24
|
+
function isDecimalSeparator(char) {
|
|
25
|
+
return char === ".";
|
|
26
|
+
}
|
|
27
|
+
exports.isDecimalSeparator = isDecimalSeparator;
|
|
28
|
+
function formatNumericalPositionString(num) {
|
|
29
|
+
const str = num.toString();
|
|
30
|
+
if (str.endsWith("1") && num !== 11)
|
|
31
|
+
return `${str}st`;
|
|
32
|
+
if (str.endsWith("2") && num !== 12)
|
|
33
|
+
return `${str}nd`;
|
|
34
|
+
if (str.endsWith("3") && num !== 13)
|
|
35
|
+
return `${str}rd`;
|
|
36
|
+
return `${str}th`;
|
|
37
|
+
}
|
|
38
|
+
exports.formatNumericalPositionString = formatNumericalPositionString;
|
|
39
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/formula/Utils.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,SAAgB,OAAO,CAAC,IAAY;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAFD,0BAEC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAFD,oDAEC;AAED,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAFD,8CAEC;AAED,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAFD,oCAEC;AAED,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,IAAI,KAAK,GAAG,CAAC;AACtB,CAAC;AAFD,gDAEC;AAED,SAAgB,6BAA6B,CAAC,GAAW;IACvD,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC3B,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,EAAE;QACjC,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,EAAE;QACjC,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,EAAE;QACjC,OAAO,GAAG,GAAG,IAAI,CAAC;IAEpB,OAAO,GAAG,GAAG,IAAI,CAAC;AACpB,CAAC;AAVD,sEAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport function isDigit(char: string): boolean {\n return /^\\d/.test(char);\n}\n\nexport function isLetterOrUnderscore(char: string): boolean {\n return /^[\\p{L}_]/u.test(char);\n}\n\nexport function isStringDelimiter(char: string): boolean {\n return [\"\\\"\", \"'\", \"`\"].includes(char);\n}\n\nexport function isWhitespace(char: string): boolean {\n return /^\\s/.test(char);\n}\n\nexport function isDecimalSeparator(char: string): boolean {\n return char === \".\";\n}\n\nexport function formatNumericalPositionString(num: number): string {\n const str = num.toString();\n if (str.endsWith(\"1\") && num !== 11)\n return `${str}st`;\n if (str.endsWith(\"2\") && num !== 12)\n return `${str}nd`;\n if (str.endsWith(\"3\") && num !== 13)\n return `${str}rd`;\n\n return `${str}th`;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./BlockingOverlay.scss";
|
|
3
|
+
export interface BlockingOverlayProps {
|
|
4
|
+
isVisible: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const BlockingOverlay: ({ isVisible }: BlockingOverlayProps) => JSX.Element;
|
|
7
|
+
//# sourceMappingURL=BlockingOverlay.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BlockingOverlay = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const utils_1 = require("./utils");
|
|
14
|
+
require("./BlockingOverlay.scss");
|
|
15
|
+
const BlockingOverlay = ({ isVisible }) => {
|
|
16
|
+
return (react_1.default.createElement("div", { className: classnames_1.default("group-mapping-blocking-overlay", isVisible && "visible") },
|
|
17
|
+
react_1.default.createElement("div", { className: "group-mapping-blocking-overlay-spinner" },
|
|
18
|
+
react_1.default.createElement(utils_1.LoadingSpinner, null))));
|
|
19
|
+
};
|
|
20
|
+
exports.BlockingOverlay = BlockingOverlay;
|
|
21
|
+
//# sourceMappingURL=BlockingOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockingOverlay.js","sourceRoot":"","sources":["../../../../src/widget/components/BlockingOverlay.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,4DAAoC;AACpC,kDAA0B;AAC1B,mCAAyC;AACzC,kCAAgC;AAMzB,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAwB,EAAE,EAAE;IACrE,OAAO,CACL,uCAAK,SAAS,EAAE,oBAAU,CAAC,gCAAgC,EAAE,SAAS,IAAI,SAAS,CAAC;QAClF,uCAAK,SAAS,EAAC,wCAAwC;YACrD,8BAAC,sBAAc,OAAG,CACd,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport { LoadingSpinner } from \"./utils\";\nimport \"./BlockingOverlay.scss\";\n\nexport interface BlockingOverlayProps {\n isVisible: boolean;\n}\n\nexport const BlockingOverlay = ({ isVisible }: BlockingOverlayProps) => {\n return (\n <div className={classnames(\"group-mapping-blocking-overlay\", isVisible && \"visible\")}>\n <div className=\"group-mapping-blocking-overlay-spinner\">\n <LoadingSpinner />\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
|
+
|
|
7
|
+
.group-mapping-blocking-overlay {
|
|
8
|
+
background-color: black;
|
|
9
|
+
position: absolute;
|
|
10
|
+
height: inherit;
|
|
11
|
+
right: 6px;
|
|
12
|
+
left: 6px;
|
|
13
|
+
opacity: 60%;
|
|
14
|
+
z-index: 9999;
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
|
|
17
|
+
&.visible {
|
|
18
|
+
visibility: visible;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.group-mapping-blocking-overlay-spinner {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
height: inherit;
|
|
26
|
+
}
|
|
@@ -7,7 +7,7 @@ interface CalculatedPropertyActionProps {
|
|
|
7
7
|
groupId: string;
|
|
8
8
|
property?: CalculatedPropertyType;
|
|
9
9
|
ids: string[];
|
|
10
|
-
returnFn: () => Promise<void>;
|
|
10
|
+
returnFn: (modified: boolean) => Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
declare const CalculatedPropertyAction: ({ iModelId, mappingId, groupId, property, ids, returnFn, }: CalculatedPropertyActionProps) => JSX.Element;
|
|
13
13
|
export default CalculatedPropertyAction;
|
|
@@ -35,7 +35,6 @@ const useValidator_1 = __importStar(require("../hooks/useValidator"));
|
|
|
35
35
|
const utils_1 = require("./utils");
|
|
36
36
|
const viewerUtils_1 = require("./viewerUtils");
|
|
37
37
|
require("./CalculatedPropertyAction.scss");
|
|
38
|
-
const insights_client_1 = require("@itwin/insights-client");
|
|
39
38
|
const GroupingMapping_1 = require("./GroupingMapping");
|
|
40
39
|
const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids, returnFn, }) => {
|
|
41
40
|
var _a, _b, _c;
|
|
@@ -88,7 +87,7 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
|
|
|
88
87
|
}
|
|
89
88
|
try {
|
|
90
89
|
setIsLoading(true);
|
|
91
|
-
const reportingClientApi =
|
|
90
|
+
const reportingClientApi = utils_1.getReportingClient(apiContext.prefix);
|
|
92
91
|
property
|
|
93
92
|
? await reportingClientApi.updateCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, (_a = property.id) !== null && _a !== void 0 ? _a : "", {
|
|
94
93
|
propertyName,
|
|
@@ -98,7 +97,7 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
|
|
|
98
97
|
propertyName,
|
|
99
98
|
type,
|
|
100
99
|
});
|
|
101
|
-
await returnFn();
|
|
100
|
+
await returnFn(true);
|
|
102
101
|
}
|
|
103
102
|
catch (error) {
|
|
104
103
|
utils_1.handleError(error.status);
|
|
@@ -112,7 +111,7 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
|
|
|
112
111
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
113
112
|
react_1.default.createElement(utils_1.WidgetHeader, { title: property
|
|
114
113
|
? `${(_c = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _c !== void 0 ? _c : ""}`
|
|
115
|
-
: "Create Calculated Property", returnFn: returnFn }),
|
|
114
|
+
: "Create Calculated Property", returnFn: async () => returnFn(false) }),
|
|
116
115
|
react_1.default.createElement("div", { className: 'calculated-properties-action-container' },
|
|
117
116
|
react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Calculated Property Details', className: 'details-form' },
|
|
118
117
|
react_1.default.createElement(itwinui_react_1.Small, { className: 'field-legend' }, "Asterisk * indicates mandatory fields."),
|
|
@@ -165,7 +164,7 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
|
|
|
165
164
|
getSpatialData(option.value)))), selectedItemRenderer: (option) => (react_1.default.createElement("div", { className: 'select-item' },
|
|
166
165
|
react_1.default.createElement("div", null, option.label),
|
|
167
166
|
getSpatialData(option.value))), onShow: () => { }, onHide: () => { } }))),
|
|
168
|
-
react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: returnFn, isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
|
|
167
|
+
react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: async () => returnFn(false), isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
|
|
169
168
|
};
|
|
170
169
|
exports.default = CalculatedPropertyAction;
|
|
171
170
|
//# sourceMappingURL=CalculatedPropertyAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAIjD,wDAM8B;AAC9B,+CAA+D;AAC/D,gEAAwC;AACxC,sFAGkD;AAClD,sEAAwE;AACxE,mCAAoD;AACpD,+CAAkE;AAClE,2CAAyC;AAEzC,4DAAyD;AACzD,uDAA+C;AAW/C,MAAM,wBAAwB,GAAG,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,EACH,QAAQ,GACsB,EAAE,EAAE;;IAClC,MAAM,UAAU,GAAG,kBAAU,CAAC,4BAAU,CAAC,CAAC;IAC1C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAC9C,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,mCAAI,EAAE,CAC7B,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAS,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,mCAAI,EA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AK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,uCAAK,SAAS,EAAC,aAAa;wBAC1B,2CAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,EACD,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EACzC,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Fieldset,\n LabeledInput,\n LabeledSelect,\n MenuItem,\n Small,\n} from \"@itwin/itwinui-react\";\nimport React, { useContext, useEffect, useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport {\n BboxDimension,\n BboxDimensionsDecorator,\n} from \"../../decorators/BboxDimensionsDecorator\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError, WidgetHeader } from \"./utils\";\nimport { visualizeElements, zoomToElements } from \"./viewerUtils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { CalculatedPropertyType } from \"./CalculatedPropertyTable\";\nimport { ReportingClient } from \"@itwin/insights-client\";\nimport { ApiContext } from \"./GroupingMapping\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: CalculatedPropertyType;\n ids: string[];\n returnFn: () => Promise<void>;\n}\n\nconst CalculatedPropertyAction = ({\n iModelId,\n mappingId,\n groupId,\n property,\n ids,\n returnFn,\n}: CalculatedPropertyActionProps) => {\n const apiContext = useContext(ApiContext);\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<string>(property?.type ?? \"\");\n const [bboxDecorator, setBboxDecorator] = useState<\n BboxDimensionsDecorator | undefined\n >();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [inferredSpatialData, setInferredSpatialData] = useState<\n Map<BboxDimension, number> | undefined\n >();\n const [validator, showValidationMessage] = useValidator();\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n visualizeElements([ids[0]], \"red\");\n void zoomToElements([ids[0]]);\n }, [ids]);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(ids[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, ids]);\n\n useEffect(() => {\n if (bboxDecorator && type && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[type as keyof typeof BboxDimension])\n ? bboxDecorator.drawContext(\n BboxDimension[type as keyof typeof BboxDimension],\n )\n : bboxDecorator.clearContext();\n }\n }, [bboxDecorator, inferredSpatialData, type]);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n\n const reportingClientApi = new ReportingClient(apiContext.prefix);\n\n property\n ? await reportingClientApi.updateCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n property.id ?? \"\",\n {\n propertyName,\n type,\n },\n )\n : await reportingClientApi.createCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n {\n propertyName,\n type,\n },\n );\n await returnFn();\n } catch (error: any) {\n handleError(error.status);\n setIsLoading(false);\n }\n };\n\n const getSpatialData = (value: string) =>\n inferredSpatialData?.has(\n BboxDimension[value as keyof typeof BboxDimension],\n ) && (\n <div>\n {`${inferredSpatialData\n ?.get(BboxDimension[value as keyof typeof BboxDimension])\n ?.toPrecision(4)}m`}\n </div>\n );\n\n return (\n <>\n <WidgetHeader\n title={\n property\n ? `${property?.propertyName ?? \"\"}`\n : \"Create Calculated Property\"\n }\n returnFn={returnFn}\n />\n <div className='calculated-properties-action-container'>\n <Fieldset legend='Calculated Property Details' className='details-form'>\n <Small className='field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <LabeledInput\n value={propertyName}\n required\n name='name'\n label='Name'\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<string>\n label='Quantity Type'\n required\n options={[\n { value: \"Length\", label: \"Length\" },\n { value: \"Area\", label: \"Area\" },\n { value: \"Volume\", label: \"Volume\" },\n {\n value: \"BoundingBoxLongestEdgeLength\",\n label: \"Longest Edge Length\",\n },\n {\n value: \"BoundingBoxIntermediateEdgeLength\",\n label: \"Intermediate Edge Length\",\n },\n {\n value: \"BoundingBoxShortestEdgeLength\",\n label: \"Shortest Edge Length\",\n },\n {\n value: \"BoundingBoxDiagonalLength\",\n label: \"Diagonal Length\",\n },\n {\n value: \"BoundingBoxLongestFaceDiagonalLength\",\n label: \"Longest Face Diagonal Length\",\n },\n {\n value: \"BoundingBoxIntermediateFaceDiagonalLength\",\n label: \"Intermediate Face Diagonal Length\",\n },\n {\n value: \"BoundingBoxShortestFaceDiagonalLength\",\n label: \"Shortest Face Diagonal Length\",\n },\n ]}\n value={type}\n onChange={setType}\n itemRenderer={(option: SelectOption<string>) => (\n <MenuItem>\n <div className='gr-cp-menu-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className='select-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n onShow={() => { }}\n onHide={() => { }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={returnFn}\n isSavingDisabled={!(type && propertyName)}\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyAction;\n"]}
|
|
1
|
+
{"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAIjD,wDAM8B;AAC9B,+CAA+D;AAC/D,gEAAwC;AACxC,sFAGkD;AAClD,sEAAwE;AACxE,mCAAwE;AACxE,+CAAkE;AAClE,2CAAyC;AAEzC,uDAA+C;AAW/C,MAAM,wBAAwB,GAAG,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,EACH,QAAQ,GACsB,EAAE,EAAE;;IAClC,MAAM,UAAU,GAAG,kBAAU,CAAC,4BAAU,CAAC,CAAC;IAC1C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAC9C,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,mCAAI,EAAE,CAC7B,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAS,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,mCAAI,E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,CAAC,KAAK,CAAO;4BACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,uCAAK,SAAS,EAAC,aAAa;wBAC1B,2CAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,EACD,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrC,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EACzC,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Fieldset,\n LabeledInput,\n LabeledSelect,\n MenuItem,\n Small,\n} from \"@itwin/itwinui-react\";\nimport React, { useContext, useEffect, useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport {\n BboxDimension,\n BboxDimensionsDecorator,\n} from \"../../decorators/BboxDimensionsDecorator\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { getReportingClient, handleError, WidgetHeader } from \"./utils\";\nimport { visualizeElements, zoomToElements } from \"./viewerUtils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { CalculatedPropertyType } from \"./CalculatedPropertyTable\";\nimport { ApiContext } from \"./GroupingMapping\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: CalculatedPropertyType;\n ids: string[];\n returnFn: (modified: boolean) => Promise<void>;\n}\n\nconst CalculatedPropertyAction = ({\n iModelId,\n mappingId,\n groupId,\n property,\n ids,\n returnFn,\n}: CalculatedPropertyActionProps) => {\n const apiContext = useContext(ApiContext);\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<string>(property?.type ?? \"\");\n const [bboxDecorator, setBboxDecorator] = useState<BboxDimensionsDecorator | undefined>();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [inferredSpatialData, setInferredSpatialData] = useState<Map<BboxDimension, number> | undefined>();\n const [validator, showValidationMessage] = useValidator();\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n visualizeElements([ids[0]], \"red\");\n void zoomToElements([ids[0]]);\n }, [ids]);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(ids[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, ids]);\n\n useEffect(() => {\n if (bboxDecorator && type && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[type as keyof typeof BboxDimension])\n ? bboxDecorator.drawContext(\n BboxDimension[type as keyof typeof BboxDimension],\n )\n : bboxDecorator.clearContext();\n }\n }, [bboxDecorator, inferredSpatialData, type]);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n\n const reportingClientApi = getReportingClient(apiContext.prefix);\n\n property\n ? await reportingClientApi.updateCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n property.id ?? \"\",\n {\n propertyName,\n type,\n },\n )\n : await reportingClientApi.createCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n {\n propertyName,\n type,\n },\n );\n await returnFn(true);\n } catch (error: any) {\n handleError(error.status);\n setIsLoading(false);\n }\n };\n\n const getSpatialData = (value: string) =>\n inferredSpatialData?.has(\n BboxDimension[value as keyof typeof BboxDimension],\n ) && (\n <div>\n {`${inferredSpatialData\n ?.get(BboxDimension[value as keyof typeof BboxDimension])\n ?.toPrecision(4)}m`}\n </div>\n );\n\n return (\n <>\n <WidgetHeader\n title={\n property\n ? `${property?.propertyName ?? \"\"}`\n : \"Create Calculated Property\"\n }\n returnFn={async () => returnFn(false)}\n />\n <div className='calculated-properties-action-container'>\n <Fieldset legend='Calculated Property Details' className='details-form'>\n <Small className='field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <LabeledInput\n value={propertyName}\n required\n name='name'\n label='Name'\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<string>\n label='Quantity Type'\n required\n options={[\n { value: \"Length\", label: \"Length\" },\n { value: \"Area\", label: \"Area\" },\n { value: \"Volume\", label: \"Volume\" },\n {\n value: \"BoundingBoxLongestEdgeLength\",\n label: \"Longest Edge Length\",\n },\n {\n value: \"BoundingBoxIntermediateEdgeLength\",\n label: \"Intermediate Edge Length\",\n },\n {\n value: \"BoundingBoxShortestEdgeLength\",\n label: \"Shortest Edge Length\",\n },\n {\n value: \"BoundingBoxDiagonalLength\",\n label: \"Diagonal Length\",\n },\n {\n value: \"BoundingBoxLongestFaceDiagonalLength\",\n label: \"Longest Face Diagonal Length\",\n },\n {\n value: \"BoundingBoxIntermediateFaceDiagonalLength\",\n label: \"Intermediate Face Diagonal Length\",\n },\n {\n value: \"BoundingBoxShortestFaceDiagonalLength\",\n label: \"Shortest Face Diagonal Length\",\n },\n ]}\n value={type}\n onChange={setType}\n itemRenderer={(option: SelectOption<string>) => (\n <MenuItem>\n <div className='gr-cp-menu-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className='select-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n onShow={() => { }}\n onHide={() => { }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={async () => returnFn(false)}\n isSavingDisabled={!(type && propertyName)}\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyAction;\n"]}
|
|
@@ -8,11 +8,14 @@ interface CalculatedPropertyTableProps {
|
|
|
8
8
|
iModelId: string;
|
|
9
9
|
mappingId: string;
|
|
10
10
|
groupId: string;
|
|
11
|
-
setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<CreateTypeFromInterface<
|
|
11
|
+
setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<CreateTypeFromInterface<CalculatedPropertyType> | undefined>>;
|
|
12
12
|
setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;
|
|
13
13
|
onCalculatedPropertyModify: (value: CellProps<CalculatedPropertyType>) => void;
|
|
14
|
+
isLoadingCalculatedProperties: boolean;
|
|
15
|
+
calculatedProperties: CalculatedPropertyType[];
|
|
16
|
+
refreshCalculatedProperties: () => Promise<void>;
|
|
14
17
|
selectedCalculatedProperty?: CalculatedPropertyType;
|
|
15
18
|
}
|
|
16
|
-
declare const CalculatedPropertyTable: ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, selectedCalculatedProperty, }: CalculatedPropertyTableProps) => JSX.Element;
|
|
19
|
+
declare const CalculatedPropertyTable: ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, isLoadingCalculatedProperties: isLoadingGroupProperties, calculatedProperties, refreshCalculatedProperties, selectedCalculatedProperty, }: CalculatedPropertyTableProps) => JSX.Element;
|
|
17
20
|
export default CalculatedPropertyTable;
|
|
18
21
|
//# sourceMappingURL=CalculatedPropertyTable.d.ts.map
|