@itwin/grouping-mapping-widget 0.8.0 → 0.8.2
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/README.md +1 -1
- package/lib/cjs/formula/InfixToPostfixConverter.js +1 -1
- package/lib/cjs/formula/InfixToPostfixConverter.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +144 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.js +1 -2
- package/lib/cjs/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.scss +8 -10
- package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -2
- package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.scss +4 -1
- package/lib/esm/formula/InfixToPostfixConverter.js +1 -1
- package/lib/esm/formula/InfixToPostfixConverter.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +144 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/widget/components/BlockingOverlay.js +1 -2
- package/lib/esm/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/esm/widget/components/BlockingOverlay.scss +8 -10
- package/lib/esm/widget/components/GroupPropertyUtils.js +2 -2
- package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.scss +4 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ This package provides an interface to define your own custom UI or callback func
|
|
|
38
38
|
|
|
39
39
|
You can use your own UI component to define group creation method.
|
|
40
40
|
|
|
41
|
-
An example of grouping custom UI, [ManualGroupingCustomUI](
|
|
41
|
+
An example of grouping custom UI, [ManualGroupingCustomUI](./src/widget/components/customUI/ManualGroupingCustomUI.tsx) helps user to manually define ECSQL query for groups.
|
|
42
42
|
|
|
43
43
|
In `GroupingCustomUIProps`:
|
|
44
44
|
|
|
@@ -144,7 +144,7 @@ const addOperator = (ctx) => {
|
|
|
144
144
|
if (o2.value === "(") {
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
const o2Unary = o2.argCount === 0;
|
|
147
|
+
const o2Unary = (o2.argCount === 0) || (o2.argCount === 1 && o2.argCountIncremented === true);
|
|
148
148
|
const op2 = o2Unary ? FormulaOperatorsProvider_1.getUnaryOperator(o2.value) : FormulaOperatorsProvider_1.getBinaryOperator(o2.value);
|
|
149
149
|
const o2Precedence = FormulaOperatorsProvider_1.getOperatorPrecedence(op2);
|
|
150
150
|
if (!(o2Precedence > o1Precedence || (o2Precedence === o1Precedence && o1Associativity === FormulaOperatorsProvider_1.OperatorAssociativity.Left))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfixToPostfixConverter.js","sourceRoot":"","sources":["../../../src/formula/InfixToPostfixConverter.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,uEAAuD;AACvD,yEAA0L;AAE1L,mCAAgC;AAChC,mCAAgC;AAChC,mCAA4C;AAE5C,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,OAAO,cAAc,KAAK,aAAa,IAAI,yBAAiB,CAAC,cAAc,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,KAAK,GAAG,KAAK,C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AG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAE,CAAC;QAExD,MAAM,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,SAAS,KAAK,SAAS,CAAC,KAAK,EAAE;YACjC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC;SACjD;KACF;IAED,OAAO,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,EAAG,CAAC,CAAC;QAE1C,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;QAC7C,IAAI,SAAS,KAAK,eAAe,EAAE;YACjC,iBAAiB,CAAC,eAAe,CAAC,CAAC;SACpC;KACF;IAED,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;AACvC,CAAC;AAlCD,sDAkCC","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 { isFunction } from \"./FormulaFunctionProvider\";\nimport { getBinaryOperator, getOperatorAssociativity, getOperatorPrecedence, getUnaryOperator, isOperator, isSupportedOperator, OperatorAssociativity } from \"./FormulaOperatorsProvider\";\nimport type { IResult } from \"./IResult\";\nimport { Queue } from \"./Queue\";\nimport { Stack } from \"./Stack\";\nimport { isStringDelimiter } from \"./Utils\";\n\nfunction isNumber(part: string): boolean {\n return !isNaN(Number(part)) || !isNaN(parseFloat(part));\n}\n\nfunction isStringLiteral(token: string): boolean {\n if (token.length < 2) {\n return false;\n }\n\n const firstCharacter = token[0];\n const lastCharacter = token[token.length - 1];\n return firstCharacter === lastCharacter && isStringDelimiter(firstCharacter);\n}\n\nfunction isBoolean(token: string): boolean {\n const lower = token.toLowerCase();\n return lower === \"true\" || lower === \"false\";\n}\n\nfunction isNull(token: string): boolean {\n return token.toLowerCase() === \"null\";\n}\n\nexport enum TokenType {\n Number = 0,\n Function = 1,\n Operator = 2,\n Variable = 3,\n String = 4,\n Boolean = 5,\n Null = 6,\n}\n\nenum InternalTokenType {\n Number = 0,\n Function = 1,\n Operator = 2,\n Variable = 3,\n OpeningParenthesis = 4,\n ClosingParenthesis = 5,\n ArgumentSeparator = 6,\n String = 7,\n Boolean = 8,\n Null = 9,\n}\n\nexport interface Token {\n value: string;\n type: TokenType;\n argCount: number;\n}\n\ninterface InternalToken {\n value: string;\n type: InternalTokenType;\n argCount: number;\n argCountIncremented: boolean;\n}\n\nfunction getExternalQueue(internal: Queue<InternalToken>): IResult<Queue<Token>> {\n const external = new Queue<Token>();\n while (internal.length > 0) {\n const t = internal.dequeue()!;\n\n switch (t.type) {\n case InternalTokenType.Number:\n external.enqueue({ value: t.value, type: TokenType.Number, argCount: t.argCount });\n break;\n case InternalTokenType.Function:\n external.enqueue({ value: t.value, type: TokenType.Function, argCount: t.argCount });\n break;\n case InternalTokenType.Operator:\n external.enqueue({ value: t.value, type: TokenType.Operator, argCount: t.argCount });\n break;\n case InternalTokenType.Variable:\n external.enqueue({ value: t.value, type: TokenType.Variable, argCount: t.argCount });\n break;\n case InternalTokenType.String:\n external.enqueue({ value: t.value, type: TokenType.String, argCount: t.argCount });\n break;\n case InternalTokenType.Boolean:\n external.enqueue({ value: t.value, type: TokenType.Boolean, argCount: t.argCount });\n break;\n case InternalTokenType.Null:\n external.enqueue({ value: t.value, type: TokenType.Null, argCount: t.argCount });\n break;\n default:\n return { errorMessage: `Missing closing parenthesis \")\".` };\n }\n }\n\n return { value: external };\n}\n\ninterface IConverterContext {\n resultQueue: Queue<InternalToken>;\n operatorStack: Stack<InternalToken>;\n currentToken: string;\n currentTokenType: InternalTokenType;\n previousToken?: string;\n previousTokenType?: InternalTokenType;\n}\n\ntype TokenInterpreter = (ctx: IConverterContext) => IResult<boolean>;\n\nfunction incrementArgCount(token: InternalToken) {\n if (!token.argCountIncremented) {\n token.argCount++;\n token.argCountIncremented = true;\n }\n}\n\nfunction addOperand(ctx: IConverterContext, type: InternalTokenType) {\n ctx.resultQueue.enqueue({ value: ctx.currentToken, type, argCount: 0, argCountIncremented: false });\n\n const currentOperators = ctx.operatorStack.peekN(2);\n const op1 = currentOperators[0];\n if (undefined !== op1) {\n incrementArgCount(op1);\n if (op1.argCount === 1) {\n const op2 = currentOperators[1];\n if (undefined !== op2 && op2.argCount !== 0) {\n incrementArgCount(op2);\n }\n }\n }\n}\n\nconst addNumber: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand(ctx, InternalTokenType.Number);\n return { value: true };\n};\n\nconst addVariable: TokenInterpreter = (ctx: IConverterContext) => {\n ctx = { ...ctx, currentToken: ctx.currentToken.toLowerCase() };\n if (undefined !== ctx.previousToken && isNumber(ctx.previousToken)) {\n addOperator({ ...ctx, currentToken: \"*\" });\n addOperand({ ...ctx, previousToken: \"*\" }, InternalTokenType.Variable);\n } else {\n addOperand(ctx, InternalTokenType.Variable);\n }\n return { value: true };\n};\n\nconst addFunction: TokenInterpreter = (ctx: IConverterContext) => {\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n\n ctx.operatorStack.push({ value: ctx.currentToken, type: InternalTokenType.Function, argCount: 0, argCountIncremented: false });\n return { value: true };\n};\n\nconst addOperator: TokenInterpreter = (ctx: IConverterContext) => {\n if (!isSupportedOperator(ctx.currentToken)) {\n return { errorMessage: `Operator \"${ctx.currentToken}\" is not supported.` };\n }\n\n const binary = undefined !== ctx.previousToken && \"(\" !== ctx.previousToken && \",\" !== ctx.previousToken && !isOperator(ctx.previousToken);\n const unary = !binary;\n\n const op = unary ? getUnaryOperator(ctx.currentToken) : getBinaryOperator(ctx.currentToken);\n if (unary && undefined === op) {\n return { errorMessage: `Unary \"${ctx.currentToken}\" is not supported.` };\n }\n\n const o1 = ctx.currentToken;\n const o1Associativity = getOperatorAssociativity(op);\n const o1Precedence = getOperatorPrecedence(op);\n while (ctx.operatorStack.length > 0) {\n const o2 = ctx.operatorStack.peek()!;\n\n if (o2.value === \"(\") {\n break;\n }\n\n const o2Unary = o2.argCount === 0;\n const op2 = o2Unary ? getUnaryOperator(o2.value) : getBinaryOperator(o2.value);\n const o2Precedence = getOperatorPrecedence(op2);\n if (!(o2Precedence > o1Precedence || (o2Precedence === o1Precedence && o1Associativity === OperatorAssociativity.Left))) {\n break;\n }\n\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n ctx.operatorStack.push({\n value: o1,\n type: InternalTokenType.Operator,\n argCount: binary ? 1 : 0,\n argCountIncremented: false,\n });\n\n return { value: true };\n};\n\nconst openParenthesis: TokenInterpreter = (ctx: IConverterContext) => {\n if (undefined !== ctx.previousToken) {\n if (InternalTokenType.Number === ctx.previousTokenType || InternalTokenType.ClosingParenthesis === ctx.previousTokenType) {\n addOperator({ ...ctx, currentToken: \"*\" });\n } else if (InternalTokenType.Variable === ctx.previousTokenType) {\n return { errorMessage: `Function \"${ctx.previousToken}\" is not supported.` };\n }\n }\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator && currentOperator.type !== InternalTokenType.Function) {\n incrementArgCount(currentOperator);\n }\n\n ctx.operatorStack.push({ value: \"(\", type: InternalTokenType.OpeningParenthesis, argCount: 0, argCountIncremented: false });\n return { value: true };\n};\n\nconst closeParenthesis: TokenInterpreter = (ctx: IConverterContext) => {\n while (ctx.operatorStack.length > 0 && ctx.operatorStack.peek()!.value !== \"(\") {\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n }\n\n const leftParenthesis = ctx.operatorStack.pop();\n if (undefined === leftParenthesis) {\n return { errorMessage: `Closing parenthesis \")\" found, but the opening parenthesis \"(\" is missing.` };\n }\n\n const potentialFnToken = ctx.operatorStack.peek();\n if (undefined !== potentialFnToken && isFunction(potentialFnToken.value)) {\n potentialFnToken.argCount = leftParenthesis.argCount;\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n }\n\n return { value: true };\n};\n\nconst addString: TokenInterpreter = (ctx: IConverterContext) => {\n const withoutDelimiters = ctx.currentToken.substring(1, ctx.currentToken.length - 1);\n addOperand({ ...ctx, currentToken: withoutDelimiters }, InternalTokenType.String);\n return { value: true };\n};\n\nconst addBoolean: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand({ ...ctx, currentToken: ctx.currentToken.toLowerCase() }, InternalTokenType.Boolean);\n return { value: true };\n};\n\nconst addNull: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand({ ...ctx, currentToken: ctx.currentToken.toLowerCase() }, InternalTokenType.Null);\n return { value: true };\n};\n\nconst separateFunctionArgumentSeparator: TokenInterpreter = (ctx: IConverterContext) => {\n while (ctx.operatorStack.length > 0 && ctx.operatorStack.peek()!.value !== \"(\") {\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n const last2Operators = ctx.operatorStack.peekN(2);\n if (last2Operators.length < 2 || last2Operators[0].type !== InternalTokenType.OpeningParenthesis || last2Operators[1].type !== InternalTokenType.Function) {\n return { errorMessage: `Function argument separator \",\" found outside of a function call.` };\n }\n\n last2Operators[0].argCountIncremented = false;\n return { value: true };\n};\n\nfunction getTokenType(token: string, nextToken: string | undefined): InternalTokenType {\n if (isNumber(token)) {\n return InternalTokenType.Number;\n } else if (isStringLiteral(token)) {\n return InternalTokenType.String;\n } else if (isBoolean(token)) {\n return InternalTokenType.Boolean;\n } else if (isNull(token)) {\n return InternalTokenType.Null;\n } else if (isFunction(token) && \"(\" === nextToken) {\n return InternalTokenType.Function;\n } else if (isOperator(token)) {\n return InternalTokenType.Operator;\n } else if (\"(\" === token) {\n return InternalTokenType.OpeningParenthesis;\n } else if (\")\" === token) {\n return InternalTokenType.ClosingParenthesis;\n } else if (\",\" === token) {\n return InternalTokenType.ArgumentSeparator;\n } else {\n return InternalTokenType.Variable;\n }\n}\n\nconst tokenInterpreters: Map<InternalTokenType, TokenInterpreter> = new Map([\n [InternalTokenType.Number, addNumber],\n [InternalTokenType.ArgumentSeparator, separateFunctionArgumentSeparator],\n [InternalTokenType.ClosingParenthesis, closeParenthesis],\n [InternalTokenType.Function, addFunction],\n [InternalTokenType.OpeningParenthesis, openParenthesis],\n [InternalTokenType.Operator, addOperator],\n [InternalTokenType.Variable, addVariable],\n [InternalTokenType.String, addString],\n [InternalTokenType.Boolean, addBoolean],\n [InternalTokenType.Null, addNull],\n]);\n\nexport function convertInfixToPostfix(infix: string[]): IResult<Queue<Token>> {\n const resultQueue = new Queue<InternalToken>();\n const operatorStack = new Stack<InternalToken>();\n\n for (let index = 0; index < infix.length; index++) {\n const token = infix[index];\n\n const ctx: IConverterContext = {\n resultQueue,\n operatorStack,\n currentToken: token,\n currentTokenType: getTokenType(token, index < infix.length - 1 ? infix[index + 1] : undefined),\n previousToken: index > 0 ? infix[index - 1] : undefined,\n previousTokenType: index > 0 ? getTokenType(infix[index - 1], token) : undefined,\n };\n\n const fn = tokenInterpreters.get(ctx.currentTokenType)!;\n\n const tmpResult = fn(ctx);\n if (undefined === tmpResult.value) {\n return { errorMessage: tmpResult.errorMessage };\n }\n }\n\n while (operatorStack.length > 0) {\n resultQueue.enqueue(operatorStack.pop()!);\n\n const currentOperator = operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n return getExternalQueue(resultQueue);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InfixToPostfixConverter.js","sourceRoot":"","sources":["../../../src/formula/InfixToPostfixConverter.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,uEAAuD;AACvD,yEAA0L;AAE1L,mCAAgC;AAChC,mCAAgC;AAChC,mCAA4C;AAE5C,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,CAAC,KAAK,CA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D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAE3B,MAAM,GAAG,GAAsB;YAC7B,WAAW;YACX,aAAa;YACb,YAAY,EAAE,KAAK;YACnB,gBAAgB,EAAE,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9F,aAAa,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;YACvD,iBAAiB,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;SACjF,CAAC;QAEF,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAE,CAAC;QAExD,MAAM,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,SAAS,KAAK,SAAS,CAAC,KAAK,EAAE;YACjC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC;SACjD;KACF;IAED,OAAO,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,EAAG,CAAC,CAAC;QAE1C,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;QAC7C,IAAI,SAAS,KAAK,eAAe,EAAE;YACjC,iBAAiB,CAAC,eAAe,CAAC,CAAC;SACpC;KACF;IAED,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;AACvC,CAAC;AAlCD,sDAkCC","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 { isFunction } from \"./FormulaFunctionProvider\";\nimport { getBinaryOperator, getOperatorAssociativity, getOperatorPrecedence, getUnaryOperator, isOperator, isSupportedOperator, OperatorAssociativity } from \"./FormulaOperatorsProvider\";\nimport type { IResult } from \"./IResult\";\nimport { Queue } from \"./Queue\";\nimport { Stack } from \"./Stack\";\nimport { isStringDelimiter } from \"./Utils\";\n\nfunction isNumber(part: string): boolean {\n return !isNaN(Number(part)) || !isNaN(parseFloat(part));\n}\n\nfunction isStringLiteral(token: string): boolean {\n if (token.length < 2) {\n return false;\n }\n\n const firstCharacter = token[0];\n const lastCharacter = token[token.length - 1];\n return firstCharacter === lastCharacter && isStringDelimiter(firstCharacter);\n}\n\nfunction isBoolean(token: string): boolean {\n const lower = token.toLowerCase();\n return lower === \"true\" || lower === \"false\";\n}\n\nfunction isNull(token: string): boolean {\n return token.toLowerCase() === \"null\";\n}\n\nexport enum TokenType {\n Number = 0,\n Function = 1,\n Operator = 2,\n Variable = 3,\n String = 4,\n Boolean = 5,\n Null = 6,\n}\n\nenum InternalTokenType {\n Number = 0,\n Function = 1,\n Operator = 2,\n Variable = 3,\n OpeningParenthesis = 4,\n ClosingParenthesis = 5,\n ArgumentSeparator = 6,\n String = 7,\n Boolean = 8,\n Null = 9,\n}\n\nexport interface Token {\n value: string;\n type: TokenType;\n argCount: number;\n}\n\ninterface InternalToken {\n value: string;\n type: InternalTokenType;\n argCount: number;\n argCountIncremented: boolean;\n}\n\nfunction getExternalQueue(internal: Queue<InternalToken>): IResult<Queue<Token>> {\n const external = new Queue<Token>();\n while (internal.length > 0) {\n const t = internal.dequeue()!;\n\n switch (t.type) {\n case InternalTokenType.Number:\n external.enqueue({ value: t.value, type: TokenType.Number, argCount: t.argCount });\n break;\n case InternalTokenType.Function:\n external.enqueue({ value: t.value, type: TokenType.Function, argCount: t.argCount });\n break;\n case InternalTokenType.Operator:\n external.enqueue({ value: t.value, type: TokenType.Operator, argCount: t.argCount });\n break;\n case InternalTokenType.Variable:\n external.enqueue({ value: t.value, type: TokenType.Variable, argCount: t.argCount });\n break;\n case InternalTokenType.String:\n external.enqueue({ value: t.value, type: TokenType.String, argCount: t.argCount });\n break;\n case InternalTokenType.Boolean:\n external.enqueue({ value: t.value, type: TokenType.Boolean, argCount: t.argCount });\n break;\n case InternalTokenType.Null:\n external.enqueue({ value: t.value, type: TokenType.Null, argCount: t.argCount });\n break;\n default:\n return { errorMessage: `Missing closing parenthesis \")\".` };\n }\n }\n\n return { value: external };\n}\n\ninterface IConverterContext {\n resultQueue: Queue<InternalToken>;\n operatorStack: Stack<InternalToken>;\n currentToken: string;\n currentTokenType: InternalTokenType;\n previousToken?: string;\n previousTokenType?: InternalTokenType;\n}\n\ntype TokenInterpreter = (ctx: IConverterContext) => IResult<boolean>;\n\nfunction incrementArgCount(token: InternalToken) {\n if (!token.argCountIncremented) {\n token.argCount++;\n token.argCountIncremented = true;\n }\n}\n\nfunction addOperand(ctx: IConverterContext, type: InternalTokenType) {\n ctx.resultQueue.enqueue({ value: ctx.currentToken, type, argCount: 0, argCountIncremented: false });\n\n const currentOperators = ctx.operatorStack.peekN(2);\n const op1 = currentOperators[0];\n if (undefined !== op1) {\n incrementArgCount(op1);\n if (op1.argCount === 1) {\n const op2 = currentOperators[1];\n if (undefined !== op2 && op2.argCount !== 0) {\n incrementArgCount(op2);\n }\n }\n }\n}\n\nconst addNumber: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand(ctx, InternalTokenType.Number);\n return { value: true };\n};\n\nconst addVariable: TokenInterpreter = (ctx: IConverterContext) => {\n ctx = { ...ctx, currentToken: ctx.currentToken.toLowerCase() };\n if (undefined !== ctx.previousToken && isNumber(ctx.previousToken)) {\n addOperator({ ...ctx, currentToken: \"*\" });\n addOperand({ ...ctx, previousToken: \"*\" }, InternalTokenType.Variable);\n } else {\n addOperand(ctx, InternalTokenType.Variable);\n }\n return { value: true };\n};\n\nconst addFunction: TokenInterpreter = (ctx: IConverterContext) => {\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n\n ctx.operatorStack.push({ value: ctx.currentToken, type: InternalTokenType.Function, argCount: 0, argCountIncremented: false });\n return { value: true };\n};\n\nconst addOperator: TokenInterpreter = (ctx: IConverterContext) => {\n if (!isSupportedOperator(ctx.currentToken)) {\n return { errorMessage: `Operator \"${ctx.currentToken}\" is not supported.` };\n }\n\n const binary = undefined !== ctx.previousToken && \"(\" !== ctx.previousToken && \",\" !== ctx.previousToken && !isOperator(ctx.previousToken);\n const unary = !binary;\n\n const op = unary ? getUnaryOperator(ctx.currentToken) : getBinaryOperator(ctx.currentToken);\n if (unary && undefined === op) {\n return { errorMessage: `Unary \"${ctx.currentToken}\" is not supported.` };\n }\n\n const o1 = ctx.currentToken;\n const o1Associativity = getOperatorAssociativity(op);\n const o1Precedence = getOperatorPrecedence(op);\n while (ctx.operatorStack.length > 0) {\n const o2 = ctx.operatorStack.peek()!;\n\n if (o2.value === \"(\") {\n break;\n }\n\n const o2Unary = (o2.argCount === 0) || (o2.argCount === 1 && o2.argCountIncremented === true);\n const op2 = o2Unary ? getUnaryOperator(o2.value) : getBinaryOperator(o2.value);\n const o2Precedence = getOperatorPrecedence(op2);\n if (!(o2Precedence > o1Precedence || (o2Precedence === o1Precedence && o1Associativity === OperatorAssociativity.Left))) {\n break;\n }\n\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n ctx.operatorStack.push({\n value: o1,\n type: InternalTokenType.Operator,\n argCount: binary ? 1 : 0,\n argCountIncremented: false,\n });\n\n return { value: true };\n};\n\nconst openParenthesis: TokenInterpreter = (ctx: IConverterContext) => {\n if (undefined !== ctx.previousToken) {\n if (InternalTokenType.Number === ctx.previousTokenType || InternalTokenType.ClosingParenthesis === ctx.previousTokenType) {\n addOperator({ ...ctx, currentToken: \"*\" });\n } else if (InternalTokenType.Variable === ctx.previousTokenType) {\n return { errorMessage: `Function \"${ctx.previousToken}\" is not supported.` };\n }\n }\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator && currentOperator.type !== InternalTokenType.Function) {\n incrementArgCount(currentOperator);\n }\n\n ctx.operatorStack.push({ value: \"(\", type: InternalTokenType.OpeningParenthesis, argCount: 0, argCountIncremented: false });\n return { value: true };\n};\n\nconst closeParenthesis: TokenInterpreter = (ctx: IConverterContext) => {\n while (ctx.operatorStack.length > 0 && ctx.operatorStack.peek()!.value !== \"(\") {\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n }\n\n const leftParenthesis = ctx.operatorStack.pop();\n if (undefined === leftParenthesis) {\n return { errorMessage: `Closing parenthesis \")\" found, but the opening parenthesis \"(\" is missing.` };\n }\n\n const potentialFnToken = ctx.operatorStack.peek();\n if (undefined !== potentialFnToken && isFunction(potentialFnToken.value)) {\n potentialFnToken.argCount = leftParenthesis.argCount;\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n }\n\n return { value: true };\n};\n\nconst addString: TokenInterpreter = (ctx: IConverterContext) => {\n const withoutDelimiters = ctx.currentToken.substring(1, ctx.currentToken.length - 1);\n addOperand({ ...ctx, currentToken: withoutDelimiters }, InternalTokenType.String);\n return { value: true };\n};\n\nconst addBoolean: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand({ ...ctx, currentToken: ctx.currentToken.toLowerCase() }, InternalTokenType.Boolean);\n return { value: true };\n};\n\nconst addNull: TokenInterpreter = (ctx: IConverterContext) => {\n addOperand({ ...ctx, currentToken: ctx.currentToken.toLowerCase() }, InternalTokenType.Null);\n return { value: true };\n};\n\nconst separateFunctionArgumentSeparator: TokenInterpreter = (ctx: IConverterContext) => {\n while (ctx.operatorStack.length > 0 && ctx.operatorStack.peek()!.value !== \"(\") {\n ctx.resultQueue.enqueue(ctx.operatorStack.pop()!);\n\n const currentOperator = ctx.operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n const last2Operators = ctx.operatorStack.peekN(2);\n if (last2Operators.length < 2 || last2Operators[0].type !== InternalTokenType.OpeningParenthesis || last2Operators[1].type !== InternalTokenType.Function) {\n return { errorMessage: `Function argument separator \",\" found outside of a function call.` };\n }\n\n last2Operators[0].argCountIncremented = false;\n return { value: true };\n};\n\nfunction getTokenType(token: string, nextToken: string | undefined): InternalTokenType {\n if (isNumber(token)) {\n return InternalTokenType.Number;\n } else if (isStringLiteral(token)) {\n return InternalTokenType.String;\n } else if (isBoolean(token)) {\n return InternalTokenType.Boolean;\n } else if (isNull(token)) {\n return InternalTokenType.Null;\n } else if (isFunction(token) && \"(\" === nextToken) {\n return InternalTokenType.Function;\n } else if (isOperator(token)) {\n return InternalTokenType.Operator;\n } else if (\"(\" === token) {\n return InternalTokenType.OpeningParenthesis;\n } else if (\")\" === token) {\n return InternalTokenType.ClosingParenthesis;\n } else if (\",\" === token) {\n return InternalTokenType.ArgumentSeparator;\n } else {\n return InternalTokenType.Variable;\n }\n}\n\nconst tokenInterpreters: Map<InternalTokenType, TokenInterpreter> = new Map([\n [InternalTokenType.Number, addNumber],\n [InternalTokenType.ArgumentSeparator, separateFunctionArgumentSeparator],\n [InternalTokenType.ClosingParenthesis, closeParenthesis],\n [InternalTokenType.Function, addFunction],\n [InternalTokenType.OpeningParenthesis, openParenthesis],\n [InternalTokenType.Operator, addOperator],\n [InternalTokenType.Variable, addVariable],\n [InternalTokenType.String, addString],\n [InternalTokenType.Boolean, addBoolean],\n [InternalTokenType.Null, addNull],\n]);\n\nexport function convertInfixToPostfix(infix: string[]): IResult<Queue<Token>> {\n const resultQueue = new Queue<InternalToken>();\n const operatorStack = new Stack<InternalToken>();\n\n for (let index = 0; index < infix.length; index++) {\n const token = infix[index];\n\n const ctx: IConverterContext = {\n resultQueue,\n operatorStack,\n currentToken: token,\n currentTokenType: getTokenType(token, index < infix.length - 1 ? infix[index + 1] : undefined),\n previousToken: index > 0 ? infix[index - 1] : undefined,\n previousTokenType: index > 0 ? getTokenType(infix[index - 1], token) : undefined,\n };\n\n const fn = tokenInterpreters.get(ctx.currentTokenType)!;\n\n const tmpResult = fn(ctx);\n if (undefined === tmpResult.value) {\n return { errorMessage: tmpResult.errorMessage };\n }\n }\n\n while (operatorStack.length > 0) {\n resultQueue.enqueue(operatorStack.pop()!);\n\n const currentOperator = operatorStack.peek();\n if (undefined !== currentOperator) {\n incrementArgCount(currentOperator);\n }\n }\n\n return getExternalQueue(resultQueue);\n}\n"]}
|
|
@@ -35,6 +35,7 @@ const moq = __importStar(require("typemoq"));
|
|
|
35
35
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
36
36
|
const presentation_frontend_1 = require("@itwin/presentation-frontend");
|
|
37
37
|
const core_common_1 = require("@itwin/core-common");
|
|
38
|
+
const grouping_mapping_widget_2 = require("../grouping-mapping-widget");
|
|
38
39
|
const mockITwinId = faker_1.faker.datatype.uuid();
|
|
39
40
|
const mockIModelId = faker_1.faker.datatype.uuid();
|
|
40
41
|
const mockMappingId = faker_1.faker.datatype.uuid();
|
|
@@ -158,5 +159,148 @@ describe("Groupings View with default UIs", () => {
|
|
|
158
159
|
const editManual = test_utils_1.screen.getAllByTestId(`gmw-edit-2`);
|
|
159
160
|
expect(editManual).toHaveLength(1);
|
|
160
161
|
});
|
|
162
|
+
it("Set up grouping custom UI - should replace default grouping methods", async () => {
|
|
163
|
+
// Arange
|
|
164
|
+
const mockGroups = groupsFactory();
|
|
165
|
+
const mockedAccessToken = await test_utils_1.mockAccessToken();
|
|
166
|
+
test_utils_1.mockMappingClient
|
|
167
|
+
.setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))
|
|
168
|
+
.returns(async () => mockGroups.groups);
|
|
169
|
+
const mockedUIComponent = (_props) => react_1.default.createElement("div");
|
|
170
|
+
const mockGroupingUI = {
|
|
171
|
+
type: grouping_mapping_widget_2.GroupingMappingCustomUIType.Grouping,
|
|
172
|
+
name: "mOcKgRoUpInGuI",
|
|
173
|
+
displayLabel: "Mock Grouping UI",
|
|
174
|
+
uiComponent: mockedUIComponent,
|
|
175
|
+
};
|
|
176
|
+
// Act
|
|
177
|
+
const { user } = test_utils_1.render(react_1.default.createElement(grouping_mapping_widget_1.Groupings, { mapping: mockMapping, goBack: jest.fn() }), [mockGroupingUI]);
|
|
178
|
+
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
179
|
+
// Assert
|
|
180
|
+
const addButton = test_utils_1.screen.getAllByTestId("gmw-add-group-button");
|
|
181
|
+
expect(addButton).toHaveLength(1);
|
|
182
|
+
// Click on 'Add Group' button
|
|
183
|
+
await user.click(addButton[0]);
|
|
184
|
+
// Should have exactly 1 add method with given configuration
|
|
185
|
+
const addCustom = test_utils_1.screen.getAllByTestId("gmw-add-0");
|
|
186
|
+
expect(addCustom).toHaveLength(1);
|
|
187
|
+
expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);
|
|
188
|
+
// Each group should have a more icon button
|
|
189
|
+
const moreButton = test_utils_1.screen.getAllByTestId("gmw-more-button");
|
|
190
|
+
expect(moreButton).toHaveLength(mockGroups.groups.length);
|
|
191
|
+
expect(moreButton.length).toBeGreaterThan(0);
|
|
192
|
+
// Click on first more icon
|
|
193
|
+
await user.click(moreButton[0]);
|
|
194
|
+
// Should have 3 context menu items without context configuration
|
|
195
|
+
const contextMenuItems = test_utils_1.screen.getAllByTestId("gmw-context-menu-item");
|
|
196
|
+
expect(contextMenuItems).toHaveLength(3);
|
|
197
|
+
expect(contextMenuItems[0]).toHaveTextContent("Edit");
|
|
198
|
+
// Hover on 'Edit'
|
|
199
|
+
await user.hover(contextMenuItems[0]);
|
|
200
|
+
// Should have exactly 1 sub menu item
|
|
201
|
+
const editCustom = test_utils_1.screen.getAllByTestId(`gmw-edit-0`);
|
|
202
|
+
expect(editCustom).toHaveLength(1);
|
|
203
|
+
expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);
|
|
204
|
+
// Click on the edit custom UI
|
|
205
|
+
await user.click(editCustom[0]);
|
|
206
|
+
const groupName = test_utils_1.screen.getAllByText(mockGroups.groups[0].groupName);
|
|
207
|
+
expect(groupName).toHaveLength(1);
|
|
208
|
+
});
|
|
209
|
+
it("Set up context custom UI - should have default grouping methods and add context menu", async () => {
|
|
210
|
+
// Arange
|
|
211
|
+
const mockGroups = groupsFactory();
|
|
212
|
+
const mockedAccessToken = await test_utils_1.mockAccessToken();
|
|
213
|
+
test_utils_1.mockMappingClient
|
|
214
|
+
.setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))
|
|
215
|
+
.returns(async () => mockGroups.groups);
|
|
216
|
+
const mockedUIComponent = (_props) => react_1.default.createElement("div");
|
|
217
|
+
const mockContextUI = {
|
|
218
|
+
type: grouping_mapping_widget_2.GroupingMappingCustomUIType.Context,
|
|
219
|
+
name: "mOcKgRoUpInGuI",
|
|
220
|
+
displayLabel: "Mock Grouping UI",
|
|
221
|
+
uiComponent: mockedUIComponent,
|
|
222
|
+
};
|
|
223
|
+
// Act
|
|
224
|
+
const { user } = test_utils_1.render(react_1.default.createElement(grouping_mapping_widget_1.Groupings, { mapping: mockMapping, goBack: jest.fn() }), [mockContextUI]);
|
|
225
|
+
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
226
|
+
// Assert
|
|
227
|
+
const addButton = test_utils_1.screen.getAllByTestId("gmw-add-group-button");
|
|
228
|
+
expect(addButton).toHaveLength(1);
|
|
229
|
+
// Click on 'Add Group' button
|
|
230
|
+
await user.click(addButton[0]);
|
|
231
|
+
// Should have three menu items
|
|
232
|
+
const addSelection = test_utils_1.screen.getAllByTestId("gmw-add-0");
|
|
233
|
+
expect(addSelection).toHaveLength(1);
|
|
234
|
+
const addSearch = test_utils_1.screen.getAllByTestId("gmw-add-1");
|
|
235
|
+
expect(addSearch).toHaveLength(1);
|
|
236
|
+
const addManual = test_utils_1.screen.getAllByTestId("gmw-add-2");
|
|
237
|
+
expect(addManual).toHaveLength(1);
|
|
238
|
+
// Should have the right group number
|
|
239
|
+
const horizontalTiles = test_utils_1.screen.getAllByTestId("gmw-horizontal-tile");
|
|
240
|
+
expect(horizontalTiles).toHaveLength(mockGroups.groups.length);
|
|
241
|
+
// Click on first group more icon
|
|
242
|
+
const moreButton = test_utils_1.screen.getAllByTestId("gmw-more-button");
|
|
243
|
+
expect(moreButton).toHaveLength(mockGroups.groups.length);
|
|
244
|
+
await user.click(moreButton[0]);
|
|
245
|
+
// Should have 4 context menu items
|
|
246
|
+
const contextMenuItems = test_utils_1.screen.getAllByTestId("gmw-context-menu-item");
|
|
247
|
+
expect(contextMenuItems).toHaveLength(4);
|
|
248
|
+
expect(contextMenuItems[0]).toHaveTextContent("Edit");
|
|
249
|
+
expect(contextMenuItems[1]).toHaveTextContent("Properties");
|
|
250
|
+
expect(contextMenuItems[2]).toHaveTextContent("Remove");
|
|
251
|
+
expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);
|
|
252
|
+
// Click on the context ui
|
|
253
|
+
await user.click(contextMenuItems[3]);
|
|
254
|
+
});
|
|
255
|
+
it("Set up both grouping and context custom UI", async () => {
|
|
256
|
+
// Arange
|
|
257
|
+
const mockGroups = groupsFactory();
|
|
258
|
+
const mockedAccessToken = await test_utils_1.mockAccessToken();
|
|
259
|
+
test_utils_1.mockMappingClient
|
|
260
|
+
.setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))
|
|
261
|
+
.returns(async () => mockGroups.groups);
|
|
262
|
+
const mockedGroupingUIComponent = (_props) => react_1.default.createElement("div");
|
|
263
|
+
const mockedContextUIComponent = (_props) => react_1.default.createElement("div");
|
|
264
|
+
const mockGroupingUI = {
|
|
265
|
+
type: grouping_mapping_widget_2.GroupingMappingCustomUIType.Grouping,
|
|
266
|
+
name: "mOcKgRoUpInGuI",
|
|
267
|
+
displayLabel: "Mock Grouping UI",
|
|
268
|
+
uiComponent: mockedGroupingUIComponent,
|
|
269
|
+
};
|
|
270
|
+
const mockContextUI = {
|
|
271
|
+
type: grouping_mapping_widget_2.GroupingMappingCustomUIType.Context,
|
|
272
|
+
name: "mOcKgRoUpInGuI",
|
|
273
|
+
displayLabel: "Mock Grouping UI",
|
|
274
|
+
uiComponent: mockedContextUIComponent,
|
|
275
|
+
};
|
|
276
|
+
// Act
|
|
277
|
+
const { user } = test_utils_1.render(react_1.default.createElement(grouping_mapping_widget_1.Groupings, { mapping: mockMapping, goBack: jest.fn() }), [mockContextUI, mockGroupingUI]);
|
|
278
|
+
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
279
|
+
// Assert
|
|
280
|
+
const addButton = test_utils_1.screen.getAllByTestId("gmw-add-group-button");
|
|
281
|
+
expect(addButton).toHaveLength(1);
|
|
282
|
+
// Click on 'Add Group' button
|
|
283
|
+
await user.click(addButton[0]);
|
|
284
|
+
// Should have exactly 1 add method with given configuration
|
|
285
|
+
const addCustom = test_utils_1.screen.getAllByTestId("gmw-add-0");
|
|
286
|
+
expect(addCustom).toHaveLength(1);
|
|
287
|
+
expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);
|
|
288
|
+
// Check the group tile number
|
|
289
|
+
const horizontalTiles = test_utils_1.screen.getAllByTestId("gmw-horizontal-tile");
|
|
290
|
+
expect(horizontalTiles).toHaveLength(mockGroups.groups.length);
|
|
291
|
+
// Click on first group more icon
|
|
292
|
+
const moreButton = test_utils_1.screen.getAllByTestId("gmw-more-button");
|
|
293
|
+
expect(moreButton).toHaveLength(mockGroups.groups.length);
|
|
294
|
+
await user.click(moreButton[0]);
|
|
295
|
+
// Should have 4 context menu items
|
|
296
|
+
const contextMenuItems = test_utils_1.screen.getAllByTestId("gmw-context-menu-item");
|
|
297
|
+
expect(contextMenuItems).toHaveLength(4);
|
|
298
|
+
expect(contextMenuItems[0]).toHaveTextContent("Edit");
|
|
299
|
+
expect(contextMenuItems[1]).toHaveTextContent("Properties");
|
|
300
|
+
expect(contextMenuItems[2]).toHaveTextContent("Remove");
|
|
301
|
+
expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);
|
|
302
|
+
// Click on the context ui
|
|
303
|
+
await user.click(contextMenuItems[3]);
|
|
304
|
+
});
|
|
161
305
|
});
|
|
162
306
|
//# sourceMappingURL=GroupingMappingCustomUI.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,6CAAgI;AAChI,2CAAwC;AACxC,wEAAuD;AAEvD,6CAA+B;AAE/B,wDAAmD;AAEnD,wEAAkF;AAElF,oDAAuD;AAEvD,MAAM,WAAW,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC3C,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAChC,UAAU,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC5C,iBAAiB,EAAC,KAAK;IACvB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAA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AAM,CAAC,CAAC;QAE1D,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,mCAAmC;QACnC,MAAM,gBAAgB,GAAG,mBAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QACxE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAExD,kBAAkB;QAClB,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,+BAA+B;QAC/B,MAAM,aAAa,GAAG,mBAAM,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC1D,MAAM,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,UAAU,GAAG,mBAAM,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QACvD,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,UAAU,GAAG,mBAAM,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QACvD,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { mockAccessToken, mockMappingClient, render, screen, TestUtils, waitForElementToBeRemoved, within } from \"./test-utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { Groupings } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, Mapping} from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, SelectionSet, SelectionSetEvent} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport type { SelectionManager, SelectionScopesManager } from \"@itwin/presentation-frontend\";\nimport { Presentation, SelectionChangeEvent } from \"@itwin/presentation-frontend\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled:false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst selectionManagerMock = moq.Mock.ofType<SelectionManager>();\nconst selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nbeforeAll(async () => {\n await NoRenderApp.startup({localization: new EmptyLocalization()});\n await Presentation.initialize();\n const selectionSet = moq.Mock.ofType<SelectionSet>();\n const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();\n selectionSet.setup((x) => x.elements).returns(() => new Set([]));\n selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);\n connectionMock\n .setup((x) => x.selectionSet)\n .returns(() => selectionSet.object);\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n selectionManagerMock\n .setup((x) => x.selectionChange)\n .returns(() => new SelectionChangeEvent());\n\n selectionScopesManagerMock\n .setup(async (x) => x.getSelectionScopes(connectionMock.object))\n .returns(async () => []);\n selectionManagerMock\n .setup((x) => x.scopes)\n .returns(() => selectionScopesManagerMock.object);\n\n Presentation.setSelectionManager(selectionManagerMock.object);\n await TestUtils.initializeUiFramework(connectionMock.object);\n});\n\ndescribe(\"Groupings View with default UIs\", () => {\n it(\"List all groups and click on add group and edit group buttons\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have 3 sub menu items\n const editSelection = screen.getAllByTestId(`gmw-edit-0`);\n expect(editSelection).toHaveLength(1);\n const editSearch = screen.getAllByTestId(`gmw-edit-1`);\n expect(editSearch).toHaveLength(1);\n const editManual = screen.getAllByTestId(`gmw-edit-2`);\n expect(editManual).toHaveLength(1);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,6CAAgI;AAChI,2CAAwC;AACxC,wEAAuD;AAEvD,6CAA+B;AAE/B,wDAAmD;AAEnD,wEAAkF;AAElF,oDAAuD;AAEvD,wEAAyE;AAEzE,MAAM,WAAW,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,a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AC,MAAM,CAAC,CAAC;QAE/D,iCAAiC;QACjC,MAAM,UAAU,GAAG,mBAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE1D,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,mCAAmC;QACnC,MAAM,gBAAgB,GAAG,mBAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QACxE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAE1E,0BAA0B;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { mockAccessToken, mockMappingClient, render, screen, TestUtils, waitForElementToBeRemoved, within } from \"./test-utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { Groupings } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, SelectionSet, SelectionSetEvent} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport type { SelectionManager, SelectionScopesManager } from \"@itwin/presentation-frontend\";\nimport { Presentation, SelectionChangeEvent } from \"@itwin/presentation-frontend\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI} from \"../grouping-mapping-widget\";\nimport { GroupingMappingCustomUIType } from \"../grouping-mapping-widget\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled:false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst selectionManagerMock = moq.Mock.ofType<SelectionManager>();\nconst selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nbeforeAll(async () => {\n await NoRenderApp.startup({localization: new EmptyLocalization()});\n await Presentation.initialize();\n const selectionSet = moq.Mock.ofType<SelectionSet>();\n const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();\n selectionSet.setup((x) => x.elements).returns(() => new Set([]));\n selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);\n connectionMock\n .setup((x) => x.selectionSet)\n .returns(() => selectionSet.object);\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n selectionManagerMock\n .setup((x) => x.selectionChange)\n .returns(() => new SelectionChangeEvent());\n\n selectionScopesManagerMock\n .setup(async (x) => x.getSelectionScopes(connectionMock.object))\n .returns(async () => []);\n selectionManagerMock\n .setup((x) => x.scopes)\n .returns(() => selectionScopesManagerMock.object);\n\n Presentation.setSelectionManager(selectionManagerMock.object);\n await TestUtils.initializeUiFramework(connectionMock.object);\n});\n\ndescribe(\"Groupings View with default UIs\", () => {\n it(\"List all groups and click on add group and edit group buttons\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have 3 sub menu items\n const editSelection = screen.getAllByTestId(`gmw-edit-0`);\n expect(editSelection).toHaveLength(1);\n const editSearch = screen.getAllByTestId(`gmw-edit-1`);\n expect(editSearch).toHaveLength(1);\n const editManual = screen.getAllByTestId(`gmw-edit-2`);\n expect(editManual).toHaveLength(1);\n });\n\n it(\"Set up grouping custom UI - should replace default grouping methods\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockGroupingUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items without context configuration\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have default grouping methods and add context menu\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockContextUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockContextUI, mockGroupingUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n});\n"]}
|
|
@@ -14,8 +14,7 @@ const utils_1 = require("./utils");
|
|
|
14
14
|
require("./BlockingOverlay.scss");
|
|
15
15
|
const BlockingOverlay = ({ isVisible }) => {
|
|
16
16
|
return (react_1.default.createElement("div", { className: classnames_1.default("gmw-group-mapping-blocking-overlay", isVisible && "gmw-visible") },
|
|
17
|
-
react_1.default.createElement(
|
|
18
|
-
react_1.default.createElement(utils_1.LoadingSpinner, null))));
|
|
17
|
+
react_1.default.createElement(utils_1.LoadingSpinner, null)));
|
|
19
18
|
};
|
|
20
19
|
exports.BlockingOverlay = BlockingOverlay;
|
|
21
20
|
//# sourceMappingURL=BlockingOverlay.js.map
|
|
@@ -1 +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,oCAAoC,EAAE,SAAS,IAAI,aAAa,CAAC;QAC1F,
|
|
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,oCAAoC,EAAE,SAAS,IAAI,aAAa,CAAC;QAC1F,8BAAC,sBAAc,OAAG,CACd,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B","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(\"gmw-group-mapping-blocking-overlay\", isVisible && \"gmw-visible\")}>\n <LoadingSpinner />\n </div>\n );\n};\n"]}
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import
|
|
5
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
7
|
.gmw-group-mapping-blocking-overlay {
|
|
8
8
|
background-color: black;
|
|
9
9
|
position: absolute;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
top: $iui-baseline;
|
|
14
|
+
bottom: $iui-baseline;
|
|
15
|
+
right: $iui-s;
|
|
16
|
+
left: $iui-s;
|
|
13
17
|
opacity: 60%;
|
|
14
18
|
z-index: 9999;
|
|
15
19
|
visibility: hidden;
|
|
@@ -18,9 +22,3 @@
|
|
|
18
22
|
visibility: visible;
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
.gmw-group-mapping-blocking-overlay-spinner {
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
height: inherit;
|
|
26
|
-
}
|
|
@@ -44,7 +44,7 @@ const extractPrimitives = (propertyTraversal, propertyField) => propertyField.pr
|
|
|
44
44
|
primitiveNavigationClass,
|
|
45
45
|
actualECClassName,
|
|
46
46
|
parentPropertyClassName,
|
|
47
|
-
key: `${actualECClassName}
|
|
47
|
+
key: `${parentPropertyClassName}|${actualECClassName}|${newPropertyTraversal.join("|")}`,
|
|
48
48
|
categoryLabel: propertyField.category.label,
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -63,7 +63,7 @@ const extractPrimitiveStructProperties = (propertyTraversal, members, categoryLa
|
|
|
63
63
|
primitiveNavigationClass: "",
|
|
64
64
|
actualECClassName,
|
|
65
65
|
parentPropertyClassName,
|
|
66
|
-
key: `${actualECClassName}
|
|
66
|
+
key: `${parentPropertyClassName}|${actualECClassName}|${newPropertyTraversal.join("|")}`,
|
|
67
67
|
categoryLabel,
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPropertyUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupPropertyUtils.ts"],"names":[],"mappings":";;;AAMA,4DAAkD;AAWlD,oEAMoC;AACpC,wEAA4D;AAC5D,6CAAwC;AAexC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAY,EAAE;IAC7C,QAAQ,IAAI,EAAE;QACZ,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,0BAAQ,CAAC,OAAO,CAAC;QAC1B,KAAK,SAAS;YACZ,OAAO,0BAAQ,CAAC,OAAO,CAAC;QAC1B,KAAK,QAAQ;YACX,OAAO,0BAAQ,CAAC,MAAM,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,0BAAQ,CAAC,MAAM,CAAC;QACzB;YACE,OAAO,0BAAQ,CAAC,MAAM,CAAC;KAC1B;AACH,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,iBAA2B,EAC3B,aAA8B,EACV,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;IACjE,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5C,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC;IACzC,kCAAkC;IAClC,MAAM,uBAAuB,GAAG,MAAA,aAAa,CAAC,MAAM,0CAAE,gBAAgB,CAAC,IAAI,CAAC;IAC5E,MAAM,wBAAwB,GAAG,MAAA,MAAA,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,0CAAE,SAAS,CAAC,IAA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pE,MAAM;aACP;YACD,IAAI,CAAC,KAAK,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvC,QAAQ,GAAG,IAAI,CAAC;aACjB;SACF;QACD,IAAI,QAAQ;YACV,MAAM;KACT;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC;AAClD,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB;AAEK,MAAM,2BAA2B,GAAG,KAAK,EAAE,gBAAkC,EAAE,MAAc,EAAE,EAAE;IACtG,MAAM,OAAO,GAAY;QACvB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE;YACL;gBACE,QAAQ,EAAE,+BAAS,CAAC,OAAO;gBAC3B,cAAc,EAAE;oBACd;wBACE,QAAQ,EAAE,+CAAyB,CAAC,qBAAqB;qBAC1D;iBACF;aACF;SAAC;KACL,CAAC;IACF,MAAM,cAAc,GAA+E;QACjG,MAAM,EAAE,gBAAgB;QACxB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,gDAA0B,CAAC,YAAY;KACrD,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,oCAAY,CAAC,YAAY,CAAC,oBAAoB,CACrE,cAAc,CACf,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAvBW,QAAA,2BAA2B,+BAuBtC","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 type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ECProperty } from \"@itwin/insights-client\";\nimport { DataType } from \"@itwin/insights-client\";\nimport type {\n ContentDescriptorRequestOptions,\n Field,\n KeySet,\n NestedContentField,\n PropertiesField,\n Ruleset,\n RulesetVariable,\n StructFieldMemberDescription,\n} from \"@itwin/presentation-common\";\nimport {\n ContentSpecificationTypes,\n DefaultContentDisplayTypes,\n PropertyValueFormat,\n RelationshipMeaning,\n RuleTypes,\n} from \"@itwin/presentation-common\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { deepEqual } from \"fast-equals\";\n\nexport interface PropertyMetaData {\n displayLabel: string;\n sourceSchema: string;\n sourceClassName: string;\n categoryLabel: string;\n propertyType: DataType;\n actualECClassName: string;\n parentPropertyClassName: string | undefined;\n ecPropertyTraversal: string[];\n primitiveNavigationClass: string;\n key: string;\n}\n\nconst convertType = (type: string): DataType => {\n switch (type) {\n case \"int\":\n case \"enum\":\n case \"long\":\n return DataType.Integer;\n case \"boolean\":\n return DataType.Boolean;\n case \"double\":\n return DataType.Double;\n case \"number\":\n return DataType.Number;\n default:\n return DataType.String;\n }\n};\n\nconst extractPrimitives = (\n propertyTraversal: string[],\n propertyField: PropertiesField\n): PropertyMetaData[] => propertyField.properties.map((property) => {\n const propertyName = property.property.name;\n const displayLabel = propertyField.label;\n // It belongs to this parent class\n const parentPropertyClassName = propertyField.parent?.contentClassInfo.name;\n const primitiveNavigationClass = property.property.navigationPropertyInfo?.classInfo.name ?? \"\";\n /* Presentation assigns primitive navigations properties as a long type due to how it stores the\n ECInstanceId of the class in the meta.ECClassDef table on the C++ layer.\n We are handling this special case.\n */\n const propertyType = primitiveNavigationClass ? DataType.String : convertType(property.property.type);\n const actualECClassName = property.property.classInfo.name;\n const newPropertyTraversal = [...propertyTraversal, propertyName];\n\n return (\n {\n displayLabel,\n sourceSchema: \"*\",\n sourceClassName: \"*\",\n ecPropertyTraversal: newPropertyTraversal,\n propertyType,\n primitiveNavigationClass,\n actualECClassName,\n parentPropertyClassName,\n key: `${actualECClassName}__${newPropertyTraversal.join(\"_\")}`,\n categoryLabel: propertyField.category.label,\n }\n );\n});\n\nconst extractPrimitiveStructProperties = (\n propertyTraversal: string[],\n members: StructFieldMemberDescription[],\n categoryLabel: string,\n actualECClassName: string,\n parentPropertyClassName?: string,\n): PropertyMetaData[] => members.flatMap((member) => {\n if (member.type.valueFormat === PropertyValueFormat.Primitive) {\n const propertyName = member.name;\n const displayLabel = member.label;\n const propertyType = convertType(member.type.typeName);\n const newPropertyTraversal = [...propertyTraversal, propertyName];\n\n return ({\n displayLabel,\n sourceSchema: \"*\",\n sourceClassName: \"*\",\n ecPropertyTraversal: newPropertyTraversal,\n propertyType,\n primitiveNavigationClass: \"\",\n actualECClassName,\n parentPropertyClassName,\n key: `${actualECClassName}__${newPropertyTraversal.join(\"_\")}`,\n categoryLabel,\n });\n\n } else if (member.type.valueFormat === PropertyValueFormat.Struct) {\n return extractPrimitiveStructProperties(\n propertyTraversal,\n member.type.members,\n categoryLabel,\n actualECClassName,\n parentPropertyClassName\n );\n }\n\n return [];\n});\n\nconst extractStruct = (property: Field) => {\n if (property.type.valueFormat !== PropertyValueFormat.Struct) {\n return [];\n }\n\n const columnName = (property as PropertiesField).properties[0]\n .property.name;\n const actualECClassName = (property as PropertiesField).properties[0].property.classInfo.name;\n return extractPrimitiveStructProperties(\n [columnName],\n property.type.members,\n property.category.label,\n actualECClassName\n );\n};\n\nconst extractNested = (propertyTraversal: string[], propertyFields: Field[]): PropertyMetaData[] =>\n propertyFields.flatMap((property) => {\n // Generate base ECProperty\n switch (property.type.valueFormat) {\n case PropertyValueFormat.Primitive: {\n return extractPrimitives([...propertyTraversal], property as PropertiesField);\n }\n // Get structs\n case PropertyValueFormat.Struct: {\n const nestedContentField = property as NestedContentField;\n // Only handling single path and not handling nested content fields within navigations\n if (\n nestedContentField.pathToPrimaryClass &&\n nestedContentField.pathToPrimaryClass.length > 1\n ) {\n break;\n }\n\n switch (nestedContentField.relationshipMeaning) {\n // Aspects are not looked at again. Extraction does not support aspects within navigations.\n // Navigation properties\n case RelationshipMeaning.RelatedInstance: {\n if (\n // Deal with a TypeDefinition\n nestedContentField.pathToPrimaryClass[0].relationshipInfo.name ===\n \"BisCore:GeometricElement3dHasTypeDefinition\"\n ) {\n return extractNested([...propertyTraversal, \"TypeDefinition\"], nestedContentField.nestedFields);\n }\n break;\n }\n default: {\n // Some elements don't have a path to primary class or relationship meaning..\n // Most likely a simple struct property\n if (!nestedContentField.pathToPrimaryClass) {\n return extractStruct(property);\n }\n }\n }\n }\n }\n return [];\n });\n\nexport const convertPresentationFields = (propertyFields: Field[]): PropertyMetaData[] =>\n propertyFields.flatMap((property) => {\n // Generate base ECProperty\n switch (property.type.valueFormat) {\n case PropertyValueFormat.Primitive: {\n const extractedPrimitives = extractPrimitives([], property as PropertiesField);\n for (const extractedPrimitive of extractedPrimitives) {\n extractedPrimitive.sourceSchema = \"*\";\n extractedPrimitive.sourceClassName = \"*\";\n return extractedPrimitive;\n }\n break;\n }\n // Get structs\n case PropertyValueFormat.Struct: {\n const nestedContentField = property as NestedContentField;\n // Only handling single path and not handling nested content fields within navigations\n if (\n nestedContentField.pathToPrimaryClass &&\n nestedContentField.pathToPrimaryClass.length > 1\n ) {\n break;\n }\n switch (nestedContentField.relationshipMeaning) {\n case RelationshipMeaning.SameInstance: {\n // Check for aspects.\n if (\n (nestedContentField.pathToPrimaryClass[0].relationshipInfo\n .name === \"BisCore:ElementOwnsUniqueAspect\" ||\n nestedContentField.pathToPrimaryClass[0].relationshipInfo\n .name === \"BisCore:ElementOwnsMultiAspects\")\n ) {\n const fullClassName = nestedContentField.contentClassInfo.name;\n const schema = fullClassName.split(\":\")[0];\n const className = fullClassName.split(\":\")[1];\n const extractedNested = extractNested([], nestedContentField.nestedFields);\n const aspectExtractedNested = extractedNested.map((ecProperty) => ({ ...ecProperty, schema, className }));\n return aspectExtractedNested;\n }\n break;\n }\n // Navigation properties\n case RelationshipMeaning.RelatedInstance: {\n if (\n // Deal with a TypeDefinition\n nestedContentField.pathToPrimaryClass[0].relationshipInfo.name ===\n \"BisCore:GeometricElement3dHasTypeDefinition\"\n ) {\n return extractNested([\"TypeDefinition\"], nestedContentField.nestedFields);\n }\n break;\n }\n default: {\n // Some elements don't have a path to primary class or relationship meaning..\n // Most likely a simple struct property\n if (!nestedContentField.pathToPrimaryClass) {\n return extractStruct(property);\n }\n }\n }\n }\n }\n return [];\n });\n\nexport const convertToECProperties = (property: PropertyMetaData): ECProperty[] => {\n const ecProperty: ECProperty = {\n ecSchemaName: property.sourceSchema,\n ecClassName: property.sourceClassName,\n ecPropertyType: property.propertyType,\n ecPropertyName: \"\",\n };\n switch (property.primitiveNavigationClass) {\n // Hardcode Models navigation path and label behavior\n case \"BisCore:ModelContainsElements\": {\n return [\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"ModeledElement\",\n \"UserLabel\",\n ].join(\".\"),\n },\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"ModeledElement\",\n \"CodeValue\",\n ].join(\".\"),\n },\n ];\n }\n // Hardcode Category and Physical Material navigation path and label behavior\n case \"BisCore:GeometricElement3dIsInCategory\":\n case \"BisCore:PhysicalElementIsOfPhysicalMaterial\":\n return [\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"UserLabel\",\n ].join(\".\"),\n },\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"CodeValue\",\n ].join(\".\"),\n },\n ];\n default: {\n return [\n {\n ...ecProperty,\n ecPropertyName: property.ecPropertyTraversal.join(\".\"),\n },\n ];\n }\n }\n};\n\nexport const findProperties = (ecProperties: ECProperty[], propertiesMetaData: PropertyMetaData[]) => {\n let ecPropertiesCopy = [...ecProperties];\n const propertiesMetaDataResult: PropertyMetaData[] = new Array<PropertyMetaData>();\n let notFound = false;\n while (ecPropertiesCopy.length !== 0) {\n for (let i = 0; i < propertiesMetaData.length; i++) {\n const generatedProperty = convertToECProperties(propertiesMetaData[i]);\n const slicedEcProperties = ecPropertiesCopy.slice(0, generatedProperty.length);\n if (deepEqual(generatedProperty, slicedEcProperties)) {\n propertiesMetaDataResult.push(propertiesMetaData[i]);\n ecPropertiesCopy = ecPropertiesCopy.slice(generatedProperty.length);\n break;\n }\n if (i === propertiesMetaData.length - 1) {\n notFound = true;\n }\n }\n if (notFound)\n break;\n }\n return notFound ? [] : propertiesMetaDataResult;\n};\n\nexport const fetchPresentationDescriptor = async (iModelConnection: IModelConnection, keySet: KeySet) => {\n const ruleSet: Ruleset = {\n id: \"gmw-element-properties\",\n rules: [\n {\n ruleType: RuleTypes.Content,\n specifications: [\n {\n specType: ContentSpecificationTypes.SelectedNodeInstances,\n },\n ],\n }],\n };\n const requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> = {\n imodel: iModelConnection,\n keys: keySet,\n rulesetOrId: ruleSet,\n displayType: DefaultContentDisplayTypes.PropertyPane,\n };\n const descriptor = await Presentation.presentation.getContentDescriptor(\n requestOptions\n );\n return descriptor;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupPropertyUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/GroupPropertyUtils.ts"],"names":[],"mappings":";;;AAMA,4DAAkD;AAWlD,oEAMoC;AACpC,wEAA4D;AAC5D,6CAAwC;AAexC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAY,EAAE;IAC7C,QAAQ,IAAI,EAAE;QACZ,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,0BAAQ,CAAC,OAAO,CAAC;QAC1B,KAAK,SAAS;YACZ,OAAO,0BAAQ,CAAC,OAAO,CAAC;QAC1B,KAAK,QAAQ;YACX,OAAO,0BAAQ,CAAC,MAAM,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,0BAAQ,CAAC,MAAM,CAAC;QACzB;YACE,OAAO,0BAAQ,CAAC,MAAM,CAAC;KAC1B;AACH,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CACxB,iBAA2B,EAC3B,aAA8B,EACV,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;IACjE,MAAM,YAAY,GAAG,QAAQ,CAAC,Q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,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC/E,IAAI,uBAAS,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,EAAE;gBACpD,wBAAwB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,gBAAgB,GAAG,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACpE,MAAM;aACP;YACD,IAAI,CAAC,KAAK,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvC,QAAQ,GAAG,IAAI,CAAC;aACjB;SACF;QACD,IAAI,QAAQ;YACV,MAAM;KACT;IACD,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC;AAClD,CAAC,CAAC;AArBW,QAAA,cAAc,kBAqBzB;AAEK,MAAM,2BAA2B,GAAG,KAAK,EAAE,gBAAkC,EAAE,MAAc,EAAE,EAAE;IACtG,MAAM,OAAO,GAAY;QACvB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE;YACL;gBACE,QAAQ,EAAE,+BAAS,CAAC,OAAO;gBAC3B,cAAc,EAAE;oBACd;wBACE,QAAQ,EAAE,+CAAyB,CAAC,qBAAqB;qBAC1D;iBACF;aACF;SAAC;KACL,CAAC;IACF,MAAM,cAAc,GAA+E;QACjG,MAAM,EAAE,gBAAgB;QACxB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,gDAA0B,CAAC,YAAY;KACrD,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,oCAAY,CAAC,YAAY,CAAC,oBAAoB,CACrE,cAAc,CACf,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAvBW,QAAA,2BAA2B,+BAuBtC","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 type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ECProperty } from \"@itwin/insights-client\";\nimport { DataType } from \"@itwin/insights-client\";\nimport type {\n ContentDescriptorRequestOptions,\n Field,\n KeySet,\n NestedContentField,\n PropertiesField,\n Ruleset,\n RulesetVariable,\n StructFieldMemberDescription,\n} from \"@itwin/presentation-common\";\nimport {\n ContentSpecificationTypes,\n DefaultContentDisplayTypes,\n PropertyValueFormat,\n RelationshipMeaning,\n RuleTypes,\n} from \"@itwin/presentation-common\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { deepEqual } from \"fast-equals\";\n\nexport interface PropertyMetaData {\n displayLabel: string;\n sourceSchema: string;\n sourceClassName: string;\n categoryLabel: string;\n propertyType: DataType;\n actualECClassName: string;\n parentPropertyClassName: string | undefined;\n ecPropertyTraversal: string[];\n primitiveNavigationClass: string;\n key: string;\n}\n\nconst convertType = (type: string): DataType => {\n switch (type) {\n case \"int\":\n case \"enum\":\n case \"long\":\n return DataType.Integer;\n case \"boolean\":\n return DataType.Boolean;\n case \"double\":\n return DataType.Double;\n case \"number\":\n return DataType.Number;\n default:\n return DataType.String;\n }\n};\n\nconst extractPrimitives = (\n propertyTraversal: string[],\n propertyField: PropertiesField\n): PropertyMetaData[] => propertyField.properties.map((property) => {\n const propertyName = property.property.name;\n const displayLabel = propertyField.label;\n // It belongs to this parent class\n const parentPropertyClassName = propertyField.parent?.contentClassInfo.name;\n const primitiveNavigationClass = property.property.navigationPropertyInfo?.classInfo.name ?? \"\";\n /* Presentation assigns primitive navigations properties as a long type due to how it stores the\n ECInstanceId of the class in the meta.ECClassDef table on the C++ layer.\n We are handling this special case.\n */\n const propertyType = primitiveNavigationClass ? DataType.String : convertType(property.property.type);\n const actualECClassName = property.property.classInfo.name;\n const newPropertyTraversal = [...propertyTraversal, propertyName];\n\n return (\n {\n displayLabel,\n sourceSchema: \"*\",\n sourceClassName: \"*\",\n ecPropertyTraversal: newPropertyTraversal,\n propertyType,\n primitiveNavigationClass,\n actualECClassName,\n parentPropertyClassName,\n key: `${parentPropertyClassName}|${actualECClassName}|${newPropertyTraversal.join(\"|\")}`,\n categoryLabel: propertyField.category.label,\n }\n );\n});\n\nconst extractPrimitiveStructProperties = (\n propertyTraversal: string[],\n members: StructFieldMemberDescription[],\n categoryLabel: string,\n actualECClassName: string,\n parentPropertyClassName?: string,\n): PropertyMetaData[] => members.flatMap((member) => {\n if (member.type.valueFormat === PropertyValueFormat.Primitive) {\n const propertyName = member.name;\n const displayLabel = member.label;\n const propertyType = convertType(member.type.typeName);\n const newPropertyTraversal = [...propertyTraversal, propertyName];\n\n return ({\n displayLabel,\n sourceSchema: \"*\",\n sourceClassName: \"*\",\n ecPropertyTraversal: newPropertyTraversal,\n propertyType,\n primitiveNavigationClass: \"\",\n actualECClassName,\n parentPropertyClassName,\n key: `${parentPropertyClassName}|${actualECClassName}|${newPropertyTraversal.join(\"|\")}`,\n categoryLabel,\n });\n\n } else if (member.type.valueFormat === PropertyValueFormat.Struct) {\n return extractPrimitiveStructProperties(\n propertyTraversal,\n member.type.members,\n categoryLabel,\n actualECClassName,\n parentPropertyClassName\n );\n }\n\n return [];\n});\n\nconst extractStruct = (property: Field) => {\n if (property.type.valueFormat !== PropertyValueFormat.Struct) {\n return [];\n }\n\n const columnName = (property as PropertiesField).properties[0]\n .property.name;\n const actualECClassName = (property as PropertiesField).properties[0].property.classInfo.name;\n return extractPrimitiveStructProperties(\n [columnName],\n property.type.members,\n property.category.label,\n actualECClassName\n );\n};\n\nconst extractNested = (propertyTraversal: string[], propertyFields: Field[]): PropertyMetaData[] =>\n propertyFields.flatMap((property) => {\n // Generate base ECProperty\n switch (property.type.valueFormat) {\n case PropertyValueFormat.Primitive: {\n return extractPrimitives([...propertyTraversal], property as PropertiesField);\n }\n // Get structs\n case PropertyValueFormat.Struct: {\n const nestedContentField = property as NestedContentField;\n // Only handling single path and not handling nested content fields within navigations\n if (\n nestedContentField.pathToPrimaryClass &&\n nestedContentField.pathToPrimaryClass.length > 1\n ) {\n break;\n }\n\n switch (nestedContentField.relationshipMeaning) {\n // Aspects are not looked at again. Extraction does not support aspects within navigations.\n // Navigation properties\n case RelationshipMeaning.RelatedInstance: {\n if (\n // Deal with a TypeDefinition\n nestedContentField.pathToPrimaryClass[0].relationshipInfo.name ===\n \"BisCore:GeometricElement3dHasTypeDefinition\"\n ) {\n return extractNested([...propertyTraversal, \"TypeDefinition\"], nestedContentField.nestedFields);\n }\n break;\n }\n default: {\n // Some elements don't have a path to primary class or relationship meaning..\n // Most likely a simple struct property\n if (!nestedContentField.pathToPrimaryClass) {\n return extractStruct(property);\n }\n }\n }\n }\n }\n return [];\n });\n\nexport const convertPresentationFields = (propertyFields: Field[]): PropertyMetaData[] =>\n propertyFields.flatMap((property) => {\n // Generate base ECProperty\n switch (property.type.valueFormat) {\n case PropertyValueFormat.Primitive: {\n const extractedPrimitives = extractPrimitives([], property as PropertiesField);\n for (const extractedPrimitive of extractedPrimitives) {\n extractedPrimitive.sourceSchema = \"*\";\n extractedPrimitive.sourceClassName = \"*\";\n return extractedPrimitive;\n }\n break;\n }\n // Get structs\n case PropertyValueFormat.Struct: {\n const nestedContentField = property as NestedContentField;\n // Only handling single path and not handling nested content fields within navigations\n if (\n nestedContentField.pathToPrimaryClass &&\n nestedContentField.pathToPrimaryClass.length > 1\n ) {\n break;\n }\n switch (nestedContentField.relationshipMeaning) {\n case RelationshipMeaning.SameInstance: {\n // Check for aspects.\n if (\n (nestedContentField.pathToPrimaryClass[0].relationshipInfo\n .name === \"BisCore:ElementOwnsUniqueAspect\" ||\n nestedContentField.pathToPrimaryClass[0].relationshipInfo\n .name === \"BisCore:ElementOwnsMultiAspects\")\n ) {\n const fullClassName = nestedContentField.contentClassInfo.name;\n const schema = fullClassName.split(\":\")[0];\n const className = fullClassName.split(\":\")[1];\n const extractedNested = extractNested([], nestedContentField.nestedFields);\n const aspectExtractedNested = extractedNested.map((ecProperty) => ({ ...ecProperty, schema, className }));\n return aspectExtractedNested;\n }\n break;\n }\n // Navigation properties\n case RelationshipMeaning.RelatedInstance: {\n if (\n // Deal with a TypeDefinition\n nestedContentField.pathToPrimaryClass[0].relationshipInfo.name ===\n \"BisCore:GeometricElement3dHasTypeDefinition\"\n ) {\n return extractNested([\"TypeDefinition\"], nestedContentField.nestedFields);\n }\n break;\n }\n default: {\n // Some elements don't have a path to primary class or relationship meaning..\n // Most likely a simple struct property\n if (!nestedContentField.pathToPrimaryClass) {\n return extractStruct(property);\n }\n }\n }\n }\n }\n return [];\n });\n\nexport const convertToECProperties = (property: PropertyMetaData): ECProperty[] => {\n const ecProperty: ECProperty = {\n ecSchemaName: property.sourceSchema,\n ecClassName: property.sourceClassName,\n ecPropertyType: property.propertyType,\n ecPropertyName: \"\",\n };\n switch (property.primitiveNavigationClass) {\n // Hardcode Models navigation path and label behavior\n case \"BisCore:ModelContainsElements\": {\n return [\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"ModeledElement\",\n \"UserLabel\",\n ].join(\".\"),\n },\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"ModeledElement\",\n \"CodeValue\",\n ].join(\".\"),\n },\n ];\n }\n // Hardcode Category and Physical Material navigation path and label behavior\n case \"BisCore:GeometricElement3dIsInCategory\":\n case \"BisCore:PhysicalElementIsOfPhysicalMaterial\":\n return [\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"UserLabel\",\n ].join(\".\"),\n },\n {\n ...ecProperty,\n ecPropertyName: [\n ...property.ecPropertyTraversal,\n \"CodeValue\",\n ].join(\".\"),\n },\n ];\n default: {\n return [\n {\n ...ecProperty,\n ecPropertyName: property.ecPropertyTraversal.join(\".\"),\n },\n ];\n }\n }\n};\n\nexport const findProperties = (ecProperties: ECProperty[], propertiesMetaData: PropertyMetaData[]) => {\n let ecPropertiesCopy = [...ecProperties];\n const propertiesMetaDataResult: PropertyMetaData[] = new Array<PropertyMetaData>();\n let notFound = false;\n while (ecPropertiesCopy.length !== 0) {\n for (let i = 0; i < propertiesMetaData.length; i++) {\n const generatedProperty = convertToECProperties(propertiesMetaData[i]);\n const slicedEcProperties = ecPropertiesCopy.slice(0, generatedProperty.length);\n if (deepEqual(generatedProperty, slicedEcProperties)) {\n propertiesMetaDataResult.push(propertiesMetaData[i]);\n ecPropertiesCopy = ecPropertiesCopy.slice(generatedProperty.length);\n break;\n }\n if (i === propertiesMetaData.length - 1) {\n notFound = true;\n }\n }\n if (notFound)\n break;\n }\n return notFound ? [] : propertiesMetaDataResult;\n};\n\nexport const fetchPresentationDescriptor = async (iModelConnection: IModelConnection, keySet: KeySet) => {\n const ruleSet: Ruleset = {\n id: \"gmw-element-properties\",\n rules: [\n {\n ruleType: RuleTypes.Content,\n specifications: [\n {\n specType: ContentSpecificationTypes.SelectedNodeInstances,\n },\n ],\n }],\n };\n const requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> = {\n imodel: iModelConnection,\n keys: keySet,\n rulesetOrId: ruleSet,\n displayType: DefaultContentDisplayTypes.PropertyPane,\n };\n const descriptor = await Presentation.presentation.getContentDescriptor(\n requestOptions\n );\n return descriptor;\n};\n"]}
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
6
|
|
|
7
7
|
.gmw-group-mapping-container {
|
|
8
|
+
position: absolute;
|
|
9
|
+
right: 0;
|
|
10
|
+
left: 0;
|
|
8
11
|
display: flex;
|
|
9
12
|
flex-direction: column;
|
|
10
13
|
padding: $iui-baseline $iui-m;
|
|
@@ -15,4 +18,4 @@
|
|
|
15
18
|
|
|
16
19
|
.gmw-field-legend {
|
|
17
20
|
color: $iui-color-system-gray;
|
|
18
|
-
}
|
|
21
|
+
}
|
|
@@ -141,7 +141,7 @@ const addOperator = (ctx) => {
|
|
|
141
141
|
if (o2.value === "(") {
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
|
-
const o2Unary = o2.argCount === 0;
|
|
144
|
+
const o2Unary = (o2.argCount === 0) || (o2.argCount === 1 && o2.argCountIncremented === true);
|
|
145
145
|
const op2 = o2Unary ? getUnaryOperator(o2.value) : getBinaryOperator(o2.value);
|
|
146
146
|
const o2Precedence = getOperatorPrecedence(op2);
|
|
147
147
|
if (!(o2Precedence > o1Precedence || (o2Precedence === o1Precedence && o1Associativity === OperatorAssociativity.Left))) {
|