diff --git a/tests/assets/components/create/custom-constellation/.eslintrc.json b/tests/assets/components/create/custom-constellation/.eslintrc.json deleted file mode 100644 index ddf04a80..00000000 --- a/tests/assets/components/create/custom-constellation/.eslintrc.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "root": true, - "extends": ["@pega"], - "parserOptions": { - "project": "tsconfig.json", - "ecmaVersion": 13, - "warnOnUnsupportedTypeScriptVersion": false - }, - "settings": { - "import/resolver": { - "typescript": {}, - "node": { - "extensions": [".js", ".jsx"] - } - } - }, - "ignorePatterns": [ - "node_modules", "packages/*/lib", "!.storybook", ".storybook/public" - ], - "rules": { - - // Prettier recommends running separately from a linter. - // https://prettier.io/docs/en/integrating-with-linters.html#notes - "prettier/prettier": "off", - - // Disable rules from shared configs we're not ready for yet. - "sonarjs/cognitive-complexity": "off", - "sonarjs/no-identical-functions": "off", - "sonarjs/no-duplicate-string": "off", - "sonarjs/no-nested-template-literals": "off", - - // - // JA - Override some default lint handling here - "@typescript-eslint/array-type": ["error", { "default": "generic" }], - // "import/extensions": ["warn", "never"], // Turning off for now (see below) - - // - // Initial release: turning these off; phase in to "warn" or "error" over time - // For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files - "import/extensions": ["off", "never"], - "import/named": "off", - "import/no-cycle": "off", - "import/no-duplicates": "off", - "import/no-extraneous-dependencies": "off", - "import/no-named-as-default": "off", - "import/no-named-as-default-member": "off", - "import/no-self-import": "off", - "import/no-unresolved": "off", - "import/no-useless-path-segments": "off", - "import/order": "off", - "import/prefer-default-export": "off", - "import/no-relative-packages": "off", - - "no-else-return": "off", - "no-restricted-syntax": "off", - "no-underscore-dangle": "off", - - "jsx-a11y/alt-text": "off", - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/click-events-have-key-events": "off", - "jsx-a11y/label-has-associated-control": "off", - "jsx-a11y/no-static-element-interactions": "off", - - - "sonarjs/prefer-immediate-return": "off", - "sonarjs/no-redundant-boolean": "off", - - "@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions - "@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions - "@typescript-eslint/ban-types": "off", // also, see override below - - // - // Initial release: set to error - "@typescript-eslint/no-inferrable-types": "off", - "eqeqeq": "off", - "no-alert": "off", - "no-console": "off", - "no-fallthrough": "error", - "no-undef": "off", - "no-unused-vars": "off", - "no-var": "off", - "prefer-const": "off", - "yoda": "error", - "no-irregular-whitespace": "off", - "no-empty": "off", - "no-new-object": "off", - - "import/no-mutable-exports": "error", - "sonarjs/max-switch-cases": "error", - "sonarjs/no-collapsible-if": "off", - "sonarjs/no-all-duplicated-branches": "off", - "sonarjs/no-duplicated-branches": "off", - "sonarjs/no-gratuitous-expressions": "off", - "sonarjs/no-ignored-return": "off", - "sonarjs/no-small-switch": "off", - "sonarjs/prefer-object-literal": "off", - "sonarjs/prefer-single-boolean-return": "off", - "@typescript-eslint/no-shadow": "off", - "array-callback-return": "off", - "camelcase": "error", - "default-case": "off", - "func-names": "error", - "no-case-declarations": "error", - "no-lonely-if": "off", - "no-nested-ternary": "error", - "no-plusplus": "off", - "no-restricted-globals": "off", - "no-restricted-properties": "off", - "no-shadow": "off", - "radix": "off", - "spaced-comment": "off", - - "import/newline-after-import": "off", - "sonarjs/no-nested-switch": "off", - "@typescript-eslint/no-array-constructor": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-useless-constructor": "off", - "@typescript-eslint/no-unused-expressions": "off", - "class-methods-use-this": "off", - "guard-for-in": "off", - "no-unneeded-ternary": "off", - "no-unused-expressions": "off", - "operator-assignment": "off", - "prefer-template": "off", - "vars-on-top": "off", - - "no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation - "@typescript-eslint/no-use-before-define": "error" - - }, - "overrides": [ - { - "files": "*.@(ts|tsx)", - "rules": { - "@typescript-eslint/method-signature-style": ["off", "property"], - // "@typescript-eslint/ban-types": [ - // "warn", - // { - // "types": { - // "Omit": "Please use the 'OmitStrict' type from 'src/types/' instead.", - // "object": false, - // "Function": false - // }, - // "extendDefaults": true - // } - // ], - - "quotes": "off", - "@typescript-eslint/quotes": "off" - // [ - // "error", - // "single", - // { - // "avoidEscape": true, - // "allowTemplateLiterals": false - // } - // ] - } - }, - { - "files": "*.@(js|jsx|ts|tsx|mdx)", - "rules": { - } - }, - { - "files": ".storybook/*.js", - "extends": ["@pega/eslint-config/script"] - }, - { - "files": "*/**/mocks/**.@(mocks|styles).@(tsx|ts)", - "rules": { - "import/prefer-default-export": ["off"] - } - } - ] -} diff --git a/tests/assets/components/create/custom-constellation/_custom-constellation.md b/tests/assets/components/create/custom-constellation/_custom-constellation.md deleted file mode 100644 index e23e4799..00000000 --- a/tests/assets/components/create/custom-constellation/_custom-constellation.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/custom-constellation** directory - -The **src/components/custom-constellation** directory contains the code for Constellation-related _associated_ components of custom components that you create and use with the **Angular SDK**. -These _associated_ components are used to show the preview of the custom component in App Studio when you are authoring your application and App Studio needs to use the Constellation -design system version of your custom component. diff --git a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.jsx b/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.jsx deleted file mode 100644 index 0bff1470..00000000 --- a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.jsx +++ /dev/null @@ -1,51 +0,0 @@ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import { stateProps, configProps } from './mock.stories'; - -import PegaDxilMyTestText from './index.jsx'; - -export default { - title: 'PegaDxilMyTestText', - decorators: [withKnobs], - component: PegaDxilMyTestText -}; - -export const basePegaDxilMyTestText = () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [value, setValue] = useState(configProps.value); - - const props = { - value, - placeholder: configProps.placeholder, - label: configProps.label, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, theValue) => { - setValue(theValue); - }, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/index.jsx b/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/index.jsx deleted file mode 100644 index c223d42a..00000000 --- a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/index.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import PropTypes from 'prop-types'; -import { Input, Label } from '@pega/cosmos-react-core'; - -import StyledPegaDxilMyTestTextWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyTestText = props => { - const { getPConnect, value, placeholder, disabled, readOnly, required, label, testId } = props; - - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn?.getStateProps()?.value; - - const handleOnChange = event => { - const { value: updatedValue } = event.target; - actions.updateFieldValue(propName, updatedValue); - }; - - return ( - - - - - ); -}; - -PegaDxilMyTestText.defaultProps = { - value: '', - placeholder: '', - disabled: false, - readOnly: false, - required: false, - testId: null -}; - -PegaDxilMyTestText.propTypes = { - label: PropTypes.string, - value: PropTypes.string, - placeholder: PropTypes.string, - getPConnect: PropTypes.func.isRequired, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string -}; - -export default PegaDxilMyTestText; diff --git a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/mock.stories.js b/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/mock.stories.js deleted file mode 100644 index fd283d8b..00000000 --- a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/mock.stories.js +++ /dev/null @@ -1,13 +0,0 @@ -export const configProps = { - value: '', - label: 'Text Sample', - placeholder: 'Text Placeholder', - helperText: 'Text Helper Text', - testId: 'Text-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.TextSample', - hasSuggestions: false -}; diff --git a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/styles.js b/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/create/custom-constellation/field/Pega_DXIL_MyTestText/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/create/custom-constellation/field/_field.md b/tests/assets/components/create/custom-constellation/field/_field.md deleted file mode 100644 index da26dc3e..00000000 --- a/tests/assets/components/create/custom-constellation/field/_field.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/field** directory - -The **src/components/custom-constellation/field** directory contains the code for the Constellation-based associated component for any custom **field** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/field** directory, there will be a matching component in the **src/components/custom-sdk/field** directory. diff --git a/tests/assets/components/create/custom-constellation/template/_template.md b/tests/assets/components/create/custom-constellation/template/_template.md deleted file mode 100644 index 75835038..00000000 --- a/tests/assets/components/create/custom-constellation/template/_template.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/template** directory - -The **src/components/custom-constellation/template** directory contains the code for the Constellation-based associated component for any custom **template** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/template** directory, there will be a matching component in the **src/components/custom-sdk/template** directory. diff --git a/tests/assets/components/create/custom-constellation/widget/_widget.md b/tests/assets/components/create/custom-constellation/widget/_widget.md deleted file mode 100644 index 11871a8a..00000000 --- a/tests/assets/components/create/custom-constellation/widget/_widget.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/widget** directory - -The **src/components/custom-constellation/widget** directory contains the code for the Constellation-based associated component for any custom **widget** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/widget** directory, there will be a matching component in the **src/components/custom-sdk/widget** directory. diff --git a/tests/assets/components/create/custom-sdk/_custom-sdk.md b/tests/assets/components/create/custom-sdk/_custom-sdk.md deleted file mode 100644 index d19acbaf..00000000 --- a/tests/assets/components/create/custom-sdk/_custom-sdk.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/custom-sdk** directory - -The **src/components/custom-sdk** directory contains the code for custom components that you create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new components, the generated code that you can use as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/custom-sdk**. diff --git a/tests/assets/components/create/custom-sdk/field/_field.md b/tests/assets/components/create/custom-sdk/field/_field.md deleted file mode 100644 index 99d479f7..00000000 --- a/tests/assets/components/create/custom-sdk/field/_field.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/field** directory - -The **src/components/custom-sdk/field** directory contains the code for the custom **field** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _field_ components, the generated code that you can use as a starting point for your component development -will be placed in component-specific folders in **src/components/custom-sdk/field**. diff --git a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/config.json b/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/config.json deleted file mode 100644 index 41631ad2..00000000 --- a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "Pega_DXIL_MyTestText", - "label": "My Test Text", - "description": "My Test Text Description", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyTestText", - "type": "Field", - "subtype": "Text", - "icon": "images/pz-url-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.html b/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.html deleted file mode 100644 index d135b05c..00000000 --- a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
- -
- - - -
- - {{ formattedValue$ }} -
-
-
diff --git a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.scss b/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.scss deleted file mode 100644 index bee2b661..00000000 --- a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.scss +++ /dev/null @@ -1,30 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} \ No newline at end of file diff --git a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.spec.ts b/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.spec.ts deleted file mode 100644 index 61422dd6..00000000 --- a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTestTextComponent } from './pega-dxil-my-test-text.component'; - -describe('PegaDxilMyTestTextComponent', () => { - let component: PegaDxilMyTestTextComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTestTextComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTestTextComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.ts b/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.ts deleted file mode 100644 index 04ac61c8..00000000 --- a/tests/assets/components/create/custom-sdk/field/pega-dxil-my-test-text/pega-dxil-my-test-text.component.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-test-text', - templateUrl: './pega-dxil-my-test-text.component.html', - styleUrls: ['./pega-dxil-my-test-text.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PegaDxilMyTestTextComponent implements OnInit { - @Input() pConn$: any; - @Input() formatAs$: string; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - componentReference: string = ''; - formattedValue$: string; - format$: string = 'text'; - formattedUrl$: string = ''; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - - // call updateSelf when initializing - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - // TDB - get formats - switch (this.formatAs$) { - case 'text': - this.formattedValue$ = this.value$; - break; - case 'date': - this.formattedValue$ = this.generateDate(this.value$); - break; - case 'date-time': - this.formattedValue$ = this.generateDateTime(this.value$); - break; - case 'time': - if (this.value$) { - const timeParts = this.value$.split(':'); - this.formattedValue$ = `${timeParts[0]}:${timeParts[1]}`; - } else { - this.formattedValue$ = ''; - } - break; - case 'url': - this.formattedUrl$ = this.generateUrl(this.value$); - this.formattedValue$ = this.value$; - break; - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - generateUrl(sVal): string { - if (sVal.indexOf('https://') == 0 || sVal.indexOf('http://') == 0) { - } else { - // assume no http - sVal = 'http://' + sVal; - } - - return sVal; - } - - generateDate(sVal): string { - if (!sVal) return ''; - // const value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric' - // }).format(new Date(sVal + "T00:00")); - - return this.utils.generateDate(sVal, 'Date-Long-Custom-YYYY'); - } - - generateDateTime(sVal): string { - if (!sVal) return ''; - if (sVal.length === 10) return this.generateDate(sVal); - let value = sVal.substring(0, sVal.length - 1); - // value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric', - // hour: 'numeric', - // minute: 'numeric', - // second: 'numeric', - // hour12: true, - // }).format(new Date(value)) - - return this.utils.generateDateTime(value, 'DateTime-Long-YYYY-Custom'); - } -} diff --git a/tests/assets/components/create/custom-sdk/template/_template.md b/tests/assets/components/create/custom-sdk/template/_template.md deleted file mode 100644 index f5875c69..00000000 --- a/tests/assets/components/create/custom-sdk/template/_template.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/template** directory - -The **src/components/custom-sdk/template** directory contains the code for the custom **template** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _template_ components, the generated code that you can use as a starting point for your component development -will be placed in component-specific folders in **src/components/custom-sdk/template**. diff --git a/tests/assets/components/create/custom-sdk/widget/_widget.md b/tests/assets/components/create/custom-sdk/widget/_widget.md deleted file mode 100644 index ca4cf89e..00000000 --- a/tests/assets/components/create/custom-sdk/widget/_widget.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/widget** directory - -The **src/components/custom-sdk/widget** directory contains the code for the custom **widget** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _widget_ components, the generated code that you can use as a starting point for your component -development will be placed in component-specific folders in **src/components/custom-sdk/widget**. diff --git a/tests/assets/components/create/override-sdk/_override-sdk.md b/tests/assets/components/create/override-sdk/_override-sdk.md deleted file mode 100644 index bd18b767..00000000 --- a/tests/assets/components/create/override-sdk/_override-sdk.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/override-sdk** directory - -The **src/components/override-sdk** directory contains the code for components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run override** command to override the default implementation of a component, the generated code that you can use as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk**. diff --git a/tests/assets/components/create/override-sdk/designSystemExtension/_designSystemExtension.md b/tests/assets/components/create/override-sdk/designSystemExtension/_designSystemExtension.md deleted file mode 100644 index 341a695c..00000000 --- a/tests/assets/components/create/override-sdk/designSystemExtension/_designSystemExtension.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/designSystemExtension** directory - -The **src/components/override-sdk/designSystemExtension** directory contains the code for components that **extend** the design system and for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **design system extension** component, the generated code that you can use -as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/designSystemExtension**. diff --git a/tests/assets/components/create/override-sdk/field/_field.md b/tests/assets/components/create/override-sdk/field/_field.md deleted file mode 100644 index 2ede8890..00000000 --- a/tests/assets/components/create/override-sdk/field/_field.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/field** directory - -The **src/components/override-sdk/field** directory contains the code for **field** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **field** component, the generated code that you can use as a starting point -for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/field**. diff --git a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.html b/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.html deleted file mode 100644 index 2d7f86d8..00000000 --- a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - - {{ opt.value }} - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.scss b/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.spec.ts b/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.spec.ts deleted file mode 100644 index bc91b1db..00000000 --- a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AutoCompleteComponent } from './auto-complete.component'; - -describe('AutoCompleteComponent', () => { - let component: AutoCompleteComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AutoCompleteComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AutoCompleteComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.ts b/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.ts deleted file mode 100644 index 0621dc93..00000000 --- a/tests/assets/components/create/override-sdk/field/auto-complete/auto-complete.component.ts +++ /dev/null @@ -1,318 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatOptionModule } from '@angular/material/core'; -import { MatAutocompleteModule } from '@angular/material/autocomplete'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { DatapageService } from '@pega/angular-sdk-library'; -import { handleEvent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-auto-complete', - templateUrl: './auto-complete.component.html', - styleUrls: ['./auto-complete.component.scss'], - standalone: true, - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatAutocompleteModule, - MatOptionModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class AutoCompleteComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - configProps$: any; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - options$: Array; - componentReference: string = ''; - testId: string; - listType: string; - columns = []; - - helperText: string; - fieldControl = new FormControl('', null); - parameters: {}; - hideLabel: any; - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils, - private dataPageService: DatapageService - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - const index = this.options$?.findIndex((element) => element.key === this.configProps$['value']); - this.value$ = index > -1 ? this.options$[index].value : this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.listType = this.configProps$['listType']; - const displayMode = this.configProps$['displayMode']; - let datasource = this.configProps$['datasource']; - let columns = this.configProps$['columns']; - this.hideLabel = this.configProps$['hideLabel']; - const { deferDatasource, datasourceMetadata } = this.configProps$; - this.helperText = this.configProps$['helperText']; - this.parameters = this.configProps$?.parameters; - const context = this.pConn$.getContextName(); - // convert associated to datapage listtype and transform props - // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList - if (deferDatasource && datasourceMetadata?.datasource?.name) { - this.listType = 'datapage'; - datasource = datasourceMetadata.datasource.name; - this.parameters = this.flattenParameters(datasourceMetadata?.datasource?.parameters); - const displayProp = datasourceMetadata.datasource.propertyForDisplayText.startsWith('@P') - ? datasourceMetadata.datasource.propertyForDisplayText.substring(3) - : datasourceMetadata.datasource.propertyForDisplayText; - const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P') - ? datasourceMetadata.datasource.propertyForValue.substring(3) - : datasourceMetadata.datasource.propertyForValue; - columns = [ - { - key: 'true', - setProperty: 'Associated property', - value: valueProp - }, - { - display: 'true', - primary: 'true', - useForSearch: true, - value: displayProp - } - ]; - } - if (columns) { - this.columns = this.preProcessColumns(columns); - } - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - if (this.listType === 'associated') { - this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject()); - } - - if (!displayMode && this.listType !== 'associated') { - const workListData = this.PCore$.getDataApiUtils().getData(datasource, {}); - - workListData.then((workListJSON: Object) => { - const optionsData: Array = []; - const results = workListJSON['data'].data; - const displayColumn = this.getDisplayFieldsMetaData(this.columns); - results?.forEach((element) => { - const obj = { - key: element.pyGUID || element[displayColumn.primary], - value: element[displayColumn.primary]?.toString() - }; - optionsData.push(obj); - }); - this.options$ = optionsData; - }); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - flattenParameters(params = {}) { - const flatParams = {}; - Object.keys(params).forEach((key) => { - const { name, value: theVal } = params[key]; - flatParams[name] = theVal; - }); - - return flatParams; - } - - getDisplayFieldsMetaData(columnList) { - const displayColumns = columnList.filter((col) => col.display === 'true'); - const metaDataObj: any = { key: '', primary: '', secondary: [] }; - const keyCol = columnList.filter((col) => col.key === 'true'); - metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto'; - for (let index = 0; index < displayColumns.length; index += 1) { - if (displayColumns[index].primary === 'true') { - metaDataObj.primary = displayColumns[index].value; - } else { - metaDataObj.secondary.push(displayColumns[index].value); - } - } - return metaDataObj; - } - - preProcessColumns(columnList) { - return columnList?.map((col) => { - const tempColObj = { ...col }; - tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value; - return tempColObj; - }); - } - - isSelected(buttonValue: string): boolean { - if (this.value$ === buttonValue) { - return true; - } - - return false; - } - - fieldOnChange(event: any) { - // this works - this.pConn$.setValue( this.componentReference, `property: ${this.componentReference}`); - // this works - this.pConn$.setValue( this.componentReference, this.fieldControl.value); - // PConnect wants to use changeHandler for onChange - // this.angularPConnect.changeHandler( this, event); - this.angularPConnectData.actions.onChange(this, event); - } - - optionChanged(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - let key = ''; - if (event?.target?.value) { - const index = this.options$?.findIndex((element) => element.value === event.target.value); - key = index > -1 ? (key = this.options$[index].key) : event.target.value; - } - - const value = key; - const actionsApi = this.pConn$?.getActionsApi(); - const propName = this.pConn$?.getStateProps().value; - handleEvent(actionsApi, 'changeNblur', propName, value); - if (this.configProps$?.onRecordChange) { - event.target.value = value; - this.configProps$.onRecordChange(event); - } - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/create/override-sdk/field/auto-complete/config.json b/tests/assets/components/create/override-sdk/field/auto-complete/config.json deleted file mode 100644 index b3e56275..00000000 --- a/tests/assets/components/create/override-sdk/field/auto-complete/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "AutoComplete", - "description": "Picklist", - "type": "Field", - "subtype": "PICKERS", - "icon": "", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/create/override-sdk/infra/_infra.md b/tests/assets/components/create/override-sdk/infra/_infra.md deleted file mode 100644 index 5d1cef65..00000000 --- a/tests/assets/components/create/override-sdk/infra/_infra.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/infra** directory - -The **src/components/override-sdk/infra** directory contains the code for **infrastructure** components for which you want to override the default implementation for use with the **Angular SDK**. - -When run the **npm run create** command to override the default implementation of an **infrastructure** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/infra**. diff --git a/tests/assets/components/create/override-sdk/template/_template.md b/tests/assets/components/create/override-sdk/template/_template.md deleted file mode 100644 index c77fa60b..00000000 --- a/tests/assets/components/create/override-sdk/template/_template.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/template** directory - -The **src/components/override-sdk/template** directory contains the code for **template** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **template** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/template**. diff --git a/tests/assets/components/create/override-sdk/widget/_widget.md b/tests/assets/components/create/override-sdk/widget/_widget.md deleted file mode 100644 index 8acacb0a..00000000 --- a/tests/assets/components/create/override-sdk/widget/_widget.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/widget** directory - -The **src/components/override-sdk/widget** directory contains the code for **widget** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **widget** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/widget**. diff --git a/tests/assets/components/createAll/custom-constellation/.eslintrc.json b/tests/assets/components/createAll/custom-constellation/.eslintrc.json deleted file mode 100644 index ddf04a80..00000000 --- a/tests/assets/components/createAll/custom-constellation/.eslintrc.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "root": true, - "extends": ["@pega"], - "parserOptions": { - "project": "tsconfig.json", - "ecmaVersion": 13, - "warnOnUnsupportedTypeScriptVersion": false - }, - "settings": { - "import/resolver": { - "typescript": {}, - "node": { - "extensions": [".js", ".jsx"] - } - } - }, - "ignorePatterns": [ - "node_modules", "packages/*/lib", "!.storybook", ".storybook/public" - ], - "rules": { - - // Prettier recommends running separately from a linter. - // https://prettier.io/docs/en/integrating-with-linters.html#notes - "prettier/prettier": "off", - - // Disable rules from shared configs we're not ready for yet. - "sonarjs/cognitive-complexity": "off", - "sonarjs/no-identical-functions": "off", - "sonarjs/no-duplicate-string": "off", - "sonarjs/no-nested-template-literals": "off", - - // - // JA - Override some default lint handling here - "@typescript-eslint/array-type": ["error", { "default": "generic" }], - // "import/extensions": ["warn", "never"], // Turning off for now (see below) - - // - // Initial release: turning these off; phase in to "warn" or "error" over time - // For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files - "import/extensions": ["off", "never"], - "import/named": "off", - "import/no-cycle": "off", - "import/no-duplicates": "off", - "import/no-extraneous-dependencies": "off", - "import/no-named-as-default": "off", - "import/no-named-as-default-member": "off", - "import/no-self-import": "off", - "import/no-unresolved": "off", - "import/no-useless-path-segments": "off", - "import/order": "off", - "import/prefer-default-export": "off", - "import/no-relative-packages": "off", - - "no-else-return": "off", - "no-restricted-syntax": "off", - "no-underscore-dangle": "off", - - "jsx-a11y/alt-text": "off", - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/click-events-have-key-events": "off", - "jsx-a11y/label-has-associated-control": "off", - "jsx-a11y/no-static-element-interactions": "off", - - - "sonarjs/prefer-immediate-return": "off", - "sonarjs/no-redundant-boolean": "off", - - "@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions - "@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions - "@typescript-eslint/ban-types": "off", // also, see override below - - // - // Initial release: set to error - "@typescript-eslint/no-inferrable-types": "off", - "eqeqeq": "off", - "no-alert": "off", - "no-console": "off", - "no-fallthrough": "error", - "no-undef": "off", - "no-unused-vars": "off", - "no-var": "off", - "prefer-const": "off", - "yoda": "error", - "no-irregular-whitespace": "off", - "no-empty": "off", - "no-new-object": "off", - - "import/no-mutable-exports": "error", - "sonarjs/max-switch-cases": "error", - "sonarjs/no-collapsible-if": "off", - "sonarjs/no-all-duplicated-branches": "off", - "sonarjs/no-duplicated-branches": "off", - "sonarjs/no-gratuitous-expressions": "off", - "sonarjs/no-ignored-return": "off", - "sonarjs/no-small-switch": "off", - "sonarjs/prefer-object-literal": "off", - "sonarjs/prefer-single-boolean-return": "off", - "@typescript-eslint/no-shadow": "off", - "array-callback-return": "off", - "camelcase": "error", - "default-case": "off", - "func-names": "error", - "no-case-declarations": "error", - "no-lonely-if": "off", - "no-nested-ternary": "error", - "no-plusplus": "off", - "no-restricted-globals": "off", - "no-restricted-properties": "off", - "no-shadow": "off", - "radix": "off", - "spaced-comment": "off", - - "import/newline-after-import": "off", - "sonarjs/no-nested-switch": "off", - "@typescript-eslint/no-array-constructor": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-useless-constructor": "off", - "@typescript-eslint/no-unused-expressions": "off", - "class-methods-use-this": "off", - "guard-for-in": "off", - "no-unneeded-ternary": "off", - "no-unused-expressions": "off", - "operator-assignment": "off", - "prefer-template": "off", - "vars-on-top": "off", - - "no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation - "@typescript-eslint/no-use-before-define": "error" - - }, - "overrides": [ - { - "files": "*.@(ts|tsx)", - "rules": { - "@typescript-eslint/method-signature-style": ["off", "property"], - // "@typescript-eslint/ban-types": [ - // "warn", - // { - // "types": { - // "Omit": "Please use the 'OmitStrict' type from 'src/types/' instead.", - // "object": false, - // "Function": false - // }, - // "extendDefaults": true - // } - // ], - - "quotes": "off", - "@typescript-eslint/quotes": "off" - // [ - // "error", - // "single", - // { - // "avoidEscape": true, - // "allowTemplateLiterals": false - // } - // ] - } - }, - { - "files": "*.@(js|jsx|ts|tsx|mdx)", - "rules": { - } - }, - { - "files": ".storybook/*.js", - "extends": ["@pega/eslint-config/script"] - }, - { - "files": "*/**/mocks/**.@(mocks|styles).@(tsx|ts)", - "rules": { - "import/prefer-default-export": ["off"] - } - } - ] -} diff --git a/tests/assets/components/createAll/custom-constellation/_custom-constellation.md b/tests/assets/components/createAll/custom-constellation/_custom-constellation.md deleted file mode 100644 index e23e4799..00000000 --- a/tests/assets/components/createAll/custom-constellation/_custom-constellation.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/custom-constellation** directory - -The **src/components/custom-constellation** directory contains the code for Constellation-related _associated_ components of custom components that you create and use with the **Angular SDK**. -These _associated_ components are used to show the preview of the custom component in App Studio when you are authoring your application and App Studio needs to use the Constellation -design system version of your custom component. diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/Boolean.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/Boolean.js deleted file mode 100644 index 231eff52..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/Boolean.js +++ /dev/null @@ -1,38 +0,0 @@ -function Boolean(value, { allowEmpty = true, tick = "", cross = "" } = {}) { - if ( - (!allowEmpty && !value) || - value === false || - value?.toString()?.toLowerCase() === "false" || - value === 0 || - value === "0" - ) { - return cross || ""; - } - if ( - value === true || - value?.toString()?.toLowerCase() === "true" || - value === 1 || - value === "1" - ) { - return tick || ""; - } - if ( - allowEmpty && - (value === "null" || - value === "" || - value === null || - typeof value === "undefined") - ) { - return "––"; - } - return value; -} - -export default { - TrueFalse: (value, options) => - Boolean(value, { - ...options, - tick: "True", - cross: "False" - }) -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/boolean-format.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/boolean-format.js deleted file mode 100644 index a54a334b..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/boolean-format.js +++ /dev/null @@ -1,26 +0,0 @@ -import Boolean from "./Boolean"; - - -export default { - ...Boolean -}; - - - -export function format(value, type) { - let formattedValue; - - switch (type?.toLowerCase()) { - - - case "boolean": - case "checkbox": { - formattedValue = Boolean.TrueFalse(value, { allowEmpty: false }); - break; - } - - default: - formattedValue = value; - } - return formattedValue; -} diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/demo.stories.jsx deleted file mode 100644 index 7906dae0..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/demo.stories.jsx +++ /dev/null @@ -1,61 +0,0 @@ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, stateProps } from './mock.stories'; - -import PegaDxilMyBoolean from './index'; - -export default { - title: 'PegaDxilMyBoolean', - decorators: [withKnobs], - component: PegaDxilMyBoolean -}; - -export const basePegaDxilMyBoolean = () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [value, setValue] = useState(configProps.value); - - const props = { - value, - label: configProps.label, - helperText: configProps.helperText, - caption: configProps.caption, - validatemessage: configProps.validatemessage, - hideLabel: configProps.hideLabel, - testId: configProps.testId, - additionalProps: configProps.additionalProps, - displayMode: configProps.displayMode, - variant: configProps.variant, - trueLabel: configProps.trueLabel, - falseLabel: configProps.falseLabel, - disabled: configProps.disabled, - readOnly: configProps.readOnly, - required: configProps.required, - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, theValue) => { - setValue(theValue); - }, - triggerFieldChange: () => { /* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => { /* nothing */} - }; - } - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/index.jsx deleted file mode 100644 index f91c390d..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/index.jsx +++ /dev/null @@ -1,170 +0,0 @@ -import { - Checkbox as CosmosCheckbox, - CheckboxGroup, - FieldValueList, - Text -} from "@pega/cosmos-react-core"; -import PropTypes from "prop-types"; - -// includes in bundle -import handleEvent from "./event-utils"; - -import StyledPegaDxilMyBooleanWrapper from './styles'; - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyBoolean = props => { - const { - getPConnect, - value, - label, - helperText, - caption, - validatemessage, - hideLabel, - testId, - additionalProps, - displayMode, - variant, - trueLabel, - falseLabel - } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - let status = ""; - if (validatemessage !== "") { - status = "error"; - } - - const aCosmosCheckbox = ( - { - handleEvent(actions, "changeNblur", propName, event.target.checked); - }} - onBlur={(event) => { - pConn.getValidationApi().validate(event.target.checked); - }} - data-testid={testId} - /> - ); - - const parentTestId = testId ? `${testId}-parent` : testId; - - let displayComponent; - if (displayMode) { - displayComponent = ; - } - - if (displayMode === 'DISPLAY_ONLY') { - return ( displayComponent ); - } - - if (displayMode === "LABELS_LEFT") { - return ( - - - - ); - } - - if (displayMode === "STACKED_LARGE_VAL") { - return ( - - - {displayComponent} - - ) - } - ]} - /> - - ); - } - - - return ( - - - {aCosmosCheckbox} - - - ); - - -}; - - -PegaDxilMyBoolean.defaultProps = { - validatemessage: '', - value: false, - label: '', - hideLabel: false, - helperText: '', - disabled: false, - readOnly: false, - required: false, - testId: null, - additionalProps: {}, - displayMode: null, - variant: 'inline', - displayValue: 'Yes/No', - trueLabel: '', - falseLabel: '' -}; - -PegaDxilMyBoolean.propTypes = { - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - label: PropTypes.string, - hideLabel: PropTypes.bool, - helperText: PropTypes.string, - value: PropTypes.bool, - caption: PropTypes.string.isRequired, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - variant: PropTypes.string, - displayValue: PropTypes.string, - trueLabel: PropTypes.string, - falseLabel: PropTypes.string -}; - -export default PegaDxilMyBoolean; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/mock.stories.js deleted file mode 100644 index a2f8eb1c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/mock.stories.js +++ /dev/null @@ -1,21 +0,0 @@ -export const configProps = { - value: true, - label: 'Boolean label', - helperText: 'Test helper text', - caption: 'Boolean caption', - validatemessage: '', - hideLabel: false, - testId: '12345678', - additionalProps: {}, - displayMode: '', - variant: '', - trueLabel: 'True', - falseLabel: 'False', - disabled: false, - readOnly: false, - required: true -}; - -export const stateProps = { - value: '.Test' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/demo.stories.jsx deleted file mode 100644 index 869b26ce..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/demo.stories.jsx +++ /dev/null @@ -1,53 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, fieldMetadata, stateProps } from './mock.stories.js'; - -import PegaDxilMyCurrency from './index.jsx'; - -export default { - title: 'PegaDxilMyCurrency', - decorators: [withKnobs], - component: PegaDxilMyCurrency -}; - -export const basePegaDxilMyCurrency = () => { - - const props = { - value: Number(configProps.value), - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - showGroupSeparators: configProps.showGroupSeparators, - allowDecimals: configProps.allowDecimals, - currencyISOCode: configProps.currencyISOCode, - alwaysShowISOCode: configProps.alwaysShowISOCode, - hasSuggestions: configProps.hasSuggestions, - testId: configProps.testId, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */}, - clearErrorMessages: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/index.jsx deleted file mode 100644 index f8c747af..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/index.jsx +++ /dev/null @@ -1,296 +0,0 @@ -import { useState, useEffect } from 'react'; -import { - CurrencyInput as CosmosCurrency, - CurrencyDisplay, - NumberDisplay, - FieldValueList, - Text, - useAfterInitialEffect -} from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import handleEvent from './event-utils'; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyCurrencyWrapper from './styles'; - -const formatValue = (value) => { - if (!value && value !== 0) return ''; - const [integer, decimal = ''] = value.toString().split('.'); - return `${integer}.${decimal.padEnd(3, '0')}`; -}; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyCurrency = props => { - const { - getPConnect, - value, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - allowDecimals, - currencyISOCode, - alwaysShowISOCode, - displayMode, - additionalProps, - variant, - formatter, - negative, - notation, - isTableFormatter, - hasSuggestions - } = props; - let { currencyDisplay } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const [currencyValue, setCurrencyValue] = useState(() => formatValue(value)); - - let { readOnly, required, disabled } = props; - - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - useAfterInitialEffect(() => { - setCurrencyValue(formatValue(value)); - }, [value]); - - const { decimalPrecision, currencyDecimalPrecision } = props; - let noOfDecimals = parseInt(decimalPrecision, 10); - if (Number.isNaN(noOfDecimals)) noOfDecimals = undefined; - let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10); - - if (displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY') { - let displayComp; - let { showGroupSeparators } = props; - if (displayMode === 'LABELS_LEFT' && isTableFormatter) { - noOfFractionDigits = undefined; - showGroupSeparators = true; - if (formatter === 'Currency-Code') { - currencyDisplay = 'code'; - } - } - - const displayValue = !value && value !== 0 ? undefined : Number(currencyValue); - - - displayComp = ( - - ); - - - - - if (['Integer', 'Decimal', 'Percentage', 'Decimal-Auto'].includes(formatter)) { - let unit; - - switch (formatter) { - case 'Integer': { - noOfDecimals = 0; - break; - } - case 'Decimal': { - break; - } - case 'Decimal-Auto': { - noOfDecimals = Number.isInteger(currencyValue) ? 0 : 2; - break; - } - case 'Percentage': { - showGroupSeparators = false; - unit = 'percent'; - break; - } - // no default - } - - displayComp = ( - - ); - } - - - switch (displayMode) { - case 'DISPLAY_ONLY': { - return ( displayComp ) ; - } - case 'LABELS_LEFT': { - return ( - - - - ); - } - case 'STACKED_LARGE_VAL': { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - // no default - } - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setCurrencyValue(enteredValue); - pConn.clearErrorMessages({ - property: propName - }); - }} - onBlur={(enteredValue) => { - const parsedValue = enteredValue !== '' ? Number(enteredValue) : enteredValue; - if (!readOnly && (!value || value !== parsedValue)) { - handleEvent(actions, 'changeNblur', propName, parsedValue); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyCurrency.defaultProps = { - value: 0, - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - decimalPrecision: null, - allowDecimals: true, - currencyISOCode: 'USD', - isoCodeSelection: 'constant', - testId: null, - displayMode: null, - additionalProps: {}, - variant: 'inline', - showGroupSeparators: false, - formatter: 'defaultCurrency', - currencyDisplay: 'symbol', - negative: 'minus-sign', - notation: 'standard', - currencyDecimalPrecision: 'auto', - isTableFormatter: false, - alwaysShowISOCode: false, - hasSuggestions: false -}; - -PegaDxilMyCurrency.propTypes = { - value: PropTypes.number, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - decimalPrecision: PropTypes.number, - allowDecimals: PropTypes.bool, - currencyISOCode: PropTypes.string, - isoCodeSelection: PropTypes.string, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - displayMode: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - showGroupSeparators: PropTypes.bool, - formatter: PropTypes.string, - currencyDisplay: PropTypes.string, - negative: PropTypes.string, - notation: PropTypes.string, - currencyDecimalPrecision: PropTypes.string, - isTableFormatter: PropTypes.bool, - alwaysShowISOCode: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyCurrency; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/mock.stories.js deleted file mode 100644 index adaecb3f..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/mock.stories.js +++ /dev/null @@ -1,23 +0,0 @@ -export const configProps = { - value: '', - label: 'Currency Sample', - currencyISOCode: 'USD', - allowDecimals: true, - alwaysShowISOCode: true, - placeholder: 'Currency Placeholder', - helperText: 'Currency Helper Text', - testId: 'currency-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.CurrencySample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Decimal', - displayAs: 'pxCurrency', - label: 'Currency sample' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/DateFormatter.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/DateFormatter.js deleted file mode 100644 index d0572897..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/DateFormatter.js +++ /dev/null @@ -1,61 +0,0 @@ -import dayjs from 'dayjs'; -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -const types = ['fromNow', 'customFormat']; - - - -// value should be in ISO 8601 format. -function DateFormatter( - value, - { type = types[1], format = "DD/MM/YYYY", tzone } = {} -) { - if (!value) return value; - switch (type) { - case types[1]: - if (tzone) return dayjs(value).tz(tzone).format(format); - return dayjs(value).format(format); - case types[0]: - return dayjs(value).from(dayjs()); - default: - return value; - } -} - -// value should be in hh:mm:ss format (00:00:00 - 23:59:59). -function TimeFormatter(value, options) { - if (!value) return value; - const { locale = "en-US" } = options; - const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/; - if (value.length === 8 && timeOnlyRegex.test(value)) { - const tempDate = new Date(); - const hours = parseInt(value.substr(0, 2), 10); - const minutes = parseInt(value.substr(3, 2), 10); - const seconds = parseInt(value.substr(6, 2), 10); - tempDate.setHours(hours); - tempDate.setMinutes(minutes); - tempDate.setSeconds(seconds); - return tempDate.toLocaleTimeString(locale); - } - return DateFormatter(value, options); -} - -export default { - Date: (value, options) => DateFormatter(value, { type: 'customFormat', ...options }), - 'Date-Time-Default': (value, options) => - DateFormatter(value, { ...options, type: 'customFormat', format: 'lll' }), - 'Time-Default': (value, options) => - TimeFormatter(value, { - ...options, - type: 'customFormat', - format: 'hh:mm A' - }) -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/FormattedText.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/FormattedText.jsx deleted file mode 100644 index 76cec590..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/FormattedText.jsx +++ /dev/null @@ -1,41 +0,0 @@ -import { FieldValueList } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -import { format } from './date.js'; - -export default function FormattedText(props) { - const { formatType, label, value, testId, hideLabel, variant, additionalProps } = props; - - let text = value; - - text = format(text, formatType, additionalProps); - - const fields = [ - { - id: label.toLowerCase(), - name: hideLabel ? '' : label, - value: text - } - ]; - return ; -} - -FormattedText.defaultProps = { - formatType: 'none', - variant: 'stacked', - value: undefined, - label: '', - testId: null, - hideLabel: false, - additionalProps: {} -}; - -FormattedText.propTypes = { - formatType: PropTypes.string, - variant: PropTypes.oneOf(['inline', 'stacked']), - value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]), - label: PropTypes.string, - testId: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - hideLabel: PropTypes.bool -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/date.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/date.js deleted file mode 100644 index f6fdcf3a..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/date.js +++ /dev/null @@ -1,439 +0,0 @@ -/* eslint-disable no-undef */ -import dayjs from 'dayjs'; -import DateFormatter from './DateFormatter.js'; - -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -function isIsoDate(str) { - if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) return false; - const d = new Date(str); - return d.toISOString() === str; -} - -function getDateObject(text) { - // TODO - cleanup formatters util functions as DX APIs are returning values per ISO std now. - const timeStamp = text.replace(/-/g, ''); - const isDateTime = timeStamp.indexOf('GMT') !== -1; - const year = parseInt(timeStamp.substr(0, 4), 10); - const month = parseInt(timeStamp.substr(4, 2), 10) - 1; - const day = parseInt(timeStamp.substr(6, 2), 10); - - const date = new Date(); - - date.setDate(day); - date.setMonth(month); - date.setFullYear(year); - - if (isDateTime) { - const hours = parseInt(timeStamp.substr(9, 2), 10); - const minutes = parseInt(timeStamp.substr(11, 2), 10); - const seconds = parseInt(timeStamp.substr(13, 2), 10); - const ms = parseInt(timeStamp.substr(16, 3), 10); - date.setHours(hours); - date.setMinutes(minutes); - date.setSeconds(seconds); - date.setMilliseconds(ms); - } - - return date; -} - -function parseDateInISO(value) { - const isMilliSeconds = new RegExp('^[0-9]+$').exec(value); - if (isMilliSeconds) { - const date = new Date(parseInt(value, 10)); - return date.toISOString(); - } - - if (isIsoDate(value)) { - const date = new Date(value); - return date.toISOString(); - } - - return value ? getDateObject(value).toISOString() : value; -} - -export default { - ...DateFormatter -}; - -export const datetimedisplayformatter = formatter => { - const objectvalues = {}; - switch (formatter) { - case 'DateTime-Long': { - objectvalues.variantVal = 'datetime'; - objectvalues.formatVal = 'long'; - break; - } - case 'DateTime-Short': { - objectvalues.variantVal = 'date'; - objectvalues.formatVal = 'short'; - break; - } - case 'DateTime-Since': { - objectvalues.variantVal = 'relative'; - break; - } - case 'Time-Only': { - objectvalues.variantVal = 'time'; - objectvalues.formatVal = 'short'; - break; - } - // no default - } - return objectvalues; -}; - -export const formatExists = formatterVal => { - const formatterValues = ['DateTime-Long', 'DateTime-Short', 'DateTime-Since', 'Time-Only']; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; -}; - -/** - * Return relative time in fromNow for the given datetime - * @description Convert and return the given datetime in dayJSObject - * - * @param {string} text datetime - * @returns {object} datetime as a dayjs object - */ -export const getDayJSObject = text => { - const momObj = dayjs(text); - if (momObj.isValid()) return momObj; - const timeStamp = text; - const isDateTime = timeStamp.indexOf('GMT') !== -1; - const year = parseInt(timeStamp.substr(0, 4), 10); - const month = parseInt(timeStamp.substr(4, 2), 10) - 1; - const day = parseInt(timeStamp.substr(6, 2), 10); - - const CurrentTz = PCore.getLocaleUtils().getTimeZoneInUse(); - - let mom = new Date(); - - mom.setUTCDate(day); - mom.setUTCMonth(month); - mom.setUTCFullYear(year); - - /* istanbul ignore else */ - if (isDateTime) { - const hours = parseInt(timeStamp.substr(9, 2), 10); - const minutes = parseInt(timeStamp.substr(11, 2), 10); - const seconds = parseInt(timeStamp.substr(13, 2), 10); - const ms = parseInt(timeStamp.substr(16, 3), 10); - mom.setUTCHours(hours); - mom.setUTCMinutes(minutes); - mom.setUTCSeconds(seconds); - mom.setUTCMilliseconds(ms); - } - - mom = dayjs( - mom.toLocaleString('en-US', { - timeZone: CurrentTz - }) - ); - - return mom; -}; - -/** - * Return relative time in fromNow for the given datetime - * - * @param {string} time datetime - * @returns {object} relative time from now - */ -export const getRelativeTime = time => { - let relativetime = ''; - if (dayjs(time).isUTC()) { - relativetime = dayjs(time).fromNow(); - } else { - const dayjstime = getDayJSObject(time); - relativetime = dayjs(dayjstime).fromNow(); - } - return relativetime; -}; - -/** - * Return year for the date passed - * - * @param {string} value from which Year needs to be taken out - * @returns {number} year for the date passed - */ -export const getFullYear = value => - value ? new Date(value).getFullYear() : new Date().getFullYear(); - -/** - * Return maxDate for the date passed - * - * @param {number} nextYears next number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} maxDate calculated based on inputs - */ -export const getMaxDate = (nextYears, currentYear, yearFromValue) => { - if (Number.isNaN(nextYears)) { - nextYears = 20; - } - let maxYear = currentYear + nextYears; - if (yearFromValue > maxYear) { - maxYear = yearFromValue; - } - return `${maxYear}-01-01`; -}; - -/** - * Return minDate for the date passed - * - * @param {number} previousYears previous number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} minDate calculated based on inputs - */ -export const getMinDate = (previousYears, currentYear, yearFromValue) => { - if (Number.isNaN(previousYears)) { - previousYears = 100; - } - let minYear = currentYear - previousYears; - if (yearFromValue < minYear) { - minYear = yearFromValue; - } - return `${minYear}-12-31`; -}; - -/** - * Return clockFormat after parsing - * - * @param {number | string} clockFormat chosen by user - * - * @returns {number} clockFormat - */ -export const parseClockFormat = clockFormat => - typeof clockFormat === 'string' ? parseInt(clockFormat, 10) : clockFormat; - -/** - * Return datetime value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} datetime after stripping of ms and seconds if selected to - */ -export const correctDateTimeToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return `${datetime.substring(0, datetime.indexOf('Z'))}.000Z`; - } - return `${datetime.substring(0, datetime.lastIndexOf(':'))}:00.000Z`; -}; - -/** - * Return time value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} just time after stripping of ms and seconds if selected to - */ -export const timeCorrectedToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return datetime.substring(datetime.indexOf('T') + 1, datetime.indexOf('.')); - } - return `${datetime.substring(datetime.indexOf('T') + 1, datetime.lastIndexOf(':'))}:00`; -}; - -/** - * This function handles the cosmos blur handler of DateTime components - * - * @param {string | undefined} errorState for the selected datetime value - * @param {string} actualValue present in redux - * @param {string} formattedValue retrieved by trimming ISO to just Date/Time, also applying timezone if DateTime - * @param {object} actions object which has fire and blur callbacks - * @param {string} propName name of the property bound - * @param {object} pConn component's PConnect object which is useful to invoke validationApi - * - * @returns {void} - */ -export const datetimeFireChangeBlurEvents = ( - errorState, - actualValue, - formattedValue, - actions, - propName, - pConn -) => { - // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation - // above triggerFieldChange should have validated this - if (errorState) { - pConn.getValidationApi().validate(errorState); - } - // BUG-640834 In errorState presist old values avoiding store update & re-render. - else { - if (formattedValue !== actualValue) { - actions.updateFieldValue(propName, formattedValue); - } - actions.triggerFieldChange(propName, formattedValue); - } -}; - -/** - * Return Date format for the locale passed - * - * @param {string} locale locale string - * @param {object} options options for format string - * @returns {string} dateformat for the locale - * Example : getDateFormat("pl-PL") returns "DD.MM.YYYY" - */ -export const getDateFormat = (locale, options) => { - return new Intl.DateTimeFormat(locale, options) - .formatToParts() - .map(({ type, value }) => { - switch (type) { - case 'day': - return 'DD'; - case 'month': - return 'MM'; - case 'year': - return 'YYYY'; - case 'hour': - return 'hh'; - case 'minute': - return 'mm'; - case 'second': - return 'ss'; - case 'dayPeriod': - return 'A'; - case 'literal': - return value; - default: - return ''; - } - }) - .join(''); -}; - -/** - * Return boolean for the locale passed to specify if locale uses 12 hour format - * - * @param {string} locale locale string - * @returns {boolean} True or False for the locale - * Example : getDateFormat("pl-PL") returns false - */ -export const is12HClockFormat = locale => { - const meridiem = new Intl.DateTimeFormat(locale, { - hour: 'numeric' - }) - .formatToParts() - .find(({ type }) => type === 'dayPeriod'); - return !!(meridiem === null || meridiem === undefined ? undefined : meridiem.value); -}; - -/** - * Return Option object for Time formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object time formatting - * Example : getTimeOptions(false, true) returns {hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getTimeOptions = (withSeconds, is12h = false) => { - return { - hour: 'numeric', - minute: 'numeric', - ...(withSeconds && { second: 'numeric' }), - hour12: is12h - }; -}; - -/** - * Return Option object for Datetime formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object datetime formatting - * Example : getDateTimeOptions(false, true) returns {year: 'numeric',month: 'numeric',day: 'numeric',hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getDateTimeOptions = (withSeconds, is12h = false) => { - return { - year: 'numeric', - month: 'numeric', - day: 'numeric', - ...getTimeOptions(withSeconds, is12h) - }; -}; - -export function getCurrentTimezone(tzone) { - if (tzone) return tzone; - return PCore?.getLocaleUtils?.().getTimeZoneInUse?.(); -} - -export function format(value, type, options) { - let formattedValue; - - switch (type?.toLowerCase()) { - case 'currency': { - const defaultOptions = { - locale: getLocale(), - position: 'before', - decPlaces: 2 - }; - const params = { ...defaultOptions, ...options }; - formattedValue = Currency.Currency(value, params); - break; - } - - case 'decimal': { - const defaultOptions = { locale: getLocale(), decPlaces: 2 }; - const params = { ...defaultOptions, ...options }; - formattedValue = Currency.Decimal(value, params); - break; - } - - case 'integer': { - const defaultOptions = { locale: getLocale() }; - const params = { ...defaultOptions, ...options }; - formattedValue = Currency.Integer(value, params); - break; - } - - case 'date': { - const defaultOptions = { - format: 'MMM DD, YYYY', - timezone: getCurrentTimezone() - }; - const params = { ...defaultOptions, ...options }; - formattedValue = DateFormatter.Date(parseDateInISO(value), params); - break; - } - - case 'datetime': { - const defaultOptions = { - format: 'MMM DD, YYYY h:mm A', - timezone: getCurrentTimezone() - }; - const params = { ...defaultOptions, ...options }; - formattedValue = DateFormatter.Date(parseDateInISO(value), params); - break; - } - - case 'boolean': - case 'checkbox': { - formattedValue = Boolean.TrueFalse(value, { allowEmpty: false }); - break; - } - - default: - formattedValue = value; - } - return formattedValue; -} diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/demo.stories.jsx deleted file mode 100644 index 3dbf1084..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/demo.stories.jsx +++ /dev/null @@ -1,73 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; -import { configProps, stateProps } from './mock.stories'; -import PegaDxilMyDate from './index.jsx'; - -export default { - title: 'PegaDxilMyDate', - decorators: [withKnobs], - component: PegaDxilMyDate -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getEnvironmentInfo = () => { - return { - getLocale: () => { - return 'en-GB'; - } - }; -}; - -export const basePegaDxilMyDate = () => { - const props = { - getPConnect: () => { - return { - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => {/* nothing */} - }; - }, - getStateProps: () => { - return stateProps; - }, - getConfigProps: () => { - return configProps; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - clearErrorMessages: () => {/* nothing */} - }; - }, - value: configProps.value, - validatemessage: configProps.validatemessage, - label: configProps.label, - hideLabel: configProps.hideLabel, - helperText: configProps.helperText, - nextYearRange: configProps.nextYearRange, - previousYearRange: configProps.previousYearRange, - showWeekNumber: configProps.showWeekNumber, - testId: configProps.testId, - showAsFormattedText: configProps.showAsFormattedText, - additionalProps: configProps.additionalProps, - displayMode: configProps.displayMode, - variant: configProps.variant, - hasSuggestions: configProps.hasSuggestions, - disabled: configProps.disabled, - readOnly: configProps.readOnly, - required: configProps.required - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/index.jsx deleted file mode 100644 index de22f856..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/index.jsx +++ /dev/null @@ -1,256 +0,0 @@ -/* eslint-disable no-undef */ -import { useEffect, useState } from 'react'; -import { DateInput, FieldValueList, DateTimeDisplay, Text, } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; -import FormattedText from "./FormattedText.jsx"; - -import StyledPegaDxilMyDateWrapper from './styles'; - -// includes in bundle -import { - datetimedisplayformatter, - formatExists, - getFullYear, - getMaxDate, - getMinDate, - datetimeFireChangeBlurEvents, - getDateFormat -} from "./date.js"; -import { suggestionsHandler } from './suggestions-handler'; - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyDate = props => { - const { - getPConnect, - value, - validatemessage, - label, - hideLabel, - helperText, - nextYearRange, - previousYearRange, - showWeekNumber, - testId, - showAsFormattedText, - additionalProps, - displayMode, - variant, - hasSuggestions - } = props; - - let {formatter} = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn?.getStateProps()?.value; - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === "string" && prop === "true") - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : ''); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - // calculate min and max range of calendar - const currentYear = getFullYear(); - const yearFromValue = getFullYear(value); - const maxDate = getMaxDate( - parseInt(nextYearRange, 10), - currentYear, - yearFromValue - ); - const minDate = getMinDate( - parseInt(previousYearRange, 10), - currentYear, - yearFromValue - ); - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - - - function handleBlur(onBlurValue) { - const { valueAsISOString: date, state: errorState } = onBlurValue; - const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date; - datetimeFireChangeBlurEvents(errorState, value, trimmedDate, actions, propName, pConn); - const isValueChanged = !(value === undefined && trimmedDate === '') && value !== trimmedDate; - if (hasSuggestions && isValueChanged) { - pConn.ignoreSuggestion(); - } - } - - function handleChange(onChangeValue) { - const { valueAsISOString: date } = onChangeValue; - const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date; - if (hasSuggestions && value !== trimmedDate) { - setStatus(undefined); - } - pConn.clearErrorMessages({ - property: propName - }) - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY') { - let variantValue = "date"; - let formatValue = "long"; - if(pConn && pConn.getConfigProps()){ - const runtimeformatter = pConn.getConfigProps()?.formatter; - if(formatter !== runtimeformatter){ - formatter = runtimeformatter; - } - } - if(formatter !== "" && formatExists(formatter)){ - const {variantVal,formatVal} = datetimedisplayformatter(formatter); - variantValue = variantVal; - formatValue = formatVal; - } - const displayComp = ( - - ); - switch(displayMode){ - case 'DISPLAY_ONLY': { - return ( displayComp ); - } - case "LABELS_LEFT" : { - return ( - - - - - ); - } - case "STACKED_LARGE_VAL" : { - return ( - - {displayComp} }]} - /> - - - ); - } - // no default - } - } - - - let dateComponent; - - if (readOnly && showAsFormattedText) { - const environmentInfo = PCore.getEnvironmentInfo(); - const locale = environmentInfo && environmentInfo.getLocale(); - const textAdditionalProps = { - format: getDateFormat(locale), - fieldType: 'Date' - }; - dateComponent = ( - - - - ); - } else { - dateComponent = ( - - - - ); - } - return dateComponent; -} - - - -PegaDxilMyDate.defaultProps = { - value: undefined, - validatemessage: "", - helperText: "", - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - showWeekNumber: false, - nextYearRange: "", - previousYearRange: "", - testId: null, - showAsFormattedText: false, - additionalProps: {}, - displayMode: null, - variant: "inline", - formatter: "defaultDate", - hasSuggestions: false -}; - -PegaDxilMyDate.propTypes = { - value: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - showWeekNumber: PropTypes.bool, - nextYearRange: PropTypes.string, - previousYearRange: PropTypes.string, - testId: PropTypes.string, - showAsFormattedText: PropTypes.bool, - additionalProps: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - variant: PropTypes.string, - formatter: PropTypes.string, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyDate; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/mock.stories.js deleted file mode 100644 index 54c66ae7..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/mock.stories.js +++ /dev/null @@ -1,23 +0,0 @@ -export const configProps = { - value: '2023-01-31T12:23:00.000Z', - validatemessage: '', - label: 'Date Label', - hideLabel: false, - helperText: 'Date helper text', - nextYearRange: '10', - previousYearRange: '10', - showWeekNumber: true, - testId: '12345678', - showAsFormattedText: true, - additionalProps: {}, - displayMode: '', - variant: '', - hasSuggestions: false, - readOnly: false, - required: false, - disabled: false -}; - -export const stateProps = { - value: '.DateLabel' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-time.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-time.js deleted file mode 100644 index 7fb4d071..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-time.js +++ /dev/null @@ -1,92 +0,0 @@ -import dayjs from "dayjs"; -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -const types = ["fromNow", "customFormat"]; - -// value should be in ISO 8601 format. -function DateFormatter( - value, - { type = types[1], format = "DD/MM/YYYY", tzone, fieldType } = {} -) { - if (!value) return value; - switch (type) { - case types[1]: - if (tzone && fieldType !== 'Date') return dayjs(value).tz(tzone).format(format); // Date only value should be formatted without timezone - return dayjs(value).format(format); - case types[0]: - return dayjs(value).from(dayjs()); - default: - return value; - } -} -// value should be in hh:mm:ss format (00:00:00 - 23:59:59). -function TimeFormatter(value, options) { - if (!value) return value; - const { locale = "en-US" } = options; - const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/; - if (value.length === 8 && timeOnlyRegex.test(value)) { - const { timeOptions = {} } = options; - const tempDate = new Date(); - const hours = parseInt(value.substr(0, 2), 10); - const minutes = parseInt(value.substr(3, 2), 10); - const seconds = parseInt(value.substr(6, 2), 10); - tempDate.setHours(hours); - tempDate.setMinutes(minutes); - tempDate.setSeconds(seconds); - return tempDate.toLocaleTimeString(locale, timeOptions); - } - return DateFormatter(value, options); -} - -export const DateTimeShortFormatter = (value, options) => { - return DateFormatter(value, { - ...options, - type: "customFormat", - format: "MMM DD, YYYY" - }); -} - -export default { - "DateTime-Long": (value, options) => - DateFormatter(value, { ...options, type: "customFormat", format: "LLL" }), - "DateTime-Short": DateTimeShortFormatter, - "DateTime-Since": (value) => DateFormatter(value, { type: "fromNow" }), - "Time-Only": (value, options) => - TimeFormatter(value, { - ...options, - type: "customFormat", - format: "hh:mm:ss A" - }), - convertToTimezone: (value, options) => { - return value && options && options.timezone - ? DateFormatter(value, { - ...options, - type: "customFormat", - format: "YYYY-MM-DDTHH:mm:ss" - }) - : value; - }, - convertFromTimezone: (value, tzone) => - value && tzone - ? dayjs.tz(value, tzone).utc().format("YYYY-MM-DDTHH:mm:ss[Z]") - : value, - Date: (value, options) => - DateFormatter(value, { type: "customFormat", ...options }), - "Date-Default": DateTimeShortFormatter, - "Date-Time-Default": (value, options) => - DateFormatter(value, { ...options, type: "customFormat", format: "lll" }), - "Time-Default": (value, options) => - TimeFormatter(value, { - ...options, - type: "customFormat", - format: "hh:mm A" - }) -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-utils.js deleted file mode 100644 index fad402d1..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date-utils.js +++ /dev/null @@ -1,288 +0,0 @@ -/* eslint-disable no-undef */ -import dayjs from "dayjs"; -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -/** - * Return relative time in fromNow for the given datetime - * @description Convert and return the given datetime in dayJSObject - * - * @param {string} text datetime - * @returns {object} datetime as a dayjs object - */ -export const getDayJSObject = (text) => { - const momObj = dayjs(text); - if (momObj.isValid()) return momObj; - const timeStamp = text; - const isDateTime = timeStamp.indexOf("GMT") !== -1; - const year = parseInt(timeStamp.substr(0, 4), 10); - const month = parseInt(timeStamp.substr(4, 2), 10) - 1; - const day = parseInt(timeStamp.substr(6, 2), 10); - - const CurrentTz = PCore.getLocaleUtils().getTimeZoneInUse(); - - let mom = new Date(); - - mom.setUTCDate(day); - mom.setUTCMonth(month); - mom.setUTCFullYear(year); - - /* istanbul ignore else */ - if (isDateTime) { - const hours = parseInt(timeStamp.substr(9, 2), 10); - const minutes = parseInt(timeStamp.substr(11, 2), 10); - const seconds = parseInt(timeStamp.substr(13, 2), 10); - const ms = parseInt(timeStamp.substr(16, 3), 10); - mom.setUTCHours(hours); - mom.setUTCMinutes(minutes); - mom.setUTCSeconds(seconds); - mom.setUTCMilliseconds(ms); - } - - mom = dayjs( - mom.toLocaleString("en-US", { - timeZone: CurrentTz - }) - ); - - return mom; -}; - -/** - * Return relative time in fromNow for the given datetime - * - * @param {string} time datetime - * @returns {object} relative time from now - */ -export const getRelativeTime = (time) => { - let relativetime = ""; - if (dayjs(time).isUTC()) { - relativetime = dayjs(time).fromNow(); - } else { - const dayjstime = getDayJSObject(time); - relativetime = dayjs(dayjstime).fromNow(); - } - return relativetime; -}; - -/** - * Return year for the date passed - * - * @param {string} value from which Year needs to be taken out - * @returns {number} year for the date passed - */ -export const getFullYear = (value) => - value ? new Date(value).getFullYear() : new Date().getFullYear(); - -/** - * Return maxDate for the date passed - * - * @param {number} nextYears next number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} maxDate calculated based on inputs - */ -export const getMaxDate = (nextYears, currentYear, yearFromValue) => { - if (Number.isNaN(nextYears)) { - nextYears = 20; - } - let maxYear = currentYear + nextYears; - if (yearFromValue > maxYear) { - maxYear = yearFromValue; - } - return `${maxYear}-01-01`; -}; - -/** - * Return minDate for the date passed - * - * @param {number} previousYears previous number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} minDate calculated based on inputs - */ -export const getMinDate = (previousYears, currentYear, yearFromValue) => { - if (Number.isNaN(previousYears)) { - previousYears = 100; - } - let minYear = currentYear - previousYears; - if (yearFromValue < minYear) { - minYear = yearFromValue; - } - return `${minYear}-12-31`; -}; - -/** - * Return clockFormat after parsing - * - * @param {number | string} clockFormat chosen by user - * - * @returns {number} clockFormat - */ -export const parseClockFormat = (clockFormat) => - typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat; - -/** - * Return datetime value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} datetime after stripping of ms and seconds if selected to - */ -export const correctDateTimeToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`; - } - return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`; -}; - -/** - * Return time value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} just time after stripping of ms and seconds if selected to - */ -export const timeCorrectedToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf(".")); - } - return `${datetime.substring( - datetime.indexOf("T") + 1, - datetime.lastIndexOf(":") - )}:00`; -}; - -/** - * This function handles the cosmos blur handler of DateTime components - * - * @param {string | undefined} errorState for the selected datetime value - * @param {string} actualValue present in redux - * @param {string} formattedValue retrieved by trimming ISO to just Date/Time, also applying timezone if DateTime - * @param {object} actions object which has fire and blur callbacks - * @param {string} propName name of the property bound - * @param {object} pConn component's PConnect object which is useful to invoke validationApi - * - * @returns {void} - */ -export const datetimeFireChangeBlurEvents = ( - errorState, - actualValue, - formattedValue, - actions, - propName, - pConn -) => { - - // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation - // above triggerFieldChange should have validated this - if (errorState) { - pConn.getValidationApi().validate(errorState); - } - // BUG-640834 In errorState presist old values avoiding store update & re-render. - else{ - if (formattedValue !== actualValue) { - actions.updateFieldValue(propName, formattedValue); - } - actions.triggerFieldChange(propName, formattedValue); - } -}; - -/** - * Return Date format for the locale passed - * - * @param {string} locale locale string - * @param {object} options options for format string - * @returns {string} dateformat for the locale - * Example : getDateFormat("pl-PL") returns "DD.MM.YYYY" - */ -export const getDateFormat = (locale, options) => { - return new Intl.DateTimeFormat(locale, options) - .formatToParts() - .map(({ type, value }) => { - switch (type) { - case "day": - return "DD"; - case "month": - return "MM"; - case "year": - return "YYYY"; - case "hour": - return "hh"; - case "minute": - return "mm"; - case "second": - return "ss"; - case "dayPeriod": - return "A"; - case "literal": - return value; - default: - return ""; - } - }) - .join(""); -}; - -/** - * Return boolean for the locale passed to specify if locale uses 12 hour format - * - * @param {string} locale locale string - * @returns {boolean} True or False for the locale - * Example : getDateFormat("pl-PL") returns false - */ -export const is12HClockFormat = (locale) => { - const meridiem = new Intl.DateTimeFormat(locale, { - hour: "numeric" - }) - .formatToParts() - .find(({ type }) => type === "dayPeriod"); - return !!(meridiem === null || meridiem === undefined - ? undefined - : meridiem.value); -}; - -/** - * Return Option object for Time formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object time formatting - * Example : getTimeOptions(false, true) returns {hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getTimeOptions = (withSeconds, is12h = false) => { - return { - hour: "numeric", - minute: "numeric", - ...(withSeconds && { second: "numeric" }), - hour12: is12h - }; -}; - -/** - * Return Option object for Datetime formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object datetime formatting - * Example : getDateTimeOptions(false, true) returns {year: 'numeric',month: 'numeric',day: 'numeric',hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getDateTimeOptions = (withSeconds, is12h = false) => { - return { - year: "numeric", - month: "numeric", - day: "numeric", - ...getTimeOptions(withSeconds, is12h) - }; -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date.js deleted file mode 100644 index 072a6a1e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/date.js +++ /dev/null @@ -1,331 +0,0 @@ -/* eslint-disable no-undef */ -import dayjs from 'dayjs'; -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -export const datetimedisplayformatter = (formatter) => { - const objectvalues = {}; - switch (formatter) { - case "DateTime-Long": { - objectvalues.variantVal = "datetime"; - objectvalues.formatVal = "long"; - break; - } - case "DateTime-Short": { - objectvalues.variantVal = "date"; - objectvalues.formatVal = "short"; - break; - } - case "DateTime-Since": { - objectvalues.variantVal = "relative"; - break; - } - case "Time-Only": { - objectvalues.variantVal = "time"; - objectvalues.formatVal = "short"; - break; - } - // no default - } - return objectvalues; -}; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "DateTime-Long", - "DateTime-Short", - "DateTime-Since", - "Time-Only" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; -}; - - - -/** - * Return relative time in fromNow for the given datetime - * @description Convert and return the given datetime in dayJSObject - * - * @param {string} text datetime - * @returns {object} datetime as a dayjs object - */ -export const getDayJSObject = (text) => { - const momObj = dayjs(text); - if (momObj.isValid()) return momObj; - const timeStamp = text; - const isDateTime = timeStamp.indexOf("GMT") !== -1; - const year = parseInt(timeStamp.substr(0, 4), 10); - const month = parseInt(timeStamp.substr(4, 2), 10) - 1; - const day = parseInt(timeStamp.substr(6, 2), 10); - - const CurrentTz = PCore.getLocaleUtils().getTimeZoneInUse(); - - let mom = new Date(); - - mom.setUTCDate(day); - mom.setUTCMonth(month); - mom.setUTCFullYear(year); - - /* istanbul ignore else */ - if (isDateTime) { - const hours = parseInt(timeStamp.substr(9, 2), 10); - const minutes = parseInt(timeStamp.substr(11, 2), 10); - const seconds = parseInt(timeStamp.substr(13, 2), 10); - const ms = parseInt(timeStamp.substr(16, 3), 10); - mom.setUTCHours(hours); - mom.setUTCMinutes(minutes); - mom.setUTCSeconds(seconds); - mom.setUTCMilliseconds(ms); - } - - mom = dayjs( - mom.toLocaleString("en-US", { - timeZone: CurrentTz - }) - ); - - return mom; -}; - -/** - * Return relative time in fromNow for the given datetime - * - * @param {string} time datetime - * @returns {object} relative time from now - */ -export const getRelativeTime = (time) => { - let relativetime = ""; - if (dayjs(time).isUTC()) { - relativetime = dayjs(time).fromNow(); - } else { - const dayjstime = getDayJSObject(time); - relativetime = dayjs(dayjstime).fromNow(); - } - return relativetime; -}; - -/** - * Return year for the date passed - * - * @param {string} value from which Year needs to be taken out - * @returns {number} year for the date passed - */ -export const getFullYear = (value) => - value ? new Date(value).getFullYear() : new Date().getFullYear(); - -/** - * Return maxDate for the date passed - * - * @param {number} nextYears next number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} maxDate calculated based on inputs - */ -export const getMaxDate = (nextYears, currentYear, yearFromValue) => { - if (Number.isNaN(nextYears)) { - nextYears = 20; - } - let maxYear = currentYear + nextYears; - if (yearFromValue > maxYear) { - maxYear = yearFromValue; - } - return `${maxYear}-01-01`; -}; - -/** - * Return minDate for the date passed - * - * @param {number} previousYears previous number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} minDate calculated based on inputs - */ -export const getMinDate = (previousYears, currentYear, yearFromValue) => { - if (Number.isNaN(previousYears)) { - previousYears = 100; - } - let minYear = currentYear - previousYears; - if (yearFromValue < minYear) { - minYear = yearFromValue; - } - return `${minYear}-12-31`; -}; - -/** - * Return clockFormat after parsing - * - * @param {number | string} clockFormat chosen by user - * - * @returns {number} clockFormat - */ -export const parseClockFormat = (clockFormat) => - typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat; - -/** - * Return datetime value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} datetime after stripping of ms and seconds if selected to - */ -export const correctDateTimeToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`; - } - return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`; -}; - -/** - * Return time value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} just time after stripping of ms and seconds if selected to - */ -export const timeCorrectedToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf(".")); - } - return `${datetime.substring( - datetime.indexOf("T") + 1, - datetime.lastIndexOf(":") - )}:00`; -}; - -/** - * This function handles the cosmos blur handler of DateTime components - * - * @param {string | undefined} errorState for the selected datetime value - * @param {string} actualValue present in redux - * @param {string} formattedValue retrieved by trimming ISO to just Date/Time, also applying timezone if DateTime - * @param {object} actions object which has fire and blur callbacks - * @param {string} propName name of the property bound - * @param {object} pConn component's PConnect object which is useful to invoke validationApi - * - * @returns {void} - */ -export const datetimeFireChangeBlurEvents = ( - errorState, - actualValue, - formattedValue, - actions, - propName, - pConn -) => { - - // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation - // above triggerFieldChange should have validated this - if (errorState) { - pConn.getValidationApi().validate(errorState); - } - // BUG-640834 In errorState presist old values avoiding store update & re-render. - else{ - if (formattedValue !== actualValue) { - actions.updateFieldValue(propName, formattedValue); - } - actions.triggerFieldChange(propName, formattedValue); - } -}; - -/** - * Return Date format for the locale passed - * - * @param {string} locale locale string - * @param {object} options options for format string - * @returns {string} dateformat for the locale - * Example : getDateFormat("pl-PL") returns "DD.MM.YYYY" - */ -export const getDateFormat = (locale, options) => { - return new Intl.DateTimeFormat(locale, options) - .formatToParts() - .map(({ type, value }) => { - switch (type) { - case "day": - return "DD"; - case "month": - return "MM"; - case "year": - return "YYYY"; - case "hour": - return "hh"; - case "minute": - return "mm"; - case "second": - return "ss"; - case "dayPeriod": - return "A"; - case "literal": - return value; - default: - return ""; - } - }) - .join(""); -}; - -/** - * Return boolean for the locale passed to specify if locale uses 12 hour format - * - * @param {string} locale locale string - * @returns {boolean} True or False for the locale - * Example : getDateFormat("pl-PL") returns false - */ -export const is12HClockFormat = (locale) => { - const meridiem = new Intl.DateTimeFormat(locale, { - hour: "numeric" - }) - .formatToParts() - .find(({ type }) => type === "dayPeriod"); - return !!(meridiem === null || meridiem === undefined - ? undefined - : meridiem.value); -}; - -/** - * Return Option object for Time formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object time formatting - * Example : getTimeOptions(false, true) returns {hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getTimeOptions = (withSeconds, is12h = false) => { - return { - hour: "numeric", - minute: "numeric", - ...(withSeconds && { second: "numeric" }), - hour12: is12h - }; -}; - -/** - * Return Option object for Datetime formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object datetime formatting - * Example : getDateTimeOptions(false, true) returns {year: 'numeric',month: 'numeric',day: 'numeric',hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getDateTimeOptions = (withSeconds, is12h = false) => { - return { - year: "numeric", - month: "numeric", - day: "numeric", - ...getTimeOptions(withSeconds, is12h) - }; -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/demo.stories.jsx deleted file mode 100644 index 33477e19..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/demo.stories.jsx +++ /dev/null @@ -1,73 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; -import { configProps, stateProps } from './mock.stories'; -import PegaDxilMyDateTime from './index.jsx'; - -export default { - title: 'PegaDxilMyDateTime', - decorators: [withKnobs], - component: PegaDxilMyDateTime -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getEnvironmentInfo = () => { - return { - getTimeZone: () => { - return ''; - } - }; -}; - -export const basePegaDxilMyDateTime = () => { - const props = { - getPConnect: () => { - return { - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => {/* nothing */} - }; - }, - getStateProps: () => { - return stateProps; - }, - getConfigProps: () => { - return configProps; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - clearErrorMessages: () => {/* nothing */} - }; - }, - value: configProps.value, - validatemessage: configProps.validatemessage, - label: configProps.label, - hideLabel: configProps.hideLabel, - helperText: configProps.helperText, - withSeconds: configProps.withSeconds, - nextYearRange: configProps.nextYearRange, - previousYearRange: configProps.previousYearRange, - showWeekNumber: configProps.showWeekNumber, - testId: configProps.testId, - additionalProps: configProps.additionalProps, - displayMode: configProps.displayMode, - variant: configProps.variant, - hasSuggestions: configProps.hasSuggestions, - disabled: configProps.disabled, - readOnly: configProps.readOnly, - required: configProps.required - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/index.jsx deleted file mode 100644 index 64510b9c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/index.jsx +++ /dev/null @@ -1,254 +0,0 @@ -/* eslint-disable no-undef */ -import { useEffect, useState } from 'react'; -import { DateTimeInput, FieldValueList, DateTimeDisplay, Text } from "@pega/cosmos-react-core"; -import PropTypes from "prop-types"; - -// includes in bundle -import DateTimeFormatter from "./date-time"; -import {datetimedisplayformatter,formatExists} from "./date"; -import { - getFullYear, - getMaxDate, - getMinDate, - parseClockFormat, - correctDateTimeToSeconds, - datetimeFireChangeBlurEvents -} from "./date-utils"; -import { suggestionsHandler } from './suggestions-handler'; - - -import StyledPegaDxilMyDateTimeWrapper from './styles'; - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyDateTime = props => { - const { - getPConnect, - value, - validatemessage, - label, - hideLabel, - helperText, - withSeconds, - nextYearRange, - previousYearRange, - showWeekNumber, - pickerInterval, - testId, - additionalProps, - displayMode, - variant, - hasSuggestions - } = props; - let { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - - const environmentInfo = PCore.getEnvironmentInfo(); - const timezone = environmentInfo && environmentInfo.getTimeZone(); - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : ''); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - let { clockFormat } = props; - clockFormat = parseClockFormat(clockFormat); - - // calculate min and max range of calendar - const currentYear = getFullYear(); - const yearFromValue = getFullYear(value); - const maxDate = getMaxDate(parseInt(nextYearRange, 10), currentYear, yearFromValue); - const minDate = getMinDate(parseInt(previousYearRange, 10), currentYear, yearFromValue); - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - function handleBlur(onBlurValue) { - const { valueAsISOString: datetimeTZ, state: errorState } = onBlurValue; - const datetimeGMT = DateTimeFormatter.convertFromTimezone(datetimeTZ, timezone); - - const datetimeGMTCorrectedToSeconds = datetimeGMT - ? correctDateTimeToSeconds(datetimeGMT, withSeconds) - : datetimeGMT; - - datetimeFireChangeBlurEvents(errorState, value, datetimeGMTCorrectedToSeconds, actions, propName, pConn); - const isValueChanged = - !(value === undefined && datetimeGMTCorrectedToSeconds === '') && value !== datetimeGMTCorrectedToSeconds; - if (hasSuggestions && isValueChanged) { - pConn.ignoreSuggestion(); - } - } - - function handleChange(onChangeValue) { - const { valueAsISOString: datetimeTZ } = onChangeValue; - const datetimeGMT = DateTimeFormatter.convertFromTimezone(datetimeTZ, timezone); - const datetimeGMTCorrectedToSeconds = datetimeGMT - ? correctDateTimeToSeconds(datetimeGMT, withSeconds) - : datetimeGMT; - if (hasSuggestions && value !== datetimeGMTCorrectedToSeconds) { - setStatus(undefined); - } - pConn.clearErrorMessages({ - property: propName - }); - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY') { - let variantValue = 'datetime'; - let formatValue = withSeconds ? 'long' : 'short'; - const runtimeformatter = pConn.getConfigProps()?.formatter; - if (formatter !== runtimeformatter) { - formatter = runtimeformatter; - } - if (formatExists(formatter)) { - const { variantVal, formatVal } = datetimedisplayformatter(formatter); - variantValue = variantVal; - formatValue = withSeconds && formatter === 'Time-Only' ? 'long' : formatVal; - } - const displayComp = ( - - ); - switch (displayMode) { - case 'DISPLAY_ONLY': { - return ( displayComp ); - } - case 'LABELS_LEFT': { - return ( - - - - ); - } - case 'STACKED_LARGE_VAL': { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - // no default - } - } - - - return ( - - - - ); -} - - - -PegaDxilMyDateTime.defaultProps = { - value: undefined, - withSeconds: false, - validatemessage: "", - helperText: "", - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - pickerInterval: "30", - clockFormat: 0, - showWeekNumber: false, - nextYearRange: "", - previousYearRange: "", - testId: null, - additionalProps: {}, - displayMode: null, - variant: "inline", - Format: "defaultDateTime", - hasSuggestions: false -}; - -PegaDxilMyDateTime.propTypes = { - value: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - withSeconds: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - pickerInterval: PropTypes.string, - clockFormat: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - showWeekNumber: PropTypes.bool, - nextYearRange: PropTypes.string, - previousYearRange: PropTypes.string, - testId: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - variant: PropTypes.string, - formatter: PropTypes.string, - Format: PropTypes.string, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyDateTime; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/mock.stories.js deleted file mode 100644 index 45eb3e8c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/mock.stories.js +++ /dev/null @@ -1,23 +0,0 @@ -export const configProps = { - value: '2023-01-24T16:45:00.000Z', - validatemessage: '', - label: 'DateTime Label', - hideLabel: false, - helperText: 'DateTime helper text', - withSeconds: false, - nextYearRange: '10', - previousYearRange: '5', - showWeekNumber: false, - testId: '12345678', - additionalProps: {}, - displayMode: '', - variant: '', - hasSuggestions: false, - readOnly: false, - required: false, - disabled: false -}; - -export const stateProps = { - value: '.DateTimeLabel' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/demo.stories.jsx deleted file mode 100644 index a9eb10fa..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/demo.stories.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, fieldMetadata, stateProps } from './mock.stories.js'; - -import PegaDxilMyDecimal from './index.jsx'; - -export default { - title: 'PegaDxilMyDecimal', - decorators: [withKnobs], - component: PegaDxilMyDecimal -}; - -export const basePegaDxilMyDecimal = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - showGroupSeparators: configProps.showGroupSeparators, - hasSuggestions: configProps.hasSuggestions, - testId: configProps.testId, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/index.jsx deleted file mode 100644 index 3e0fc7a8..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/index.jsx +++ /dev/null @@ -1,270 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { NumberInput, NumberDisplay, CurrencyDisplay, FieldValueList, Text } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import StyledPegaDxilMyDecimalWrapper from './styles'; -import handleEvent from "./event-utils"; -import { suggestionsHandler } from './suggestions-handler'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyDecimal = props => { - const { - getPConnect, - value, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - displayMode, - additionalProps, - variant, - formatter, - negative, - notation, - currencyISOCode, - isTableFormatter, - hasSuggestions - } = props; - let { showGroupSeparators } = props; - let { currencyDisplay } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const [decimalValue, setDecimalValue] = useState(value?.toString()); - const hasValueChange = useRef(false); - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - const { decimalPrecision, currencyDecimalPrecision } = props; - let numberOfDecimals = parseInt(decimalPrecision, 10); - if (Number.isNaN(numberOfDecimals)) { - numberOfDecimals = decimalPrecision === '' ? undefined : 2; - } - let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10); - - useEffect(() => { - setDecimalValue(value?.toString()); - }, [value]); - - let unit; - - if (['DISPLAY_ONLY', 'LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode)) { - if (displayMode !== 'STACKED_LARGE_VAL' && isTableFormatter) { - showGroupSeparators = true; - noOfFractionDigits = undefined; - if (formatter === 'Currency-Code') { - currencyDisplay = 'code'; - } - } - - switch (formatter) { - case 'Integer': { - numberOfDecimals = 0; - break; - } - case 'Percentage': { - showGroupSeparators = false; - unit = 'percent'; - break; - } - case 'Decimal-Auto': { - numberOfDecimals = Number.isInteger(decimalValue) ? 0 : 2; - break; - } - default: { - break; - } - } - - - - const displayComp = - formatter === 'Currency' || formatter === 'Currency-Code' ? ( - - ) : ( - - ); - - - switch (displayMode) { - case 'DISPLAY_ONLY': { - return ( displayComp ); - } - case 'LABELS_LEFT': { - return ( - - - - ); - } - case 'STACKED_LARGE_VAL': { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - // no default - } - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setDecimalValue(enteredValue); - if (value !== (enteredValue !== '' ? Number(enteredValue) : '')) { - handleEvent(actions, 'change', propName, enteredValue !== '' ? Number(enteredValue) : ''); - hasValueChange.current = true; - } - }} - onBlur={() => { - if (!value || hasValueChange.current) { - handleEvent(actions, 'blur', propName, decimalValue !== '' ? Number(decimalValue) : ''); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - - -PegaDxilMyDecimal.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - decimalPrecision: '', - showGroupSeparators: false, - displayMode: null, - additionalProps: {}, - variant: 'inline', - currencyISOCode: 'USD', - formatter: 'defaultDecimal', - isoCodeSelection: 'constant', - negative: 'minus-sign', - notation: 'standard', - currencyDisplay: 'symbol', - currencyDecimalPrecision: 'auto', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyDecimal.propTypes = { - value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - decimalPrecision: PropTypes.string, - showGroupSeparators: PropTypes.bool, - displayMode: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - currencyISOCode: PropTypes.string, - formatter: PropTypes.string, - isoCodeSelection: PropTypes.string, - negative: PropTypes.string, - notation: PropTypes.string, - currencyDisplay: PropTypes.string, - currencyDecimalPrecision: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyDecimal; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/mock.stories.js deleted file mode 100644 index 39ac58c2..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/mock.stories.js +++ /dev/null @@ -1,21 +0,0 @@ -export const configProps = { - value: '', - label: 'Decimal Sample', - showGroupSeparators: true, - placeholder: 'Decimal Placeholder', - helperText: 'Decimal Helper Text', - testId: 'decimal-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.DecimalSample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Decimal', - displayAs: 'pxNumber', - label: 'Decimal sample' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/demo.stories.jsx deleted file mode 100644 index e7a9917d..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/demo.stories.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyEmail from './index.jsx'; - -import { stateProps, configProps, fieldMetadata } from './mock.stories'; - -export default { - title: 'PegaDxilMyEmail', - decorators: [withKnobs], - component: PegaDxilMyEmail -}; - -export const basePegaDxilMyEmail = () => { - - const props = { - value: configProps.value, - label: configProps.label, - placeholder: configProps.placeholder, - helperText: configProps.helperText, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/index.jsx deleted file mode 100644 index adc7dc4c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/index.jsx +++ /dev/null @@ -1,231 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { Input, EmailDisplay, FieldValueList, Text, URLDisplay, PhoneDisplay } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import { suggestionsHandler } from './suggestions-handler'; -import handleEvent from "./event-utils"; - -import StyledPegaDxilMyEmailWrapper from './styles'; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyEmail = props => { - const { - getPConnect, - value, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - displayMode, - additionalProps, - variant, - isTableFormatter, - hasSuggestions - } = props; - const { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const hasValueChange = useRef(false); - - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - const [inputValue, setInputValue] = useState(value); - useEffect(() => setInputValue(value), [value]); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - let displayComp = null; - if (displayMode) { - displayComp = ; - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - if (isTableFormatter && formatExists(formatter)) { - displayComp = textFormatter(formatter, value); - } - return displayMode === 'DISPLAY_ONLY' ? ( - - displayComp - - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setInputValue(event.target.value); - if (value !== event.target.value) { - handleEvent(actions, 'change', propName, event.target.value); - hasValueChange.current = true; - } - }} - onBlur={(event) => { - if (!value || hasValueChange.current) { - handleEvent(actions, 'blur', propName, event.target.value); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onFocus={actions.onFocus} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyEmail.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - displayMode: null, - additionalProps: {}, - variant: 'inline', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyEmail.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - displayMode: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyEmail; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/mock.stories.js deleted file mode 100644 index d4dee12d..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/mock.stories.js +++ /dev/null @@ -1,22 +0,0 @@ -export const configProps = { - value: '', - label: 'Email Sample', - placeholder: 'Email Placeholder', - helperText: 'Email Helper Text', - testId: 'email-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.EmailSample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Text', - maxLength: 256, - displayAs: 'pxEmail', - label: 'Email sample', - validateAs: 'ValidEmailAddress' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/demo.stories.jsx deleted file mode 100644 index 1f4cca82..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/demo.stories.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { stateProps, configProps, fieldMetadata } from './mock.stories'; - -import PegaDxilMyInteger from './index.jsx'; - -export default { - title: 'PegaDxilMyInteger', - decorators: [withKnobs], - component: PegaDxilMyInteger -}; - -export const basePegaDxilMyInteger = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - showGroupSeparators: configProps.showGroupSeparators, - hasSuggestions: configProps.hasSuggestions, - testId: configProps.testId, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/index.jsx deleted file mode 100644 index 5ed8d49a..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/index.jsx +++ /dev/null @@ -1,333 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { NumberInput, NumberDisplay, Slider, FieldValueList, CurrencyDisplay, Text } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import handleEvent from "./event-utils"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyIntegerWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyInteger = props => { - const { - getPConnect, - value, - defaultValue, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - displayMode, - displayAs, - showInput, - min, - max, - step, - showTicks, - additionalProps, - variant, - formatter, - negative, - notation, - isTableFormatter, - hasSuggestions - } = props; - let { showGroupSeparators } = props; - let { currencyDisplay } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const [integerValue, setIntegerValue] = useState(value?.toString()); - const sliderDefaultValue = !defaultValue && defaultValue !== 0 ? max : defaultValue; - const hasValueChange = useRef(false); - - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : ''); - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - useEffect(() => { - setIntegerValue(value?.toString()); - }, [value]); - - useEffect(() => { - if (displayAs === 'slider' && value === '') { - handleEvent(actions, 'change', propName, sliderDefaultValue); - } - }, []); - - const { decimalPrecision, currencyDecimalPrecision, currencyISOCode } = props; - let noOfDecimals = parseInt(decimalPrecision, 10); - if (Number.isNaN(noOfDecimals)) noOfDecimals = undefined; - let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10); - let unit; - let unitPlacement; - - if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) { - switch (formatter) { - case 'Decimal': { - break; - } - case 'Percentage': { - showGroupSeparators = false; - unit = '%'; - unitPlacement = 'after'; - break; - } - case 'Decimal-Auto': { - noOfDecimals = Number.isInteger(integerValue) ? 0 : 2; - break; - } - default: { - noOfDecimals = 0; - break; - } - } - - if (isTableFormatter && displayMode === 'LABELS_LEFT') { - showGroupSeparators = true; - noOfFractionDigits = undefined; - if (formatter === 'Currency-Code') { - currencyDisplay = 'code'; - } - } - - - const displayComp = - formatter === 'Currency' || formatter === 'Currency-Code' ? ( - - ) : ( - - ); - - - switch (displayMode) { - case 'DISPLAY_ONLY': { - return ( displayComp ); - } - case 'LABELS_LEFT': { - return ( - - - - ); - } - case 'STACKED_LARGE_VAL': { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - // no default - } - } - - function onChangeHandler(enteredValue) { - if (hasSuggestions) { - setStatus(undefined); - } - setIntegerValue(enteredValue); - // const parsedValue = integerValue !== '' ? Number(integerValue) : ''; - if (value !== (enteredValue !== '' ? Number(enteredValue) : '')) { - handleEvent(actions, 'change', propName, enteredValue !== '' ? Number(enteredValue) : ''); - hasValueChange.current = true; - } - // In case of stepper variation there is no blur event as component is never focussed unless forced. Need to update redux on change. - if (displayAs === 'stepper') { - handleEvent(actions, 'changeNblur', propName, enteredValue !== '' ? Number(enteredValue) : ''); - } - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return displayAs === 'slider' ? ( - - { - onChangeHandler(selectedValue.toString()); - handleEvent(actions, 'changeNblur', propName, selectedValue); - }} - /> - - ) : ( - - { - onChangeHandler(enteredValue); - }} - onBlur={() => { - if (!readOnly && (hasValueChange.current || !value)) { - handleEvent(actions, 'blur', propName, integerValue !== '' ? Number(integerValue) : ''); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyInteger.defaultProps = { - value: '', - defaultValue: null, - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - showGroupSeparators: false, - displayMode: null, - displayAs: 'input', - showInput: true, - min: 0, - max: 100, - step: 1, - showTicks: true, - additionalProps: {}, - variant: 'inline', - decimalPrecision: null, - currencyISOCode: 'USD', - isoCodeSelection: 'constant', - formatter: 'defaultInteger', - negative: 'minus-sign', - notation: 'standard', - currencyDisplay: 'symbol', - currencyDecimalPrecision: 'auto', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyInteger.propTypes = { - value: PropTypes.string, - defaultValue: PropTypes.number, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - showGroupSeparators: PropTypes.bool, - displayMode: PropTypes.string, - displayAs: PropTypes.string, - showInput: PropTypes.bool, - min: PropTypes.number, - max: PropTypes.number, - step: PropTypes.number, - showTicks: PropTypes.bool, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - decimalPrecision: PropTypes.number, - currencyISOCode: PropTypes.string, - isoCodeSelection: PropTypes.string, - formatter: PropTypes.string, - negative: PropTypes.string, - notation: PropTypes.string, - currencyDisplay: PropTypes.string, - currencyDecimalPrecision: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyInteger; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/mock.stories.js deleted file mode 100644 index 8cce1630..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/mock.stories.js +++ /dev/null @@ -1,21 +0,0 @@ -export const configProps = { - value: '', - label: 'Integer Sample', - showGroupSeparators: true, - placeholder: 'Integer Placeholder', - helperText: 'Integer Helper Text', - testId: 'integer-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.IntegerSample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Integer', - displayAs: 'pxInteger', - label: 'Integer sample' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyInteger/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/demo.stories.jsx deleted file mode 100644 index 5f3cbe3d..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/demo.stories.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyParagraph from './index.jsx'; - -import { stateProps, configProps, fieldMetadata } from './mock.stories'; - -export default { - title: 'PegaDxilMyParagraph', - decorators: [withKnobs], - component: PegaDxilMyParagraph -}; - -export const basePegaDxilMyParagraph = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/index.jsx deleted file mode 100644 index 5e1e621e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/index.jsx +++ /dev/null @@ -1,231 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { TextArea as CosmosTextArea, FieldValueList, ParagraphDisplay, Text, EmailDisplay, PhoneDisplay, URLDisplay } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import { suggestionsHandler } from './suggestions-handler'; -import handleEvent from "./event-utils"; - -import StyledPegaDxilMyParagraphWrapper from './styles'; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyParagraph = props => { - const { - getPConnect, - value, - hideLabel, - placeholder, - validatemessage, - label, - helperText, - testId, - fieldMetadata, - displayMode, - additionalProps, - variant, - isTableFormatter, - hasSuggestions - } = props; - const { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const maxLength = fieldMetadata?.maxLength; - const hasValueChange = useRef(false); - - - // BUG-547602: Temporary type coercion for 8.5 until DXAPIs are enhanced to pass original pxViewMetadata JSON, respecting boolean primitives - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [inputValue, setInputValue] = useState(value); - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - useEffect(() => setInputValue(value), [value]); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - let displayComp = ; - if (isTableFormatter && formatExists(formatter) && formatter !== 'TextInput') { - displayComp = textFormatter(formatter, value); - } - return displayMode === 'DISPLAY_ONLY' ? ( - - displayComp - - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - const isValDefined = typeof value !== 'undefined' && value !== ''; - const val = isValDefined ? ( - - {value} - - ) : ( - '' - ); - return ( - - - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setInputValue(event.target.value); - if (value !== event.target.value) { - handleEvent(actions, 'change', propName, event.target.value); - hasValueChange.current = true; - } - }} - onBlur={(event) => { - if (!value || hasValueChange.current) { - handleEvent(actions, 'blur', propName, event.target.value); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyParagraph.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - displayMode: null, - fieldMetadata: {}, - additionalProps: {}, - variant: 'inline', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyParagraph.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - displayMode: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - fieldMetadata: PropTypes.objectOf(PropTypes.any), - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyParagraph; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/mock.stories.js deleted file mode 100644 index 69fb82bf..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/mock.stories.js +++ /dev/null @@ -1,20 +0,0 @@ -export const configProps = { - value: '', - label: 'Paragraph Sample', - placeholder: 'Paragraph Placeholder', - helperText: 'Paragraph Helper Text', - testId: 'paragraph-12345678', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Text', - displayAs: 'pxTextArea', - label: 'Paragraph sample' -}; - -export const stateProps = { - value: '.ParagraphSample', - hasSuggestions: false -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/demo.stories.jsx deleted file mode 100644 index e13fe786..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/demo.stories.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, stateProps, fieldMetadata } from './mock.stories.js'; - -import PegaDxilMyPercentage from './index.jsx'; - -export default { - title: 'PegaDxilMyPercentage', - decorators: [withKnobs], - component: PegaDxilMyPercentage -}; - -export const basePegaDxilMyPercentage = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - showGroupSeparators: configProps.showGroupSeparators, - hasSuggestions: configProps.hasSuggestions, - testId: configProps.testId, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/index.jsx deleted file mode 100644 index 48431e8b..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/index.jsx +++ /dev/null @@ -1,275 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { - NumberInput, - NumberDisplay, - CurrencyDisplay, - FieldValueList, - Text -} from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import handleEvent from './event-utils'; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyPercentageWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyPercentage = props => { - const { - getPConnect, - value, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - decimalPrecision, - additionalProps, - displayMode, - variant, - formatter, - isTableFormatter, - hasSuggestions - } = props; - let { showGroupSeparators } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const [percentageValue, setPercentageValue] = useState(value?.toString()); - const hasValueChange = useRef(false); - - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - let numberOfDecimals = parseInt(decimalPrecision, 10); - if (Number.isNaN(numberOfDecimals)) { - numberOfDecimals = decimalPrecision === '' ? undefined : 2; - } - - useEffect(() => { - setPercentageValue(value?.toString()); - }, [value]); - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - let unit = 'percent'; - let displayComp = null; - - if (isTableFormatter) { - switch (formatter) { - case 'Integer': { - numberOfDecimals = 0; - showGroupSeparators = true; - unit = ''; - break; - } - case 'Decimal': { - showGroupSeparators = true; - unit = ''; - break; - } - case 'Decimal-Auto': { - numberOfDecimals = Number.isInteger(percentageValue) ? 0 : 2; - showGroupSeparators = true; - unit = ''; - break; - } - default: { - showGroupSeparators = false; - break; - } - } - } - - - displayComp = ( - - ); - if (isTableFormatter && (formatter === 'Currency' || formatter === 'Currency-Code')) { - const { currencyISOCode } = props; - let showIsoCode = true; - if (formatter === 'Currency') { - showIsoCode = false; - } - displayComp = ( - - ); - } - - - return displayMode === 'DISPLAY_ONLY' ? ( - - displayComp - - ) : ( - - - - ); - } - - - if (displayMode === 'STACKED_LARGE_VAL') { - const displayComp = ( - - ); - - - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setPercentageValue(enteredValue); - if (value !== enteredValue) { - handleEvent(actions, 'change', propName, enteredValue); - hasValueChange.current = true; - } - }} - onBlur={() => { - const parsedValue = percentageValue !== '' ? Number(percentageValue) : ''; - if (!value || hasValueChange.current) { - handleEvent(actions, 'blur', propName, parsedValue); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyPercentage.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - decimalPrecision: '', - showGroupSeparators: false, - additionalProps: {}, - displayMode: null, - variant: 'inline', - currencyISOCode: 'USD', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyPercentage.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - decimalPrecision: PropTypes.string, - showGroupSeparators: PropTypes.bool, - additionalProps: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - variant: PropTypes.string, - formatter: PropTypes.string, - currencyISOCode: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyPercentage; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/mock.stories.js deleted file mode 100644 index fc6331a3..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/mock.stories.js +++ /dev/null @@ -1,21 +0,0 @@ -export const configProps = { - value: '', - label: 'Percentage Sample', - showGroupSeparators: true, - placeholder: 'Percentage Placeholder', - helperText: 'Percentage Helper Text', - testId: 'percentage-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.PercentageSample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Decimal', - displayAs: 'pxPercentage', - label: 'Percentage sample' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/demo.stories.jsx deleted file mode 100644 index e0c51940..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/demo.stories.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyPhone from './index.jsx'; -import { stateProps, configProps } from './mock.stories'; - -export default { - title: 'PegaDxilMyPhone', - decorators: [withKnobs], - component: PegaDxilMyPhone -}; - -export const basePegaDxilMyPhone = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - datasource: configProps.datasource, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/index.jsx deleted file mode 100644 index 5ea815cd..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/index.jsx +++ /dev/null @@ -1,266 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { - PhoneInput as CosmosPhone, - getPhoneNumberParts, - PhoneDisplay, - FieldValueList, - Text, - EmailDisplay, URLDisplay -} from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import handleEvent from "./event-utils"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyPhoneWrapper from './styles'; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyPhone = props => { - const { - getPConnect, - value, - showCountryCode, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - datasource, - testId, - displayMode, - additionalProps, - variant, - isTableFormatter, - hasSuggestions - } = props; - const { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const hasValueChange = useRef(false); - - let callingCodesList = []; - if (datasource?.source?.length > 0) { - datasource.source.forEach((element) => { - callingCodesList.push(element.value); - }); - } else { - callingCodesList = ['+1']; // if no datasource is present we default to show only US country code - } - - // BUG-547602: Temporary type coercion for 8.5 until DXAPIs are enhanced to pass original pxViewMetadata JSON, respecting boolean primitives - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [inputValue, setInputValue] = useState(value); - useEffect(() => setInputValue(value), [value]); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - // funtion to exclude country code from phone number - function getPhoneNumberAlone(phoneNumber) { - const phoneNumberParts = getPhoneNumberParts(phoneNumber, callingCodesList); - return phoneNumberParts && phoneNumberParts[1]; - } - - function handleChangeBlur(enteredValue, eventType) { - if (!getPhoneNumberAlone(enteredValue)) { - enteredValue = ''; - } - handleEvent(actions, eventType, propName, enteredValue); - } - - let displayComp = null; - if (displayMode) { - displayComp = ; - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - if (isTableFormatter && formatExists(formatter)) { - displayComp = textFormatter(formatter, value); - } - return displayMode === 'DISPLAY_ONLY' ? ( - - displayComp - - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setInputValue(enteredValue); - if (value !== enteredValue) { - handleEvent(actions, 'change', propName, enteredValue); - } - hasValueChange.current = true; - }} - onBlur={(enteredValue) => { - if (!value || hasValueChange.current) { - handleChangeBlur(enteredValue, 'blur'); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyPhone.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - datasource: undefined, - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - showCountryCode: true, - testId: null, - displayMode: null, - additionalProps: {}, - variant: 'inline', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyPhone.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - datasource: PropTypes.objectOf(PropTypes.any), - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - showCountryCode: PropTypes.bool, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - displayMode: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyPhone; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/mock.stories.js deleted file mode 100644 index 75bfaf42..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/mock.stories.js +++ /dev/null @@ -1,37 +0,0 @@ -export const configProps = { - value: '', - label: 'Phone Sample', - datasource: { - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ], - fields: {} - }, - showCountryCode: true, - placeholder: 'Phone Placeholder', - helperText: 'Phone Helper Text', - testId: 'phone-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.PhoneSample', - datasource: { - source: 'D_pyCountryCallingCodeList.pxResults', - fields: { - value: '.pyCallingCode' - } - }, - hasSuggestions: false -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/demo.stories.jsx deleted file mode 100644 index ed2621a7..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/demo.stories.jsx +++ /dev/null @@ -1,78 +0,0 @@ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, rawMetadata, fieldMetadata, stateProps } from './mock.stories.js'; - -import PegaDxilMyPicklist from './index.jsx'; - -export default { - title: 'PegaDxilMyPicklist', - decorators: [withKnobs], - component: PegaDxilMyPicklist -}; - -export const basePegaDxilMyPicklist = () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [value, setValue] = useState(configProps.value); - - const props = { - value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - datasource: configProps.datasource, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - fieldMetadata, - - getPConnect: () => { - return { - getConfigProps: () => { - return configProps; - }, - getStateProps: () => { - return stateProps; - }, - getLocalizedValue: val => { - return val; - }, - getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => { - return `${localeClass}!${localeContext}!${localeName}`; - }, - getCaseInfo: () => { - return { - getClassName: () => { - return 'DIXL-MediaCo-Work-NewService'; - } - }; - }, - getRawMetadata: () => { - return rawMetadata; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, theValue) => { - setValue(theValue); - }, - triggerFieldChange: () => {/* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/index.jsx deleted file mode 100644 index 1e2d0de0..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/index.jsx +++ /dev/null @@ -1,351 +0,0 @@ -import { useState, useEffect, useRef } from 'react'; -import { Select, Option, FieldValueList, Text } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import handleEvent from "./event-utils"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyPicklistWrapper from './styles'; -import {EmailDisplay, PhoneDisplay, URLDisplay } from "@pega/cosmos-react-core"; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - - -export const setDefaultValue = (dropdownOptions, pConnect, propName) => { - // calculate the default option and set it to dropdown - const option = (dropdownOptions && dropdownOptions[0]) || {}; - const defaultValue = option.key ? option.props.value : ''; - pConnect.setValue(propName, defaultValue, defaultValue); -}; - -const pushPlaceholderOption = (placeholder, listSourceItems, items, pConnect) => { - // If we have a placeholder, push that option in the list of items - if (placeholder) { - items.push( - - ); - } else if (!listSourceItems) { - // If we don't have a placeholder and our list source is empty, push a blank row option in the list of items - items.push( - ); - }); - - const isDisplayModeEnabled = - displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY'; - let firstOptionKey = ''; - let firstOptionValue = ''; - if (!placeholder && listSourceItems?.length > 0) { - // First option isn't going to change as long as placeholder is present. Incase placeholder is not there - // check for new option - firstOptionKey = listSourceItems[0].key; - firstOptionValue = listSourceItems[0].text || listSourceItems[0].value; - } - useEffect(() => { - // placeholder - placeholder option configured to be shown with dropdown, empty string if not configured - // value - value of the dropdown if set to something prior (either by pre-activity or default value etc.), empty string if nothing is set - // selectedLabel - is value(the one above) if it is one of the option in the dropdown datasource, empty string if not - // below code does this - - // set dropdown value to first option if placeholder is NOT present and ((value is empty) or (value is not empty and selectedLabel is empty)) - // set dropdown value to empty if placeholder is present and value is not empty and selectedLabel is empty - // Broken down first option(key, value) to be as dependency instead of entire items array which creates new reference on every render - // First option is kept as dependency as setDefaultValue sets only first value from options - if (!isDisplayModeEnabled && ((!placeholder && !value) || (!isMount && value && !selectedLabel))) { - setDefaultValue(items, pConnect, propName); - } - }, [firstOptionKey, firstOptionValue, placeholder, selectedLabel, value, propName]); - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - let displayComp = selectedLabel; - if (isTableFormatter && formatExists(formatter)) { - displayComp = textFormatter(formatter, selectedLabel); - } - if (selectedLabel === '') { - displayComp = value || ; - } - - return displayMode === 'DISPLAY_ONLY' ? ( - - displayComp - - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - selectedLabel = selectedLabel === '' ? value : selectedLabel; - const isValDefined = typeof selectedLabel !== 'undefined' && selectedLabel !== ''; - const val = isValDefined ? ( - - {selectedLabel} - - ) : ( - '' - ); - return ( - - - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConnect, setStatus); - }; - - return ( - - - - ); -} - -PegaDxilMyPicklist.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - helperText: '', - datasource: [], - listType: '', - additionalProps: {}, - fieldMetadata: {}, - displayMode: null, - onRecordChange: null, - variant: 'inline', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyPicklist.propTypes = { - getPConnect: PropTypes.func.isRequired, - value: PropTypes.string, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - datasource: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.any), - PropTypes.shape({ - source: PropTypes.arrayOf(PropTypes.any) - }) - ]), - listType: PropTypes.string, - validatemessage: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - helperText: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - fieldMetadata: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - onRecordChange: PropTypes.func, - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyPicklist; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/mock.stories.js deleted file mode 100644 index 1bea2054..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/mock.stories.js +++ /dev/null @@ -1,67 +0,0 @@ -export const configProps = { - value: '', - label: 'Picklist Sample', - placeholder: 'Select...', - listType: 'associated', - datasource: [ - { - key: 'Option 1', - value: 'Option 1' - }, - { - key: 'Option 2', - value: 'Option 2' - }, - { - key: 'Option 3', - value: 'Option 3' - } - ], - helperText: 'Picklist Helper Text', - testId: 'picklist-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.PicklistSample', - placeholder: 'Select...', - datasource: '.PicklistSample', - hasSuggestions: false -}; - -export const rawMetadata = { - type: 'Dropdown', - config: { - value: '@P .PicklistSample', - label: '@L Picklist Sample', - placeholder: '@L Select...', - listType: 'associated', - datasource: '@ASSOCIATED .PicklistSample', - helperText: '@L Picklist Helper Text', - testId: 'picklist-12345678' - } -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Text', - displayAs: 'pxDropdown', - label: 'Picklist sample', - datasource: { - tableType: 'PromptList', - records: [ - { - key: 'Option 1', - value: 'Option 1' - }, - { - key: 'Option 2', - value: 'Option 2' - }, - { - key: 'Option 3', - value: 'Option 3' - } - ] - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/demo.stories.jsx deleted file mode 100644 index 1294e24a..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/demo.stories.jsx +++ /dev/null @@ -1,51 +0,0 @@ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import { stateProps, configProps } from './mock.stories'; - -import PegaDxilMyText from './index.jsx'; - -export default { - title: 'PegaDxilMyText', - decorators: [withKnobs], - component: PegaDxilMyText -}; - -export const basePegaDxilMyText = () => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const [value, setValue] = useState(configProps.value); - - const props = { - value, - placeholder: configProps.placeholder, - label: configProps.label, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, theValue) => { - setValue(theValue); - }, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/index.jsx deleted file mode 100644 index d0ac35df..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/index.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import PropTypes from 'prop-types'; -import { Input, Label } from '@pega/cosmos-react-core'; - -import StyledPegaDxilMyTextWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyText = props => { - const { getPConnect, value, placeholder, disabled, readOnly, required, label, testId } = props; - - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn?.getStateProps()?.value; - - const handleOnChange = event => { - const { value: updatedValue } = event.target; - actions.updateFieldValue(propName, updatedValue); - }; - - return ( - - - - - ); -}; - -PegaDxilMyText.defaultProps = { - value: '', - placeholder: '', - disabled: false, - readOnly: false, - required: false, - testId: null -}; - -PegaDxilMyText.propTypes = { - label: PropTypes.string, - value: PropTypes.string, - placeholder: PropTypes.string, - getPConnect: PropTypes.func.isRequired, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string -}; - -export default PegaDxilMyText; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/mock.stories.js deleted file mode 100644 index fd283d8b..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/mock.stories.js +++ /dev/null @@ -1,13 +0,0 @@ -export const configProps = { - value: '', - label: 'Text Sample', - placeholder: 'Text Placeholder', - helperText: 'Text Helper Text', - testId: 'Text-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.TextSample', - hasSuggestions: false -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyText/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/StatusWork.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/StatusWork.jsx deleted file mode 100644 index 4c6c2b48..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/StatusWork.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Status } from "@pega/cosmos-react-core"; - -export default function StatusWorkRenderer({ value }) { - let variant = "info"; - - const warnStrings = ["fail", "cancel", "reject", "revoke", "stopped", "warn"]; - const infoStrings = ["open", "hold", "info", "new"]; - const successStrings = ["resolved", "completed", "success"]; - const pendingStrings = ["pending"]; - - if (new RegExp(warnStrings.join("|"), "i").test(value)) { - variant = "warn"; - } else if (new RegExp(infoStrings.join("|"), "i").test(value)) { - variant = "info"; - } else if (new RegExp(successStrings.join("|"), "i").test(value)) { - variant = "success"; - } else if (new RegExp(pendingStrings.join("|"), "i").test(value)) { - variant = "pending"; - } - - return ( - - {value} - - ); -} diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/demo.stories.jsx deleted file mode 100644 index cf098746..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/demo.stories.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyTextInput from './index.jsx'; - -import { stateProps, fieldMetadata, configProps } from './mock.stories'; - -export default { - title: 'PegaDxilMyTextInput', - decorators: [withKnobs], - component: PegaDxilMyTextInput -}; - -export const basePegaDxilMyTextInput = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - fieldMetadata, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/index.jsx deleted file mode 100644 index 3bfc666c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/index.jsx +++ /dev/null @@ -1,239 +0,0 @@ -import { useEffect, useState, useRef } from 'react'; -import { Input, FieldValueList, Text, EmailDisplay, PhoneDisplay, URLDisplay } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// include in bundle -import handleEvent from "./event-utils"; -import StatusWorkRenderer from "./StatusWork.jsx"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyTextInputWrapper from './styles'; - - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyTextInput = props => { - const { - getPConnect, - placeholder, - validatemessage, - label, - hideLabel, - helperText, - testId, - fieldMetadata, - additionalProps, - displayMode, - displayAsStatus, - variant, - hasSuggestions, - isTableFormatter - } = props; - const { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const maxLength = fieldMetadata?.maxLength; - const hasValueChange = useRef(false); - - let { value, readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [inputValue, setInputValue] = useState(value); - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - useEffect(() => setInputValue(value), [value]); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - // Override the value to render as status work when prop passed to display as status - if (displayAsStatus) { - value = StatusWorkRenderer({ value }); - - // Fall into this scenario for case summary, default to stacked status - if (!displayMode) { - return ; - } - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - let displayComp = value || ; - if (isTableFormatter && formatExists(formatter)) { - displayComp = textFormatter(formatter, value); - } - return displayMode === 'DISPLAY_ONLY' ? ( - displayComp - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - const isValDefined = typeof value !== 'undefined' && value !== ''; - const val = isValDefined ? ( - - {value} - - ) : ( - '' - ); - return ( - - - - ); - } - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setInputValue(event.target.value); - if (value !== event.target.value) { - handleEvent(actions, 'change', propName, event.target.value); - hasValueChange.current = true; - } - }} - onBlur={(event) => { - if ((!value || hasValueChange.current) && !readOnly) { - handleEvent(actions, 'blur', propName, event.target.value); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyTextInput.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - displayAsStatus: false, - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - fieldMetadata: {}, - additionalProps: {}, - displayMode: null, - variant: 'inline', - formatter: '', - isTableFormatter: false, - hasSuggestions: false -}; - -PegaDxilMyTextInput.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - displayMode: PropTypes.string, - displayAsStatus: PropTypes.bool, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - fieldMetadata: PropTypes.objectOf(PropTypes.any), - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyTextInput; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/mock.stories.js deleted file mode 100644 index b2753b25..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/mock.stories.js +++ /dev/null @@ -1,21 +0,0 @@ -export const configProps = { - value: '', - label: 'TextInput Sample', - placeholder: 'TextInput Placeholder', - helperText: 'TextInput Helper Text', - testId: 'TextInput-12345678', - hasSuggestions: false -}; - -export const stateProps = { - value: '.TextInputSample', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Text', - maxLength: 256, - displayAs: 'pxTextInput', - label: 'TextInput Sample' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/demo.stories.jsx deleted file mode 100644 index 6d689d76..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/demo.stories.jsx +++ /dev/null @@ -1,57 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; -import { configProps, stateProps } from './mock.stories'; -import PegaDxilMyTimeOfDay from './index.jsx'; - -export default { - title: 'PegaDxilMyTimeOfDay', - decorators: [withKnobs], - component: PegaDxilMyTimeOfDay -}; - -export const basePegaDxilMyTimeOfDay = () => { - const props = { - getPConnect: () => { - return { - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => {/* nothing */} - }; - }, - getStateProps: () => { - return stateProps; - }, - getConfigProps: () => { - return configProps; - }, - ignoreSuggestion: () => {/* nothing */}, - clearErrorMessages: () => {/* nothing */} - }; - }, - value: configProps.value, - validatemessage: configProps.validatemessage, - label: configProps.label, - hideLabel: configProps.hideLabel, - helperText: configProps.helperText, - withSeconds: configProps.withSeconds, - testId: configProps.testId, - additionalProps: configProps.additionalProps, - displayMode: configProps.displayMode, - variant: configProps.variant, - hasSuggestions: configProps.hasSuggestions, - disabled: configProps.disabled, - readOnly: configProps.readOnly, - required: configProps.required - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/index.jsx deleted file mode 100644 index 3330d5d5..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/index.jsx +++ /dev/null @@ -1,213 +0,0 @@ -import { useEffect, useState } from 'react'; -import { TimeInput, FieldValueList, DateTimeDisplay, Text } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import { - parseClockFormat, - timeCorrectedToSeconds, - datetimeFireChangeBlurEvents -} from "./time-of-day"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyTimeOfDayWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyTimeOfDay = props => { - const { - getPConnect, - value, - validatemessage, - label, - hideLabel, - helperText, - withSeconds, - pickerInterval, - testId, - additionalProps, - displayMode, - variant, - hasSuggestions - } = props; - let { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - - - // BUG-547602: Temporary type coercion for 8.5 until DXAPIs are enhanced to pass original pxViewMetadata JSON, respecting boolean primitives - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - let { clockFormat } = props; - clockFormat = parseClockFormat(clockFormat); - - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - function handleBlur(onBlurValue) { - const { valueAsISOString: time, state: errorState } = onBlurValue; - const trimmedTime = time ? timeCorrectedToSeconds(time, withSeconds) : time; - datetimeFireChangeBlurEvents(errorState, value, trimmedTime, actions, propName, pConn); - const isValueChanged = !(value === undefined && trimmedTime === '') && value !== trimmedTime; - if (hasSuggestions && isValueChanged) { - pConn.ignoreSuggestion(); - } - } - - function handleChange(onChangeValue) { - const { valueAsISOString: time } = onChangeValue; - const trimmedTime = time ? timeCorrectedToSeconds(time, withSeconds) : time; - if (hasSuggestions && value !== trimmedTime) { - setStatus(undefined); - } - pConn.clearErrorMessages({ - property: propName - }); - } - - if (displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY') { - let variantValue = 'time'; - let formatValue = withSeconds ? 'long' : 'short'; - if (pConn && pConn.getConfigProps()) { - const runtimeformatter = pConn.getConfigProps()?.formatter; - if (formatter !== runtimeformatter) { - formatter = runtimeformatter; - } - } - if (formatter === 'Time-Only') { - variantValue = 'time'; - formatValue = 'long'; - } - const displayComp = ( - - ); - switch (displayMode) { - case 'DISPLAY_ONLY': { - return ( displayComp ); - } - case 'LABELS_LEFT': { - return ( - - - - ); - } - case 'STACKED_LARGE_VAL': { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - // no default - } - } - - return ( - - - - ); -} - -PegaDxilMyTimeOfDay.defaultProps = { - value: undefined, - withSeconds: false, - validatemessage: "", - helperText: "", - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - pickerInterval: "30", - clockFormat: 0, - testId: null, - additionalProps: {}, - displayMode: null, - variant: "inline", - formatter:"defaultTime" -}; - -PegaDxilMyTimeOfDay.propTypes = { - value: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - withSeconds: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - pickerInterval: PropTypes.string, - clockFormat: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - testId: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - displayMode: PropTypes.string, - variant: PropTypes.string, - formatter : PropTypes.string -}; - -export default PegaDxilMyTimeOfDay; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/mock.stories.js deleted file mode 100644 index 8a432748..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/mock.stories.js +++ /dev/null @@ -1,20 +0,0 @@ -export const configProps = { - value: '13:30', - validatemessage: '', - label: 'TimeOfDay Label', - hideLabel: false, - helperText: 'TimeOfDay helper text', - withSeconds: false, - testId: '12345678', - additionalProps: {}, - displayMode: '', - variant: '', - hasSuggestions: false, - readOnly: false, - required: false, - disabled: false -}; - -export const stateProps = { - value: '.TimeOfDayLabel' -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/time-of-day.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/time-of-day.js deleted file mode 100644 index fad402d1..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/time-of-day.js +++ /dev/null @@ -1,288 +0,0 @@ -/* eslint-disable no-undef */ -import dayjs from "dayjs"; -import relativeTime from 'dayjs/plugin/relativeTime.js'; -import localizedFormat from 'dayjs/plugin/localizedFormat.js'; -import utc from 'dayjs/plugin/utc.js'; -import timezone from 'dayjs/plugin/timezone.js'; - -dayjs.extend(relativeTime); -dayjs.extend(localizedFormat); -dayjs.extend(utc); -dayjs.extend(timezone); - -/** - * Return relative time in fromNow for the given datetime - * @description Convert and return the given datetime in dayJSObject - * - * @param {string} text datetime - * @returns {object} datetime as a dayjs object - */ -export const getDayJSObject = (text) => { - const momObj = dayjs(text); - if (momObj.isValid()) return momObj; - const timeStamp = text; - const isDateTime = timeStamp.indexOf("GMT") !== -1; - const year = parseInt(timeStamp.substr(0, 4), 10); - const month = parseInt(timeStamp.substr(4, 2), 10) - 1; - const day = parseInt(timeStamp.substr(6, 2), 10); - - const CurrentTz = PCore.getLocaleUtils().getTimeZoneInUse(); - - let mom = new Date(); - - mom.setUTCDate(day); - mom.setUTCMonth(month); - mom.setUTCFullYear(year); - - /* istanbul ignore else */ - if (isDateTime) { - const hours = parseInt(timeStamp.substr(9, 2), 10); - const minutes = parseInt(timeStamp.substr(11, 2), 10); - const seconds = parseInt(timeStamp.substr(13, 2), 10); - const ms = parseInt(timeStamp.substr(16, 3), 10); - mom.setUTCHours(hours); - mom.setUTCMinutes(minutes); - mom.setUTCSeconds(seconds); - mom.setUTCMilliseconds(ms); - } - - mom = dayjs( - mom.toLocaleString("en-US", { - timeZone: CurrentTz - }) - ); - - return mom; -}; - -/** - * Return relative time in fromNow for the given datetime - * - * @param {string} time datetime - * @returns {object} relative time from now - */ -export const getRelativeTime = (time) => { - let relativetime = ""; - if (dayjs(time).isUTC()) { - relativetime = dayjs(time).fromNow(); - } else { - const dayjstime = getDayJSObject(time); - relativetime = dayjs(dayjstime).fromNow(); - } - return relativetime; -}; - -/** - * Return year for the date passed - * - * @param {string} value from which Year needs to be taken out - * @returns {number} year for the date passed - */ -export const getFullYear = (value) => - value ? new Date(value).getFullYear() : new Date().getFullYear(); - -/** - * Return maxDate for the date passed - * - * @param {number} nextYears next number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} maxDate calculated based on inputs - */ -export const getMaxDate = (nextYears, currentYear, yearFromValue) => { - if (Number.isNaN(nextYears)) { - nextYears = 20; - } - let maxYear = currentYear + nextYears; - if (yearFromValue > maxYear) { - maxYear = yearFromValue; - } - return `${maxYear}-01-01`; -}; - -/** - * Return minDate for the date passed - * - * @param {number} previousYears previous number of years - * @param {number} currentYear current year - * @param {number} yearFromValue year set on value in redux - * - * @returns {string} minDate calculated based on inputs - */ -export const getMinDate = (previousYears, currentYear, yearFromValue) => { - if (Number.isNaN(previousYears)) { - previousYears = 100; - } - let minYear = currentYear - previousYears; - if (yearFromValue < minYear) { - minYear = yearFromValue; - } - return `${minYear}-12-31`; -}; - -/** - * Return clockFormat after parsing - * - * @param {number | string} clockFormat chosen by user - * - * @returns {number} clockFormat - */ -export const parseClockFormat = (clockFormat) => - typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat; - -/** - * Return datetime value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} datetime after stripping of ms and seconds if selected to - */ -export const correctDateTimeToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`; - } - return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`; -}; - -/** - * Return time value string off to seconds - * - * @param {string} datetime in ISO format - * @param {boolean} withSeconds to specify if seconds is needed or not - * - * @returns {string} just time after stripping of ms and seconds if selected to - */ -export const timeCorrectedToSeconds = (datetime, withSeconds) => { - if (withSeconds) { - return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf(".")); - } - return `${datetime.substring( - datetime.indexOf("T") + 1, - datetime.lastIndexOf(":") - )}:00`; -}; - -/** - * This function handles the cosmos blur handler of DateTime components - * - * @param {string | undefined} errorState for the selected datetime value - * @param {string} actualValue present in redux - * @param {string} formattedValue retrieved by trimming ISO to just Date/Time, also applying timezone if DateTime - * @param {object} actions object which has fire and blur callbacks - * @param {string} propName name of the property bound - * @param {object} pConn component's PConnect object which is useful to invoke validationApi - * - * @returns {void} - */ -export const datetimeFireChangeBlurEvents = ( - errorState, - actualValue, - formattedValue, - actions, - propName, - pConn -) => { - - // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation - // above triggerFieldChange should have validated this - if (errorState) { - pConn.getValidationApi().validate(errorState); - } - // BUG-640834 In errorState presist old values avoiding store update & re-render. - else{ - if (formattedValue !== actualValue) { - actions.updateFieldValue(propName, formattedValue); - } - actions.triggerFieldChange(propName, formattedValue); - } -}; - -/** - * Return Date format for the locale passed - * - * @param {string} locale locale string - * @param {object} options options for format string - * @returns {string} dateformat for the locale - * Example : getDateFormat("pl-PL") returns "DD.MM.YYYY" - */ -export const getDateFormat = (locale, options) => { - return new Intl.DateTimeFormat(locale, options) - .formatToParts() - .map(({ type, value }) => { - switch (type) { - case "day": - return "DD"; - case "month": - return "MM"; - case "year": - return "YYYY"; - case "hour": - return "hh"; - case "minute": - return "mm"; - case "second": - return "ss"; - case "dayPeriod": - return "A"; - case "literal": - return value; - default: - return ""; - } - }) - .join(""); -}; - -/** - * Return boolean for the locale passed to specify if locale uses 12 hour format - * - * @param {string} locale locale string - * @returns {boolean} True or False for the locale - * Example : getDateFormat("pl-PL") returns false - */ -export const is12HClockFormat = (locale) => { - const meridiem = new Intl.DateTimeFormat(locale, { - hour: "numeric" - }) - .formatToParts() - .find(({ type }) => type === "dayPeriod"); - return !!(meridiem === null || meridiem === undefined - ? undefined - : meridiem.value); -}; - -/** - * Return Option object for Time formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object time formatting - * Example : getTimeOptions(false, true) returns {hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getTimeOptions = (withSeconds, is12h = false) => { - return { - hour: "numeric", - minute: "numeric", - ...(withSeconds && { second: "numeric" }), - hour12: is12h - }; -}; - -/** - * Return Option object for Datetime formatting - * - * @param {boolean} withSeconds true or false depending on seconds to be included - * @param {boolean} is12h 12 hour format - * @returns {object} options object datetime formatting - * Example : getDateTimeOptions(false, true) returns {year: 'numeric',month: 'numeric',day: 'numeric',hour: 'numeric',minute: 'numeric',hour12: true} - */ -export const getDateTimeOptions = (withSeconds, is12h = false) => { - return { - year: "numeric", - month: "numeric", - day: "numeric", - ...getTimeOptions(withSeconds, is12h) - }; -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/demo.stories.jsx deleted file mode 100644 index c85be627..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/demo.stories.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyUrl from './index.jsx'; -import { stateProps, configProps } from './mock.stories'; - -export default { - title: 'PegaDxilMyUrl', - decorators: [withKnobs], - component: PegaDxilMyUrl -}; - -export const basePegaDxilMyUrl = () => { - - const props = { - value: configProps.value, - placeholder: configProps.placeholder, - label: configProps.label, - helperText: configProps.helperText, - testId: configProps.testId, - hasSuggestions: configProps.hasSuggestions, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/event-utils.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/event-utils.js deleted file mode 100644 index 8b806f56..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/event-utils.js +++ /dev/null @@ -1,18 +0,0 @@ -const handleEvent = (actions, eventType, propName, value) => { - switch (eventType) { - case "change": - actions.updateFieldValue(propName, value); - break; - case "blur": - actions.triggerFieldChange(propName, value); - break; - case "changeNblur": - actions.updateFieldValue(propName, value); - actions.triggerFieldChange(propName, value); - break; - default: - break; - } -}; - -export default handleEvent; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/index.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/index.jsx deleted file mode 100644 index 70f8f17c..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/index.jsx +++ /dev/null @@ -1,232 +0,0 @@ -import { useState, useEffect, useRef} from "react"; -import { Input, FieldValueList, Text } from "@pega/cosmos-react-core"; -import PropTypes from "prop-types"; - -// includes in bundle -import {formatExists,textFormatter, urlFormatter} from "./text-url.jsx"; -import handleEvent from "./event-utils"; -import { suggestionsHandler } from './suggestions-handler'; - -import StyledPegaDxilMyUrlWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -const PegaDxilMyUrl = props => { - const { - getPConnect, - value, - hideLabel, - placeholder, - validatemessage, - label, - helperText, - testId, - displayMode, - additionalProps, - variant, - isTableFormatter, - displayAs, - widthSel, - customWidth, - altText, - altTextOfImage, - propaltTextOfImage, - urlLabel, - propUrlLabel, - urlLabelSelection, - tableDisplayAs, - hasSuggestions - } = props; - const { formatter } = props; - const pConn = getPConnect(); - const actions = pConn.getActionsApi(); - const propName = pConn.getStateProps().value; - const hasValueChange = useRef(false); - - - // BUG-547602: Temporary type coercion for 8.5 until DXAPIs are enhanced to pass original pxViewMetadata JSON, respecting boolean primitives - let { readOnly, required, disabled } = props; - [readOnly, required, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const [inputValue, setInputValue] = useState(value); - const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined); - useEffect(() => setInputValue(value), [value]); - - useEffect(() => { - if (validatemessage !== '') { - setStatus('error'); - } - if (hasSuggestions) { - setStatus('pending'); - } else if (!hasSuggestions && status !== 'success') { - setStatus(validatemessage !== '' ? 'error' : undefined); - } - }, [validatemessage, hasSuggestions]); - - let displayComp = null; - if (displayMode) { - displayComp = urlFormatter(value, { - displayAs, - tableDisplayAs, - isTableFormatter, - altText, - altTextOfImage, - propaltTextOfImage, - urlLabelSelection, - urlLabel, - propUrlLabel, - widthSel, - customWidth - }); - } - - - - if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') { - if (isTableFormatter && formatter !== 'URL' && formatExists(formatter)) { - displayComp = textFormatter(formatter, value); - } - return displayMode === 'DISPLAY_ONLY' ? ( - displayComp - ) : ( - - - - ); - } - - if (displayMode === 'STACKED_LARGE_VAL') { - return ( - - - {displayComp} - - ) - } - ]} - /> - - ); - } - - const onResolveSuggestionHandler = (accepted) => { - suggestionsHandler(accepted, pConn, setStatus); - }; - - return ( - - { - if (hasSuggestions) { - setStatus(undefined); - } - setInputValue(event.target.value); - if (value !== event.target.value) { - handleEvent(actions, 'change', propName, event.target.value); - hasValueChange.current = true; - } - }} - onBlur={(event) => { - if (!value || hasValueChange.current) { - handleEvent(actions, 'blur', propName, event.target.value); - if (hasSuggestions) { - pConn.ignoreSuggestion(); - } - hasValueChange.current = false; - } - }} - onFocus={actions.onFocus} - onResolveSuggestion={onResolveSuggestionHandler} - /> - - ); -} - -PegaDxilMyUrl.defaultProps = { - value: '', - placeholder: '', - validatemessage: '', - helperText: '', - hideLabel: false, - disabled: false, - readOnly: false, - required: false, - testId: null, - displayMode: null, - additionalProps: {}, - variant: 'inline', - formatter: '', - isTableFormatter: false, - displayAs: 'defaultURL', - widthSel: 'defaultWidth', - customWidth: null, - altText: 'constant', - altTextOfImage: '', - propaltTextOfImage: '', - urlLabel: '', - propUrlLabel: '', - urlLabelSelection: 'constant', - tableDisplayAs: 'link', - hasSuggestions: false -}; - -PegaDxilMyUrl.propTypes = { - value: PropTypes.string, - placeholder: PropTypes.string, - label: PropTypes.string.isRequired, - hideLabel: PropTypes.bool, - getPConnect: PropTypes.func.isRequired, - validatemessage: PropTypes.string, - helperText: PropTypes.string, - disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), - testId: PropTypes.string, - displayMode: PropTypes.string, - additionalProps: PropTypes.objectOf(PropTypes.any), - variant: PropTypes.string, - formatter: PropTypes.string, - isTableFormatter: PropTypes.bool, - displayAs: PropTypes.string, - widthSel: PropTypes.string, - customWidth: PropTypes.number, - altText: PropTypes.string, - altTextOfImage: PropTypes.string, - propaltTextOfImage: PropTypes.string, - urlLabel: PropTypes.string, - propUrlLabel: PropTypes.string, - urlLabelSelection: PropTypes.string, - tableDisplayAs: PropTypes.string, - hasSuggestions: PropTypes.bool -}; - -export default PegaDxilMyUrl; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/mock.stories.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/mock.stories.js deleted file mode 100644 index 05e390a7..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/mock.stories.js +++ /dev/null @@ -1,22 +0,0 @@ -export const configProps = { - value: '', - label: 'URL Sample', - placeholder: 'URL Placeholder', - helperText: 'URL Helper Text', - testId: 'url-12345678', - hasSuggestions: false -}; - -export const fieldMetadata = { - classID: 'DIXL-MediaCo-Work-NewService', - type: 'Text', - maxLength: 256, - displayAs: 'pxURL', - label: 'URL sample', - validateAs: 'pxIsValidURL' -}; - -export const stateProps = { - value: '.URLSample', - hasSuggestions: false -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/styles.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/suggestions-handler.js b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/suggestions-handler.js deleted file mode 100644 index 901cd99e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/suggestions-handler.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable import/prefer-default-export */ -export const suggestionsHandler = (accepted, pConn, setStatus) => { - if (accepted) { - pConn.acceptSuggestion(); - setStatus('success'); - } else { - pConn.ignoreSuggestion(); - setStatus(undefined); - } -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/text-url.jsx b/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/text-url.jsx deleted file mode 100644 index 81b8a6e8..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/text-url.jsx +++ /dev/null @@ -1,173 +0,0 @@ -import { useState, useRef, React} from "react"; -import { EmailDisplay, PhoneDisplay, URLDisplay, Image, Button, Lightbox } from '@pega/cosmos-react-core'; - -export const formatExists = (formatterVal) => { - const formatterValues = [ - "TextInput", - "WorkStatus", - "RichText", - "Email", - "Phone", - "URL", - "Operator" - ]; - let isformatter = false; - if (formatterValues.includes(formatterVal)) { - isformatter = true; - } - return isformatter; - }; - -const urlLabelVal = (urlLabelSelection, btnVal, urlLabel, propUrlLabel) => { - if ((urlLabel !== '' || propUrlLabel !== '') && btnVal !== null) { - switch (urlLabelSelection) { - case 'constant': { - btnVal = urlLabel; - break; - } - case 'propertyRef': { - btnVal = propUrlLabel; - break; - } - // no default - } - } - return btnVal; -}; - -const isImage = (url) => /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url); - -const TableImage = (imageProps) => { - const { value, altText, altTextOfImage, propaltTextOfImage, urlLabelSelection, urlLabel, propUrlLabel } = imageProps; - const demoButtonRef = useRef(null); - let imageDisplayComp = null; - const [images, setImages] = useState(null); - const imgDescription = { - id: 'url', - name: urlLabelSelection === 'constant' ? urlLabel : propUrlLabel, - description: altText === 'constant' ? altTextOfImage : propaltTextOfImage, - src: value - }; - const onClick = () => { - setImages([imgDescription]); - }; - const onItemDownload = async (id) => { - const a = document.createElement('a'); - a.href = await fetch(images[0].src) - .then((response) => { - return response.blob(); - }) - .then((blob) => { - return URL.createObjectURL(blob); - }); - a.download = images?.find((image) => image.id === id)?.name ?? id; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - }; - let btnVal = value; - btnVal = urlLabelVal(urlLabelSelection, btnVal, urlLabel, propUrlLabel); - imageDisplayComp = ( - - {btnVal !== null && ( - - )} - {images && ( - { - setImages(null); - demoButtonRef.current?.focus(); - }} - onItemDownload={isImage(images[0].src) ? onItemDownload : undefined} - /> - )} - - ); - return imageDisplayComp; -}; - -export const textFormatter = (formatter,value) => { - let displayComponent = null; - switch(formatter){ - case "TextInput" : { - displayComponent = value; - break; - } - case "Email" : { - displayComponent = (); - break; - } - case "Phone" : { - displayComponent = (); - break; - } - case "URL" : { - displayComponent = (); - break; - } - // no default - } - return displayComponent; -}; - -/** - * Returns a URL display component based on the options - * @function urlFormatter - * @param {string} value value - * @param {object} options options for formatting - * { displayAs,tableDisplayAs,isTableFormatter,altText,altTextOfImage,propaltTextOfImage,urlLabelSelection, urlLabel,propUrlLabel, widthSel, customWidth} - */ -export const urlFormatter = (value, options) => { - const { - displayAs, - tableDisplayAs, - isTableFormatter, - altText, - altTextOfImage, - propaltTextOfImage, - urlLabelSelection, - urlLabel, - propUrlLabel, - widthSel, - customWidth - } = options; - - let urlFormatComp = null; - if ( - (displayAs === 'labelText' || (isTableFormatter && tableDisplayAs === 'link')) && - (urlLabel !== '' || propUrlLabel !== '') - ) { - urlFormatComp = ( - - ); - } else if ((displayAs === 'Image' || tableDisplayAs === 'Image') && !!value) { - if (isTableFormatter) { - urlFormatComp = TableImage({ - value, - altText, - altTextOfImage, - propaltTextOfImage, - urlLabelSelection, - urlLabel, - propUrlLabel - }); - } else { - const width = widthSel === 'widthpx' ? customWidth : null; - urlFormatComp = ( - {altText - ); - } - } else { - urlFormatComp = ; - } - return urlFormatComp; -}; diff --git a/tests/assets/components/createAll/custom-constellation/field/_field.md b/tests/assets/components/createAll/custom-constellation/field/_field.md deleted file mode 100644 index da26dc3e..00000000 --- a/tests/assets/components/createAll/custom-constellation/field/_field.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/field** directory - -The **src/components/custom-constellation/field** directory contains the code for the Constellation-based associated component for any custom **field** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/field** directory, there will be a matching component in the **src/components/custom-sdk/field** directory. diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/OneColumnDetails.svg b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/OneColumnDetails.svg deleted file mode 100644 index f5659c9f..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/OneColumnDetails.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - 1 col - - - - - - - - - - - - - A - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/StatusWork.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/StatusWork.jsx deleted file mode 100644 index 4c6c2b48..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/StatusWork.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Status } from "@pega/cosmos-react-core"; - -export default function StatusWorkRenderer({ value }) { - let variant = "info"; - - const warnStrings = ["fail", "cancel", "reject", "revoke", "stopped", "warn"]; - const infoStrings = ["open", "hold", "info", "new"]; - const successStrings = ["resolved", "completed", "success"]; - const pendingStrings = ["pending"]; - - if (new RegExp(warnStrings.join("|"), "i").test(value)) { - variant = "warn"; - } else if (new RegExp(infoStrings.join("|"), "i").test(value)) { - variant = "info"; - } else if (new RegExp(successStrings.join("|"), "i").test(value)) { - variant = "success"; - } else if (new RegExp(pendingStrings.join("|"), "i").test(value)) { - variant = "pending"; - } - - return ( - - {value} - - ); -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/demo.stories.jsx deleted file mode 100644 index aa582cff..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/demo.stories.jsx +++ /dev/null @@ -1,132 +0,0 @@ -import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core'; -import PegaDxilMyDetails from './index'; -import { pyReviewRaw, pyReviewResolved, regionChildrenResolved } from './mock.stories'; -import StatusWorkRenderer from './StatusWork.jsx'; - -export default { - title: 'PegaDxilMyDetails', - component: PegaDxilMyDetails -}; - -const renderField = resolvedProps => { - const { - displayAsStatus = false, - displayMode, - value = '', - label = '', - key, - // eslint-disable-next-line react-hooks/rules-of-hooks - theme = useTheme() - } = resolvedProps; - - const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked'; - - let val = - value !== '' ? ( - - {value} - - ) : ( - '' - ); - - if (label === 'Create date/time') - val = ( - - ); - - if (displayAsStatus === true) val = ; - - if (label === 'Create Operator') - val = ( - - ); - - if (variant === 'inline') { - val = value || ( - - ); - } else { - val = ( - - {val} - - ); - } - return ; -}; - -export const basePegaDxilMyDetails = () => { - const props = { - template: 'MyCo_MyComponents_NewDetailsTemplate', - showHighlightedData: true, - label: 'Test Details', - showLabel: true, - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children; - }, - getRawMetadata: () => { - return pyReviewRaw; - }, - getInheritedProps: () => { - return pyReviewRaw.config.inheritedProps; - }, - createComponent: config => { - // eslint-disable-next-line default-case - switch (config.config.value) { - case '@P .pyStatusWork': - return renderField(pyReviewResolved.highlightedData[0].config); - case '@P .pyID': - return renderField(pyReviewResolved.highlightedData[1].config); - case '@P .pxCreateDateTime': - return renderField(pyReviewResolved.highlightedData[2].config); - case '@USER .pxCreateOperator': - return renderField(pyReviewResolved.highlightedData[3].config); - case '@P .pySLADeadline': - return renderField(regionChildrenResolved[0]); - case '@P .pySLAGoal': - return renderField(regionChildrenResolved[1]); - case '@P .pySLAStartTime': - return renderField(regionChildrenResolved[2]); - } - }, - setInheritedProp: () => { - /* nothing */ - }, - resolveConfigProps: () => { - /* nothing */ - } - }; - } - }; - - const regionAChildren = pyReviewRaw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - <> - {regionAChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/index.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/index.jsx deleted file mode 100644 index a9dec67e..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/index.jsx +++ /dev/null @@ -1,83 +0,0 @@ -import { Fragment } from 'react'; -import { Grid, Flex, FieldGroup } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -import StyledPegaDxilMyDetailsWrapper from './styles'; - -// includes in bundle -import { getAllFields } from './utils'; - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyDetails(props) { - - const { getPConnect, children, label, showLabel, showHighlightedData } = props; - const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() }; - - const numRegions = getAllFields(getPConnect)?.length; - const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)"); - const gridContainer = { "colGap": 1}; - gridContainer.cols = gridRepeat; - gridContainer.alignItems = 'start'; - - const gridHighlightContainer = { "gap": 2}; - gridHighlightContainer.cols = gridRepeat; - gridHighlightContainer.alignItems = 'start'; - gridHighlightContainer.pad = [0, 0, 2, 0]; - - // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent - let highlightedDataArr = []; - if (showHighlightedData) { - const { highlightedData = [] } = getPConnect().getRawMetadata().config; - highlightedDataArr = highlightedData.map((field) => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - // Mark as status display when using pyStatusWork - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return getPConnect().createComponent(field); - }); - } - - return ( - - - {showHighlightedData && highlightedDataArr.length > 0 && ( - - {highlightedDataArr.map((child, i) => ( - {child} - ))} - - )} - - {children.map((child, i) => ( - - {child} - - ))} - - - - ); - -} - -PegaDxilMyDetails.defaultProps = { - label: undefined, - showLabel: true, - showHighlightedData: false -}; - - -PegaDxilMyDetails.propTypes = { - showLabel: PropTypes.bool, - label: PropTypes.string, - getPConnect: PropTypes.func.isRequired, - showHighlightedData: PropTypes.bool -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/mock.stories.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/mock.stories.js deleted file mode 100644 index 17ed81cb..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/mock.stories.js +++ /dev/null @@ -1,189 +0,0 @@ -export const pyReviewRaw = { - name: 'pyReview', - type: 'View', - config: { - template: 'Details', - ruleClass: 'MyCo-MyCompon-Work-MyComponents', - showLabel: true, - label: '@L Details', - localeReference: '@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW', - showHighlightedData: true, - highlightedData: [ - { - type: 'TextInput', - config: { - value: '@P .pyStatusWork', - label: '@L Work Status', - displayMode: 'STACKED_LARGE_VAL', - displayAsStatus: true, - key: 'pyStatusWork' - } - }, - { - type: 'TextInput', - config: { - value: '@P .pyID', - label: '@L Case ID', - displayMode: 'STACKED_LARGE_VAL', - key: 'pyID' - } - }, - { - type: 'DateTime', - config: { - value: '@P .pxCreateDateTime', - label: '@L Create date/time', - displayMode: 'STACKED_LARGE_VAL', - key: 'pxCreateDateTime' - } - }, - { - type: 'UserReference', - config: { - label: '@L Create Operator', - value: '@USER .pxCreateOperator', - placeholder: 'Select...', - displayMode: 'STACKED_LARGE_VAL', - key: 'pxCreateOperator' - } - } - ], - inheritedProps: [ - { - prop: 'label', - value: '@L Details' - }, - { - prop: 'showLabel', - value: true - } - ] - }, - children: [ - { - name: 'A', - type: 'Region', - getPConnect: () => { - return { - getRawMetadata: () => { - return pyReviewRaw.children[0]; - } - }; - }, - children: [ - { - type: 'DateTime', - config: { - value: '@P .pySLADeadline', - label: '@L SLA Deadline' - }, - key: '1' - }, - { - type: 'DateTime', - config: { - value: '@P .pySLAGoal', - label: '@L SLA Goal' - }, - key: '2' - }, - { - type: 'RadioButtons', - config: { - value: '@P .pySLAStartTime', - label: '@L SLA Start Time', - listType: 'associated', - datasource: '@ASSOCIATED .pySLAStartTime' - }, - key: '3' - } - ] - } - ], - classID: 'MyCo-MyCompon-Work-MyComponents' -}; - -export const pyReviewResolved = { - readOnly: true, - template: 'Details', - ruleClass: 'MyCo-MyCompon-Work-MyComponents', - showLabel: true, - label: 'Details', - localeReference: 'MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW', - showHighlightedData: true, - highlightedData: [ - { - type: 'TextInput', - config: { - value: 'New', - label: 'Work Status', - displayMode: 'STACKED_LARGE_VAL', - displayAsStatus: true - } - }, - { - type: 'TextInput', - config: { - value: 'M-1002', - label: 'Case ID', - displayMode: 'STACKED_LARGE_VAL' - } - }, - { - type: 'DateTime', - config: { - value: '2022-12-11T20:06:27.232Z', - label: 'Create date/time', - displayMode: 'STACKED_LARGE_VAL' - } - }, - { - type: 'UserReference', - config: { - label: 'Create Operator', - value: { - userId: 'conns', - userName: 'Sara Connor' - }, - placeholder: 'Select...', - displayMode: 'STACKED_LARGE_VAL' - } - } - ], - displayMode: 'LABELS_LEFT' -}; - -export const regionChildrenResolved = [ - { - readOnly: true, - value: '', - label: 'SLA Deadline', - displayMode: 'LABELS_LEFT', - key: 'SLA Deadline' - }, - { - readOnly: true, - value: '', - label: 'SLA Goal', - displayMode: 'LABELS_LEFT', - key: 'SLA Goal' - }, - { - readOnly: true, - value: '', - label: 'SLA Start Time', - listType: 'associated', - datasource: [ - { - key: 'AssignmentCreation', - value: 'The creation time of the Assignment' - }, - { - key: 'CurrentTime', - value: 'Current Date Time' - } - ], - displayMode: 'LABELS_LEFT', - key: 'SLA Start Time' - } -]; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/styles.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/utils.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/utils.js deleted file mode 100644 index 2a91cc0f..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/utils.js +++ /dev/null @@ -1,152 +0,0 @@ -/* eslint-disable no-undef */ - -/** - * Given the PConnect object of a Template component, retrieve the children - * metadata of all regions. - * @param {Function} pConnect PConnect of a Template component. - */ -export function getAllFields(pConnect) { - const metadata = pConnect().getRawMetadata(); - if (!metadata.children) { - return []; - } - - let allFields = []; - - const makeField = (f) => ({ - ...pConnect().resolveConfigProps(f.config), - type: f.type - }); - - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - allFields = metadata.children.map((region) => - region.children.map((field) => { - // Do not resolve the config props if is status work, instead create component here as status badge and mark as status display - if (field.config?.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - return pConnect().createComponent(field); - } - - return makeField(field); - }) - ); - } else { - allFields = metadata.children.map(makeField); - } - - return allFields; -} - - - -export function getFilteredFields(getPConnect) { - let primaryFieldsRaw; - let secondaryFieldsRaw; - const metadata = getPConnect().getRawMetadata(); - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - primaryFieldsRaw = metadata.children[0].children; - secondaryFieldsRaw = metadata.children[1].children; - } else { - [primaryFieldsRaw, secondaryFieldsRaw] = metadata.children; - } - - // Filter out fields that are not visible and unsupported types for primary fields (for CaseSummary) - primaryFieldsRaw = primaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - secondaryFieldsRaw = secondaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - return [primaryFieldsRaw, secondaryFieldsRaw]; -} - -/** - * Returns ConfigurableLayout mapped content. With pre-populated default layout configs. - * @param {object[]} regionData template children item. - * @returns {object[]} ConfigurableLayout content. - */ -export function getLayoutDataFromRegion(regionData) { - const defaultLayoutConfig = { - width: 'full', - fillAvailable: true, - minWidth: [300, 'px'] - }; - - return regionData.props - ?.getPConnect() - ?.getChildren() - ?.map((item, index) => { - const itemPConnect = item?.getPConnect(); - - return { - id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`, - content: itemPConnect?.getComponent(), - layoutConfig: { - ...defaultLayoutConfig, - ...itemPConnect?.getConfigProps().layoutConfig - } - }; - }); -} - -/** - * Determine if the current view is the view of the case step/assignment. - * @param {Function} pConnect PConnect object for the component - */ -export function getIsAssignmentView(pConnect) { - // Get caseInfo content from the store which contains the view info about the current assignment/step - // TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available - const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID); - const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID); - - const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`; - - // Get the info about the current view from pConnect - const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`; - - return assignmentViewId === currentViewId; -} - -/** - * A hook that gets the instructions content for a view. - * @param {Function} pConnect PConnect object for the component - * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler) - */ -export function getInstructions(pConnect, instructions = 'casestep') { - const caseStepInstructions = pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS); - - // Determine if this view is the current assignment/step view - const isCurrentAssignmentView = getIsAssignmentView(pConnect); - - // Case step instructions - if (instructions === 'casestep' && isCurrentAssignmentView && caseStepInstructions?.length) { - return caseStepInstructions; - } - - // No instructions - if (instructions === 'none') { - return undefined; - } - - // If the annotation wasn't processed correctly, don't return any instruction text - if (instructions?.startsWith('@PARAGRAPH')) { - /* eslint-disable no-console */ - console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.'); - /* eslint-enable no-console */ return undefined; - } - - // Custom instructions from the view - // The raw metadata for `instructions` will be something like '@PARAGRAPH .SomeParagraphRule' but - // it is evaluated by core logic to the content - if (instructions !== 'casestep' && instructions !== 'none') { - return instructions; - } - return undefined; -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/DefaultForm.svg b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/DefaultForm.svg deleted file mode 100644 index 9fe86e70..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/DefaultForm.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - 2 col copy - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/demo.stories.jsx deleted file mode 100644 index 1556bcbf..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/demo.stories.jsx +++ /dev/null @@ -1,166 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyForm from './index.jsx'; -import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core'; -import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core'; -import { pyReviewRaw, regionChildrenResolved } from './mock.stories'; - -export default { - title: 'PegaDxilMyForm', - decorators: [withKnobs], - component: PegaDxilMyForm -}; - -const renderField = resolvedProps => { - const { displayMode, value = '', label = '', key } = resolvedProps; - - const [inputValue, setInputValue] = useState(value); - const [phoneValue, setPhoneValue] = useState('+16397975093'); - - const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked'; - - let val = - value !== '' ? ( - { - setInputValue(e.target.value); - }} - > - {inputValue} - - ) : ( - '' - ); - - - if (label === 'Service Date') - val = ( - { - const { valueAsISOString: date } = dateValue; - const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date; - setInputValue(trimmedDate); - }} - > - ); - - if (label === 'Email') - val = ( - { - setInputValue(e.target.value); - }} - > - ); - - if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name') - val = ( - { - setInputValue(e.target.value); - }} - > - ); - - if (label === 'Phone Number') - val = ( - { - setPhoneValue(phoneVal); - }} - > - ); - - - if (variant === 'inline') { - val = value || ( - - ); - } else { - val = ( - { - setInputValue(e.target.value); - }} - > - {val} - - ); - } - return ( - - ); -}; - -export const basePegaDxilMyForm = () => { - const props = { - NumCols: 1, - template: 'DefaultForm', - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children; - }, - createComponent: config => { - // eslint-disable-next-line default-case - switch (config.config.value) { - case '@P .FirstName': - return renderField(regionChildrenResolved[0]); - case '@P .MiddleName': - return renderField(regionChildrenResolved[1]); - case '@P .LastName': - return renderField(regionChildrenResolved[2]); - case '@P .Email': - return renderField(regionChildrenResolved[3]); - case '@P .PhoneNumber': - return renderField(regionChildrenResolved[4]); - case '@P .ServiceDate': - return renderField(regionChildrenResolved[5]); - } - } - }; - } - }; - - const regionAChildren = pyReviewRaw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - <> - {regionAChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/index.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/index.jsx deleted file mode 100644 index 021863d5..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/index.jsx +++ /dev/null @@ -1,42 +0,0 @@ -import { Grid } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -import StyledPegaDxilMyFormWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyForm(props) { - - - const { children, NumCols } = props; - - const nCols = parseInt(NumCols, 10); - - // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`); - - return ( - - - {children} - - - ); - -} - -PegaDxilMyForm.defaultProps = { - NumCols: 1, - children: [] -}; - -PegaDxilMyForm.propTypes = { - NumCols: PropTypes.number, - children: PropTypes.arrayOf(PropTypes.node), -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/mock.stories.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/mock.stories.js deleted file mode 100644 index 75a0941e..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/mock.stories.js +++ /dev/null @@ -1,137 +0,0 @@ -export const pyReviewRaw = { - name: 'CollectInformation', - type: 'View', - config: { - template: 'DefaultForm', - ruleClass: 'OM5W9U-SampleApp-Work-Test', - localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION', - context: '@P .pyViewContext' - }, - children: [ - { - name: 'Fields', - type: 'Region', - children: [ - { - type: 'TextInput', - config: { - value: '@P .FirstName', - label: '@L First Name', - key: 'FirstName' - } - }, - { - type: 'TextInput', - config: { - value: '@P .MiddleName', - label: '@L Middle Name', - key: 'MiddleName' - } - }, - { - type: 'TextInput', - config: { - value: '@P .LastName', - label: '@L Last Name', - key: 'LastName' - } - }, - { - type: 'Email', - config: { - value: '@P .Email', - label: '@L Email', - key: 'Email' - } - }, - { - type: 'Phone', - config: { - value: '@P .PhoneNumber', - label: '@L Phone Number', - datasource: { - source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults', - fields: { - value: '@P .pyCallingCode' - } - }, - key: 'PhoneNumber' - } - }, - { - type: 'Date', - config: { - value: '@P .ServiceDate', - label: '@L Service Date', - key: 'ServiceDate' - } - } - ] - } - ], - classID: 'OM5W9U-SampleApp-Work-Test' -}; - -export const regionChildrenResolved = [ - { - readOnly: undefined, - value: 'John', - label: 'First Name', - hasSuggestions: false, - key: 'firstName' - }, - { - readOnly: undefined, - value: '', - label: 'Middle Name', - hasSuggestions: false, - key: 'middleName' - }, - { - readOnly: undefined, - value: 'Doe', - label: 'Last Name', - hasSuggestions: false, - key: 'lastName' - }, - { - readOnly: undefined, - value: 'John@doe.com', - label: 'Email', - hasSuggestions: false, - key: 'email' - }, - { - readOnly: undefined, - value: '+16397975093', - label: 'Phone Number', - datasource: { - fields: { - value: undefined - }, - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ] - }, - hasSuggestions: false, - key: 'phoneNumber' - }, - { - readOnly: undefined, - value: '2023-01-25', - label: 'Service Date', - hasSuggestions: false, - key: 'serviceDate' - } -]; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/styles.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyForm/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/GetNextWork.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/GetNextWork.jsx deleted file mode 100644 index 5c04e519..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/GetNextWork.jsx +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable no-undef */ -import { Button, useToaster } from '@pega/cosmos-react-core'; - -export default function GetNextWork(props) { - const { getPConnect, variant } = props; - - const toasterCtx = useToaster(); - - const localizedVal = PCore.getLocaleUtils().getLocaleValue; - - const getNextWork = () => { - - // alert('Get next work clicked'); - - getPConnect() - .getActionsApi() - .getNextWork() - .catch((err) => { - /* eslint-disable no-console */ - console.log(err); - /* eslint-enable no-console */ - if (err[0].status === 404) { - toasterCtx.push({ - content: localizedVal('No task currently available') - }); - } - }); - }; - - return ( - - ); -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/OneColumnPage.svg b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/demo.stories.jsx deleted file mode 100644 index 5d408efd..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/demo.stories.jsx +++ /dev/null @@ -1,102 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work'; - -import PegaDxilMyPage from './index.jsx'; -import { pyHome1Resolved, pyHome1Raw } from './mock.stories.js'; - -export default { - title: 'PegaDxilMyPage', - decorators: [withKnobs], - component: PegaDxilMyPage -}; - -export const basePegaDxilMyPage = () => { - if (!window.PCore) { - window.PCore = {}; - } - - window.PCore.getLocaleUtils = () => { - return { - getLocaleValue: val => { - return val; - } - }; - }; - - const configProps = pyHome1Resolved.children[0].children[0].config; - - const props = { - useConfigurableLayout: false, - enableGetNextWork: pyHome1Raw.config.enableGetNextWork, - icon: pyHome1Raw.config.icon, - title: 'Page Template', - - getPConnect: () => { - return { - getStateProps: () => { - return {}; - }, - getActionsApi: () => { - return { - getNextWork: () => { - return new Promise(resolve => { - resolve({}); - }); - }, - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - getChildren: () => { - return pyHome1Raw.children; - }, - getComponentName: () => { - return ''; - }, - getLocalizedValue: value => { - return value; - }, - getRawMetadata: () => { - return pyHome1Raw; - }, - createComponent: config => { - if (config.type === 'AppAnnouncement') { - return ( - { - return { - getChildren: () => { - return pyHome1Resolved.children; - } - }; - }} - /> - ); - } - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - const regionAChildren = pyHome1Raw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - <> - {regionAChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/index.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/index.jsx deleted file mode 100644 index 89699dfc..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/index.jsx +++ /dev/null @@ -1,70 +0,0 @@ -import { useMemo, Children } from 'react'; -import PropTypes from 'prop-types'; -import { OneColumnPage as OneColumn } from '@pega/cosmos-react-core'; -import { ConfigurableLayout } from '@pega/cosmos-react-work' -// import { registerIcon } from '@pega/cosmos-react-core'; - -// temp -// import * as headlineIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headline.icon'; - -import StyledPegaDxilMyPageWrapper from './styles'; - -import GetNextWork from './GetNextWork.jsx'; -import { getLayoutDataFromRegion } from './utils'; - -// temp -// registerIcon(headlineIcon); - -// currently getting 'icon' from props is not supported with iconRegistry -// have to manually get icon, so can't determine a runtime for now -// so "headline" icon is hardcoded. - - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyPage(props) { - - // add back in icon when working - // const { children, title, icon, useConfigurableLayout, getPConnect, enableGetNextWork } = props; - const { children, title, useConfigurableLayout, getPConnect, enableGetNextWork } = props; - const childArray = useMemo(() => { - return Children.toArray(children); - }, [children]); - const layoutItemsA = useMemo(() => { - return getLayoutDataFromRegion(childArray[0]); - }, [childArray[0]]); - - // temp - const tempIcon = "pi pi-headline"; - - return ( - - - : childArray[0]} - title={title} - icon={tempIcon?.replace('pi pi-', '')} - actions={enableGetNextWork ? : null} - /> - - - ); - - - -} - -PegaDxilMyPage.defaultProps = { - /* icon: '', */ - useConfigurableLayout: false -}; - -PegaDxilMyPage.propTypes = { - children: PropTypes.arrayOf(PropTypes.node).isRequired, - title: PropTypes.string.isRequired, - /* icon: PropTypes.string, */ - useConfigurableLayout: PropTypes.bool -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/localizations.json b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/localizations.json deleted file mode 100644 index 8e13d22a..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/localizations.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Get next work" : "Get next work", - "No task currently available" : "No task currently available" -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/mock.stories.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/mock.stories.js deleted file mode 100644 index 7659742d..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/mock.stories.js +++ /dev/null @@ -1,94 +0,0 @@ -export const pyHome1Raw = { - name: 'pyHome1', - type: 'View', - config: { - type: 'landingpage', - template: 'OneColumnPage', - icon: 'home-solid', - title: '@ENV APPLICATION_DESC', - ruleClass: 'DIXL-MediaCo-UIPages', - localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1', - enableGetNextWork: true, - context: 'pyPortal' - }, - children: [ - { - name: 'A', - type: 'Region', - children: [ - { - type: 'AppAnnouncement', - config: { - label: '@L App announcement', - description: - "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.", - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+', - datasource: { - source: '@DATASOURCE D_pyAnnouncements.pxResults', - fields: { - name: '@P .pyLabel' - } - } - } - } - ] - } - ], - classID: 'DIXL-MediaCo-UIPages' -}; - -export const pyHome1Resolved = { - name: 'pyHome1', - type: 'View', - config: { - type: 'landingpage', - template: 'OneColumnPage', - icon: 'home-solid', - title: '@ENV APPLICATION_DESC', - ruleClass: 'DIXL-MediaCo-UIPages', - localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1', - enableGetNextWork: true, - context: 'pyPortal' - }, - children: [ - { - name: 'A', - type: 'Region', - getPConnect: () => { - return { - getComponentName: () => { - return ''; - }, - getComponent: () => { - return pyHome1Resolved.children[0]; - }, - getConfigProps: () => { - return {}; - } - }; - }, - children: [ - { - type: 'AppAnnouncement', - config: { - label: '@L App announcement', - description: - "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.", - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+', - datasource: { - source: '@DATASOURCE D_pyAnnouncements.pxResults', - fields: { - name: '@P .pyLabel' - } - } - } - } - ] - } - ], - classID: 'DIXL-MediaCo-UIPages' -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/styles.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/utils.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/utils.js deleted file mode 100644 index e088c3aa..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/utils.js +++ /dev/null @@ -1,229 +0,0 @@ -/* eslint-disable no-undef */ -import { createUID } from '@pega/cosmos-react-core'; - -// import { LazyMap as LazyComponentMap } from '../../components_map'; - -const LazyComponentMap = {}; - -/** - * Given the PConnect object of a Template component, retrieve the children - * metadata of all regions. - * @param {Function} pConnect PConnect of a Template component. - */ -export function getAllFields(pConnect) { - const metadata = pConnect().getRawMetadata(); - if (!metadata.children) { - return []; - } - - let allFields = []; - - const makeField = (f) => ({ - ...pConnect().resolveConfigProps(f.config), - type: f.type - }); - - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - allFields = metadata.children.map((region) => - region.children.map((field) => { - // Do not resolve the config props if is status work, instead create component here as status badge and mark as status display - if (field.config?.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - return pConnect().createComponent(field); - } - - return makeField(field); - }) - ); - } else { - allFields = metadata.children.map(makeField); - } - - return allFields; -} - -/** - * A helper function to create an object consisting react component as per the type. - * This is used by CaseSummary template. - * @param {object} configObject Object containing meta information for the particular field authored - * @param {Function} getPConnect PConnect function passed along to other components. - * @param {string} displayMode displayMode string contains information about the layout of component in review mode. - */ -export function prepareComponentInCaseSummary(configObject, getPConnect, displayMode) { - const { config, children } = configObject; - let { type } = configObject; - const caseSummaryComponentObject = {}; - let showAddressLabel = true; - if (config && config.value === '@P .pyStatusWork') { - config.displayAsStatus = true; - type = 'TextInput'; // force the type to be TextInput for status field. - // As TextInput is loaded forcefully sometimes, TextInput component might not be available in lazy map. - // Load TextInput if it is not available. - if (!LazyComponentMap[type]) { - PCore.getAssetLoader().getLoader('component-loader')([type]); - } - } - - caseSummaryComponentObject.name = getPConnect().resolveConfigProps({ - label: config.label - }).label; - if (type === 'CaseOperator') { - switch (caseSummaryComponentObject.name) { - case 'Create operator': - caseSummaryComponentObject.name = getPConnect().resolveConfigProps({ - createLabel: config.createLabel - }).createLabel; - break; - case 'Update operator': - caseSummaryComponentObject.name = getPConnect().resolveConfigProps({ - updateLabel: config.updateLabel - }).updateLabel; - break; - default: - caseSummaryComponentObject.name = getPConnect().resolveConfigProps({ - resolveLabel: config.resolveLabel - }).resolveLabel; - break; - } - } else if (type === 'Checkbox') { - caseSummaryComponentObject.name = getPConnect().resolveConfigProps({ - label: config.caption - }).label; - } else if (type === 'Address') { - showAddressLabel = false; - } - const createdComponent = getPConnect().createComponent({ - type, - children: children ? [...children] : [], - showAddressLabel, - config: { - ...config, - hideLabel: true, - key: createUID() // Need a unique key on render of the summary so that the component is recreated each time - } - }); - createdComponent.props.getPConnect().setInheritedProp('displayMode', displayMode); - if (type === 'Address') { - createdComponent.props.getPConnect().setInheritedProp('showAddressLabel', showAddressLabel); - } - // createdComponent.props.getPConnect().setInheritedProp("hideLabel", true); - caseSummaryComponentObject.value = createdComponent; - if (type === 'reference') { - caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label; - } - - return caseSummaryComponentObject; -} - -export function getFilteredFields(getPConnect) { - let primaryFieldsRaw; - let secondaryFieldsRaw; - const metadata = getPConnect().getRawMetadata(); - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - primaryFieldsRaw = metadata.children[0].children; - secondaryFieldsRaw = metadata.children[1].children; - } else { - [primaryFieldsRaw, secondaryFieldsRaw] = metadata.children; - } - - // Filter out fields that are not visible and unsupported types for primary fields (for CaseSummary) - primaryFieldsRaw = primaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - secondaryFieldsRaw = secondaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - return [primaryFieldsRaw, secondaryFieldsRaw]; -} - -/** - * Returns ConfigurableLayout mapped content. With pre-populated default layout configs. - * @param {object[]} regionData template children item. - * @returns {object[]} ConfigurableLayout content. - */ -export function getLayoutDataFromRegion(regionData) { - const defaultLayoutConfig = { - width: 'full', - fillAvailable: true, - minWidth: [300, 'px'] - }; - - return regionData.props - ?.getPConnect() - ?.getChildren() - ?.map((item, index) => { - const itemPConnect = item?.getPConnect(); - - return { - id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`, - content: itemPConnect?.getComponent(), - layoutConfig: { - ...defaultLayoutConfig, - ...itemPConnect?.getConfigProps().layoutConfig - } - }; - }); -} - -/** - * Determine if the current view is the view of the case step/assignment. - * @param {Function} pConnect PConnect object for the component - */ -export function getIsAssignmentView(pConnect) { - // Get caseInfo content from the store which contains the view info about the current assignment/step - // TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available - const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID); - const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID); - - const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`; - - // Get the info about the current view from pConnect - const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`; - - return assignmentViewId === currentViewId; -} - -/** - * A hook that gets the instructions content for a view. - * @param {Function} pConnect PConnect object for the component - * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler) - */ -export function getInstructions(pConnect, instructions = 'casestep') { - const caseStepInstructions = pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS); - - // Determine if this view is the current assignment/step view - const isCurrentAssignmentView = getIsAssignmentView(pConnect); - - // Case step instructions - if (instructions === 'casestep' && isCurrentAssignmentView && caseStepInstructions?.length) { - return caseStepInstructions; - } - - // No instructions - if (instructions === 'none') { - return undefined; - } - - // If the annotation wasn't processed correctly, don't return any instruction text - if (instructions?.startsWith('@PARAGRAPH')) { - /* eslint-disable no-console */ - console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.'); - /* eslint-enable no-console */ - return undefined; - } - - // Custom instructions from the view - // The raw metadata for `instructions` will be something like '@PARAGRAPH .SomeParagraphRule' but - // it is evaluated by core logic to the content - if (instructions !== 'casestep' && instructions !== 'none') { - return instructions; - } - return undefined; -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx deleted file mode 100644 index 4c6c2b48..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Status } from "@pega/cosmos-react-core"; - -export default function StatusWorkRenderer({ value }) { - let variant = "info"; - - const warnStrings = ["fail", "cancel", "reject", "revoke", "stopped", "warn"]; - const infoStrings = ["open", "hold", "info", "new"]; - const successStrings = ["resolved", "completed", "success"]; - const pendingStrings = ["pending"]; - - if (new RegExp(warnStrings.join("|"), "i").test(value)) { - variant = "warn"; - } else if (new RegExp(infoStrings.join("|"), "i").test(value)) { - variant = "info"; - } else if (new RegExp(successStrings.join("|"), "i").test(value)) { - variant = "success"; - } else if (new RegExp(pendingStrings.join("|"), "i").test(value)) { - variant = "pending"; - } - - return ( - - {value} - - ); -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg deleted file mode 100644 index 4d15fcd0..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - 2 col - - - - - - - - - - - - - - B - - - - A - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx deleted file mode 100644 index bf8ae373..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx +++ /dev/null @@ -1,136 +0,0 @@ -import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core'; -import PegaDxilMyTwoColumnDetails from './index'; -import { pyReviewRaw, pyReviewResolved, regionChildrenResolved } from './mock.stories'; -import StatusWorkRenderer from './StatusWork.jsx'; - -export default { - title: 'PegaDxilMyTwoColumnDetails', - component: PegaDxilMyTwoColumnDetails -}; - -const renderField = resolvedProps => { - const { - displayAsStatus = false, - displayMode, - value = '', - label = '', - key, - // eslint-disable-next-line react-hooks/rules-of-hooks - theme = useTheme() - } = resolvedProps; - - const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked'; - - let val = - value !== '' ? ( - - {value} - - ) : ( - '' - ); - - if (label === 'Create date/time') - val = ( - - ); - - if (displayAsStatus === true) val = ; - - if (label === 'Create Operator') - val = ( - - ); - - if (variant === 'inline') { - val = value || ( - - ); - } else { - val = ( - - {val} - - ); - } - return ; -}; - -export const basePegaDxilMyTwoColumnDetails = () => { - const props = { - template: 'MyCo_MyComponents_NewDetailsTemplate', - showHighlightedData: true, - label: 'Test Details', - showLabel: true, - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children; - }, - getRawMetadata: () => { - return pyReviewRaw; - }, - getInheritedProps: () => { - return pyReviewRaw.config.inheritedProps; - }, - createComponent: config => { - // eslint-disable-next-line default-case - switch (config.config.value) { - case '@P .pyStatusWork': - return renderField(pyReviewResolved.highlightedData[0].config); - case '@P .pyID': - return renderField(pyReviewResolved.highlightedData[1].config); - case '@P .pxCreateDateTime': - return renderField(pyReviewResolved.highlightedData[2].config); - case '@USER .pxCreateOperator': - return renderField(pyReviewResolved.highlightedData[3].config); - case '@P .pySLADeadline': - return renderField(regionChildrenResolved[0]); - case '@P .pySLAGoal': - return renderField(regionChildrenResolved[1]); - case '@P .pySLAStartTime': - return renderField(regionChildrenResolved[2]); - } - }, - setInheritedProp: () => { - /* nothing */ - }, - resolveConfigProps: () => { - /* nothing */ - } - }; - } - }; - - const regionAChildren = pyReviewRaw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - const regionBChildren = pyReviewRaw.children[1].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - - {regionAChildren} - {regionBChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/index.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/index.jsx deleted file mode 100644 index cf606a9b..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/index.jsx +++ /dev/null @@ -1,83 +0,0 @@ -import { Fragment } from 'react'; -import { Grid, Flex, FieldGroup } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -import StyledPegaDxilMyTwoColumnDetailsWrapper from './styles'; - -// includes in bundle -import { getAllFields } from './utils'; - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyTwoColumnDetails(props) { - - const { getPConnect, children, label, showLabel, showHighlightedData } = props; - const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() }; - - const numRegions = getAllFields(getPConnect)?.length; - const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)"); - const gridContainer = { "colGap": 1}; - gridContainer.cols = gridRepeat; - gridContainer.alignItems = 'start'; - - const gridHighlightContainer = { "gap": 2}; - gridHighlightContainer.cols = gridRepeat; - gridHighlightContainer.alignItems = 'start'; - gridHighlightContainer.pad = [0, 0, 2, 0]; - - // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent - let highlightedDataArr = []; - if (showHighlightedData) { - const { highlightedData = [] } = getPConnect().getRawMetadata().config; - highlightedDataArr = highlightedData.map((field) => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - // Mark as status display when using pyStatusWork - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return getPConnect().createComponent(field); - }); - } - - return ( - - - {showHighlightedData && highlightedDataArr.length > 0 && ( - - {highlightedDataArr.map((child, i) => ( - {child} - ))} - - )} - - {children.map((child, i) => ( - - {child} - - ))} - - - - ); - -} - -PegaDxilMyTwoColumnDetails.defaultProps = { - label: undefined, - showLabel: true, - showHighlightedData: false -}; - - -PegaDxilMyTwoColumnDetails.propTypes = { - showLabel: PropTypes.bool, - label: PropTypes.string, - getPConnect: PropTypes.func.isRequired, - showHighlightedData: PropTypes.bool -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/mock.stories.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/mock.stories.js deleted file mode 100644 index 10f90839..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/mock.stories.js +++ /dev/null @@ -1,230 +0,0 @@ -export const pyReviewRaw = { - name: 'pyReview', - type: 'View', - config: { - template: 'Details', - ruleClass: 'MyCo-MyCompon-Work-MyComponents', - showLabel: true, - label: '@L Details', - localeReference: '@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW', - showHighlightedData: true, - highlightedData: [ - { - type: 'TextInput', - config: { - value: '@P .pyStatusWork', - label: '@L Work Status', - displayMode: 'STACKED_LARGE_VAL', - displayAsStatus: true, - key: 'pyStatusWork' - } - }, - { - type: 'TextInput', - config: { - value: '@P .pyID', - label: '@L Case ID', - displayMode: 'STACKED_LARGE_VAL', - key: 'pyID' - } - }, - { - type: 'DateTime', - config: { - value: '@P .pxCreateDateTime', - label: '@L Create date/time', - displayMode: 'STACKED_LARGE_VAL', - key: 'pxCreateDateTime' - } - }, - { - type: 'UserReference', - config: { - label: '@L Create Operator', - value: '@USER .pxCreateOperator', - placeholder: 'Select...', - displayMode: 'STACKED_LARGE_VAL', - key: 'pxCreateOperator' - } - } - ], - inheritedProps: [ - { - prop: 'label', - value: '@L Details' - }, - { - prop: 'showLabel', - value: true - } - ] - }, - children: [ - { - name: 'A', - type: 'Region', - key: 'A', - getPConnect: () => { - return { - getRawMetadata: () => { - return pyReviewRaw.children[0]; - } - }; - }, - children: [ - { - type: 'DateTime', - config: { - value: '@P .pySLADeadline', - label: '@L SLA Deadline', - key: 'pySLADeadline' - } - }, - { - type: 'DateTime', - config: { - value: '@P .pySLAGoal', - label: '@L SLA Goal', - key: 'pySLAGoal' - } - }, - { - type: 'RadioButtons', - config: { - value: '@P .pySLAStartTime', - label: '@L SLA Start Time', - listType: 'associated', - datasource: '@ASSOCIATED .pySLAStartTime', - key: 'pySLAStartTime' - } - } - ] - }, - { - name: 'B', - type: 'Region', - key: 'B', - getPConnect: () => { - return { - getRawMetadata: () => { - return pyReviewRaw.children[0]; - } - }; - }, - children: [ - { - type: 'DateTime', - config: { - value: '@P .pySLADeadline', - label: '@L SLA Deadline', - key: 'pySLADeadline' - } - }, - { - type: 'DateTime', - config: { - value: '@P .pySLAGoal', - label: '@L SLA Goal', - key: 'pySLAGoal' - } - }, - { - type: 'RadioButtons', - config: { - value: '@P .pySLAStartTime', - label: '@L SLA Start Time', - listType: 'associated', - datasource: '@ASSOCIATED .pySLAStartTime', - key: 'pySLAStartTime' - } - } - ] - } - ], - classID: 'MyCo-MyCompon-Work-MyComponents' -}; - -export const pyReviewResolved = { - readOnly: true, - template: 'Details', - ruleClass: 'MyCo-MyCompon-Work-MyComponents', - showLabel: true, - label: 'Details', - localeReference: 'MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW', - showHighlightedData: true, - highlightedData: [ - { - type: 'TextInput', - config: { - value: 'New', - label: 'Work Status', - displayMode: 'STACKED_LARGE_VAL', - displayAsStatus: true - } - }, - { - type: 'TextInput', - config: { - value: 'M-1002', - label: 'Case ID', - displayMode: 'STACKED_LARGE_VAL' - } - }, - { - type: 'DateTime', - config: { - value: '2022-12-11T20:06:27.232Z', - label: 'Create date/time', - displayMode: 'STACKED_LARGE_VAL' - } - }, - { - type: 'UserReference', - config: { - label: 'Create Operator', - value: { - userId: 'conns', - userName: 'Sara Connor' - }, - placeholder: 'Select...', - displayMode: 'STACKED_LARGE_VAL' - } - } - ], - displayMode: 'LABELS_LEFT' -}; - -export const regionChildrenResolved = [ - { - readOnly: true, - value: '', - label: 'SLA Deadline', - displayMode: 'LABELS_LEFT', - key: 'SLA Deadline' - }, - { - readOnly: true, - value: '', - label: 'SLA Goal', - displayMode: 'LABELS_LEFT', - key: 'SLA Goal' - }, - { - readOnly: true, - value: '', - label: 'SLA Start Time', - listType: 'associated', - datasource: [ - { - key: 'AssignmentCreation', - value: 'The creation time of the Assignment' - }, - { - key: 'CurrentTime', - value: 'Current Date Time' - } - ], - displayMode: 'LABELS_LEFT', - key: 'SLA Start Time' - } -]; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/styles.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/utils.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/utils.js deleted file mode 100644 index cc4ead88..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnDetails/utils.js +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable no-undef */ - - - -/** - * Given the PConnect object of a Template component, retrieve the children - * metadata of all regions. - * @param {Function} pConnect PConnect of a Template component. - */ -export function getAllFields(pConnect) { - const metadata = pConnect().getRawMetadata(); - if (!metadata.children) { - return []; - } - - let allFields = []; - - const makeField = (f) => ({ - ...pConnect().resolveConfigProps(f.config), - type: f.type - }); - - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - allFields = metadata.children.map((region) => - region.children.map((field) => { - // Do not resolve the config props if is status work, instead create component here as status badge and mark as status display - if (field.config?.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - return pConnect().createComponent(field); - } - - return makeField(field); - }) - ); - } else { - allFields = metadata.children.map(makeField); - } - - return allFields; -} - - - -export function getFilteredFields(getPConnect) { - let primaryFieldsRaw; - let secondaryFieldsRaw; - const metadata = getPConnect().getRawMetadata(); - const hasRegions = !!metadata.children[0]?.children; - if (hasRegions) { - primaryFieldsRaw = metadata.children[0].children; - secondaryFieldsRaw = metadata.children[1].children; - } else { - [primaryFieldsRaw, secondaryFieldsRaw] = metadata.children; - } - - // Filter out fields that are not visible and unsupported types for primary fields (for CaseSummary) - primaryFieldsRaw = primaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - secondaryFieldsRaw = secondaryFieldsRaw.filter((item) => { - const resolvedItem = getPConnect().resolveConfigProps(item.config); - return resolvedItem.visibility !== false && item.type !== 'TextContent'; - }); - - return [primaryFieldsRaw, secondaryFieldsRaw]; -} - -/** - * Returns ConfigurableLayout mapped content. With pre-populated default layout configs. - * @param {object[]} regionData template children item. - * @returns {object[]} ConfigurableLayout content. - */ -export function getLayoutDataFromRegion(regionData) { - const defaultLayoutConfig = { - width: 'full', - fillAvailable: true, - minWidth: [300, 'px'] - }; - - return regionData.props - ?.getPConnect() - ?.getChildren() - ?.map((item, index) => { - const itemPConnect = item?.getPConnect(); - - return { - id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`, - content: itemPConnect?.getComponent(), - layoutConfig: { - ...defaultLayoutConfig, - ...itemPConnect?.getConfigProps().layoutConfig - } - }; - }); -} - -/** - * Determine if the current view is the view of the case step/assignment. - * @param {Function} pConnect PConnect object for the component - */ -export function getIsAssignmentView(pConnect) { - // Get caseInfo content from the store which contains the view info about the current assignment/step - // TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available - const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID); - const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID); - - const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`; - - // Get the info about the current view from pConnect - const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`; - - return assignmentViewId === currentViewId; -} - -/** - * A hook that gets the instructions content for a view. - * @param {Function} pConnect PConnect object for the component - * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler) - */ -export function getInstructions(pConnect, instructions = 'casestep') { - const caseStepInstructions = pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS); - - // Determine if this view is the current assignment/step view - const isCurrentAssignmentView = getIsAssignmentView(pConnect); - - // Case step instructions - if (instructions === 'casestep' && isCurrentAssignmentView && caseStepInstructions?.length) { - return caseStepInstructions; - } - - // No instructions - if (instructions === 'none') { - return undefined; - } - - // If the annotation wasn't processed correctly, don't return any instruction text - if (instructions?.startsWith('@PARAGRAPH')) { - /* eslint-disable no-console */ - console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.'); - /* eslint-enable no-console */ - return undefined; - } - - // Custom instructions from the view - // The raw metadata for `instructions` will be something like '@PARAGRAPH .SomeParagraphRule' but - // it is evaluated by core logic to the content - if (instructions !== 'casestep' && instructions !== 'none') { - return instructions; - } - return undefined; -} diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg deleted file mode 100644 index 3533e017..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - 2-col icon - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - B - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx deleted file mode 100644 index 5da27462..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx +++ /dev/null @@ -1,175 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyTwoColumnForm from './index.jsx'; -import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core'; -import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core'; -import { pyReviewRaw, regionChildrenResolved } from './mock.stories'; - -export default { - title: 'PegaDxilMyTwoColumnForm', - decorators: [withKnobs], - component: PegaDxilMyTwoColumnForm -}; - -const renderField = resolvedProps => { - const { displayMode, value = '', label = '', key } = resolvedProps; - - const [inputValue, setInputValue] = useState(value); - const [phoneValue, setPhoneValue] = useState('+16397975093'); - - - const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked'; - - let val = - value !== '' ? ( - { - setInputValue(e.target.value); - }} - > - {inputValue} - - ) : ( - '' - ); - - - if (label === 'Service Date') - val = ( - { - const { valueAsISOString: date } = dateVal; - const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date; - setInputValue(trimmedDate); - }} - > - ); - - if (label === 'Email') - val = ( - { - setInputValue(e.target.value); - }} - > - ); - - if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name') - val = ( - { - setInputValue(e.target.value); - }} - > - ); - - if (label === 'Phone Number') - val = ( - { - setPhoneValue(phoneVal); - }} - > - ); - - - if (variant === 'inline') { - val = value || ( - - ); - } else { - val = ( - { - setInputValue(e.target.value); - }} - > - {val} - - ); - } - return ( - { - /* nothing */ - }} - /> - ); -}; - -export const basePegaDxilMyTwoColumnForm = () => { - const props = { - template: 'DefaultForm', - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children; - }, - createComponent: config => { - // eslint-disable-next-line default-case - switch (config.config.value) { - case '@P .FirstName': - return renderField(regionChildrenResolved[0]); - case '@P .MiddleName': - return renderField(regionChildrenResolved[1]); - case '@P .LastName': - return renderField(regionChildrenResolved[2]); - case '@P .Email': - return renderField(regionChildrenResolved[3]); - case '@P .PhoneNumber': - return renderField(regionChildrenResolved[4]); - case '@P .ServiceDate': - return renderField(regionChildrenResolved[5]); - } - } - }; - } - }; - - const regionAChildren = pyReviewRaw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - const regionBChildren = pyReviewRaw.children[1].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - - {regionAChildren} - {regionBChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/index.jsx b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/index.jsx deleted file mode 100644 index 99533727..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/index.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import { Grid, Flex } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -import StyledPegaDxilMyTwoColumnFormWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyTwoColumnForm(props) { - - - const { children } = props; - - const numRegions = children?.length; - const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)"); - const gridContainer = {"colGap" : 1}; - gridContainer.cols = gridRepeat; - gridContainer.alignItems = 'start'; - - const flexContainer = {direction: 'column'}; - flexContainer.gap = 2; - - return ( - - - {children.map((child, i) => ( - - {child} - - ))} - - - ); - -} - -PegaDxilMyTwoColumnForm.defaultProps = { - children: [] -}; - -PegaDxilMyTwoColumnForm.propTypes = { - children: PropTypes.arrayOf(PropTypes.node), -}; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/mock.stories.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/mock.stories.js deleted file mode 100644 index 8e16b199..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/mock.stories.js +++ /dev/null @@ -1,143 +0,0 @@ -export const pyReviewRaw = { - name: 'CollectInformation', - type: 'View', - config: { - template: 'DefaultForm', - ruleClass: 'OM5W9U-SampleApp-Work-Test', - localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION', - context: '@P .pyViewContext' - }, - children: [ - { - name: 'A', - type: 'Region', - children: [ - { - type: 'TextInput', - config: { - value: '@P .FirstName', - label: '@L First Name', - key: 'FirstName' - } - }, - { - type: 'TextInput', - config: { - value: '@P .MiddleName', - label: '@L Middle Name', - key: 'MiddleName' - } - }, - { - type: 'TextInput', - config: { - value: '@P .LastName', - label: '@L Last Name', - key: 'LastName' - } - } - ] - }, - { - name: 'B', - type: 'Region', - children: [ - { - type: 'Email', - config: { - value: '@P .Email', - label: '@L Email', - key: 'Email' - } - }, - { - type: 'Phone', - config: { - value: '@P .PhoneNumber', - label: '@L Phone Number', - datasource: { - source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults', - fields: { - value: '@P .pyCallingCode' - } - }, - key: 'PhoneNumber' - } - }, - { - type: 'Date', - config: { - value: '@P .ServiceDate', - label: '@L Service Date', - key: 'ServiceDate' - } - } - ] - } - ], - classID: 'OM5W9U-SampleApp-Work-Test' -}; - -export const regionChildrenResolved = [ - { - readOnly: undefined, - value: 'John', - label: 'First Name', - hasSuggestions: false, - key: 'First Name' - }, - { - readOnly: undefined, - value: '', - label: 'Middle Name', - hasSuggestions: false, - key: 'Middle Name' - }, - { - readOnly: undefined, - value: 'Doe', - label: 'Last Name', - hasSuggestions: false, - key: 'Last Name' - }, - { - readOnly: undefined, - value: 'John@doe.com', - label: 'Email', - hasSuggestions: false, - key: 'Email' - }, - { - readOnly: undefined, - value: '+16397975093', - label: 'Phone Number', - datasource: { - fields: { - value: undefined - }, - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ] - }, - hasSuggestions: false, - key: 'Phone Number' - }, - { - readOnly: undefined, - value: '2023-01-25', - label: 'Service Date', - hasSuggestions: false, - key: 'Service Date' - } -]; diff --git a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/styles.js b/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/Pega_DXIL_MyTwoColumnForm/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/template/_template.md b/tests/assets/components/createAll/custom-constellation/template/_template.md deleted file mode 100644 index 75835038..00000000 --- a/tests/assets/components/createAll/custom-constellation/template/_template.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/template** directory - -The **src/components/custom-constellation/template** directory contains the code for the Constellation-based associated component for any custom **template** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/template** directory, there will be a matching component in the **src/components/custom-sdk/template** directory. diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/OneColumnPage.svg b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/demo.stories.jsx deleted file mode 100644 index 60c9a853..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/demo.stories.jsx +++ /dev/null @@ -1,78 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyCaseWidget from './index.jsx'; - -import historyData from './mock.stories'; - -export default { - title: 'PegaDxilMyCaseWidget', - decorators: [withKnobs], - component: PegaDxilMyCaseWidget -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getConstants = () => { - return { - CASE_INFO: { - CASE_INFO_ID: 'caseInfo.ID' - } - }; -}; - -window.PCore.getLocaleUtils = () => { - return { - getLocaleValue: value => { - return value; - } - }; -}; - -window.PCore.getDataApiUtils = () => { - return { - getData: () => { - return new Promise(resolve => { - resolve(historyData); - }); - } - }; -}; - -export const basePegaDxilMyCaseWidget = () => { - - const props = { - label: 'Case history', - - getPConnect: () => { - return { - getValue: value => { - return value; - }, - getContextName: () => { - return 'app/primary_1'; - }, - getLocalizedValue: value => { - return value; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } -}; - -return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.jsx deleted file mode 100644 index eab48284..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.jsx +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable no-undef */ -import { useState, useEffect } from 'react'; -import PropTypes from 'prop-types'; -import { Table, Text } from '@pega/cosmos-react-core'; - -import StyledPegaDxilMyCaseWidgetWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyCaseWidget(props) { - const { getPConnect, label } = props; - const pConn = getPConnect(); - const [history, setHistory] = useState([]); - const [isLoading, setIsLoading] = useState(true); - const caseID = pConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID); - const context = pConn.getContextName(); - - const columns = [ - { renderer: 'date', label: pConn.getLocalizedValue('Date') }, - { renderer: 'description', label: pConn.getLocalizedValue('Description') }, - { renderer: 'user', label: pConn.getLocalizedValue('Performed by') } - ]; - - useEffect(() => { - const payload = { dataViewParameters: [{ CaseInstanceKey: caseID }] }; - PCore.getDataApiUtils() - .getData('D_pyWorkHistory', payload, context) - .then((response) => { - setIsLoading(false); - if (response.data.data !== null) { - setHistory( - response.data.data.map((entry, index) => { - return { - date: new Date(entry.pxTimeCreated).toLocaleString(), - description: {entry.pyMessageKey}, - user: entry.pyPerformer, - id: index - }; - }) - ); - } else { - setHistory([]); - } - }) - .catch(() => { - setHistory([]); - setIsLoading(false); - }); - }, [caseID, context]); - return ( - - - - ); - -} - -PegaDxilMyCaseWidget.defaultProps = { - -}; - -PegaDxilMyCaseWidget.propTypes = { - getPConnect: PropTypes.func.isRequired -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/mock.stories.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/mock.stories.js deleted file mode 100644 index 1b5d98db..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/mock.stories.js +++ /dev/null @@ -1,390 +0,0 @@ -const historyData = { - data: { - fetchDateTime: '2023-01-18T12:04:56.517Z', - pxObjClass: 'Pega-API-DataExploration-Data', - resultCount: 31, - data: [ - { - pxTimeCreated: '2023-01-13T21:46:33.339Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214633.339 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214633.339 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:33.332Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214633.332 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214633.332 GMT', - pxLongitude: null, - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:32.005Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214632.005 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214632.005 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.998Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.998 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.998 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.175Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.175 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.175 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.168Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.168 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.168 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:29.893Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214629.893 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214629.893 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:29.887Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214629.887 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214629.887 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:28.248Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214628.248 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214628.248 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:28.242Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214628.242 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214628.242 GMT', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:08.399Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214608.399 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214608.399 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:08.393Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214608.393 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214608.393 GMT', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:07.584Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214607.584 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214607.584 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:07.579Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214607.579 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214607.579 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:06.262Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214606.262 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214606.262 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:06.256Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214606.256 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214606.256 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:57.503Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214557.503 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214557.503 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:57.496Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214557.496 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214557.496 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:36.250Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214536.250 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214536.250 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:36.244Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214536.244 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214536.244 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:35.364Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214535.364 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214535.364 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:35.356Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214535.356 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214535.356 GMT', - pxLongitude: null, - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:33.224Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214533.224 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214533.224 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:33.218Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214533.218 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214533.218 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:32.436Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214532.436 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214532.436 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:32.430Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214532.430 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214532.430 GMT', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:25.003Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214525.003 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214525.003 GMT', - pxLongitude: null, - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:24.994Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214524.994 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214524.994 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'Select Test'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.570Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.570 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.570 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.563Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.563 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.563 GMT', - pxLongitude: null, - pyMessageKey: 'ChangeStageAutomatic\tCreate\tPick Test', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: 'ChangeStageAutomatic\tCreate\tPick Test' - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.550Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.550 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.550 GMT', - pxLongitude: null, - pyMessageKey: 'Item created.', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - } - ], - hasMoreResults: false - }, - status: 200, - statusText: '', - headers: { - 'content-length': '1328', - 'content-type': 'application/json;charset=UTF-8' - }, - request: {} -}; -export default historyData; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/styles.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Avatar.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Avatar.jsx deleted file mode 100644 index ad9f9dd1..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Avatar.jsx +++ /dev/null @@ -1,75 +0,0 @@ -/* eslint-disable no-undef */ -/* eslint-disable react-hooks/rules-of-hooks */ -import { useEffect, useState } from 'react'; -import PropTypes from 'prop-types'; -import { Avatar as CosmosAvatar } from '@pega/cosmos-react-core'; - -function Avatar(props) { - const { metaObj, showStatus } = props; - const [imageBlobUrl, setImageBlobUrl] = useState(null); - let userName; - let userIdentifier; - - // TODO Below if conditions can be removed once we have apis to get worklist/mywork info - // This is non CaseView case (Dashboard, MyWork etc) - if (!metaObj) { - userName = PCore.getEnvironmentInfo().getOperatorName(); - userIdentifier = PCore.getEnvironmentInfo().getOperatorIdentifier(); - } else { - userName = metaObj.name; - userIdentifier = metaObj.ID; - } - if (!userName && userIdentifier) { - userName = userIdentifier; - } - - useEffect(() => { - const imageKey = !metaObj ? PCore.getEnvironmentInfo().getOperatorImageInsKey() : metaObj.image; - if (imageKey) { - PCore.getAssetLoader() - .getSvcImage(imageKey) - .then((blob) => window.URL.createObjectURL(blob)) - .then((imagePath) => setImageBlobUrl(imagePath)); - } - }, []); - - if (showStatus) { - const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier); - const [userState, setUserState] = useState(currentState === 'online' ? 'active' : 'inactive'); - - const handleUserStateChange = ({ state }) => { - setUserState(state === 'online' ? 'active' : 'inactive'); - }; - - useEffect(() => { - const subId = PCore.getMessagingServiceManager() - .getUserPresence() - .subscribe(userIdentifier, handleUserStateChange); - - return function cleanup() { - PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId); - }; - }, []); - return ; - } - - // Do not render when userName does not exists - // TODO : In CNR case, pxRequestor is not available, please remove this condition once it populates - if (!userName) { - return null; - } - - return ; -} - -Avatar.propTypes = { - metaObj: PropTypes.objectOf(PropTypes.any), - showStatus: PropTypes.bool -}; - -Avatar.defaultProps = { - metaObj: null, - showStatus: false -}; - -export default Avatar; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Operator.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Operator.jsx deleted file mode 100644 index cc1fb28c..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/Operator.jsx +++ /dev/null @@ -1,237 +0,0 @@ -/* eslint-disable no-undef */ -import { useState, useEffect, Fragment } from 'react'; -import { - Link, - Button, - Popover, - Flex, - useOuterEvent, - useElement, - Progress, - FormField, - useTheme -} from '@pega/cosmos-react-core'; -import { Glimpse } from '@pega/cosmos-react-work'; -import PropTypes from 'prop-types'; - -import Avatar from './Avatar.jsx'; - -const Operator = (props) => { - const { id, name, label, testId, helperText, externalUser, metaObj } = props; - const [isOpen, setIsOpen] = useState(false); - const [isLoading, setIsLoading] = useState(true); - const [popoverTarget, setPopoverTarget] = useState(null); - const [popoverEl, setPopoverEl] = useElement(null); - const [popoverContent, setpopoverContent] = useState(null); - const theme = useTheme(); - - /* If the id has changed, we need to reset the popover */ - useEffect(() => { - setPopoverTarget(null); - }, [id]); - - - - const OperatorPreview = () => { - const localizedVal = PCore.getLocaleUtils().getLocaleValue; - const localeCategory = 'Operator'; - setpopoverContent( - - ); - if (externalUser && externalUser.classID !== 'Data-Party-Operator') { - const fields = [ - { - id: 'pyFirstName', - name: localizedVal('Name', localeCategory), - value: externalUser.name - }, - { - id: 'pyEmail1', - name: localizedVal('Email', localeCategory), - value: - externalUser.email !== '' ? {externalUser.email} : '' - }, - { - id: 'pyPhoneNumber', - name: localizedVal('Phone', localeCategory), - value: externalUser.phone !== '' ? {externalUser.phone} : '' - } - ]; - setIsLoading(false); - setpopoverContent( - - } - primary={externalUser.name} - secondary={[externalUser.position]} - fields={fields} - /> - ); - } else { - const { getOperatorDetails } = PCore.getUserApi(); - getOperatorDetails(id) - .then((res) => { - if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) { - const fields = [ - { - id: 'pyOrganization', - name: localizedVal('Organization', localeCategory), - value: res.data.pyOperatorInfo.pyOrganization - }, - { - id: 'pyTelephone', - name: localizedVal('Telephone', localeCategory), - value: - res.data.pyOperatorInfo.pyTelephone !== '' ? ( - - {res.data.pyOperatorInfo.pyTelephone} - - ) : ( - '' - ) - }, - { - id: 'pyEmailAddress', - name: localizedVal('Email address', localeCategory), - value: - res.data.pyOperatorInfo.pyEmailAddress !== '' ? ( - - {res.data.pyOperatorInfo.pyEmailAddress} - - ) : ( - '' - ) - }, - { - id: 'ReportToUserName', - name: localizedVal('Reports to', localeCategory), - value: res.data.pyOperatorInfo.pyReportToUserName - } - ]; - setIsLoading(false); - setpopoverContent( - - } - primary={res.data.pyOperatorInfo.pyUserName} - secondary={[res.data.pyOperatorInfo.pyPosition]} - fields={fields} - /> - ); - } else { - setIsLoading(false); - setpopoverContent({localizedVal('Operator not found', localeCategory)}); - } - }) - .catch(() => { - setIsLoading(false); - setpopoverContent( - {localizedVal('Error loading the operator profile', localeCategory)} - ); - }); - } - }; - - - const clickAction = (e) => { - setPopoverTarget(e.currentTarget); - setIsOpen(!isOpen); - if (popoverTarget === null) { - OperatorPreview(); - } - }; - - const hidePopover = () => { - if (isOpen) { - setIsOpen(false); - } - }; - useOuterEvent('mousedown', [popoverEl, popoverTarget], hidePopover); // Call the method on clicking outside these elements - const hideOnEscape = (e) => { - if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed - }; - - const comp = ( - - {metaObj ? ( - - ) : ( - - )} - - {isOpen && ( - - {popoverContent} - - )} - - ); - - if (label !== null) { - return ( - - {comp} - - ); - } - - return comp; -}; - -Operator.propTypes = { - name: PropTypes.string, - id: PropTypes.string, - label: PropTypes.string, - testId: PropTypes.string, - helperText: PropTypes.string, - metaObj: PropTypes.object -}; - -Operator.defaultProps = { - name: '', - id: '', - label: null, - testId: null, - helperText: null, - metaObj: null -}; - -export default Operator; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx deleted file mode 100644 index 2528f406..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyPageCaseWidget from './index.jsx'; - -import { configProps, operatorDetails } from './mock.stories'; - -export default { - title: 'PegaDxilMyPageCaseWidget', - decorators: [withKnobs], - component: PegaDxilMyPageCaseWidget -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getLocaleUtils = () => { - return { - getLocaleValue: value => { - return value; - } - }; -}; - -window.PCore.getUserApi = () => { - return { - getOperatorDetails: () => { - return new Promise(resolve => { - resolve(operatorDetails); - }); - } - }; -}; - -export const basePegaDxilMyPageCaseWidget = () => { - - const props = { - label: configProps.label, - createLabel: configProps.createLabel, - updateLabel: configProps.updateLabel, - createOperator: configProps.createOperator, - updateOperator: configProps.updateOperator, - createDateTime: configProps.createDateTime, - updateDateTime: configProps.updateDateTime, - hideLabel: configProps.hideLabel, - - getPConnect: () => { - return { - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } -}; - -return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/index.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/index.jsx deleted file mode 100644 index c9903046..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/index.jsx +++ /dev/null @@ -1,108 +0,0 @@ -/* eslint-disable no-nested-ternary */ -import { Fragment } from 'react'; -import { DateTimeDisplay, Card, CardHeader, CardContent, Flex } from '@pega/cosmos-react-core'; -import PropTypes from 'prop-types'; - -// includes in bundle -import Operator from './Operator.jsx'; - -import StyledPegaDxilMyPageCaseWidgetWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyPageCaseWidget(props) { - - const { - getPConnect, - title, - label, - createLabel, - updateLabel, - createOperator, - updateOperator, - createDateTime, - updateDateTime, - resolveLabel, - resolveOperator, - resolveDateTime, - hideLabel - } = props; - - - const [_label, user, dateTimeValue] = - label === 'Create operator' - ? [createLabel, createOperator, createDateTime] - : label === 'Update operator' - ? [updateLabel, updateOperator, updateDateTime] - : [resolveLabel, resolveOperator, resolveDateTime]; - - - - return user.userId && user.userName ? ( - - - {title} - - - - - {dateTimeValue && ( - - {' '} - - - )} - - - - - - ) : ( - - defVal - - ); - - - -} - -PegaDxilMyPageCaseWidget.defaultProps = { - "label": "Create operator", - "title": "Create operator", - createLabel: null, - updateLabel: null, - createOperator: null, - updateOperator: null, - createDateTime: null, - updateDateTime: null, - resolveLabel: null, - resolveOperator: null, - resolveDateTime: null, - hideLabel: false -}; - -PegaDxilMyPageCaseWidget.propTypes = { - getPConnect: PropTypes.func.isRequired, - label: PropTypes.string, - title: PropTypes.string, - createLabel: PropTypes.string, - updateLabel: PropTypes.string, - resolveLabel: PropTypes.string, - createOperator: PropTypes.objectOf(PropTypes.any), - updateOperator: PropTypes.objectOf(PropTypes.any), - resolveOperator: PropTypes.objectOf(PropTypes.any), - createDateTime: PropTypes.string, - updateDateTime: PropTypes.string, - resolveDateTime: PropTypes.string, - hideLabel: PropTypes.bool -}; - -// as objects are there in props, shallow comparision fails & re-rendering of comp happens even with -// same key value pairs in obj. hence using custom comparison function on when to re-render -// const comparisonFn = (prevProps, nextProps) => { -// return prevProps.updateDateTime === nextProps.updateDateTime; -// }; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/mock.stories.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/mock.stories.js deleted file mode 100644 index 62fb4f20..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/mock.stories.js +++ /dev/null @@ -1,51 +0,0 @@ -export const configProps = { - label: 'Create operator', - createLabel: 'Created', - updateLabel: 'Updated', - updateDateTime: '2023-01-16T14:53:33.280Z', - createDateTime: '2023-01-16T14:53:33.198Z', - updateOperator: { - userId: 'admin@mediaco', - userName: 'admin' - }, - createOperator: { - userId: 'admin@mediaco', - userName: 'admin' - }, - hideLabel: true, - key: '_532zx1dah', - displayMode: 'LABELS_LEFT' -}; - -export const operatorDetails = { - data: { - pzLoadTime: 'January 18, 2023 10:33:19 AM EST', - pzPageNameHash: '_pa1519192551088960pz', - pyOperatorInfo: { - pyUserName: 'french DigV2', - pyPosition: '', - pyImageInsKey: '', - pySkills: [ - { - pySkillName: '', - pzIndexOwnerKey: 'DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2', - pySkillRating: 0 - } - ], - pyReportToUserName: '', - pyReportTo: '', - pyOrganization: 'DXIL', - pyTitle: '', - pyLabel: 'frenchTest.DigV2', - pyEmailAddress: 'User@DigV2', - pyTelephone: '' - } - }, - status: 200, - statusText: '', - headers: { - 'content-length': '435', - 'content-type': 'application/json;charset=UTF-8' - }, - request: {} -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/styles.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/OneColumnPage.svg b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/demo.stories.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/demo.stories.jsx deleted file mode 100644 index aef7480b..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/demo.stories.jsx +++ /dev/null @@ -1,30 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyPageWidget from './index.jsx'; - - -import configProps from './mock.stories'; - -export default { - title: 'PegaDxilMyPageWidget', - decorators: [withKnobs], - component: PegaDxilMyPageWidget -}; - -export const basePegaDxilMyPageWidget = () => { - - const props = { - label: configProps.label, - header: configProps.header, - description: configProps.description, - image: configProps.image, - datasource: configProps.datasource, - whatsnewlink: configProps.whatsnewlink -}; - -return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/index.jsx b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/index.jsx deleted file mode 100644 index f4ce3dcc..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/index.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import PropTypes from 'prop-types'; -import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work'; - -import StyledPegaDxilMyPageWidgetWrapper from './styles'; - - -// Duplicated runtime code from Constellation Design System Component - -// props passed in combination of props from property panel (config.json) and run time props from Constellation -// any default values in config.pros should be set in defaultProps at bottom of this file -export default function PegaDxilMyPageWidget(props) { - - const { header, description, datasource, whatsnewlink, image } = props; - let details = []; - if (datasource && datasource.source) { - details = datasource.source.map((item) => { - return item.name; - }); - } - return ( - - - - ); - -} - -PegaDxilMyPageWidget.defaultProps = { - header: '', - description: '', - image: '', - datasource: [], - whatsnewlink: '' -}; - -PegaDxilMyPageWidget.propTypes = { - header: PropTypes.string, - description: PropTypes.string, - datasource: PropTypes.instanceOf(Object), - whatsnewlink: PropTypes.string, - image: PropTypes.string -}; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/mock.stories.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/mock.stories.js deleted file mode 100644 index 93ebf940..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/mock.stories.js +++ /dev/null @@ -1,23 +0,0 @@ -const configProps = { - label: 'App announcement', - header: 'Announcements', - description: 'Welcome to MediaCo Application for testing SDK frameworks.', - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8 PC9zdmc ', - datasource: { - source: [ - { - name: 'New React based UI rendering' - }, - { - name: 'Support for followers and recents' - }, - { - name: 'New authoring experience' - } - ], - fields: {} - } -}; -export default configProps; diff --git a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/styles.js b/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/styles.js deleted file mode 100644 index 633cb0e9..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -// utilizing theming, comment out, if want individual style -import styled from 'styled-components'; -import { Configuration } from '@pega/cosmos-react-core'; - -export default styled(Configuration)``; - -// individual style, comment out above, and uncomment here and add styles -// import styled, { css } from 'styled-components'; -// -// export default styled.div(() => { -// return css` -// margin: 0px 0; -// `; -// }); diff --git a/tests/assets/components/createAll/custom-constellation/widget/_widget.md b/tests/assets/components/createAll/custom-constellation/widget/_widget.md deleted file mode 100644 index 11871a8a..00000000 --- a/tests/assets/components/createAll/custom-constellation/widget/_widget.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **custom-constellation/widget** directory - -The **src/components/custom-constellation/widget** directory contains the code for the Constellation-based associated component for any custom **widget** component you have created for use with the **Angular SDK**. - -For each component in the **src/components/custom-constellation/widget** directory, there will be a matching component in the **src/components/custom-sdk/widget** directory. diff --git a/tests/assets/components/createAll/custom-sdk/_custom-sdk.md b/tests/assets/components/createAll/custom-sdk/_custom-sdk.md deleted file mode 100644 index d19acbaf..00000000 --- a/tests/assets/components/createAll/custom-sdk/_custom-sdk.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/custom-sdk** directory - -The **src/components/custom-sdk** directory contains the code for custom components that you create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new components, the generated code that you can use as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/custom-sdk**. diff --git a/tests/assets/components/createAll/custom-sdk/field/_field.md b/tests/assets/components/createAll/custom-sdk/field/_field.md deleted file mode 100644 index 99d479f7..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/_field.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/field** directory - -The **src/components/custom-sdk/field** directory contains the code for the custom **field** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _field_ components, the generated code that you can use as a starting point for your component development -will be placed in component-specific folders in **src/components/custom-sdk/field**. diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/config.json deleted file mode 100644 index dd93b887..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "Pega_DXIL_MyBoolean", - "label": "My Boolean", - "description": "My Boolean", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyBoolean", - "type": "Field", - "subtype": "Boolean", - "icon": "images/pz-checkbox-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT" - }, - { - "name": "hideLabel", - "label": "Hide Label", - "format": "BOOLEAN" - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "caption", - "label": "Caption", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/demo.stories.jsx deleted file mode 100644 index de9fd078..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/demo.stories.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import { useState } from 'react'; -import { withKnobs } from '@storybook/addon-knobs'; - -import { configProps, stateProps } from './mock.stories'; - -import PegaDxilMyBoolean from './index.tsx'; - -export default { - title: 'PegaDxilMyBoolean', - decorators: [withKnobs], - component: PegaDxilMyBoolean -}; - -export const BasePegaDxilMyBoolean = () => { - const [value, setValue] = useState(configProps.value); - - const props = { - value, - label: configProps.label, - helperText: configProps.helperText, - caption: configProps.caption, - testId: configProps.testId, - trueLabel: configProps.trueLabel, - falseLabel: configProps.falseLabel, - - getPConnect: () => { - return { - getStateProps: () => { - return stateProps; - }, - getConfigProps: () => { - return configProps; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, theValue) => { - setValue(theValue); - }, - triggerFieldChange: () => { /* nothing */} - }; - }, - getValidationApi: () => { - return { - validate: () => { /* nothing */} - }; - } - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/mock.stories.js b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/mock.stories.js deleted file mode 100644 index d667da90..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/mock.stories.js +++ /dev/null @@ -1,15 +0,0 @@ -export const configProps = { - "caption": "Boolean Caption", - "value": false, - "trueLabel": "Yes", - "falseLabel": "No", - "label": "Boolean Sample", - "helperText": "Boolean Helper Text", - "testId": "boolean-12345678", - "hasSuggestions": false -}; - -export const stateProps = { - "value": ".BooleanSample", - "hasSuggestions": false -}; \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.html deleted file mode 100644 index 291e1587..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
- -
- -
-
-
- - - - {{ caption$ }} -
-
- {{ caption$ }} -
-
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.scss deleted file mode 100644 index 767c7526..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -.psdk-full-width { - min-width: 9.375rem; - width: 100%; - text-align: left; -} - -.psdk-label-readonly { - top: 0rem; - margin-top: 0.625rem; - font-size: 0.875rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.spec.ts deleted file mode 100644 index 17c2e4a7..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyBooleanComponent } from './pega-dxil-my-boolean.component'; - -describe('PegaDxilMyBooleanComponent', () => { - let component: PegaDxilMyBooleanComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyBooleanComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyBooleanComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.ts deleted file mode 100644 index a93c6e3e..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-boolean', - templateUrl: './pega-dxil-my-boolean.component.html', - styleUrls: ['./pega-dxil-my-boolean.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyBooleanComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: any = ''; - caption$: string = ''; - testId: string = ''; - showLabel$: boolean = false; - checkboxLabelPos$ = 'after'; - isChecked$: boolean = false; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - this.caption$ = this.configProps$['caption']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - if (this.label$ != '') { - this.showLabel$ = true; - } - - if (this.value$ === 'true' || this.value$ == true) { - this.isChecked$ = true; - } else { - this.isChecked$ = false; - } - } - - fieldOnChange(event: any) { - event.value = event.checked; - - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - event.value = event.checked; - this.angularPConnectData.actions.onBlur(this, event); - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/config.json deleted file mode 100644 index e4729d98..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/config.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "name": "Pega_DXIL_MyCurrency", - "label": "My Currency", - "description": "My Currency", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyCurrency", - "type": "Field", - "subtype": "Decimal-Currency", - "icon": "images/pz-currency-active.svg", - "properties": [ - { - "name": "label", - "label": "Label value", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "CASCADE", - "source": { - "format": "SELECT", - "label": "ISO Code Selection", - "name": "isoCodeSelection", - "defaultValue": "constant", - "source": [ - { - "key": "constant", - "value": "Constant" - }, - { - "key": "propertyRef", - "value": "Property Reference" - } - ] - }, - "cascadeElements": [ - { - "key": "currencyISOCode", - "format": "TEXT", - "name": "currencyISOCode", - "label": "Currency ISO Code", - "defaultValue": "USD", - "match": "constant" - }, - { - "key": "currencyISOCode", - "format": "PROPERTY", - "name": "currencyISOCode", - "label": "Currency ISO Code", - "match": "propertyRef" - } - ] - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "allowDecimals", - "label": "Allow Decimals", - "format": "BOOLEAN", - "defaultValue": true - }, - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.html deleted file mode 100644 index 2dfc9fde..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.html +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.spec.ts deleted file mode 100644 index 01a2e3f3..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyCurrencyComponent } from './pega-dxil-my-currency.component'; - -describe('PegaDxilMyCurrencyComponent', () => { - let component: PegaDxilMyCurrencyComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyCurrencyComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyCurrencyComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.ts deleted file mode 100644 index cb3ac4ec..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-currency', - templateUrl: './pega-dxil-my-currency.component.html', - styleUrls: ['./pega-dxil-my-currency.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyCurrencyComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - this.value$ = nValue && typeof nValue == 'string' ? parseFloat(nValue) : nValue; - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/config.json deleted file mode 100644 index 03fc53eb..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/config.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "name": "Pega_DXIL_MyDateTime", - "label": "My DateTime", - "description": "My DateTime", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyDateTime", - "type": "Field", - "subtype": "DateTime", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "SELECT", - "name": "clockFormat", - "label": "Clock", - "defaultValue": "use locale", - "source": [ - { - "key": 0, - "value": "use locale" - }, - { - "key": 12, - "value": "12 hours" - }, - { - "key": 24, - "value": "24 hours" - } - ] - }, - { - "name": "withSeconds", - "label": "Display Seconds", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "LABEL", - "label": "Year range", - "variant": "secondary" - }, - { - "format": "INLINE", - "elements": [ - { - "key": "next", - "format": "LABEL", - "label": "Next", - "variant": "secondary" - }, - { - "key": "nextYears", - "format": "NUMBER", - "label": "", - "name": "nextYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "format": "INLINE", - "elements": [ - { - "key": "previous", - "format": "LABEL", - "label": "Previous", - "variant": "secondary" - }, - { - "key": "previousYears", - "format": "NUMBER", - "label": "", - "name": "previousYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "name": "showWeekNumber", - "label": "Display week numbers on calendar", - "format": "BOOLEAN" - }, - { - "format": "SELECT", - "name": "pickerInterval", - "label": "Time picker", - "defaultValue": "30", - "source": [ - { - "key": "5", - "value": "5 min" - }, - { - "key": "10", - "value": "10 min" - }, - { - "key": "15", - "value": "15 min" - }, - { - "key": "20", - "value": "20 min" - }, - { - "key": "30", - "value": "30 min" - }, - { - "key": "60", - "value": "1 hr" - } - ] - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Read-only settings", - "format": "GROUP", - "properties": [ - { - "name": "showAsFormattedText", - "label": "Show as formatted text", - "format": "BOOLEAN" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.html deleted file mode 100644 index cc153d21..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.spec.ts deleted file mode 100644 index dd255cc5..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PegaDxilMyDateTimeComponent } from './pega-dxil-my-date-time.component'; - -describe('PegaDxilMyDateTimeComponent', () => { - let component: PegaDxilMyDateTimeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PegaDxilMyDateTimeComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyDateTimeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.ts deleted file mode 100644 index fa38d6ce..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-date-time', - templateUrl: './pega-dxil-my-date-time.component.html', - styleUrls: ['./pega-dxil-my-date-time.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyDateTimeComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: any; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.testId = this.configProps$['testId']; - if (this.configProps$['value'] != undefined) { - const value = this.configProps$['value']; - this.value$ = value ? value.replace('Z', '') : value; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - if (event.target.value) { - event.value = event.target.value; - } - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - if (event.target.value) event.value = event.target.value; - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/config.json deleted file mode 100644 index 335c5dad..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/config.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "name": "Pega_DXIL_MyDate", - "label": "My Date", - "description": "My Date", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyDate", - "type": "Field", - "subtype": "Date", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "LABEL", - "label": "Year range", - "variant": "secondary" - }, - { - "format": "INLINE", - "elements": [ - { - "key": "next", - "format": "LABEL", - "label": "Next", - "variant": "secondary" - }, - { - "key": "nextYears", - "format": "NUMBER", - "label": "", - "name": "nextYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "format": "INLINE", - "elements": [ - { - "key": "previous", - "format": "LABEL", - "label": "Previous", - "variant": "secondary" - }, - { - "key": "previousYears", - "format": "NUMBER", - "label": "", - "name": "previousYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "name": "showWeekNumber", - "label": "Display week numbers on calendar", - "format": "BOOLEAN" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Read-only settings", - "format": "GROUP", - "properties": [ - { - "name": "showAsFormattedText", - "label": "Show as formatted text", - "format": "BOOLEAN" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.html deleted file mode 100644 index 106d9615..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.spec.ts deleted file mode 100644 index 7a882a17..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyDateComponent } from './pega-dxil-my-date.component'; - -describe('PegaDxilMyDateComponent', () => { - let component: PegaDxilMyDateComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyDateComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyDateComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.ts deleted file mode 100644 index 142f88a2..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatNativeDateModule } from '@angular/material/core'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-date', - templateUrl: './pega-dxil-my-date.component.html', - styleUrls: ['./pega-dxil-my-date.component.scss'], - standalone: true, - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatDatepickerModule, - MatNativeDateModule, - TextComponent, - FieldValueListComponent - ] -}) -export class PegaDxilMyDateComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - label$: string = ''; - value$: any; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - let sDateValue: any = ''; - sDateValue = this.configProps$['value']; - - if (sDateValue != '') { - if (typeof sDateValue == 'object') { - sDateValue = sDateValue.toISOString(); - } else if (sDateValue.indexOf('/') < 0) { - // if we have the "pega" format, then for display, convert to standard format (US) - // sDateValue = this.formatDate(sDateValue); - sDateValue = this.utils.generateDate(sDateValue, 'Date-Long-Custom-YYYY'); - } - this.value$ = new Date(sDateValue); - } - } - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnDateChange(event: any, sValue: string) { - // this comes from the date pop up - if (typeof event.value == 'object') { - // convert date to pega "date" format - event.value = event.value.toISOString(); - } - this.angularPConnectData.actions.onChange(this, { value: event.value }); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - if (typeof event.value == 'object') { - event.value = event.value.toISOString(); - // convert date to pega "date" format - event.value = event.value.toISOString(); - } - this.angularPConnectData.actions.onBlur(this, { value: event.value }); - } - - hasErrors() { - return this.fieldControl.status === 'INVALID'; - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = `${this.fieldControl.errors.matDatepickerParse.text} is not a valid date value`; - } - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/config.json deleted file mode 100644 index 059c14f5..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "Pega_DXIL_MyDecimal", - "label": "My Decimal", - "description": "My Decimal", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyDecimal", - "type": "Field", - "subtype": "Decimal", - "icon": "images/pz-decimal-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "decimalPrecision", - "label": "Decimal places", - "format": "NUMBER", - "min": 0 - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.html deleted file mode 100644 index 03036c89..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.spec.ts deleted file mode 100644 index f63d3837..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyDecimalComponent } from './pega-dxil-my-decimal.component'; - -describe('PegaDxilMyDecimalComponent', () => { - let component: PegaDxilMyDecimalComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyDecimalComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyDecimalComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.ts deleted file mode 100644 index 81ca2e17..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-decimal', - templateUrl: './pega-dxil-my-decimal.component.html', - styleUrls: ['./pega-dxil-my-decimal.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyDecimalComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseFloat(nValue); - } - this.value$ = nValue; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - this.componentReference = this.pConn$.getStateProps().value; - } - - fieldOnChange(event: any) { - // this.angularPConnect.changeHandler( this, event ); - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/config.json deleted file mode 100644 index f24dc5d3..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "Pega_DXIL_MyEmail", - "label": "My Email", - "description": "My Email", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyEmail", - "type": "Field", - "subtype": "Text-Email", - "icon": "images/pz-email-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.html deleted file mode 100644 index 499e72d0..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.spec.ts deleted file mode 100644 index 606d5cec..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyEmailComponent } from './pega-dxil-my-email.component'; - -describe('PegaDxilMyEmailComponent', () => { - let component: PegaDxilMyEmailComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyEmailComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyEmailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.ts deleted file mode 100644 index ba126a38..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-email/pega-dxil-my-email.component.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-email', - templateUrl: './pega-dxil-my-email.component.html', - styleUrls: ['./pega-dxil-my-email.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyEmailComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/config.json deleted file mode 100644 index 88979bea..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/config.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "Pega_DXIL_MyInteger", - "label": "My Integer", - "description": "My Integer", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyInteger", - "type": "Field", - "subtype": "Integer", - "icon": "images/pz-integer-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.html deleted file mode 100644 index b61419c9..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.html +++ /dev/null @@ -1,30 +0,0 @@ - -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.spec.ts deleted file mode 100644 index f994c117..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyIntegerComponent } from './pega-dxil-my-integer.component'; - -describe('PegaDxilMyIntegerComponent', () => { - let component: PegaDxilMyIntegerComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyIntegerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyIntegerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.ts deleted file mode 100644 index 0df13520..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-integer/pega-dxil-my-integer.component.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-integer', - templateUrl: './pega-dxil-my-integer.component.html', - styleUrls: ['./pega-dxil-my-integer.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyIntegerComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseInt(nValue); - } - this.value$ = nValue; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/config.json deleted file mode 100644 index f84e9697..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "Pega_DXIL_MyParagraph", - "label": "My Paragraph", - "description": "My Paragraph", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyParagraph", - "type": "Field", - "subtype": "Text-Paragraph", - "icon": "images/pz-text-area-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.html deleted file mode 100644 index 7e2962bd..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
-
- - - {{ getErrorMessage() }} - -
-
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.spec.ts deleted file mode 100644 index d3d2a7ba..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyParagraphComponent } from './pega-dxil-my-paragraph.component'; - -describe('PegaDxilMyParagraphComponent', () => { - let component: PegaDxilMyParagraphComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyParagraphComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyParagraphComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.ts deleted file mode 100644 index 313988ad..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/pega-dxil-my-paragraph.component.ts +++ /dev/null @@ -1,179 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-paragraph', - templateUrl: './pega-dxil-my-paragraph.component.html', - styleUrls: ['./pega-dxil-my-paragraph.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PegaDxilMyParagraphComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - nMaxLength$: number; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.nMaxLength$ = this.pConn$.getFieldMetadata(this.pConn$.getRawConfigProps()?.value)?.maxLength || 100; - this.testId = this.configProps$['testId']; - this.displayMode$ = this.configProps$['displayMode']; - this.label$ = this.configProps$['label']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - // PConnect wants to use changeHandler for onChange - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/config.json deleted file mode 100644 index da8bef1c..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "Pega_DXIL_MyPercentage", - "label": "My Percentage", - "description": "My Percentage", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPercentage", - "type": "Field", - "subtype": "Decimal-Percentage", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "decimalPrecision", - "label": "Decimal places", - "format": "NUMBER", - "min": 0 - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.html deleted file mode 100644 index 2c4da1db..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.html +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.scss deleted file mode 100644 index af04528b..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; - } - - .psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(.75) perspective(100px) translateZ(.001px); - -ms-transform: translateY(-1.28125em) scale(.75); - width: 133.33333%; - } - - .psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; - } - - ::ng-deep .mat-mdc-form-field-infix { - width: auto; - } \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.spec.ts deleted file mode 100644 index 3691b681..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PegaDxilMyPercentageComponent } from './pega-dxil-my-percentage.component'; - -describe('PegaDxilMyPercentageComponent', () => { - let component: PegaDxilMyPercentageomponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPercentageComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPercentageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.ts deleted file mode 100644 index ac3e9598..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-percentage', - templateUrl: './pega-dxil-my-percentage.component.html', - styleUrls: ['./pega-dxil-my-percentage.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyPercentageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseInt(nValue); - } - this.value$ = nValue; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/config.json deleted file mode 100644 index e7d1b669..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/config.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "name": "Pega_DXIL_MyPhone", - "label": "My Phone", - "description": "My Phone", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPhone", - "type": "Field", - "subtype": "Text-Phone", - "icon": "images/pz-phone-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "showCountryCode", - "label": "Show Country Code", - "format": "BOOLEAN", - "defaultValue": true - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label", - "datasource": { - "source": "@DATASOURCE D_pyCountryCallingCodeList.pxResults", - "fields": { - "value": "@P .pyCallingCode" - } - } - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.html deleted file mode 100644 index 5b8bf052..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
-
- - - - {{ getErrorMessage() }} - -
-
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.scss deleted file mode 100644 index 40d8f616..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.scss +++ /dev/null @@ -1,81 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.phone-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -::ng-deep .iti { - display: block !important; - margin-bottom: 20px; - - .dropdown-menu.country-dropdown { - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-color: #c7cace; - margin-top: -1px; - } - - .iti__country-list { - box-shadow: none; - font-size: 14px; - margin-left: 0; - width: 244px; - max-height: 170px; - } - - .search-container input { - font-size: 14px; - border-color: #c7cace; - border-radius: 0; - padding: 5px 10px; - } - - .search-container input:focus { - outline: none; - } -} - -::ng-deep .iti__flag-container.open + input { - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - -::ng-deep ngx-mat-intl-tel-input { - .country-selector { - opacity: 1 !important; - bottom: 8px !important; - } - - input:not(.country-search) { - bottom: 3px; - left: 10px; - } - - .country-list-button { - font-size: 0.8rem !important; - } - - .mat-menu-content:not(:empty) { - max-height: 250px; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.spec.ts deleted file mode 100644 index aed2e13c..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyPhoneComponent } from './pega-dxil-my-phone.component'; - -describe('PegaDxilMyPhoneComponent', () => { - let component: PegaDxilMyPhoneComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPhoneComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPhoneComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.ts deleted file mode 100644 index ed32fe91..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-phone/pega-dxil-my-phone.component.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input'; -import { Utils } from '@pega/angular-sdk-library'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { handleEvent } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-phone', - templateUrl: './pega-dxil-my-phone.component.html', - styleUrls: ['./pega-dxil-my-phone.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, NgxMatIntlTelInputComponent, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyPhoneComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - separateDialCode = false; - afterBlur: boolean; - - fieldControl = new FormControl('', null); - - phoneForm = new FormGroup({ - phone: new FormControl(undefined) - }); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.testId = this.configProps$['testId']; - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - if (this.bReadonly$) { - this.phoneForm.setValue({ phone: this.value$ }); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - if (this.formGroup$.controls[this.controlName$].value) { - const actionsApi = this.pConn$?.getActionsApi(); - const propName = this.pConn$?.getStateProps().value; - const value = this.formGroup$.controls[this.controlName$].value; - const eventObj = { - target: { - value - } - }; - this.afterBlur = true; - this.angularPConnectData.actions.onChange(this, eventObj); - handleEvent(actionsApi, 'blur', propName, value); - } - } - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = 'Invalid Phone'; - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/config.json deleted file mode 100644 index ae0d4cbc..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/config.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "Pega_DXIL_MyPicklist", - "label": "My Picklist", - "description": "My Picklist", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPicklist", - "type": "Field", - "subtype": "Picklist", - "icon": "images/pz-dropdown-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label", - "placeholder": "@L Select...", - "listType": "associated", - "datasource": "@ASSOCIATED .$this.name" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.html deleted file mode 100644 index 349a06d0..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - - - {{ opt.value }} - - - {{ label$ }} - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.scss deleted file mode 100644 index 1f792ffe..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.scss +++ /dev/null @@ -1,25 +0,0 @@ -.psdk-form { - min-width: 9.375rem; - width: 100%; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.spec.ts deleted file mode 100644 index 1d87f6c6..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyPicklistComponent } from './pega-dxil-my-picklist.component'; - -describe('PegaDxilMyPicklistComponent', () => { - let component: PegaDxilMyPicklistComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPicklistComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPicklistComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.ts deleted file mode 100644 index bd8b4e07..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatOptionModule } from '@angular/material/core'; -import { MatSelectModule } from '@angular/material/select'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-picklist', - templateUrl: './pega-dxil-my-picklist.component.html', - styleUrls: ['./pega-dxil-my-picklist.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatOptionModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyPicklistComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - options$: Array; - componentReference: string = ''; - testId: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - this.displayMode$ = this.configProps$['displayMode']; - this.label$ = this.configProps$['label']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject()); - optionsList?.unshift({ key: 'Select', value: 'Select...' }); - this.options$ = optionsList; - if (this.value$ === '' && !this.bReadonly$) { - this.value$ = 'Select'; - } - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - isSelected(buttonValue: string): boolean { - if (this.value$ === buttonValue) { - return true; - } - - return false; - } - - fieldOnChange(event: any) { - if (event?.value === 'Select') { - event.value = ''; - } - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/config.json deleted file mode 100644 index 06571142..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "Pega_DXIL_MyTextInput", - "label": "My Text Input", - "description": "My Text Input", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyTextInput", - "type": "Field", - "subtype": "Text", - "icon": "images/pz-url-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.html deleted file mode 100644 index 9e180e82..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.spec.ts deleted file mode 100644 index 2aab5616..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTextInputComponent } from './pega-dxil-my-text-input.component'; - -describe('PegaDxilMyTextInputComponent', () => { - let component: PegaDxilMyTextInputComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTextInputComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTextInputComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.ts deleted file mode 100644 index 335257a9..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text-input/pega-dxil-my-text-input.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-text-input', - templateUrl: './pega-dxil-my-text-input.component.html', - styleUrls: ['./pega-dxil-my-text-input.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyTextInputComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - testId: string = ''; - bHasForm$: boolean = true; - componentReference: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - // this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - this.componentReference = this.pConn$.getStateProps().value; - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/config.json deleted file mode 100644 index ce4cedd5..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "Pega_DXIL_MyText", - "label": "My Text", - "description": "My Text", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyText", - "type": "Field", - "subtype": "Text", - "icon": "images/pz-url-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.html deleted file mode 100644 index d135b05c..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
- -
- - - -
- - {{ formattedValue$ }} -
-
-
diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.scss deleted file mode 100644 index bee2b661..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.scss +++ /dev/null @@ -1,30 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.spec.ts deleted file mode 100644 index 282a65d2..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTextComponent } from './pega-dxil-my-text.component'; - -describe('PegaDxilMyTextComponent', () => { - let component: PegaDxilMyTextComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTextComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTextComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.ts deleted file mode 100644 index 1a62a118..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-text/pega-dxil-my-text.component.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-text', - templateUrl: './pega-dxil-my-text.component.html', - styleUrls: ['./pega-dxil-my-text.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PegaDxilMyTextComponent implements OnInit { - @Input() pConn$: any; - @Input() formatAs$: string; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - componentReference: string = ''; - formattedValue$: string; - format$: string = 'text'; - formattedUrl$: string = ''; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - - // call updateSelf when initializing - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - // TDB - get formats - switch (this.formatAs$) { - case 'text': - this.formattedValue$ = this.value$; - break; - case 'date': - this.formattedValue$ = this.generateDate(this.value$); - break; - case 'date-time': - this.formattedValue$ = this.generateDateTime(this.value$); - break; - case 'time': - if (this.value$) { - const timeParts = this.value$.split(':'); - this.formattedValue$ = `${timeParts[0]}:${timeParts[1]}`; - } else { - this.formattedValue$ = ''; - } - break; - case 'url': - this.formattedUrl$ = this.generateUrl(this.value$); - this.formattedValue$ = this.value$; - break; - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - generateUrl(sVal): string { - if (sVal.indexOf('https://') == 0 || sVal.indexOf('http://') == 0) { - } else { - // assume no http - sVal = 'http://' + sVal; - } - - return sVal; - } - - generateDate(sVal): string { - if (!sVal) return ''; - // const value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric' - // }).format(new Date(sVal + "T00:00")); - - return this.utils.generateDate(sVal, 'Date-Long-Custom-YYYY'); - } - - generateDateTime(sVal): string { - if (!sVal) return ''; - if (sVal.length === 10) return this.generateDate(sVal); - let value = sVal.substring(0, sVal.length - 1); - // value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric', - // hour: 'numeric', - // minute: 'numeric', - // second: 'numeric', - // hour12: true, - // }).format(new Date(value)) - - return this.utils.generateDateTime(value, 'DateTime-Long-YYYY-Custom'); - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/config.json deleted file mode 100644 index d4add5b5..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/config.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "name": "Pega_DXIL_MyTimeOfDay", - "label": "My TimeOfDay", - "description": "My TimeOfDay", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyTimeOfDay", - "type": "Field", - "subtype": "TimeOfDay", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "SELECT", - "name": "clockFormat", - "label": "Clock", - "defaultValue": "use locale", - "source": [ - { - "key": 0, - "value": "use locale" - }, - { - "key": 12, - "value": "12 hours" - }, - { - "key": 24, - "value": "24 hours" - } - ] - }, - { - "name": "withSeconds", - "label": "Display Seconds", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "SELECT", - "name": "pickerInterval", - "label": "Time picker", - "defaultValue": "30", - "source": [ - { - "key": "5", - "value": "5 min" - }, - { - "key": "10", - "value": "10 min" - }, - { - "key": "15", - "value": "15 min" - }, - { - "key": "20", - "value": "20 min" - }, - { - "key": "30", - "value": "30 min" - }, - { - "key": "60", - "value": "1 hr" - } - ] - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.html deleted file mode 100644 index 5f343c50..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.spec.ts deleted file mode 100644 index 170186ed..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTimeOfDayComponent } from './pega-dxil-my-time-of-day.component'; - -describe('PegaDxilMyTimeOfDayComponent', () => { - let component: PegaDxilMyTimeOfDayComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTimeOfDayComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTimeOfDayComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.ts deleted file mode 100644 index 176d4a00..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/pega-dxil-my-time-of-day.component.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-time-of-day', - templateUrl: './pega-dxil-my-time-of-day.component.html', - styleUrls: ['./pega-dxil-my-time-of-day.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyTimeOfDayComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - event.value = event.target.value; - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - event.value = event.target.value; - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/config.json b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/config.json deleted file mode 100644 index 26b75710..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/config.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "Pega_DXIL_MyURL", - "label": "My URL", - "description": "My URL", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyURL", - "type": "Field", - "subtype": "Text-URL", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Column settings", - "format": "GROUP", - "visibility": "@VIEWTYPE == 'MultiRecordDisplayAsTable'", - "properties": [ - { - "name": "columnWidth", - "label": "Column width", - "format": "SELECT", - "source": [ - { - "key": "auto", - "value": "Auto" - }, - { - "key": "custom", - "value": "Custom" - } - ] - }, - { - "name": "width", - "label": "Width (px)", - "format": "NUMBER", - "visibility": "$this.columnWidth == 'custom'" - } - ] - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - }, - { - "label": "Advanced", - "format": "GROUP", - "collapsible": true, - "properties": [ - { - "name": "testId", - "label": "Test ID", - "format": "TEXT", - "ignorePattern": "[^-_\\p{N}\\p{L}]", - "includeAnnotations": false - } - ] - } - ], - "defaultConfig": { - "label": "@L $this.label" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.html b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.html deleted file mode 100644 index a326928b..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.scss b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.spec.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.spec.ts deleted file mode 100644 index e71145d7..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ - -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyUrlComponent } from './pega-dxil-my-url.component'; - -describe('PegaDxilMyUrlComponent', () => { - let component: PegaDxilMyUrlComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyUrlComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyUrlComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.ts b/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.ts deleted file mode 100644 index dde834bb..00000000 --- a/tests/assets/components/createAll/custom-sdk/field/pega-dxil-my-url/pega-dxil-my-url.component.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { TextComponent } from '@pega/angular-sdk-library'; -import { FieldValueListComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-url', - templateUrl: './pega-dxil-my-url.component.html', - styleUrls: ['./pega-dxil-my-url.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, TextComponent, FieldValueListComponent] -}) -export class PegaDxilMyUrlComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/template/_template.md b/tests/assets/components/createAll/custom-sdk/template/_template.md deleted file mode 100644 index f5875c69..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/_template.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/template** directory - -The **src/components/custom-sdk/template** directory contains the code for the custom **template** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _template_ components, the generated code that you can use as a starting point for your component development -will be placed in component-specific folders in **src/components/custom-sdk/template**. diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/DefaultForm.svg b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/DefaultForm.svg deleted file mode 100644 index 9fe86e70..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/DefaultForm.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - 2 col copy - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/config.json b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/config.json deleted file mode 100644 index fadc5560..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/config.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Pega_DXIL_MyDetails", - "label": "My Details", - "description": "My Details", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyDetails", - "type": "Template", - "subtype": "DETAILS", - "icon": "DefaultForm.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/demo.stories.jsx deleted file mode 100644 index 0d1cffee..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/demo.stories.jsx +++ /dev/null @@ -1,71 +0,0 @@ -import { withKnobs } from "@storybook/addon-knobs"; - -import PegaDxilMyDetails from "./index.tsx"; - -import operatorDetails, { pyReviewRaw } from "./mock.stories"; - -export default { - title: "PegaDxilMyDetails", - decorators: [withKnobs], - component: PegaDxilMyDetails, - parameters: { - type: "Details", - }, -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getUserApi = () => { - return { - getOperatorDetails: () => { - return new Promise((resolve) => { - resolve(operatorDetails); - }); - }, - }; -}; - -window.PCore.getEnvironmentInfo = () => { - return { - getUseLocale: () => { - return "en-US"; - }, - }; -}; - -export const BasePegaDxilMyDetails = () => { - const props = { - NumCols: "1", - template: "DefaultForm", - showHighlightedData: false, - label: "Details", - showLabel: true, - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children[0].children; - }, - getRawMetadata: () => { - return pyReviewRaw; - }, - getInheritedProps: () => { - return pyReviewRaw.config.inheritedProps; - }, - setInheritedProp: () => { - /* nothing */ - }, - resolveConfigProps: () => { - /* nothing */ - }, - }; - }, - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/mock.stories.js b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/mock.stories.js deleted file mode 100644 index 7ad86b15..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/mock.stories.js +++ /dev/null @@ -1,294 +0,0 @@ -const operatorDetails = { - data: { - pzLoadTime: "January 18, 2023 10:33:19 AM EST", - pzPageNameHash: "_pa1519192551088960pz", - pyOperatorInfo: { - pyUserName: "french DigV2", - pyPosition: "", - pyImageInsKey: "", - pySkills: [ - { - pySkillName: "", - pzIndexOwnerKey: "DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2", - pySkillRating: 0, - }, - ], - pyReportToUserName: "", - pyReportTo: "", - pyOrganization: "DXIL", - pyTitle: "", - pyLabel: "frenchTest.DigV2", - pyEmailAddress: "User@DigV2", - pyTelephone: "", - }, - }, - status: 200, - statusText: "", - headers: { - "content-length": "435", - "content-type": "application/json;charset=UTF-8", - }, - request: {}, -}; - -export default operatorDetails; - -export const pyReviewRaw = { - name: "pyReview", - type: "View", - config: { - template: "Details", - ruleClass: "MyCo-MyCompon-Work-MyComponents", - showLabel: true, - label: "@L Details", - localeReference: "@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW", - showHighlightedData: true, - highlightedData: [ - { - type: "TextInput", - config: { - value: "@P .pyStatusWork", - label: "@L Work Status", - displayMode: "STACKED_LARGE_VAL", - displayAsStatus: true, - }, - }, - { - type: "TextInput", - config: { - value: "@P .pyID", - label: "@L Case ID", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "DateTime", - config: { - value: "@P .pxCreateDateTime", - label: "@L Create date/time", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "UserReference", - config: { - label: "@L Create Operator", - value: "@USER .pxCreateOperator", - placeholder: "Select...", - displayMode: "STACKED_LARGE_VAL", - }, - }, - ], - inheritedProps: [ - { - prop: "label", - value: "@L Details", - }, - { - prop: "showLabel", - value: true, - }, - ], - }, - children: [ - { - name: "A", - type: "Region", - getPConnect: () => { - return { - getRawMetadata: () => { - return pyReviewRaw.children[0]; - }, - }; - }, - children: [ - { - readOnly: undefined, - placeholder: "First Name", - value: "John", - label: "First Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - placeholder: "Middle Name", - value: "", - label: "Middle Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - placeholder: "Last Name", - value: "Doe", - label: "Last Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - value: "john@doe.com", - label: "Email", - required: true, - testId: "CE8AE9DA5B7CD6C3DF2929543A9AF92D", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - value: "+16397975093", - label: "Phone", - displayMode: "LABELS_LEFT", - hasSuggestions: false, - }, - { - readOnly: undefined, - placeholder: "Price", - value: "90.99", - label: "Price", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "currency"; - }, - }; - }, - }, - { - readOnly: undefined, - value: "100 Mbps", - label: "Internet Plan", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "radio"; - }, - getConfigProps: () => { - return {}; - }, - getDataObject: () => { - return {}; - }, - }; - }, - }, - { - caseOpConfig: { - label: "Update operator", - createLabel: "Created", - updateLabel: "Updated", - updateDateTime: "2023-03-10T12:53:04.670Z", - createDateTime: "2023-03-10T12:52:20.054Z", - updateOperator: { - userId: "User.DigV2", - userName: "User DigV2", - }, - createOperator: { - userId: "User.DigV2", - userName: "User DigV2", - }, - }, - }, - ], - }, - ], - classID: "MyCo-MyCompon-Work-MyComponents", -}; - -export const pyReviewResolved = { - readOnly: true, - template: "Details", - ruleClass: "MyCo-MyCompon-Work-MyComponents", - showLabel: true, - label: "Details", - localeReference: "MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW", - showHighlightedData: true, - highlightedData: [ - { - type: "TextInput", - config: { - value: "New", - label: "Work Status", - displayMode: "STACKED_LARGE_VAL", - displayAsStatus: true, - }, - }, - { - type: "TextInput", - config: { - value: "M-1002", - label: "Case ID", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "DateTime", - config: { - value: "2022-12-11T20:06:27.232Z", - label: "Create date/time", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "UserReference", - config: { - label: "Create Operator", - value: { - userId: "conns", - userName: "Sara Connor", - }, - placeholder: "Select...", - displayMode: "STACKED_LARGE_VAL", - }, - }, - ], - displayMode: "LABELS_LEFT", -}; - -export const regionChildrenResolved = [ - { - readOnly: true, - value: "", - label: "SLA Deadline", - displayMode: "LABELS_LEFT", - }, - { - readOnly: true, - value: "", - label: "SLA Goal", - displayMode: "LABELS_LEFT", - }, - { - readOnly: true, - value: "", - label: "SLA Start Time", - listType: "associated", - datasource: [ - { - key: "AssignmentCreation", - value: "The creation time of the Assignment", - }, - { - key: "CurrentTime", - value: "Current Date Time", - }, - ], - displayMode: "LABELS_LEFT", - }, -]; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.html b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.html deleted file mode 100644 index 9bab94e3..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- -
diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.scss b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.scss deleted file mode 100644 index be9bb2d2..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.spec.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.spec.ts deleted file mode 100644 index 8f57e55f..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyDetailsComponent } from './pega-dxil-my-details.component'; - -describe('PegaDxilMyDetailsComponent', () => { - let component: PegaDxilMyDetailsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyDetailsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyDetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.ts deleted file mode 100644 index 4b20badf..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-details', - templateUrl: './pega-dxil-my-details.component.html', - styleUrls: ['./pega-dxil-my-details.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class PegaDxilMyDetailsComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - - PCore$: any; - - highlightedDataArr: Array = []; - showHighlightedData: boolean; - arFields$: Array = []; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - this.arFields$ = []; - let pKid = kid.getPConnect(); - const fields = pKid.getChildren(); - fields?.forEach((field) => { - const thePConn = field.getPConnect(); - const theCompType = thePConn.getComponentName().toLowerCase(); - if (theCompType === 'reference') { - const configProps = thePConn.getConfigProps(); - configProps.readOnly = true; - configProps.displayMode = 'LABELS_LEFT'; - const propToUse = { ...thePConn.getInheritedProps() }; - configProps.label = propToUse?.label; - const options = { - context: thePConn.getContextName(), - pageReference: thePConn.getPageReference(), - referenceList: thePConn.getReferenceList() - }; - const viewContConfig = { - meta: { - type: theCompType, - config: configProps - }, - options - }; - const theViewCont = this.PCore$.createPConnect(viewContConfig); - const data = { - type: theCompType, - pConn: theViewCont?.getPConnect() - }; - this.arFields$.push(data); - } else { - const data = { - type: theCompType, - config: thePConn.getConfigProps() - }; - this.arFields$.push(data); - } - }); - } - } -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/DefaultForm.svg b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/DefaultForm.svg deleted file mode 100644 index 9fe86e70..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/DefaultForm.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - 2 col copy - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/config.json b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/config.json deleted file mode 100644 index 98107e5d..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/config.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "Pega_DXIL_MyForm", - "label": "My Form", - "description": "My Form", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyForm", - "type": "Template", - "subtype": "FORM", - "icon": "DefaultForm.svg", - "properties": [ - { - "format": "SELECT", - "name": "NumCols", - "label": "Number of columns", - "defaultValue": "1", - "source": [ - { "key": "1", "value": "One" }, - { "key": "2", "value": "Two" }, - { "key": "3", "value": "Three" } - ] - }, - { - "format": "SELECT", - "name": "templateOverrideMode", - "label": "Template for embedded views", - "defaultValue": "USE_TEMPLATE", - "source": [ - { "key": "USE_TEMPLATE", "value": "Use template" }, - { "key": "IGNORE_TEMPLATE", "value": "Ignore template" } - ] - }, - { - "format": "INSTRUCTIONS" - }, - { - "name": "Fields", - "label": "Fields", - "format": "CONTENTPICKER", - "allowCreatingGroup": true - } - ] -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/demo.stories.jsx deleted file mode 100644 index b03bc18d..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/demo.stories.jsx +++ /dev/null @@ -1,215 +0,0 @@ -import { useState } from 'react'; - -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyForm from './index.tsx'; - -export default { - title: 'PegaDxilMyForm', - decorators: [withKnobs], - component: PegaDxilMyForm -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getErrorHandler = () => { - return { - getGenericFailedMessage() { - /* nothing */ - } - }; -}; - -window.PCore.getConstants = () => { - return { - CASE_INFO: { - INSTRUCTIONS: "" - } - } -}; - -export const BasePegaDxilMyForm = () => { - - const [firstName, setFirstName] = useState('John'); - const [middleName, setMiddleName] = useState(''); - const [lastName, setLastName] = useState('Joe'); - const [phone, setPhone] = useState('+16397975093'); - const [suffix, setSuffix] = useState(''); - const [email, setEmail] = useState('john@doe.com'); - - const props = { - NumCols: "1", - template: 'DefaultForm', - - getPConnect: () => { - return { - getChildren: () => { - return [ - { - getPConnect: () => { - return { - getChildren: () => { - return [ - { - readOnly: undefined, - placeholder: 'First Name', - value: firstName, - label: 'First Name', - hasSuggestions: false, - onChange: val => { - setFirstName(val.target.value); - } - }, - { - readOnly: undefined, - placeholder: 'Middle Name', - value: middleName, - label: 'Middle Name', - hasSuggestions: false, - onChange: val => { - setMiddleName(val.target.value); - } - }, - - { - value: lastName, - label: 'Last Name', - required: true, - placeholder: 'Last Name', - testId: '77587239BF4C54EA493C7033E1DBF636', - hasSuggestions: false, - onChange: val => { - setLastName(val.target.value); - } - }, - - { - readOnly: undefined, - value: phone, - label: 'Phone Number', - datasource: { - fields: { - value: undefined - }, - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ] - }, - hasSuggestions: false, - onChange: val => { - setPhone(val.value); - }, - onBlur: () => { - /* nothing */ - } - }, - - { - value: suffix, - label: 'Suffix', - placeholder: 'Select...', - listType: 'associated', - datasource: [ - { - key: 'Sr', - value: 'Sr' - }, - { - key: 'Jr', - value: 'Jr' - }, - { - key: 'III', - value: 'III' - }, - { - key: 'IV', - value: 'IV' - }, - { - key: 'V', - value: 'V' - } - ], - testId: '56E6DDD1CB6CEC596B433440DFB21C17', - hasSuggestions: false, - deferDatasource: false, - getPConnect: () => { - return { - getContextName: () => { - return null; - }, - getDataObject: () => { - return null; - }, - getActionsApi: () => { - return { - updateFieldValue: (propName, value) => { - setSuffix(value); - }, - triggerFieldChange: () => { - /* nothing */ - } - }; - }, - getStateProps: () => { - return { - value: '' - }; - } - }; - }, - onChange: val => { - setSuffix(val.target.value); - } - }, - - { - value: email, - label: 'Email', - required: true, - testId: 'CE8AE9DA5B7CD6C3DF2929543A9AF92D', - hasSuggestions: false, - onChange: val => { - setEmail(val.target.value); - } - } - ]; - } - }; - } - } - ]; - }, - getValue: (val) => { - return val; - }, - getCurrentView: () => { - return ""; - }, - getCurrentClassID: () => { - return ""; - } - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.html b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.html deleted file mode 100644 index a9b23146..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-
{{label}}
-
-
-
-
-
-
-
- -
-
diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.scss b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.scss deleted file mode 100644 index 0d25bbaf..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.scss +++ /dev/null @@ -1,33 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-default-form-one-column { - display: grid; - grid-template-columns: repeat(1, minmax(0, 1fr)); - gap: calc(1rem); -} - -.psdk-default-form-two-column { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: calc(1rem); -} - -.psdk-default-form-three-column { - display: grid; - grid-template-columns: repeat(3, 1fr); - gap: calc(1rem); -} - -.psdk-default-form-two-column .grid-column { - grid-column: 1 / span 2; -} - -.psdk-default-form-three-column .grid-column { - grid-column: 1 / span 3; -} - -.template-title-container { - font-size: calc(0.9375rem); - font-weight: 600; - margin: 10px 0px; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.spec.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.spec.ts deleted file mode 100644 index 985f1486..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyFormComponent } from './pega-dxil-my-form.component'; - -describe('PegaDxilMyFormComponent', () => { - let component: PegaDxilMyFormComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyFormComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.ts deleted file mode 100644 index 9ec90d89..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { TemplateUtils } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-pega-dxil-my-form', - templateUrl: './pega-dxil-my-form.component.html', - styleUrls: ['./pega-dxil-my-form.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PegaDxilMyFormComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - divClass$: string; - template: any; - showLabel: any; - label: any; - instructions: string; - - NO_HEADER_TEMPLATES = [ - 'SubTabs', - 'SimpleTable', - 'Details', - 'DetailsTwoColumn', - 'DetailsThreeColumn', - 'NarrowWideDetails', - 'WideNarrowDetails', - 'Confirmation' - ]; - - constructor(private templateUtils: TemplateUtils) {} - - ngOnInit(): void { - let configProps = this.pConn$.getConfigProps(); - this.template = configProps?.template; - const propToUse = { ...this.pConn$.getInheritedProps() }; - this.showLabel = propToUse?.showLabel; - this.label = propToUse?.label; - let kids = this.pConn$.getChildren(); - this.instructions = this.templateUtils.getInstructions(this.pConn$, configProps?.instructions); - console.log("instructions" + this.instructions); - - let numCols = configProps.NumCols ? configProps.NumCols : '1'; - switch (numCols) { - case '1': - this.divClass$ = 'psdk-default-form-one-column'; - break; - case '2': - this.divClass$ = 'psdk-default-form-two-column'; - break; - case '3': - this.divClass$ = 'psdk-default-form-three-column'; - break; - default: - this.divClass$ = 'psdk-default-form-one-column'; - break; - } - - // repoint children before getting templateArray - // Children may contain 'reference' component, so we need to - // normalize them - this.arChildren$ = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren()); - } -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/OneColumnPage.svg b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/OneColumnPage.svg deleted file mode 100644 index da2634ed..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/OneColumnPage.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - 1-col icon - - - - - - - - - - - - - - - - - - - A - - - - - - diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/config.json b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/config.json deleted file mode 100644 index b7a36c63..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/config.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Pega_DXIL_MyPage", - "label": "My Page", - "description": "My Page", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPage", - "type": "Template", - "subtype": "PAGE", - "icon": "OneColumnPage.svg", - "properties": [ - { - "name": "useConfigurableLayout", - "label": "Use inline layout for insights", - "format": "BOOLEAN" - }, - { - "name": "enableGetNextWork", - "label": "Enable Get next work", - "format": "BOOLEAN" - }, - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - } - ], - "defaultConfig": {} -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/demo.stories.jsx deleted file mode 100644 index 7bbfcc6a..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/demo.stories.jsx +++ /dev/null @@ -1,80 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import AppAnnouncement from "@pega/react-sdk-components/lib/components/widget/AppAnnouncement"; - -import { pyHome1Resolved, pyHome1Raw } from './mock.stories'; - -import PegaDxilMyPage from './index.tsx'; - -export default { - title: 'PegaDxilMyPage', - decorators: [withKnobs], - component: PegaDxilMyPage -}; - -export const BasePegaDxilMyPage = () => { - - const configProps = pyHome1Resolved.children[0].children[0].config; - - const props = { - getPConnect: () => { - return { - getStateProps: () => { - return {}; - }, - getActionsApi: () => { - return { - getNextWork: () => { - return new Promise(resolve => { - resolve({}); - }); - }, - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - getChildren: () => { - return pyHome1Raw.children; - }, - getComponentName: () => { - return ''; - }, - getLocalizedValue: value => { - return value; - }, - getRawMetadata: () => { - return pyHome1Raw; - }, - createComponent: config => { - if(config.type === 'AppAnnouncement') { - return ( - - ); - } - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - const regionAChildren = pyHome1Raw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - <> - {regionAChildren} - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/mock.stories.js b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/mock.stories.js deleted file mode 100644 index 67eb333b..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/mock.stories.js +++ /dev/null @@ -1,115 +0,0 @@ -export const pyHome1Raw = { - name: 'pyHome1', - type: 'View', - config: { - type: 'landingpage', - template: 'OneColumnPage', - icon: 'home-solid', - title: '@ENV APPLICATION_DESC', - ruleClass: 'DIXL-MediaCo-UIPages', - localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1', - enableGetNextWork: true, - context: 'pyPortal' - }, - children: [ - { - name: 'A', - type: 'Region', - children: [ - { - type: 'AppAnnouncement', - config: { - label: '@L App announcement', - description: - "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.", - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+', - datasource: { - source: [ - { - "name": "New React based UI rendering" - }, - { - "name": "Support for followers and recents" - }, - { - "name": "New authoring experience" - } - ], - fields: { - name: '@P .pyLabel' - } - } - } - } - ] - } - ], - classID: 'DIXL-MediaCo-UIPages' -}; - -export const pyHome1Resolved = { - name: 'pyHome1', - type: 'View', - config: { - type: 'landingpage', - template: 'OneColumnPage', - icon: 'home-solid', - title: '@ENV APPLICATION_DESC', - ruleClass: 'DIXL-MediaCo-UIPages', - localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1', - enableGetNextWork: true, - context: 'pyPortal' - }, - children: [ - { - name: 'A', - type: 'Region', - getPConnect: () => { - return { - getComponentName: () => { - return ''; - }, - getComponent: () => { - return pyHome1Resolved.children[0]; - }, - getConfigProps: () => { - return {}; - } - }; - }, - children: [ - { - type: 'AppAnnouncement', - config: { - label: '@L App announcement', - description: - "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.", - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+', - datasource: { - source: [ - { - "name": "New React based UI rendering" - }, - { - "name": "Support for followers and recents" - }, - { - "name": "New authoring experience" - } - ] - , - fields: { - name: '@P .pyLabel' - } - } - } - } - ] - } - ], - classID: 'DIXL-MediaCo-UIPages' -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.html b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.html deleted file mode 100644 index c8cab928..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

{{ title$ }}

-
-
-
-
- - -
PegaDxilMyPage Missing: {{ kid.getPConnect().getComponentName() }}
-
-
-
diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.scss b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.scss deleted file mode 100644 index 541a2eb2..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.psdk-page-title { - padding-left: 0.2rem; -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.spec.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.spec.ts deleted file mode 100644 index a4d4b398..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyPageComponent } from './pega-dxil-my-page.component'; - -describe('PegaDxilMyPageComponent', () => { - let component: PegaDxilMyPageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.ts deleted file mode 100644 index ea333cfc..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-page/pega-dxil-my-page.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ViewComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-pega-dxil-my-page', - templateUrl: './pega-dxil-my-page.component.html', - styleUrls: ['./pega-dxil-my-page.component.scss'], - standalone: true, - imports: [CommonModule, RegionComponent, forwardRef(() => ViewComponent)] -}) -export class PegaDxilMyPageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - configProps$: Object; - arChildren$: Array; - title$: string; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit() { - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - - this.title$ = this.configProps$['title']; - let operator = this.configProps$['operator']; - - if (operator && operator != '') { - this.title$ += ', ' + operator; - } - - // when showing a page, similar to updating root, need to cause viewContainer to call "initContainer" - sessionStorage.setItem('hasViewContainer', 'false'); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - // turn off spinner - //this.psService.sendMessage(false); - } - } -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/TwoColumnDetails.svg b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/TwoColumnDetails.svg deleted file mode 100644 index 4d15fcd0..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/TwoColumnDetails.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - 2 col - - - - - - - - - - - - - - B - - - - A - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/config.json b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/config.json deleted file mode 100644 index f96796f3..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Pega_DXIL_MyTwoColumnDetails", - "label": "My Two Column Details", - "description": "My Two Column Details", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyTwoColumnDetails", - "type": "Template", - "subtype": "DETAILS", - "icon": "TwoColumnDetails.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/demo.stories.jsx deleted file mode 100644 index 6ef06e90..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/demo.stories.jsx +++ /dev/null @@ -1,73 +0,0 @@ -import { withKnobs } from "@storybook/addon-knobs"; - -import PegaDxilMyTwoColumnDetails from "./index.tsx"; - -import operatorDetails, { pyReviewRaw } from "./mock.stories"; - -export default { - title: "PegaDxilMyTwoColumnDetails", - decorators: [withKnobs], - component: PegaDxilMyTwoColumnDetails, - parameters: { - type: "DetailsRegion", - }, -}; - -export const BaseYourOrgRequiredDxilDetailsRegion = () => { - if (!window.PCore) { - window.PCore = {}; - } - - window.PCore.getUserApi = () => { - return { - getOperatorDetails: () => { - return new Promise((resolve) => { - resolve(operatorDetails); - }); - }, - }; - }; - - window.PCore.getEnvironmentInfo = () => { - return { - getUseLocale: () => { - return "en-US"; - }, - }; - }; - - const props = { - NumCols: "2", - template: "DefaultForm", - showHighlightedData: false, - label: "Details Region", - showLabel: true, - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children[0].children; - }, - getRawMetadata: () => { - return pyReviewRaw; - }, - getInheritedProps: () => { - return pyReviewRaw.config.inheritedProps; - }, - setInheritedProp: () => { - /* nothing */ - }, - resolveConfigProps: () => { - /* nothing */ - }, - }; - }, - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/mock.stories.js b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/mock.stories.js deleted file mode 100644 index 20323a70..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/mock.stories.js +++ /dev/null @@ -1,290 +0,0 @@ -const operatorDetails = { - data: { - pzLoadTime: "January 18, 2023 10:33:19 AM EST", - pzPageNameHash: "_pa1519192551088960pz", - pyOperatorInfo: { - pyUserName: "french DigV2", - pyPosition: "", - pyImageInsKey: "", - pySkills: [ - { - pySkillName: "", - pzIndexOwnerKey: "DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2", - pySkillRating: 0, - }, - ], - pyReportToUserName: "", - pyReportTo: "", - pyOrganization: "DXIL", - pyTitle: "", - pyLabel: "frenchTest.DigV2", - pyEmailAddress: "User@DigV2", - pyTelephone: "", - }, - }, - status: 200, - statusText: "", - headers: { - "content-length": "435", - "content-type": "application/json;charset=UTF-8", - }, - request: {}, -}; - -export default operatorDetails; - -export const pyReviewRaw = { - name: "pyReview", - type: "View", - config: { - template: "Details", - ruleClass: "MyCo-MyCompon-Work-MyComponents", - showLabel: true, - label: "@L Details", - localeReference: "@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW", - showHighlightedData: true, - highlightedData: [ - { - type: "TextInput", - config: { - value: "@P .pyStatusWork", - label: "@L Work Status", - displayMode: "STACKED_LARGE_VAL", - displayAsStatus: true, - }, - }, - { - type: "TextInput", - config: { - value: "@P .pyID", - label: "@L Case ID", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "DateTime", - config: { - value: "@P .pxCreateDateTime", - label: "@L Create date/time", - displayMode: "STACKED_LARGE_VAL", - }, - }, - { - type: "UserReference", - config: { - label: "@L Create Operator", - value: "@USER .pxCreateOperator", - placeholder: "Select...", - displayMode: "STACKED_LARGE_VAL", - }, - }, - ], - inheritedProps: [ - { - prop: "label", - value: "@L Details", - }, - { - prop: "showLabel", - value: true, - }, - ], - }, - children: [ - { - name: "A", - type: "Region", - getPConnect: () => { - return { - getRawMetadata: () => { - return pyReviewRaw.children[0]; - }, - }; - }, - children: [ - { - readOnly: undefined, - placeholder: "First Name", - value: "John", - label: "First Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - placeholder: "Middle Name", - value: "", - label: "Middle Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - placeholder: "Last Name", - value: "Doe", - label: "Last Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - value: "john@doe.com", - label: "Email", - required: true, - testId: "CE8AE9DA5B7CD6C3DF2929543A9AF92D", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - value: "+16397975093", - label: "Phone", - displayMode: "LABELS_LEFT", - hasSuggestions: false, - }, - { - readOnly: undefined, - placeholder: "Price", - value: "90.99", - label: "Price", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "currency"; - }, - }; - }, - }, - { - readOnly: undefined, - value: "100 Mbps", - label: "Internet Plan", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "radio"; - }, - getConfigProps: () => { - return {}; - }, - getDataObject: () => { - return {}; - }, - }; - }, - }, - { - readOnly: undefined, - placeholder: "Middle Name", - value: "", - label: "Middle Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - placeholder: "Last Name", - value: "Doe", - label: "Last Name", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - value: "john@doe.com", - label: "Email", - required: true, - testId: "CE8AE9DA5B7CD6C3DF2929543A9AF92D", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - }, - { - readOnly: undefined, - value: "+16397975093", - label: "Phone", - displayMode: "LABELS_LEFT", - hasSuggestions: false, - }, - { - readOnly: undefined, - placeholder: "Price", - value: "90.89", - label: "Price", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "currency"; - }, - }; - }, - }, - { - readOnly: undefined, - value: "100 Mbps", - label: "Internet Plan", - hasSuggestions: false, - displayMode: "LABELS_LEFT", - getPConnect: () => { - return { - getActionsApi: () => {/* nothing */}, - getStateProps: () => { - return { - value: "", - }; - }, - getComponentName: () => { - return "radio"; - }, - getConfigProps: () => { - return {}; - }, - getDataObject: () => { - return {}; - }, - }; - }, - }, - { - caseOpConfig: { - label: "Create operator", - createLabel: "Created", - updateLabel: "Updated", - updateDateTime: "2023-03-10T15:45:56.919Z", - createDateTime: "2023-03-10T15:45:40.154Z", - updateOperator: { - userId: "rep@mediaco", - userName: "representative", - }, - createOperator: { - userId: "rep@mediaco", - userName: "representative", - }, - }, - }, - ], - }, - ], - classID: "MyCo-MyCompon-Work-MyComponents", -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.html b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.html deleted file mode 100644 index 1c73cc38..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.html +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.scss b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.scss deleted file mode 100644 index be9bb2d2..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.spec.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.spec.ts deleted file mode 100644 index e6977fe9..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTwoColumnDetailsComponent } from './pega-dxil-my-two-column-details.component'; - -describe('PegaDxilMyTwoColumnDetailsComponent', () => { - let component: PegaDxilMyTwoColumnDetailsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTwoColumnDetailsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTwoColumnDetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.ts deleted file mode 100644 index 31a071f9..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/pega-dxil-my-two-column-details.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-pega-dxil-my-two-column-details', - templateUrl: './pega-dxil-my-two-column-details.component.html', - styleUrls: ['./pega-dxil-my-two-column-details.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class PegaDxilMyTwoColumnDetailsComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - showHighlightedData: boolean; - highlightedDataArr: any; - - arFields$: Array = []; - arFields2$: Array = []; - arFields3$: Array = []; - - propsToUse: any = {}; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - this.pConn$.setInheritedProp('readOnly', true); - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } else { - this.arFields2$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/TwoColumn.svg b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/TwoColumn.svg deleted file mode 100644 index 3533e017..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/TwoColumn.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - 2-col icon - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - B - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/config.json b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/config.json deleted file mode 100644 index a312fc7c..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/config.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "Pega_DXIL_MyTwoColumnForm", - "label": "My Two Column Form", - "description": "My Two Column Form", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyTwoColumnForm", - "type": "Template", - "subtype": "FORM", - "icon": "TwoColumn.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER" - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER" - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "saveToReference": true - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "saveToReference": true - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY", - "saveToReference": true - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/demo.stories.jsx deleted file mode 100644 index e35f422f..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/demo.stories.jsx +++ /dev/null @@ -1,180 +0,0 @@ -import { useState } from 'react'; -import PegaDxilMyTwoColumnForm from './index.tsx'; -import { pyReviewRaw } from './mock.stories'; -import { TextField } from '@material-ui/core'; -import MuiPhoneNumber from 'material-ui-phone-number'; -import { KeyboardDatePicker, MuiPickersUtilsProvider } from '@material-ui/pickers'; -import DayjsUtils from '@date-io/dayjs'; - -export default { - title: 'PegaDxilMyTwoColumnForm', - component: PegaDxilMyTwoColumnForm -}; - -const renderField = resolvedProps => { - const { displayMode, value = '', label = '', onChange} = resolvedProps; - - const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked'; - let val = ''; - if (label === 'Service Date') - val = - - - - if (label === 'Email') - val = ; - - if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name') - val = ; - - if (label === 'Phone Number') - val = ; - - - if (variant === 'inline') { - val = value || ; - } - - return val; -}; - -export const BasePegaDxilMyTwoColumnForm = () => { - const [firstName, setFirstName] = useState('John'); - const [middleName, setMiddleName] = useState(''); - const [lastName, setLastName] = useState('Joe'); - const [phone, setPhone] = useState('+16397975093'); - const [serviceDate, setServiceDate] = useState('2023-01-25'); - const [email, setEmail] = useState('john@doe.com'); - const regionChildrenResolved = [ - { - readOnly: undefined, - value: firstName, - label: 'First Name', - hasSuggestions: false, - onChange: val => { - setFirstName(val.target.value); - } - }, - { - readOnly: undefined, - value: middleName, - label: 'Middle Name', - hasSuggestions: false, - onChange: val => { - setMiddleName(val.target.value); - } - }, - { - readOnly: undefined, - value: lastName, - label: 'Last Name', - hasSuggestions: false, - onChange: val => { - setLastName(val.target.value); - } - }, - { - readOnly: undefined, - value: email, - label: 'Email', - hasSuggestions: false, - onChange: val => { - setEmail(val.target.value); - } - }, - { - readOnly: undefined, - value: phone, - label: 'Phone Number', - datasource: { - fields: { - value: undefined - }, - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ] - }, - hasSuggestions: false, - onChange: val => { - setPhone(val); - } - }, - { - readOnly: undefined, - value: serviceDate, - label: 'Service Date', - hasSuggestions: false, - onChange: date => { - const changeValue = date && date.isValid() ? date.toISOString() : null; - setServiceDate(changeValue); - } - - } - ]; - const props = { - template: 'DefaultForm', - getPConnect: () => { - return { - getChildren: () => { - return pyReviewRaw.children; - }, - createComponent: config => { - switch (config.config.value) { - case '@P .FirstName': - return renderField(regionChildrenResolved[0]); - case '@P .MiddleName': - return renderField(regionChildrenResolved[1]); - case '@P .LastName': - return renderField(regionChildrenResolved[2]); - case '@P .Email': - return renderField(regionChildrenResolved[3]); - case '@P .PhoneNumber': - return renderField(regionChildrenResolved[4]); - case '@P .ServiceDate': - return renderField(regionChildrenResolved[5]); - default: - break; - } - } - }; - } - }; - - const regionAChildren = pyReviewRaw.children[0].children.map(child => { - return props.getPConnect().createComponent(child); - }); - const regionBChildren = pyReviewRaw.children[1].children.map(child => { - return props.getPConnect().createComponent(child); - }); - - return ( - <> - - {regionAChildren} - {regionBChildren} - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/mock.stories.js b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/mock.stories.js deleted file mode 100644 index 0b1d0ec1..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/mock.stories.js +++ /dev/null @@ -1,132 +0,0 @@ -export const pyReviewRaw = { - name: 'CollectInformation', - type: 'View', - config: { - template: 'DefaultForm', - ruleClass: 'OM5W9U-SampleApp-Work-Test', - localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION', - context: '@P .pyViewContext' - }, - children: [ - { - name: 'A', - type: 'Region', - children: [ - { - type: 'TextInput', - config: { - value: '@P .FirstName', - label: '@L First Name' - } - }, - { - type: 'TextInput', - config: { - value: '@P .MiddleName', - label: '@L Middle Name' - } - }, - { - type: 'TextInput', - config: { - value: '@P .LastName', - label: '@L Last Name' - } - } - ] - }, - { - name: 'B', - type: 'Region', - children: [ - { - type: 'Email', - config: { - value: '@P .Email', - label: '@L Email' - } - }, - { - type: 'Phone', - config: { - value: '@P .PhoneNumber', - label: '@L Phone Number', - datasource: { - source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults', - fields: { - value: '@P .pyCallingCode' - } - } - } - }, - { - type: 'Date', - config: { - value: '@P .ServiceDate', - label: '@L Service Date' - } - } - ] - } - ], - classID: 'OM5W9U-SampleApp-Work-Test' - }; - - export const regionChildrenResolved = [ - { - readOnly: undefined, - value: 'John', - label: 'First Name', - hasSuggestions: false - }, - { - readOnly: undefined, - value: 'Din', - label: 'Middle Name', - hasSuggestions: false - }, - { - readOnly: undefined, - value: 'Doe', - label: 'Last Name', - hasSuggestions: false - }, - { - readOnly: undefined, - value: 'John@doe.com', - label: 'Email', - hasSuggestions: false - }, - { - readOnly: undefined, - value: '+16397975093', - label: 'Phone Number', - datasource: { - fields: { - value: undefined - }, - source: [ - { - value: '+1' - }, - { - value: '+91' - }, - { - value: '+48' - }, - { - value: '+44' - } - ] - }, - hasSuggestions: false - }, - { - readOnly: undefined, - value: '2023-01-25', - label: 'Service Date', - hasSuggestions: false - } - ]; - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.html b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.html deleted file mode 100644 index 0b639153..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.scss b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.scss deleted file mode 100644 index a26771fe..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.scss +++ /dev/null @@ -1,28 +0,0 @@ -* { - box-sizing: border-box; -} - -.psdk-two-column { - display: flow-root; - height: 100%; -} - -/* Create two equal columns that floats next to each other */ -.psdk-two-column-column { - width: 50%; - float: left; - padding: 0rem 0.3125rem; - height: 100%; -} - -.psdk-two-column-left { - float: left; - min-width: 50%; - padding: 0rem 0.3125rem; -} - -.psdk-two-column-right { - float: left; - width: 50%; - padding: 0rem 0.3125rem; -} diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.spec.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.spec.ts deleted file mode 100644 index f2d62146..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyTwoColumnFormComponent } from './pega-dxil-my-two-column-form.component'; - -describe('PegaDxilMyTwoColumnFormComponent', () => { - let component: PegaDxilMyTwoColumnFormComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyTwoColumnFormComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyTwoColumnFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.ts b/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.ts deleted file mode 100644 index 404de442..00000000 --- a/tests/assets/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/pega-dxil-my-two-column-form.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-pega-dxil-my-two-column-form', - templateUrl: './pega-dxil-my-two-column-form.component.html', - styleUrls: ['./pega-dxil-my-two-column-form.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class PegaDxilMyTwoColumnFormComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/_widget.md b/tests/assets/components/createAll/custom-sdk/widget/_widget.md deleted file mode 100644 index ca4cf89e..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/_widget.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **custom-sdk/widget** directory - -The **src/components/custom-sdk/widget** directory contains the code for the custom **widget** components you want to create and use with the **Angular SDK**. - -When you run the **npm run create** command to create new _widget_ components, the generated code that you can use as a starting point for your component -development will be placed in component-specific folders in **src/components/custom-sdk/widget**. diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/OneColumnPage.svg b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/config.json b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/config.json deleted file mode 100644 index 28399f10..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/config.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Pega_DXIL_MyCaseWidget", - "label": "My Case Widget", - "description": "My Case Widget", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyCaseWidget", - "type": "Widget", - "subtype": "CASE", - "icon": "OneColumnPage.svg", - "properties": [ - { - "name": "label", - "label": "Label value", - "format": "TEXT" - } - ], - "defaultConfig": { - "label": "Case Widget" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/demo.stories.jsx deleted file mode 100644 index 8cffb67c..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/demo.stories.jsx +++ /dev/null @@ -1,70 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { historyData } from './mock.stories'; - -import PegaDxilMyCaseWidget from './index.tsx'; - -export default { - title: 'PegaDxilMyCaseWidget', - decorators: [withKnobs], - component: PegaDxilMyCaseWidget -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getConstants = () => { - return { - CASE_INFO: { - CASE_INFO_ID: 'caseInfo.ID' - } - }; -}; - -window.PCore.getDataApiUtils = () => { - return { - getData: () => { - return new Promise(resolve => { - resolve(historyData); - }); - } - }; -}; - -export const BasePegaDxilMyCaseWidget = () => { - - const props = { - label: 'Case history', - - getPConnect: () => { - return { - getValue: value => { - return value; - }, - getContextName: () => { - return 'app/primary_1'; - }, - getLocalizedValue: value => { - return value; - }, - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/mock.stories.js b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/mock.stories.js deleted file mode 100644 index 08f1bf94..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/mock.stories.js +++ /dev/null @@ -1,390 +0,0 @@ -// eslint-disable-next-line import/prefer-default-export -export const historyData = { - data: { - fetchDateTime: '2023-01-18T12:04:56.517Z', - pxObjClass: 'Pega-API-DataExploration-Data', - resultCount: 31, - data: [ - { - pxTimeCreated: '2023-01-13T21:46:33.339Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214633.339 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214633.339 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:33.332Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214633.332 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214633.332 GMT', - pxLongitude: null, - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:32.005Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214632.005 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214632.005 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.998Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.998 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.998 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.175Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.175 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.175 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:31.168Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214631.168 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214631.168 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:29.893Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214629.893 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214629.893 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:29.887Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214629.887 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214629.887 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:28.248Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214628.248 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214628.248 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:28.242Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214628.242 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214628.242 GMT', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:08.399Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214608.399 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214608.399 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:46:08.393Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214608.393 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214608.393 GMT', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:07.584Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214607.584 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214607.584 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:07.579Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214607.579 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214607.579 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:06.262Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214606.262 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214606.262 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:46:06.256Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214606.256 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214606.256 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:57.503Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214557.503 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214557.503 GMT', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:57.496Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214557.496 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214557.496 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:36.250Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214536.250 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214536.250 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:36.244Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214536.244 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214536.244 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:35.364Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214535.364 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214535.364 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:35.356Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214535.356 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214535.356 GMT', - pxLongitude: null, - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:33.224Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214533.224 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214533.224 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:33.218Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214533.218 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214533.218 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' removed via ticket.", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:32.436Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214532.436 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214532.436 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:32.430Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214532.430 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214532.430 GMT', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'EmbeddedData'.", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxTimeCreated: '2023-01-13T21:45:25.003Z', - pxObjClass: 'History-DXIL-DigV2-Work', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214525.003 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214525.003 GMT', - pxLongitude: null, - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:24.994Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214524.994 GMT', - pxLongitude: null, - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214524.994 GMT', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assignment to 'complete task' completed by performing a 'Select Test'.", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.570Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.570 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.570 GMT', - pxLongitude: null, - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMessageKey: "Assigned to User DigV2 to 'complete task' ", - pyMemo: null, - pxLatitude: null - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.563Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.563 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.563 GMT', - pxLongitude: null, - pyMessageKey: 'ChangeStageAutomatic\tCreate\tPick Test', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pxLatitude: null, - pyMemo: 'ChangeStageAutomatic\tCreate\tPick Test' - }, - { - pxObjClass: 'History-DXIL-DigV2-Work', - pxTimeCreated: '2023-01-13T21:45:23.550Z', - pyPerformer: 'User DigV2', - pxInsName: 'DXIL-DIGV2-WORK C-7430!20230113T214523.550 GMT', - pzInsKey: 'HISTORY-DXIL-DIGV2-WORK DXIL-DIGV2-WORK C-7430!20230113T214523.550 GMT', - pxLongitude: null, - pyMessageKey: 'Item created.', - pxHistoryForReference: 'DXIL-DIGV2-WORK C-7430', - pyMemo: null, - pxLatitude: null - } - ], - hasMoreResults: false - }, - status: 200, - statusText: '', - headers: { - 'content-length': '1328', - 'content-type': 'application/json;charset=UTF-8' - }, - request: {} -}; diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.html b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.html deleted file mode 100644 index f68fa036..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

{{ configProps$.label }}

-
- - - - - - - -
{{ dCol.label }}{{ element[dCol.fieldName] }}
- diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.scss b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.scss deleted file mode 100644 index f9eafd57..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -table { - width: 100%; -} - -.mat-mdc-row .mat-mdc-cell { - text-align: left; -} - -.psdk-search { - padding-left: 0.625rem; -} - -.psdk-icon-search { - vertical-align: sub; - padding: 0rem 0.125rem; - min-width: unset; - width: 1.1rem; -} - -.psdk-case-history-title { - margin-left: 0.5rem; -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.spec.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.spec.ts deleted file mode 100644 index 3fa17525..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyCaseWidgetComponent } from './pega-dxil-my-case-widget.component'; - -describe('PegaDxilMyCaseWidgetComponent', () => { - let component: PegaDxilMyCaseWidgetComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyCaseWidgetComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyCaseWidgetComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.ts deleted file mode 100644 index 0e8c1994..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/pega-dxil-my-case-widget.component.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatTableDataSource, MatTableModule } from '@angular/material/table'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-case-widget', - templateUrl: './pega-dxil-my-case-widget.component.html', - styleUrls: ['./pega-dxil-my-case-widget.component.scss'], - standalone: true, - imports: [CommonModule, MatTableModule] -}) -export class PegaDxilMyCaseWidgetComponent implements OnInit { - @Input() pConn$: any; - - PCore$: any; - configProps$: any; - - repeatList$: MatTableDataSource; - fields$: Array; - displayedColumns$ = Array(); - waitingForData: boolean = false; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.configProps$ = this.pConn$.getConfigProps(); - - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - const dataViewName = 'D_pyWorkHistory'; - const context = this.pConn$.getContextName(); - - this.waitingForData = true; - - const caseHistoryData = this.PCore$.getDataApiUtils().getData( - dataViewName, - `{"dataViewParameters":[{"CaseInstanceKey":"${caseID}"}]}`, - context - ); - - caseHistoryData.then((historyJSON: Object) => { - this.fields$ = [ - { label: 'Date', type: 'DateTime', fieldName: 'pxTimeCreated' }, - { label: 'Description', type: 'TextInput', fieldName: 'pyMessageKey' }, - { label: 'User', type: 'TextInput', fieldName: 'pyPerformer' } - ]; - - const tableDataResults = this.updateData(historyJSON['data'].data, this.fields$); - - this.displayedColumns$ = this.getDisplayColums(this.fields$); - - this.repeatList$ = new MatTableDataSource(tableDataResults); - - this.waitingForData = false; - }); - } - - ngOnDestroy() {} - - updateFields(arFields, arColumns): Array { - let arReturn = arFields; - for (let i in arReturn) { - arReturn[i].config.name = arColumns[i]; - } - - return arReturn; - } - - updateData(listData: Array, fieldData: Array): Array { - let returnList: Array = new Array(); - for (let row in listData) { - // copy - let rowData = JSON.parse(JSON.stringify(listData[row])); - - for (let field of fieldData) { - let fieldName = field['fieldName']; - let formattedDate; - - switch (field['type']) { - case 'Date': - formattedDate = this.utils.generateDate(rowData[fieldName], 'Date-Short-YYYY'); - rowData[fieldName] = formattedDate; - break; - case 'DateTime': - formattedDate = this.utils.generateDateTime(rowData[fieldName], 'DateTime-Short-YYYY'); - rowData[fieldName] = formattedDate; - break; - } - } - - returnList.push(rowData); - } - - return returnList; - } - - getDisplayColums(fields = []) { - let arReturn = fields.map((field, colIndex) => { - let theField = field.fieldName; - - return theField; - }); - return arReturn; - } -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/OneColumnPage.svg b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/config.json b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/config.json deleted file mode 100644 index 05bbe8c1..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "Pega_DXIL_MyPageCaseWidget", - "label": "My PageCase Widget", - "description": "My PageCase Widget", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPageCaseWidget", - "type": "Widget", - "subtype": ["PAGE","CASE"], - "icon": "OneColumnPage.svg", - "properties": [ - { - "name": "title", - "label": "Label value", - "format": "TEXT" - }, - { - "format": "SELECT", - "label": "Usage", - "name": "label", - "defaultValue": "Create operator", - "localize": true, - "source": [ - { - "key": "Create operator", - "value": "Create operator" - }, - { - "key": "Update operator", - "value": "Update operator" - }, - { - "key": "Resolve operator", - "value": "Resolve operator" - } - ] - }, - - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ], - "defaultConfig": { - "label": "Create operator", - "title": "Create operator", - "createLabel": "@L Created", - "updateLabel": "@L Updated", - "createOperator": "@USER .pxCreateOperator", - "updateOperator": "@USER .pxUpdateOperator", - "createDateTime": "@P .pxCreateDateTime", - "updateDateTime": "@P .pxUpdateDateTime", - "resolveLabel": "@L Resolved", - "resolveOperator": "@USER .pyResolvedUserID", - "resolveDateTime": "@P .pyResolvedTimestamp" - } -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/demo.stories.jsx deleted file mode 100644 index 1847748f..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/demo.stories.jsx +++ /dev/null @@ -1,52 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import { caseOpConfig, operatorDetails } from './mock.stories'; - -import PegaDxilMyPageCaseWidget from './index.tsx'; - -export default { - title: 'PegaDxilMyPageCaseWidget', - decorators: [withKnobs], - component: PegaDxilMyPageCaseWidget -}; - -if (!window.PCore) { - window.PCore = {}; -} - -window.PCore.getUserApi = () => { - return { - getOperatorDetails: () => { - return new Promise(resolve => { - resolve(operatorDetails); - }); - } - }; -}; - -export const BasePegaDxilMyPageCaseWidget = () => { - - const props = { - caseOpConfig, - getPConnect: () => { - return { - getActionsApi: () => { - return { - updateFieldValue: () => {/* nothing */}, - triggerFieldChange: () => {/* nothing */} - }; - }, - ignoreSuggestion: () => {/* nothing */}, - acceptSuggestion: () => {/* nothing */}, - setInheritedProps: () => {/* nothing */}, - resolveConfigProps: () => {/* nothing */} - }; - } - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/mock.stories.js b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/mock.stories.js deleted file mode 100644 index e8121cf4..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/mock.stories.js +++ /dev/null @@ -1,52 +0,0 @@ - -export const caseOpConfig = { - label: 'Create operator', - createLabel: 'Created', - updateLabel: 'Updated', - updateDateTime: '2023-01-16T14:53:33.280Z', - createDateTime: '2023-01-16T14:53:33.198Z', - updateOperator: { - userId: 'admin@mediaco', - userName: 'admin' - }, - createOperator: { - userId: 'admin@mediaco', - userName: 'admin' - }, - hideLabel: true, - key: '_532zx1dah', - displayMode: 'LABELS_LEFT' -}; - -export const operatorDetails = { - data: { - pzLoadTime: 'January 18, 2023 10:33:19 AM EST', - pzPageNameHash: '_pa1519192551088960pz', - pyOperatorInfo: { - pyUserName: 'french DigV2', - pyPosition: '', - pyImageInsKey: '', - pySkills: [ - { - pySkillName: '', - pzIndexOwnerKey: 'DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2', - pySkillRating: 0 - } - ], - pyReportToUserName: '', - pyReportTo: '', - pyOrganization: 'DXIL', - pyTitle: '', - pyLabel: 'frenchTest.DigV2', - pyEmailAddress: 'User@DigV2', - pyTelephone: '' - } - }, - status: 200, - statusText: '', - headers: { - 'content-length': '435', - 'content-type': 'application/json;charset=UTF-8' - }, - request: {} -}; diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.html b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.html deleted file mode 100644 index 26a603e3..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
-
-
- {{ field.config.displayLabel }} -
-
-
- -
-
- -
-
-
-
-
diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.scss b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.scss deleted file mode 100644 index 9481e1eb..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.scss +++ /dev/null @@ -1,137 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-case-summary { - display: block; - margin: 0.625rem; -} - -.psdk-case-summary-primary { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-secondary { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-status { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-status-data { - display: block; - background-color: lavender; - color: $app-primary-color; - padding: 0rem 0.625rem; - display: inline; - font-size: 0.75rem; - font-weight: 700; - text-transform: uppercase; - line-height: 1.5rem; -} - -.psdk-case-summary-primary .label { - font-weight: 600; -} - -.psdk-case-summary-primary .data { - font-weight: 600; - font-size: 1.625rem; -} - -.psdk-case-summary-secondary .label { - font-weight: 600; -} -.psdk-case-summary-secondary .data { - font-weight: 600; - color: $app-primary-color; - padding-left: 1.25rem; -} - -.psdk-case-summary-fields { - padding: calc(2 * 0.5rem); - display: inline-flex; - grid-row-gap: calc(2 * 0.5rem); - column-gap: 4rem; -} - -.psdk-case-summary-fields-primary { - grid-template-columns: 20ch 1fr; - display: grid; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(2 * 0.5rem); -} - -.psdk-csf-primary-field { - display: grid; - grid-template-columns: 1fr; - grid-column-gap: calc(0 * 0.5rem); -} - -.psdk-csf-primary-field-header { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 1; - max-width: max-content; - font-size: 0.8125rem; - font-weight: 400; - color: rgba(0, 0, 0, 0.8); -} - -.psdk-csf-primary-field-data { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 2; - margin-inline-start: unset; -} - -.psdk-case-summary-fields-secondary { - width: 100%; - display: grid; - grid-template-columns: 1fr; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(1 * 0.5rem); -} - -.psdk-csf-secondary-field { - display: grid; - grid-template-columns: auto; - grid-column-gap: calc(2 * 0.5rem); -} - -.psdk-csf-secondary-field-header { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 1; - max-width: max-content; - font-size: 0.8125rem; - font-weight: 400; - color: rgba(0, 0, 0, 0.8); -} - -.psdk-csf-secondary-field-data { - word-break: break-word; - grid-column-start: 2; - grid-row-start: 1; - margin-inline-start: unset; -} - -span.psdk-csf-text-style { - font-size: 1.125rem; - font-weight: 600; -} - -span.psdk-csf-status-style { - background-color: #e9eef3; - border-radius: calc(0.25 * 0.5rem); - color: #4c5a67; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.spec.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.spec.ts deleted file mode 100644 index dc994def..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyPageCaseWidgetComponent } from './pega-dxil-my-page-case-widget.component'; - -describe('PegaDxilMyPageCaseWidgetComponent', () => { - let component: PegaDxilMyPageCaseWidgetComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPageCaseWidgetComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPageCaseWidgetComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.ts deleted file mode 100644 index 9cc64b2f..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/pega-dxil-my-page-case-widget.component.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pega-dxil-my-page-case-widget', - templateUrl: './pega-dxil-my-page-case-widget.component.html', - styleUrls: ['./pega-dxil-my-page-case-widget.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PegaDxilMyPageCaseWidgetComponent implements OnInit { - @Input() status$: string; - @Input() bShowStatus$: boolean; - - @Input() primaryFields$: Array; - - @Input() pConn$: any; - PCore$: any; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - controlName$: string; - - - constructor(private utils: Utils, private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // call updateSelf when initializing - // this.updateSelf(); - this.checkAndUpdate(); - - - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.primaryFields$ = new Array(); - - let createConfig = {} - createConfig["label"] = this.configProps$["label"]; - createConfig["updateDateTime"] = this.configProps$["createDateTime"]; - createConfig["displayLabel"] = this.configProps$["createLabel"]; - createConfig["createOperator"] = this.configProps$["createOperator"]; - let elConfig = {}; - elConfig["config"] = createConfig; - - this.primaryFields$.push(elConfig); - - let updateConfig = {}; - updateConfig["label"] = this.configProps$["updateLabel"]; - updateConfig["updateDateTime"] = this.configProps$["updateDateTime"]; - updateConfig["displayLabel"] = this.configProps$["updateLabel"]; - updateConfig["updateOperator"] = this.configProps$["updateOperator"]; - let elConfig1 = {}; - elConfig1["config"] = updateConfig; - - this.primaryFields$.push(elConfig1); - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - ngOnChanges() { - this.updateLabelAndDate(this.primaryFields$); - } - - updateLabelAndDate(arData: Array) { - for (let field of arData) { - switch (field.type.toLowerCase()) { - case 'caseoperator': - if (field.config.label.toLowerCase() == 'create operator') { - field.config['displayLabel'] = field.config.createLabel; - } else if (field.config.label.toLowerCase() == 'update operator') { - field.config['displayLabel'] = field.config.updateLabel; - } - break; - case 'date': - field.config.value = this.utils.generateDate(field.config.value, 'Date-Long'); - break; - } - } - } -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/OneColumnPage.svg b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/OneColumnPage.svg deleted file mode 100644 index 5f2dec97..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/OneColumnPage.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - 1 col - - - - - - - - - - - - - - - - - - - - - - - - - A - - - - - - - - \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/config.json b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/config.json deleted file mode 100644 index 91422f16..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "Pega_DXIL_MyPageWidget", - "label": "My Page Widget", - "description": "My Page Widget", - "organization": "Pega", - "version": "0.0.1", - "library": "DXIL", - "allowedApplications": [], - "componentKey": "Pega_DXIL_MyPageWidget", - "type": "Widget", - "subtype": "PAGE", - "icon": "OneColumnPage.svg", - "properties": [ - { - "name": "description", - "label": "Description", - "format": "TEXT", - "defaultValue": "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos." - }, - { - "name": "whatsnewlink", - "label": "What's new link", - "format": "TEXT", - "defaultValue": "https://design.pega.com" - }, - { - "name": "image", - "label": "Image link", - "format": "TEXT", - "defaultValue": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+" - }, - { - "name": "datasource", - "label": "Data source for details", - "defaultValue": "@DATASOURCE D_pyAnnouncements.pxResults", - "format": "DATASOURCE", - "required": true, - "properties": [ - { - "name": "name", - "label": "Label", - "defaultValue": "@P .pyLabel" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ], - "defaultConfig": {} -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/demo.stories.jsx b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/demo.stories.jsx deleted file mode 100644 index 8e5cbe2e..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/demo.stories.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import { withKnobs } from '@storybook/addon-knobs'; - -import PegaDxilMyPageWidget from './index.tsx'; - -import { configProps } from './mock.stories'; - -export default { - title: 'PegaDxilMyPageWidget', - decorators: [withKnobs], - component: PegaDxilMyPageWidget -}; - -export const BasePegaDxilMyPageWidget = () => { - - const props = { - label: configProps.label, - header: configProps.header, - description: configProps.description, - image: configProps.image, - datasource: configProps.datasource, - whatsnewlink: configProps.whatsnewlink - }; - - return ( - <> - - - ); -}; diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/mock.stories.js b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/mock.stories.js deleted file mode 100644 index 64830af8..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/mock.stories.js +++ /dev/null @@ -1,23 +0,0 @@ -// eslint-disable-next-line import/prefer-default-export -export const configProps = { - label: 'App announcement', - header: 'Announcements', - description: 'Welcome to MediaCo Application for testing SDK frameworks.', - whatsnewlink: 'https://design.pega.com', - image: - 'data:image/svg xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8 PC9zdmc ', - datasource: { - source: [ - { - name: 'New React based UI rendering' - }, - { - name: 'Support for followers and recents' - }, - { - name: 'New authoring experience' - } - ], - fields: {} - } -}; \ No newline at end of file diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pagecomponent.spec.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pagecomponent.spec.ts deleted file mode 100644 index b441c83c..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pagecomponent.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PegaDxilMyPageWidgetComponent } from './pega-dxil-my-page-widget.component'; - -describe('PegaDxilMyPageWidgetComponent', () => { - let component: PegaDxilMyPageWidgetComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PegaDxilMyPageWidgetComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PegaDxilMyPageWidgetComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.html b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.html deleted file mode 100644 index f3bd53cc..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.html +++ /dev/null @@ -1,14 +0,0 @@ - -
-

{{ header$ }}

-
-

{{ description$ }}

-
-

{{ label$ }}

-
    -
  • {{ detail }}
  • -
-
-
- See what's new -
diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.scss b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.scss deleted file mode 100644 index b13ef7ea..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.scss +++ /dev/null @@ -1,19 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -h2 { - font-size: 1.2rem; - margin-block-start: 0rem; -} - -h3 { - font-size: 1.1rem; -} -ul { - padding-inline-start: 20px; -} -.psdk-announcement { - background-color: $app-primary-light-color; - padding: 1rem; - margin: 0.5rem; - border-radius: 0.6125rem; -} diff --git a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.ts b/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.ts deleted file mode 100644 index ede59bf9..00000000 --- a/tests/assets/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/pega-dxil-my-page-widget.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; - -@Component({ - selector: 'app-pega-dxil-my-page-widget', - templateUrl: './pega-dxil-my-page-widget.component.html', - styleUrls: ['./pega-dxil-my-page-widget.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule] -}) -export class PegaDxilMyPageWidgetComponent implements OnInit { - @Input() pConn$: any; - - header$: string; - description$: string; - arDetails$: Array; - label$: string; - whatsnewlink$: string; - - constructor() {} - - ngOnInit(): void { - let configProps = this.pConn$.getConfigProps(); - - this.header$ = configProps.header; - this.description$ = configProps.description; - this.arDetails$ = configProps.details; - this.label$ = configProps.label; - this.whatsnewlink$ = configProps.whatsnewlink; - } -} diff --git a/tests/assets/components/createAll/override-sdk/_override-sdk.md b/tests/assets/components/createAll/override-sdk/_override-sdk.md deleted file mode 100644 index bd18b767..00000000 --- a/tests/assets/components/createAll/override-sdk/_override-sdk.md +++ /dev/null @@ -1,5 +0,0 @@ -# The **components/override-sdk** directory - -The **src/components/override-sdk** directory contains the code for components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run override** command to override the default implementation of a component, the generated code that you can use as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk**. diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/_designSystemExtension.md b/tests/assets/components/createAll/override-sdk/designSystemExtension/_designSystemExtension.md deleted file mode 100644 index 341a695c..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/_designSystemExtension.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/designSystemExtension** directory - -The **src/components/override-sdk/designSystemExtension** directory contains the code for components that **extend** the design system and for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **design system extension** component, the generated code that you can use -as a starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/designSystemExtension**. diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.html deleted file mode 100644 index 10ecec40..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.ts deleted file mode 100644 index 218b3cd2..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert-banner/alert-banner.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AlertComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-alert-banner', - templateUrl: './alert-banner.component.html', - styleUrls: ['./alert-banner.component.scss'], - standalone: true, - imports: [CommonModule, AlertComponent] -}) -export class AlertBannerComponent implements OnInit { - constructor() { } - - @Input() banners: Array; - - SEVERITY_MAP = { - urgent: 'error', - warning: 'warning', - success: 'success', - info: 'info' - }; - - ngOnInit(): void { } - - onAlertClose(config) { - const { PAGE, type, target } = config - const { clearMessages } = window.PCore.getMessageManager(); - clearMessages({ category: PAGE, type, context: target }); - } - -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.html deleted file mode 100644 index 2e73cbff..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.html +++ /dev/null @@ -1,18 +0,0 @@ -
-
- {{ getMatIcon(severity) }} -
-
{{ message }}
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.scss deleted file mode 100644 index b26f9e48..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.scss +++ /dev/null @@ -1,52 +0,0 @@ -.psdk-alert { - border: 1px solid; - display: flex; - align-items: center; - border-radius: 4px; - padding: 10px; - margin: 5px 0px; -} - -.psdk-alert-icon { - display: flex; - align-items: center; - margin-right: 10px; -} - -.psdk-alert-error { - color: rgb(82, 21, 8); - border: 1px solid rgb(207, 53, 22); - .mat-icon { - color: rgb(207, 53, 22); - } -} - -.psdk-grid-warning { - color: rgb(102, 60, 0); - border: 1px solid #ff9800; - .mat-icon { - color: #ff9800; - } -} - -.psdk-grid-success { - color: rgb(2, 46, 9); - border: 1px solid rgb(6, 116, 23); - .mat-icon { - color: rgb(6, 116, 23); - } -} - -.psdk-grid-info { - color: rgb(13, 60, 97); - border: 1px solid #2196f3; - .mat-icon { - color: #2196f3; - } -} - -.close-button { - background: none; - border: none; - cursor: pointer; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.ts deleted file mode 100644 index 90328dfa..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/alert/alert.component.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatIconModule } from '@angular/material/icon'; - -@Component({ - selector: 'app-alert', - templateUrl: './alert.component.html', - styleUrls: ['./alert.component.scss'], - standalone: true, - imports: [CommonModule, MatIconModule] -}) -export class AlertComponent implements OnInit { - constructor() { } - - @Input() message: Array; - @Input() severity; - @Input() hideClose; - @Output() onClose: EventEmitter = new EventEmitter(); - - ngOnInit(): void { } - - getMatIcon(severity) { - let variant; - switch (severity) { - case 'error': - variant = 'error_outline'; - break; - case 'warning': - variant = 'warning_amber'; - break; - case 'success': - variant = 'task_alt'; - break; - case 'info': - variant = 'info_outline'; - break; - } - return variant; - } - - onCloseClick() { - this.onClose.emit(); - } - -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.html deleted file mode 100644 index 62409bdc..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.spec.ts deleted file mode 100644 index 39bbde65..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CaseCreateStageComponent } from './case-create-stage.component'; - -describe('CaseCreateStageComponent', () => { - let component: CaseCreateStageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CaseCreateStageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CaseCreateStageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.ts deleted file mode 100644 index 9cce458f..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/case-create-stage/case-create-stage.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-case-create-stage', - templateUrl: './case-create-stage.component.html', - styleUrls: ['./case-create-stage.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class CaseCreateStageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - arChildren$: Array; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.html deleted file mode 100644 index c7d88918..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
-
-
- {{ field.config.label }} -
-
- - - --- - -
- -
- {{ field.config.value }} - {{ field.config.value }} - {{ field.config.value }} - {{ field.config.value }} - {{ field.config.value }} - - {{ field.config.value }} -
-
-
-
-
-
-
-
-
- {{ field.config.displayLabel }} -
-
- - -
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.scss deleted file mode 100644 index db6ad025..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.scss +++ /dev/null @@ -1,136 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-case-summary { - display: block; - margin: 0.625rem; -} - -.psdk-case-summary-primary { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-secondary { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-status { - text-align: left; - margin-bottom: 0.75rem; -} - -.psdk-case-summary-status-data { - display: block; - background-color: lavender; - color: $app-primary-color; - padding: 0rem 0.625rem; - display: inline; - font-size: 0.75rem; - font-weight: 700; - text-transform: uppercase; - line-height: 1.5rem; -} - -.psdk-case-summary-primary .label { - font-weight: 600; -} - -.psdk-case-summary-primary .data { - font-weight: 600; - font-size: 1.625rem; -} - -.psdk-case-summary-secondary .label { - font-weight: 600; -} -.psdk-case-summary-secondary .data { - font-weight: 600; - color: $app-primary-color; - padding-left: 1.25rem; -} - -.psdk-case-summary-fields { - padding: calc(2 * 0.5rem); - display: grid; - grid-row-gap: calc(2 * 0.5rem); -} - -.psdk-case-summary-fields-primary { - grid-template-columns: 20ch 1fr; - display: grid; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(2 * 0.5rem); -} - -.psdk-csf-primary-field { - display: grid; - grid-template-columns: 1fr; - grid-column-gap: calc(0 * 0.5rem); -} - -.psdk-csf-primary-field-header { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 1; - max-width: max-content; - font-size: 0.8125rem; - font-weight: 400; - color: rgba(0, 0, 0, 0.8); -} - -.psdk-csf-primary-field-data { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 2; - margin-inline-start: unset; -} - -.psdk-case-summary-fields-secondary { - width: 100%; - display: grid; - grid-template-columns: 1fr; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(1 * 0.5rem); -} - -.psdk-csf-secondary-field { - display: grid; - grid-template-columns: auto; - grid-column-gap: calc(2 * 0.5rem); -} - -.psdk-csf-secondary-field-header { - word-break: break-word; - grid-column-start: 1; - grid-row-start: 1; - max-width: max-content; - font-size: 0.8125rem; - font-weight: 400; - color: rgba(0, 0, 0, 0.8); -} - -.psdk-csf-secondary-field-data { - word-break: break-word; - grid-column-start: 2; - grid-row-start: 1; - margin-inline-start: unset; -} - -span.psdk-csf-text-style { - font-size: 1.125rem; - font-weight: 600; -} - -span.psdk-csf-status-style { - background-color: #e9eef3; - border-radius: calc(0.25 * 0.5rem); - color: #4c5a67; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.spec.ts deleted file mode 100644 index 0f192982..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MaterialCaseSummaryComponent } from './material-case-summary.component'; - -describe('MaterialCaseSummaryComponent', () => { - let component: MaterialCaseSummaryComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MaterialCaseSummaryComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialCaseSummaryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.ts deleted file mode 100644 index 330068ae..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-case-summary/material-case-summary.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-material-case-summary', - templateUrl: './material-case-summary.component.html', - styleUrls: ['./material-case-summary.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class MaterialCaseSummaryComponent implements OnInit { - @Input() status$: string; - @Input() bShowStatus$: boolean; - @Input() primaryFields$: Array; - @Input() secondaryFields$: Array; - - primaryFieldsWithStatus$: Array; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - this.updatePrimaryWithStatus(); - this.updateLabelAndDate(this.primaryFieldsWithStatus$); - this.updateLabelAndDate(this.secondaryFields$); - } - - ngOnChanges() { - this.updatePrimaryWithStatus(); - this.updateLabelAndDate(this.primaryFieldsWithStatus$); - this.updateLabelAndDate(this.secondaryFields$); - } - - updateLabelAndDate(arData: Array) { - for (let field of arData) { - switch (field.type.toLowerCase()) { - case 'caseoperator': - if (field.config.label.toLowerCase() == 'create operator') { - field.config['displayLabel'] = field.config.createLabel; - } else if (field.config.label.toLowerCase() == 'update operator') { - field.config['displayLabel'] = field.config.updateLabel; - } - break; - case 'date': - field.config.value = this.utils.generateDate(field.config.value, 'Date-Long'); - break; - } - } - } - - updatePrimaryWithStatus() { - this.primaryFieldsWithStatus$ = []; - for (let prim of this.primaryFields$) { - this.primaryFieldsWithStatus$.push(prim); - } - - if (this.bShowStatus$) { - const oStatus = { type: 'status', config: { value: this.status$, label: 'Status' } }; - - const count = this.primaryFieldsWithStatus$.length; - if (count < 2) { - this.primaryFieldsWithStatus$.push(oStatus); - } else { - this.primaryFieldsWithStatus$.splice(1, 0, oStatus); - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.html deleted file mode 100644 index 17eb9369..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
-
-
- -
- -
-
- {{ field.config.label }} -
-
- {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _formatDate(field.config.value, field.type) }} - - {{ _getValue(field.config.value) }} -
-
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.scss deleted file mode 100644 index bf59b6ef..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.scss +++ /dev/null @@ -1,33 +0,0 @@ -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; - } - - span.psdk-details-text-style-hf{ - font-weight: bold; - } - - span.psdk-details-status-style-hf { - background-color: #e9eef3; - border-radius: calc(0.25 * 0.5rem); - color: #4c5a67; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; - } - - .psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; - } - - .psdk-csf-primary-field-value { - margin: 8px 0; - } \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts deleted file mode 100644 index 548cac9d..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { MaterialDetailsFieldsComponent } from './material-details-fields.component'; - -describe('MaterialDetailsFieldsComponent', () => { - let component: MaterialDetailsFieldsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ MaterialDetailsFieldsComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(MaterialDetailsFieldsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.ts deleted file mode 100644 index 00155a12..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component, Input, forwardRef } from '@angular/core'; -import { Utils } from '@pega/angular-sdk-library'; -import { CommonModule } from '@angular/common'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-material-details-fields', - templateUrl: './material-details-fields.component.html', - styleUrls: ['./material-details-fields.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent) ] -}) -export class MaterialDetailsFieldsComponent { - - PCore$: any; - angularPConnect: any; - constructor(private utils: Utils) {} - - @Input() arFields$: Array; - @Input() arHighlightedFields: Array; - - ngOnInit(): void {} - - - _getValue(configValue) { - if (configValue && configValue != '') { - return configValue; - } else { - return '---'; - } - } - - _formatDate(dateValue: string, dateFormat: string): string { - return this.utils.generateDate(dateValue, dateFormat); - } - -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.html deleted file mode 100644 index f8de53eb..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-
-
- {{ field.config.label }} -
-
- {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _getValue(field.config.value) }} - {{ _formatDate(field.config.value, field.type) }} - - {{ _getValue(field.config.value) }} -
-
-
-
- - - -
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.scss deleted file mode 100644 index 6c64f1f9..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.scss +++ /dev/null @@ -1,121 +0,0 @@ -.psdk-details-group { - display: flex; - flex-direction: row; - justify-content: space-between; -} -.psdk-details-fields { - padding: calc(2 * 0.5rem); - grid-row-gap: calc(2 * 0.5rem); -} - -.psdk-details-fields-primary { - width: 100%; - display: grid; - grid-template-columns: 1fr; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(1 * 0.5rem); -} - -.psdk-details-fields-single { - display: grid; - grid-template-columns: 20ch 1fr; - grid-column-gap: calc(2 * 0.5rem); -} - -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} - -.psdk-details-fields-value { - word-break: break-word; - grid-column-start: 2; - grid-row-start: 1; -} - -span.psdk-details-text-style-hf{ - font-weight: 500; - font-size: 1.25rem; -} - -span.psdk-details-text-style { - font-weight: 400; -} - -span.psdk-details-status-style { - background-color: #e9eef3; - border-radius: calc(0.25 * 0.5rem); - color: #4c5a67; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; -} - -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-csf-primary-field-value { - margin: 8px 0; -} - -span.psdk-details-status-style-hf { - background-color: #e9eef3; - border-radius: calc(0.25 * 0.5rem); - color: #4c5a67; - display: inline-block; - font-size: 1.25rem; - font-weight: 500; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; -} - -.psdk-grid-filter-1 { - display: grid; - grid-template-columns: repeat(1,minmax(0,1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-grid-filter-2 { - display: grid; - grid-template-columns: repeat(2,minmax(0,1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-grid-filter-3 { - display: grid; - grid-template-columns: repeat(3,minmax(0,1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-grid-filter-wide-narrow { - display: grid; - grid-template-columns: 7fr 3fr; - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-grid-filter-narrow-wide { - display: grid; - grid-template-columns: 3fr 7fr; - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.spec.ts deleted file mode 100644 index 472b8fdc..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { MaterialDetailsComponent } from './material-details.component'; - -describe('MaterialDetailsComponent', () => { - let component: MaterialDetailsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ MaterialDetailsComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialDetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.ts deleted file mode 100644 index 57970782..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-details/material-details.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-material-details', - templateUrl: './material-details.component.html', - styleUrls: ['./material-details.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class MaterialDetailsComponent implements OnInit { - constructor(private utils: Utils) {} - - @Input() arFields$: Array; - @Input() arFields2$: Array; - @Input() arFields3$: Array; - @Input() arHighlightedFields: Array; - @Input() layout: any; - - ngOnInit(): void {} - - _getValue(configValue) { - if (configValue && configValue != '') { - return configValue; - } else { - return '---'; - } - } - - _formatDate(dateValue: string, dateFormat: string): string { - return this.utils.generateDate(dateValue, dateFormat); - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.html deleted file mode 100644 index 40810601..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
-
- -
-
-
- -
-
- {{item$.primary.name}} -
-
{{item$.secondary.text}}
-
-
-
- - - - - - - -
- - - - -
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.scss deleted file mode 100644 index 69a30c28..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.scss +++ /dev/null @@ -1,128 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.psdk-utility-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-utility-view-all { - width: 100%; - display: flex; - justify-content: center; -} - -.psdk-utility-count { - background: $app-primary-light-color; - border-radius: calc(1.125 * 0.5rem); - color: black; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - text-align: center; - width: 1.125rem; - - vertical-align: top; - margin: 0 0 0.313rem 1rem; -} - -.psdk-utility .header-text { - font-size: 1rem; - font-weight: bold; - padding-bottom: 0.3125rem; - text-align: left; - display: inline-block; -} - -.psdk-utility .header-icon { - display: inline-block; -} - -.psdk-utility { - width: 100%; - padding: 0.625rem 0rem; - text-align: left; - background-color: $app-form-color; - border-radius: 0.6125rem; - margin: 0.3125rem 0rem; -} -.psdk-utility .header { - text-align: left; - display: flex; - align-items: center;; -} - -.psdk-utility-svg-icon { - width: 1.4rem; - display: inline-block; -} - -.psdk-settings-svg-icon { - width: 1.4rem; - display: inline-block; - filter: $app-primary-color-filter; -} - - -.psdk-utility .message { - text-align: center; -} - -.psdk-utility-card { - display: flex; - flex-direction: row; - padding: 0.25rem 0rem 0.25rem 0.25rem; -} - -.psdk-utility-card-icon { - flex-grow: 1; - max-width: 2.813rem; -} - -.psdk-utility-card-svg-icon { - width: 2.5rem; - display: inline-block; -} - -.psdk-utility-card-main { - flex-grow: 2; - max-width: 16.563rem; -} - -.psdk-utility-card-main-primary-url { - color: $app-primary-color; -} - -.psdk-utility-card-main-primary-url .mat-mdc-button.mat-primary { - padding-left: 0px; -} - -.psdk-utility-card-main-primary-label { - font-weight: bold; -} - -.psdk-utility-card-actions { - flex-grow: 1; - text-align: right; -} - -.psdk-utility-card-action-svg-icon { - width: 1.4rem; - display: inline-block; -} - -.psdk-utility-card-actions-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: middle; - filter: $app-primary-color-filter; -} - -.psdk-utility-card-action-actions-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: bottom; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.spec.ts deleted file mode 100644 index 1ad3e7b9..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MaterialSummaryItemComponent } from './material-summary-item.component'; - -describe('MaterialSummaryItemComponent', () => { - let component: MaterialSummaryItemComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MaterialSummaryItemComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialSummaryItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.ts deleted file mode 100644 index 14a62e71..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-item/material-summary-item.component.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatMenuModule } from '@angular/material/menu'; -import { Utils } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-material-summary-item', - templateUrl: './material-summary-item.component.html', - styleUrls: ['./material-summary-item.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule, MatMenuModule] -}) -export class MaterialSummaryItemComponent implements OnInit { - @Input() PCore$: any; - @Input() item$: any; - @Input() menuIconOverride$: string = ''; - @Input() menuIconOverrideAction$: any; - - settingsSvgIcon$: string; - imagePath$: string = ''; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - this.imagePath$ = this.utils.getIconPath(this.utils.getSDKStaticContentUrl()); - - this.settingsSvgIcon$ = this.utils.getImageSrc('more', this.utils.getSDKStaticContentUrl()); - if (this.menuIconOverride$ != '') { - this.menuIconOverride$ = this.utils.getImageSrc(this.menuIconOverride$, this.utils.getSDKStaticContentUrl()); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.html deleted file mode 100644 index 4b747b04..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.scss deleted file mode 100644 index f1197474..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.spec.ts deleted file mode 100644 index 67f8a38a..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MaterialSummaryListComponent } from './material-summary-list.component'; - -describe('MaterialSummaryListComponent', () => { - let component: MaterialSummaryListComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MaterialSummaryListComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialSummaryListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.ts deleted file mode 100644 index 571dc6a2..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-summary-list/material-summary-list.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-material-summary-list', - templateUrl: './material-summary-list.component.html', - styleUrls: ['./material-summary-list.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class MaterialSummaryListComponent implements OnInit { - @Input() arItems$: Array; - @Input() icon$: string; - @Input() menuIconOverride$: string = ''; - @Input() menuIconOverrideAction$: any; - - PCore$: any; - - constructor() {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.html deleted file mode 100644 index 64a0c477..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
-
-
- -
-
{{ headerText$ }}
-
-
- -
-
-
-
-
{{ noItemsMessage$ }}
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.scss deleted file mode 100644 index f646c260..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.scss +++ /dev/null @@ -1,52 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.psdk-case-view-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-utility .header-text { - font-size: 1rem; - font-weight: bold; - padding-bottom: 0.3125rem; - text-align: left; - display: inline-block; -} - -.psdk-utility .header-icon { - display: inline-block; -} - -.psdk-utility { - width: 100%; - height: 6.25rem; - padding: 0.625rem 0rem; - text-align: left; - background-color: $app-form-color; - border-radius: 0.6125rem; - margin: 0.3125rem 0rem; -} -.psdk-utility .header { - text-align: left; - display: flex; - align-items: center; -} - -.psdk-utility-svg-icon { - width: 1.4rem; - display: inline-block; -} - -.psdk-settings-svg-icon { - width: 1.4rem; - display: inline-block; - filter: $app-primary-color-filter; -} - -.psdk-utility .message { - text-align: center; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.spec.ts deleted file mode 100644 index 72896d64..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MaterialUtilityComponent } from './material-utility.component'; - -describe('MaterialutilityComponent', () => { - let component: MaterialUtilityComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MaterialUtilityComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialUtilityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.ts deleted file mode 100644 index 4a3ae4bf..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-utility/material-utility.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { Utils } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-material-utility', - templateUrl: './material-utility.component.html', - styleUrls: ['./material-utility.component.scss'], - providers: [Utils], - standalone: true -}) -export class MaterialUtilityComponent implements OnInit { - @Input() headerText$: string; - @Input() headerIcon$: string; - @Input() headerIconUrl$: string; - @Input() noItemsMessage$: string; - - headerSvgIcon$: string; - settingsSvgIcon$: string; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - this.headerSvgIcon$ = this.utils.getImageSrc(this.headerIcon$, this.headerIconUrl$); - this.settingsSvgIcon$ = this.utils.getImageSrc('plus', this.headerIconUrl$); - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html deleted file mode 100644 index f15c2aa8..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
- - -
-
{{ tab.name }}
-
-   -
-
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss deleted file mode 100644 index 92f2bd87..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +++ /dev/null @@ -1,28 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -mat-button-toggle-group { - width: 100%; - border-width: 0.0625rem 0rem; -} - -mat-button-toggle-group ::ng-deep .mat-button-toggle-appearance-standard { - background-color: transparent; -} - -mat-button-toggle-group ::ng-deep .mat-button-toggle.mat-button-toggle-checked.mat-button-toggle-appearance-standard { - background-color: transparent; - border-right: 0.1875rem solid $app-primary-color; -} - -mat-button-toggle-group ::ng-deep .mat-button-toggle.mat-focus-indicator.mat-button-toggle-appearance-standard { - background-color: transparent; - border-right: 0.1875rem solid transparent; -} - -mat-button-toggle-group ::ng-deep .mat-button-toggle-appearance-standard .mat-button-toggle-label-content { - text-align: left; -} - -.psdk-vtab-badge .mat-badge-content { - top: 0rem; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.spec.ts deleted file mode 100644 index 63efb373..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MaterialVerticalTabsComponent } from './material-vertical-tabs.component'; - -describe('MaterialVerticalTabsComponent', () => { - let component: MaterialVerticalTabsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MaterialVerticalTabsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MaterialVerticalTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts deleted file mode 100644 index d3c95f12..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatBadgeModule } from '@angular/material/badge'; -import { MatButtonToggleModule } from '@angular/material/button-toggle'; - -@Component({ - selector: 'app-material-vertical-tabs', - templateUrl: './material-vertical-tabs.component.html', - styleUrls: ['./material-vertical-tabs.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonToggleModule, MatBadgeModule] -}) -export class MaterialVerticalTabsComponent implements OnInit { - @Input() tabConfig$: Array; - @Output() tabClick: EventEmitter = new EventEmitter(); - - selectedTabId$: any; - - constructor() {} - - ngOnInit(): void { - // tabConfig$ [ {name: , id: , count: }] - - if (this.tabConfig$) { - // seletedTabId is the first tab, unless another is selected - this.selectedTabId$ = this.tabConfig$[0]?.id; - - // run through and see anything is selected - for (let i in this.tabConfig$) { - let aTab = this.tabConfig$[i]; - if (aTab?.selected) { - this.selectedTabId$ = aTab.id; - break; - } - } - } - } - - onChange(tab: any) { - this.tabClick.emit(tab); - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.html deleted file mode 100644 index 74181960..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- -
-
{{ date$ }}
-
- -
-
-
-
-
{{ field.name }}
-
{{ field.value }}
-
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.scss deleted file mode 100644 index cca72694..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.scss +++ /dev/null @@ -1,74 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-operator { - display: flex; - flex-direction: row; - font-size: 0.8rem; - color: $app-neutral-color; -} - -.psdk-operator-popover { - display: table; - margin: auto; - min-width: 100px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; - position: absolute; - z-index: 99; -} - -.psdk-operator-name { - color: $app-neutral-color; -} - -.psdk-operator-value { - padding-left: 5px; - color: $app-neutral-dark-color; - margin: 0px; -} - -.psdk-single { - flex: 1; -} - -.psdk-double { - flex: 2; -} - -.psdk-top-pad { - padding-top: 10px; -} - -dl { - display: grid; - grid-template-columns: auto 1fr; - grid-column-gap: calc(2 * 0.5rem); - grid-row-gap: calc(1 * 0.5rem); -} - -dl::before, -dl::after { - box-sizing: border-box; - margin: 0; - padding: 0; -} - -dt { - max-width: 20ch; - grid-column-start: 1; -} - -dd { - max-width: 75ch; - grid-column-start: 2; -} - -.mat-mdc-button.mat-primary, -.mat-mdc-icon-button.mat-primary, -.mat-mdc-outlined-button.mat-primary { - padding: 0px; - line-height: unset; -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.spec.ts deleted file mode 100644 index 96ce9c56..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { OperatorComponent } from './operator.component'; - -describe('OperatorComponent', () => { - let component: OperatorComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ OperatorComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(OperatorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.ts deleted file mode 100644 index 607ff9b9..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/operator/operator.component.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Component, OnInit, Input, Renderer2, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-operator', - templateUrl: './operator.component.html', - styleUrls: ['./operator.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule] -}) -export class OperatorComponent implements OnInit { - @Input() date$: string; - @Input() name$: string; - - @Input() label$: string; - @Input() helperText$: string; - @Input() id$: string; - - PCore$: any; - - fields$: Array = []; - bShowPopover$: boolean; - - constructor(private renderer: Renderer2, private cdRef: ChangeDetectorRef, private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.renderer.listen('window', 'click', (e: Event) => { - if (this.bShowPopover$) { - this.bShowPopover$ = false; - } - }); - - this.date$ = this.utils.generateDate(this.date$, 'DateTime-Since'); - this.bShowPopover$ = false; - } - - ngOnDestroy(): void { - this.renderer.destroy(); - } - - showOperator() { - const operatorPreviewPromise = this.PCore$.getUserApi().getOperatorDetails(this.id$); - - operatorPreviewPromise.then((res) => { - if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) { - this.fields$ = [ - { - id: 'pyPosition', - name: 'Position', - value: res.data.pyOperatorInfo.pyPosition != '' ? res.data.pyOperatorInfo.pyPosition : '---' - }, - { - id: 'pyOrganization', - name: 'Organization', - value: res.data.pyOperatorInfo.pyOrganization != '' ? res.data.pyOperatorInfo.pyOrganization : '---' - }, - { - id: 'ReportToUserName', - name: 'Reports to', - value: res.data.pyOperatorInfo.pyReportToUserName != '' ? res.data.pyOperatorInfo.pyReportToUserName : '---' - }, - { - id: 'pyTelephone', - name: 'Telephone', - value: res.data.pyOperatorInfo.pyTelephone != '' ? res.data.pyOperatorInfo.pyTelephone : '---' - }, - { - id: 'pyEmailAddress', - name: 'Email address', - value: res.data.pyOperatorInfo.pyEmailAddress != '' ? res.data.pyOperatorInfo.pyEmailAddress : '---' - } - ]; - - this.bShowPopover$ = true; - this.cdRef.detectChanges(); - } - }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.html b/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.html deleted file mode 100644 index 655cb83f..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.scss b/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.spec.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.spec.ts deleted file mode 100644 index 26433f28..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PulseComponent } from './pulse.component'; - -describe('PulseComponent', () => { - let component: PulseComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PulseComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PulseComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.ts b/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.ts deleted file mode 100644 index 5f714161..00000000 --- a/tests/assets/components/createAll/override-sdk/designSystemExtension/pulse/pulse.component.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FeedContainerComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-pulse', - templateUrl: './pulse.component.html', - styleUrls: ['./pulse.component.scss'], - standalone: true, - imports: [FeedContainerComponent] -}) -export class PulseComponent implements OnInit { - @Input() pConn$: any; - - PCore$: any; - - configProps$: Object; - currentUser$: string; - currentUserInitials$: string = '--'; - - constructor() {} - - ngOnInit() { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - //this.currentUser$ = this.configProps$["currentUser"]; - this.currentUser$ = this.PCore$.getEnvironmentInfo().getOperatorName(); - - if (this.currentUser$ != '') { - this.currentUserInitials$ = this.currentUser$.charAt(0); - - if (this.currentUser$.lastIndexOf(' ') > 0) { - let lastName = this.currentUser$.substring(this.currentUser$.lastIndexOf(' ') + 1); - this.currentUserInitials$ += lastName.charAt(0); - } else if (this.currentUser$.lastIndexOf('.') > 0) { - let lastName = this.currentUser$.substring(this.currentUser$.lastIndexOf('.') + 1); - this.currentUserInitials$ += lastName.charAt(0); - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/_field.md b/tests/assets/components/createAll/override-sdk/field/_field.md deleted file mode 100644 index 2ede8890..00000000 --- a/tests/assets/components/createAll/override-sdk/field/_field.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/field** directory - -The **src/components/override-sdk/field** directory contains the code for **field** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **field** component, the generated code that you can use as a starting point -for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/field**. diff --git a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.html b/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.html deleted file mode 100644 index 2d7f86d8..00000000 --- a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - - {{ opt.value }} - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.scss b/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.spec.ts deleted file mode 100644 index bc91b1db..00000000 --- a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AutoCompleteComponent } from './auto-complete.component'; - -describe('AutoCompleteComponent', () => { - let component: AutoCompleteComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AutoCompleteComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AutoCompleteComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.ts b/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.ts deleted file mode 100644 index 0621dc93..00000000 --- a/tests/assets/components/createAll/override-sdk/field/auto-complete/auto-complete.component.ts +++ /dev/null @@ -1,318 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatOptionModule } from '@angular/material/core'; -import { MatAutocompleteModule } from '@angular/material/autocomplete'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { DatapageService } from '@pega/angular-sdk-library'; -import { handleEvent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-auto-complete', - templateUrl: './auto-complete.component.html', - styleUrls: ['./auto-complete.component.scss'], - standalone: true, - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatAutocompleteModule, - MatOptionModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class AutoCompleteComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - configProps$: any; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - options$: Array; - componentReference: string = ''; - testId: string; - listType: string; - columns = []; - - helperText: string; - fieldControl = new FormControl('', null); - parameters: {}; - hideLabel: any; - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils, - private dataPageService: DatapageService - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - const index = this.options$?.findIndex((element) => element.key === this.configProps$['value']); - this.value$ = index > -1 ? this.options$[index].value : this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.listType = this.configProps$['listType']; - const displayMode = this.configProps$['displayMode']; - let datasource = this.configProps$['datasource']; - let columns = this.configProps$['columns']; - this.hideLabel = this.configProps$['hideLabel']; - const { deferDatasource, datasourceMetadata } = this.configProps$; - this.helperText = this.configProps$['helperText']; - this.parameters = this.configProps$?.parameters; - const context = this.pConn$.getContextName(); - // convert associated to datapage listtype and transform props - // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList - if (deferDatasource && datasourceMetadata?.datasource?.name) { - this.listType = 'datapage'; - datasource = datasourceMetadata.datasource.name; - this.parameters = this.flattenParameters(datasourceMetadata?.datasource?.parameters); - const displayProp = datasourceMetadata.datasource.propertyForDisplayText.startsWith('@P') - ? datasourceMetadata.datasource.propertyForDisplayText.substring(3) - : datasourceMetadata.datasource.propertyForDisplayText; - const valueProp = datasourceMetadata.datasource.propertyForValue.startsWith('@P') - ? datasourceMetadata.datasource.propertyForValue.substring(3) - : datasourceMetadata.datasource.propertyForValue; - columns = [ - { - key: 'true', - setProperty: 'Associated property', - value: valueProp - }, - { - display: 'true', - primary: 'true', - useForSearch: true, - value: displayProp - } - ]; - } - if (columns) { - this.columns = this.preProcessColumns(columns); - } - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - if (this.listType === 'associated') { - this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject()); - } - - if (!displayMode && this.listType !== 'associated') { - const workListData = this.PCore$.getDataApiUtils().getData(datasource, {}); - - workListData.then((workListJSON: Object) => { - const optionsData: Array = []; - const results = workListJSON['data'].data; - const displayColumn = this.getDisplayFieldsMetaData(this.columns); - results?.forEach((element) => { - const obj = { - key: element.pyGUID || element[displayColumn.primary], - value: element[displayColumn.primary]?.toString() - }; - optionsData.push(obj); - }); - this.options$ = optionsData; - }); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - flattenParameters(params = {}) { - const flatParams = {}; - Object.keys(params).forEach((key) => { - const { name, value: theVal } = params[key]; - flatParams[name] = theVal; - }); - - return flatParams; - } - - getDisplayFieldsMetaData(columnList) { - const displayColumns = columnList.filter((col) => col.display === 'true'); - const metaDataObj: any = { key: '', primary: '', secondary: [] }; - const keyCol = columnList.filter((col) => col.key === 'true'); - metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto'; - for (let index = 0; index < displayColumns.length; index += 1) { - if (displayColumns[index].primary === 'true') { - metaDataObj.primary = displayColumns[index].value; - } else { - metaDataObj.secondary.push(displayColumns[index].value); - } - } - return metaDataObj; - } - - preProcessColumns(columnList) { - return columnList?.map((col) => { - const tempColObj = { ...col }; - tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value; - return tempColObj; - }); - } - - isSelected(buttonValue: string): boolean { - if (this.value$ === buttonValue) { - return true; - } - - return false; - } - - fieldOnChange(event: any) { - // this works - this.pConn$.setValue( this.componentReference, `property: ${this.componentReference}`); - // this works - this.pConn$.setValue( this.componentReference, this.fieldControl.value); - // PConnect wants to use changeHandler for onChange - // this.angularPConnect.changeHandler( this, event); - this.angularPConnectData.actions.onChange(this, event); - } - - optionChanged(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - let key = ''; - if (event?.target?.value) { - const index = this.options$?.findIndex((element) => element.value === event.target.value); - key = index > -1 ? (key = this.options$[index].key) : event.target.value; - } - - const value = key; - const actionsApi = this.pConn$?.getActionsApi(); - const propName = this.pConn$?.getStateProps().value; - handleEvent(actionsApi, 'changeNblur', propName, value); - if (this.configProps$?.onRecordChange) { - event.target.value = value; - this.configProps$.onRecordChange(event); - } - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/auto-complete/config.json b/tests/assets/components/createAll/override-sdk/field/auto-complete/config.json deleted file mode 100644 index b3e56275..00000000 --- a/tests/assets/components/createAll/override-sdk/field/auto-complete/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "AutoComplete", - "description": "Picklist", - "type": "Field", - "subtype": "PICKERS", - "icon": "", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.html b/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.html deleted file mode 100644 index 6d7a8296..00000000 --- a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.html +++ /dev/null @@ -1,18 +0,0 @@ -
-
-

{{ heading$ }}

-
-

{{ body1$ }}

-

{{ body2$ }}

-
- - - - - - - - - -
-
diff --git a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.scss b/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.scss deleted file mode 100644 index 0c0caef5..00000000 --- a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -.psdk-cancel-alert-background { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - height: 100%; - width: 100%; - background-color: rgba(100, 100, 100, 0.4); - position: fixed; - z-index: 9999; - top: 0px; - left: 0px; -} - -.psdk-cancel-alert-top { - display: table; - margin: auto; - min-width: 550px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; -} diff --git a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.spec.ts deleted file mode 100644 index cd12ab0e..00000000 --- a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CancelAlertComponent } from './cancel-alert.component'; - -describe('CancelAlertComponent', () => { - let component: CancelAlertComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CancelAlertComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CancelAlertComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.ts b/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.ts deleted file mode 100644 index f3f35441..00000000 --- a/tests/assets/components/createAll/override-sdk/field/cancel-alert/cancel-alert.component.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatGridListModule } from '@angular/material/grid-list'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { ErrorMessagesService } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-cancel-alert', - templateUrl: './cancel-alert.component.html', - styleUrls: ['./cancel-alert.component.scss'], - standalone: true, - imports: [CommonModule, MatGridListModule, MatButtonModule] -}) -export class CancelAlertComponent implements OnInit { - @Input() pConn$: any; - @Input() bShowAlert$: boolean; - @Output() onAlertState$ = new EventEmitter(); - - PCore$: any; - - heading$: string; - body1$: string; - body2$: string; - itemKey: string; - snackBarRef: any; - - constructor(private erService: ErrorMessagesService, private psService: ProgressSpinnerService) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - } - - ngOnChanges(changes) { - if (this.bShowAlert$) { - this.psService.sendMessage(false); - - const contextName = this.pConn$.getContextName(); - const caseInfo = this.pConn$.getCaseInfo(); - const caseName = caseInfo.getName(); - const ID = caseInfo.getID(); - - this.itemKey = contextName; - this.heading$ = 'Delete ' + caseName + ' (' + ID + ')'; - this.body1$ = 'Are you sure you want to delete ' + caseName + ' (' + ID + ')?'; - this.body2$ = 'Alternatively, you can continue working or save your work for later.'; - - //this.onAlertState$.emit(true); - } - } - - ngOnDestroy() {} - - dismissAlert() { - this.bShowAlert$ = false; - this.onAlertState$.emit(false); - } - - dismissAlertOnly() { - this.bShowAlert$ = false; - this.onAlertState$.emit(true); - } - - sendMessage(sMessage: string) { - //this.snackBarRef = this.snackBar.open(sMessage,"Ok", { duration: 3000}); - //this.erService.sendMessage("show", sMessage); - alert(sMessage); - } - - buttonClick(sAction) { - const dispatchInfo = { - context: this.itemKey, - semanticURL: '' - }; - - const actionsAPI = this.pConn$.getActionsApi(); - - switch (sAction) { - case 'save': - this.psService.sendMessage(true); - // eslint-disable-next-line no-case-declarations - const savePromise = actionsAPI.saveAndClose(this.itemKey); - savePromise - .then(() => { - this.psService.sendMessage(false); - this.dismissAlert(); - - this.PCore$.getPubSubUtils().publish(this.PCore$.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED); - }) - .catch(() => { - this.psService.sendMessage(false); - this.sendMessage('Save failed'); - }); - break; - case 'continue': - this.dismissAlertOnly(); - break; - case 'delete': - this.psService.sendMessage(true); - - // eslint-disable-next-line no-case-declarations - const deletePromise = actionsAPI.deleteCaseInCreateStage(this.itemKey); - - deletePromise - .then(() => { - this.psService.sendMessage(false); - this.dismissAlert(); - this.PCore$.getPubSubUtils().publish(this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL); - }) - .catch(() => { - this.psService.sendMessage(false); - this.sendMessage('Delete failed.'); - }); - break; - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.html b/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.html deleted file mode 100644 index a3fd5fde..00000000 --- a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.html +++ /dev/null @@ -1,41 +0,0 @@ -
- -
- -
-
-
- - - - {{ caption$ }} -
-
- {{ caption$ }} -
- {{ helperText }} - {{ getErrorMessage() }} -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.scss b/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.scss deleted file mode 100644 index 767c7526..00000000 --- a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -.psdk-full-width { - min-width: 9.375rem; - width: 100%; - text-align: left; -} - -.psdk-label-readonly { - top: 0rem; - margin-top: 0.625rem; - font-size: 0.875rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.spec.ts deleted file mode 100644 index 2f611342..00000000 --- a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CheckBoxComponent } from './check-box.component'; - -describe('CheckBoxComponent', () => { - let component: CheckBoxComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CheckBoxComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CheckBoxComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.ts b/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.ts deleted file mode 100644 index 04dbbc18..00000000 --- a/tests/assets/components/createAll/override-sdk/field/check-box/check-box.component.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-check-box', - templateUrl: './check-box.component.html', - styleUrls: ['./check-box.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, forwardRef(() => ComponentMapperComponent)] -}) -export class CheckBoxComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: any = ''; - caption$: string = ''; - testId: string = ''; - showLabel$: boolean = false; - checkboxLabelPos$ = 'after'; - isChecked$: boolean = false; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - this.caption$ = this.configProps$['caption']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - if (this.label$ != '') { - this.showLabel$ = true; - } - - if (this.value$ === 'true' || this.value$ == true) { - this.isChecked$ = true; - } else { - this.isChecked$ = false; - } - } - - fieldOnChange(event: any) { - event.value = event.checked; - - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - event.value = event.checked; - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/check-box/config.json b/tests/assets/components/createAll/override-sdk/field/check-box/config.json deleted file mode 100644 index 51f9c85f..00000000 --- a/tests/assets/components/createAll/override-sdk/field/check-box/config.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "Checkbox", - "description": "Boolean", - "type": "Field", - "subtype": "PICKERS", - "icon": "images/pz-checkbox-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT" - }, - { - "name": "hideLabel", - "label": "Hide Label", - "format": "BOOLEAN" - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "caption", - "label": "Caption", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/currency/config.json b/tests/assets/components/createAll/override-sdk/field/currency/config.json deleted file mode 100644 index 7dbc20c5..00000000 --- a/tests/assets/components/createAll/override-sdk/field/currency/config.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "Currency", - "description": "Currency", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-currency-active.svg", - "properties": [ - { - "name": "label", - "label": "Label value", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "CASCADE", - "source": { - "format": "SELECT", - "label": "ISO Code Selection", - "name": "isoCodeSelection", - "defaultValue": "constant", - "source": [ - { - "key": "constant", - "value": "Constant" - }, - { - "key": "propertyRef", - "value": "Property Reference" - } - ] - }, - "cascadeElements": [ - { - "key": "currencyISOCode", - "format": "TEXT", - "name": "currencyISOCode", - "label": "Currency ISO Code", - "defaultValue": "USD", - "match": "constant" - }, - { - "key": "currencyISOCode", - "format": "PROPERTY", - "name": "currencyISOCode", - "label": "Currency ISO Code", - "match": "propertyRef" - } - ] - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "allowDecimals", - "label": "Allow Decimals", - "format": "BOOLEAN", - "defaultValue": true - }, - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.html b/tests/assets/components/createAll/override-sdk/field/currency/currency.component.html deleted file mode 100644 index 28750f01..00000000 --- a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.html +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.scss b/tests/assets/components/createAll/override-sdk/field/currency/currency.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/currency/currency.component.spec.ts deleted file mode 100644 index 208cff63..00000000 --- a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CurrencyComponent } from './currency.component'; - -describe('CurrencyComponent', () => { - let component: CurrencyComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CurrencyComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CurrencyComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.ts b/tests/assets/components/createAll/override-sdk/field/currency/currency.component.ts deleted file mode 100644 index 2173b851..00000000 --- a/tests/assets/components/createAll/override-sdk/field/currency/currency.component.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-currency', - templateUrl: './currency.component.html', - styleUrls: ['./currency.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class CurrencyComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - this.value$ = nValue && typeof nValue == 'string' ? parseFloat(nValue) : nValue; - this.helperText = this.configProps$['helperText']; - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/date-time/config.json b/tests/assets/components/createAll/override-sdk/field/date-time/config.json deleted file mode 100644 index 6d2e4c58..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date-time/config.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "name": "DateTime", - "description": "Date & time", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "SELECT", - "name": "clockFormat", - "label": "Clock", - "defaultValue": "use locale", - "source": [ - { - "key": 0, - "value": "use locale" - }, - { - "key": 12, - "value": "12 hours" - }, - { - "key": 24, - "value": "24 hours" - } - ] - }, - { - "name": "withSeconds", - "label": "Display Seconds", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "LABEL", - "label": "Year range", - "variant": "secondary" - }, - { - "format": "INLINE", - "elements": [ - { - "key": "next", - "format": "LABEL", - "label": "Next", - "variant": "secondary" - }, - { - "key": "nextYears", - "format": "NUMBER", - "label": "", - "name": "nextYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "format": "INLINE", - "elements": [ - { - "key": "previous", - "format": "LABEL", - "label": "Previous", - "variant": "secondary" - }, - { - "key": "previousYears", - "format": "NUMBER", - "label": "", - "name": "previousYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "name": "showWeekNumber", - "label": "Display week numbers on calendar", - "format": "BOOLEAN" - }, - { - "format": "SELECT", - "name": "pickerInterval", - "label": "Time picker", - "defaultValue": "30", - "source": [ - { - "key": "5", - "value": "5 min" - }, - { - "key": "10", - "value": "10 min" - }, - { - "key": "15", - "value": "15 min" - }, - { - "key": "20", - "value": "20 min" - }, - { - "key": "30", - "value": "30 min" - }, - { - "key": "60", - "value": "1 hr" - } - ] - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Read-only settings", - "format": "GROUP", - "properties": [ - { - "name": "showAsFormattedText", - "label": "Show as formatted text", - "format": "BOOLEAN" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.html b/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.html deleted file mode 100644 index 14e79a34..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.scss b/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.spec.ts deleted file mode 100644 index 0657768b..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DateTimeComponent } from './date-time.component'; - -describe('DateTimeComponent', () => { - let component: DateTimeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DateTimeComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DateTimeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.ts b/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.ts deleted file mode 100644 index 7b8f2608..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date-time/date-time.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-date-time', - templateUrl: './date-time.component.html', - styleUrls: ['./date-time.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DateTimeComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: any; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.testId = this.configProps$['testId']; - if (this.configProps$['value'] != undefined) { - const value = this.configProps$['value']; - this.value$ = value ? value.replace('Z', '') : value; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - if (event.target.value) { - event.value = event.target.value; - } - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - if (event.target.value) event.value = event.target.value; - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/date/config.json b/tests/assets/components/createAll/override-sdk/field/date/config.json deleted file mode 100644 index b16b42f8..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "name": "Date", - "description": "Date only", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "LABEL", - "label": "Year range", - "variant": "secondary" - }, - { - "format": "INLINE", - "elements": [ - { - "key": "next", - "format": "LABEL", - "label": "Next", - "variant": "secondary" - }, - { - "key": "nextYears", - "format": "NUMBER", - "label": "", - "name": "nextYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "format": "INLINE", - "elements": [ - { - "key": "previous", - "format": "LABEL", - "label": "Previous", - "variant": "secondary" - }, - { - "key": "previousYears", - "format": "NUMBER", - "label": "", - "name": "previousYearRange", - "min": 0 - }, - { - "key": "year", - "format": "LABEL", - "label": "years", - "variant": "secondary" - } - ] - }, - { - "name": "showWeekNumber", - "label": "Display week numbers on calendar", - "format": "BOOLEAN" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Read-only settings", - "format": "GROUP", - "properties": [ - { - "name": "showAsFormattedText", - "label": "Show as formatted text", - "format": "BOOLEAN" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/date/date.component.html b/tests/assets/components/createAll/override-sdk/field/date/date.component.html deleted file mode 100644 index 3bc3ec7c..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date/date.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/date/date.component.scss b/tests/assets/components/createAll/override-sdk/field/date/date.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date/date.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/date/date.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/date/date.component.spec.ts deleted file mode 100644 index 5e629e06..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date/date.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DateComponent } from './date.component'; - -describe('DateComponent', () => { - let component: DateComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DateComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DateComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/date/date.component.ts b/tests/assets/components/createAll/override-sdk/field/date/date.component.ts deleted file mode 100644 index 89a61e19..00000000 --- a/tests/assets/components/createAll/override-sdk/field/date/date.component.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatNativeDateModule } from '@angular/material/core'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-date', - templateUrl: './date.component.html', - styleUrls: ['./date.component.scss'], - standalone: true, - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatDatepickerModule, - MatNativeDateModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class DateComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - label$: string = ''; - value$: any; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - let sDateValue: any = ''; - sDateValue = this.configProps$['value']; - - if (sDateValue != '') { - if (typeof sDateValue == 'object') { - sDateValue = sDateValue.toISOString(); - } else if (sDateValue.indexOf('/') < 0) { - // if we have the "pega" format, then for display, convert to standard format (US) - // sDateValue = this.formatDate(sDateValue); - sDateValue = this.utils.generateDate(sDateValue, 'Date-Long-Custom-YYYY'); - } - this.value$ = new Date(sDateValue); - } - } - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnDateChange(event: any, sValue: string) { - // this comes from the date pop up - if (typeof event.value == 'object') { - // convert date to pega "date" format - event.value = event.value.toISOString(); - } - this.angularPConnectData.actions.onChange(this, { value: event.value }); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - if (typeof event.value == 'object') { - event.value = event.value.toISOString(); - // convert date to pega "date" format - event.value = event.value.toISOString(); - } - this.angularPConnectData.actions.onBlur(this, { value: event.value }); - } - - hasErrors() { - return this.fieldControl.status === 'INVALID'; - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = `${this.fieldControl.errors.matDatepickerParse.text} is not a valid date value`; - } - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/decimal/config.json b/tests/assets/components/createAll/override-sdk/field/decimal/config.json deleted file mode 100644 index 1e3d50ec..00000000 --- a/tests/assets/components/createAll/override-sdk/field/decimal/config.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "Decimal", - "description": "Decimal", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-decimal-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "decimalPrecision", - "label": "Decimal places", - "format": "NUMBER", - "min": 0 - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.html b/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.html deleted file mode 100644 index be3f5022..00000000 --- a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.scss b/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.spec.ts deleted file mode 100644 index 9ede1aee..00000000 --- a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DecimalComponent } from './decimal.component'; - -describe('DecimalComponent', () => { - let component: DecimalComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DecimalComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DecimalComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.ts b/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.ts deleted file mode 100644 index 4218a71e..00000000 --- a/tests/assets/components/createAll/override-sdk/field/decimal/decimal.component.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-decimal', - templateUrl: './decimal.component.html', - styleUrls: ['./decimal.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DecimalComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // starting very simple... - - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseFloat(nValue); - } - this.value$ = nValue; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - this.componentReference = this.pConn$.getStateProps().value; - } - - fieldOnChange(event: any) { - // this.angularPConnect.changeHandler( this, event ); - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/dropdown/config.json b/tests/assets/components/createAll/override-sdk/field/dropdown/config.json deleted file mode 100644 index 3e83be8c..00000000 --- a/tests/assets/components/createAll/override-sdk/field/dropdown/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "Dropdown", - "description": "Picklist", - "type": "Field", - "subtype": "PICKERS", - "icon": "images/pz-dropdown-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.html b/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.html deleted file mode 100644 index 462a39f3..00000000 --- a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - - - {{ opt.value }} - - - {{ label$ }} - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.scss b/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.scss deleted file mode 100644 index 1f792ffe..00000000 --- a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.scss +++ /dev/null @@ -1,25 +0,0 @@ -.psdk-form { - min-width: 9.375rem; - width: 100%; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.spec.ts deleted file mode 100644 index 3e136498..00000000 --- a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DropdownComponent } from './dropdown.component'; - -describe('DropdownComponent', () => { - let component: DropdownComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DropdownComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DropdownComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.ts b/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.ts deleted file mode 100644 index 2e026d27..00000000 --- a/tests/assets/components/createAll/override-sdk/field/dropdown/dropdown.component.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatOptionModule } from '@angular/material/core'; -import { MatSelectModule } from '@angular/material/select'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { handleEvent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-dropdown', - templateUrl: './dropdown.component.html', - styleUrls: ['./dropdown.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatOptionModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DropdownComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: any; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - options$: Array; - componentReference: string = ''; - testId: string = ''; - helperText: string; - hideLabel: any; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - this.displayMode$ = this.configProps$['displayMode']; - this.label$ = this.configProps$['label']; - this.helperText = this.configProps$['helperText']; - this.hideLabel = this.configProps$['hideLabel']; - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject()); - optionsList?.unshift({ key: 'Select', value: 'Select...' }); - this.options$ = optionsList; - if (this.value$ === '' && !this.bReadonly$) { - this.value$ = 'Select'; - } - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - isSelected(buttonValue: string): boolean { - if (this.value$ === buttonValue) { - return true; - } - - return false; - } - - fieldOnChange(event: any) { - if (event?.value === 'Select') { - event.value = ''; - } - const actionsApi = this.pConn$?.getActionsApi(); - const propName = this.pConn$?.getStateProps().value; - handleEvent(actionsApi, 'changeNblur', propName, event.value); - if (this.configProps$?.onRecordChange) { - this.configProps$.onRecordChange(event); - } - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/email/config.json b/tests/assets/components/createAll/override-sdk/field/email/config.json deleted file mode 100644 index a7b82e6c..00000000 --- a/tests/assets/components/createAll/override-sdk/field/email/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "Email", - "description": "Email", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-email-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/email/email.component.html b/tests/assets/components/createAll/override-sdk/field/email/email.component.html deleted file mode 100644 index 6971c175..00000000 --- a/tests/assets/components/createAll/override-sdk/field/email/email.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/email/email.component.scss b/tests/assets/components/createAll/override-sdk/field/email/email.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/email/email.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/email/email.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/email/email.component.spec.ts deleted file mode 100644 index 79393fbe..00000000 --- a/tests/assets/components/createAll/override-sdk/field/email/email.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { EmailComponent } from './email.component'; - -describe('EmailComponent', () => { - let component: EmailComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ EmailComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(EmailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/email/email.component.ts b/tests/assets/components/createAll/override-sdk/field/email/email.component.ts deleted file mode 100644 index fc942b78..00000000 --- a/tests/assets/components/createAll/override-sdk/field/email/email.component.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-email', - templateUrl: './email.component.html', - styleUrls: ['./email.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class EmailComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/integer/config.json b/tests/assets/components/createAll/override-sdk/field/integer/config.json deleted file mode 100644 index 5407b5c8..00000000 --- a/tests/assets/components/createAll/override-sdk/field/integer/config.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "Integer", - "description": "Integer", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-integer-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.html b/tests/assets/components/createAll/override-sdk/field/integer/integer.component.html deleted file mode 100644 index 6560050c..00000000 --- a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.scss b/tests/assets/components/createAll/override-sdk/field/integer/integer.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/integer/integer.component.spec.ts deleted file mode 100644 index 1477d360..00000000 --- a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { IntegerComponent } from './integer.component'; - -describe('IntegerComponent', () => { - let component: IntegerComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ IntegerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(IntegerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.ts b/tests/assets/components/createAll/override-sdk/field/integer/integer.component.ts deleted file mode 100644 index c22cc828..00000000 --- a/tests/assets/components/createAll/override-sdk/field/integer/integer.component.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-integer', - templateUrl: './integer.component.html', - styleUrls: ['./integer.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class IntegerComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseInt(nValue); - } - this.value$ = nValue; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/percentage/config.json b/tests/assets/components/createAll/override-sdk/field/percentage/config.json deleted file mode 100644 index 625968d2..00000000 --- a/tests/assets/components/createAll/override-sdk/field/percentage/config.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "Percentage", - "description": "Percentage", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "decimalPrecision", - "label": "Decimal places", - "format": "NUMBER", - "min": 0 - }, - { - "name": "showGroupSeparators", - "label": "Show thousands separator", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.html b/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.html deleted file mode 100644 index 95498666..00000000 --- a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.html +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.scss b/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.scss deleted file mode 100644 index af04528b..00000000 --- a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; - } - - .psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(.75) perspective(100px) translateZ(.001px); - -ms-transform: translateY(-1.28125em) scale(.75); - width: 133.33333%; - } - - .psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; - } - - ::ng-deep .mat-mdc-form-field-infix { - width: auto; - } \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.spec.ts deleted file mode 100644 index adaeef98..00000000 --- a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PercentageComponent } from './percentage.component'; - -describe('PercentageComponent', () => { - let component: PercentageComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PercentageComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PercentageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.ts b/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.ts deleted file mode 100644 index 2c753a08..00000000 --- a/tests/assets/components/createAll/override-sdk/field/percentage/percentage.component.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-percentage', - templateUrl: './percentage.component.html', - styleUrls: ['./percentage.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class PercentageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: number; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl(null, null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - let nValue = this.configProps$['value']; - if (nValue) { - if (typeof nValue == 'string') { - nValue = parseInt(nValue); - } - this.value$ = nValue; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/phone/config.json b/tests/assets/components/createAll/override-sdk/field/phone/config.json deleted file mode 100644 index 64277806..00000000 --- a/tests/assets/components/createAll/override-sdk/field/phone/config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "Phone", - "description": "Phone", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-phone-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "name": "showCountryCode", - "label": "Show Country Code", - "format": "BOOLEAN", - "defaultValue": true - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.html b/tests/assets/components/createAll/override-sdk/field/phone/phone.component.html deleted file mode 100644 index dd46cb2f..00000000 --- a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
-
- - - - {{ getErrorMessage() }} - -
-
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.scss b/tests/assets/components/createAll/override-sdk/field/phone/phone.component.scss deleted file mode 100644 index 40d8f616..00000000 --- a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.scss +++ /dev/null @@ -1,81 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.phone-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -::ng-deep .iti { - display: block !important; - margin-bottom: 20px; - - .dropdown-menu.country-dropdown { - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-color: #c7cace; - margin-top: -1px; - } - - .iti__country-list { - box-shadow: none; - font-size: 14px; - margin-left: 0; - width: 244px; - max-height: 170px; - } - - .search-container input { - font-size: 14px; - border-color: #c7cace; - border-radius: 0; - padding: 5px 10px; - } - - .search-container input:focus { - outline: none; - } -} - -::ng-deep .iti__flag-container.open + input { - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - -::ng-deep ngx-mat-intl-tel-input { - .country-selector { - opacity: 1 !important; - bottom: 8px !important; - } - - input:not(.country-search) { - bottom: 3px; - left: 10px; - } - - .country-list-button { - font-size: 0.8rem !important; - } - - .mat-menu-content:not(:empty) { - max-height: 250px; - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/phone/phone.component.spec.ts deleted file mode 100644 index 73355d45..00000000 --- a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PhoneComponent } from './phone.component'; - -describe('PhoneComponent', () => { - let component: PhoneComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PhoneComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PhoneComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.ts b/tests/assets/components/createAll/override-sdk/field/phone/phone.component.ts deleted file mode 100644 index a0ffc1a5..00000000 --- a/tests/assets/components/createAll/override-sdk/field/phone/phone.component.ts +++ /dev/null @@ -1,193 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input'; -import { Utils } from '@pega/angular-sdk-library'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { handleEvent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -@Component({ - selector: 'app-phone', - templateUrl: './phone.component.html', - styleUrls: ['./phone.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, NgxMatIntlTelInputComponent, forwardRef(() => ComponentMapperComponent)] -}) -export class PhoneComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - separateDialCode = false; - afterBlur: boolean; - helperText: string; - - fieldControl = new FormControl('', null); - - phoneForm = new FormGroup({ - phone: new FormControl(undefined) - }); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.testId = this.configProps$['testId']; - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - if (this.bReadonly$) { - this.phoneForm.setValue({ phone: this.value$ }); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - if (this.formGroup$.controls[this.controlName$].value) { - const actionsApi = this.pConn$?.getActionsApi(); - const propName = this.pConn$?.getStateProps().value; - const value = this.formGroup$.controls[this.controlName$].value; - const eventObj = { - target: { - value - } - }; - this.afterBlur = true; - this.angularPConnectData.actions.onChange(this, eventObj); - handleEvent(actionsApi, 'blur', propName, value); - } - } - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = 'Invalid Phone'; - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/radio-buttons/config.json b/tests/assets/components/createAll/override-sdk/field/radio-buttons/config.json deleted file mode 100644 index 07012db9..00000000 --- a/tests/assets/components/createAll/override-sdk/field/radio-buttons/config.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "RadioButtons", - "description": "Picklist", - "type": "Field", - "subtype": "PICKERS", - "icon": "images/pz-radio-button-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.html b/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.html deleted file mode 100644 index f3ad2f23..00000000 --- a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- -
- -
-
- - - - - - - - - {{ opt.value }} - - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.scss b/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.scss deleted file mode 100644 index 9cc21ff9..00000000 --- a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.scss +++ /dev/null @@ -1,39 +0,0 @@ -.psdk-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.psdk-radio-horizontal { - display: flex; - flex-direction: row; -} - -.psdk-radio-vertical { - display: flex; - flex-direction: column; -} - -.psdk-radio-button { - padding: 0.3125rem; -} - -.psdk-radio-form { - width: 100%; -} - -.psdk-radio-form ::ng-deep .mat-form-field-underline { - background-color: transparent; -} - -.psdk-radio-form ::ng-deep .mat-form-field-label { - top: 0em; -} diff --git a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.spec.ts deleted file mode 100644 index d24ce926..00000000 --- a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { RadioButtonsComponent } from './radio-buttons.component'; - -describe('RadioButtonsComponent', () => { - let component: RadioButtonsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ RadioButtonsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(RadioButtonsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.ts b/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.ts deleted file mode 100644 index 2005fe48..00000000 --- a/tests/assets/components/createAll/override-sdk/field/radio-buttons/radio-buttons.component.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatRadioModule } from '@angular/material/radio'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-radio-buttons', - templateUrl: './radio-buttons.component.html', - styleUrls: ['./radio-buttons.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatRadioModule, forwardRef(() => ComponentMapperComponent)] -}) -export class RadioButtonsComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - options$: Array; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject()); - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - isSelected(buttonValue: string): boolean { - if (this.value$ === buttonValue) { - return true; - } - - return false; - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.html b/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.html deleted file mode 100644 index 8789ac97..00000000 --- a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
- - -
-
{{ label$ }}
-
{{ value$ || "---" }}
-
-
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.scss b/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.scss deleted file mode 100644 index 85364323..00000000 --- a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} - -.psdk-value { - margin: 8px 0px; -} diff --git a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.ts b/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.ts deleted file mode 100644 index c323a0dc..00000000 --- a/tests/assets/components/createAll/override-sdk/field/semantic-link/semantic-link.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-semantic-link', - templateUrl: './semantic-link.component.html', - styleUrls: ['./semantic-link.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class SemanticLinkComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - displayMode$: string = ''; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.value$ = this.configProps$['text'] || '---'; - this.displayMode$ = this.configProps$['displayMode']; - this.label$ = this.configProps$['label']; - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-area/config.json b/tests/assets/components/createAll/override-sdk/field/text-area/config.json deleted file mode 100644 index c543f34e..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-area/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "TextArea", - "description": "Text (paragraph)", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-text-area-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.html b/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.html deleted file mode 100644 index 7e2962bd..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
-
- - - {{ getErrorMessage() }} - -
-
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.scss b/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.spec.ts deleted file mode 100644 index 81dc1912..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TextAreaComponent } from './text-area.component'; - -describe('TextAreaComponent', () => { - let component: TextAreaComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TextAreaComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TextAreaComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.ts b/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.ts deleted file mode 100644 index e360c948..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-area/text-area.component.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-text-area', - templateUrl: './text-area.component.html', - styleUrls: ['./text-area.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class TextAreaComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - nMaxLength$: number; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - testId: string; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.nMaxLength$ = this.pConn$.getFieldMetadata(this.pConn$.getRawConfigProps()?.value)?.maxLength || 100; - this.testId = this.configProps$['testId']; - this.displayMode$ = this.configProps$['displayMode']; - this.label$ = this.configProps$['label']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - // PConnect wants to use changeHandler for onChange - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - // field control gets error message from here - - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/text-content/config.json b/tests/assets/components/createAll/override-sdk/field/text-content/config.json deleted file mode 100644 index 310d7922..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-content/config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "TextContent", - "description": "Text", - "type": "Field", - "subtype": "DATA_DISPLAY", - "icon": "images/text-content.svg", - "properties": [ - { - "format": "SELECT", - "name": "displayAs", - "label": "Component", - "defaultValue": "Paragraph", - "source": [ - { "key": "Paragraph", "value": "Paragraph" }, - { "key": "Heading 1", "value": "Heading 1" }, - { "key": "Heading 2", "value": "Heading 2" }, - { "key": "Heading 3", "value": "Heading 3" }, - { "key": "Heading 4", "value": "Heading 4" } - ] - }, - { - "name": "content", - "label": " ", - "format": "TEXT", - "multiline": true - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.html b/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.html deleted file mode 100644 index 9f8fa2e3..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
{{ content$ }}
-
{{ content$ }}
-
{{ content$ }}
-
{{ content$ }}
-
{{ content$ }}
-
diff --git a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.scss b/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.scss deleted file mode 100644 index 6674e65d..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -.psdk-data-readonly { - margin-top: 0.625rem; - width: 100%; -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.spec.ts deleted file mode 100644 index b092e685..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TextContentComponent } from './text-content.component'; - -describe('TextContentComponent', () => { - let component: TextContentComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TextContentComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TextContentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.ts b/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.ts deleted file mode 100644 index a6178399..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-content/text-content.component.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-text-content', - templateUrl: './text-content.component.html', - styleUrls: ['./text-content.component.scss'], - standalone: true, - imports: [CommonModule] -}) -export class TextContentComponent implements OnInit { - @Input() pConn$: any; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - content$: string = ''; - displayAs$: string; - displayMode$: string = ''; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - if (this.configProps$['content'] != undefined) { - this.content$ = this.configProps$['content']; - } - if (this.configProps$['displayAs'] != undefined) { - this.displayAs$ = this.configProps$['displayAs']; - } - this.displayMode$ = this.configProps$['displayMode']; - - // Any update to content or displayAs will re-render this component. - // All rendering logic is in the .html file. - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-input/config.json b/tests/assets/components/createAll/override-sdk/field/text-input/config.json deleted file mode 100644 index 1e73ff8e..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-input/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "TextInput", - "description": "Text (single line)", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.html b/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.html deleted file mode 100644 index 3e8e022f..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.scss b/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.spec.ts deleted file mode 100644 index 6dd3bfb3..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TextInputComponent } from './text-input.component'; - -describe('TextInputComponent', () => { - let component: TextInputComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TextInputComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TextInputComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.ts b/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.ts deleted file mode 100644 index 4210cd0d..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text-input/text-input.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-text-input', - templateUrl: './text-input.component.html', - styleUrls: ['./text-input.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class TextInputComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - testId: string = ''; - bHasForm$: boolean = true; - componentReference: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - // this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.testId = this.configProps$['testId']; - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - this.componentReference = this.pConn$.getStateProps().value; - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/text/text.component.html b/tests/assets/components/createAll/override-sdk/field/text/text.component.html deleted file mode 100644 index 55ddf6b7..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text/text.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
- -
- - - -
- - {{ formattedValue$ }} -
-
-
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/field/text/text.component.scss b/tests/assets/components/createAll/override-sdk/field/text/text.component.scss deleted file mode 100644 index bee2b661..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text/text.component.scss +++ /dev/null @@ -1,30 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - opacity: 54%; - font-size: 0.7rem; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} - -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/field/text/text.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/text/text.component.spec.ts deleted file mode 100644 index fa94e0e4..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text/text.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TextComponent } from './text.component'; - -describe('TextComponent', () => { - let component: TextComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TextComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TextComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/text/text.component.ts b/tests/assets/components/createAll/override-sdk/field/text/text.component.ts deleted file mode 100644 index 2f74487b..00000000 --- a/tests/assets/components/createAll/override-sdk/field/text/text.component.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-text', - templateUrl: './text.component.html', - styleUrls: ['./text.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class TextComponent implements OnInit { - @Input() pConn$: any; - @Input() formatAs$: string; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - componentReference: string = ''; - formattedValue$: string; - format$: string = 'text'; - formattedUrl$: string = ''; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - - // call updateSelf when initializing - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - // TDB - get formats - switch (this.formatAs$) { - case 'text': - this.formattedValue$ = this.value$; - break; - case 'date': - this.formattedValue$ = this.generateDate(this.value$); - break; - case 'date-time': - this.formattedValue$ = this.generateDateTime(this.value$); - break; - case 'time': - if (this.value$) { - const timeParts = this.value$.split(':'); - this.formattedValue$ = `${timeParts[0]}:${timeParts[1]}`; - } else { - this.formattedValue$ = ''; - } - break; - case 'url': - this.formattedUrl$ = this.generateUrl(this.value$); - this.formattedValue$ = this.value$; - break; - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - generateUrl(sVal): string { - if (sVal.indexOf('https://') == 0 || sVal.indexOf('http://') == 0) { - } else { - // assume no http - sVal = 'http://' + sVal; - } - - return sVal; - } - - generateDate(sVal): string { - if (!sVal) return ''; - // const value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric' - // }).format(new Date(sVal + "T00:00")); - - return this.utils.generateDate(sVal, 'Date-Long-Custom-YYYY'); - } - - generateDateTime(sVal): string { - if (!sVal) return ''; - if (sVal.length === 10) return this.generateDate(sVal); - let value = sVal.substring(0, sVal.length - 1); - // value = new Intl.DateTimeFormat('default', { - // year: 'numeric', - // month: 'numeric', - // day: 'numeric', - // hour: 'numeric', - // minute: 'numeric', - // second: 'numeric', - // hour12: true, - // }).format(new Date(value)) - - return this.utils.generateDateTime(value, 'DateTime-Long-YYYY-Custom'); - } -} diff --git a/tests/assets/components/createAll/override-sdk/field/time/config.json b/tests/assets/components/createAll/override-sdk/field/time/config.json deleted file mode 100644 index 07cacb09..00000000 --- a/tests/assets/components/createAll/override-sdk/field/time/config.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "Time", - "description": "Time only", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-date-time-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "format": "SELECT", - "name": "clockFormat", - "label": "Clock", - "defaultValue": "use locale", - "source": [ - { - "key": 0, - "value": "use locale" - }, - { - "key": 12, - "value": "12 hours" - }, - { - "key": 24, - "value": "24 hours" - } - ] - }, - { - "name": "withSeconds", - "label": "Display Seconds", - "format": "BOOLEAN" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "format": "SELECT", - "name": "pickerInterval", - "label": "Time picker", - "defaultValue": "30", - "source": [ - { - "key": "5", - "value": "5 min" - }, - { - "key": "10", - "value": "10 min" - }, - { - "key": "15", - "value": "15 min" - }, - { - "key": "20", - "value": "20 min" - }, - { - "key": "30", - "value": "30 min" - }, - { - "key": "60", - "value": "1 hr" - } - ] - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/time/time.component.html b/tests/assets/components/createAll/override-sdk/field/time/time.component.html deleted file mode 100644 index f3c4798a..00000000 --- a/tests/assets/components/createAll/override-sdk/field/time/time.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/time/time.component.scss b/tests/assets/components/createAll/override-sdk/field/time/time.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/time/time.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/time/time.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/time/time.component.spec.ts deleted file mode 100644 index 0d748765..00000000 --- a/tests/assets/components/createAll/override-sdk/field/time/time.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { TimeComponent } from './time.component'; - -describe('TimeComponent', () => { - let component: TimeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ TimeComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(TimeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/time/time.component.ts b/tests/assets/components/createAll/override-sdk/field/time/time.component.ts deleted file mode 100644 index 28329a63..00000000 --- a/tests/assets/components/createAll/override-sdk/field/time/time.component.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-time', - templateUrl: './time.component.html', - styleUrls: ['./time.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class TimeComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - event.value = event.target.value; - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - event.value = event.target.value; - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/url/config.json b/tests/assets/components/createAll/override-sdk/field/url/config.json deleted file mode 100644 index d4d3e1f7..00000000 --- a/tests/assets/components/createAll/override-sdk/field/url/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "URL", - "description": "URL", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-url-active.svg", - "properties": [ - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/url/url.component.html b/tests/assets/components/createAll/override-sdk/field/url/url.component.html deleted file mode 100644 index cbbec6ba..00000000 --- a/tests/assets/components/createAll/override-sdk/field/url/url.component.html +++ /dev/null @@ -1,27 +0,0 @@ -
- -
- -
-
- - {{ label$ }} - - {{ getErrorMessage() }} - -
-
-
- - - diff --git a/tests/assets/components/createAll/override-sdk/field/url/url.component.scss b/tests/assets/components/createAll/override-sdk/field/url/url.component.scss deleted file mode 100644 index 2e3f5529..00000000 --- a/tests/assets/components/createAll/override-sdk/field/url/url.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/field/url/url.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/url/url.component.spec.ts deleted file mode 100644 index c11fc489..00000000 --- a/tests/assets/components/createAll/override-sdk/field/url/url.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { UrlComponent } from './url.component'; - -describe('UrlComponent', () => { - let component: UrlComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ UrlComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(UrlComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/url/url.component.ts b/tests/assets/components/createAll/override-sdk/field/url/url.component.ts deleted file mode 100644 index cb1d6538..00000000 --- a/tests/assets/components/createAll/override-sdk/field/url/url.component.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-url', - templateUrl: './url.component.html', - styleUrls: ['./url.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class UrlComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - label$: string = ''; - value$: string = ''; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - displayMode$: string = ''; - controlName$: string; - bHasForm$: boolean = true; - componentReference: string = ''; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.controlName$ = this.angularPConnect.getComponentID(this); - - // Then, continue on with other initialization - - // call updateSelf when initializing - //this.updateSelf(); - this.checkAndUpdate(); - - if (this.formGroup$ != null) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - this.bHasForm$ = true; - } else { - this.bReadonly$ = true; - this.bHasForm$ = false; - } - } - - ngOnDestroy(): void { - if (this.formGroup$ != null) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['value'] != undefined) { - this.value$ = this.configProps$['value']; - } - - this.label$ = this.configProps$['label']; - this.displayMode$ = this.configProps$['displayMode']; - this.helperText = this.configProps$['helperText']; - - // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - if (this.configProps$['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(this.configProps$['required']); - } - this.cdRef.detectChanges(); - }); - - if (this.configProps$['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // disabled - if (this.configProps$['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(this.configProps$['disabled']); - } - - if (this.bDisabled$) { - this.fieldControl.disable(); - } else { - this.fieldControl.enable(); - } - - if (this.configProps$['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(this.configProps$['readOnly']); - } - - this.componentReference = this.pConn$.getStateProps().value; - - // trigger display of error message with field control - if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') { - let timer = interval(100).subscribe(() => { - this.fieldControl.setErrors({ message: true }); - this.fieldControl.markAsTouched(); - - timer.unsubscribe(); - }); - } - } - - fieldOnChange(event: any) { - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnClick(event: any) {} - - fieldOnBlur(event: any) { - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onBlur(this, event); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/field/user-reference/config.json b/tests/assets/components/createAll/override-sdk/field/user-reference/config.json deleted file mode 100644 index 0f6bcff6..00000000 --- a/tests/assets/components/createAll/override-sdk/field/user-reference/config.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "UserReference", - "description": "User reference", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "displayAs", - "label": "Display As", - "format": "TEXT", - "disabled": true - }, - { - "name": "label", - "label": "Field label", - "format": "TEXT", - "required": true - }, - { - "name": "readOnly", - "label": "Edit mode", - "format": "READONLY" - }, - { - "label": "Input settings", - "format": "GROUP", - "visibility": "(!readOnly = true)", - "properties": [ - { - "name": "placeholder", - "label": "Placeholder", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - } - ] - }, - { - "label": "Read-only settings", - "format": "GROUP", - "properties": [ - { - "name": "showAsFormattedText", - "label": "Show as formatted text", - "format": "BOOLEAN" - } - ] - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "visibility": "(!readOnly = true)" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "visibility": "(!readOnly = true)" - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.html b/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.html deleted file mode 100644 index 85125fae..00000000 --- a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.html +++ /dev/null @@ -1,49 +0,0 @@ -
-
- {{ label$ }} - -
-
- - - - {{ opt.value }} - - - {{ label$ }} - - {{ getErrorMessage() }} - - -
-
- - {{ label$ }} - - - - {{ opt.value }} - - - - {{ getErrorMessage() }} - - -
-
diff --git a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.scss b/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.scss deleted file mode 100644 index d7803db3..00000000 --- a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.scss +++ /dev/null @@ -1,30 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-user-reference { - font-size: 0.8rem; - color: $app-neutral-color; -} -.psdk-single { - flex: 1; -} - -.psdk-double { - flex: 2; -} - -.psdk-top-pad { - padding-top: 10px; -} - -.psdk-full-width { - width: 100%; - padding-left: 0.625rem; -} - -dt { - flex: 1; -} - -dd { - flex: 2; -} diff --git a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.spec.ts b/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.spec.ts deleted file mode 100644 index 375bda7e..00000000 --- a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { UserReferenceComponent } from './user-reference.component'; - -describe('UserReferenceComponent', () => { - let component: UserReferenceComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ UserReferenceComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(UserReferenceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.ts b/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.ts deleted file mode 100644 index c18d0283..00000000 --- a/tests/assets/components/createAll/override-sdk/field/user-reference/user-reference.component.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatAutocompleteModule } from '@angular/material/autocomplete'; -import { MatInputModule } from '@angular/material/input'; -import { MatOptionModule } from '@angular/material/core'; -import { MatSelectModule } from '@angular/material/select'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { OperatorComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -const OPERATORS_DP = 'D_pyGetOperatorsForCurrentApplication'; -const DROPDOWN_LIST = 'Drop-down list'; -const SEARCH_BOX = 'Search box'; - -@Component({ - selector: 'app-user-reference', - templateUrl: './user-reference.component.html', - styleUrls: ['./user-reference.component.scss'], - standalone: true, - imports: [ - CommonModule, - OperatorComponent, - ReactiveFormsModule, - MatFormFieldModule, - MatSelectModule, - MatOptionModule, - MatInputModule, - MatAutocompleteModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class UserReferenceComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - PCore$: any; - angularPConnectData: any = {}; - controlName$: string; - value$; - userName$: string; - label$: string; - userID$: string; - options$: any; - bReadonly$: boolean; - bRequired$: boolean; - showAsFormattedText$: boolean; - displayAs$: string; - testId: string; - helperText: string; - - fieldControl = new FormControl('', null); - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.controlName$ = this.angularPConnect.getComponentID(this); - - this.checkAndUpdate(); - - if (this.formGroup$) { - // add control to formGroup - this.formGroup$.addControl(this.controlName$, this.fieldControl); - this.fieldControl.setValue(this.value$); - } - } - - ngOnDestroy() { - if (this.formGroup$) { - this.formGroup$.removeControl(this.controlName$); - } - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - get type(): string { - if (this.bReadonly$ && this.showAsFormattedText$) { - return 'operator'; - } - if (this.displayAs$ === DROPDOWN_LIST) { - return 'dropdown'; - } - if (this.displayAs$ === SEARCH_BOX) { - return 'searchbox'; - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - let props = this.pConn$.getConfigProps(); - this.testId = props['testId']; - - const { label, displayAs, value, showAsFormattedText, helperText } = props; - - this.label$ = label; - this.showAsFormattedText$ = showAsFormattedText; - this.displayAs$ = displayAs; - this.helperText = helperText; - - let { readOnly, required, disabled } = props; - [this.bReadonly$, this.bRequired$, disabled] = [readOnly, required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - const isUserNameAvailable = (user) => { - return typeof user === 'object' && user !== null && user.userName; - }; - - this.userID$ = this.utils.getUserId(value); - - if (this.userID$ && this.bReadonly$ && this.showAsFormattedText$) { - if (isUserNameAvailable(value)) { - this.userName$ = value.userName; - } else { - // if same user ref field is referred in view as editable & readonly formatted text - // referenced users won't be available, so get user details from dx api - const { getOperatorDetails } = this.PCore$.getUserApi(); - getOperatorDetails(this.userID$).then((resp) => { - if (resp.data && resp.data.pyOperatorInfo && resp.data.pyOperatorInfo.pyUserName) { - this.userName$ = resp.data.pyOperatorInfo.pyUserName; - } - }); - } - } else if (displayAs === DROPDOWN_LIST || displayAs === SEARCH_BOX) { - const queryPayload = { - dataViewName: OPERATORS_DP - }; - this.PCore$.getRestClient() - .invokeRestApi('getListData', { queryPayload }) - .then((resp) => { - const ddDataSource = resp.data.data.map((listItem) => ({ - key: listItem.pyUserIdentifier, - value: listItem.pyUserName - })); - this.options$ = ddDataSource; - }) - .catch((err) => { - console.log(err); - }); - } - } - - fieldOnChange(event: any) { - if (event?.value === 'Select') { - event.value = ''; - } - this.angularPConnectData.actions.onChange(this, event); - } - - fieldOnBlur(event: any) { - let key = ''; - if (event?.target?.value) { - const index = this.options$?.findIndex((element) => element.value === event.target.value); - key = index > -1 ? (key = this.options$[index].key) : event.target.value; - } - - const eve = { - value: key - }; - // PConnect wants to use eventHandler for onBlur - this.angularPConnectData.actions.onChange(this, eve); - } - - getErrorMessage() { - let errMessage: string = ''; - - // look for validation messages for json, pre-defined or just an error pushed from workitem (400) - if (this.fieldControl.hasError('message')) { - errMessage = this.angularPConnectData.validateMessage; - return errMessage; - } else if (this.fieldControl.hasError('required')) { - errMessage = 'You must enter a value'; - } else if (this.fieldControl.errors) { - errMessage = this.fieldControl.errors.toString(); - } - - return errMessage; - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/_infra.md b/tests/assets/components/createAll/override-sdk/infra/_infra.md deleted file mode 100644 index 5d1cef65..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/_infra.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/infra** directory - -The **src/components/override-sdk/infra** directory contains the code for **infrastructure** components for which you want to override the default implementation for use with the **Angular SDK**. - -When run the **npm run create** command to override the default implementation of an **infrastructure** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/infra**. diff --git a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.html b/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.html deleted file mode 100644 index 0204089a..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.scss b/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.scss deleted file mode 100644 index f1197474..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.spec.ts deleted file mode 100644 index dcdfb8d8..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ActionButtonsComponent } from './action-buttons.component'; - -describe('ActionButtonsComponent', () => { - let component: ActionButtonsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ActionButtonsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ActionButtonsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.ts b/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.ts deleted file mode 100644 index 6f198ab7..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/action-buttons/action-buttons.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatGridListModule } from '@angular/material/grid-list'; - -@Component({ - selector: 'app-action-buttons', - templateUrl: './action-buttons.component.html', - styleUrls: ['./action-buttons.component.scss'], - standalone: true, - imports: [CommonModule, MatGridListModule, MatButtonModule] -}) -export class ActionButtonsComponent implements OnInit { - @Input() arMainButtons$: Array; - @Input() arSecondaryButtons$: Array; - - @Output() actionButtonClick: EventEmitter = new EventEmitter(); - - constructor() {} - - ngOnInit(): void {} - - buttonClick(sAction, sButtonType) { - this.actionButtonClick.emit({ action: sAction, buttonType: sButtonType }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.html b/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.html deleted file mode 100644 index 42f49bbd..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
-
- - - -
Assignment Card wants component not yet available: {{ kid.getPConnect().getComponentName() }}
-
-
-
- -
-
-
- - -
diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.scss b/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.scss deleted file mode 100644 index 99870edb..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-case-view-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-flow-container { - padding: 0rem 1rem; -} diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.spec.ts deleted file mode 100644 index 061b2307..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AssignmentCardComponent } from './assignment-card.component'; - -describe('AssignmentCardComponent', () => { - let component: AssignmentCardComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AssignmentCardComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AssignmentCardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.ts b/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.ts deleted file mode 100644 index 0717a5f4..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment-card/assignment-card.component.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { CaseCreateStageComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-assignment-card', - templateUrl: './assignment-card.component.html', - styleUrls: ['./assignment-card.component.scss'], - standalone: true, - imports: [CommonModule, ReactiveFormsModule, CaseCreateStageComponent, RegionComponent, forwardRef(() => ComponentMapperComponent)] -}) -export class AssignmentCardComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() arMainButtons$: Array; - @Input() arSecondaryButtons$: Array; - @Input() arChildren$: Array; - @Input() updateToken$: number; - - @Output() actionButtonClick: EventEmitter = new EventEmitter(); - - constructor() {} - - ngOnInit(): void { - // Children may contain 'reference' component, so we need to - // normalize them - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.arChildren$); - } - - ngOnChanges(data: any) { - // Children may contain 'reference' component, so we need to - // normalize them - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.arChildren$); - } - - onActionButtonClick(oData: any) { - this.actionButtonClick.emit(oData); - } -} - diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.html b/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.html deleted file mode 100644 index 711b9df7..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
-
-
- -
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.scss b/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.spec.ts deleted file mode 100644 index 7b8510c3..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AssignmentComponent } from './assignment.component'; - -describe('AssignmentComponent', () => { - let component: AssignmentComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AssignmentComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AssignmentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.ts b/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.ts deleted file mode 100644 index 4f91acb2..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/assignment/assignment.component.ts +++ /dev/null @@ -1,437 +0,0 @@ -/* eslint-disable no-case-declarations */ -import { Component, OnInit, Input, SimpleChange, NgZone, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ErrorMessagesService } from '@pega/angular-sdk-library'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const PCore: any; - -declare const window: any; - -@Component({ - selector: 'app-assignment', - templateUrl: './assignment.component.html', - styleUrls: ['./assignment.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class AssignmentComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() arChildren$: Array; - @Input() itemKey$: string; - @Input() isCreateStage$: boolean; - @Input() updateToken$: number; - @Input() isInModal$: boolean = false; - @Input() banners; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - configProps$: Object; - - newPConn$: any; - containerName$: string; - - bIsRefComponent: boolean = false; - bInitialized: boolean = false; - - templateName$: string; - - arMainButtons$: Array; - arSecondaryButtons$: Array; - - actionsAPI: any; - - bHasNavigation$: boolean = false; - bIsVertical$: boolean = false; - arCurrentStepIndicies$: Array = new Array(); - arNavigationSteps$: Array = new Array(); - - init: boolean; - finishAssignment: any; - navigateToStep: any; - saveAssignment: any; - cancelAssignment: any; - cancelCreateStageAssignment: any; - showPage: any; - - //itemKey: string = ""; // JA - this is what Nebula/Constellation uses to pass to finishAssignment, navigateToStep - - bReInit: boolean = false; - - constructor( - private angularPConnect: AngularPConnectService, - private psService: ProgressSpinnerService, - private erService: ErrorMessagesService, - private ngZone: NgZone - ) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.initComponent(); - - this.angularPConnect.shouldComponentUpdate(this); - - this.bInitialized = true; - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - let loadingInfo; - try { - //loadingInfo = this.pConn$.getLoadingStatus(); - loadingInfo = this.newPConn$.getLoadingStatus(); - - this.psService.sendMessage(loadingInfo); - } catch (ex) {} - } - } - - ngOnChanges(changes: { [propName: string]: SimpleChange }) { - if (this.bInitialized) { - this.updateChanges(); - } - } - - updateChanges() { - this.bIsRefComponent = this.checkIfRefComponent(this.pConn$); - - this.ngZone.run(() => { - // pConn$ may be a 'reference' component, so normalize it - //this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); - this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$); - - // If 'reference' so we need to get the children of the normalized pConn - if (this.bIsRefComponent) { - //this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren()); - } - }); - - this.createButtons(); - } - - checkIfRefComponent(thePConn: any): boolean { - let bReturn = false; - if (thePConn && thePConn.getComponentName() == 'reference') { - bReturn = true; - } - - return bReturn; - } - - initComponent() { - this.bIsRefComponent = this.checkIfRefComponent(this.pConn$); - - // pConn$ may be a 'reference' component, so normalize it - //this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); - this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$); - - // If 'reference' so we need to get the children of the normalized pConn - if (this.bIsRefComponent) { - //this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren()); - } - - // prevent re-intializing with flowContainer update unless an action is taken - this.bReInit = false; - this.bHasNavigation$ = false; - - //this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.configProps$ = this.newPConn$.resolveConfigProps(this.newPConn$.getConfigProps()); - - this.templateName$ = this.configProps$['template']; - - // create pointers to functions - /* - let containerMgr = this.pConn$.getContainerManager(); - let actionsAPI = this.pConn$.getActionsApi(); - let baseContext = this.pConn$.getContextName(); - let acName = this.pConn$.getContainerName(); - */ - - let actionsAPI = this.newPConn$.getActionsApi(); - let baseContext = this.newPConn$.getContextName(); - let acName = this.newPConn$.getContainerName(); - - // for now, in general this should be overridden by updateSelf(), and not be blank - if (this.itemKey$ === '') { - this.itemKey$ = baseContext.concat('/').concat(acName); - } - - //this.pConn$.isBoundToState(); - this.newPConn$.isBoundToState(); - - this.init = false; - - // store off bound functions to above pointers - this.finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI); - this.navigateToStep = actionsAPI.navigateToStep.bind(actionsAPI); - this.saveAssignment = actionsAPI.saveAssignment.bind(actionsAPI); - this.cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI); - this.showPage = actionsAPI.showPage.bind(actionsAPI); - - this.cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI); - - this.createButtons(); - } - - createButtons() { - //let oData = this.pConn$.getDataObject(); - let oData = this.newPConn$.getDataObject(); - - // inside - // get fist kid, get the name and displa - // pass first kid to a view container, which will disperse it to a view which will use one column, two column, etc. - let oWorkItem = this.arChildren$[0].getPConnect(); - let oWorkData = oWorkItem.getDataObject(); - - if (oWorkData) { - this.actionsAPI = oWorkItem.getActionsApi(); - - //this.containerName$ = oWorkMeta["name"]; - - if (oWorkData.caseInfo && oWorkData.caseInfo.assignments !== null) { - this.containerName$ = oWorkData.caseInfo.assignments?.[0].name; - - // get caseInfo - let oCaseInfo = oData.caseInfo; - - if (oCaseInfo && oCaseInfo.actionButtons) { - this.arMainButtons$ = oCaseInfo.actionButtons.main; - this.arSecondaryButtons$ = oCaseInfo.actionButtons.secondary; - } - - if (oCaseInfo.navigation != null) { - this.bHasNavigation$ = true; - - if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') { - this.bHasNavigation$ = false; - } else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') { - this.bIsVertical$ = true; - } else { - this.bIsVertical$ = false; - } - - // iterate through steps to find current one(s) - // immutable, so we want to change the local copy, so need to make a copy - this.ngZone.run(() => { - // what comes back now in configObject is the children of the flowContainer - this.arNavigationSteps$ = JSON.parse(JSON.stringify(oCaseInfo.navigation.steps)); - this.arCurrentStepIndicies$ = new Array(); - this.arCurrentStepIndicies$ = this.findCurrentIndicies(this.arNavigationSteps$, this.arCurrentStepIndicies$, 0); - }); - } else { - this.bHasNavigation$ = false; - } - } - } - } - - findCurrentIndicies(arStepperSteps: Array, arIndicies: Array, depth: number): Array { - let count = 0; - arStepperSteps.forEach((step) => { - if (step.visited_status == 'current') { - arIndicies[depth] = count; - - // add in - step['step_status'] = ''; - } else if (step.visited_status == 'success') { - count++; - step.step_status = 'completed'; - } else { - count++; - step.step_status = ''; - } - - if (step.steps) { - arIndicies = this.findCurrentIndicies(step.steps, arIndicies, depth + 1); - } - }); - - return arIndicies; - } - - onSaveActionSuccess(data) { - this.actionsAPI.cancelAssignment(this.itemKey$).then(() => { - this.psService.sendMessage(false); - this.PCore$.getPubSubUtils().publish(this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL); - }); - } - - onActionButtonClick(oData: any) { - this.buttonClick(oData.action, oData.buttonType); - } - - buttonClick(sAction, sButtonType) { - // right now, done on an individual basis, setting bReInit to true - // upon the next flow container state change, will cause the flow container - // to re-initialize - // this.bReInit =true; - - /* - let baseContext = this.pConn$.getContextName(); - let acName = this.pConn$.getContainerName(); - let itemID = baseContext.concat("/").concat(acName); - */ - - let baseContext = this.newPConn$.getContextName(); - let acName = this.newPConn$.getContainerName(); - let itemID = baseContext.concat('/').concat(acName); - - if (sButtonType == 'secondary') { - let stepID = ''; // ??? - - // need to handle cancel as this.cancel(dispatchInfo) - //this.actionsAPI[sAction](dispatchInfo); - switch (sAction) { - case 'navigateToStep': - this.erService.sendMessage('publish', ''); - if (this.formValid()) { - this.bReInit = true; - this.psService.sendMessage(true); - - let navigatePromise = this.navigateToStep('previous', this.itemKey$); - navigatePromise - .then(() => { - this.updateChanges(); - this.psService.sendMessage(false); - }) - .catch(() => { - this.psService.sendMessage(false); - }); - } - break; - - case 'saveAssignment': { - const caseID = this.pConn$.getCaseInfo().getKey(); - const assignmentID = this.pConn$.getCaseInfo().getAssignmentID(); - const savePromise = this.saveAssignment(this.itemKey$); - - savePromise - .then(() => { - const caseType = this.pConn$.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID); - this.PCore$.getPubSubUtils().publish('cancelPressed'); - this.onSaveActionSuccess({ caseType, caseID, assignmentID }); - }) - .catch(() => { - this.psService.sendMessage(false); - }); - - break; - } - - case 'cancelAssignment': - this.bReInit = true; - this.erService.sendMessage('dismiss', ''); - const isAssignmentInCreateStage = this.pConn$.getCaseInfo().isAssignmentInCreateStage(); - const isLocalAction = - this.pConn$.getCaseInfo().isLocalAction() || - (PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && - this.pConn$.getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION)); - // check if create stage (modal) - if (isAssignmentInCreateStage && this.isInModal$ && !isLocalAction) { - const cancelPromise = this.cancelCreateStageAssignment(this.itemKey$); - cancelPromise - .then(() => { - this.psService.sendMessage(false); - // this.PCore$.getPubSubUtils().publish( - // this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL); - }) - .catch(() => { - this.psService.sendMessage(false); - }); - } else { - this.psService.sendMessage(true); - - // publish before cancel pressed, because - // cancel assignment happens "after" cancel assignment happens - this.PCore$.getPubSubUtils().publish('cancelPressed'); - - const cancelPromise = this.cancelAssignment(this.itemKey$); - cancelPromise - .then(() => { - this.psService.sendMessage(false); - this.PCore$.getPubSubUtils().publish(this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL); - }) - .catch(() => { - this.psService.sendMessage(false); - }); - } - break; - - default: - break; - } - } else if (sButtonType == 'primary') { - switch (sAction) { - case 'finishAssignment': - this.erService.sendMessage('publish', ''); - if (this.formValid()) { - this.bReInit = true; - this.psService.sendMessage(true); - let finishPromise = this.finishAssignment(this.itemKey$); // JA - was itemID but Nebula/Constellation uses itemKey - finishPromise - .then(() => { - this.psService.sendMessage(false); - this.updateChanges(); - }) - .catch(() => { - this.psService.sendMessage(false); - }); - } else { - //let snackBarRef = this.snackBar.open("Please fix errors on form.", "Ok"); - this.erService.sendMessage('show', 'Please fix errors on form.'); - } - break; - default: - break; - } - } - } - - formValid(): boolean { - this.touchAll(); - return this.formGroup$.valid; - } - - touchAll(): void { - Object.values(this.formGroup$.controls).forEach((control: any) => { - control.markAsTouched(); - }); - } - - topViewRefresh(): void { - Object.values(this.formGroup$.controls).forEach((control: any) => { - control.markAsTouched(); - }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.html b/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.html deleted file mode 100644 index 0ab77d12..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.scss b/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.spec.ts deleted file mode 100644 index cd9ca929..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DeferLoadComponent } from './defer-load.component'; - -describe('DeferLoadComponent', () => { - let component: DeferLoadComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DeferLoadComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DeferLoadComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.ts b/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.ts deleted file mode 100644 index 00c70639..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/defer-load/defer-load.component.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; - -/** - * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with - * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and - * is totally at your own risk. - */ - -declare const window: any; - -@Component({ - selector: 'app-defer-load', - templateUrl: './defer-load.component.html', - styleUrls: ['./defer-load.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DeferLoadComponent implements OnInit { - @Input() pConn$: any; - @Input() loadData$: any; - @Input() name; - - PCore$: any; - - componentName$: string; - loadedPConn$: any; - bShowDefer$: boolean = false; - - angularPConnectData: any = {}; - constants: any; - currentLoadedAssignment = ""; - isContainerPreview: boolean; - loadViewCaseID: any; - resourceType: any; - deferLoadId: any; - containerName: any; - CASE: any; - PAGE: any; - DATA: any; - constructor(private angularPConnect: AngularPConnectService) { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.constants = this.PCore$.getConstants(); - } - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - const { CASE, PAGE, DATA } = this.constants.RESOURCE_TYPES; - this.CASE = CASE; - this.PAGE = PAGE; - this.DATA = DATA; - - this.loadActiveTab(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const theRequestedAssignment = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.ASSIGNMENT_LABEL); - if (theRequestedAssignment !== this.currentLoadedAssignment) { - this.currentLoadedAssignment = theRequestedAssignment; - this.loadActiveTab(); - } - } - - ngOnChanges() { - - this.loadViewCaseID = this.pConn$.getValue(this.constants.PZINSKEY) || this.pConn$.getValue(this.constants.CASE_INFO.CASE_INFO_ID); - let containerItemData; - const targetName = this.pConn$.getTarget(); - if (targetName) { - this.containerName = this.PCore$.getContainerUtils().getActiveContainerItemName(targetName); - containerItemData = this.PCore$.getContainerUtils().getContainerItemData(targetName, this.containerName); - } - const { resourceType = this.CASE } = containerItemData || { resourceType: this.loadViewCaseID ? this.CASE : this.PAGE }; - this.resourceType = resourceType; - this.isContainerPreview = /preview_[0-9]*/g.test(this.pConn$.getContextName()); - - const theConfigProps = this.pConn$.getConfigProps(); - this.deferLoadId = theConfigProps.deferLoadId; - this.name = this.name || theConfigProps.name; - - this.loadActiveTab(); - } - - getViewOptions = () => ({ - viewContext: this.resourceType, - pageClass: this.loadViewCaseID ? '' : this.pConn$.getDataObject().pyPortal.classID, - container: this.isContainerPreview ? 'preview' : null, - containerName: this.isContainerPreview ? 'preview' : null, - updateData: this.isContainerPreview - }); - - onResponse(data) { - if (this.deferLoadId) { - this.PCore$.getDeferLoadManager().start( - this.name, - this.pConn$.getCaseInfo().getKey(), - this.pConn$.getPageReference().replace('caseInfo.content', ''), - this.pConn$.getContextName(), - this.deferLoadId - ); - } - - if (data && !(data.type && data.type === 'error')) { - const config = { - meta: data, - options: { - context: this.pConn$.getContextName(), - pageReference: this.pConn$.getPageReference() - } - }; - const configObject = this.PCore$.createPConnect(config); - configObject.getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT') - this.loadedPConn$ = ReferenceComponent.normalizePConn(configObject.getPConnect()); - this.componentName$ = this.loadedPConn$.getComponentName(); - if (this.deferLoadId) { - this.PCore$.getDeferLoadManager().stop(this.deferLoadId, this.pConn$.getContextName()); - } - } - // this.cdRef.detectChanges(); - }; - - loadActiveTab() { - if (this.resourceType === this.DATA) { - // Rendering defer loaded tabs in data context - if (this.containerName) { - const dataContext = this.PCore$.getStoreValue('.dataContext', 'dataInfo', this.containerName); - const dataContextParameters = this.PCore$.getStoreValue( - '.dataContextParameters', - 'dataInfo', - this.containerName - ); - - this.pConn$ - .getActionsApi() - .showData(this.name, dataContext, dataContextParameters, { - skipSemanticUrl: true, - isDeferLoaded: true - }) - .then(data => { - this.onResponse(data); - }); - } else { - console.error('Cannot load the defer loaded view without container information'); - } - } else if (this.resourceType === this.PAGE) { - // Rendering defer loaded tabs in case/ page context - this.pConn$ - .getActionsApi() - .loadView(encodeURI(this.loadViewCaseID), this.name, this.getViewOptions()) - .then(data => { - this.onResponse(data); - }); - } else { - this.pConn$.getActionsApi().refreshCaseView(encodeURI(this.loadViewCaseID), this.name) - .then(data => { - this.onResponse(data.root); - }); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.html b/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.html deleted file mode 100644 index dcce0676..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.html +++ /dev/null @@ -1 +0,0 @@ -

{{message}}

diff --git a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.scss b/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.spec.ts deleted file mode 100644 index 10d54bf9..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ErrorBoundaryComponent } from './error-boundary.component'; - -describe('ErrorBoundaryComponent', () => { - let component: ErrorBoundaryComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ErrorBoundaryComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ErrorBoundaryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.ts b/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.ts deleted file mode 100644 index 0abc48e7..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/error-boundary/error-boundary.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -@Component({ - selector: 'app-error-boundary', - templateUrl: './error-boundary.component.html', - styleUrls: ['./error-boundary.component.scss'], - standalone: true, - imports: [CommonModule] -}) -export class ErrorBoundaryComponent { - @Input('message') message: string; -} diff --git a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.html b/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.html deleted file mode 100644 index 1ff1365e..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.html +++ /dev/null @@ -1,98 +0,0 @@ -
-
-
-
-
-
- {{ i + 1 }} -
-
-
- {{ mainStep.name }} -
-
-
- -
    -
  • -
    - - - - -
    -
    - -
    -
  • -
-
- - - - -
-
-
- -
-
- -
-
-
- {{ i + 1 }} -
-
-
-
- {{ mainStep.name }} -
-
-
-
-
-
-
- -
    -
  • -
    - - - - -
    -
    - -
    -
  • -
-
- - - - -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.scss b/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.scss deleted file mode 100644 index fd823ae0..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.scss +++ /dev/null @@ -1,261 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-case-view-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.psdk-icon-current { - color: $app-primary-color; -} - -.psdk-icon-not-current { - color: $app-neutral-color; -} - -.psdk-current-svg-icon { - width: 1rem; - filter: $app-primary-color-filter; -} - -.psdk-not-current-svg-icon { - width: 1rem; - filter: $app-neutral-color-filter; -} - -mat-vertical-stepper { - background-color: transparent; -} -mat-horizontal-stepper { - background-color: transparent; -} - -.psdk-sub-step-current { - padding-left: 0.625rem; - font-weight: bold; - color: rgba(0, 0, 0, 0.87); -} - -.psdk-sub-step-not-current { - padding-left: 0.625rem; - color: rgba(0, 0, 0, 0.54); -} - -.psdk-flow-container-top { - background-color: $app-form-color; - padding: 0rem 0.625rem; - border-radius: 0.3125rem; -} -.psdk-flow-container { - padding-left: 2.1875rem; -} - -.psdk-sub-step-list { - list-style: none; - padding-bottom: 0.625rem; -} - -.psdk-vertical-stepper { - background-color: transparent; - display: block; - text-align: left; -} - -.psdk-vertical-step { - display: block; -} - -.psdk-vertical-step-header { - overflow: hidden; - outline: none; - cursor: pointer; - position: relative; - box-sizing: content-box; - display: flex; - align-items: center; - height: 24px; - padding: 24px 24px; -} - -.psdk-vertical-step-icon { - margin-right: 12px; - background-color: $app-neutral-color; - color: #fff; - border-radius: 50%; - height: 24px; - width: 24px; - flex-shrink: 0; - position: relative; -} - -.psdk-vertical-step-icon-content { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - color: #fff; -} - -.psdk-vertical-step-icon-selected { - margin-right: 12px; - background-color: $app-primary-color; - color: #fff; - border-radius: 50%; - height: 24px; - width: 24px; - flex-shrink: 0; - position: relative; -} - -.psdk-vertical-step-label { - color: rgba(0, 0, 0, 0.54); - display: inline-block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: 50px; - vertical-align: middle; - font-size: 14px; - font-weight: 500; -} - -.psdk-vertical-step-label-selected { - color: rgba(0, 0, 0, 0.87); - display: inline-block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: 50px; - vertical-align: middle; - font-size: 14px; - font-weight: 500; -} - -.psdk-vertical-step-body { - margin-left: 36px; - border: 0; - position: relative; - display: block; - text-align: left; -} -.psdk-vertical-step-line { - display: block; -} - -.psdk-vertical-step-line::before { - content: ''; - position: absolute; - left: 0; - border-left-width: 1px; - border-left-style: solid; - top: -16px; - bottom: -16px; - border-left-color: rgba(0, 0, 0, 0.12); -} - -.psdk-horizontal-stepper { - background-color: transparent; - display: block; -} - -.psdk-horizontal-stepper-header-container { - white-space: nowrap; - display: flex; - align-items: center; - text-align: left; -} - -.psdk-horizontal-step-header { - overflow: hidden; - outline: none; - cursor: pointer; - position: relative; - box-sizing: content-box; - display: flex; - height: 72px; - overflow: hidden; - align-items: center; - padding: 0 24px; -} - -.psdk-horizontal-step-icon { - background-color: $app-neutral-color; - color: #fff; - border-radius: 50%; - height: 24px; - width: 24px; - flex-shrink: 0; - position: relative; - display: block; - margin-right: 8px; - flex: none; -} - -.psdk-horizontal-step-icon-content { - display: block; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} - -.psdk-horizontal-step-icon-selected { - background-color: $app-primary-color; - color: #fff; - border-radius: 50%; - height: 24px; - width: 24px; - flex-shrink: 0; - position: relative; - display: block; - margin-right: 8px; - flex: none; -} - -.psdk-horizontal-step-label { - color: rgba(0, 0, 0, 0.54); - display: inline-block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: 50px; - vertical-align: middle; - font-size: 14px; - font-weight: 500; - text-overflow: ellipsis; - overflow: hidden; -} - -.psdk-horizontal-step-label-selected { - color: rgba(0, 0, 0, 0.87); - display: inline-block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: 50px; - vertical-align: middle; - font-size: 14px; - font-weight: 500; - text-overflow: ellipsis; - overflow: hidden; -} - -.psdk-horizontal-step-text-label { - text-overflow: ellipsis; - overflow: hidden; - display: block; -} - -.psdk-horizontal-step-line { - border-top-color: rgba(0, 0, 0, 0.12); - border-top-width: 1px; - border-top-style: solid; - flex: auto; - height: 0; - margin: 0 -16px; - min-width: 32px; -} diff --git a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.spec.ts deleted file mode 100644 index 4e354473..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { MultiStepComponent } from './multi-step.component'; - -describe('MultiStepComponent', () => { - let component: MultiStepComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ MultiStepComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MultiStepComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.ts b/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.ts deleted file mode 100644 index 7c23127c..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/multi-step/multi-step.component.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-multi-step', - templateUrl: './multi-step.component.html', - styleUrls: ['./multi-step.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class MultiStepComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() arMainButtons$: Array; - @Input() arSecondaryButtons$: Array; - @Input() arChildren$: Array; - @Input() bIsVertical$: boolean; - @Input() arCurrentStepIndicies$: Array; - @Input() arNavigationSteps$: Array; - @Output() actionButtonClick: EventEmitter = new EventEmitter(); - - PCore$: any; - - svgCurrent$: string; - svgNotCurrent$: string; - bShow$: boolean = true; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // svg icons - this.svgCurrent$ = this.utils.getImageSrc('circle-solid', this.utils.getSDKStaticContentUrl()); - this.svgNotCurrent$ = this.utils.getImageSrc('circle-solid', this.utils.getSDKStaticContentUrl()); - } - - onActionButtonClick(oData: any) { - this.actionButtonClick.emit(oData); - } - - _getVIconClass(status): String { - if (status == 'current') { - return 'psdk-vertical-step-icon-selected'; - } - - return 'psdk-vertical-step-icon'; - } - - _getVLabelClass(status): string { - if (status == 'current') { - return 'psdk-vertical-step-label-selected'; - } - - return 'psdk-vertical-step-label'; - } - - _getVBodyClass(index: number): string { - if (index < this.arNavigationSteps$.length - 1) { - return 'psdk-vertical-step-body psdk-vertical-step-line'; - } - - return 'psdk-vertical-step-body'; - } - - _getHIconClass(status): string { - if (status == 'current') { - return 'psdk-horizontal-step-icon-selected'; - } - - return 'psdk-horizontal-step-icon'; - } - - _getHLabelClass(status): string { - if (status == 'current') { - return 'psdk-horizontal-step-label-selected'; - } - - return 'psdk-horizontal-step-label'; - } - - _showHLine(index: number): boolean { - if (index < this.arNavigationSteps$.length - 1) { - return true; - } - - return false; - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.html b/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.html deleted file mode 100644 index 9ab4286b..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.html +++ /dev/null @@ -1,55 +0,0 @@ -
-
-
- -
-
-
{{ portalApp$ }}
-
-
-
-
- - -
- - Create -
-
- - - {{ caseType.pyLabel }} - - -
-
-
- - -
- - {{ page.pyLabel }} -
-
-
-
-
-
- - -
-
{{ portalOperatorInitials$ }}
- {{ portalOperator$ }} -
-
- - - - -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.scss b/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.scss deleted file mode 100644 index 9b1cf355..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.scss +++ /dev/null @@ -1,154 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -// Things related to movement -$transition-slow: 0.5s !default; -$transition-medium: 0.3s !default; -$transition-fast: 0.1s !default; -$natural-ease: cubic-bezier(0.4, 0.6, 0.1, 1) !default; - -.psdk-nav-divider { - border-bottom: 0.0625rem solid invert($app-nav-bg, 15%); - width: 100%; - align-items: center; -} - -.psdk-nav-header { - display: flex; - padding-top: 0.625rem; -} - -.psdk-nav-logo { - width: 3.75rem; - padding: 0.625rem; - margin-right: 1.25rem; -} - -// background color white -.psdk-nav-svg-icon { - filter: $app-white-color-filter; - width: 1.6rem; - padding-right: 0.625rem; -} - -.psdk-nav-portal-name { - font-size: 0.875rem; -} - -.psdk-nav-portal-app { - font-size: 1.25rem; -} - -.psdk-appshell-nav { - z-index: 3; - position: fixed; - display: flex; - flex-direction: column; - justify-content: flex-start; - background: $app-nav-bg; - width: $app-nav-width; - height: 100%; - color: invert($app-nav-bg, 100%); - overflow-y: auto; - overflow-x: hidden; - white-space: nowrap; - transition: width $transition-medium $natural-ease; - will-change: width; -} - -.psdk-appshell-nav:hover { - width: $app-nav-width-expanded; -} - -.psdk-appshell-topnav { - display: flex; - flex-direction: column; - justify-content: flex-start; - background: $app-nav-bg; - width: $app-nav-width; - height: 15%; - color: invert($app-nav-bg, 100%); - overflow: hidden; - white-space: nowrap; - transition: width $transition-medium $natural-ease; - will-change: width; -} - -.psdk-appshell-middlenav { - display: flex; - flex-direction: column; - justify-content: space-between; - background: $app-nav-bg; - width: $app-nav-width; - height: 50%; - color: invert($app-nav-bg, 100%); - overflow: hidden; - white-space: nowrap; - transition: width $transition-medium $natural-ease; - will-change: width; -} - -.psdk-nav-ul-middle { - display: block; - list-style-type: none; - margin: 0rem; - padding-inline-start: 30px; -} - -.psdk-nav-li-middle { - box-sizing: border-box; - text-align: left; -} - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.psdk-nav-button-span { - padding: 0 1rem; - color: invert($app-nav-bg, 100%); -} - -.psdk-nav-oper-avatar { - margin: 0rem; - padding: 0rem; - min-width: 2.5rem; - min-height: 2.5rem; - max-width: 2.5rem; - max-height: 2.5rem; - border-radius: 50%; - justify-content: center; - align-items: center; - text-align: center; - display: inline-flex; - background: $app-neutral-color; - color: white; - font-weight: normal; - font-size: 1rem; -} - -mat-list { - padding: 0; -} - -.psdk-profile-list-item { - padding-left: 24px; -} - -mat-list-item { - padding: 20px 30px; - padding-right: 0; - cursor: pointer !important; - height: auto !important; - - &:hover { - background-color: rgba(0, 0, 0, 0.5); - } - - .flex-box { - display: flex; - align-items: center; - width: 100%; - text-align: left; - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.spec.ts deleted file mode 100644 index cb0cff46..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { NavbarComponent } from './navbar.component'; - -describe('NavbarComponent', () => { - let component: NavbarComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ NavbarComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(NavbarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.ts b/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.ts deleted file mode 100644 index df2c5925..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/navbar/navbar.component.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, NgZone } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatListModule } from '@angular/material/list'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { logout } from '@pega/auth/lib/sdk-auth-manager'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-navbar', - templateUrl: './navbar.component.html', - styleUrls: ['./navbar.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, MatListModule, MatMenuModule] -}) -export class NavbarComponent implements OnInit { - @Input() pConn$: any; - @Input() appName$: string; - @Input() pages$: Array; - @Input() caseTypes$: Array; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - - navPages$: Array; - navExpandCollapse$: string; - bShowCaseTypes$: boolean = false; - - portalApp$: string = ''; - portalLogoImage$: string; - showAppName$: boolean = false; - - portalOperator$: string; - portalOperatorInitials$: string; - - actionsAPI: any; - createWork: any; - showPage: any; - logout: any; - - configProps: any; - navIcon$: string; - - constructor( - private angularPConnect: AngularPConnectService, - private chRef: ChangeDetectorRef, - private psService: ProgressSpinnerService, - private ngZone: NgZone, - private utils: Utils - ) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.navIcon$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg'); - - // this is a dummy "get", because right now images are in http and the main screen is https - // so the images don't load automatically. This call, makes an initial hit that allows the - // rest of the images to show up - this.loadImage(this.navIcon$); - - this.initComponent(); - } - - // ngOnDestroy - // unsubscribe from Store - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - loadImage(src: string) { - return new Promise((resolve, reject) => { - resolve(src); - }); - } - - // Callback passed when subscribing to store change - onStateChange() { - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // NOTE: can call angularPConnect.getState with optional args for detailed logging: bLogMsg and component object - this.angularPConnect.getState(); - - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf(): void { - this.initComponent(); - } - - initComponent() { - this.ngZone.run(() => { - this.navIcon$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg'); - this.navExpandCollapse$ = this.utils.getImageSrc('plus', this.utils.getSDKStaticContentUrl()); - - // Then, continue on with other initialization - - // making a copy, so can add info - this.navPages$ = JSON.parse(JSON.stringify(this.pages$)); - - for (let page in this.navPages$) { - this.navPages$[page]['iconName'] = this.utils.getImageSrc( - this.navPages$[page]['pxPageViewIcon'], - this.utils.getSDKStaticContentUrl() - ); - } - - this.actionsAPI = this.pConn$.getActionsApi(); - this.createWork = this.actionsAPI.createWork.bind(this.actionsAPI); - this.showPage = this.actionsAPI.showPage.bind(this.actionsAPI); - this.configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.logout = this.actionsAPI.logout.bind(this.actionsAPI); - - let oData = this.pConn$.getDataObject(); - - this.portalLogoImage$ = this.utils.getSDKStaticContentUrl().concat('assets/pzpega-logo-mark.svg'); - this.portalOperator$ = this.PCore$.getEnvironmentInfo().getOperatorName(); - this.portalOperatorInitials$ = this.utils.getInitials(this.portalOperator$); - this.showAppName$ = this.configProps['showAppName']; - - this.portalApp$ = this.PCore$.getEnvironmentInfo().getApplicationLabel(); - }); - } - - navPanelButtonClick(oPageData: any) { - const { pyClassName, pyRuleName } = oPageData; - - this.showPage(pyRuleName, pyClassName); - } - - navPanelCreateButtonClick() { - if (this.navExpandCollapse$.indexOf('plus') > 0) { - this.navExpandCollapse$ = this.utils.getImageSrc('times', this.utils.getSDKStaticContentUrl()); - this.bShowCaseTypes$ = true; - } else { - this.navExpandCollapse$ = this.utils.getImageSrc('plus', this.utils.getSDKStaticContentUrl()); - this.bShowCaseTypes$ = false; - } - - this.chRef.detectChanges(); - } - - navPanelCreateCaseType(sCaseType: string, sFlowType: string) { - this.psService.sendMessage(true); - this.navPanelCreateButtonClick(); - - const actionInfo = { - containerName: 'primary', - flowType: sFlowType ? sFlowType : 'pyStartCase' - }; - this.createWork(sCaseType, actionInfo); - } - - navPanelLogoutClick() { - logout().then(() => { - // Reload the page to kick off the login - window.location.reload(); - }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/region/region.component.html b/tests/assets/components/createAll/override-sdk/infra/region/region.component.html deleted file mode 100644 index 022e707f..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/region/region.component.html +++ /dev/null @@ -1,11 +0,0 @@ - -
- -
diff --git a/tests/assets/components/createAll/override-sdk/infra/region/region.component.scss b/tests/assets/components/createAll/override-sdk/infra/region/region.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/infra/region/region.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/region/region.component.spec.ts deleted file mode 100644 index aab871dc..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/region/region.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { RegionComponent } from './region.component'; - -describe('RegionComponent', () => { - let component: RegionComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ RegionComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(RegionComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/region/region.component.ts b/tests/assets/components/createAll/override-sdk/infra/region/region.component.ts deleted file mode 100644 index ea97cca0..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/region/region.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -// import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-region', - templateUrl: './region.component.html', - styleUrls: ['./region.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class RegionComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - // console.log(`ngOnInit (no registerAndSubscribe!): Region`); - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - // The children may contain 'reference' components, so normalize the children... - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.html b/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.html deleted file mode 100644 index 8f56fd09..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
- {{ stage.name }} -
-
{{ stage.name }}
-
{{ stage.name }}
-
-
- -
diff --git a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.scss b/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.scss deleted file mode 100644 index d67fae12..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.scss +++ /dev/null @@ -1,109 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-stages { - padding: 0.625rem 0rem; -} - -.psdk-stages-span span { - padding: 0.3125rem; - font-weight: bold; - font-size: 1.5rem; -} - -.psdk-stages-div { - display: inline-flex; - padding: 0.3125rem; - font-weight: bold; - font-size: 1.3rem; - color: $app-neutral-color; -} - -.psdk-stages-past { - color: $app-primary-color; - padding-right: 0.3125rem; -} - -.psdk-stages-present { - color: $app-secondary-color; - padding-right: 0.3125rem; -} - -.psdk-stages-future { - color: $app-neutral-color; - padding-right: 0.3125rem; -} - -.psdk-stages-full { - display: block; -} - -.psdk-stages-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-stages-full { - display: block; -} - -.psdk-stages-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-stages-icon { - width: 1.4rem; - display: inline-block; - vertical-align: top; -} - -.psdk-stages-bar { - margin: 1rem 0rem; - background-color: rgb(255, 255, 255); - border-radius: 0.5rem; - border: 0.0625rem solid $app-neutral-light-color; - overflow: hidden; - height: 2rem; - display: flex; -} - -.psdk-stages-chevron { - position: relative; - padding: calc(1rem); - display: flex; - justify-content: center; - align-items: center; - max-width: 100%; - min-width: 0px; - flex-grow: 1; - flex-shrink: 1; -} - -.psdk-stages-chevron:not(:last-child)::after { - content: ''; - position: absolute; - display: block; - z-index: 2; - width: calc(1.75rem); - right: calc(-0.4375rem); - background: inherit; - border-style: solid; - border-color: rgb(207, 207, 207); - border-width: 0.0625rem 0.0625rem 0px 0px; - border-radius: 0px calc(0.3125rem) 0px 0px; - transform: rotateZ(45deg) skew(15deg, 15deg); - height: 2rem; -} - -.psdk-stages-inner-past { - color: black; - font-size: 1rem; -} - -.psdk-stages-inner-present { - color: $app-primary-color; - font-weight: bold; - font-size: 1rem; -} -.psdk-stages-inner-future { - color: $app-neutral-color; - font-size: 1rem; -} diff --git a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.spec.ts deleted file mode 100644 index 3805f1fc..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { StagesComponent } from './stages.component'; - -describe('StagesComponent', () => { - let component: StagesComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ StagesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(StagesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.ts b/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.ts deleted file mode 100644 index 64087f02..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/stages/stages.component.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-stages', - templateUrl: './stages.component.html', - styleUrls: ['./stages.component.scss'], - standalone: true, - imports: [CommonModule] -}) -export class StagesComponent implements OnInit { - @Input() pConn$: any; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - configProps$: Object; - - arStageResults$: Array; - lastStage$: any; - checkSvgIcon$: string; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - const imagePath = this.utils.getIconPath(this.utils.getSDKStaticContentUrl()); - this.checkSvgIcon$ = this.utils.getImageSrc('check', this.utils.getSDKStaticContentUrl()); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - let timer = interval(50).subscribe(() => { - timer.unsubscribe(); - - let arStages = this.angularPConnect.getComponentProp(this, 'stages'); - - //this.stageResults$ = this.configProps$["stages"]; - if (arStages != null) { - this.arStageResults$ = arStages; - this.lastStage$ = this.arStageResults$[this.arStageResults$.length - 1]; - } - }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/infra/view/view.component.html b/tests/assets/components/createAll/override-sdk/infra/view/view.component.html deleted file mode 100644 index 0240f243..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/view/view.component.html +++ /dev/null @@ -1,38 +0,0 @@ -
-
- {{ label$ }} -
- - -
- -
-
- - -
-
-
- -
-
-
- -
- -
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/infra/view/view.component.scss b/tests/assets/components/createAll/override-sdk/infra/view/view.component.scss deleted file mode 100644 index bcc13757..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/view/view.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -h3 { - margin-left: 0.8rem; -} - -.ng-view-top { - padding: 0; -} - -.template-title-container{ - display: flex; - justify-content: space-between; - align-items: center; - font-size: calc(0.9375rem); - font-weight: 600; - margin-bottom: 1rem; -} diff --git a/tests/assets/components/createAll/override-sdk/infra/view/view.component.spec.ts b/tests/assets/components/createAll/override-sdk/infra/view/view.component.spec.ts deleted file mode 100644 index 28de8fba..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/view/view.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ViewComponent } from './view.component'; - -describe('ViewComponent', () => { - let component: ViewComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ViewComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ViewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/infra/view/view.component.ts b/tests/assets/components/createAll/override-sdk/infra/view/view.component.ts deleted file mode 100644 index 82eb3a4e..00000000 --- a/tests/assets/components/createAll/override-sdk/infra/view/view.component.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { Component, OnInit, Input, forwardRef, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { getAllFields } from '@pega/angular-sdk-library'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -/** - * WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with - * Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and - * is totally at your own risk. - */ - -@Component({ - selector: 'app-view', - templateUrl: './view.component.html', - styleUrls: ['./view.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class ViewComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() displayOnlyFA$: boolean; - //@Input() updateToken$: number; - - angularPConnectData: any = {}; - - configProps$: Object; - inheritedProps$: Object; - arChildren$: Array; - templateName$: string; - title$: string = ''; - label$: string = ''; - showLabel$: boolean = true; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit() { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.checkAndUpdate(); - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - ngOnChanges(changes: SimpleChanges) { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.checkAndUpdate(); - } - } - - updateSelf() { - if (this.angularPConnect.getComponentID(this) === undefined) { - return; - } - - //debugger; - - // normalize this.pConn$ in case it contains a 'reference' - this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.inheritedProps$ = this.pConn$.getInheritedProps(); - - // NOTE: this.configProps$['visibility'] is used in view.component.ts such that - // the View will only be rendered when this.configProps$['visibility'] is false. - // It WILL render if true or undefined. - - this.templateName$ = 'template' in this.configProps$ ? (this.configProps$['template'] as string) : ''; - this.title$ = 'title' in this.configProps$ ? (this.configProps$['title'] as string) : ''; - this.label$ = 'label' in this.configProps$ ? (this.configProps$['label'] as string) : ''; - this.showLabel$ = 'showLabel' in this.configProps$ ? (this.configProps$['showLabel'] as boolean) : this.showLabel$; - // label & showLabel within inheritedProps takes precedence over configProps - this.label$ = 'label' in this.inheritedProps$ ? (this.inheritedProps$['label'] as string) : this.label$; - this.showLabel$ = 'showLabel' in this.inheritedProps$ ? (this.inheritedProps$['showLabel'] as boolean) : this.showLabel$; - // children may have a 'reference' so normalize the children array - this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); - // was: this.arChildren$ = this.pConn$.getChildren(); - - // debug - // let kidList: string = ""; - // for (let i in this.arChildren$) { - // kidList = kidList.concat(this.arChildren$[i].getPConnect().getComponentName()).concat(","); - // } - //console.log("-->view update: " + this.angularPConnect.getComponentID(this) + ", template: " + this.templateName$ + ", kids: " + kidList); - } - - // JA - adapting additionalProps from Nebula/Constellation version which uses static methods - // on the component classes stored in PComponents (that Angular doesn't have)... - additionalProps(state: any, getPConnect: any) { - let propObj = {}; - - // We already have the template name in this.templateName$ - if (this.templateName$ !== '') { - let allFields = {}; - - // These uses are adapted from Nebula/Constellation CaseSummary.additionalProps - switch (this.templateName$) { - case 'CaseSummary': - allFields = getAllFields(getPConnect); - // eslint-disable-next-line no-case-declarations - const unresFields = { - primaryFields: allFields[0], - secondaryFields: allFields[1] - }; - propObj = getPConnect.resolveConfigProps(unresFields); - break; - - case 'Details': - allFields = getAllFields(getPConnect); - propObj = { fields: allFields[0] }; - break; - } - } - - return propObj; - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/_template.md b/tests/assets/components/createAll/override-sdk/template/_template.md deleted file mode 100644 index c77fa60b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/_template.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/template** directory - -The **src/components/override-sdk/template** directory contains the code for **template** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **template** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/template**. diff --git a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.html b/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.html deleted file mode 100644 index b4412787..00000000 --- a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
-
-
- -
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.scss b/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.scss deleted file mode 100644 index 05572782..00000000 --- a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.scss +++ /dev/null @@ -1,42 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.appshell-top { - display: flex; - background-color: $app-background-color; -} - -.appshell-main { - position: relative; - margin-left: $app-nav-width; - min-height: 100vh; - display: block; - width: 100%; -} - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.progress-box { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - height: 100%; - width: 100%; - background-color: whitesmoke; - position: fixed; - z-index: 999; - top: 0rem; - left: 0rem; - opacity: 0.5; -} - -.progress-spinner { - text-align: center; -} - -::ng-deep snack-bar-container.snackbar-newline { - white-space: pre-line; -} diff --git a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.spec.ts deleted file mode 100644 index f9fbec3d..00000000 --- a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AppShellComponent } from './app-shell.component'; - -describe('AppShellComponent', () => { - let component: AppShellComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AppShellComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AppShellComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.ts b/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.ts deleted file mode 100644 index e29f423b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/app-shell/app-shell.component.ts +++ /dev/null @@ -1,163 +0,0 @@ -import { Component, OnInit, Input, NgZone, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatSnackBarModule, MatSnackBar } from '@angular/material/snack-bar'; -import { Subscription } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ErrorMessagesService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-app-shell', - templateUrl: './app-shell.component.html', - styleUrls: ['./app-shell.component.scss'], - standalone: true, - imports: [CommonModule, MatSnackBarModule, forwardRef(() => ComponentMapperComponent)] -}) -export class AppShellComponent implements OnInit { - @Input() pConn$: any; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - configProps$: Object; - - pages$: Array; - caseTypes$: Array; - arChildren$: Array; - bShowAppShell$: boolean = false; - appName$: string = 'PEGA'; - errorMessage: any; - errorMessagesSubscription: Subscription; - sErrorMessages: string = ''; - snackBarRef: any; - bOkDisplayError: boolean = false; - - constructor( - private angularPConnect: AngularPConnectService, - private erService: ErrorMessagesService, - private snackBar: MatSnackBar, - private ngZone: NgZone - ) {} - - ngOnInit() { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - // making a copy, so can add info - this.pages$ = this.configProps$['pages']; - - if (this.pages$) { - this.bShowAppShell$ = true; - } - this.caseTypes$ = this.configProps$['caseTypes']; - - this.arChildren$ = this.pConn$.getChildren(); - - // handle showing and hiding the progress spinner - this.errorMessagesSubscription = this.erService.getMessage().subscribe((message) => { - this.errorMessage = message; - - this.showDismissErrorMessages(this.errorMessage); - }); - - // cannot call checkAndUpdate becasue first time through, will call updateSelf and that is incorrect (causes issues). - // however, need angularPConnect to be initialized with currentProps for future updates, so calling shouldComponentUpdate directly - // without checking to update here in init, will initialize and this is correct - this.angularPConnect.shouldComponentUpdate(this); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.ngZone.run(() => { - // making a copy, so can add info - this.pages$ = this.configProps$['pages']; - - if (this.pages$) { - this.bShowAppShell$ = true; - } - - this.caseTypes$ = this.configProps$['caseTypes']; - this.arChildren$ = this.pConn$.getChildren(); - }); - } - - // fpr show/hiding error messages in the SnackBar component - showDismissErrorMessages(errorMessages: any) { - switch (errorMessages.action) { - case 'update': - // won't show unless publish is turned on - // eslint-disable-next-line @typescript-eslint/prefer-includes - if (this.sErrorMessages.indexOf(errorMessages.actionMessage) < 0) { - this.sErrorMessages = this.sErrorMessages.concat(errorMessages.actionMessage).concat('\n'); - - if (this.bOkDisplayError) { - let config = { panelClass: ['snackbar-newline'] }; - this.snackBarRef = this.snackBar.open(this.sErrorMessages, 'Ok', config); - } - } - break; - case 'show': - // add error message if not in the list - // won't show unless publish is turned on - // eslint-disable-next-line @typescript-eslint/prefer-includes - if (this.sErrorMessages.indexOf(errorMessages.actionMessage) < 0) { - this.sErrorMessages = this.sErrorMessages.concat(errorMessages.actionMessage).concat('\n'); - } - - if (this.bOkDisplayError) { - let config = { panelClass: ['snackbar-newline'] }; - this.snackBarRef = this.snackBar.open(this.sErrorMessages, 'Ok', config); - } - // this.snackBarRef.afterDismissed().subscribe( info => { - // this.sErrorMessages = ""; - // } - // ) - break; - case 'dismiss': - // closes snack bar - // turns publish off - // clears out errors - // should be called to dimiss and at "cancel" - if (this.snackBarRef != null) { - this.snackBarRef.dismiss(); - this.sErrorMessages = ''; - this.bOkDisplayError = false; - } - break; - case 'publish': - // allows errors to be shown, clears out existing ones - // should be turned on at "submit" (finishAssignment, nextAssignment, etc.) - - this.bOkDisplayError = true; - this.sErrorMessages = ''; - - break; - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.html b/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.html deleted file mode 100644 index 74d8b307..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.scss b/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.scss deleted file mode 100644 index 95949b12..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.scss +++ /dev/null @@ -1,44 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-case-summary-info-box { - display: flex; - flex-direction: row; - justify-content: space-evenly; -} - -.psdk-case-summary-data { - flex: 1; -} - -.psdk-case-view-label { - font-size: 1rem; - display: block; - transform: translateY(0.2em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(0.2em) scale(0.75); - width: 133.33333%; -} - -.psdk-label-readonly { - font-size: 1rem; - display: block; - transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(-1.28125em) scale(0.75); - width: 133.33333%; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -.psdk-status { - background-color: $app-primary-color; - color: white; - padding: 0; - margin-top: 0.625rem; - width: fit-content; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.spec.ts deleted file mode 100644 index 5ae846ce..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CaseSummaryComponent } from './case-summary.component'; - -describe('CaseSummaryComponent', () => { - let component: CaseSummaryComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CaseSummaryComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CaseSummaryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.ts b/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.ts deleted file mode 100644 index d60f9b9c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-summary/case-summary.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-case-summary', - templateUrl: './case-summary.component.html', - styleUrls: ['./case-summary.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class CaseSummaryComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - angularPConnectData: any = {}; - - configProps$: Object; - arChildren$: Array; - - status$: string; - bShowStatus$: boolean; - primaryFields$: Array = []; - secondaryFields$: Array = []; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.initComponent(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - initComponent() { - // dereference the View in case the incoming pConn$ is a 'reference' - this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); - - // Then, continue on with other initialization - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - - this.generatePrimaryAndSecondaryFields(); - - this.status$ = this.configProps$['status']; - this.bShowStatus$ = this.configProps$['showStatus']; - } - - // Callback passed when subscribing to store change - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.generatePrimaryAndSecondaryFields(); - } - - ngOnChanges() { - this.initComponent(); - } - - generatePrimaryAndSecondaryFields() { - this.primaryFields$ = []; - this.secondaryFields$ = []; - - for (let oField of this.arChildren$[0].getPConnect().getChildren()) { - let kid = oField.getPConnect(); - this.primaryFields$.push(kid.resolveConfigProps(kid.getRawMetadata())); - } - - for (let oField of this.arChildren$[1].getPConnect().getChildren()) { - let kid = oField.getPConnect(); - this.secondaryFields$.push(kid.resolveConfigProps(kid.getRawMetadata())); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-summary/config.json b/tests/assets/components/createAll/override-sdk/template/case-summary/config.json deleted file mode 100644 index d8a7d75c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-summary/config.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "CaseSummary", - "label": "Summary data", - "description": "Case summary template", - "type": "Template", - "subtype": "SUMMARY", - "icon": "Summary.svg", - "hideViewName": true, - "hideTemplateEdit": true, - "properties": [ - { - "name": "Primary fields", - "label": "Primary fields", - "format": "CONTENTPICKER", - "addTypeList": ["Fields"] - }, - { - "name": "Secondary fields", - "label": "Secondary fields", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Fields"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.html b/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.html deleted file mode 100644 index d0fb2c07..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.html +++ /dev/null @@ -1,89 +0,0 @@ -
-
- - -
- -
-
-
{{ currentCaseID }}
-
{{ id$ }}
-
-

{{ heading$ }}

-
-
-
-
- -
- - - - - - - - - - -
- -
- -
- -
- - -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
-
-
-
-
- -
-
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.scss b/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.scss deleted file mode 100644 index 05dd426d..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.scss +++ /dev/null @@ -1,106 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -h1 { - font-size: 1.1rem; - line-height: 1.3rem; -} - -::ng-deep .mat-mdc-menu-panel { - overflow: unset; - max-width: unset; -} - -.psdk-case-view-label { - font-size: 1rem; - display: block; - transform: translateY(0.2em) scale(0.75) perspective(100px) translateZ(0.001px); - -ms-transform: translateY(0.2em) scale(0.75); - width: 133.33333%; -} - -.psdk-case-view { - box-sizing: border-box; - display: flex; -} - -.ng-case-view-toolbar { - padding: 0.625rem 0.625rem; -} - -.psdk-case-icon-div { - background-color: $app-primary-dark-color; - border-radius: 1rem; - padding: 0.5rem 0.3rem 0.3rem 0.3rem; -} -.psdk-case-svg-icon { - width: 2rem; - padding: 0rem 0.3125rem; - filter: $app-white-color-filter; -} - -.psdk-case-view-info-box { - display: flex; - flex-direction: row; - padding: 0rem 0.3125rem 0rem 0rem; -} - -.psdk-case-view-info { - flex: 0 0 auto; - width: 25rem; - float: left; - padding: 0rem 0.3125rem 0rem 0rem; - height: 100%; /* Should be removed. Only for demonstration */ - background-color: $app-form-color; -} - -.psdk-case-view-main { - flex-grow: 2; - float: left; - padding: 0rem 0.3125rem; - height: 100%; /* Should be removed. Only for demonstration */ -} - -.psdk-case-view-summary { - padding-left: 0.75rem; -} - -.psdk-case-view-heading { - display: block; - text-align: left; - padding-left: 0.5rem; - padding-bottom: 0; - padding-top: 5px; -} -.psdk-case-view-heading-id { - font-size: 0.9rem; - font-weight: normal; -} - -.psdk-case-view-buttons { - display: flex; - justify-content: flex-start; - padding: 0.3125rem; -} - -.psdk-case-view-utilities { - width: 21.875rem; - float: left; - padding: 0rem 0.3125rem; - height: 100%; /* Should be removed. Only for demonstration */ -} - -.psdk-case-view-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-status { - padding: 0.3125rem 0.3125rem; - background-color: $app-primary-color; - color: white; - width: fit-content; - margin: 0.625rem; -} - -button { - margin: 0rem 0.3125rem; -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.spec.ts deleted file mode 100644 index cf55d267..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { CaseViewComponent } from './case-view.component'; - -describe('CaseViewComponent', () => { - let component: CaseViewComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ CaseViewComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CaseViewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.ts b/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.ts deleted file mode 100644 index db424e2e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-view/case-view.component.ts +++ /dev/null @@ -1,229 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { MatToolbarModule } from '@angular/material/toolbar'; -import { MatButtonModule } from '@angular/material/button'; -import { MatMenuModule } from '@angular/material/menu'; -import { interval } from 'rxjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-case-view', - templateUrl: './case-view.component.html', - styleUrls: ['./case-view.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, MatToolbarModule, MatButtonModule, MatMenuModule, ComponentMapperComponent, forwardRef(() => RegionComponent)] -}) -export class CaseViewComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() displayOnlyFA$: boolean; - - PCore$: any; - - configProps$: Object; - arChildren$: Array; - - heading$: string = ''; - id$: string = ''; - status$: string = ''; - caseTabs$: Array = []; - svgCase$: string; - tabData$: any; - - mainTabs: any; - mainTabData: any; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - arAvailableActions$: Array = []; - arAvailabeProcesses$: Array = []; - - caseSummaryPConn$: any; - currentCaseID: string = ''; - editAction: boolean; - bHasNewAttachments: boolean = false; - - constructor( - private cdRef: ChangeDetectorRef, - private angularPConnect: AngularPConnectService, - private utils: Utils - ) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - const bLogging = false; - - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - // generally, don't want to refresh everything when data changes in caseView, it is usually the - // case summary. But check if the case ID changes, this means a different case and we should - // update all. - if (this.hasCaseIDChanged()) { - this.fullUpdate(); - - // update okToInitFlowContainer, because case view was drawn, flow container will need to be init - // to match Nebula/Constellation - sessionStorage.setItem('okToInitFlowContainer', 'true'); - } else { - this.updateHeaderAndSummary(); - } - } - } - - hasCaseIDChanged(): boolean { - if (this.currentCaseID !== this.pConn$.getDataObject().caseInfo.ID) { - this.currentCaseID = this.pConn$.getDataObject().caseInfo.ID; - return true; - } else { - return false; - } - } - - updateHeaderAndSummary() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - let hasNewAttachments = this.pConn$.getDataObject().caseInfo?.hasNewAttachments; - - if(hasNewAttachments !== this.bHasNewAttachments){ - this.bHasNewAttachments = hasNewAttachments; - if(this.bHasNewAttachments){ - this.PCore$.getPubSubUtils().publish( - this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, - true - ); - } - } - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let meta = kid.getPConnect().getRawMetadata(); - if (meta.type.toLowerCase() == 'region' && meta.name.toLowerCase() == 'summary') { - this.caseSummaryPConn$ = kid.getPConnect().getChildren()[0].getPConnect(); - } - } - - // have to put in a timeout, otherwise get an angular change event error - let timer = interval(100).subscribe(() => { - timer.unsubscribe(); - - this.heading$ = this.configProps$['header']; - this.id$ = this.configProps$['subheader']; - this.status$ = this.pConn$.getValue('.pyStatusWork'); - }); - } - - fullUpdate() { - this.caseTabs$ = []; - this.updateHeaderAndSummary(); - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - - let caseInfo = this.pConn$.getDataObject().caseInfo; - this.currentCaseID = caseInfo.ID; - this.arAvailableActions$ = caseInfo?.availableActions ? caseInfo.availableActions : []; - this.editAction = this.arAvailableActions$.find((action) => action.ID === 'pyUpdateCaseDetails'); - this.arAvailabeProcesses$ = caseInfo?.availableProcesses ? caseInfo.availableProcesses : []; - - this.svgCase$ = this.utils.getImageSrc(this.configProps$['icon'], this.utils.getSDKStaticContentUrl()); - - //this.utils.consoleKidDump(this.pConn$); - - if (!this.displayOnlyFA$) { - for (let kid of this.arChildren$) { - let kidPConn = kid.getPConnect(); - if (kidPConn.getRawMetadata().name == 'Tabs') { - this.mainTabs = kid; - this.mainTabData = this.mainTabs.getPConnect().getChildren(); - } - } - - this.mainTabs - .getPConnect() - .getChildren() - ?.forEach((child, i) => { - const config = child.getPConnect().resolveConfigProps(child.getPConnect().getRawMetadata()).config; - let { label, inheritedProps, visibility } = config; - //For some tabs, "label" property is not avaialable in theTabCompConfig, so will get them from inheritedProps - if (!label) { - inheritedProps.forEach((inheritedProp: any) => { - if (inheritedProp.prop === 'label') { - label = inheritedProp.value; - } - }); - } - // We'll display the tabs when either visibility property doesn't exist or is true(if exists) - if (visibility === undefined || visibility === true) { - this.caseTabs$.push({ name: label, id: i }); - // To make first visible tab display at the beginning - if (!this.tabData$) { - this.tabData$ = { type: 'DeferLoad', config: child.getPConnect().getRawMetadata().config }; - } - } - }); - } - } - - updateSelf() { - this.fullUpdate(); - } - - onTabClick(tab: any) { - this.tabData$ = this.mainTabData[tab].getPConnect().getRawMetadata(); - this.cdRef.detectChanges(); - } - - _editClick() { - const editAction = this.arAvailableActions$.find((action) => action.ID === 'pyUpdateCaseDetails'); - const actionsAPI = this.pConn$.getActionsApi(); - const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI); - - openLocalAction(editAction.ID, { ...editAction }); - } - - _menuActionClick(data) { - const actionsAPI = this.pConn$.getActionsApi(); - const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI); - - openLocalAction(data.ID, { ...data, containerName: 'modal', type: 'express' }); - } - - _menuProcessClick(data) { - const actionsAPI = this.pConn$.getActionsApi(); - const openProcessAction = actionsAPI.openProcessAction.bind(actionsAPI); - - openProcessAction(data.ID, { ...data }); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/case-view/config.json b/tests/assets/components/createAll/override-sdk/template/case-view/config.json deleted file mode 100644 index b1f47a0f..00000000 --- a/tests/assets/components/createAll/override-sdk/template/case-view/config.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "CaseView", - "label": "Case page", - "description": "Standard case page", - "type": "Template", - "subtype": "CASEVIEW", - "icon": "CasePage.svg", - "hideTemplateEdit": true, - "hideViewName": true, - "properties": [ - { - "name": "header", - "label": "Header", - "format": "PROPERTY" - }, - { - "name": "subheader", - "label": "Subheader", - "format": "PROPERTY" - }, - { - "name": "showIconInHeader", - "label": "Show icon in header", - "format": "BOOLEAN" - }, - { - "name": "Tabs", - "label": "Tabs", - "format": "CONTENTPICKER", - "modifyPanelOverride": "DeferLoad", - "addTypeList": ["Tabs"] - }, - { - "name": "Utilities", - "label": "Utilities", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.html b/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.html deleted file mode 100644 index 81ffcddc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
-
-

{{ label }}

-
- -
-
- -
-
- -
-
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.scss b/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.scss deleted file mode 100644 index 65c3587c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.scss +++ /dev/null @@ -1,10 +0,0 @@ -.done-button { - justify-content: flex-end; - display: flex; - padding-bottom: 1rem; -} - -.confirm-label { - padding: 0px 16px; - margin: 0px; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.spec.ts deleted file mode 100644 index 845c91b0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ConfirmationComponent } from './confirmation.component'; - - -describe('ConfirmationComponent', () => { - let component: ConfirmationComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ConfirmationComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(ConfirmationComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.ts b/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.ts deleted file mode 100644 index dcaf6291..00000000 --- a/tests/assets/components/createAll/override-sdk/template/confirmation/confirmation.component.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { getToDoAssignments } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-confirmation', - templateUrl: './confirmation.component.html', - styleUrls: ['./confirmation.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class ConfirmationComponent implements OnInit { - rootInfo: any; - datasource: any; - showTasks: any; - detailProps: any; - toDoList: any; - label: any; - CONSTS: any; - showDetails: boolean; - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - - angularPConnectData: any = {}; - PCore$: any; - configProps$: any; - showConfirmView = true; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.CONSTS = this.PCore$.getConstants(); - const activeContainerItemID = this.PCore$.getContainerUtils().getActiveContainerItemName(this.pConn$.getTarget()); - this.rootInfo = this.PCore$.getContainerUtils().getContainerItemData(this.pConn$.getTarget(), activeContainerItemID); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const theConfigProps = this.pConn$.getConfigProps(); - this.datasource = theConfigProps?.datasource; - this.showTasks = theConfigProps?.showTasks; - this.label = theConfigProps?.label; - // Get the inherited props from the parent to determine label settings - // Not using whatsNext at the moment, need to figure out the use of it - const whatsNext = this.datasource?.source; - const items = whatsNext?.length > 0 ? whatsNext.map((item) => item.label) : ''; - const todoProps = { ...theConfigProps, renderTodoInConfirm: true }; - this.toDoList = getToDoAssignments(this.pConn$); - this.detailProps = { ...theConfigProps, showLabel: false }; - this.showDetails = this.pConn$?.getChildren()?.[0]?.getPConnect()?.getChildren()?.length > 0; - } - - onConfirmViewClose() { - this.showConfirmView = false; - this.PCore$.getPubSubUtils().publish(this.PCore$.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CLOSE_CONFIRM_VIEW, this.rootInfo); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.html b/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.html deleted file mode 100644 index 1436efea..00000000 --- a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
- -
-
-
- -
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.scss b/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.spec.ts deleted file mode 100644 index 66f0b7b9..00000000 --- a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DataReferenceComponent } from './data-reference.component'; - -describe('DataReferenceComponent', () => { - let component: DataReferenceComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DataReferenceComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DataReferenceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.ts b/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.ts deleted file mode 100644 index a168d9a0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/data-reference/data-reference.component.ts +++ /dev/null @@ -1,251 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MultiReferenceReadonlyComponent } from '@pega/angular-sdk-library'; -import { SingleReferenceReadonlyComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' }; - -@Component({ - selector: 'app-data-reference', - templateUrl: './data-reference.component.html', - styleUrls: ['./data-reference.component.scss'], - standalone: true, - imports: [ - CommonModule, - SingleReferenceReadonlyComponent, - MultiReferenceReadonlyComponent, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class DataReferenceComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - - arFields$: Array = []; - referenceType = ''; - selectionMode = ''; - parameters; - hideLabel = false; - childrenToRender: Array = []; - dropDownDataSource: String = ''; - isDisplayModeEnabled: Boolean = false; - propsToUse: any = {}; - rawViewMetadata: any = {}; - viewName: String = ''; - firstChildMeta: any = {}; - canBeChangedInReviewMode: Boolean = false; - propName: String = ''; - firstChildPConnect; - children; - displaySingleRef: boolean; - displayMultiRef: boolean; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.children = this.pConn$.getChildren(); - this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - // Update properties based on configProps - const theConfigProps = this.pConn$.getConfigProps(); - const label = theConfigProps.label; - const showLabel = theConfigProps.showLabel; - const displayMode = theConfigProps.displayMode; - const allowAndPersistChangesInReviewMode = theConfigProps.allowAndPersistChangesInReviewMode; - this.referenceType = theConfigProps.referenceType; - this.selectionMode = theConfigProps.selectionMode; - const displayAs = theConfigProps.displayAs; - this.parameters = theConfigProps.parameters; - this.hideLabel = theConfigProps.hideLabel; - - this.propsToUse = { label, showLabel, ...this.pConn$.getInheritedProps() }; - if (this.propsToUse.showLabel === false) { - this.propsToUse.label = ''; - } - this.rawViewMetadata = this.pConn$.getRawMetadata(); - this.viewName = this.rawViewMetadata.name; - this.firstChildMeta = this.rawViewMetadata.children[0]; - const refList = this.rawViewMetadata.config.referenceList; - this.canBeChangedInReviewMode = - allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown'); - // this.childrenToRender = this.children; - this.isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode); - - if (this.firstChildMeta?.type !== 'Region') { - this.firstChildPConnect = this.pConn$.getChildren()[0].getPConnect; - - /* remove refresh When condition from those old view so that it will not be used for runtime */ - if (this.firstChildMeta.config?.readOnly) { - delete this.firstChildMeta.config.readOnly; - } - if (this.firstChildMeta?.type === 'Dropdown') { - this.firstChildMeta.config.datasource.source = this.rawViewMetadata.config?.parameters - ? this.dropDownDataSource - : '@DATASOURCE '.concat(refList).concat('.pxResults'); - } else if (this.firstChildMeta?.type === 'AutoComplete') { - this.firstChildMeta.config.datasource = refList; - - /* Insert the parameters to the component only if present */ - if (this.rawViewMetadata.config?.parameters) { - this.firstChildMeta.config.parameters = this.parameters; - } - } - // set displayMode conditionally - if (!this.canBeChangedInReviewMode) { - this.firstChildMeta.config.displayMode = displayMode; - } - if (this.firstChildMeta.type === 'SimpleTableSelect' && this.selectionMode === SELECTION_MODE.MULTI) { - this.propName = this.PCore$.getAnnotationUtils().getPropertyName(this.firstChildMeta.config.selectionList); - } else { - this.propName = this.PCore$.getAnnotationUtils().getPropertyName(this.firstChildMeta.config.value); - } - - const theRecreatedFirstChild = this.recreatedFirstChild(); - const viewsRegion = this.rawViewMetadata.children[1]; - if (viewsRegion?.name === 'Views' && viewsRegion.children.length) { - this.childrenToRender = [theRecreatedFirstChild, ...this.children.slice(1)]; - } else { - this.childrenToRender = [theRecreatedFirstChild]; - } - } - } - - handleSelection(event) { - const caseKey = this.pConn$.getCaseInfo().getKey(); - const refreshOptions = { autoDetectRefresh: true }; - if (this.canBeChangedInReviewMode && this.pConn$.getValue('__currentPageTabViewName')) { - this.pConn$ - .getActionsApi() - .refreshCaseView(caseKey, this.pConn$.getValue('__currentPageTabViewName'), null, refreshOptions); - this.PCore$.getDeferLoadManager().refreshActiveComponents(this.pConn$.getContextName()); - } else { - const pgRef = this.pConn$.getPageReference().replace('caseInfo.content', ''); - this.pConn$.getActionsApi().refreshCaseView(caseKey, this.viewName, pgRef, refreshOptions); - } - - // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value - const propValue = event?.id || event?.target?.value; - if (propValue && this.canBeChangedInReviewMode && this.isDisplayModeEnabled) { - this.PCore$.getDataApiUtils() - .getCaseEditLock(caseKey) - .then((caseResponse) => { - const pageTokens = this.pConn$.getPageReference().replace('caseInfo.content', '').split('.'); - let curr = {}; - const commitData = curr; - - pageTokens.forEach((el) => { - if (el !== '') { - curr[el] = {}; - curr = curr[el]; - } - }); - - // expecting format like {Customer: {pyID:"C-100"}} - const propArr = this.propName.split('.'); - propArr.forEach((element, idx) => { - if (idx + 1 === propArr.length) { - curr[element] = propValue; - } else { - curr[element] = {}; - curr = curr[element]; - } - }); - - this.PCore$.getDataApiUtils() - .updateCaseEditFieldsData( - caseKey, - { [caseKey]: commitData }, - caseResponse.headers.etag, - this.pConn$.getContextName() - ) - .then((response) => { - this.PCore$.getContainerUtils().updateChildContainersEtag( - this.pConn$.getContextName(), - response.headers.etag - ); - }); - }); - } - } - - // Re-create first child with overridden props - // Memoized child in order to stop unmount and remount of the child component when data reference - // rerenders without any actual change - recreatedFirstChild() { - const { type, config } = this.firstChildMeta; - if (this.firstChildMeta?.type !== 'Region') { - this.pConn$.clearErrorMessages({ - property: this.propName - }); - if (!this.canBeChangedInReviewMode && this.isDisplayModeEnabled && this.selectionMode === SELECTION_MODE.SINGLE) { - this.displaySingleRef = true; - } - - if (this.isDisplayModeEnabled && this.selectionMode === SELECTION_MODE.MULTI) { - this.displayMultiRef = true; - } - - // In the case of a datasource with parameters you cannot load the dropdown before the parameters - if (type === 'Dropdown' && this.rawViewMetadata.config?.parameters && this.dropDownDataSource === null) { - return null; - } - - return this.firstChildPConnect().createComponent({ - type, - config: { - ...config, - required: this.propsToUse.required, - visibility: this.propsToUse.visibility, - disabled: this.propsToUse.disabled, - label: this.propsToUse.label, - viewName: this.pConn$.getCurrentView(), - parameters: this.rawViewMetadata.config.parameters, - readOnly: false, - localeReference: this.rawViewMetadata.config.localeReference, - ...(this.selectionMode === SELECTION_MODE.SINGLE ? { referenceType: this.referenceType } : ''), - dataRelationshipContext: - this.rawViewMetadata.config.contextClass && this.rawViewMetadata.config.name - ? this.rawViewMetadata.config.name - : null, - hideLabel: this.hideLabel, - onRecordChange: this.handleSelection.bind(this) - } - }); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.html b/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.html deleted file mode 100644 index 90023929..00000000 --- a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-
{{label}}
-
-
-
-
-
-
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.scss b/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.scss deleted file mode 100644 index d135e488..00000000 --- a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.scss +++ /dev/null @@ -1,38 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-default-form-one-column { - display: grid; - grid-template-columns: repeat(1, minmax(0, 1fr)); - gap: calc(1rem); -} - -.psdk-default-form-two-column { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: calc(1rem); -} - -.psdk-default-form-three-column { - display: grid; - grid-template-columns: repeat(3, 1fr); - gap: calc(1rem); -} - -.psdk-default-form-two-column .grid-column { - grid-column: 1 / span 2; -} - -.psdk-default-form-three-column .grid-column { - grid-column: 1 / span 3; -} - -.template-title-container { - font-size: calc(0.9375rem); - font-weight: 600; - margin: 10px 0px; -} - -.psdk-default-form-instruction-text{ - padding-top: 0.625rem; - padding-bottom: 0.625rem; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.spec.ts deleted file mode 100644 index 0908ba7e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DefaultFormComponent } from './default-form.component'; - -describe('DefaultFormComponent', () => { - let component: DefaultFormComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DefaultFormComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DefaultFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.ts b/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.ts deleted file mode 100644 index 17f89230..00000000 --- a/tests/assets/components/createAll/override-sdk/template/default-form/default-form.component.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { ReferenceComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { TemplateUtils } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-default-form', - templateUrl: './default-form.component.html', - styleUrls: ['./default-form.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DefaultFormComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - divClass$: string; - template: any; - showLabel: any; - label: any; - instructions: string; - - NO_HEADER_TEMPLATES = [ - 'SubTabs', - 'SimpleTable', - 'Details', - 'DetailsTwoColumn', - 'DetailsThreeColumn', - 'NarrowWideDetails', - 'WideNarrowDetails', - 'Confirmation' - ]; - - constructor(private templateUtils: TemplateUtils) {} - - ngOnInit(): void { - let configProps = this.pConn$.getConfigProps(); - this.template = configProps?.template; - const propToUse = { ...this.pConn$.getInheritedProps() }; - this.showLabel = propToUse?.showLabel; - this.label = propToUse?.label; - let kids = this.pConn$.getChildren(); - this.instructions = this.templateUtils.getInstructions(this.pConn$, configProps?.instructions); - console.log("instructions" + this.instructions); - - let numCols = configProps.NumCols ? configProps.NumCols : '1'; - switch (numCols) { - case '1': - this.divClass$ = 'psdk-default-form-one-column'; - break; - case '2': - this.divClass$ = 'psdk-default-form-two-column'; - break; - case '3': - this.divClass$ = 'psdk-default-form-three-column'; - break; - default: - this.divClass$ = 'psdk-default-form-one-column'; - break; - } - - // repoint children before getting templateArray - // Children may contain 'reference' component, so we need to - // normalize them - this.arChildren$ = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren()); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.html b/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.html deleted file mode 100644 index e22f590a..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.html +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.scss b/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.scss deleted file mode 100644 index deee7559..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: 3fr 7fr; - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.spec.ts deleted file mode 100644 index e22b4472..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsNarrowWideComponent } from './details-narrow-wide.component'; - -describe('DetailsNarrowWideComponent', () => { - let component: DetailsNarrowWideComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsNarrowWideComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsNarrowWideComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.ts b/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.ts deleted file mode 100644 index ef387e17..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-narrow-wide/details-narrow-wide.component.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-details-narrow-wide', - templateUrl: './details-narrow-wide.component.html', - styleUrls: ['./details-narrow-wide.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsNarrowWideComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - - arFields$: Array = []; - arFields2$: Array = []; - highlightedDataArr: Array = []; - showHighlightedData: boolean; - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } else { - this.arFields2$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-one-column/config.json b/tests/assets/components/createAll/override-sdk/template/details-one-column/config.json deleted file mode 100644 index 6a2a3506..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-one-column/config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Details", - "label": "Details (One column)", - "description": "Details (One column)", - "type": "Template", - "subtype": "DETAILS", - "icon": "OneColumnDetails.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.html b/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.html deleted file mode 100644 index 978798d1..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.scss b/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.spec.ts deleted file mode 100644 index f7573b8a..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsOneColumnComponent } from './details-one-column.component'; - -describe('DetailsOneColumnComponent', () => { - let component: DetailsOneColumnComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsOneColumnComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsOneColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.ts b/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.ts deleted file mode 100644 index 8dd71deb..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-one-column/details-one-column.component.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { FormGroup } from '@angular/forms'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-details-one-column', - templateUrl: './details-one-column.component.html', - styleUrls: ['./details-one-column.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsOneColumnComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - showHighlightedData: boolean; - highlightedDataArr: any; - - arFields$: Array = []; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - this.pConn$.setInheritedProp('readOnly', true); - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.html b/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.html deleted file mode 100644 index c6094126..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.html +++ /dev/null @@ -1,15 +0,0 @@ - - -
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.scss b/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.spec.ts deleted file mode 100644 index b8d341a6..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DetailsSubTabsComponent } from './details-sub-tabs.component'; - -describe('DetailsSubTabsComponent', () => { - let component: DetailsSubTabsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DetailsSubTabsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsSubTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.ts b/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.ts deleted file mode 100644 index 50a5d430..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-sub-tabs/details-sub-tabs.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { MatTabsModule } from '@angular/material/tabs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-details-sub-tabs', - templateUrl: './details-sub-tabs.component.html', - styleUrls: ['./details-sub-tabs.component.scss'], - standalone: true, - imports: [MatTabsModule, CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class DetailsSubTabsComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - angularPConnectData: any = {}; - PCore$: any; - defaultTabIndex = 0; - currentTabId = this.defaultTabIndex.toString(); - tabItems: Array; - availableTabs: any; - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const children = this.pConn$?.getChildren(); - const deferLoadedTabs = children[0]; - this.availableTabs = getVisibleTabs(deferLoadedTabs, 'tabsSubs'); - this.updateTabContent(); - } - - updateTabContent() { - const tempTabItems = getTransientTabs(this.availableTabs, this.currentTabId, this.tabItems); - this.tabItems = tempTabItems; - } - - handleTabClick(event) { - const { index } = event; - this.currentTabId = index.toString(); - tabClick(index, this.availableTabs, this.currentTabId, this.tabItems); - const tempTabItems = getTransientTabs(this.availableTabs, this.currentTabId, this.tabItems); - this.tabItems[index].content = tempTabItems[index].content; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-three-column/config.json b/tests/assets/components/createAll/override-sdk/template/details-three-column/config.json deleted file mode 100644 index e3da8894..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-three-column/config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "DetailsThreeColumn", - "label": "Details (Three column)", - "description": "Details (Three column)", - "type": "Template", - "subtype": "DETAILS", - "icon": "ThreeColumnDetails.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - }, - { - "name": "C", - "label": "Region C", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.html b/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.html deleted file mode 100644 index 0fa1434c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.html +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.scss b/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.scss deleted file mode 100644 index e847157b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(3,minmax(0,1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.spec.ts deleted file mode 100644 index 1bb920f1..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsThreeColumnComponent } from './details-three-column.component'; - -describe('DetailsThreeColumnComponent', () => { - let component: DetailsThreeColumnComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsThreeColumnComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsThreeColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.ts b/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.ts deleted file mode 100644 index e2241f89..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-three-column/details-three-column.component.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-details-three-column', - templateUrl: './details-three-column.component.html', - styleUrls: ['./details-three-column.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsThreeColumnComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - showHighlightedData: boolean; - highlightedDataArr: any; - PCore$: any; - - arFields$: Array = []; - arFields2$: Array = []; - arFields3$: Array = []; - - propsToUse: any = {}; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - this.pConn$.setInheritedProp('readOnly', true); - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } else if (kids.indexOf(kid) == 1) { - this.arFields2$ = pKidData.children; - } else { - this.arFields3$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-two-column/config.json b/tests/assets/components/createAll/override-sdk/template/details-two-column/config.json deleted file mode 100644 index 60823c6e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-two-column/config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "DetailsTwoColumn", - "label": "Details (Two column)", - "description": "Details (Two column)", - "type": "Template", - "subtype": "DETAILS", - "icon": "TwoColumnDetails.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.html b/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.html deleted file mode 100644 index 1c73cc38..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.html +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.scss b/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.scss deleted file mode 100644 index be9bb2d2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.spec.ts deleted file mode 100644 index a89c8096..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsTwoColumnComponent } from './details-two-column.component'; - -describe('DetailsTwoColumnComponent', () => { - let component: DetailsTwoColumnComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsTwoColumnComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsTwoColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.ts b/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.ts deleted file mode 100644 index a8ba17c2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-two-column/details-two-column.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-details-two-column', - templateUrl: './details-two-column.component.html', - styleUrls: ['./details-two-column.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsTwoColumnComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - showHighlightedData: boolean; - highlightedDataArr: any; - - arFields$: Array = []; - arFields2$: Array = []; - arFields3$: Array = []; - - propsToUse: any = {}; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - this.pConn$.setInheritedProp('readOnly', true); - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } else { - this.arFields2$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.html b/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.html deleted file mode 100644 index 8ce282ba..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.html +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.scss b/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.scss deleted file mode 100644 index 6c30835f..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: 7fr 3fr; - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.spec.ts deleted file mode 100644 index b8de9da8..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsWideNarrowComponent } from './details-wide-narrow.component'; - -describe('DetailsWideNarrowComponent', () => { - let component: DetailsWideNarrowComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsWideNarrowComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsWideNarrowComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.ts b/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.ts deleted file mode 100644 index b91ddeca..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details-wide-narrow/details-wide-narrow.component.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-details-wide-narrow', - templateUrl: './details-wide-narrow.component.html', - styleUrls: ['./details-wide-narrow.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsWideNarrowComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - highlightedDataArr: Array = []; - showHighlightedData: boolean; - arFields$: Array = []; - arFields2$: Array = []; - propsToUse: any = {}; - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - this.pConn$.setInheritedProp('readOnly', true); - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - let pKid = kid.getPConnect(); - let pKidData = pKid.resolveConfigProps(pKid.getRawMetadata()); - if (kids.indexOf(kid) == 0) { - this.arFields$ = pKidData.children; - } else { - this.arFields2$ = pKidData.children; - } - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/details/config.json b/tests/assets/components/createAll/override-sdk/template/details/config.json deleted file mode 100644 index 6a2a3506..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details/config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Details", - "label": "Details (One column)", - "description": "Details (One column)", - "type": "Template", - "subtype": "DETAILS", - "icon": "OneColumnDetails.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Views", "UIComponents"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/details/details.component.html b/tests/assets/components/createAll/override-sdk/template/details/details.component.html deleted file mode 100644 index 9bab94e3..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details/details.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- -
diff --git a/tests/assets/components/createAll/override-sdk/template/details/details.component.scss b/tests/assets/components/createAll/override-sdk/template/details/details.component.scss deleted file mode 100644 index be9bb2d2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details/details.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/override-sdk/template/details/details.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/details/details.component.spec.ts deleted file mode 100644 index 3505e504..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details/details.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DetailsComponent } from './details.component'; - -describe('DetailsComponent', () => { - let component: DetailsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DetailsComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(DetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/details/details.component.ts b/tests/assets/components/createAll/override-sdk/template/details/details.component.ts deleted file mode 100644 index 029fe253..00000000 --- a/tests/assets/components/createAll/override-sdk/template/details/details.component.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { MaterialDetailsComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-details', - templateUrl: './details.component.html', - styleUrls: ['./details.component.scss'], - standalone: true, - imports: [MaterialDetailsComponent] -}) -export class DetailsComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - - PCore$: any; - - highlightedDataArr: Array = []; - showHighlightedData: boolean; - arFields$: Array = []; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const rawMetaData = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata().config); - this.showHighlightedData = rawMetaData?.showHighlightedData; - - if( this.showHighlightedData ){ - const highlightedData = rawMetaData?.highlightedData; - this.highlightedDataArr = highlightedData.map(field => { - field.config.displayMode = 'STACKED_LARGE_VAL'; - - if (field.config.value === '@P .pyStatusWork') { - field.type = 'TextInput'; - field.config.displayAsStatus = true; - } - - return field; - }); - } - - let kids = this.pConn$.getChildren(); - for (let kid of kids) { - this.arFields$ = []; - let pKid = kid.getPConnect(); - const fields = pKid.getChildren(); - fields?.forEach((field) => { - const thePConn = field.getPConnect(); - const theCompType = thePConn.getComponentName().toLowerCase(); - if (theCompType === 'reference') { - const configProps = thePConn.getConfigProps(); - configProps.readOnly = true; - configProps.displayMode = 'LABELS_LEFT'; - const propToUse = { ...thePConn.getInheritedProps() }; - configProps.label = propToUse?.label; - const options = { - context: thePConn.getContextName(), - pageReference: thePConn.getPageReference(), - referenceList: thePConn.getReferenceList() - }; - const viewContConfig = { - meta: { - type: theCompType, - config: configProps - }, - options - }; - const theViewCont = this.PCore$.createPConnect(viewContConfig); - const data = { - type: theCompType, - pConn: theViewCont?.getPConnect() - }; - this.arFields$.push(data); - } else { - const data = { - type: theCompType, - config: thePConn.getConfigProps() - }; - this.arFields$.push(data); - } - }); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.html b/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.html deleted file mode 100644 index 1607186e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.html +++ /dev/null @@ -1,8 +0,0 @@ -
- {{ heading }} -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.scss b/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.scss deleted file mode 100644 index b630a267..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -.psdk-details-fields-label { - color: rgba(0, 0, 0, 0.54); - margin: 8px 0px; -} - -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.ts b/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.ts deleted file mode 100644 index 01313b8f..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-list/field-group-list.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-field-group-list', - templateUrl: './field-group-list.component.html', - styleUrls: ['./field-group-list.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class FieldGroupListComponent implements OnInit { - @Input() item; - @Input() heading; - @Input() formGroup$; - - fields: any = []; - - ngOnInit(): void {} - - ngOnChanges() {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.html b/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.html deleted file mode 100644 index e808504a..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-

- {{ label$ }} -

-
-
-
- -
-
-
- -
-
-
-
- {{ kid.name }} -
-
- -
-
- -
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.scss b/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.scss deleted file mode 100644 index 840c1a37..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.psdk-utility-card-action-svg-icon { - width: 1.4rem; -} - -.header-div { - display: flex; - align-items: center; -} diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.ts b/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.ts deleted file mode 100644 index 7ce096a2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-group-template/field-group-template.component.ts +++ /dev/null @@ -1,157 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { FieldGroupUtils } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-field-group-template', - templateUrl: './field-group-template.component.html', - styleUrls: ['./field-group-template.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule, ComponentMapperComponent, forwardRef(() => RegionComponent)] -}) -export class FieldGroupTemplateComponent implements OnInit { - @Input() configProps$: any; - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - PCore$: any; - - angularPConnectData: any = {}; - inheritedProps$: Object; - showLabel$: boolean = true; - label$: string; - readonlyMode: boolean; - contextClass: any; - referenceList: any; - pageReference: any; - heading: any; - children: any; - menuIconOverride$: any; - prevRefLength: number; - allowAddEdit: boolean; - fieldHeader: any; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils, private fieldGroupUtils: FieldGroupUtils) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.updateSelf(); - - let menuIconOverride$ = 'trash'; - if (menuIconOverride$) { - this.menuIconOverride$ = this.utils.getImageSrc(menuIconOverride$, this.utils.getSDKStaticContentUrl()); - } - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - ngOnChanges(changes) { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - if (changes && changes.configProps$) { - const props = changes.configProps$; - if (props.currentValue !== props.previousValue) { - this.configProps$ = props.currentValue; - if (changes?.pConn$?.currentValue) { - this.pConn$ = changes?.pConn$?.currentValue; - } - this.updateSelf(); - } - } - } - - updateSelf() { - this.inheritedProps$ = this.pConn$.getInheritedProps(); - this.label$ = this.configProps$['label']; - this.showLabel$ = this.configProps$['showLabel']; - // label & showLabel within inheritedProps takes precedence over configProps - this.label$ = this.inheritedProps$['label'] || this.label$; - this.showLabel$ = this.inheritedProps$['showLabel'] || this.showLabel$; - - this.allowAddEdit = this.configProps$['allowTableEdit']; - - const renderMode = this.configProps$['renderMode']; - const displayMode = this.configProps$['displayMode']; - this.readonlyMode = renderMode === 'ReadOnly' || displayMode === 'LABELS_LEFT'; - this.contextClass = this.configProps$['contextClass']; - const lookForChildInConfig = this.configProps$['lookForChildInConfig']; - this.heading = this.configProps$['heading'] ?? 'Row'; - this.fieldHeader = this.configProps$['fieldHeader']; - const resolvedList = this.fieldGroupUtils.getReferenceList(this.pConn$); - this.pageReference = `${this.pConn$.getPageReference()}${resolvedList}`; - this.pConn$.setReferenceList(resolvedList); - if (this.readonlyMode) { - this.pConn$.setInheritedProp('displayMode', 'LABELS_LEFT'); - } - this.referenceList = this.configProps$['referenceList']; - if (this.prevRefLength != this.referenceList.length) { - if (!this.readonlyMode) { - if (this.referenceList?.length === 0 && this.allowAddEdit !== false) { - this.addFieldGroupItem(); - } - } - let children: any = []; - this.referenceList?.map((item, index) => { - children.push({ - id: index, - name: this.fieldHeader === 'propertyRef' ? this.getDynamicHeader(item, index) : this.getStaticHeader(this.heading, index), - children: this.fieldGroupUtils.buildView(this.pConn$, index, lookForChildInConfig) - }); - }); - this.children = children; - } - this.prevRefLength = this.referenceList.length; - } - - getStaticHeader = (heading, index) => { - return `${heading} ${index + 1}`; - }; - - getDynamicHeader = (item, index) => { - if (this.fieldHeader === 'propertyRef' && this.heading && item[this.heading.substring(1)]) { - return item[this.heading.substring(1)]; - } - return `Row ${index + 1}`; - }; - - addFieldGroupItem() { - if (this.PCore$?.getPCoreVersion()?.includes('8.7')) { - this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length, this.pageReference); - } else { - this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length); - } - } - - deleteFieldGroupItem(index) { - if (this.PCore$?.getPCoreVersion()?.includes('8.7')) { - this.pConn$.getListActions().deleteEntry(index, this.pageReference); - } else { - this.pConn$.getListActions().deleteEntry(index); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.html b/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.html deleted file mode 100644 index bfd80b82..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.html +++ /dev/null @@ -1,21 +0,0 @@ -
-
{{ label$ }}
-
- {{ value$ || "---" }} -
-
- - -
-
{{ label$ }}
-
- {{ value$ || "---" }} -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.scss b/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.scss deleted file mode 100644 index 09137f33..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.scss +++ /dev/null @@ -1,18 +0,0 @@ -.psdk-container-labels-left{ - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; - } - .psdk-value { - margin: 8px 0px; - } - .psdk-value-hf { - margin: 8px 0px; - font-weight: 500; - font-size: 1.25rem; - } - .psdk-val-labels-left{ - margin: 8px 0px; - } \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.spec.ts deleted file mode 100644 index aa218a8a..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FieldValueListComponent } from './field-value-list.component'; - -describe('FieldValueListComponent', () => { - let component: FieldValueListComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ FieldValueListComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FieldValueListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.ts b/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.ts deleted file mode 100644 index 66101759..00000000 --- a/tests/assets/components/createAll/override-sdk/template/field-value-list/field-value-list.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { Component, OnInit, Input } from '@angular/core'; - -declare const window: any; - -@Component({ - selector: 'app-field-value-list', - templateUrl: './field-value-list.component.html', - styleUrls: ['./field-value-list.component.scss'], - standalone: true, - imports: [CommonModule] -}) -export class FieldValueListComponent implements OnInit{ - - @Input() label$: any; - @Input() value$: any; - @Input() displayMode$: any; - PCore$: any; - - angularPConnectData: any = {}; - configProps$: any; - pConn$: any; - - constructor() {} - - ngOnInit(): void {} - - ngOnChanges() {} - - updateSelf() {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/list-page/config.json b/tests/assets/components/createAll/override-sdk/template/list-page/config.json deleted file mode 100644 index 2f288fb7..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-page/config.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "name": "ListPage", - "type": "Template", - "subtype": "PAGE", - "label": "List page", - "icon": "Table.svg", - "hideTemplateEdit": true, - "hideFromTemplatePicker": true, - "viewNameLabel": "List page title", - "properties": [ - { - "name": "existingOrCustomListView", - "format": "LISTPAGE", - "properties": [ - { - "name": "listviewPicker", - "format": "LISTVIEWPICKER", - "visibleFor": ["Existing"] - }, - { - "name": "customListPage", - "format": "CUSTOMLISTPAGE", - "visibleFor": ["Custom"], - "properties": [ - { - "name": "referenceList", - "label": "Data page", - "format": "CONTENTPICKERSOURCE" - }, - { - "name": "parameters", - "label": "", - "format": "PARAMETERS", - "context": "global" - }, - { - "name": "presets", - "label": "Presets", - "format": "PRESETPICKER", - "addTypeList": ["Presets"], - "properties": [ - { - "name": "label", - "label": "Display name", - "format": "DISPLAYNAME" - }, - { - "format": "COMPONENTPICKER", - "componentsList": [ - { "name": "Table", "description": "Table" }, - { "name": "Gallery", "description": "Gallery" } - ] - }, - { - "format": "CARDDETAILS", - "visibleFor": ["Gallery"] - }, - { - "name": "Columns", - "label": "Columns", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Associations"], - "modifyPanelOverride": "ListField" - }, - { - "name": "fillAvailableSpace", - "label": "Column to take up remaining width", - "format": "FILLCOLUMNWIDTH" - }, - { - "name": "columnFilter", - "label": "Column filter", - "format": "COLUMNFILTER" - }, - { - "name": "columnSort", - "label": "Column sort", - "format": "COLUMNSORT" - }, - { - "name": "groupBy", - "label": "Group By", - "format": "GROUPBY", - "visibleFor": ["Table"] - } - ] - }, - { - "name": "editing", - "label": "Editing", - "format": "EDITING" - }, - { - "label": "User personalization", - "format": "GROUP", - "properties": [ - { - "name": "personalization", - "label": "Allow saving custom views", - "format": "BOOLEAN" - }, - { - "name": "grouping", - "label": "Allow grouping", - "format": "BOOLEAN" - }, - { - "name": "reorderFields", - "label": "Allow column reordering", - "format": "BOOLEAN" - }, - { - "name": "globalSearch", - "label": "Allow global search", - "format": "BOOLEAN" - }, - { - "name": "toggleFieldVisibility", - "label": "Allow user edit column visibility", - "format": "BOOLEAN" - }, - { - "name": "showHeaderIcons", - "label": "Show column header icons", - "format": "BOOLEAN" - } - ] - } - ] - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.html b/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.html deleted file mode 100644 index 2d5b85e5..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.scss b/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.spec.ts deleted file mode 100644 index b5f33a0f..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ListPageComponent } from './list-page.component'; - -describe('ListPageComponent', () => { - let component: ListPageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ListPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.ts b/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.ts deleted file mode 100644 index add5a125..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-page/list-page.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-list-page', - templateUrl: './list-page.component.html', - styleUrls: ['./list-page.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class ListPageComponent implements OnInit { - @Input() pConn$: any; - - constructor() {} - - ngOnInit(): void {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/list-view/config.json b/tests/assets/components/createAll/override-sdk/template/list-view/config.json deleted file mode 100644 index 0ad63890..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-view/config.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "name": "ListView", - "label": "Table", - "description": "Table Template", - "type": "Template", - "subtype": "LIST", - "icon": "Table.svg", - "hideTemplatePicker": true, - "hideFromTemplatePicker": true, - "viewNameLabel": "View name", - "properties": [ - { - "name": "referenceList", - "label": "Data page", - "format": "CONTENTPICKERSOURCE" - }, - { - "name": "parameters", - "label": "", - "format": "PARAMETERS" - }, - { - "name": "presets", - "label": "Presets", - "format": "PRESETPICKER", - "addTypeList": ["Presets"], - "properties": [ - { - "name": "label", - "label": "Display name", - "format": "DISPLAYNAME" - }, - { - "format": "COMPONENTPICKER", - "componentsList": [ - { "name": "Table", "description": "Table" }, - { "name": "Gallery", "description": "Gallery" } - ] - }, - { - "format": "CARDDETAILS", - "visibleFor": ["Gallery"] - }, - { - "name": "Columns", - "label": "Columns", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Associations"], - "hideModifyIcons": false, - "modifyPanelOverride": "ListField" - }, - { - "name": "fillAvailableSpace", - "label": "Column to take up remaining width", - "format": "FILLCOLUMNWIDTH" - }, - { - "name": "columnFilter", - "label": "Column filter", - "format": "COLUMNFILTER" - }, - { - "name": "columnSort", - "label": "Column sort", - "format": "COLUMNSORT" - }, - { - "name": "groupBy", - "label": "Group By", - "format": "GROUPBY", - "visibleFor": ["Table"] - } - ] - }, - { - "name": "editing", - "label": "Editing", - "format": "EDITING" - }, - { - "label": "User personalization", - "format": "GROUP", - "properties": [ - { - "name": "personalization", - "label": "Allow saving custom views", - "format": "BOOLEAN" - }, - { - "name": "grouping", - "label": "Allow grouping", - "format": "BOOLEAN" - }, - { - "name": "reorderFields", - "label": "Allow column reordering", - "format": "BOOLEAN" - }, - { - "name": "globalSearch", - "label": "Allow global search", - "format": "BOOLEAN" - }, - { - "name": "toggleFieldVisibility", - "label": "Allow user edit column visibility", - "format": "BOOLEAN" - }, - { - "name": "showHeaderIcons", - "label": "Show column header icons", - "format": "BOOLEAN" - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.html b/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.html deleted file mode 100644 index e31aa6d3..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.html +++ /dev/null @@ -1,244 +0,0 @@ -
- - Search - - - -
-
-
- - - - - - - - - - - - - - - -
- {{ dCol.config.label }} -
- -
-
- -
-
- - - - - - -
-
- - - {{ element[dCol.config.name] }} - -
- expand_less - expand_more - {{ _getGroupName(groupByColumns$[group.level - 1]) }}: {{ group[groupByColumns$[group.level - 1]] }} ({{ - group.totalCounts - }}) -
-
-
-
-
- - - - - - - - - - - - - - - -
- {{ dCol.config.label }} -
- -
-
- -
-
- - - - - - -
-
- - - {{ element[dCol.config.name] }} - -
- expand_less - expand_more - {{ _getGroupName(groupByColumns$[group.level - 1]) }}: {{ group[groupByColumns$[group.level - 1]] }} ({{ - group.totalCounts - }}) -
-
-
-
-
-
-
- - - - - - - - - - - - - - - - -
- - - - - {{ dCol.config.label }} - {{ element[dCol.config.name] }}
-
- - - - - -
{{ dCol.config.label }}
-
-
No Records Found.
-
-
-
- - - -
- - -
-
-

- Filter: {{ filterContainsLabel$ }} -

-
- - - Contains - Equals - Starts with - - - - - - -
- -
- - - is not equal to - after - before - is null - is not null - - - - - Date - - - - - - - Date time - - - - - Time - - -
- - -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.scss b/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.scss deleted file mode 100644 index b4533dee..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.scss +++ /dev/null @@ -1,151 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -table { - width: 100%; -} - -::ng-deep .mat-sort-header-content { - white-space: nowrap; -} - -::ng-deep td.mat-mdc-cell { - white-space: nowrap; -} - -::ng-deep th.mat-mdc-header-cell, -td.mat-mdc-cell, -td.mat-mdc-footer-cell { - padding: 0rem 0.188rem; -} - -::ng-deep .mat-mdc-button { - padding: 0px; - text-align: left; -} - -.mat-mdc-icon-button { - width: fit-content; -} - -.mat-mdc-row .mat-mdc-cell { - text-align: left; -} - -.psdk-mat-header { - white-space: nowrap; - padding-right: 5px; -} - -.psdk-mat-header-button { - display: inline-grid; -} - -.psdk-mat-header-arrow { - display: inline-grid; - vertical-align: middle; -} - -.psdk-mat-header-filter { - display: inline-grid; - vertical-align: middle; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-search { - padding-left: 0.625rem; -} - -.psdk-icon-search { - vertical-align: sub; - padding: 0rem 0.125rem; - min-width: unset; - width: 1.1rem; -} - -.psdk-outer-div-in-form { - display: inline-grid; -} - -.psdk-inner-div-in-form { - height: auto; - position: relative; - width: 100%; - overflow: auto; - max-height: 550px; - min-height: auto; -} - -.psdk-list-view-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: middle; - filter: $app-primary-color-filter; -} - -.psdk-filter-svg-icon { - width: 1rem; - display: inline-block; - vertical-align: middle; - filter: $app-neutral-color-filter; -} - -.psdk-arrow-svg-icon { - width: 1rem; - display: inline-block; - vertical-align: middle; - filter: $app-neutral-color-filter; -} - -.psdk-filter-popover { - display: table; - margin: auto; - min-width: 100px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; - position: absolute; - z-index: 99; -} - -.psdk-dialog-background { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - height: 100%; - width: 100%; - background-color: rgba(100, 100, 100, 0.4); - position: fixed; - z-index: 999; - top: 0px; - left: 0px; -} - -.psdk-modal-file-top { - display: table; - margin: auto; - min-width: 150px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; -} - -tr.mat-mdc-row { - cursor: pointer; -} - -.psdk-no-records { - height: 56px; - justify-content: center; - display: flex; - align-items: center; - border: 1px solid lightgray; - border-top: none; -} diff --git a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.spec.ts deleted file mode 100644 index b45338f0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ListViewComponent } from './list-view.component'; - -describe('ListViewComponent', () => { - let component: ListViewComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ListViewComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListViewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.ts b/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.ts deleted file mode 100644 index f95d02b7..00000000 --- a/tests/assets/components/createAll/override-sdk/template/list-view/list-view.component.ts +++ /dev/null @@ -1,1013 +0,0 @@ -/* eslint-disable max-classes-per-file */ -import { Component, OnInit, Input, ViewChild, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatOptionModule } from '@angular/material/core'; -import { MatSelectModule } from '@angular/material/select'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatRadioModule } from '@angular/material/radio'; -import { MatIconModule } from '@angular/material/icon'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatButtonModule } from '@angular/material/button'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator'; -import { MatSort, MatSortModule } from '@angular/material/sort'; -import { MatTableDataSource, MatTableModule } from '@angular/material/table'; -import { DragDropModule, CdkDragDrop, moveItemInArray, CdkDropList, CdkDrag } from '@angular/cdk/drag-drop'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' }; - -export class Group { - level = 0; - parent: Group; - expanded = true; - totalCounts = 0; - get visible(): boolean { - return !this.parent || (this.parent.visible && this.parent.expanded); - } -} - -@Component({ - selector: 'app-list-view', - templateUrl: './list-view.component.html', - styleUrls: ['./list-view.component.scss'], - standalone: true, - imports: [ - CommonModule, - MatFormFieldModule, - MatInputModule, - MatTableModule, - MatSortModule, - DragDropModule, - CdkDropList, - CdkDrag, - MatButtonModule, - MatMenuModule, - MatIconModule, - MatRadioModule, - MatCheckboxModule, - MatPaginatorModule, - MatSelectModule, - MatOptionModule, - MatDatepickerModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class ListViewComponent implements OnInit { - @ViewChild(MatPaginator) paginator: MatPaginator; - @ViewChild(MatSort) sort: MatSort; - - @Input() pConn$: any; - @Input() bInForm$: boolean = false; - @Input() payload; - - PCore$: any; - - repeatList$: MatTableDataSource; - fields$: Array; - - displayedColumns$ = Array(); - groupByColumns$: Array = []; - - configProps: any; - - updatedRefList: any; - - repeatListData: Array; - - searchIcon$: string; - - bShowSearch$: boolean = false; - bColumnReorder$: boolean = false; - bGrouping$: boolean = false; - - perfFilter: string; - searchFilter: string; - - menuSvgIcon$: string; - arrowSvgIcon$: string = ''; - arrowDownSvgIcon$: string; - arrowUpSvgIcon$: string; - - filterSvgIcon$: string; - filterOnSvgIcon$: string; - groupBySvgIcon$: string; - - compareType: string; - compareRef: string; - arrowDirection: string = 'down'; - - filterByColumns: Array = []; - bShowFilterPopover$: boolean = false; - bContains$: boolean = true; - bDateTime$: boolean = false; - - filterContainsLabel$: string = ''; - filterContainsType$: string = 'contains'; - filterContainsValue$: any; - - bIsDate$: boolean = false; - bIsDateTime$: boolean = false; - bIsTime$: boolean = false; - - currentFilterRefData: any; - currentFilterImageEl: any; - - arFilterMainButtons$: Array = []; - arFilterSecondaryButtons$: Array = []; - selectionMode: string; - singleSelectionMode: boolean; - multiSelectionMode: boolean; - rowID: any; - response: any; - compositeKeys: any; - - constructor(private psService: ProgressSpinnerService, private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.configProps = this.pConn$.getConfigProps(); - /** By default, pyGUID is used for Data classes and pyID is for Work classes as row-id/key */ - const defRowID = this.configProps?.referenceType === 'Case' ? 'pyID' : 'pyGUID'; - /** If compositeKeys is defined, use dynamic value, else fallback to pyID or pyGUID. */ - this.compositeKeys = this.configProps?.compositeKeys; - this.rowID = this.compositeKeys && this.compositeKeys?.length === 1 ? this.compositeKeys[0] : defRowID; - this.bShowSearch$ = this.utils.getBooleanValue(this.configProps.globalSearch); - this.bColumnReorder$ = this.utils.getBooleanValue(this.configProps.reorderFields); - this.bGrouping$ = this.utils.getBooleanValue(this.configProps.grouping); - - this.menuSvgIcon$ = this.utils.getImageSrc('more', this.utils.getSDKStaticContentUrl()); - this.arrowDownSvgIcon$ = this.utils.getImageSrc('arrow-down', this.utils.getSDKStaticContentUrl()); - this.arrowUpSvgIcon$ = this.utils.getImageSrc('arrow-up', this.utils.getSDKStaticContentUrl()); - - this.filterSvgIcon$ = this.utils.getImageSrc('filter', this.utils.getSDKStaticContentUrl()); - this.filterOnSvgIcon$ = this.utils.getImageSrc('filter-on', this.utils.getSDKStaticContentUrl()); - this.groupBySvgIcon$ = this.utils.getImageSrc('row', this.utils.getSDKStaticContentUrl()); - - this.selectionMode = this.configProps.selectionMode; - - this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' }); - this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' }); - - this.searchIcon$ = this.utils.getImageSrc('search', this.utils.getSDKStaticContentUrl()); - this.getListData(); - } - - getListData() { - const componentConfig = this.pConn$.getComponentConfig(); - if (this.configProps) { - const refList = this.configProps?.referenceList; - - // returns a promise - const workListData = this.PCore$.getDataApiUtils().getData(refList, this.payload); - - this.bShowFilterPopover$ = false; - - workListData.then((workListJSON: Object) => { - // don't update these fields until we return from promise - this.fields$ = this.configProps.presets[0].children[0].children; - // this is an unresovled version of this.fields$, need unresolved, so can get the property reference - let columnFields = componentConfig.presets[0].children[0].children; - - const tableDataResults = workListJSON['data'].data; - - this.displayedColumns$ = this.getDisplayColums(columnFields); - this.fields$ = this.updateFields(this.fields$, this.displayedColumns$); - this.response = tableDataResults; - this.updatedRefList = this.updateData(tableDataResults, this.fields$); - if (this.selectionMode === SELECTION_MODE.SINGLE && this.updatedRefList?.length > 0) { - this.displayedColumns$?.unshift('select'); - this.singleSelectionMode = true; - } else if (this.selectionMode === SELECTION_MODE.MULTI && this.updatedRefList?.length > 0) { - this.displayedColumns$?.unshift('select'); - this.multiSelectionMode = true; - } - - this.repeatList$ = new MatTableDataSource(this.updatedRefList); - this.repeatList$.filterPredicate = this.customFilterPredicate.bind(this); - - // keeping an original copy to get back after possible sorts, filters and groupBy - this.repeatListData = this.repeatList$.data.slice(); - - this.repeatList$.paginator = this.paginator; - this.repeatList$.sort = this.sort; - }); - } - } - - ngOnChanges(changes) { - if (changes && changes.payload) { - const currentPayloadVal = changes.payload?.currentValue; - const previousPayloadVal = changes.payload?.previousValue; - if (currentPayloadVal !== previousPayloadVal) { - this.getListData(); - } - } - } - - ngOnDestroy() {} - - ngAfterViewInit() { - // paginator has to exist for this to work, - // so called after init (paginator drawn) - // Calls are now in workListData promise - // this.repeatList$.paginator = this.paginator; - // this.repeatList$.sort = this.sort; - } - - drop(event: CdkDragDrop>) { - moveItemInArray(this.displayedColumns$, event.previousIndex, event.currentIndex); - } - - updateFields(arFields, arColumns): Array { - let arReturn = arFields; - for (let i in arReturn) { - arReturn[i].config.name = arColumns[i]; - } - - return arReturn; - } - - applySearch(event: Event) { - const filterValue = (event.target as HTMLInputElement).value; - this.searchFilter = filterValue.trim().toLowerCase(); - - if (this.groupByColumns$.length > 0) { - this.repeatList$.data = this.repeatListData.slice(); - this.repeatList$.filter = this.searchFilter; - let repeatData = this.repeatList$.sortData(this.repeatList$.filteredData, this.repeatList$.sort); - this.repeatList$.data = this.addGroups(repeatData, this.groupByColumns$); - - this.perfFilter = performance.now().toString(); - this.repeatList$.filter = this.perfFilter; - } else { - this.repeatList$.filter = this.searchFilter; - } - - if (this.repeatList$.paginator) { - this.repeatList$.paginator.firstPage(); - } - } - - fieldOnChange(row) { - const value = row[this.rowID]; - const reqObj = {}; - if (this.compositeKeys?.length > 1) { - const index = this.response.findIndex((element) => element[this.rowID] === value); - const selectedRow = this.response[index]; - this.compositeKeys.forEach((element) => { - reqObj[element] = selectedRow[element]; - }); - } else { - reqObj[this.rowID] = value; - } - this.pConn$?.getListActions?.()?.setSelectedRows([reqObj]); - } - - onCheckboxClick(row, event) { - const value = row[this.rowID]; - const checked = event?.checked; - const reqObj = {}; - if (this.compositeKeys?.length > 1) { - const index = this.response.findIndex((element) => element[this.rowID] === value); - const selectedRow = this.response[index]; - this.compositeKeys.forEach((element) => { - reqObj[element] = selectedRow[element]; - }); - reqObj['$selected'] = checked; - } else { - reqObj[this.rowID] = value; - reqObj['$selected'] = checked; - } - this.pConn$?.getListActions()?.setSelectedRows([reqObj]); - } - - rowClick(row) { - switch (this.configProps.rowClickAction) { - case 'openAssignment': - this.psService.sendMessage(true); - this.openAssignment(row); - break; - } - } - - _getIconStyle(level): string { - let sReturn = ''; - let nLevel = parseInt(level); - nLevel--; - nLevel = nLevel * 15; - sReturn = 'padding-left: ' + nLevel + 'px; vertical-align: middle'; - - return sReturn; - } - - _getGroupName(fieldName) { - for (let i in this.fields$) { - let field = this.fields$[i]; - if (field.config.name == fieldName) { - return field.config.label; - } - } - - return ''; - } - - _showButton(name, row) { - let bReturn = false; - const { pxRefObjectClass, pzInsKey, pxRefObjectKey } = row; - switch (name) { - case 'pxTaskLabel': - if (pxRefObjectClass != '' && pzInsKey != '') { - bReturn = true; - } - break; - case 'pxRefObjectInsName': - if (pxRefObjectClass != '' && pxRefObjectKey != '') { - bReturn = true; - } - break; - } - - return bReturn; - } - - _listViewClick(name, value, index) { - switch (name) { - case 'pxTaskLabel': - this.openAssignment(this.repeatList$.data[index]); - break; - case 'pxRefObjectInsName': - this.openWork(this.repeatList$.data[index]); - break; - } - } - - compare(a: number | string, b: number | string, isAsc: boolean) { - return (a < b ? -1 : 1) * (isAsc ? 1 : -1); - } - - _headerSortClick(event, columnData) { - // images 0 - filter, 1 - arrow, 2 - more - - /** Commenting this code for now as it is giving errors not sure if it ever worked */ - // let arrowImage = event.srcElement.getElementsByTagName('img')[1]; - // let arrowAttr = arrowImage.getAttribute('arrow'); - - // this.clearOutArrows(event, columnData); - - // switch (arrowAttr) { - // case 'up': - // arrowImage.src = this.arrowDownSvgIcon$; - // arrowImage.setAttribute('arrow', 'down'); - // break; - // case 'down': - // arrowImage.src = ''; - // arrowImage.setAttribute('arrow', 'none'); - // break; - // default: - // arrowImage.src = this.arrowUpSvgIcon$; - // arrowImage.setAttribute('arrow', 'up'); - // break; - // } - - this.compareType = columnData.type; - this.compareRef = columnData.config.name; - // this.arrowDirection = arrowImage.getAttribute('arrow'); - this.arrowDirection = this.arrowDirection === 'up' ? 'down' : 'up'; - - this.filterSortGroupBy(); - } - - clearOutArrows(event, columnData) { - let arImages = event.srcElement.parentElement.getElementsByTagName('img'); - - for (let theImage of arImages) { - //let theImage = arImages[i] - let arrow = theImage.getAttribute('arrow'); - if (arrow) { - let arrowId = theImage.getAttribute('arrowid'); - if (arrow != 'none' && arrowId != columnData.config.name) { - theImage.setAttribute('arrow', 'none'); - theImage.src = ''; - } - } - } - } - - sortCompare(a, b): number { - let aValue = a[this.compareRef]; - let bValue = b[this.compareRef]; - - if (this.compareType == 'Date' || this.compareType == 'DateTime') { - aValue = this.utils.getSeconds(aValue); - bValue = this.utils.getSeconds(bValue); - } - - if (this.compareRef == 'pxRefObjectInsName') { - const prefixX = aValue.split('-'); - const prefixY = bValue.split('-'); - switch (this.arrowDirection) { - case 'up': - if (prefixX[0] !== prefixY[0]) { - if (prefixX[0] < prefixY[0]) return -1; - if (prefixX[0] > prefixY[0]) return 1; - return 0; - } - return prefixX[1] - prefixY[1]; - break; - case 'down': - if (prefixX[0] !== prefixY[0]) { - if (prefixX[0] > prefixY[0]) return -1; - if (prefixX[0] < prefixY[0]) return 1; - return 0; - } - return prefixY[1] - prefixX[1]; - break; - } - } - - switch (this.arrowDirection) { - case 'up': - if (aValue < bValue) { - return -1; - } else if (aValue > bValue) { - return 1; - } - break; - case 'down': - if (aValue > bValue) { - return -1; - } else if (aValue < bValue) { - return 1; - } - break; - } - - return 0; - } - - updateFilterDisplay(type) { - switch (type) { - case 'Date': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = true; - this.bIsDateTime$ = false; - this.bIsTime$ = false; - break; - case 'DateTime': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = false; - this.bIsDateTime$ = true; - this.bIsTime$ = false; - break; - case 'Time': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = false; - this.bIsDateTime$ = false; - this.bIsTime$ = true; - break; - default: - this.filterContainsType$ = 'contains'; - this.bContains$ = true; - this.bDateTime$ = false; - this.bIsDate$ = false; - this.bIsDateTime$ = false; - this.bIsTime$ = false; - break; - } - } - - _filter(event, columnData) { - // add clickAway listener - window.addEventListener('mouseup', this._clickAway.bind(this)); - - this.currentFilterRefData = columnData; - this.filterContainsLabel$ = columnData.config.label; - - setTimeout(() => { - this.updateFilterDisplay(columnData.type); - - this.updateFilterVarsWithCurrent(columnData); - - this.bShowFilterPopover$ = true; - }); - } - - _clickAway(event: any) { - var bInPopUp = false; - - //run through list of elements in path, if menu not in th path, then want to - // hide (toggle) the menu - for (let i in event.path) { - if ( - event.path[i].className == 'psdk-modal-file-top' || - event.path[i].tagName == 'BUTTON' || - event.path[i].tagName == 'MAT-OPTION' || - event.path[i].tagName == 'MAT-INPUT' - ) { - bInPopUp = true; - break; - } - } - if (!bInPopUp) { - // this.bShowFilterPopover$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - } - - _filterContainsType(event) { - this.filterContainsType$ = event.value; - } - - _filterContainsValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _filterContainsDateValue(event, value) { - this.filterContainsValue$ = value; - } - - _filterContainsDateTimeValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _filterContainsTimeValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _onFilterActionButtonClick(event: any) { - // modal buttons - switch (event.action) { - case 'cancel': - this.currentFilterRefData = []; - break; - case 'submit': - this.updateFilterWithInfo(); - this.filterSortGroupBy(); - - break; - } - - this.bShowFilterPopover$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - - updateFilterWithInfo() { - let bFound = false; - for (let filterObj of this.filterByColumns) { - if (filterObj['ref'] === this.currentFilterRefData.config.name) { - filterObj['type'] = this.currentFilterRefData.type; - filterObj['containsFilter'] = this.filterContainsType$; - filterObj['containsFilterValue'] = this.filterContainsValue$; - - bFound = true; - break; - } - } - - if (!bFound) { - // add in - let filterObj: any = {}; - filterObj.ref = this.currentFilterRefData.config.name; - filterObj.type = this.currentFilterRefData.type; - filterObj.containsFilter = this.filterContainsType$; - filterObj.containsFilterValue = this.filterContainsValue$; - - this.filterByColumns.push(filterObj); - } - - // iterate through filters and update filterOn icon - for (let filterObj of this.filterByColumns) { - let containsFilterValue = filterObj['containsFilterValue']; - let containsFilter = filterObj['containsFilter']; - let filterRef = filterObj['ref']; - let filterIndex = this.displayedColumns$.indexOf(filterRef); - let arFilterImg = document.getElementsByName('filterOnIcon'); - let filterImg: any = arFilterImg[filterIndex]; - if (containsFilterValue == '' && containsFilter != 'null' && containsFilter != 'notnull') { - // clear icon - filterImg.src = ''; - } else { - // show icon - filterImg.src = this.filterOnSvgIcon$; - } - } - } - - updateFilterVarsWithCurrent(columnData) { - // find current ref, if exists, move data to variable to display - - let bFound = false; - for (let filterObj of this.filterByColumns) { - if (filterObj['ref'] === this.currentFilterRefData.config.name) { - this.filterContainsType$ = filterObj['containsFilter']; - this.filterContainsValue$ = filterObj['containsFilterValue']; - - bFound = true; - break; - } - } - - if (!bFound) { - switch (columnData.type) { - case 'Date': - case 'DateTime': - case 'Time': - this.filterContainsType$ = 'notequal'; - break; - default: - this.filterContainsType$ = 'contains'; - break; - } - - this.filterContainsValue$ = ''; - } - } - - filterData(item: any) { - let bKeep = true; - for (let filterObj of this.filterByColumns) { - if (filterObj.containsFilterValue != '' || filterObj.containsFilter == 'null' || filterObj.containsFilter == 'notnull') { - let value: any; - let filterValue: any; - - switch (filterObj.type) { - case 'Date': - case 'DateTime': - case 'Time': - value = item[filterObj.ref] != null ?? item[filterObj.ref] != '' ? this.utils.getSeconds(item[filterObj.ref]) : null; - filterValue = - filterObj.containsFilterValue != null && filterObj.containsFilterValue != '' - ? this.utils.getSeconds(filterObj.containsFilterValue) - : null; - - switch (filterObj.containsFilter) { - case 'notequal': - // becasue filterValue is in minutes, need to have a range of less than 60 secons - - if (value != null && filterValue != null) { - // get rid of millisecons - value = value / 1000; - filterValue = filterValue / 1000; - - let diff = value - filterValue; - if (diff >= 0 && diff < 60) { - bKeep = false; - } - } - - break; - case 'after': - if (value < filterValue) { - bKeep = false; - } - break; - case 'before': - if (value > filterValue) { - bKeep = false; - } - break; - case 'null': - if (value != null) { - bKeep = false; - } - break; - case 'notnull': - if (value == null) { - bKeep = false; - } - break; - } - break; - default: - value = item[filterObj.ref].toLowerCase(); - filterValue = filterObj.containsFilterValue.toLowerCase(); - - switch (filterObj.containsFilter) { - case 'contains': - if (value.indexOf(filterValue) < 0) { - bKeep = false; - } - break; - case 'equals': - if (value != filterValue) { - bKeep = false; - } - break; - case 'startswith': - if (value.indexOf(filterValue) != 0) { - bKeep = false; - } - break; - } - - break; - } - } - - // if don't keep stop filtering - if (!bKeep) { - break; - } - } - - return bKeep; - } - - filterSortGroupBy() { - // get original data set - let theData = this.repeatListData.slice(); - - // last filter config data is global - theData = theData.filter(this.filterData.bind(this)); - - // last sort config data is global - theData.sort(this.sortCompare.bind(this)); - - let reGroupData = this.addGroups(theData, this.groupByColumns$); - - this.repeatList$.data = []; - this.repeatList$.data.push(...reGroupData); - - if (this.searchFilter && this.searchFilter != '') { - this.repeatList$.filter = this.searchFilter; - } else { - this.perfFilter = performance.now().toString(); - this.repeatList$.filter = this.perfFilter; - } - this.repeatList$.filter = ''; - - if (this.repeatList$.paginator) { - this.repeatList$.paginator.firstPage(); - } - } - - // - // Grouping code inspired by this example - // https://stackblitz.com/edit/angular-material-table-row-grouping - // - - _showUnGroupBy(columnData): boolean { - for (let val of this.groupByColumns$) { - if (val == columnData.config.name) { - return true; - } - } - - return false; - } - - _groupBy(event, columnData) { - this.checkGroupByColumn(columnData.config.name, true); - - this.filterSortGroupBy(); - } - - _unGroupBy(event, columnData) { - //event.stopPropagation(); - this.checkGroupByColumn(columnData.config.name, false); - - this.filterSortGroupBy(); - } - - checkGroupByColumn(field, add) { - let found = null; - for (const column of this.groupByColumns$) { - if (column === field) { - found = this.groupByColumns$.indexOf(column, 0); - } - } - if (found != null && found >= 0) { - if (!add) { - this.groupByColumns$.splice(found, 1); - } - } else { - if (add) { - this.groupByColumns$.push(field); - } - } - } - - addGroups(data: Array, groupByColumns: Array): Array { - const rootGroup = new Group(); - rootGroup.expanded = true; - return this.getSublevel(data, 0, groupByColumns, rootGroup); - } - - getSublevel(data: Array, level: number, groupByColumns: Array, parent: Group): Array { - if (level >= groupByColumns.length) { - return data; - } - const groups = this.uniqueBy( - data.map((row) => { - const result = new Group(); - result.level = level + 1; - result.parent = parent; - for (let i = 0; i <= level; i++) { - result[groupByColumns[i]] = row[groupByColumns[i]]; - } - return result; - }), - JSON.stringify - ); - - const currentColumn = groupByColumns[level]; - let subGroups = []; - groups.forEach((group) => { - const rowsInGroup = data.filter((row) => group[currentColumn] === row[currentColumn]); - group.totalCounts = rowsInGroup.length; - const subGroup = this.getSublevel(rowsInGroup, level + 1, groupByColumns, group); - subGroup.unshift(group); - subGroups = subGroups.concat(subGroup); - }); - return subGroups; - } - - uniqueBy(a, key) { - const seen = {}; - return a.filter((item) => { - const k = key(item); - // eslint-disable-next-line no-return-assign, no-prototype-builtins - return seen.hasOwnProperty(k) ? false : (seen[k] = true); - }); - } - - isGroup(index, item): boolean { - return item.level; - } - - _groupHeaderClick(row) { - row.expanded = !row.expanded; - //this.repeatList$.filter = ""; - this.perfFilter = performance.now().toString(); - this.repeatList$.filter = this.perfFilter; - } - - // below is for grid row grouping - customFilterPredicate(data: any | Group, filter: string): boolean { - return data instanceof Group ? data.visible : this.getDataRowVisibleWithFilter(data, filter); - } - - getDataRowVisible(data: any): boolean { - const groupRows = this.repeatList$.data.filter((row) => { - if (!(row instanceof Group)) { - return false; - } - let match = true; - this.groupByColumns$.forEach((column) => { - if (!row[column] || !data[column] || row[column] !== data[column]) { - match = false; - } - }); - return match; - }); - - if (groupRows.length === 0) { - return true; - } - const parent = groupRows[0] as Group; - return parent.visible && parent.expanded; - } - - getDataRowVisibleWithFilter(data, filter) { - // fist check if row is visible with grouping - let bVisible = this.getDataRowVisible(data); - - if (bVisible && filter && filter != '' && filter != this.perfFilter) { - // now check if row is filtered. - - // assume not there unless we find it - bVisible = false; - for (let col of this.displayedColumns$) { - // filter is lower case - if (data[col] && data[col].toString().toLowerCase().indexOf(filter) >= 0) { - bVisible = true; - break; - } - } - } - - return bVisible; - } - - updateData(listData: Array, fieldData: Array): Array { - let returnList: Array = new Array(); - for (let row in listData) { - // copy - let rowData = JSON.parse(JSON.stringify(listData[row])); - - for (let field in fieldData) { - let config = fieldData[field].config; - let fieldName; - let formattedDate; - let myFormat; - - switch (fieldData[field].type) { - case 'Date': - fieldName = config.name; - myFormat = config.formatter; - if (!myFormat) { - myFormat = 'Date'; - } - formattedDate = this.utils.generateDate(rowData[fieldName], myFormat); - - rowData[fieldName] = formattedDate; - break; - case 'DateTime': - fieldName = config.name; - myFormat = config.formatter; - if (!myFormat) { - myFormat = 'DateTime-Long'; - } - formattedDate = this.utils.generateDateTime(rowData[fieldName], myFormat); - - rowData[fieldName] = formattedDate; - break; - } - } - - returnList.push(rowData); - } - - return returnList; - } - - openAssignment(row) { - const { pxRefObjectClass, pzInsKey } = row; - let sTarget = this.pConn$.getContainerName(); - let options = { containerName: sTarget }; - this.pConn$.getActionsApi().openAssignment(pzInsKey, pxRefObjectClass, options); - } - - openWork(row) { - const { pxRefObjectClass, pxRefObjectKey } = row; - - if (pxRefObjectClass != '' && pxRefObjectKey != '') { - this.pConn$.getActionsApi().openWorkByHandle(pxRefObjectKey, pxRefObjectClass); - } - } - - initializeData(data) { - data.forEach((item, idx) => { - item.__original_index = idx; - item.__level = 1; - }); - - return data; - } - - getType(field) { - const { config = {}, type } = field; - const { formatType } = config; - if (formatType === 'datetime' || formatType === 'date') { - // currently cosmos has only support for date ... it also need to support dateTime - return 'date'; - } - - return type.toLowerCase(); - } - - initializeColumns(fields = []) { - return fields.map((field, originalColIndex) => ({ - ...field, - type: this.getType(field), - name: field.config.value.substring(4), - label: field.config.label.substring(3), - id: originalColIndex, - groupingEnabled: true, - grouped: false, - minWidth: 50, - cellRenderer: this.getType(field) === 'text' ? null : field.type, - filter: true - })); - } - - getDisplayColums(fields = []) { - let arReturn = fields.map((field, colIndex) => { - let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1); - if (theField.indexOf('.') == 0) { - theField = theField.substring(1); - } - - return theField; - }); - return arReturn; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.html b/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.html deleted file mode 100644 index 289ff244..00000000 --- a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
-

{{ label }}

- -
diff --git a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.scss b/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.ts b/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.ts deleted file mode 100644 index 771098f6..00000000 --- a/tests/assets/components/createAll/override-sdk/template/multi-reference-readonly/multi-reference-readonly.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-multi-reference-readonly', - templateUrl: './multi-reference-readonly.component.html', - styleUrls: ['./multi-reference-readonly.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class MultiReferenceReadonlyComponent implements OnInit { - constructor(private angularPConnect: AngularPConnectService) {} - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - angularPConnectData: any = {}; - configProps$: any; - label: string; - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.getConfigProps(); - this.label = this.configProps$['label']; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.html b/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.html deleted file mode 100644 index a13dbe92..00000000 --- a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.scss b/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.scss deleted file mode 100644 index 6e827e90..00000000 --- a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -* { - box-sizing: border-box; -} - - - -.psdk-narrow-wide-column { - display: flow-root; - height: 100%; -} - - - -.psdk-narrow-column { - float: left; - min-width: 30%; - padding: 0rem 0.3125rem; -} - -.psdk-wide-column { - float: left; - width: 70%; - padding: 0rem 0.3125rem; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.spec.ts deleted file mode 100644 index 3caeb91b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NarrowWideFormComponent } from './narrow-wide-form.component'; - -describe('NarrowWideFormComponent', () => { - let component: NarrowWideFormComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ NarrowWideFormComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(NarrowWideFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.ts b/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.ts deleted file mode 100644 index c615206e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/narrow-wide-form/narrow-wide-form.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component, OnInit, Input, forwardRef, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-narrow-wide-form', - templateUrl: './narrow-wide-form.component.html', - styleUrls: ['./narrow-wide-form.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class NarrowWideFormComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-page/config.json b/tests/assets/components/createAll/override-sdk/template/one-column-page/config.json deleted file mode 100644 index f6896a31..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-page/config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "OneColumnPage", - "label": "One column", - "description": "OneColumn Page Template", - "type": "Template", - "subtype": "PAGE", - "icon": "OneColumnPage.svg", - "viewNameLabel": "Page title", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.html b/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.html deleted file mode 100644 index 4c7eab4d..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.scss b/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.spec.ts deleted file mode 100644 index 57260d1b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { OneColumnPageComponent } from './one-column-page.component'; - -describe('OneColumnPageComponent', () => { - let component: OneColumnPageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ OneColumnPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(OneColumnPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.ts b/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.ts deleted file mode 100644 index 565790cc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-page/one-column-page.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-one-column-page', - templateUrl: './one-column-page.component.html', - styleUrls: ['./one-column-page.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class OneColumnPageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - constructor() {} - - ngOnInit(): void {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.html b/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.html deleted file mode 100644 index 93327d5d..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
- - -
Page Missing: {{ kid.getPConnect().getComponentName() }}
-
-
-
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.scss b/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.scss deleted file mode 100644 index 522d5ee0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-one-column-tab { - background-color: $app-form-color; - margin-top: 0.5rem; - margin-bottom: 0.5rem; - border-radius: 0.3125rem; - padding: 10px; -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.ts b/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.ts deleted file mode 100644 index def54121..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column-tab/one-column-tab.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { OneColumnComponent } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-one-column-tab', - templateUrl: './one-column-tab.component.html', - styleUrls: ['./one-column-tab.component.scss'], - standalone: true, - imports: [CommonModule, OneColumnComponent, RegionComponent, forwardRef(() => ComponentMapperComponent)] -}) -export class OneColumnTabComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit(): void { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column/config.json b/tests/assets/components/createAll/override-sdk/template/one-column/config.json deleted file mode 100644 index 9c53aa62..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column/config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "OneColumn", - "label": "One column", - "description": "OneColumn Template", - "type": "Template", - "subtype": "FORM", - "icon": "OneColumn.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER" - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "saveToReference": true - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "saveToReference": true - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY", - "saveToReference": true - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.html b/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.html deleted file mode 100644 index 0b955908..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
- -
-
- -
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.scss b/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.scss deleted file mode 100644 index 1236d8ed..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -* { - box-sizing: border-box; -} diff --git a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.spec.ts deleted file mode 100644 index 55bfa270..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { OneColumnComponent } from './one-column.component'; - -describe('OneColumnComponent', () => { - let component: OneColumnComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ OneColumnComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(OneColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.ts b/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.ts deleted file mode 100644 index a0aeab3d..00000000 --- a/tests/assets/components/createAll/override-sdk/template/one-column/one-column.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { CaseCreateStageComponent } from '@pega/angular-sdk-library'; -import { ViewComponent } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-one-column', - templateUrl: './one-column.component.html', - styleUrls: ['./one-column.component.scss'], - standalone: true, - imports: [CommonModule, ViewComponent, CaseCreateStageComponent, forwardRef(() => RegionComponent)] -}) -export class OneColumnComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit(): void { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/page/page.component.html b/tests/assets/components/createAll/override-sdk/template/page/page.component.html deleted file mode 100644 index c44437d8..00000000 --- a/tests/assets/components/createAll/override-sdk/template/page/page.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

{{ title$ }}

-
-
-
-
- - -
Page Missing: {{ kid.getPConnect().getComponentName() }}
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/page/page.component.scss b/tests/assets/components/createAll/override-sdk/template/page/page.component.scss deleted file mode 100644 index 541a2eb2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/page/page.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.psdk-page-title { - padding-left: 0.2rem; -} diff --git a/tests/assets/components/createAll/override-sdk/template/page/page.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/page/page.component.spec.ts deleted file mode 100644 index 07d5966a..00000000 --- a/tests/assets/components/createAll/override-sdk/template/page/page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PageComponent } from './page.component'; - -describe('PageComponent', () => { - let component: PageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/page/page.component.ts b/tests/assets/components/createAll/override-sdk/template/page/page.component.ts deleted file mode 100644 index d069f735..00000000 --- a/tests/assets/components/createAll/override-sdk/template/page/page.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-page', - templateUrl: './page.component.html', - styleUrls: ['./page.component.scss'], - standalone: true, - imports: [CommonModule, RegionComponent, forwardRef(() => ComponentMapperComponent)] -}) -export class PageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - configProps$: Object; - arChildren$: Array; - title$: string; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit() { - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - - this.title$ = this.configProps$['title']; - let operator = this.configProps$['operator']; - - if (operator && operator != '') { - this.title$ += ', ' + operator; - } - - // when showing a page, similar to updating root, need to cause viewContainer to call "initContainer" - sessionStorage.setItem('hasViewContainer', 'false'); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - // turn off spinner - //this.psService.sendMessage(false); - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.html b/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.html deleted file mode 100644 index 1d4b3143..00000000 --- a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.html +++ /dev/null @@ -1,35 +0,0 @@ -
-
{{ listViewProps.title }}
-
-
- -
-
- -
- - -
-
- -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.scss b/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.scss deleted file mode 100644 index be9bb2d2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.psdk-grid-filter { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - column-gap: calc(2 * 0.5rem); - row-gap: calc(2 * 0.5rem); - align-items: start; -} diff --git a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.spec.ts deleted file mode 100644 index dbe5ab8c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { PromotedFiltersComponent } from './promoted-filters.component'; - -describe('PromotedFiltersComponent', () => { - let component: PromotedFiltersComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ PromotedFiltersComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PromotedFiltersComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.ts b/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.ts deleted file mode 100644 index ce1444bd..00000000 --- a/tests/assets/components/createAll/override-sdk/template/promoted-filters/promoted-filters.component.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ListViewComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -const SUPPORTED_TYPES_IN_PROMOTED_FILTERS = [ - 'TextInput', - 'Percentage', - 'Email', - 'Integer', - 'Decimal', - 'Checkbox', - 'DateTime', - 'Date', - 'Time', - 'Text', - 'TextArea', - 'Currency', - 'URL', - 'RichText' -]; - -@Component({ - selector: 'app-promoted-filters', - templateUrl: './promoted-filters.component.html', - styleUrls: ['./promoted-filters.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule, ListViewComponent, forwardRef(() => ComponentMapperComponent)] -}) -export class PromotedFiltersComponent implements OnInit { - @Input() viewName; - @Input() filters; - @Input() listViewProps; - @Input() pageClass; - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() parameters = {}; - - angularPConnectData: any = {}; - PCore$: any; - - showFilters: boolean; - localeCategory = 'SimpleTable'; - localizedVal; - filtersProperties = {}; - showTable; - transientItemID; - processedFilters = []; - payload = {}; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - this.localizedVal = this.PCore$.getLocaleUtils().getLocaleValue; - this.filters.forEach((filter) => { - this.filtersProperties[this.PCore$.getAnnotationUtils().getPropertyName(filter.config.value)] = ''; - }); - - const filtersWithClassID = { ...this.filtersProperties, classID: this.pageClass }; - this.transientItemID = this.pConn$ - .getContainerManager() - .addTransientItem({ id: this.viewName, data: filtersWithClassID }); - this.processedFilters = []; - this.filters.map((filter) => { - const filterClone = { ...filter }; - // convert any field which is not supported to TextInput and delete the placeholder as it may contain placeholder specific to original type. - if (!SUPPORTED_TYPES_IN_PROMOTED_FILTERS.includes(filterClone.type)) { - filterClone.type = 'TextInput'; - delete filterClone.config.placeholder; - } - filterClone.config.contextName = this.transientItemID; - filterClone.config.readOnly = false; - filterClone.config.context = this.transientItemID; - filterClone.config.localeReference = this.listViewProps.localeReference; - const c11nEnv = this.PCore$.createPConnect({ - meta: filterClone, - options: { - hasForm: true, - contextName: this.transientItemID - } - }); - this.processedFilters.push(c11nEnv); - }); - this.showFilters = true; - } - - formatPromotedFilters(promotedFilters) { - return Object.entries(promotedFilters).reduce((acc, [field, value]) => { - if (value) { - acc[field] = { - lhs: { - field - }, - comparator: 'EQ', - rhs: { - value - } - }; - } - return acc; - }, {}); - } - - isValidInput(input) { - return Object.values(input).findIndex((v) => v) >= 0; - } - - getFilterData() { - const changes = this.PCore$.getFormUtils().getChanges(this.transientItemID); - const formValues = {}; - Object.keys(changes).forEach((key) => { - if (!['context_data', 'pageInstructions'].includes(key)) { - formValues[key] = changes[key]; - } - }); - const promotedFilters = this.formatPromotedFilters(formValues); - if (this.PCore$.getFormUtils().isFormValid(this.transientItemID) && this.isValidInput(formValues)) { - this.showTable = true; - const Query: any = { - dataViewParameters: this.parameters || {} - }; - - if (Object.keys(promotedFilters).length > 0) { - Query.query = { filter: { filterConditions: promotedFilters } }; - } - this.payload = Query; - } - } - - clearFilterData() { - this.PCore$.getContainerUtils().clearTransientData(this.transientItemID); - this.showTable = false; - this.pConn$?.getListActions?.()?.setSelectedRows([]); // Clear the selection (if any made by user) - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.html b/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.html deleted file mode 100644 index 208c5e0b..00000000 --- a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.html +++ /dev/null @@ -1,21 +0,0 @@ -
- - - Search - - - - - - - - - - - -
{{ dCol.label }}{{ element[dCol.name] }}
- - -
diff --git a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.scss b/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.scss deleted file mode 100644 index 6ce527d3..00000000 --- a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.scss +++ /dev/null @@ -1,17 +0,0 @@ -table { - width: 100%; -} - -.mat-mdc-row .mat-mdc-cell { - text-align: left; -} - -.psdk-search { - padding-left: 0.625rem; -} - -.psdk-icon-search { - vertical-align: sub; - padding: 0rem 0.125rem; - min-width: unset; -} diff --git a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.spec.ts deleted file mode 100644 index 342caa34..00000000 --- a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { RepeatingStructuresComponent } from './repeating-structures.component'; - -describe('RepeatingStructuresComponent', () => { - let component: RepeatingStructuresComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ RepeatingStructuresComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(RepeatingStructuresComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.ts b/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.ts deleted file mode 100644 index ee1530b1..00000000 --- a/tests/assets/components/createAll/override-sdk/template/repeating-structures/repeating-structures.component.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { Component, OnInit, Input, ViewChild } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatInputModule } from '@angular/material/input'; -import { MatIconModule } from '@angular/material/icon'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator'; -import { MatSort, MatSortModule } from '@angular/material/sort'; -import { MatTableDataSource, MatTableModule } from '@angular/material/table'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-repeating-structures', - templateUrl: './repeating-structures.component.html', - styleUrls: ['./repeating-structures.component.scss'], - standalone: true, - imports: [ - CommonModule, - MatFormFieldModule, - MatIconModule, - MatInputModule, - MatTableModule, - MatSortModule, - MatPaginatorModule - ] -}) -export class RepeatingStructuresComponent implements OnInit { - @ViewChild(MatPaginator) paginator: MatPaginator; - @ViewChild(MatSort) sort: MatSort; - @Input() pConn$: any; - - configProps: any; - repeatList$: MatTableDataSource; - fields$: Array; - displayedColumns$ = Array(); - - constructor(private psService: ProgressSpinnerService, private utils: Utils) {} - - ngOnInit(): void { - const componentConfig = this.pConn$.getRawMetadata().config || { fields: [] }; - this.configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.fields$ = this.initializeColumns(componentConfig.fields); - - const refList = this.configProps.referenceList; - const tableDataResults = JSON.parse(JSON.stringify(this.pConn$.getValue(refList))); - - // update elements like date format - let updatedRefList = this.updateData(tableDataResults, this.fields$); - - this.repeatList$ = new MatTableDataSource(updatedRefList); - this.displayedColumns$ = this.getDisplayColums(this.fields$); - this.repeatList$.paginator = this.paginator; - } - - ngOnDestroy() {} - - ngAfterViewInit() { - // paginator has to exist for this to work, - // so called after init (paginator drawn) - this.repeatList$.paginator = this.paginator; - this.repeatList$.sort = this.sort; - } - - applySearch(event: Event) { - const filterValue = (event.target as HTMLInputElement).value; - this.repeatList$.filter = filterValue.trim().toLowerCase(); - - if (this.repeatList$.paginator) { - this.repeatList$.paginator.firstPage(); - } - } - - rowClick(row) { - switch (this.configProps.rowClickAction) { - case 'openAssignment': - this.psService.sendMessage(true); - this.openAssignment(row); - break; - } - } - - updateData(listData: Array, fieldData: Array): Array { - let returnList: Array = new Array(); - for (let row in listData) { - // copy - let rowData = JSON.parse(JSON.stringify(listData[row])); - - for (let field in fieldData) { - if (fieldData[field].type == 'date') { - let fieldName = fieldData[field].name; - let formattedDate = rowData[fieldName]; - - // format date - // formattedDate = formattedDate.replace("GMT", "+0000"); - this.utils.generateDateTime(formattedDate, 'MMMM D, YYYY h:mm:ss A'); - - // update - rowData[fieldName] = formattedDate; - } - } - - returnList.push(rowData); - } - - return returnList; - } - - openAssignment(row) { - const { pxRefObjectClass, pzInsKey } = row; - let sTarget = this.pConn$.getContainerName(); - let options = { containerName: sTarget }; - this.pConn$ - .getActionsApi() - .openAssignment(pzInsKey, pxRefObjectClass, options) - .then(() => {}); - } - - initializeData(data) { - data.forEach((item, idx) => { - item.__original_index = idx; - item.__level = 1; - }); - - return data; - } - - getType(field) { - const { config = {}, type } = field; - const { formatType } = config; - if (formatType === 'datetime' || formatType === 'date') { - // currently cosmos has only support for date ... it also need to support dateTime - return 'date'; - } - return type.toLowerCase(); - } - - initializeColumns(fields = []) { - return fields.map((field, originalColIndex) => ({ - ...field, - type: this.getType(field), - name: field.config.value.substring(4), - label: field.config.label.substring(3), - id: originalColIndex, - groupingEnabled: true, - grouped: false, - minWidth: 50, - cellRenderer: this.getType(field) === 'text' ? null : field.type, - filter: true - })); - } - - getDisplayColums(fields = []) { - return fields.map((field, colIndex) => field.name); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/helpers.ts b/tests/assets/components/createAll/override-sdk/template/simple-table-manual/helpers.ts deleted file mode 100644 index adf4ceb9..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/helpers.ts +++ /dev/null @@ -1,234 +0,0 @@ -declare var PCore; - -export const TABLE_CELL = "SdkRenderer"; -export const DELETE_ICON = "DeleteIcon"; - -// BUG-615253: Workaround for autosize in table with lazy loading components -/* istanbul ignore next */ -function getFiledWidth(field, label) { - let width; - switch (field.type) { - case "Time": - width = 150; - break; - case "Date": - width = 160; - break; - case "DateTime": - width = 205; - break; - case "AutoComplete": - case "TextArea": - width = 190; - break; - case "Currency": - case "TextInput": - width = 182; - break; - case "Checkbox": - - // eslint-disable-next-line no-case-declarations - const text = document.createElement("span"); - document.body.appendChild(text); - text.style.fontSize = "13px"; - text.style.position = "absolute"; - text.innerHTML = label; - width = Math.ceil(text.clientWidth) + 30; - document.body.removeChild(text); - break; - default: - width = 180; - } - return width; -} - -export const getContext = (thePConn) => { - const contextName = thePConn.getContextName(); - const pageReference = thePConn.getPageReference(); - // 8.7 change = referenceList may now be in top-level of state props, - // not always in config of state props - let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps(); - const pageReferenceForRows = referenceList.startsWith(".") - ? `${pageReference}.${referenceList.substring(1)}` - : referenceList; - - // removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions - referenceList = pageReferenceForRows.replace( - PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT, - "" - ); - - return { - contextName, - referenceListStr: referenceList, - pageReferenceForRows - }; -}; - -export const populateRowKey = (rawData) => { - return rawData.map((row, index) => { - return { ...row, index }; - }); -}; - -export const getApiContext = (processedData, pConnect, reorderCB) => { - return { - fetchData: () => { - return new Promise((resolve) => { - resolve({ - data: processedData, - filteredRecordCount: processedData.length, - totalRecordCount: processedData.length - }); - }); - }, - fetchPersonalizations: () => { - return Promise.resolve({}); - }, - applyRowReorder: (sourceKey, destinationKey) => { - // indexes are keys for simple table so, it should work. - reorderCB(); - return Promise.resolve( - pConnect - .getListActions() - .reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10)) - ); - } - }; -}; - -export const buildMetaForListView = ( - fieldMetadata, - fields, - type, - ruleClass, - name, - propertyLabel, - parameters -) => { - return { - name, - config: { - type, - referenceList: fieldMetadata.datasource.name, - parameters: parameters ?? fieldMetadata.datasource.parameters, - personalization: false, - grouping: true, - globalSearch: true, - reorderFields: true, - toggleFieldVisibility: true, - personalizationId: "" /* TODO */, - template: "ListView", - presets: [ - { - name: "presets", - template: "Table", - config: {}, - children: [ - { - name: "Columns", - type: "Region", - children: fields - } - ], - label: propertyLabel, - id: "P_" /* TODO */ - } - ], - ruleClass - } - }; -}; - -export const buildFieldsForTable = (configFields, fields, showDeleteButton) => { - const fieldDefs = configFields?.map((field, index) => { - return { - type: "text", - label: fields[index].config.label || fields[index].config.caption, - fillAvailableSpace: !!field.config.fillAvailableSpace, - id: index, - name: field.config.value.substr(4), - cellRenderer: TABLE_CELL, - sort: false, - noContextMenu: true, - showMenu: false, - meta: { - ...field - }, - // BUG-615253: Workaround for autosize in table with lazy loading components - width: getFiledWidth(field, fields[index].config.label) - }; - }); - - // ONLY add DELETE_ICON to fields when the table is requested as EDITABLE - if (showDeleteButton) { - fieldDefs.push({ - type: "text", - label: "", - name: DELETE_ICON, - id: fieldDefs.length, - cellRenderer: DELETE_ICON, - sort: false, - noContextMenu: true, - showMenu: false, - // BUG-615253: Workaround for autosize in table with lazy loading components - width: 46 - }); - } - - return fieldDefs; -}; - -export const createMetaForTable = (fields, renderMode) => { - return { - height: { - minHeight: "auto", - fitHeightToElement: "fitHeightToElement", - deltaAdjustment: "deltaAdjustment", - autoSize: true - }, - fieldDefs: fields, - itemKey: "index", - grouping: false, - reorderFields: false, - reorderItems: renderMode === "Editable", - dragHandle: renderMode === "Editable", - globalSearch: false, - personalization: false, - toggleFieldVisibility: false, - toolbar: false, - footer: false, - filterExpression: null, - editing: false, - timezone: PCore.getEnvironmentInfo().getTimeZone() - }; -}; - -/** - * This method returns a callBack function for Add action. - * @param {object} pConnect - PConnect object - * @param {number} index - index of the page list to add - */ -export const getAddRowCallback = (pConnect, index) => { - return () => pConnect.getListActions().insert({}, index); -}; - -/** - * This method creates a PConnect object with proper options for Add and Delete actions - * @param {string} contextName - contextName - * @param {string} referenceList - referenceList - * @param {string} pageReference - pageReference - */ -export const createPConnect = (contextName, referenceList, pageReference) => { - const options = { - context: contextName, - pageReference, - referenceList - }; - - // create PConnect object - const config = { meta: {}, options }; - const { getPConnect } = PCore.createPConnect(config); - - return getPConnect(); -}; diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.html b/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.html deleted file mode 100644 index e6f43f05..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.html +++ /dev/null @@ -1,164 +0,0 @@ - -
-

- {{ label }} {{ getResultsText() }} -

- - - - - - - -
-
{{ dCol.config.label }}
-
- -
-
- - - - - - -
-
{{ element[dCol.config.name] }}
- - - - - - - - - - - - - -
{{ dCol.label }} - - - -
-
- No Records Found. -
-
- No Records Found. -
-
- -
- - -
-
-

- Filter: {{ filterContainsLabel$ }} -

-
- - - Contains - Equals - Starts with - - - - - - -
- -
- - - is not equal to - after - before - is null - is not null - - - - - Date - - - - - - - Date time - - - - - Time - - -
- - -
-
diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.scss b/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.scss deleted file mode 100644 index d9be69c2..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.scss +++ /dev/null @@ -1,185 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -/* Adapted from list-view.component.scss */ - -.simple-table-wrapper { - width: 100%; - margin-top: 0.5rem; - margin-bottom: 0.5rem; -} - -table { - width: 100%; -} - -::ng-deep .mat-sort-header-content { - white-space: normal; -} - -::ng-deep td.mat-mdc-cell { - white-space: normal; -} - -::ng-deep th.mat-mdc-header-cell, -td.mat-mdc-cell, -td.mat-mdc-footer-cell { - border-right: 1px solid lightgray; - padding: 8px !important; -} - -::ng-deep .mat-mdc-button { - padding: 0px; - text-align: left; -} - -.mat-mdc-icon-button { - width: fit-content; -} - -.mat-mdc-row .mat-mdc-cell { - text-align: left; -} - -.psdk-mat-header { - white-space: normal; - padding-right: 5px; -} - -.psdk-mat-header-button { - display: inline-grid; -} - -.psdk-mat-header-arrow { - display: inline-grid; - vertical-align: middle; -} - -.psdk-mat-header-filter { - display: inline-grid; - vertical-align: middle; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-search { - padding-left: 0.625rem; -} - -.psdk-icon-search { - vertical-align: sub; - padding: 0rem 0.125rem; - min-width: unset; - width: 1.1rem; -} - -.psdk-outer-div-in-form { - display: inline-grid; -} - -.psdk-inner-div-in-form { - height: auto; - position: relative; - width: 100%; - overflow: auto; - max-height: 550px; - min-height: auto; -} - -.psdk-list-view-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: middle; - filter: $app-primary-color-filter; -} - -.psdk-filter-svg-icon { - width: 1rem; - display: inline-block; - vertical-align: middle; - filter: $app-neutral-color-filter; -} - -.psdk-arrow-svg-icon { - width: 1rem; - display: inline-block; - vertical-align: middle; - filter: $app-neutral-color-filter; -} - -.psdk-filter-popover { - display: table; - margin: auto; - min-width: 100px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; - position: absolute; - z-index: 99; -} - -.psdk-dialog-background { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - height: 100%; - width: 100%; - background-color: rgba(100, 100, 100, 0.4); - position: fixed; - z-index: 999; - top: 0px; - left: 0px; -} - -.psdk-modal-file-top { - display: table; - margin: auto; - min-width: 150px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; -} - -tr.mat-mdc-row { - cursor: pointer; -} - -tr.mat-mdc-header-row { - background: #f5f5f5; -} - -.psdk-data-readonly { - margin-top: 0.625rem; - width: 100%; -} - -.psdk-no-records { - height: 56px; - justify-content: center; - display: flex; - align-items: center; - border: 1px solid lightgray; - border-top: none; - background: white; -} - -.psdk-utility-card-action-svg-icon { - width: 1.4rem; -} - -.label { - margin: 8px; -} - -.results-count { - opacity: 0.7; - font-size: 0.8rem; - font-weight: bold; - margin-inline-start: 0.625rem; -} diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.spec.ts deleted file mode 100644 index 1d7d66db..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SimpleTableManualComponent } from './simple-table-manual.component'; - -describe('SimpleTableManualComponent', () => { - let component: SimpleTableManualComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SimpleTableManualComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SimpleTableManualComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.ts b/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.ts deleted file mode 100644 index c9e63442..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-manual/simple-table-manual.component.ts +++ /dev/null @@ -1,942 +0,0 @@ -/* eslint-disable max-classes-per-file */ -import { Component, OnInit, Input, ViewChild, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatOptionModule } from '@angular/material/core'; -import { MatSelectModule } from '@angular/material/select'; -import { MatSort, MatSortModule } from '@angular/material/sort'; -import { MatTableDataSource, MatTableModule } from '@angular/material/table'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { DatapageService } from '@pega/angular-sdk-library'; -import { FieldGroupUtils } from '@pega/angular-sdk-library'; -import { getContext, buildFieldsForTable } from './helpers'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -class Group { - level = 0; - parent: Group; - expanded = true; - totalCounts = 0; - get visible(): boolean { - return !this.parent || (this.parent.visible && this.parent.expanded); - } -} - -@Component({ - selector: 'app-simple-table-manual', - templateUrl: './simple-table-manual.component.html', - styleUrls: ['./simple-table-manual.component.scss'], - standalone: true, - imports: [ - CommonModule, - MatTableModule, - MatButtonModule, - MatSortModule, - MatMenuModule, - MatFormFieldModule, - MatDatepickerModule, - MatOptionModule, - MatSelectModule, - MatInputModule, - forwardRef(() => ComponentMapperComponent) - ] -}) -export class SimpleTableManualComponent implements OnInit { - @ViewChild(MatSort) sort: MatSort; - - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - configProps$: any; - fields$: Array; - - bVisible$: boolean = true; - displayedColumns: Array = []; - rowData: MatTableDataSource; - originalData: Array = []; - processedFields: Array = []; - fieldDefs: Array = []; - requestedReadOnlyMode: boolean = false; - readOnlyMode: boolean = false; - editableMode: boolean; - menuIconOverride$: string; - pageReference: string; - referenceList: any; - contextClass: any; - showAddRowButton: boolean; - prevRefLength: number; - elementsData: MatTableDataSource; - rawFields: any; - label: string = ''; - searchIcon$: string; - - bShowSearch$: boolean = false; - bColumnReorder$: boolean = false; - bGrouping$: boolean = false; - - perfFilter: string; - searchFilter: string; - - menuSvgIcon$: string; - arrowSvgIcon$: string = ''; - arrowDownSvgIcon$: string; - arrowUpSvgIcon$: string; - - filterSvgIcon$: string; - filterOnSvgIcon$: string; - groupBySvgIcon$: string; - - groupByColumns$: Array = []; - compareType: string; - compareRef: string; - arrowDirection: string = 'down'; - filterByColumns: Array = []; - currentFilterRefData: any; - filterContainsLabel$: string = ''; - filterContainsType$: string = 'contains'; - filterContainsValue$: any; - bShowFilterPopover$: boolean = false; - bContains$: boolean = true; - bDateTime$: boolean = false; - - bIsDate$: boolean = false; - bIsDateTime$: boolean = false; - bIsTime$: boolean = false; - currentFilterImageEl: any; - - arFilterMainButtons$: Array = []; - arFilterSecondaryButtons$: Array = []; - selectionMode: string; - singleSelectionMode: boolean; - multiSelectionMode: boolean; - rowID: any; - response: any; - compositeKeys: any; - - constructor( - private angularPConnect: AngularPConnectService, - private utils: Utils, - private dataPageService: DatapageService, - private fieldGroupUtils: FieldGroupUtils - ) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.configProps$ = this.pConn$.getConfigProps(); - // Then, continue on with other initialization - this.menuIconOverride$ = this.utils.getImageSrc('trash', this.utils.getSDKStaticContentUrl()); - // call checkAndUpdate when initializing - this.checkAndUpdate(); - this.filterSvgIcon$ = this.utils.getImageSrc('filter', this.utils.getSDKStaticContentUrl()); - this.filterOnSvgIcon$ = this.utils.getImageSrc('filter-on', this.utils.getSDKStaticContentUrl()); - this.groupBySvgIcon$ = this.utils.getImageSrc('row', this.utils.getSDKStaticContentUrl()); - this.bGrouping$ = this.utils.getBooleanValue(this.configProps$.grouping); - this.menuSvgIcon$ = this.utils.getImageSrc('more', this.utils.getSDKStaticContentUrl()); - - this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' }); - this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' }); - - this.searchIcon$ = this.utils.getImageSrc('search', this.utils.getSDKStaticContentUrl()); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['visibility'] != null) { - // eslint-disable-next-line no-multi-assign - this.bVisible$ = this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - // NOTE: getConfigProps() has each child.config with datasource and value undefined - // but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName") - // We need to use the prop name as the "glue" to tie the Angular Material table dataSource, displayColumns and data together. - // So, in the code below, we'll use the unresolved config.value (but replacing the space with an underscore to keep things happy) - const rawMetadata = this.pConn$.getRawMetadata(); - - // Adapted from Nebula - const { - label, - showLabel, - referenceList = [], // if referenceList not in configProps$, default to empy list - renderMode, - children, // destructure children into an array var: "resolvedFields" - presets, - allowTableEdit, - labelProp, - propertyLabel - } = this.configProps$; - - this.label = labelProp || propertyLabel; - - const hideAddRow = allowTableEdit === false ? true : false; - const hideDeleteRow = allowTableEdit === false ? true : false; - let { contextClass } = this.configProps$; - this.referenceList = referenceList; - if (!contextClass) { - let listName = this.pConn$.getComponentConfig().referenceList; - listName = this.PCore$.getAnnotationUtils().getPropertyName(listName); - contextClass = this.pConn$.getFieldMetadata(listName)?.pageClass; - } - this.contextClass = contextClass; - - const resolvedFields = children?.[0]?.children || presets?.[0].children?.[0].children; - // get raw config as @P and other annotations are processed and don't appear in the resolved config. - // Destructure "raw" children into array var: "rawFields" - // NOTE: when config.listType == "associated", the property can be found in either - // config.value (ex: "@P .DeclarantChoice") or - // config.datasource (ex: "@ASSOCIATED .DeclarantChoice") - // Neither of these appear in the resolved (this.configProps$) - const rawConfig = rawMetadata?.config; - const rawFields = rawConfig?.children?.[0]?.children || rawConfig?.presets?.[0].children?.[0]?.children; - this.rawFields = rawFields; - // At this point, fields has resolvedFields and rawFields we can use - - // start of from Nebula - // get context name and referenceList which will be used to prepare config of PConnect - const { contextName, referenceListStr, pageReferenceForRows } = getContext(this.pConn$); - - const resolvedList = this.fieldGroupUtils.getReferenceList(this.pConn$); - this.pageReference = `${this.pConn$.getPageReference()}${resolvedList}`; - this.pConn$.setReferenceList(resolvedList); - - // This gives up the "properties" we need to map to row/column values later - // const processedData = populateRowKey(referenceList); - - this.requestedReadOnlyMode = renderMode === 'ReadOnly'; - this.readOnlyMode = renderMode === 'ReadOnly'; - this.editableMode = renderMode === 'Editable'; - this.showAddRowButton = !this.readOnlyMode && !hideAddRow; - const showDeleteButton = !this.readOnlyMode && !hideDeleteRow; - - // Nebula has other handling for isReadOnlyMode but has Cosmos-specific code - // so ignoring that for now... - // fieldDefs will be an array where each entry will have a "name" which will be the - // "resolved" property name (that we can use as the colId) though it's not really - // resolved. The buildFieldsForTable helper just removes the "@P " (which is what - // Nebula does). It will also have the "label", and "meta" contains the original, - // unchanged config info. For now, much of the info here is carried over from - // Nebula and we may not end up using it all. - this.fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton); - - // end of from Nebula - - // Here, we use the "name" field in fieldDefs since that has the assoicated property - // (if one exists for the field). If no "name", use "cellRenderer" (typically get DELETE_ICON) - // for our columns. - this.displayedColumns = this.fieldDefs?.map((field) => { - return field.name ? field.name : field.cellRenderer; - }); - - // And now we can process the resolvedFields to add in the "name" - // from from the fieldDefs. This "name" is the value that - // we'll share to connect things together in the table. - - this.processedFields = []; - - this.processedFields = resolvedFields.map((field, i) => { - field.config['name'] = this.displayedColumns[i]; // .config["value"].replace(/ ./g,"_"); // replace space dot with underscore - return field; - }); - - if (this.prevRefLength !== this.referenceList?.length) { - if (this.editableMode) { - this.buildElementsForTable(); - } else { - this.generateRowsData(); - } - } - - this.prevRefLength = this.referenceList?.length; - - // These are the data structures referred to in the html file. - // These are the relationships that make the table work - // displayedColumns: key/value pairs where key is order of column and - // value is the property shown in that column. Ex: 1: "FirstName" - // processedFields: key/value pairs where each key is order of column - // and each value is an object of more detailed information about that - // column. - // rowData: array of each row's key/value pairs. Inside each row, - // each key is an entry in displayedColumns: ex: "FirstName": "Charles" - // Ex: { 1: {config: {label: "First Name", readOnly: true: name: "FirstName"}}, type: "TextInput" } - // The "type" indicates the type of component that should be used for editing (when editing is enabled) - // - // Note that the "property" shown in the column ("FirstName" in the above examples) is what - // ties the 3 data structures together. - } - - getResultsText() { - const recordsCount = this.readOnlyMode ? this.rowData?.data.length : this.referenceList?.length; - return `${recordsCount} result${recordsCount > 1 ? 's' : ''}`; - } - - sortCompare(a, b): number { - let aValue = a[this.compareRef]; - let bValue = b[this.compareRef]; - - if (this.compareType == 'Date' || this.compareType == 'DateTime') { - aValue = this.utils.getSeconds(aValue); - bValue = this.utils.getSeconds(bValue); - } - - if (this.compareRef == 'pxRefObjectInsName') { - const prefixX = aValue.split('-'); - const prefixY = bValue.split('-'); - switch (this.arrowDirection) { - case 'up': - if (prefixX[0] !== prefixY[0]) { - if (prefixX[0] < prefixY[0]) return -1; - if (prefixX[0] > prefixY[0]) return 1; - return 0; - } - return prefixX[1] - prefixY[1]; - break; - case 'down': - if (prefixX[0] !== prefixY[0]) { - if (prefixX[0] > prefixY[0]) return -1; - if (prefixX[0] < prefixY[0]) return 1; - return 0; - } - return prefixY[1] - prefixX[1]; - break; - } - } - - switch (this.arrowDirection) { - case 'up': - if (aValue < bValue) { - return -1; - } else if (aValue > bValue) { - return 1; - } - break; - case 'down': - if (aValue > bValue) { - return -1; - } else if (aValue < bValue) { - return 1; - } - break; - } - - return 0; - } - - updateFilterDisplay(type) { - switch (type) { - case 'Date': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = true; - this.bIsDateTime$ = false; - this.bIsTime$ = false; - break; - case 'DateTime': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = false; - this.bIsDateTime$ = true; - this.bIsTime$ = false; - break; - case 'Time': - this.filterContainsType$ = 'notequal'; - this.bContains$ = false; - this.bDateTime$ = true; - this.bIsDate$ = false; - this.bIsDateTime$ = false; - this.bIsTime$ = true; - break; - default: - this.filterContainsType$ = 'contains'; - this.bContains$ = true; - this.bDateTime$ = false; - this.bIsDate$ = false; - this.bIsDateTime$ = false; - this.bIsTime$ = false; - break; - } - } - - _filter(event, columnData) { - // add clickAway listener - window.addEventListener('mouseup', this._clickAway.bind(this)); - - this.currentFilterRefData = columnData; - this.filterContainsLabel$ = columnData.config.label; - - setTimeout(() => { - this.updateFilterDisplay(columnData.type); - - this.updateFilterVarsWithCurrent(columnData); - - this.bShowFilterPopover$ = true; - }); - } - - _clickAway(event: any) { - var bInPopUp = false; - - //run through list of elements in path, if menu not in th path, then want to - // hide (toggle) the menu - for (let i in event.path) { - if ( - event.path[i].className == 'psdk-modal-file-top' || - event.path[i].tagName == 'BUTTON' || - event.path[i].tagName == 'MAT-OPTION' || - event.path[i].tagName == 'MAT-INPUT' - ) { - bInPopUp = true; - break; - } - } - if (!bInPopUp) { - // this.bShowFilterPopover$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - } - - _filterContainsType(event) { - this.filterContainsType$ = event.value; - } - - _filterContainsValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _filterContainsDateValue(event, value) { - this.filterContainsValue$ = value; - } - - _filterContainsDateTimeValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _filterContainsTimeValue(event) { - this.filterContainsValue$ = event.target.value; - } - - _onFilterActionButtonClick(event: any) { - // modal buttons - switch (event.action) { - case 'cancel': - this.currentFilterRefData = []; - break; - case 'submit': - this.updateFilterWithInfo(); - this.filterSortGroupBy(); - - break; - } - - this.bShowFilterPopover$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - - updateFilterWithInfo() { - let bFound = false; - for (let filterObj of this.filterByColumns) { - if (filterObj['ref'] === this.currentFilterRefData.config.name) { - filterObj['type'] = this.currentFilterRefData.type; - filterObj['containsFilter'] = this.filterContainsType$; - filterObj['containsFilterValue'] = this.filterContainsValue$; - - bFound = true; - break; - } - } - - if (!bFound) { - // add in - let filterObj: any = {}; - filterObj.ref = this.currentFilterRefData.config.name; - filterObj.type = this.currentFilterRefData.type; - filterObj.containsFilter = this.filterContainsType$; - filterObj.containsFilterValue = this.filterContainsValue$; - - this.filterByColumns.push(filterObj); - } - - // iterate through filters and update filterOn icon - for (let filterObj of this.filterByColumns) { - let containsFilterValue = filterObj['containsFilterValue']; - let containsFilter = filterObj['containsFilter']; - let filterRef = filterObj['ref']; - let filterIndex = this.displayedColumns.indexOf(filterRef); - let arFilterImg = document.getElementsByName('filterOnIcon'); - let filterImg: any = arFilterImg[filterIndex]; - if (containsFilterValue == '' && containsFilter != 'null' && containsFilter != 'notnull') { - // clear icon - filterImg.src = ''; - } else { - // show icon - filterImg.src = this.filterOnSvgIcon$; - } - } - } - - updateFilterVarsWithCurrent(columnData) { - // find current ref, if exists, move data to variable to display - - let bFound = false; - for (let filterObj of this.filterByColumns) { - if (filterObj['ref'] === this.currentFilterRefData.config.name) { - this.filterContainsType$ = filterObj['containsFilter']; - this.filterContainsValue$ = filterObj['containsFilterValue']; - - bFound = true; - break; - } - } - - if (!bFound) { - switch (columnData.type) { - case 'Date': - case 'DateTime': - case 'Time': - this.filterContainsType$ = 'notequal'; - break; - default: - this.filterContainsType$ = 'contains'; - break; - } - - this.filterContainsValue$ = ''; - } - } - - filterData(item: any) { - let bKeep = true; - for (let filterObj of this.filterByColumns) { - if (filterObj.containsFilterValue != '' || filterObj.containsFilter == 'null' || filterObj.containsFilter == 'notnull') { - let value: any; - let filterValue: any; - - switch (filterObj.type) { - case 'Date': - case 'DateTime': - case 'Time': - value = item[filterObj.ref] != null ?? item[filterObj.ref] != '' ? this.utils.getSeconds(item[filterObj.ref]) : null; - filterValue = - filterObj.containsFilterValue != null && filterObj.containsFilterValue != '' - ? this.utils.getSeconds(filterObj.containsFilterValue) - : null; - - switch (filterObj.containsFilter) { - case 'notequal': - // becasue filterValue is in minutes, need to have a range of less than 60 secons - - if (value != null && filterValue != null) { - // get rid of millisecons - value = value / 1000; - filterValue = filterValue / 1000; - - let diff = value - filterValue; - if (diff >= 0 && diff < 60) { - bKeep = false; - } - } - - break; - case 'after': - if (value < filterValue) { - bKeep = false; - } - break; - case 'before': - if (value > filterValue) { - bKeep = false; - } - break; - case 'null': - if (value != null) { - bKeep = false; - } - break; - case 'notnull': - if (value == null) { - bKeep = false; - } - break; - } - break; - default: - value = item[filterObj.ref].toLowerCase(); - filterValue = filterObj.containsFilterValue.toLowerCase(); - - switch (filterObj.containsFilter) { - case 'contains': - if (value.indexOf(filterValue) < 0) { - bKeep = false; - } - break; - case 'equals': - if (value != filterValue) { - bKeep = false; - } - break; - case 'startswith': - if (value.indexOf(filterValue) != 0) { - bKeep = false; - } - break; - } - - break; - } - } - - // if don't keep stop filtering - if (!bKeep) { - break; - } - } - - return bKeep; - } - - filterSortGroupBy() { - let theData = this.originalData.slice(); - - // last filter config data is global - theData = theData.filter(this.filterData.bind(this)); - - // last sort config data is global - theData.sort(this.sortCompare.bind(this)); - this.rowData.data = theData; - } - - _headerSortClick(event, columnData) { - // images 0 - filter, 1 - arrow, 2 - more - - /** Commenting this code for now as it is giving errors not sure if it ever worked */ - // let arrowImage = event.srcElement.getElementsByTagName('img')[1]; - // let arrowAttr = arrowImage.getAttribute('arrow'); - - // this.clearOutArrows(event, columnData); - - // switch (arrowAttr) { - // case 'up': - // arrowImage.src = this.arrowDownSvgIcon$; - // arrowImage.setAttribute('arrow', 'down'); - // break; - // case 'down': - // arrowImage.src = ''; - // arrowImage.setAttribute('arrow', 'none'); - // break; - // default: - // arrowImage.src = this.arrowUpSvgIcon$; - // arrowImage.setAttribute('arrow', 'up'); - // break; - // } - - this.compareType = columnData.type; - this.compareRef = columnData.config.name; - // this.arrowDirection = arrowImage.getAttribute('arrow'); - this.arrowDirection = this.arrowDirection === 'up' ? 'down' : 'up'; - - this.filterSortGroupBy(); - } - - _showUnGroupBy(columnData): boolean { - for (let val of this.groupByColumns$) { - if (val == columnData.config.name) { - return true; - } - } - - return false; - } - - _groupBy(event, columnData) { - this.checkGroupByColumn(columnData.config.name, true); - - this.filterSortGroupBy(); - } - - _unGroupBy(event, columnData) { - //event.stopPropagation(); - this.checkGroupByColumn(columnData.config.name, false); - - this.filterSortGroupBy(); - } - - checkGroupByColumn(field, add) { - let found = null; - for (const column of this.groupByColumns$) { - if (column === field) { - found = this.groupByColumns$.indexOf(column, 0); - } - } - if (found != null && found >= 0) { - if (!add) { - this.groupByColumns$.splice(found, 1); - } - } else { - if (add) { - this.groupByColumns$.push(field); - } - } - } - - _getGroupName(fieldName) { - for (let i in this.fields$) { - let field = this.fields$[i]; - if (field.config.name == fieldName) { - return field.config.label; - } - } - - return ''; - } - - addGroups(data: Array, groupByColumns: Array): Array { - const rootGroup = new Group(); - rootGroup.expanded = true; - return this.getSublevel(data, 0, groupByColumns, rootGroup); - } - - getSublevel(data: Array, level: number, groupByColumns: Array, parent: Group): Array { - if (level >= groupByColumns.length) { - return data; - } - const groups = this.uniqueBy( - data.map((row) => { - const result = new Group(); - result.level = level + 1; - result.parent = parent; - for (let i = 0; i <= level; i++) { - result[groupByColumns[i]] = row[groupByColumns[i]]; - } - return result; - }), - JSON.stringify - ); - - const currentColumn = groupByColumns[level]; - let subGroups = []; - groups.forEach((group) => { - const rowsInGroup = data.filter((row) => group[currentColumn] === row[currentColumn]); - group.totalCounts = rowsInGroup.length; - const subGroup = this.getSublevel(rowsInGroup, level + 1, groupByColumns, group); - subGroup.unshift(group); - subGroups = subGroups.concat(subGroup); - }); - return subGroups; - } - - uniqueBy(a, key) { - const seen = {}; - return a.filter((item) => { - const k = key(item); - // eslint-disable-next-line no-return-assign, no-prototype-builtins - return seen.hasOwnProperty(k) ? false : (seen[k] = true); - }); - } - - isGroup(index, item): boolean { - return item.level; - } - - _groupHeaderClick(row) { - row.expanded = !row.expanded; - //this.repeatList$.filter = ""; - this.perfFilter = performance.now().toString(); - this.rowData.filter = this.perfFilter; - } - - // below is for grid row grouping - customFilterPredicate(data: any | Group, filter: string): boolean { - return data instanceof Group ? data.visible : this.getDataRowVisibleWithFilter(data, filter); - } - - getDataRowVisible(data: any): boolean { - const groupRows = this.rowData.data.filter((row) => { - if (!(row instanceof Group)) { - return false; - } - let match = true; - this.groupByColumns$.forEach((column) => { - if (!row[column] || !data[column] || row[column] !== data[column]) { - match = false; - } - }); - return match; - }); - - if (groupRows.length === 0) { - return true; - } - const parent = groupRows[0] as Group; - return parent.visible && parent.expanded; - } - - getDataRowVisibleWithFilter(data, filter) { - // fist check if row is visible with grouping - let bVisible = this.getDataRowVisible(data); - - if (bVisible && filter && filter != '' && filter != this.perfFilter) { - // now check if row is filtered. - - // assume not there unless we find it - bVisible = false; - for (let col of this.displayedColumns) { - // filter is lower case - if (data[col] && data[col].toString().toLowerCase().indexOf(filter) >= 0) { - bVisible = true; - break; - } - } - } - - return bVisible; - } - - getDisplayColums(fields = []) { - let arReturn = fields.map((field, colIndex) => { - let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1); - if (theField.indexOf('.') == 0) { - theField = theField.substring(1); - } - - return theField; - }); - return arReturn; - } - - _getIconStyle(level): string { - let sReturn = ''; - let nLevel = parseInt(level); - nLevel--; - nLevel = nLevel * 15; - sReturn = 'padding-left: ' + nLevel + 'px; vertical-align: middle'; - - return sReturn; - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - // return the value that should be shown as the contents for the given row data - // of the given row field - getRowValue(inRowData: Object, inColKey: string): any { - // See what data (if any) we have to display - const refKeys: Array = inColKey.split('.'); - let valBuilder = inRowData; - for (var key of refKeys) { - valBuilder = valBuilder[key]; - } - return valBuilder; - } - - generateRowsData() { - const { dataPageName, referenceList } = this.configProps$; - const context = this.pConn$.getContextName(); - // if dataPageName property value exists then make a datapage fetch call and get the list of data. - if (dataPageName) { - this.dataPageService.getDataPageData(dataPageName, context).then((listData) => { - const data = this.formatRowsData(listData); - this.originalData = data; - this.rowData = new MatTableDataSource(data); - }); - } else { - // The referenceList prop has the JSON data for each row to be displayed - // in the table. So, iterate over referenceList to create the dataRows that - // we're using as the table's dataSource - const data = this.formatRowsData(referenceList); - this.originalData = data; - this.rowData = new MatTableDataSource(data); - } - } - - formatRowsData(data) { - return data?.map((item) => { - return this.displayedColumns.reduce((dataForRow, colKey) => { - dataForRow[colKey] = this.getRowValue(item, colKey); - return dataForRow; - }, {}); - }); - } - - addRecord() { - if (this.PCore$.getPCoreVersion()?.includes('8.7')) { - this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length, this.pageReference); - } else { - this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length); - } - } - - deleteRecord(index) { - if (this.PCore$.getPCoreVersion()?.includes('8.7')) { - this.pConn$.getListActions().deleteEntry(index, this.pageReference); - } else { - this.pConn$.getListActions().deleteEntry(index); - } - } - - buildElementsForTable() { - const context = this.pConn$.getContextName(); - const eleData: any = []; - this.referenceList.forEach((element, index) => { - const data: any = []; - this.rawFields?.forEach((item) => { - const referenceListData = this.fieldGroupUtils.getReferenceList(this.pConn$); - const isDatapage = referenceListData.startsWith('D_'); - const pageReferenceValue = isDatapage - ? `${referenceListData}[${index}]` - : `${this.pConn$.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`; - const config = { - meta: item, - options: { - context, - pageReference: pageReferenceValue, - referenceList: referenceListData, - hasForm: true - } - }; - const view = this.PCore$.createPConnect(config); - data.push(view); - }); - eleData.push(data); - }); - this.elementsData = eleData; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.html b/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.html deleted file mode 100644 index dc4e2e24..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
- -
-
-
- -
- - - -
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.scss b/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.spec.ts deleted file mode 100644 index 680d0de0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { SimpleTableSelectComponent } from './simple-table-select.component'; - -describe('SimpleTableSelectComponent', () => { - let component: SimpleTableSelectComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ SimpleTableSelectComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SimpleTableSelectComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.ts b/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.ts deleted file mode 100644 index 4209df30..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table-select/simple-table-select.component.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-simple-table-select', - templateUrl: './simple-table-select.component.html', - styleUrls: ['./simple-table-select.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class SimpleTableSelectComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - - label = ''; - renderMode = ''; - showLabel = true; - viewName = ''; - parameters = {}; - dataRelationshipContext = ''; - propsToUse; - showSimpleTableManual: boolean; - isSearchable: boolean; - filters: any; - listViewProps: any; - pageClass: any; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const theConfigProps = this.pConn$.getConfigProps(); - this.label = theConfigProps.label; - this.renderMode = theConfigProps.renderMode; - this.showLabel = theConfigProps.showLabel; - this.viewName = theConfigProps.viewName; - this.parameters = theConfigProps.parameters; - this.dataRelationshipContext = theConfigProps.dataRelationshipContext; - - this.propsToUse = { label: this.label, showLabel: this.showLabel, ...this.pConn$.getInheritedProps() }; - - if (this.propsToUse.showLabel === false) { - this.propsToUse.label = ''; - } - const { MULTI } = this.PCore$.getConstants().LIST_SELECTION_MODE; - const { selectionMode, selectionList } = this.pConn$.getConfigProps(); - const isMultiSelectMode = selectionMode === MULTI; - if (isMultiSelectMode && this.renderMode === 'ReadOnly') { - this.showSimpleTableManual = true; - } else { - const pageReference = this.pConn$.getPageReference(); - let referenceProp = isMultiSelectMode - ? selectionList.substring(1) - : pageReference.substring(pageReference.lastIndexOf('.') + 1); - // Replace here to use the context name instead - let contextPageReference = null; - if (this.dataRelationshipContext !== null && selectionMode === 'single') { - referenceProp = this.dataRelationshipContext; - contextPageReference = pageReference.concat('.').concat(referenceProp); - } - const metadata = isMultiSelectMode - ? this.pConn$.getFieldMetadata(`@P .${referenceProp}`) - : this.pConn$.getCurrentPageFieldMetadata(contextPageReference); - - const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = metadata; - - this.pageClass = pageClass; - const compositeKeys: Array = []; - Object.values(fieldParameters).forEach((param: any) => { - if (this.isSelfReferencedProperty(param, referenceProp)) { - compositeKeys.push(param.substring(param.lastIndexOf('.') + 1)); - } - }); - - this.processFiltrers(theConfigProps, compositeKeys); - } - } - - processFiltrers(theConfigProps, compositeKeys) { - const defaultRowHeight = '2'; - - const additionalTableConfig = { - rowDensity: false, - enableFreezeColumns: false, - autoSizeColumns: false, - resetColumnWidths: false, - defaultFieldDef: { - showMenu: false, - noContextMenu: true, - grouping: false - }, - itemKey: '$key', - defaultRowHeight - }; - - this.listViewProps = { - ...theConfigProps, - title: this.propsToUse.label, - personalization: false, - grouping: false, - expandGroups: false, - reorderFields: false, - showHeaderIcons: false, - editing: false, - globalSearch: true, - toggleFieldVisibility: false, - basicMode: true, - additionalTableConfig, - compositeKeys, - viewName: this.viewName, - parameters: this.parameters - }; - - this.filters = this.pConn$.getRawMetadata().config.promotedFilters ?? []; - - this.isSearchable = this.filters.length > 0; - } - - isSelfReferencedProperty(param, referenceProp) { - const [, parentPropName] = param.split('.'); - return parentPropName === referenceProp; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table/config.json b/tests/assets/components/createAll/override-sdk/template/simple-table/config.json deleted file mode 100644 index 5e3651be..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "SimpleTable", - "description": "Datatype List Template", - "type": "Template", - "subtype": "DATAVIEW", - "icon": "EditableTable.svg", - "hideTemplatePicker": true, - "hideFromTemplatePicker": true, - "editing": true, - "properties": [ - { - "name": "parameters", - "label": "", - "format": "PARAMETERS" - }, - { - "name": "renderMode", - "label": "Mode", - "format": "RENDERMODE" - }, - { - "name": "Columns", - "label": "Columns", - "format": "CONTENTPICKER", - "addTypeList": ["Fields", "Associations"], - "hideModifyIcons": false, - "modifyPanelOverrideProp": "renderMode", - "modifyPanelOverride": { - "ReadOnly": "ListField" - } - }, - { - "name": "fillAvailableSpace", - "label": "Column to take up remaining width", - "format": "FILLCOLUMNWIDTH" - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "saveToReference": true - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "saveToReference": true - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY", - "saveToReference": true - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.html b/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.html deleted file mode 100644 index fb39adb3..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.html +++ /dev/null @@ -1,8 +0,0 @@ - -
- -
- - - -
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.scss b/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.spec.ts deleted file mode 100644 index ec4715c4..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { SimpleTableComponent } from './simple-table.component'; - -describe('SimpleTableComponent', () => { - let component: SimpleTableComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ SimpleTableComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SimpleTableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.ts b/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.ts deleted file mode 100644 index a7045786..00000000 --- a/tests/assets/components/createAll/override-sdk/template/simple-table/simple-table.component.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-simple-table', - templateUrl: './simple-table.component.html', - styleUrls: ['./simple-table.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class SimpleTableComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - angularPConnectData: any = {}; - PCore$: any; - - bVisible$: boolean = true; - configProps$: any; - fieldGroupProps: any; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - // Then, continue on with other initialization - - // call checkAndUpdate when initializing - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - // updateSelf - updateSelf(): void { - // moved this from ngOnInit() and call this from there instead... - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.configProps$['visibility'] != null) { - // eslint-disable-next-line no-multi-assign - this.bVisible$ = this.bVisible$ = this.utils.getBooleanValue(this.configProps$['visibility']); - } - - const { multiRecordDisplayAs } = this.configProps$; - let { contextClass } = this.configProps$; - if (!contextClass) { - let listName = this.pConn$.getComponentConfig().referenceList; - listName = this.PCore$.getAnnotationUtils().getPropertyName(listName); - contextClass = this.pConn$.getFieldMetadata(listName)?.pageClass; - } - if (multiRecordDisplayAs === 'fieldGroup') { - this.fieldGroupProps = { ...this.configProps$, contextClass }; - } - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } -} - diff --git a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.html b/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.html deleted file mode 100644 index 083139de..00000000 --- a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.scss b/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.spec.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.ts b/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.ts deleted file mode 100644 index 500828a1..00000000 --- a/tests/assets/components/createAll/override-sdk/template/single-reference-readonly/single-reference-readonly.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-single-reference-readonly', - templateUrl: './single-reference-readonly.component.html', - styleUrls: ['./single-reference-readonly.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class SingleReferenceReadonlyComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - ngOnInit(): void {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.html b/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.html deleted file mode 100644 index f3877ceb..00000000 --- a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - -
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.scss b/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.scss deleted file mode 100644 index c4c0a097..00000000 --- a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.psdk-sub-tabs{ - margin: 0.5rem; -} \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.spec.ts deleted file mode 100644 index 4f984c35..00000000 --- a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { SubTabsComponent } from './sub-tabs.component'; - -describe('SubTabsComponent', () => { - let component: SubTabsComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ SubTabsComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SubTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.ts b/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.ts deleted file mode 100644 index 605507b9..00000000 --- a/tests/assets/components/createAll/override-sdk/template/sub-tabs/sub-tabs.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { MatTabsModule } from '@angular/material/tabs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/angular-sdk-library'; -import { CommonModule } from '@angular/common'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-sub-tabs', - templateUrl: './sub-tabs.component.html', - styleUrls: ['./sub-tabs.component.scss'], - standalone: true, - imports: [MatTabsModule, CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class SubTabsComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - angularPConnectData: any = {}; - PCore$: any; - defaultTabIndex = 0; - currentTabId = this.defaultTabIndex.toString(); - tabItems: Array; - availableTabs: any; - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - this.checkAndUpdate(); - } - - ngOnDestroy() { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - const children = this.pConn$?.getChildren(); - const deferLoadedTabs = children[0]; - this.availableTabs = getVisibleTabs(deferLoadedTabs, 'tabsSubs'); - this.updateTabContent(); - } - - updateTabContent() { - const tempTabItems = getTransientTabs(this.availableTabs, this.currentTabId, this.tabItems); - this.tabItems = tempTabItems; - } - - handleTabClick(event) { - const { index } = event; - this.currentTabId = index.toString(); - tabClick(index, this.availableTabs, this.currentTabId, this.tabItems); - const tempTabItems = getTransientTabs(this.availableTabs, this.currentTabId, this.tabItems); - this.tabItems[index].content = tempTabItems[index].content; - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/three-column-page/config.json b/tests/assets/components/createAll/override-sdk/template/three-column-page/config.json deleted file mode 100644 index 972cbc11..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column-page/config.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ThreeColumnPage", - "label": "Three column", - "description": "ThreeColumn Page Template", - "type": "Template", - "subtype": "PAGE", - "icon": "ThreeColumnPage.svg", - "viewNameLabel": "Page title", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - }, - { - "name": "C", - "label": "Region C", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.html b/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.html deleted file mode 100644 index 043321ab..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.scss b/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.spec.ts deleted file mode 100644 index 3ef0e2fc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ThreeColumnPageComponent } from './three-column-page.component'; - -describe('ThreeColumnPageComponent', () => { - let component: ThreeColumnPageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ThreeColumnPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ThreeColumnPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.ts b/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.ts deleted file mode 100644 index 9a6c714c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column-page/three-column-page.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -// import { ComponentMapperComponent } from '@pega/angular-sdk-library'; -import { ThreeColumnComponent } from '@pega/angular-sdk-library'; - - -@Component({ - selector: 'app-three-column-page', - templateUrl: './three-column-page.component.html', - styleUrls: ['./three-column-page.component.scss'], - standalone: true, - imports: [ThreeColumnComponent] -}) -export class ThreeColumnPageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - constructor() {} - - ngOnInit(): void {} -} diff --git a/tests/assets/components/createAll/override-sdk/template/three-column/config.json b/tests/assets/components/createAll/override-sdk/template/three-column/config.json deleted file mode 100644 index ee9cc094..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column/config.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ThreeColumnTab", - "label": "Three column", - "description": "Three column", - "type": "Template", - "subtype": "TAB", - "icon": "ThreeColumnTab.svg", - "viewNameLabel": "Tab name", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Fields", "Insights"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Fields", "Insights"] - }, - { - "name": "C", - "label": "Region C", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Fields", "Insights"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.html b/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.html deleted file mode 100644 index fad04f1c..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.scss b/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.scss deleted file mode 100644 index b46524bb..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -* { - box-sizing: border-box; -} - -.psdk-three-column { - display: flow-root; - height: 100%; -} - -/* Create two equal columns that floats next to each other */ -.psdk-three-column-column { - width: 33%; - float: left; - padding: 0rem 0.3125rem; - height: 100%; -} diff --git a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.spec.ts deleted file mode 100644 index 92f98e14..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ThreeColumnComponent } from './three-column.component'; - -describe('ThreeColumnComponent', () => { - let component: ThreeColumnComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ThreeColumnComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ThreeColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.ts b/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.ts deleted file mode 100644 index 44985e12..00000000 --- a/tests/assets/components/createAll/override-sdk/template/three-column/three-column.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-three-column', - templateUrl: './three-column.component.html', - styleUrls: ['./three-column.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class ThreeColumnComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-page/config.json b/tests/assets/components/createAll/override-sdk/template/two-column-page/config.json deleted file mode 100644 index f13bcda8..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-page/config.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "TwoColumnPage", - "label": "Two column", - "description": "TwoColumn Page Template", - "type": "Template", - "subtype": "PAGE", - "icon": "TwoColumnPage.svg", - "viewNameLabel": "Page title", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER", - "addTypeList": ["Widgets", "Views", "Insights"] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.html b/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.html deleted file mode 100644 index c60b951e..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.scss b/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.spec.ts deleted file mode 100644 index 97cb56ad..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TwoColumnPageComponent } from './two-column-page.component'; - -describe('TwoColumnPageComponent', () => { - let component: TwoColumnPageComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TwoColumnPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TwoColumnPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.ts b/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.ts deleted file mode 100644 index f79aa1e0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-page/two-column-page.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-two-column-page', - templateUrl: './two-column-page.component.html', - styleUrls: ['./two-column-page.component.scss'], - standalone: true, - imports: [forwardRef(() => ComponentMapperComponent)] -}) -export class TwoColumnPageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - } - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.html b/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.html deleted file mode 100644 index 8de39784..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
- -
-
-
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.scss b/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.scss deleted file mode 100644 index 0c5353ce..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.scss +++ /dev/null @@ -1,29 +0,0 @@ -* { - box-sizing: border-box; - } - - .psdk-two-column { - display: flow-root; - height: 100%; - } - - /* Create two equal columns that floats next to each other */ - .psdk-two-column-column { - width: 50%; - float: left; - padding: 0rem 0.3125rem; - height: 100%; - } - - .psdk-two-column-left { - float: left; - min-width: 50%; - padding: 0rem 0.3125rem; - } - - .psdk-two-column-right { - float: left; - width: 50%; - padding: 0rem 0.3125rem; - } - \ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.spec.ts deleted file mode 100644 index beeb2b23..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TwoColumnTabComponent } from './two-column-tab.component'; - -describe('TwoColumnTabComponent', () => { - let component: TwoColumnTabComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TwoColumnTabComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TwoColumnTabComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.ts b/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.ts deleted file mode 100644 index a6b785dd..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column-tab/two-column-tab.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; -import { ViewComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-two-column-tab', - templateUrl: './two-column-tab.component.html', - styleUrls: ['./two-column-tab.component.scss'], - standalone: true, - imports: [CommonModule, RegionComponent, forwardRef(() => ViewComponent)] -}) -export class TwoColumnTabComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit(): void { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column/config.json b/tests/assets/components/createAll/override-sdk/template/two-column/config.json deleted file mode 100644 index f883c2dc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column/config.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "TwoColumn", - "label": "Two column", - "description": "TwoColumn Template", - "type": "Template", - "subtype": "FORM", - "icon": "TwoColumn.svg", - "properties": [ - { - "name": "A", - "label": "Region A", - "format": "CONTENTPICKER" - }, - { - "name": "B", - "label": "Region B", - "format": "CONTENTPICKER" - }, - { - "label": "Conditions", - "format": "GROUP", - "properties": [ - { - "name": "required", - "label": "Required", - "format": "REQUIRED", - "saveToReference": true - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED", - "saveToReference": true - }, - { - "name": "visibility", - "label": "Visibility", - "format": "VISIBILITY", - "saveToReference": true - } - ] - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.html b/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.html deleted file mode 100644 index 0b639153..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.scss b/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.scss deleted file mode 100644 index a26771fe..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.scss +++ /dev/null @@ -1,28 +0,0 @@ -* { - box-sizing: border-box; -} - -.psdk-two-column { - display: flow-root; - height: 100%; -} - -/* Create two equal columns that floats next to each other */ -.psdk-two-column-column { - width: 50%; - float: left; - padding: 0rem 0.3125rem; - height: 100%; -} - -.psdk-two-column-left { - float: left; - min-width: 50%; - padding: 0rem 0.3125rem; -} - -.psdk-two-column-right { - float: left; - width: 50%; - padding: 0rem 0.3125rem; -} diff --git a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.spec.ts deleted file mode 100644 index 1d21d387..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TwoColumnComponent } from './two-column.component'; - -describe('TwoColumnComponent', () => { - let component: TwoColumnComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TwoColumnComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TwoColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.ts b/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.ts deleted file mode 100644 index 8a5bbad0..00000000 --- a/tests/assets/components/createAll/override-sdk/template/two-column/two-column.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component, OnInit, Input, forwardRef, SimpleChanges, OnChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-two-column', - templateUrl: './two-column.component.html', - styleUrls: ['./two-column.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class TwoColumnComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.html b/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.html deleted file mode 100644 index 6ec5bf76..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
-
- -
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.scss b/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.scss deleted file mode 100644 index 329b81cc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -* { - box-sizing: border-box; -} - -.psdk-narrow-wide-column { - display: flow-root; - height: 100%; -} - -.psdk-narrow-column { - float: left; - min-width: 30%; - padding: 0rem 0.3125rem; -} - -.psdk-wide-column { - float: left; - width: 70%; - padding: 0rem 0.3125rem; -} diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.spec.ts b/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.spec.ts deleted file mode 100644 index 364f0cc8..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { WideNarrowFormComponent } from './wide-narrow-form.component'; - -describe('WideNarrowFormComponent', () => { - let component: WideNarrowFormComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ WideNarrowFormComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(WideNarrowFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.ts b/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.ts deleted file mode 100644 index 48d179cc..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-form/wide-narrow-form.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component, OnInit, Input, forwardRef, OnChanges, SimpleChanges } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { RegionComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-wide-narrow-form', - templateUrl: './wide-narrow-form.component.html', - styleUrls: ['./wide-narrow-form.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => RegionComponent)] -}) -export class WideNarrowFormComponent implements OnInit, OnChanges { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - configProps$: Object; - arChildren$: Array; - - constructor() {} - - ngOnInit() { - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.arChildren$ = this.pConn$.getChildren(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.html b/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.html deleted file mode 100644 index 391ee973..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.html +++ /dev/null @@ -1,6 +0,0 @@ -
- - - -
WideNarrowPage missing: {{ this.pConn$.getComponentName() }}
-
diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.scss b/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.ts b/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.ts deleted file mode 100644 index 0acb2152..00000000 --- a/tests/assets/components/createAll/override-sdk/template/wide-narrow-page/wide-narrow-page.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormGroup } from '@angular/forms'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -@Component({ - selector: 'app-wide-narrow-page', - templateUrl: './wide-narrow-page.component.html', - styleUrls: ['./wide-narrow-page.component.scss'], - standalone: true, - imports: [CommonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class WideNarrowPageComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - @Input() displayOnlyFA$; - - thePConnType: string = ''; - - // Used with AngularPConnect - angularPConnectData: any = {}; - - constructor(private angularPConnect: AngularPConnectService) {} - - ngOnInit(): void { - // normalize the pConn$ in case the incoming pConn$ is a 'reference' - //this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); - - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - //this.updateSelf(); - this.checkAndUpdate(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - onStateChange() { - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - updateSelf() { - // console.log(`WideNarrowPage: updateSelf`); - - this.thePConnType = this.pConn$.getComponentName(); - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/_widget.md b/tests/assets/components/createAll/override-sdk/widget/_widget.md deleted file mode 100644 index 8acacb0a..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/_widget.md +++ /dev/null @@ -1,6 +0,0 @@ -# The **override-sdk/widget** directory - -The **src/components/override-sdk/widget** directory contains the code for **widget** components for which you want to override the default implementation for use with the **Angular SDK**. - -When you run the **npm run create** command to override the default implementation of a **widget** component, the generated code that you can use as a -starting point for your component development will be placed in type-specific and component-specific folders in **src/components/override-sdk/widget**. diff --git a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.html b/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.html deleted file mode 100644 index d803f52b..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-

{{ header$ }}

-
-

{{ description$ }}

-
-

{{ label$ }}

-
    -
  • {{ detail }}
  • -
-
-
- See what's new -
diff --git a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.scss b/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.scss deleted file mode 100644 index b13ef7ea..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.scss +++ /dev/null @@ -1,19 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -h2 { - font-size: 1.2rem; - margin-block-start: 0rem; -} - -h3 { - font-size: 1.1rem; -} -ul { - padding-inline-start: 20px; -} -.psdk-announcement { - background-color: $app-primary-light-color; - padding: 1rem; - margin: 0.5rem; - border-radius: 0.6125rem; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.spec.ts deleted file mode 100644 index 53e1e79c..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AppAnnouncementComponent } from './app-announcement.component'; - -describe('AppAnnouncementComponent', () => { - let component: AppAnnouncementComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AppAnnouncementComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AppAnnouncementComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.ts b/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.ts deleted file mode 100644 index 91ee8d2e..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/app-announcement/app-announcement.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; - -@Component({ - selector: 'app-app-announcement', - templateUrl: './app-announcement.component.html', - styleUrls: ['./app-announcement.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule] -}) -export class AppAnnouncementComponent implements OnInit { - @Input() pConn$: any; - - header$: string; - description$: string; - arDetails$: Array; - label$: string; - whatsnewlink$: string; - - constructor() {} - - ngOnInit(): void { - let configProps = this.pConn$.getConfigProps(); - - this.header$ = configProps.header; - this.description$ = configProps.description; - this.arDetails$ = configProps.details; - this.label$ = configProps.label; - this.whatsnewlink$ = configProps.whatsnewlink; - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/app-announcement/config.json b/tests/assets/components/createAll/override-sdk/widget/app-announcement/config.json deleted file mode 100644 index f90c8518..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/app-announcement/config.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "AppAnnouncement", - "label": "App announcement", - "description": "App announcement widget", - "type": "Widget", - "subtype": "PAGE", - "properties": [ - { - "name": "header", - "label": "Header text", - "format": "TEXT", - "defaultValue": "@ENV APPLICATION_DESC" - }, - { - "name": "description", - "label": "description", - "format": "TEXT", - "defaultValue": "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of the Constellation design system." - }, - { - "name": "whatsnewlink", - "label": "What's New Link", - "format": "TEXT", - "defaultValue": "https://design.pega.com" - }, - { - "name": "image", - "label": "Image url", - "format": "TEXT", - "defaultValue": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+" - }, - { - "name": "datasource", - "label": "Data source for details", - "defaultValue": "@DATASOURCE D_pyAnnouncements.pxResults", - "format": "DATASOURCE", - "required": true, - "properties": [ - { - "name": "name", - "label": "Label", - "defaultValue": "@P .pyLabel" - } - ] - } - ], - "defaultConfig": {} -} diff --git a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.html b/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.html deleted file mode 100644 index d4efcbcd..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.html +++ /dev/null @@ -1,25 +0,0 @@ -
- - - -
- - - - - {{ validatemessage }} -
- -
- - - - -
-
\ No newline at end of file diff --git a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.scss b/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.scss deleted file mode 100644 index 22f4c342..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.scss +++ /dev/null @@ -1,57 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.progress-spinner { - text-align: center; - position: absolute; - left: 45%; -} - -.psdk-modal-file-selector { - border: 1px dashed $app-neutral-dark-color; - width: 100%; - padding: 0.3rem; - text-align: center; - position: relative; -} - -.label-required::after { - display: inline; - content: " *"; - vertical-align: top; - color: $app-neutral-dark-color; -} - -.file-error { - color: $app-error-light-color; -} - -.psdk-modal-file-selector-error{ - border: 1px dashed $app-error-light-color; - width: 100%; - padding: 0.3rem; - text-align: center; - position: relative; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-label-readonly { - opacity: 54%; - font-size: 0.8rem; - font-weight: 400; -} - -.psdk-data-readonly { - padding-top: 0.625rem; - width: 100%; -} - -.psdk-attachment-list { - border: 1px solid $app-neutral-color; -} - -::ng-deep .mat-mdc-form-field-infix { - width: auto; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.spec.ts deleted file mode 100644 index 7aa6eb12..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { AttachmentComponent } from './attachment.component'; - -describe('AttachmentComponent', () => { - let component: AttachmentComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ AttachmentComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AttachmentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.ts b/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.ts deleted file mode 100644 index 54862dab..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/attachment/attachment.component.ts +++ /dev/null @@ -1,535 +0,0 @@ -import { Component, OnInit, Input, NgZone, forwardRef } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import download from 'downloadjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-attachment', - templateUrl: './attachment.component.html', - styleUrls: ['./attachment.component.scss'], - standalone: true, - imports: [CommonModule, MatProgressSpinnerModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)] -}) -export class AttachmentComponent implements OnInit { - @Input() pConn$: any; - @Input() formGroup$: FormGroup; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - PCoreVersion: string; - - label$: string = ''; - value$: any; - bRequired$: boolean = false; - bReadonly$: boolean = false; - bDisabled$: boolean = false; - bVisible$: boolean = true; - bLoading$: boolean = false; - arFiles$: Array = []; - arFileList$: Array = []; - removeFileFromList$: any; - arMenuList$: Array = []; - bShowSelector$: boolean = true; - bShowJustDelete$: boolean = false; - att_valueRef: any; - att_categoryName: string; - att_id: string; - myFiles: any; - fileTemp: any = {}; - caseID: any; - status: any; - validatemessage: any = ''; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils, private ngZone: NgZone) {} - - ngOnInit(): void { - // // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.removeFileFromList$ = { onClick: this._removeFileFromList.bind(this) }; - this.PCoreVersion = this.PCore$.getPCoreVersion(); - - this.caseID = this.PCore$.getStoreValue('.pyID', 'caseInfo.content', this.pConn$.getContextName()); - - //let configProps: any = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - this.checkAndUpdate(); - } - - checkAndUpdate() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - - ngOnDestroy(): void { - // this.att_id = ''; - - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - - this.PCore$.getPubSubUtils().unsubscribe(this.PCore$.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, this.caseID); - } - - // Callback passed when subscribing to store change - onStateChange() { - this.checkAndUpdate(); - } - - updateSelf() { - let configProps: any = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - let stateProps: any = this.pConn$.getStateProps(); - - const { value, validatemessage, label, helperText } = configProps; - - if (configProps['required'] != null) { - this.bRequired$ = this.utils.getBooleanValue(configProps['required']); - } - if (configProps['visibility'] != null) { - this.bVisible$ = this.utils.getBooleanValue(configProps['visibility']); - } - - // disabled - if (configProps['disabled'] != undefined) { - this.bDisabled$ = this.utils.getBooleanValue(configProps['disabled']); - } - - if (configProps['readOnly'] != null) { - this.bReadonly$ = this.utils.getBooleanValue(configProps['readOnly']); - } - - this.label$ = label; - this.value$ = value; - this.status = stateProps.status; - this.validatemessage = stateProps.validateMessage; - - /* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */ - let { required, disabled } = configProps; - [required, disabled] = [required, disabled].map( - (prop) => prop === true || (typeof prop === 'string' && prop === 'true') - ); - - this.att_categoryName = ''; - if (value && value.pyCategoryName) { - this.att_categoryName = value.pyCategoryName; - } - - this.att_valueRef = this.pConn$.getStateProps().value; - this.att_valueRef = this.att_valueRef.indexOf('.') === 0 ? this.att_valueRef.substring(1) : this.att_valueRef; - - // let this.fileTemp: any = {}; - - if (value && value.pxResults && +value.pyCount > 0) { - this.fileTemp = this.buildFilePropsFromResponse(value.pxResults[0]); - - if (this.fileTemp.responseProps) { - if (!this.pConn$.attachmentsInfo) { - this.pConn$.attachmentsInfo = { - type: 'File', - attachmentFieldName: this.att_valueRef, - category: this.att_categoryName, - }; - } - - if (this.fileTemp.responseProps.pzInsKey && !this.fileTemp.responseProps.pzInsKey.includes('temp')) { - this.fileTemp.props.type = this.fileTemp.responseProps.pyMimeFileExtension; - this.fileTemp.props.mimeType = this.fileTemp.responseProps.pyMimeFileExtension; - this.fileTemp.props.ID = this.fileTemp.responseProps.pzInsKey; - - // create the actions for the "more" menu on the attachment - let arMenuList = new Array(); - let oMenu: any = {}; - - oMenu.icon = 'download'; - oMenu.text = 'Download'; - oMenu.onClick = () => { - this._downloadFileFromList(this.value$.pxResults[0]); - }; - arMenuList.push(oMenu); - oMenu = {}; - oMenu.icon = 'trash'; - oMenu.text = 'Delete'; - oMenu.onClick = () => { - this._removeFileFromList(this.arFileList$[0]); - }; - arMenuList.push(oMenu); - - this.arFileList$ = new Array(); - this.arFileList$.push( - this.getNewListUtilityItemProps({ - att: this.fileTemp.props, - downloadFile: null, - cancelFile: null, - deleteFile: null, - removeFile: null - }) - ); - - this.arFileList$[0].actions = arMenuList; - - this.bShowSelector$ = false; - } - if (this.fileTemp) { - const currentAttachmentList = this.getCurrentAttachmentsList(this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), - this.pConn$.getContextName()); - const index = currentAttachmentList.findIndex(element => element.props.ID === this.fileTemp.props.ID); - let tempFiles: any = []; - if (index < 0) { - tempFiles = [this.fileTemp]; - } - this.PCore$.getStateUtils().updateState( - this.pConn$.getContextName(), - this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), - [...currentAttachmentList, ...tempFiles], - { - pageReference: 'context_data', - isArrayDeepMerge: false - } - ); - } - } - } - this.PCore$.getPubSubUtils().subscribe( - this.PCore$.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, - this.resetAttachmentStoredState.bind(this), - this.caseID - ); - } - - resetAttachmentStoredState(){ - this.PCore$?.getStateUtils().updateState(this.pConn$.getContextName(), this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), undefined, { - pageReference: 'context_data', - isArrayDeepMerge: false - }); - }; - - _downloadFileFromList(fileObj: any) { - this.PCore$.getAttachmentUtils() - .downloadAttachment(fileObj.pzInsKey, this.pConn$.getContextName()) - .then((content) => { - const extension = fileObj.pyAttachName.split('.').pop(); - this.fileDownload(content.data, fileObj.pyFileName, extension); - }) - .catch((e) => { - console.log(e); - }); - } - - fileDownload = (data, fileName, ext) => { - const file = ext ? `${fileName}.${ext}` : fileName; - download(atob(data), file); - }; - - getAttachmentKey = (name = '') => (name ? `attachmentsList.${name}` : 'attachmentsList'); - - _removeFileFromList(item: any) { - const fileIndex = this.arFileList$.findIndex((element) => element?.id === item?.id); - if (this.PCore$.getPCoreVersion()?.includes('8.7')) { - if (this.value$) { - this.pConn$.attachmentsInfo = { - type: 'File', - attachmentFieldName: this.att_valueRef, - delete: true - }; - } - if (fileIndex > -1) { - this.arFileList$.splice(fileIndex, 1); - } - } else { - const attachmentsList = []; - const currentAttachmentList = this.getCurrentAttachmentsList( - this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), - this.pConn$.getContextName() - ).filter((f) => f.label !== this.att_valueRef); - if (this.value$ && this.value$.pxResults && +this.value$.pyCount > 0) { - const deletedFile = { - type: 'File', - label: this.att_valueRef, - delete: true, - responseProps: { - pzInsKey: this.arFileList$[fileIndex].id - } - }; - // updating the redux store to help form-handler in passing the data to delete the file from server - this.PCore$.getStateUtils().updateState(this.pConn$.getContextName(), this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), [...currentAttachmentList, deletedFile], { - pageReference: 'context_data', - isArrayDeepMerge: false - }); - } else { - this.PCore$.getStateUtils().updateState(this.pConn$.getContextName(), this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), [...currentAttachmentList, ...attachmentsList], { - pageReference: 'context_data', - isArrayDeepMerge: false - }); - } - if (fileIndex > -1) { - this.arFileList$.splice(fileIndex, 1); - } - } - this.bShowSelector$ = this.arFileList$?.length > 0 ? false : true; - } - - getCurrentAttachmentsList(key, context) { - return this.PCore$.getStoreValue(`.${key}`, 'context_data', context) || []; - } - - errorHandler(isFetchCanceled){ - return (error) => { - if (!isFetchCanceled(error)) { - let uploadFailMsg = this.pConn$.getLocalizedValue('Something went wrong'); - if (error.response && error.response.data && error.response.data.errorDetails) { - uploadFailMsg = this.pConn$.getLocalizedValue(error.response.data.errorDetails[0].localizedValue); - } - this.bShowSelector$ = false; - this.myFiles[0].meta = uploadFailMsg; - this.myFiles[0].error = true; - this.myFiles[0].fileName = this.pConn$.getLocalizedValue('Unable to upload file'); - this.arFileList$ = this.myFiles.map((att) => { - return this.getNewListUtilityItemProps({ - att, - downloadFile: null, - cancelFile: null, - deleteFile: null, - removeFile: null - }); - }); - - this.bShowJustDelete$ = true; - this.bLoading$ = false; - } - throw error; - }; - }; - - uploadMyFiles(event: any) { - - this.arFiles$ = this.getFiles(event.target.files); - // convert FileList to an array - this.myFiles = Array.from(this.arFiles$); - - //alert($event.target.files[0]); // outputs the first file - - - if (this.myFiles.length == 1) { - this.bLoading$ = true; - - // this.myFiles[0].ID = undefined; - - this.PCore$.getAttachmentUtils() - .uploadAttachment(this.myFiles[0], this.onUploadProgress, this.errorHandler , this.pConn$.getContextName()) - .then((fileRes) => { - this.att_id = fileRes.ID; - - let reqObj; - if (this.PCoreVersion?.includes('8.7')) { - reqObj = { - type: 'File', - attachmentFieldName: this.att_valueRef, - category: this.att_categoryName, - ID: fileRes.ID - }; - this.pConn$.attachmentsInfo = reqObj; - } else { - reqObj = { - type: 'File', - label: this.att_valueRef, - category: this.att_categoryName, - handle: fileRes.ID, - ID: fileRes.clientFileID - }; - const currentAttachmentList = this.getCurrentAttachmentsList( - this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), - this.pConn$.getContextName() - ).filter((f) => f.label !== this.att_valueRef); - this.PCore$.getStateUtils().updateState( - this.pConn$.getContextName(), - this.getAttachmentKey(this.PCoreVersion?.includes('8.23') ? this.att_valueRef : ''), - [...currentAttachmentList, reqObj], - { - pageReference: 'context_data', - isArrayDeepMerge: false - } - ); - } - - const fieldName = this.pConn$.getStateProps().value; - const context = this.pConn$.getContextName(); - - this.PCore$.getMessageManager().clearMessages({ - type: this.PCore$.getConstants().MESSAGES.MESSAGES_TYPE_ERROR, - property: fieldName, - pageReference: this.pConn$.getPageReference(), - context - }); - this.ngZone.run(() => { - this.bShowSelector$ = false; - this.myFiles[0].meta = 'File uploaded successfully'; - this.arFileList$ = this.myFiles.map((att) => { - return this.getNewListUtilityItemProps({ - att, - downloadFile: null, - cancelFile: null, - deleteFile: null, - removeFile: null - }); - }); - - this.bShowJustDelete$ = true; - this.bLoading$ = false; - }); - }) - - .catch((error) => { - // just catching the rethrown error at uploadAttachment - // to handle Unhandled rejections - - this.bShowJustDelete$ = true; - this.bLoading$ = false - this.bShowSelector$ = false; - this.myFiles[0].meta = 'File uploaded failed'; - this.arFileList$ = this.myFiles.map((att) => { - return this.getNewListUtilityItemProps({ - att, - downloadFile: null, - cancelFile: null, - deleteFile: null, - removeFile: null - }); - }); - - this.bShowJustDelete$ = true; - this.bLoading$ = false; - }); - } - } - - getNewListUtilityItemProps = ({ att, cancelFile, downloadFile, deleteFile, removeFile }) => { - let actions; - let isDownloadable = false; - - if (att.progress && att.progress !== 100) { - actions = [ - { - id: `Cancel-${att.ID}`, - text: 'Cancel', - icon: 'times', - onClick: cancelFile - } - ]; - } else if (att.links) { - const isFile = att.type === 'FILE'; - const ID = att.ID.replace(/\s/gi, ''); - const actionsMap = new Map([ - [ - 'download', - { - id: `download-${ID}`, - text: isFile ? 'Download' : 'Open', - icon: isFile ? 'download' : 'open', - onClick: downloadFile - } - ], - [ - 'delete', - { - id: `Delete-${ID}`, - text: 'Delete', - icon: 'trash', - onClick: deleteFile - } - ] - ]); - actions = []; - actionsMap.forEach((action, actionKey) => { - if (att.links[actionKey]) { - actions.push(action); - } - }); - isDownloadable = att.links.download; - } else if (att.error) { - actions = [ - { - id: `Remove-${att.ID}`, - text: 'Remove', - icon: 'trash', - onClick: removeFile - } - ]; - } - - return { - id: att.ID, - visual: { - icon: this.utils.getIconForAttachment(att), - progress: att.progress == 100 ? undefined : att.progress - }, - primary: { - type: att.type, - name: att.error ? att.fileName : att.name, - icon: 'trash', - click: removeFile - }, - secondary: { - text: att.meta, - error: att.error - }, - actions - }; - }; - - onUploadProgress() {} - - getFiles(arFiles: Array): Array { - return this.setNewFiles(arFiles); - } - - setNewFiles(arFiles, current = []) { - let index = 0; - for (let file of arFiles) { - if (!this.validateMaxSize(file, 5)) { - file.error = true; - file.meta = 'File is too big. Max allowed size is 5MB.'; - } - file.mimeType = file.type; - file.icon = this.utils.getIconFromFileType(file.type); - file.ID = `${new Date().getTime()}I${index}`; - index++; - } - - return arFiles; - } - - validateMaxSize(fileObj, maxSizeInMB): boolean { - const fileSize = (fileObj.size / 1048576).toFixed(2); - return fileSize < maxSizeInMB; - } - - buildFilePropsFromResponse(respObj) { - return { - props: { - meta: `${respObj.pyCategoryName}, ${respObj.pxCreateOperator}`, - name: respObj.pyAttachName, - icon: this.utils.getIconFromFileType(respObj.pyMimeFileExtension) - }, - responseProps: { - ...respObj - } - }; - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/attachment/config.json b/tests/assets/components/createAll/override-sdk/widget/attachment/config.json deleted file mode 100644 index d0a4514e..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/attachment/config.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "Attachment", - "description": "Attachment", - "type": "Field", - "subtype": "DATA_CAPTURE", - "icon": "images/pz-text-input-active.svg", - "properties": [ - { - "name": "label", - "label": "Label value", - "format": "TEXT" - }, - { - "name": "helperText", - "label": "Helper text", - "format": "TEXT" - }, - { - "name": "visibility", - "label": "Visible", - "format": "VISIBILITY" - }, - { - "name": "disabled", - "label": "Disabled", - "format": "DISABLED" - }, - { - "name": "required", - "label": "Required", - "format": "REQUIRED" - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.html b/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.html deleted file mode 100644 index f68fa036..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

{{ configProps$.label }}

- - - - - - - - -
{{ dCol.label }}{{ element[dCol.fieldName] }}
-
diff --git a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.scss b/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.scss deleted file mode 100644 index f9eafd57..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -table { - width: 100%; -} - -.mat-mdc-row .mat-mdc-cell { - text-align: left; -} - -.psdk-search { - padding-left: 0.625rem; -} - -.psdk-icon-search { - vertical-align: sub; - padding: 0rem 0.125rem; - min-width: unset; - width: 1.1rem; -} - -.psdk-case-history-title { - margin-left: 0.5rem; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.spec.ts deleted file mode 100644 index d70c9208..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CaseHistoryComponent } from './case-history.component'; - -describe('CaseHistoryComponent', () => { - let component: CaseHistoryComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ CaseHistoryComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(CaseHistoryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.ts b/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.ts deleted file mode 100644 index 30c2df5d..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/case-history/case-history.component.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatTableDataSource, MatTableModule } from '@angular/material/table'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-case-history', - templateUrl: './case-history.component.html', - styleUrls: ['./case-history.component.scss'], - standalone: true, - imports: [CommonModule, MatTableModule] -}) -export class CaseHistoryComponent implements OnInit { - @Input() pConn$: any; - - PCore$: any; - configProps$: any; - - repeatList$: MatTableDataSource; - fields$: Array; - displayedColumns$ = Array(); - waitingForData: boolean = false; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.configProps$ = this.pConn$.getConfigProps(); - - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - const dataViewName = 'D_pyWorkHistory'; - const context = this.pConn$.getContextName(); - - this.waitingForData = true; - - const caseHistoryData = this.PCore$.getDataApiUtils().getData( - dataViewName, - `{"dataViewParameters":[{"CaseInstanceKey":"${caseID}"}]}`, - context - ); - - caseHistoryData.then((historyJSON: Object) => { - this.fields$ = [ - { label: 'Date', type: 'DateTime', fieldName: 'pxTimeCreated' }, - { label: 'Description', type: 'TextInput', fieldName: 'pyMessageKey' }, - { label: 'User', type: 'TextInput', fieldName: 'pyPerformer' } - ]; - - const tableDataResults = this.updateData(historyJSON['data'].data, this.fields$); - - this.displayedColumns$ = this.getDisplayColums(this.fields$); - - this.repeatList$ = new MatTableDataSource(tableDataResults); - - this.waitingForData = false; - }); - } - - ngOnDestroy() {} - - updateFields(arFields, arColumns): Array { - let arReturn = arFields; - for (let i in arReturn) { - arReturn[i].config.name = arColumns[i]; - } - - return arReturn; - } - - updateData(listData: Array, fieldData: Array): Array { - let returnList: Array = new Array(); - for (let row in listData) { - // copy - let rowData = JSON.parse(JSON.stringify(listData[row])); - - for (let field of fieldData) { - let fieldName = field['fieldName']; - let formattedDate; - - switch (field['type']) { - case 'Date': - formattedDate = this.utils.generateDate(rowData[fieldName], 'Date-Short-YYYY'); - rowData[fieldName] = formattedDate; - break; - case 'DateTime': - formattedDate = this.utils.generateDateTime(rowData[fieldName], 'DateTime-Short-YYYY'); - rowData[fieldName] = formattedDate; - break; - } - } - - returnList.push(rowData); - } - - return returnList; - } - - getDisplayColums(fields = []) { - let arReturn = fields.map((field, colIndex) => { - let theField = field.fieldName; - - return theField; - }); - return arReturn; - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/case-history/config.json b/tests/assets/components/createAll/override-sdk/widget/case-history/config.json deleted file mode 100644 index fc7a8c65..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/case-history/config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "CaseHistory", - "label": "Case history", - "description": "Case history widget", - "type": "Widget", - "subtype": "CASE", - "icon": "images/pz-url-active.svg", - "properties": [], - "defaultConfig": {} -} diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/config.json b/tests/assets/components/createAll/override-sdk/widget/feed-container/config.json deleted file mode 100644 index 40ee5a2c..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "Pulse", - "label": "Pulse", - "description": "Pulse feed widget", - "type": "Widget", - "subtype": ["PAGE", "CASE"], - "properties": [], - "defaultConfig": { - "messageIDs": "@P pulse.messageIDs" - }, - "hideModifyIcon": true -} diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-api.ts b/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-api.ts deleted file mode 100644 index 3bbf1b7d..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-api.ts +++ /dev/null @@ -1,763 +0,0 @@ -declare const PCore; - -declare const window: any; - -const FeedApi = (pConnect) => { - const { invokeRestApi, getCancelTokenSource, isRequestCanceled } = PCore.getRestClient(); - const appName = window.PCore.getEnvironmentInfo().getApplicationName(); - let mentionsTagsCancelTokenSource = []; - - const getPulseContext = (pulseContext) => { - if (pulseContext && pulseContext.indexOf('DATA-PORTAL') !== -1) { - pulseContext = `DATA-PORTAL $${appName}`; - } - return pulseContext; - }; - - const fetchMessages = (pulseContext, feedID, feedClass, feedFilters, fetchMessagesCancelTokenSource) => { - pulseContext = getPulseContext(pulseContext); - let filterBy = ''; - if (feedFilters) { - feedFilters.forEach((feedFilter) => { - if (feedFilter.on) filterBy = `${filterBy}${feedFilter.id},`; - }); - if (filterBy === '') filterBy = 'ClearFilters'; - } - const queryPayload = { - filterForContext: pulseContext, - feedID, - feedClass, - filterBy, - }; - - for (let i = 0; i < fetchMessagesCancelTokenSource.length; i += 1) { - fetchMessagesCancelTokenSource[i].cancel(); - } - const newCancelTokenSource = getCancelTokenSource(); - fetchMessagesCancelTokenSource.push(newCancelTokenSource); - - return invokeRestApi( - 'getFeedMessages', - { - queryPayload, - cancelTokenSource: newCancelTokenSource, - }, - pConnect.getContextName() - ) - .then((response) => { - if (response.status === 200 && response.data) { - fetchMessagesCancelTokenSource.pop(); - - const respMessageIDs = []; - const respMessages = {}; - const feedViewResponse = response.data; - if (response.data) { - if (response.data.data.FeedList) { - const feedItemList = response.data.data.FeedList.pxResults; - if (Array.isArray(feedItemList)) { - feedItemList.forEach((message) => { - message.ID = message.pzInsKey; - respMessageIDs.push(message.ID); - respMessages[message.ID] = message; - }); - } - } - if (!feedFilters) { - feedFilters = [{ id: 'All', label: 'All', on: 'true', disabled: false }]; - if (response.data.data.FeedFilters) { - const feedFiltersList = response.data.data.FeedFilters.pxResults; - let allFilter: any = 'true'; - if (Array.isArray(feedFiltersList)) { - feedFiltersList.forEach((feedFilter) => { - const feedFilterItem = { - id: feedFilter.pyFeedSourceReference, - label: feedFilter.pyLabel, - disabled: false, - on: feedFilter.pySelected, - }; - if (!feedFilterItem.on) allFilter = false; - feedFilters.push(feedFilterItem); - }); - - feedFilters.find((feedItem) => feedItem.id === 'All').on = allFilter; - } - } - } - } - // if filters appllied, need to reset store - if (filterBy !== '' || !pConnect.getValue(`pulse.messageIDs`)) - pConnect.updateState({ - pulse: { - messages: respMessages, - messageIDs: respMessageIDs, - feedViewResponse, - }, - }); - else - pConnect.updateState({ - pulse: { - messages: { - ...pConnect.getValue(`pulse.messages`), - ...respMessages, - }, - messageIDs: [...pConnect.getValue(`pulse.messageIDs`), ...respMessageIDs], - feedViewResponse, - }, - }); - return feedFilters; - } - - pConnect.reportError(`fetchMessages call failed ${response.status}`, response.data); - return ''; - }) - .catch((error) => { - if (!isRequestCanceled(error)) { - pConnect.reportError(': Error ocurred during ajax call at fetchMessages API : ', error.response); - } - }); - }; - - const postMessage = (pulseContext, message, attachmentIDs, isReply = false) => { - pulseContext = getPulseContext(pulseContext); - const reqBody = JSON.stringify({ - context: pulseContext, - message, - attachments: attachmentIDs, - }); - - invokeRestApi('postFeedMessages', { body: reqBody }, pConnect.getContextName()) - .then((response) => { - if (response.status === 201 && response.data) { - const messageData = response.data; - const messageObject = { - ID: messageData.ID, - pzInsKey: messageData.ID, - pyFeed: { - pyPostedOn: messageData.postedTime, - pyFeedTitle: messageData.postedByUser.name, - pyCommentContext: 'pzInsKey', - pyIconType: 'user', - pyIconReference: 'pi pi-case', - }, - postedByUser: messageData.postedByUser, - pyMessage: messageData.message, - mentions: messageData.mentions || [], - pyMessageViewReference: 'pzPostDetails', - pxIcon: 'globe', - pxResults: [], - tags: messageData.tags || [], - }; - - if (isReply) { - let pxResults = pConnect.getValue('.pxResults'); - if (!pxResults) pxResults = []; - pConnect.setValue('.pxResults', [...pxResults, messageObject]); - } else { - messageObject.pxResults = []; - if (pConnect.getValue(`pulse.messageIDs`)) { - const messageIDs = pConnect.getValue(`pulse.messageIDs`); - const messages = pConnect.getValue(`pulse.messages`); - pConnect.updateState({ - pulse: { - messages: { ...messages, [messageObject.ID]: messageObject }, - messageIDs: [messageObject.ID, ...messageIDs], - }, - }); - } else { - pConnect.updateState({ - pulse: { - messages: { [messageObject.ID]: messageObject }, - messageIDs: [messageObject.ID], - }, - }); - } - } - } else { - pConnect.reportError(`postMessage call failed with status ${response.status}`, response); - } - }) - .catch((error) => { - pConnect.reportError(': Error ocurred during ajax call at postMessage API : ', error.response); - }); - }; - - const likeMessage = ({ pulseContext, likedBy: unLiked, messageID, isReply }) => { - pulseContext = getPulseContext(pulseContext); - const routeKey = unLiked ? 'unlikeFeedMessages' : 'likeFeedMessages'; - const body = JSON.stringify({ - ContextClass: pulseContext, - }); - const queryPayload = { - pulseContext, - }; - - invokeRestApi(routeKey, { body, queryPayload }, pConnect.getContextName()) - .then((response) => { - if (response.status === 200) { - if (isReply) { - const msg = pConnect.getValue(`pulse.messages.${messageID}`); - - const pxResults = msg.pxResults.map((reply) => { - reply = { ...reply }; - if (reply.pzInsKey === pulseContext) { - let updatedLikeCount = 0; - let updatedLikedFlag = false; - const likeCount = reply.pyLikes ? reply.pyLikes.pxLikeCount : 0; - if (unLiked) { - updatedLikeCount = likeCount - 1; - updatedLikedFlag = false; - } else { - updatedLikeCount = likeCount + 1; - updatedLikedFlag = true; - } - reply.pyLikes = { - pxLikeCount: updatedLikeCount, - pxIsLiked: updatedLikedFlag, - }; - } - return reply; - }); - - pConnect.updateState({ - pulse: { - messages: { - [messageID]: { - pxResults, - }, - }, - }, - }); - } else { - const msg = { ...pConnect.getValue(`pulse.messages.${messageID}`) }; - const likeCount = msg.pyLikes ? msg.pyLikes.pxLikeCount : 0; - let updatedLikeCount = 0; - let updatedLikedFlag = false; - - if (unLiked) { - updatedLikeCount = likeCount - 1; - updatedLikedFlag = false; - } else { - updatedLikeCount = likeCount + 1; - updatedLikedFlag = true; - } - - msg.pyLikes = { - pxLikeCount: updatedLikeCount, - pxIsLiked: updatedLikedFlag, - }; - - pConnect.updateState({ - pulse: { - messages: { - [pulseContext]: msg, - }, - }, - }); - } - } else { - pConnect.reportError(`likeMessage call failed with status ${response.status}`, response); - } - }) - .catch((error) => { - pConnect.reportError(': Error ocurred during ajax call at likeMessage API : ', error.response.data); - }); - }; - - const deleteMessage = (messageID, isReply, replyID) => { - let messageKey = messageID; - if (isReply) { - messageKey = replyID; - } - const queryPayload = { - messageID: messageKey, - }; - - invokeRestApi('deleteFeedMessage', { queryPayload }, pConnect.getContextName()) - .then((response) => { - if (response.status === 200) { - if (isReply) { - const msg = pConnect.getValue(`pulse.messages.${messageID}`); - const pxResults = msg.pxResults.filter((reply) => reply.pzInsKey !== replyID); - - pConnect.updateState({ - pulse: { - messages: { - [messageID]: { - pxResults, - }, - }, - }, - }); - } else { - const msgIDs = pConnect.getValue(`pulse.messageIDs`); - const newMsgIDs = msgIDs.filter((msgID) => msgID !== messageID); - - const msgs = { ...pConnect.getValue(`pulse.messages`) }; - delete msgs[messageID]; - - pConnect.updateState({ - pulse: { - messageIDs: newMsgIDs, - messages: msgs, - }, - }); - } - } else { - pConnect.reportError(`deleteMessage call failed with status ${response.status}`, response); - } - }) - .catch((error) => { - pConnect.reportError(': Error ocurred during ajax call at deleteMessage API : ', error.response); - }); - }; - - const getMentionSuggestions = (mentionProps) => { - const { searchFor, mentionsType = 'Users', listSize = 5 } = mentionProps; - const pulseContext = getPulseContext(mentionProps.pulseContext); - const queryPayload = { - pulseContext, - searchFor, - mentionsType, - listSize, - }; - - for (let i = 0; i < mentionsTagsCancelTokenSource.length; i += 1) { - mentionsTagsCancelTokenSource[i].cancel(); - } - const newCancelTokenSource = getCancelTokenSource(); - mentionsTagsCancelTokenSource.push(newCancelTokenSource); - - return invokeRestApi( - 'getMentionSuggestions', - { - queryPayload, - cancelTokenSource: newCancelTokenSource, - }, - pConnect.getContextName() - ) - .then((response) => { - mentionsTagsCancelTokenSource = []; - let mentionSuggestions = []; - if (response.status === 200 && response.data) { - mentionSuggestions = response.data.map((mentionSuggestion) => { - return { - fullname: mentionSuggestion.caption, - id: mentionSuggestion.mentionsID, - }; - }); - } else { - pConnect.reportError(`Get mention suggestions call failed ${response.status}`, response.data); - } - return mentionSuggestions; - }) - .catch((err) => { - if (!isRequestCanceled(err)) { - pConnect.reportError(': Error ocurred during ajax call at getMentionSuggestions API : ', err.response.data); - } - }); - }; - - const getTagSuggestions = (mentionProps) => { - const { searchFor, listSize = 5 } = mentionProps; - const queryPayload = { - searchFor, - listSize, - }; - - for (let i = 0; i < mentionsTagsCancelTokenSource.length; i += 1) { - mentionsTagsCancelTokenSource[i].cancel(); - } - const newCancelTokenSource = getCancelTokenSource(); - mentionsTagsCancelTokenSource.push(newCancelTokenSource); - - return invokeRestApi( - 'getTagSuggestions', - { - queryPayload, - cancelTokenSource: newCancelTokenSource, - }, - pConnect.getContextName() - ) - .then((response) => { - mentionsTagsCancelTokenSource = []; - let tagSuggestions = []; - if (response.status === 200 && response.data) { - tagSuggestions = response.data.tags.map((tag) => `#${tag}`); - } else { - pConnect.reportError(`Get tag suggestions call failed ${response.status}`, response.data); - } - return tagSuggestions; - }) - .catch((err) => { - if (!isRequestCanceled(err)) { - pConnect.reportError(': Error ocurred during ajax call at getTagSuggestions API : ', err.response.data); - } - }); - }; - - return { - fetchMessages, - postMessage, - likeMessage, - deleteMessage, - getMentionSuggestions, - getTagSuggestions, - }; -}; - -export default FeedApi; - -// /* eslint-disable sonarjs/cognitive-complexity */ -// const FeedApi = (pConnect) => { -// const { -// invokeRestApi, -// getCancelTokenSource, -// isRequestCanceled -// } = PCore.getRestClient(); -// const appName = PCore.getEnvironmentInfo().getApplicationName(); -// let mentionsTagsCancelTokenSource = []; - -// const getPulseContext = (pulseContext) => { -// if (pulseContext && pulseContext.indexOf("DATA-PORTAL") !== -1) { -// pulseContext = `DATA-PORTAL $${appName}`; -// } -// return pulseContext; -// }; - -// const fetchMessages = (pulseContext) => { -// let filterByContext = "context"; -// if (pulseContext && pulseContext.indexOf("DATA-PORTAL") !== -1) { -// filterByContext = -// "context,pxMyBookmarkMessages,pxMyFollowedCasesFeed,pxMyMentionsFeed,pxMyProfileComments,pxMySpacesFeed,pxReplyToMyMessages,pxSpaceMentions"; -// } -// pulseContext = getPulseContext(pulseContext); -// const queryPayload = { -// filterForContext: pulseContext, -// filterByContext -// }; - -// invokeRestApi("getFeedMessages", { queryPayload }) -// .then((response) => { -// if (response.status === 200 && response.data) { -// const respMessageIDs = []; -// const respMessages = {}; -// if (response.data.messages) { -// response.data.messages.forEach((message) => { -// respMessageIDs.push(message.ID); -// respMessages[message.ID] = message; -// }); -// } -// pConnect.updateState({ -// pulse: { -// messages: respMessages, -// messageIDs: respMessageIDs -// } -// }); -// } else { -// pConnect.reportError( -// `fetchMessages call failed ${response.status}`, -// response.data -// ); -// } -// }) -// .catch((error) => { -// pConnect.reportError( -// ": Error ocurred during ajax call at fetchMessages API : ", -// error.response.data -// ); -// }); -// }; - -// const postMessage = (pulseContext, message, isReply = false) => { -// // debugger; -// pulseContext = getPulseContext(pulseContext); -// const reqBody = JSON.stringify({ -// context: pulseContext, -// message -// }); - -// invokeRestApi("postFeedMessages", { body: reqBody }) -// .then((response) => { -// // debugger; -// if (response.status === 201 && response.data) { -// const messageData = response.data; -// const messageObject = { -// ID: messageData.ID, -// postedTime: messageData.postedTime, -// postedByUser: messageData.postedByUser, -// message: messageData.message, -// mentions: messageData.mentions || [], -// tags: messageData.tags || [] -// }; - -// if (isReply) { -// // debugger; -// const replies = pConnect.getValue(".replies"); -// if (undefined === replies) { -// // Nebula/Constellation changed to have an Activity component that has a .replies property -// console.log( `--> need to fix: FeedApi: getValue(".replies"): ${replies}`); -// } else { -// // Quasar-specific workaround. Nebula/Constellation has Activity object with .replies prop -// // Note that the reply gets created and put in the db but the UI isn't properly -// // refreshed until we get this fixed. -// pConnect.setValue(".replies", [...replies, messageObject]); -// } -// } else { -// messageObject.replies = []; -// const messageIDs = pConnect.getValue(`pulse.messageIDs`); -// const messages = pConnect.getValue(`pulse.messages`); -// pConnect.updateState({ -// pulse: { -// messages: { ...messages, [messageObject.ID]: messageObject }, -// messageIDs: [messageObject.ID, ...messageIDs] -// } -// }); -// } -// } else { -// pConnect.reportError( -// `postMessage call failed with status ${response.status}`, -// response.data -// ); -// } -// }) -// .catch((error) => { -// pConnect.reportError( -// ": Error ocurred during ajax call at postMessage API : ", -// error.response.data -// ); -// }); -// }; - -// const likeMessage = ({ -// pulseContext, -// likedBy: unLiked, -// messageID, -// isReply -// }) => { -// pulseContext = getPulseContext(pulseContext); -// const routeKey = unLiked ? "unlikeFeedMessages" : "likeFeedMessages"; -// const body = JSON.stringify({ -// ContextClass: pulseContext -// }); -// const queryPayload = { -// pulseContext -// }; - -// invokeRestApi(routeKey, { body, queryPayload }) -// .then((response) => { -// if (response.status === 200) { -// if (isReply) { -// const msg = pConnect.getValue(`pulse.messages.${messageID}`); - -// const replies = msg.replies.map((reply) => { -// reply = { ...reply }; -// if (reply.ID === pulseContext) { -// const likeCount = reply.likeCount ? +reply.likeCount : 0; -// if (unLiked) { -// reply.likeCount = likeCount - 1; -// reply.likedByMe = "false"; -// } else { -// reply.likeCount = likeCount + 1; -// reply.likedByMe = "true"; -// } -// } -// return reply; -// }); - -// pConnect.updateState({ -// pulse: { -// messages: { -// [messageID]: { -// replies -// } -// } -// } -// }); -// } else { -// const msg = { ...pConnect.getValue(`pulse.messages.${messageID}`) }; -// const likeCount = msg.likeCount ? +msg.likeCount : 0; - -// if (unLiked) { -// msg.likeCount = likeCount - 1; -// msg.likedByMe = "false"; -// } else { -// msg.likeCount = likeCount + 1; -// msg.likedByMe = "true"; -// } - -// pConnect.updateState({ -// pulse: { -// messages: { -// [pulseContext]: msg -// } -// } -// }); -// } -// } else { -// pConnect.reportError( -// `likeMessage call failed with status ${response.status}`, -// response.data -// ); -// } -// }) -// .catch((error) => { -// pConnect.reportError( -// ": Error ocurred during ajax call at likeMessage API : ", -// error.response.data -// ); -// }); -// }; - -// const deleteMessage = (messageID, isReply, replyID) => { -// let messageKey = messageID; -// if (isReply) { -// messageKey = replyID; -// } -// const queryPayload = { -// messageID: messageKey -// }; - -// invokeRestApi("deleteFeedMessage", { queryPayload }) -// .then((response) => { -// if (response.status === 200) { -// if (isReply) { -// const msg = pConnect.getValue(`pulse.messages.${messageID}`); -// const replies = msg.replies.filter((reply) => reply.ID !== replyID); - -// pConnect.updateState({ -// pulse: { -// messages: { -// [messageID]: { -// replies -// } -// } -// } -// }); -// } else { -// const msgIDs = pConnect.getValue(`pulse.messageIDs`); -// const newMsgIDs = msgIDs.filter((msgID) => msgID !== messageID); - -// const msgs = { ...pConnect.getValue(`pulse.messages`) }; -// delete msgs[messageID]; - -// pConnect.updateState({ -// pulse: { -// messageIDs: newMsgIDs, -// messages: msgs -// } -// }); -// } -// } else { -// pConnect.reportError( -// `deleteMessage call failed with status ${response.status}`, -// response.data -// ); -// } -// }) -// .catch((error) => { -// pConnect.reportError( -// ": Error ocurred during ajax call at deleteMessage API : ", -// error.response.data -// ); -// }); -// }; - -// const getMentionSuggestions = (mentionProps) => { -// const { searchFor, mentionsType = "Users", listSize = 5 } = mentionProps; -// const pulseContext = getPulseContext(mentionProps.pulseContext); -// const queryPayload = { -// pulseContext, -// searchFor, -// mentionsType, -// listSize -// }; - -// for (let i = 0; i < mentionsTagsCancelTokenSource.length; i += 1) { -// mentionsTagsCancelTokenSource[i].cancel(); -// } -// const newCancelTokenSource = getCancelTokenSource(); -// mentionsTagsCancelTokenSource.push(newCancelTokenSource); - -// return invokeRestApi("getMentionSuggestions", { -// queryPayload, -// cancelTokenSource: newCancelTokenSource -// }) -// .then((response) => { -// mentionsTagsCancelTokenSource = []; -// let mentionSuggestions = []; -// if (response.status === 200 && response.data) { -// mentionSuggestions = response.data.map((mentionSuggestion) => { -// return { -// fullname: mentionSuggestion.caption, -// id: mentionSuggestion.mentionsID -// }; -// }); -// } else { -// pConnect.reportError( -// `Get mention suggestions call failed ${response.status}`, -// response.data -// ); -// } -// return mentionSuggestions; -// }) -// .catch((err) => { -// if (!isRequestCanceled(err)) { -// pConnect.reportError( -// ": Error ocurred during ajax call at getMentionSuggestions API : ", -// err.response.data -// ); -// } -// }); -// }; - -// const getTagSuggestions = (mentionProps) => { -// const { searchFor, listSize = 5 } = mentionProps; -// const queryPayload = { -// searchFor, -// listSize -// }; - -// for (let i = 0; i < mentionsTagsCancelTokenSource.length; i += 1) { -// mentionsTagsCancelTokenSource[i].cancel(); -// } -// const newCancelTokenSource = getCancelTokenSource(); -// mentionsTagsCancelTokenSource.push(newCancelTokenSource); - -// return invokeRestApi("getTagSuggestions", { -// queryPayload, -// cancelTokenSource: newCancelTokenSource -// }) -// .then((response) => { -// mentionsTagsCancelTokenSource = []; -// let tagSuggestions = []; -// if (response.status === 200 && response.data) { -// tagSuggestions = response.data.tags.map((tag) => `#${tag}`); -// } else { -// pConnect.reportError( -// `Get tag suggestions call failed ${response.status}`, -// response.data -// ); -// } -// return tagSuggestions; -// }) -// .catch((err) => { -// if (!isRequestCanceled(err)) { -// pConnect.reportError( -// ": Error ocurred during ajax call at getTagSuggestions API : ", -// err.response.data -// ); -// } -// }); -// }; - -// return { -// fetchMessages, -// postMessage, -// likeMessage, -// deleteMessage, -// getMentionSuggestions, -// getTagSuggestions -// }; -// }; - -// export default FeedApi; diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.html b/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.html deleted file mode 100644 index d2b496fc..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.html +++ /dev/null @@ -1,137 +0,0 @@ -
-
-

Pulse

- -
- -
-
-
{{ this.currentUserInitials$ }}
- - - -
-
-
- - - - - - - - -
-
-
-
-
{{ pulseMessage.displayPostedByInitials }}
-
-
{{ pulseMessage.displayPostedBy }}
-
{{ pulseMessage.displayPostedTime }}
-
-
-
{{ pulseMessage.message }}
-
-
- -
-
-
- - -
- - - -
-
- -
-
-
-
-
-
{{ replyMessage.displayPostedByInitials }}
-
{{ replyMessage.displayPostedBy }}
-
{{ replyMessage.message }}
-
-
- -
- - - -
- - - - -
{{ replyMessage.displayPostedTime }}
-
-
-
- -
-
-
-
-
{{ this.currentUserInitials$ }}
- - - - -
-
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.scss b/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.scss deleted file mode 100644 index 95ed588b..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.scss +++ /dev/null @@ -1,188 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-pulse-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-full-width { - width: 100%; - padding-left: 0.625rem; -} - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; - display: inline-block; -} - -.psdk-icon-liked-by-me { - padding: 0rem 0.125rem; - min-width: unset; - display: inline-block; - color: $app-primary-color; -} - -.psdk-send-svg-icon { - width: 1.4rem; -} - -.psdk-comment-svg-icon { - width: 1.4rem; - padding: 0rem 0.3215rem; -} - -.psdk-like-svg-icon { - width: 1.4rem; - padding: 0rem 0.3215rem; -} - -.psdk-liked-by-me-svg-icon { - width: 1.4rem; - padding: 0rem 0.3215rem; - filter: $app-primary-color-filter; -} - -.psdk-avatar { - margin: 0rem; - padding: 0rem; - min-width: 2.5rem; - min-height: 2.5rem; - max-width: 2.5rem; - max-height: 2.5rem; - border-radius: 50%; - justify-content: center; - align-items: center; - text-align: center; - display: flex; - background: $app-primary-color; - color: white; - font-weight: bold; - font-size: 1.25rem; -} - -.psdk-avatar-big { - margin: 0rem; - padding: 0rem; - min-width: 3.125rem; - min-height: 3.125rem; - max-width: 3.125rem; - max-height: 3.125rem; - border-radius: 50%; - justify-content: center; - align-items: center; - text-align: center; - display: flex; - background: $app-primary-color; - color: white; - font-weight: bold; - font-size: 1.5625rem; -} - -.psdk-pulse { - display: inline-flex; - width: 100%; - padding-bottom: 0.625rem; -} - -.psdk-pulse-message-group { - display: flex; - flex-direction: column; - padding-left: 0.625rem; -} - -.psdk-pulse-message-by { - margin-bottom: 0rem; - font-weight: bold; - font-size: 0.9375rem; -} - -.psdk-pulse-message-time { - color: #aaaaaa; -} - -.psdk-pulse-message-text { - white-space: pre-line; -} - -.psdk-pulse-message-actions { - display: flex; - flex-direction: row; - padding-top: 1.25rem; -} - -.psdk-pulse-message-action-group { - flex-basis: 15em; -} - -.psdk-pulse-message-action-like { - flex-basis: 15em; -} - -.psdk-pulse-message-like-label { - vertical-align: middle; -} - -.psdk-pulse-reply { - padding-left: 1.25rem; -} - -.psdk-pulse-reply-align { - text-align: left; -} - -.psdk-pulse-reply-group { - display: flex; - flex-direction: row; - align-items: center; -} - -.psdk-pulse-reply-by { - padding: 0rem 0.625rem; - font-weight: bold; - font-size: 0.9375rem; -} - -.psdk-pulse-reply-message { - background-color: #dddddd; - border-radius: 0.625rem; - padding: 0rem 1.25rem; - white-space: pre-line; -} - -.psdk-pulse-reply-actions { - display: flex; - flex-direction: row; - align-items: center; - padding-left: 3.125rem; -} - -.psdk-pulse-reply-comment { - padding: 0rem; - min-width: 1.875rem; -} - -.psdk-pulse-reply-like { - padding: 0rem; - min-width: 1.875rem; -} - -.psdk-pulse-reply-like-label { - vertical-align: middle; - padding-right: 0.3125rem; -} - -.psdk-pulse-reply-time { - color: #aaaaaa; - padding-left: 0.625rem; -} - -.psdk-pulse-comment-group { - display: flex; - flex-direction: row; - align-items: center; -} - -.psdk-pulse-comment-post { - padding: 0rem; - min-width: 1.875rem; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.spec.ts deleted file mode 100644 index 187f7806..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { FeedContainerComponent } from './feed-container.component'; - -describe('FeedContainerComponent', () => { - let component: FeedContainerComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ FeedContainerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FeedContainerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.ts b/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.ts deleted file mode 100644 index 830ed216..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/feed-container/feed-container.component.ts +++ /dev/null @@ -1,615 +0,0 @@ -import { Component, OnInit, Input, ChangeDetectorRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatGridListModule } from '@angular/material/grid-list'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import isEqual from 'fast-deep-equal'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import FeedApi from './feed-api'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-feed-container', - templateUrl: './feed-container.component.html', - styleUrls: ['./feed-container.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, MatFormFieldModule, MatInputModule, MatGridListModule, MatButtonModule] -}) -export class FeedContainerComponent implements OnInit { - @Input() pConn$: any; - - // Used with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - - userName$: string; - imageKey$: string; - - currentUserInitials$: string; - currentUserName$: string; - - pulseMessages$: Array; - showReplyComment$: Object = {}; - - svgComment$: string; - svgLike$: string; - svgLikedByMe$: string; - svgSend$: string; - - pulseConversation: string; - userData: Map = new Map(); - - pulseComment: Object = {}; - - // functions - actionsAPI: any; - // until FeedAPI moved back to PCore, we access the methods directly (see ngInit) - feedAPI: any; - - pulseData: any; - - // Temporary way to use FeedApi... - fetchMessages: any; - likeMessage: any; - postMessage: any; - - constructor( - private angularPConnect: AngularPConnectService, - private cdRef: ChangeDetectorRef, - private utils: Utils - ) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.userName$ = this.PCore$.getEnvironmentInfo().getOperatorName(); - this.imageKey$ = this.PCore$.getEnvironmentInfo().getOperatorImageInsKey(); - this.updateCurrentUserName(this.userName$); - - // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - // Then, continue on with other initialization - // debugger; - - // const { - // fetchMessages, - // likeMessage, - // postMessage - // } = FeedApi(this.pConn$); - // this.fetchMessages = fetchMessages; - // this.likeMessage = likeMessage; - // this.postMessage = postMessage; - - // // this.userName$ = this.pConn$.getValue("pxRequestor.pxUserName"); - // // this.imageKey$ = this.pConn$.getValue("OperatorID.pyImageInsKey"); - - // //this.userName$ = this.pConn$.getDataObject()["D_pxEnvironmentInfo"].pxOperator.pyUserName; - // //this.imageKey$ = this.pConn$.getDataObject()["D_pxEnvironmentInfo"].pxOperator.pyImageInsKey; - // this.userName$ = this.pConn$.getEnvironmentInfo().getOperatorName(); - // this.imageKey$ = this.pConn$.getEnvironmentInfo().getOperatorImageInsKey(); - - // this.actionsAPI = this.pConn$.getActionsApi(); - - // let owner = this.pConn$.getConfigProps().value; - - // // with new FeedAPI: owner is the proper value to pass in - // // and no longer takes 2nd argument - // this./*feedAPI.*/fetchMessages(owner /*, this.pConn$.getContextName()*/); - - let configProps = this.pConn$.getConfigProps(); - - const { messageIDs } = configProps; - - const { fetchMessages, postMessage, getMentionSuggestions, getTagSuggestions } = FeedApi(this.pConn$); - - const appName = this.PCore$.getEnvironmentInfo().getApplicationName(); - let value = ''; - let feedID = ''; - let feedClass = ''; - - if (this.pConn$.getCaseSummary().ID) { - value = this.pConn$.getCaseSummary().ID; - feedID = 'pyCaseFeed'; - feedClass = this.pConn$.getCaseSummary().content.classID; - } else { - value = `DATA-PORTAL $${appName}`; - feedID = 'pyDashboardFeed'; - feedClass = '@baseclass'; - } - - const onUploadProgress = () => {}; - const errorHandler = () => {}; - const attachments = () => {}; - - const postComment = ({ value: message, clear }) => { - const attachmentIDs = []; - const attachmentUtils = this.PCore$.getAttachmentUtils(); - if (attachments && !!attachments.length) { - attachments; /* - .filter((file) => !file.error) - .map((file) => { - return attachmentUtils - .uploadAttachment(file, onUploadProgress, errorHandler) - .then((fileResponse) => { - const fileConfig = { - type: "File", - category: "File", - fileName: file.name, - ID: fileResponse.data.ID - }; - attachmentIDs.push(fileConfig); - if (attachments.length === attachmentIDs.length) { - postMessage( - value, - transformMarkdownToMsg(message), - attachmentIDs - ); - clear(); - setAttachments([]); - } - }) - - .catch(console.error); - }); */ - } else { - //postMessage(value, transformMarkdownToMsg(message)); - clear(); - } - }; - - /* - - const { getPConnect, messageIDs } = props; - const [mentionResults, setMentionResults] = useState([]); - const [tagResults, setTagResults] = useState([]); - const [attachments, setAttachments] = useState([]); - const [feedFilters, setFeedFilters] = useState(); - const { - fetchMessages, - postMessage, - getMentionSuggestions, - getTagSuggestions - } = FeedApi(getPConnect()); - const appName = PCore.getEnvironmentInfo().getApplicationName(); - let value = ""; - let feedID = ""; - let feedClass = ""; - if (getPConnect().getCaseSummary().ID) { - value = getPConnect().getCaseSummary().ID; - feedID = "pyCaseFeed"; - feedClass = getPConnect().getCaseSummary().content.classID; - } else { - value = `DATA-PORTAL $${appName}`; - feedID = "pyDashboardFeed"; - feedClass = "@baseclass"; - } - // For cancelling fetchrequest for filetrs - const fetchMessagesCancelTokenSource = useRef([]); - - useEffect(() => { - fetchMessages( - value, - feedID, - feedClass, - null, - fetchMessagesCancelTokenSource.current - ).then((res) => { - setFeedFilters(res); - }); - PCore.getAssetLoader().getLoader("component-loader")(["Activity"]); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - const onUploadProgress = useCallback((file) => { - return ({ loaded, total }) => { - file.progress = Math.floor((loaded / total) * 100); - setAttachments((current) => { - return current.map((currFile) => { - return currFile.name === file.name ? file : currFile; - }); - }); - }; - }, []); - - const errorHandler = useCallback((isFetchCanceled, file) => { - return (error) => { - if (!isFetchCanceled(error)) { - let localizedValue = "Upload failed"; - if ( - error.response && - error.response.data && - error.response.data.errorDetails - ) { - localizedValue = error.response.data.errorDetails[0].localizedValue; - } - delete file.progress; - setAttachments((current) => { - return current.map((currFile) => { - if (currFile.name === file.name) { - currFile.meta = localizedValue; - currFile.error = true; - } - return currFile; - }); - }); - error.isHandled = true; - } - throw error; - }; - }, []); - - const postComment = ({ value: message, clear }) => { - const attachmentIDs = []; - const attachmentUtils = window.PCore.getAttachmentUtils(); - if (attachments && !!attachments.length) { - attachments - .filter((file) => !file.error) - .map((file) => { - return attachmentUtils - .uploadAttachment(file, onUploadProgress, errorHandler) - .then((fileResponse) => { - const fileConfig = { - type: "File", - category: "File", - fileName: file.name, - ID: fileResponse.data.ID - }; - attachmentIDs.push(fileConfig); - if (attachments.length === attachmentIDs.length) { - postMessage( - value, - transformMarkdownToMsg(message), - attachmentIDs - ); - clear(); - setAttachments([]); - } - }) - - .catch(console.error); - }); - } else { - postMessage(value, transformMarkdownToMsg(message)); - clear(); - } - }; - - */ - - /* On search is called when @ character is entered and will display the mention */ - - /* - const onSearch = debounce((event) => { - if (event.type === "mention") { - getMentionSuggestions({ - pulseContext: value, - searchFor: event.search - }).then((res) => { - setMentionResults(res); - }); - } else { - getTagSuggestions({ - searchFor: event.search - }).then((res) => { - setTagResults(res); - }); - } - }, 150); - - const userName = getPConnect().getEnvironmentInfo().getOperatorName(); - const imageKey = getPConnect().getEnvironmentInfo().getOperatorImageInsKey(); - - const onFilesAdded = useCallback((newlyAddedFiles) => { - setAttachments((current) => [ - ...newlyAddedFiles.map((file) => { - if (!validateMaxSize(file, 5)) { - file.error = true; - file.meta = "File is too big. Max allowed size is 5MB."; - } - file.icon = getIconFromFileType(file.type); - file.onDelete = () => { - setAttachments((c) => c.filter((f) => f.name !== file.name)); - }; - return file; - }), - ...current - ]); - }, []); - - const onFilterChange = useCallback( - (filterID) => { - const updatedFilters = [...feedFilters]; - const filterToUpdate = updatedFilters.find( - (feedItem) => feedItem.id === filterID - ); - filterToUpdate.on = !filterToUpdate.on; - if (filterID === "All") - updatedFilters.forEach((feedFilter) => { - feedFilter.on = filterToUpdate.on; - }); - else if ( - updatedFilters.find( - (feedItem) => feedItem.on === false && feedItem.id !== "All" - ) - ) - updatedFilters.find((feedItem) => feedItem.id === "All").on = false; - else updatedFilters.find((feedItem) => feedItem.id === "All").on = true; - setFeedFilters(updatedFilters); - fetchMessages( - value, - feedID, - feedClass, - feedFilters, - fetchMessagesCancelTokenSource.current - ); - }, - [ - value, - feedID, - feedClass, - feedFilters, - fetchMessagesCancelTokenSource, - fetchMessages - ] - ); - - */ - - // set up svg images - this.svgComment$ = this.utils.getImageSrc('chat', this.utils.getSDKStaticContentUrl()); - this.svgLike$ = this.utils.getImageSrc('thumbs-up', this.utils.getSDKStaticContentUrl()); - this.svgLikedByMe$ = this.utils.getImageSrc('thumbs-up-solid', this.utils.getSDKStaticContentUrl()); - this.svgSend$ = this.utils.getImageSrc('send', this.utils.getSDKStaticContentUrl()); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - const bLogging = false; - if (bLogging) { - //console.log( `in ${this.constructor.name} onStateChange` ); - // debugger; - } - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - // console.log( `${this.constructor.name} shouldComponentUpdate: ${bUpdateSelf}`); - - // ONLY call updateSelf when the component should update - // AND removing the "gate" that was put there since shouldComponentUpdate - // should be the real "gate" - if (bUpdateSelf) { - this.updateSelf(); - } else { - let newPulseData = this.pConn$.getDataObject().pulse; - - if (!isEqual(newPulseData, this.pulseData)) { - this.updateSelf(); - } - } - - this.pulseData = this.pConn$.getDataObject().pulse; - } - - updateSelf() { - this.getMessageData(); - } - - getMessageData() { - let messageIDs = this.pConn$.getConfigProps().messageIDs; - let userName = this.pConn$.getConfigProps().currentUser; - let imageKey = this.pConn$.getValue('OperatorID.pyImageInsKey'); - - let oData = this.pConn$.getDataObject(); - - if (messageIDs && messageIDs.length > 0) { - this.pulseMessages$ = JSON.parse(JSON.stringify(oData.pulse.messages)); - - // convert to just an array of objects - this.pulseMessages$ = this.convertToArray(this.pulseMessages$); - - // create a copy, so we can modify - this.pulseMessages$ = this.appendPulseMessage(this.pulseMessages$); - - // most recent on top - this.pulseMessages$ = this.pulseMessages$.sort((a, b) => (a.updateTimeUTC < b.updateTimeUTC ? 1 : -1)); - } - } - - convertToArray(messages: Array): Array { - let arMessages: Array = new Array(); - - for (let message in messages) { - arMessages.push(messages[message]); - } - - return arMessages; - } - - appendPulseMessage(messages: Array): Array { - for (let i in messages) { - let message = messages[i]; - let postedTime = message['postedTime']; - let updatedTime = message['updatedTime']; - - this.showReplyComment$[message.ID] = false; - - message['displayPostedTime'] = this.utils.generateDateTime(postedTime, 'DateTime-Since'); - - // for sorting lasted update - if (updatedTime != null) { - message['updateTimeUTC'] = new Date(updatedTime).getTime(); - } else { - message['updateTimeUTC'] = new Date(postedTime).getTime(); - } - - message['displayPostedBy'] = message.postedByUser.name; - message['displayPostedByInitials'] = this.utils.getInitials(message.postedByUser.name); - - // if didn't break, the look at the replies - for (let iR in message.replies) { - let reply = message.replies[iR]; - - let replyPostedTime = reply['postedTime']; - reply['displayPostedTime'] = this.utils.generateDateTime(postedTime, 'DateTime-Since'); - - //let oReplyUser = this.userData.get(reply.postedByUser); - let oReplyUser = reply.postedByUser; - - if (oReplyUser) { - reply['displayPostedBy'] = oReplyUser.name; - reply['displayPostedByInitials'] = this.utils.getInitials(oReplyUser.name); - } - } - } // for - - return messages; - } - - updateMessagesWithOperators() { - for (let i in this.pulseMessages$) { - let message = this.pulseMessages$[i]; - - let postedTime = message['postedTime']; - - this.showReplyComment$[message.ID] = false; - - message['displayPostedTime'] = this.utils.generateDateTime(postedTime, 'DateTime-Since'); - - let oUser = this.userData.get(message.postedBy); - - if (oUser) { - message['displayPostedBy'] = oUser.pyUserName; - message['displayPostedByInitials'] = this.utils.getInitials(oUser.pyUserName); - } else { - let oUserParams = new Object(); - oUserParams['OperatorId'] = message.postedBy; - } - - // if didn't break, the look at the replies - for (let iR in message.replies) { - let reply = message.replies[iR]; - - let replyPostedTime = reply['postedTime']; - reply['displayPostedTime'] = this.utils.generateDateTime(postedTime, 'DateTime-Since'); - - //let oReplyUser = this.userData.get(reply.postedByUser); - let oReplyUser = reply.postedByUser; - - if (oReplyUser) { - reply['displayPostedBy'] = oReplyUser.name; - reply['displayPostedByInitials'] = this.utils.getInitials(oReplyUser.name); - } - } - } // for - } - - updateCurrentUserName(sUser: string) { - this.currentUserInitials$ = this.utils.getInitials(sUser); - this.currentUserName$ = sUser; - } - - postClick() { - // don't send a blank message - if (this.pulseConversation && this.pulseConversation != '') { - // let pulseMessage = { - // contextName : this.pConn$.getContextName(), - // message: this.pulseConversation, - // pulseContext: this.pConn$.getValue(".pzInsKey") - // }; - - // debugger; - // used to be: this./*feedAPI.*/postMessage(pulseMessage); - // With latest FeedAPI, the 1st arg should be getConfigProps().value - - // If feedAPI is defined then only post message - if (this.feedAPI) { - this./*feedAPI.*/ postMessage(this.pConn$.getConfigProps().value, this.pulseConversation); - } else { - console.log("We don't support Pulse yet"); - } - } - - // clear out local copy - document.getElementById('pulseMessage')['value'] = ''; - this.pulseConversation = ''; - } - - messageChange(event: any) { - this.pulseConversation = event.target.value; - } - - likeClick(messageID: string, rMessageID: string, bLikedByMe: boolean, level: string) { - let pulseMessage = {}; - - if (level === 'top') { - pulseMessage = { - pulseContext: rMessageID, - isReply: null, - contextName: this.pConn$.getContextName(), - likedBy: bLikedByMe, - messageID - }; - } else { - pulseMessage = { - pulseContext: rMessageID, - isReply: true, - contextName: this.pConn$.getContextName(), - likedBy: bLikedByMe, - messageID - }; - } - - // debugger; - this./*feedAPI.*/ likeMessage(pulseMessage); - } - - commentClick(messageID) { - // iterator through messages, find match, turn on comment entry - for (let i in this.pulseMessages$) { - if (this.pulseMessages$[i].ID === messageID) { - this.showReplyComment$[this.pulseMessages$[i].ID] = true; - } - } - - this.cdRef.detectChanges(); - } - - postCommentClick(messageID) { - // debugger; - - if (this.pulseComment[messageID] && this.pulseComment[messageID] != '') { - // let pulseMessage = { - // contextName : this.pConn$.getContextName(), - // message: this.pulseComment[messageID], - // pulseContext: messageID, - // reply: true - // }; - - // debugger; - // Used to be: this./*feedAPI.*/postMessage(pulseMessage); - // Latest update to API has changed and the postMessage actually gets - // the pulse context... - // used to use: contextName - // new FeedAPI wants args to be messageID, this.pulseComment[messageID], true (since this is a reply) - this./*feedAPI.*/ postMessage(messageID, this.pulseComment[messageID], true); - - this.pulseComment[messageID] = ''; - } - } - - newCommentChange(event, messageID) { - this.pulseComment[messageID] = event.target.value; - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/file-utility/config.json b/tests/assets/components/createAll/override-sdk/widget/file-utility/config.json deleted file mode 100644 index 984b6872..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/file-utility/config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "FileUtility", - "label": "Attachments", - "description": "Attachments", - "type": "Widget", - "subtype": "CASE", - "icon": "images/pz-url-active.svg", - "properties": [ - { - "name": "label", - "label": "Header text", - "format": "TEXT", - "defaultValue": "Attachments" - } - ] -} diff --git a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.html b/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.html deleted file mode 100644 index e2b1edea..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.html +++ /dev/null @@ -1,94 +0,0 @@ -
- -
- -
-
-

Add local files

-
-
- - - -
- - -
- - -
-
- -
- -
- -
-
-
-

Attachments

-
- -
-
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.scss b/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.scss deleted file mode 100644 index dd26fc93..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.scss +++ /dev/null @@ -1,107 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-dialog-background { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - height: 100%; - width: 100%; - background-color: rgba(100, 100, 100, 0.4); - position: fixed; - z-index: 999; - top: 0px; - left: 0px; -} - -.psdk-modal-file-top { - display: table; - margin: auto; - min-width: 650px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; -} - -.psdk-modal-link-top { - display: table; - margin: auto; - min-width: 650px; - background-color: white; - border: 1px solid black; - border-radius: 10px; - padding: 20px; - box-shadow: 0 0 10px 3px #777; -} - -.psdk-modal-file-selector { - border: 1px dashed $app-neutral-dark-color; - width: 100%; - padding: 0.3rem; - text-align: center; -} - -.psdk-modal-link-entry { - display: flex; - flex-direction: row; -} - -.psdk-modal-link-data { - flex-grow: 3; - margin: 0 0.3rem 0 0.3rem; -} - -.psdk-modal-link-add { - flex-grow: 1; -} - -.psdk-full-width { - width: 100%; -} - -.psdk-modal-body { - max-height: 500px; - overflow-y: auto; - overflow-x: hidden; - width: 100%; -} - -.psdk-view-all-header { - display: flex; - justify-content: space-between; -} - -.psdk-view-all-close-icon { - width: 1.5rem; -} - -.psdk-view-all-body { - max-height: 500px; - overflow-y: auto; - overflow-x: hidden; -} - -.psdk-links-two-column { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: calc(1rem); - width: 100%; -} - -.psdk-modal-links-row { - display: flex; - flex-direction: row; - justify-content: space-between; -} - -.psdk-links-add-link { - padding: 15px; -} - -ul { - columns: 2; - -webkit-columns: 2; - -moz-columns: 2; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.spec.ts deleted file mode 100644 index 4467b446..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { FileUtilityComponent } from './file-utility.component'; - -describe('FileUtilityComponent', () => { - let component: FileUtilityComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ FileUtilityComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(FileUtilityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.ts b/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.ts deleted file mode 100644 index e330fd93..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/file-utility/file-utility.component.ts +++ /dev/null @@ -1,723 +0,0 @@ -import { Component, OnInit, Input, NgZone, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatInputModule } from '@angular/material/input'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import download from 'downloadjs'; -import { AngularPConnectService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; -import { ListUtilityComponent } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-file-utility', - templateUrl: './file-utility.component.html', - styleUrls: ['./file-utility.component.scss'], - standalone: true, - imports: [CommonModule, ListUtilityComponent, MatButtonModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)] -}) -export class FileUtilityComponent implements OnInit { - @Input() pConn$: any; - - // For interaction with AngularPConnect - angularPConnectData: any = {}; - PCore$: any; - - arFullListAttachments: Array = []; - - lu_name$: string = ''; - lu_icon$: string = ''; - lu_bLoading$: boolean = false; - lu_count$: number = 0; - lu_arActions$: Array = []; - lu_arItems$: any = []; - - va_arItems$: Array = []; - - lu_onViewAllFunction: any; - - bShowFileModal$: boolean = false; - bShowLinkModal$: boolean = false; - bShowViewAllModal$: boolean = false; - - arFileMainButtons$: Array = []; - arFileSecondaryButtons$: Array = []; - - arLinkMainButtons$: Array = []; - arLinkSecondaryButtons$: Array = []; - - arFiles$: Array = []; - arFileList$: Array = []; - removeFileFromList$: any; - - arLinks$: Array = []; - arLinksList$: Array = []; - removeLinksFromList$: any; - - link_title$: string = ''; - link_url$: string = ''; - - closeSvgIcon$: string = ''; - - currentCaseID: string = ''; - - addAttachmentsActions: Array = [ - { - text: 'Add files', - id: 'addNewFiles', - onClick: () => this.createModal('addLocalFile') - }, - { - text: 'Add links', - id: 'addNewLinks', - onClick: () => this.createModal('addLocalLink') - } - ]; - - constructor(private angularPConnect: AngularPConnectService, private utils: Utils, private ngZone: NgZone) {} - - ngOnInit(): void { - // // First thing in initialization is registering and subscribing to the AngularPConnect service - this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); - - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - let configProps: any = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.lu_name$ = configProps.label; - this.lu_icon$ = 'paper-clip'; - - this.closeSvgIcon$ = this.utils.getImageSrc('times', this.utils.getSDKStaticContentUrl()); - - let onViewAllCallback = () => this.onViewAll(this.arFullListAttachments); - - this.lu_onViewAllFunction = { onClick: this.onViewAll.bind(this) }; - - this.removeFileFromList$ = { onClick: this.removeFileFromList.bind(this) }; - this.removeLinksFromList$ = { onClick: this.removeLinksFromList.bind(this) }; - - this.updateSelf(); - - this.createModalButtons(); - - this.PCore$.getPubSubUtils().subscribe( - this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, - this.updateSelf.bind(this), - "caseAttachmentsUpdateFromCaseview" - ); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - - this.PCore$.getPubSubUtils().unsubscribe( - this.PCore$.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, - "caseAttachmentsUpdateFromCaseview" - ); - } - - // Callback passed when subscribing to store change - onStateChange() { - // adding a property to track in configProps, when ever the attachment file changes - // need to trigger a redraw - this.pConn$.registerAdditionalProps({ - lastRefreshTime: `@P ${this.PCore$.getConstants().SUMMARY_OF_ATTACHMENTS_LAST_REFRESH_TIME}` - }); - - // Should always check the bridge to see if the component should update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf || this.caseHasChanged()) { - this.updateSelf(); - } - } - - onAttachFiles(files) { - const attachmentUtils = this.PCore$.getAttachmentUtils(); - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - - if (files.length > 0) { - this.lu_bLoading$ = true; - } - - const uploadedFiles = []; - - for (let file of files) { - attachmentUtils - .uploadAttachment(file, this.onUploadProgress, this.errorHandler, this.pConn$.getContextName()) - .then((fileResponse) => { - if (fileResponse.type === 'File') { - attachmentUtils - .linkAttachmentsToCase(caseID, [fileResponse], 'File', this.pConn$.getContextName()) - .then((attachments) => { - this.refreshAttachments(file.ID); - }) - .catch(console.error); - } - }) - .catch(console.error); - } - - this.arFileList$ = []; - } - - refreshAttachments(attachedFileID) { - this.updateSelf(); - } - - onUploadProgress(file) {} - - errorHandler(isFetchedCanceled, file) {} - - onAttachLinks(links) { - const attachmentUtils = this.PCore$.getAttachmentUtils(); - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - - if (links.length > 0) { - this.lu_bLoading$ = true; - } - - const linksToAttach = links.map((link) => ({ - type: 'URL', - category: 'URL', - url: link.url, - name: link.linkTitle - })); - - attachmentUtils - .linkAttachmentsToCase(caseID, linksToAttach, 'URL', this.pConn$.getContextName()) - .then((data) => { - this.refreshAttachments(data); - }) - .catch(console.log); - } - - addAttachments(attsFromResp: Array = [], attachedFileID: string = '') { - this.lu_bLoading$ = false; - - attsFromResp = attsFromResp.map((respAtt) => { - const updatedAtt = { - ...respAtt, - meta: `${respAtt.category} . ${this.utils.generateDateTime(respAtt.createTime, 'DateTime-Since')}, ${ - respAtt.createdBy - }` - }; - if (updatedAtt.type === 'FILE') { - updatedAtt.nameWithExt = updatedAtt.fileName; - } - return updatedAtt; - }); - - return attsFromResp; - } - - onViewAll(arAttachments: Array = []): void { - this.bShowViewAllModal$ = true; - - // add clickAway listener - window.addEventListener('mouseup', this._clickAway.bind(this)); - } - - _clickAway(event: any) { - var bInPopUp = false; - - //run through list of elements in path, if menu not in th path, then want to - // hide (toggle) the menu - for (let i in event.path) { - if (event.path[i].className == 'psdk-modal-file-top' || event.path[i].tagName == 'BUTTON') { - bInPopUp = true; - break; - } - } - if (!bInPopUp) { - this.bShowViewAllModal$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - } - - _closeViewAll() { - this.bShowViewAllModal$ = false; - - window.removeEventListener('mouseup', this._clickAway.bind(this)); - } - - removeFileFromList(item: any) { - if (item != null) { - for (let fileIndex in this.arFileList$) { - if (this.arFileList$[fileIndex].id == item.id) { - // remove the file from the list and redraw - this.ngZone.run(() => { - this.arFileList$.splice(parseInt(fileIndex), 1); - }); - break; - } - } - } - } - - removeLinksFromList(item: any) { - let localLinksList = this.arLinksList$.slice(); - - if (item != null) { - for (let linkIndex in localLinksList) { - if (localLinksList[linkIndex].id == item.id) { - // remove the file from the list and redraw - - localLinksList.splice(parseInt(linkIndex), 1); - - this.ngZone.run(() => { - this.arLinksList$ = localLinksList.slice(); - }); - - break; - } - } - } - } - - getNewListUtilityItemProps = ({ att, cancelFile, downloadFile, deleteFile, removeFile }) => { - let actions; - let isDownloadable = false; - - if (att.progress && att.progress !== 100) { - actions = [ - { - id: `Cancel-${att.ID}`, - text: 'Cancel', - icon: 'times', - onClick: cancelFile - } - ]; - } else if (att.links) { - const isFile = att.type === 'FILE'; - const ID = att.ID.replace(/\s/gi, ''); - const actionsMap = new Map([ - [ - 'download', - { - id: `download-${ID}`, - text: isFile ? 'Download' : 'Open', - icon: isFile ? 'download' : 'open', - onClick: downloadFile - } - ], - [ - 'delete', - { - id: `Delete-${ID}`, - text: 'Delete', - icon: 'trash', - onClick: deleteFile - } - ] - ]); - actions = []; - actionsMap.forEach((action, actionKey) => { - if (att.links[actionKey]) { - actions.push(action); - } - }); - isDownloadable = att.links.download; - } else if (att.error) { - actions = [ - { - id: `Remove-${att.ID}`, - text: 'Remove', - icon: 'trash', - onClick: removeFile - } - ]; - } - - return { - id: att.ID, - visual: { - icon: this.utils.getIconForAttachment(att), - progress: att.progress == 100 ? undefined : att.progress - }, - primary: { - type: att.type, - name: att.name, - icon: 'trash', - click: removeFile - }, - secondary: { - text: att.meta - }, - actions - }; - }; - - getListUtilityItemProps = ({ att, cancelFile, downloadFile, deleteFile, removeFile }) => { - let actions; - let isDownloadable = false; - - if (att.progress && att.progress !== 100) { - actions = [ - { - id: `Cancel-${att.ID}`, - text: 'Cancel', - icon: 'times', - onClick: cancelFile - } - ]; - } else if (att.links) { - const isFile = att.type === 'FILE'; - const ID = att.ID.replace(/\s/gi, ''); - const actionsMap = new Map([ - [ - 'download', - { - id: `download-${ID}`, - text: isFile ? 'Download' : 'Open', - icon: isFile ? 'download' : 'open', - onClick: downloadFile - } - ], - [ - 'delete', - { - id: `Delete-${ID}`, - text: 'Delete', - icon: 'trash', - onClick: deleteFile - } - ] - ]); - actions = []; - actionsMap.forEach((action, actionKey) => { - if (att.links[actionKey]) { - actions.push(action); - } - }); - isDownloadable = att.links.download; - } else if (att.error) { - actions = [ - { - id: `Remove-${att.ID}`, - text: 'Remove', - icon: 'trash', - onClick: removeFile - } - ]; - } - - return { - id: att.ID, - visual: { - icon: this.utils.getIconForAttachment(att), - progress: att.progress == 100 ? undefined : att.progress - }, - primary: { - type: att.type, - name: att.name, - icon: 'open', - click: downloadFile - }, - secondary: { - text: att.meta - }, - actions - }; - }; - - _addLink(event: any) { - // copy list locally - let localList = this.arLinksList$.slice(); - - let url = this.link_url$; - - if (!/^(http|https):\/\//.test(this.link_url$)) { - this.link_url$ = `http://${this.link_url$}`; - } - - // list for display - let oLink: any = {}; - oLink.icon = 'chain'; - - oLink.ID = `${new Date().getTime()}`; - - oLink = this.getNewListUtilityItemProps({ - att: oLink, - downloadFile: null, - cancelFile: null, - deleteFile: null, - removeFile: null - }); - - oLink.type = 'URL'; - oLink.primary.type = oLink.type; - oLink.visual.icon = 'chain'; - oLink.primary.name = this.link_title$; - oLink.primary.icon = 'open'; - oLink.secondary.text = url; - - this.ngZone.run(() => { - // need to create a new array or summary list won't detect changes - this.arLinksList$ = localList.slice(); - this.arLinksList$.push(oLink); - - // list for actually attachments - let link: any = {}; - link.id = oLink.id; - link.linkTitle = this.link_title$; - link.type = oLink.type; - link.url = url; - - this.arLinks$.push(link); - - // clear values - this.link_title$ = ''; - this.link_url$ = ''; - }); - } - - _changeTitle(event: any) { - this.link_title$ = event.srcElement.value; - } - - _changeUrl(event: any) { - this.link_url$ = event.srcElement.value; - } - - downloadFile(att: any) { - let attachUtils = this.PCore$.getAttachmentUtils(); - const { ID, name, extension, type } = att; - let context = this.pConn$.getContextName(); - - attachUtils - .downloadAttachment(ID, context) - .then((content) => { - if (type === 'FILE') { - this.fileDownload(content.data, name, extension); - } else if (type === 'URL') { - let { data } = content; - if (!/^(http|https):\/\//.test(data)) { - data = `//${data}`; - } - window.open(content.data, '_blank'); - } - }) - .catch(console.error); - } - - fileDownload = (data, fileName, ext) => { - const file = ext ? `${fileName}.${ext}` : fileName; - download(atob(data), file); - }; - - cancelFile(attID: string) { - alert('cancel'); - } - - deleteFile(att: any) { - setTimeout(() => { - let attachUtils = this.PCore$.getAttachmentUtils(); - const { ID } = att; - let context = this.pConn$.getContextName(); - - attachUtils - .deleteAttachment(ID, context) - .then(() => { - this.updateSelf(); - // let newAttachments; - // setAttachments((current) => { - // newAttachments = current.filter((file) => file.ID !== ID); - // return newAttachments; - // }); - // if (callbackFn) { - // callbackFn(newAttachments); - // } - }) - .catch(console.error); - }); - } - - removeFile(attID: string) { - alert('remove'); - } - - removeNewFile(attID: string) { - alert('remove'); - } - - createModal(modalType: string) { - switch (modalType) { - case 'addLocalFile': - this.ngZone.run(() => { - this.bShowFileModal$ = true; - }); - - break; - case 'addLocalLink': - this.ngZone.run(() => { - this.bShowLinkModal$ = true; - }); - - break; - } - } - - createModalButtons() { - this.arFileMainButtons$.push({ actionID: 'attach', jsAction: 'attachFiles', name: 'Attach files' }); - this.arFileSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' }); - - this.arLinkMainButtons$.push({ actionID: 'attach', jsAction: 'attachLinks', name: 'Attach links' }); - this.arLinkSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' }); - } - - uploadMyFiles($event) { - //alert($event.target.files[0]); // outputs the first file - this.arFiles$ = this.getFiles($event.target.files); - - // convert FileList to an array - let myFiles = Array.from(this.arFiles$); - - this.arFileList$ = myFiles.map((att) => { - return this.getNewListUtilityItemProps({ - att, - downloadFile: !att.progress ? () => this.downloadFile(att) : null, - cancelFile: att.progress ? () => this.cancelFile(att.ID) : null, - deleteFile: !att.progress ? () => this.deleteFile(att) : null, - removeFile: att.error ? () => this.removeNewFile(att.ID) : null - }); - }); - } - - getFiles(arFiles: Array): Array { - return this.setNewFiles(arFiles); - } - - setNewFiles(arFiles, current = []) { - let index = 0; - for (let file of arFiles) { - if (!this.validateMaxSize(file, 5)) { - file.error = true; - file.meta = 'File is too big. Max allowed size is 5MB.'; - } - file.mimeType = file.type; - file.icon = this.utils.getIconFromFileType(file.type); - file.ID = `${new Date().getTime()}I${index}`; - index++; - } - - return arFiles; - } - - validateMaxSize(fileObj, maxSizeInMB): boolean { - const fileSize = (fileObj.size / 1048576).toFixed(2); - return fileSize < maxSizeInMB; - } - - onFileActionButtonClick(event: any) { - // modal buttons - switch (event.action) { - case 'cancel': - this.bShowFileModal$ = false; - - this.clearOutFiles(); - break; - case 'attachFiles': - this.bShowFileModal$ = false; - this.onAttachFiles(this.arFiles$); - - this.clearOutFiles(); - break; - } - } - - onLinkActionButtonClick(event: any) { - // modal buttons - switch (event.action) { - case 'cancel': - this.bShowLinkModal$ = false; - - this.clearOutLinks(); - break; - case 'attachLinks': - this.bShowLinkModal$ = false; - this.onAttachLinks(this.arLinks$); - - this.clearOutLinks(); - break; - } - } - - clearOutFiles() { - this.arFileList$ = []; - this.arFiles$ = []; - } - - clearOutLinks() { - this.arLinksList$ = []; - this.arLinks$ = []; - this.link_title$ = ''; - this.link_url$ = ''; - } - - addALink() {} - - _fieldOnChangeLink(event: any) { - this.link_title$ = event.target.value; - } - - _fieldOnChangeURL(event: any) { - this.link_url$ = event.target.value; - } - - updateSelf() { - const attachmentUtils = this.PCore$.getAttachmentUtils(); - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - - if (caseID && caseID != '') { - let attPromise = attachmentUtils.getCaseAttachments(caseID, this.pConn$.getContextName()); - - this.lu_bLoading$ = true; - - attPromise.then((resp) => { - this.arFullListAttachments = this.addAttachments(resp); - this.lu_count$ = this.arFullListAttachments.length; - this.lu_arActions$ = this.addAttachmentsActions; - - this.lu_arItems$ = this.arFullListAttachments.slice(0, 3).map((att) => { - return this.getListUtilityItemProps({ - att, - downloadFile: !att.progress ? () => this.downloadFile(att) : null, - cancelFile: att.progress ? () => this.cancelFile(att.ID) : null, - deleteFile: !att.progress ? () => this.deleteFile(att) : null, - removeFile: att.error ? () => this.removeFile(att.ID) : null - }); - }); - - this.va_arItems$ = this.arFullListAttachments.map((att) => { - return this.getListUtilityItemProps({ - att, - downloadFile: !att.progress ? () => this.downloadFile(att) : null, - cancelFile: att.progress ? () => this.cancelFile(att.ID) : null, - deleteFile: !att.progress ? () => this.deleteFile(att) : null, - removeFile: att.error ? () => this.removeFile(att.ID) : null - }); - }); - }); - } - } - - caseHasChanged(): boolean { - const caseID = this.pConn$.getValue(this.PCore$.getConstants().CASE_INFO.CASE_INFO_ID); - if (this.currentCaseID !== caseID) { - this.currentCaseID = caseID; - return true; - } - - return false; - } -} - diff --git a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.html b/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.html deleted file mode 100644 index 8309b1be..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
-
-
-
- -
-
{{ name$ }}
-
{{ count$ }}
-
-
- - - - - - -
-
-
-
- -
{{ noItemsMessage$ }}
-
- -
-
- -
-
-
diff --git a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.scss b/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.scss deleted file mode 100644 index 6364196c..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.scss +++ /dev/null @@ -1,135 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.progress-spinner { - text-align: center; - position: absolute; - top: 40%; - left: 40%; -} - -.psdk-icon { - padding: 0rem 0.125rem; - min-width: unset; -} - -.psdk-utility-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-utility-view-all { - width: 100%; - display: flex; - justify-content: center; -} - -.psdk-utility-count { - background: $app-primary-light-color; - border-radius: calc(1.125 * 0.5rem); - color: black; - display: inline-block; - font-size: 0.75rem; - font-weight: bold; - text-align: center; - width: 1.125rem; - - vertical-align: top; - margin: 0 0 0.313rem 1rem; -} - -.psdk-utility .header-text { - font-size: 1rem; - font-weight: bold; - padding-bottom: 0.3125rem; - text-align: left; - display: inline-block; -} - -.psdk-utility .header-icon { - display: inline-block; -} - -.psdk-utility { - width: 100%; - padding: 0.625rem 0rem; - text-align: left; - background-color: $app-form-color; - border-radius: 0.6125rem; - margin: 0.3125rem 0rem; - position: relative; -} -.psdk-utility .header { - text-align: left; - display: flex; - align-items: center; -} - -.psdk-utility-svg-icon { - width: 1.4rem; - display: inline-block; -} - -.psdk-settings-svg-icon { - width: 1.4rem; - display: inline-block; - filter: $app-primary-color-filter; -} - -.psdk-utility .message { - text-align: center; -} - -.psdk-utility-card { - display: flex; - flex-direction: row; - padding: 0.25rem 0rem 0.25rem 0.25rem; -} - -.psdk-utility-card-icon { - flex-grow: 1; - max-width: 2.813rem; -} - -.psdk-utility-card-svg-icon { - width: 2.5rem; - display: inline-block; -} - -.psdk-utility-card-main { - flex-grow: 2; - max-width: 16.563rem; -} - -.psdk-utility-card-main-primary-url { - color: $app-primary-color; -} - -.psdk-utility-card-main-primary-url .mat-mdc-button.mat-primary { - padding-left: 0px; -} - -.psdk-utility-card-main-primary-label { - font-weight: bold; -} - -.psdk-utility-card-actions { - flex-grow: 1; - text-align: right; -} - -.psdk-utility-card-action-svg-icon { - width: 1.4rem; - display: inline-block; -} - -.psdk-utility-card-actions-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: middle; - filter: $app-primary-color-filter; -} - -.psdk-utility-card-action-actions-svg-icon { - width: 1.4rem; - display: inline-block; - vertical-align: bottom; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.spec.ts deleted file mode 100644 index 299c3f9e..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { ListUtilityComponent } from './list-utility.component'; - -describe('ListUtilityComponent', () => { - let component: ListUtilityComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ ListUtilityComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListUtilityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.ts b/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.ts deleted file mode 100644 index 5f627021..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/list-utility/list-utility.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Component, OnInit, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { Utils } from '@pega/angular-sdk-library'; -import { ComponentMapperComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-list-utility', - templateUrl: './list-utility.component.html', - styleUrls: ['./list-utility.component.scss'], - standalone: true, - imports: [CommonModule, MatButtonModule, MatMenuModule, MatProgressSpinnerModule, forwardRef(() => ComponentMapperComponent)] -}) -export class ListUtilityComponent implements OnInit { - @Input() name$: string = ''; - @Input() icon$: string = ''; - @Input() bLoading$: boolean = false; - @Input() count$: number = 0; - @Input() arActions$: Array = []; - @Input() arItems$: Array = []; - - // function to all - @Input() onViewAll$: any; - - PCore$: any; - - headerSvgIcon$: string; - settingsSvgIcon$: string; - - noItemsMessage$: string = 'No Items'; - - imagePath$: string = ''; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.imagePath$ = this.getIconPath(); - - this.headerSvgIcon$ = this.utils.getImageSrc(this.icon$, this.utils.getSDKStaticContentUrl()); - this.settingsSvgIcon$ = this.utils.getImageSrc('more', this.utils.getSDKStaticContentUrl()); - } - - ngOnChanges() {} - - getIconPath(): string { - return this.utils.getSDKStaticContentUrl() + 'assets/icons/'; - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/todo/config.json b/tests/assets/components/createAll/override-sdk/widget/todo/config.json deleted file mode 100644 index 4213bbe2..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/todo/config.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "Todo", - "label": "Todo", - "description": "My worklist widget", - "type": "Widget", - "subtype": "PAGE", - "properties": [ - { - "name": "headerText", - "label": "Header text", - "format": "TEXT", - "defaultValue": "@L My Worklist" - }, - { - "name": "datasource", - "label": "Data source", - "defaultValue": "@DATASOURCE D_pyMyWorkList.pxResults", - "format": "DATASOURCE", - "required": true, - "properties": [ - { - "name": "operator", - "label": "Operator", - "defaultValue": "@P .pxAssignedOperatorID" - }, - { - "name": "id", - "label": "ID", - "defaultValue": "@P .pzInsKey" - }, - { - "name": "name", - "label": "Label", - "defaultValue": "@P .pyLabel" - }, - { - "name": "value", - "label": "Work ID", - "defaultValue": "@P .pxRefObjectKey" - }, - { - "name": "priority", - "label": "Urgency", - "defaultValue": "@P .pxUrgencyAssign" - }, - { - "name": "classname", - "label": "Class name", - "defaultValue": "@P .pxRefObjectClass" - } - ] - } - ], - "defaultConfig": { - "target": "primary" - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.html b/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.html deleted file mode 100644 index 312c168c..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
-
{{ this.currentUserInitials$ }}
-
{{ headerText$ }}
-
{{ assignmentCount$ }}
-
-

-
- -
-
-
-
{{ this.currentUserInitials$ }}
-
-
{{ assignment.stepName }}
-
-
- Task in {{ assignment.name }} {{ getID(assignment) }} - - • {{ assignment?.status }} - - • Priority {{ assignment?.priority }} -
-
-
-
- -
-
-
-
-
- -
-
- -
- -
- -
-
-
-
diff --git a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.scss b/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.scss deleted file mode 100644 index bd43f9cf..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.scss +++ /dev/null @@ -1,90 +0,0 @@ -@import '@pega/angular-sdk-library/_shared/styles.scss'; - -.psdk-display-divider { - border-bottom: 0.0625rem solid $app-neutral-light-color; -} - -.psdk-todo { - padding: 0.5rem; -} - -.psdk-todo-header { - display: inline-flex; -} - -.psdk-todo-text { - padding: 0.5rem 0.625rem; - font-size: 1.1rem; - font-weight: bold; -} - -.psdk-assignment-count { - background-color: $app-primary-light-color; - margin: 0.5rem; - border-radius: 45%; - padding: 0.15rem 0.4rem; -} - -.psdk-todo-id { - color: $app-primary-color; -} - -.psdk-avatar { - margin: 0rem; - padding: 0rem; - min-width: 2.5rem; - min-height: 2.5rem; - max-width: 2.5rem; - max-height: 2.5rem; - border-radius: 50%; - justify-content: center; - align-items: center; - text-align: center; - display: flex; - background: $app-primary-color; - color: white; - font-weight: bold; - font-size: 1.25rem; -} - -.psdk-todo-assignment { - display: inline-flex; - width: 100%; - padding: 0.625rem 0rem; -} - -.psdk-todo-assignment-data { - display: inline-flex; -} - -.psdk-todo-assignment-status { - background-color: $app-neutral-light-color; - border-radius: 0.125rem; - color: darkslategray; - font-size: 0.75rem; - font-weight: bold; - line-height: calc(0.5rem * 2.5); - height: calc(0.5rem * 2.5); - padding: 0 0.5rem; - text-transform: uppercase; -} - -.psdk-todo-assignment-task { - color: $app-neutral-color; - cursor: pointer; -} - -.psdk-todo-assignment-action { - display: inline-flex; -} - -.psdk-todo-card { - width: 100%; - padding-left: 0.625rem; -} - -.psdk-todo-show-more { - width: 100%; - text-align: center; - margin-top: 0.625rem; -} diff --git a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.spec.ts deleted file mode 100644 index 173ffaf6..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { TodoComponent } from './todo.component'; - -describe('TodoComponent', () => { - let component: TodoComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ TodoComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TodoComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.ts b/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.ts deleted file mode 100644 index cba2ef6e..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/todo/todo.component.ts +++ /dev/null @@ -1,245 +0,0 @@ -import { Component, OnInit, Input, NgZone } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatButtonModule } from '@angular/material/button'; -import { ProgressSpinnerService } from '@pega/angular-sdk-library'; -import { Utils } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-todo', - templateUrl: './todo.component.html', - styleUrls: ['./todo.component.scss'], - providers: [Utils], - standalone: true, - imports: [CommonModule, MatButtonModule] -}) -export class TodoComponent implements OnInit { - @Input() pConn$: any; - @Input() caseInfoID$: string; - @Input() datasource$: any; - @Input() headerText$: string; - @Input() itemKey$: string; - @Input() showTodoList$: boolean = true; - @Input() target$: string; - @Input() type$: string = 'worklist'; - @Input() context$: string; - @Input() myWorkList$: any; - @Input() isConfirm; - - PCore$: any; - - configProps$: Object; - currentUser$: string; - currentUserInitials$: string = '--'; - assignmentCount$: number; - bShowMore$: boolean = true; - arAssignments$: Array; - assignmentsSource$: any; - - constructor(private psService: ProgressSpinnerService, private ngZone: NgZone, private utils: Utils) {} - - ngOnInit() { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED } = this.PCore$.getEvents().getCaseEvent(); - - this.PCore$.getPubSubUtils().subscribe( - this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, - () => { - this.updateToDo(); - }, - 'updateToDo' - ); - - this.PCore$.getPubSubUtils().subscribe( - CREATE_STAGE_SAVED, - () => { - this.updateList(); - }, - CREATE_STAGE_SAVED - ); - - this.PCore$.getPubSubUtils().subscribe( - CREATE_STAGE_DELETED, - () => { - this.updateList(); - }, - CREATE_STAGE_DELETED - ); - - this.updateToDo(); - } - - ngOnDestroy() { - const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED } = this.PCore$.getEvents().getCaseEvent(); - - this.PCore$.getPubSubUtils().unsubscribe(this.PCore$.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'updateToDo'); - - this.PCore$.getPubSubUtils().unsubscribe(CREATE_STAGE_SAVED, CREATE_STAGE_SAVED); - - this.PCore$.getPubSubUtils().unsubscribe(CREATE_STAGE_DELETED, CREATE_STAGE_DELETED); - } - - ngOnChanges(data: any) { - // don't update until we'va had an init - if (this.PCore$) { - this.updateToDo(); - } - } - - updateWorkList(key) { - this.PCore$.getDataApiUtils() - .getData(key) - .then((responseData) => { - const dataObject = {}; - dataObject[key] = { - pxResults: responseData.data.data - }; - - this.pConn$.updateState(dataObject); - this.updateToDo(); - }) - .catch((err) => { - console.error(err?.stack); - }); - } - - updateList() { - this.updateWorkList('D_pyMyWorkList'); - } - - updateToDo() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - if (this.headerText$ == undefined) { - this.headerText$ = this.configProps$['headerText']; - } - - this.datasource$ = this.configProps$['datasource'] ? this.configProps$['datasource'] : this.datasource$; - this.myWorkList$ = this.configProps$['myWorkList'] ? this.configProps$['myWorkList'] : this.myWorkList$; - - this.assignmentsSource$ = this.datasource$?.source || this.myWorkList$?.source; - - if (this.showTodoList$) { - this.assignmentCount$ = this.assignmentsSource$ != null ? this.assignmentsSource$.length : 0; - this.arAssignments$ = this.topThreeAssignments(this.assignmentsSource$); - } else { - // get caseInfoId assignment. - if (this.caseInfoID$ != undefined) { - this.arAssignments$ = this.getCaseInfoAssignment(this.assignmentsSource$, this.caseInfoID$); - } - } - - this.currentUser$ = this.PCore$.getEnvironmentInfo().getOperatorName(); - this.currentUserInitials$ = this.utils.getInitials(this.currentUser$); - } - - getID(assignment: any) { - let sID = ''; - if (assignment.value) { - let refKey = assignment.value; - sID = refKey.substring(refKey.lastIndexOf(' ') + 1); - } else { - let refKey = assignment.ID; - let arKeys = refKey.split('!')[0].split(' '); - - sID = arKeys[2]; - } - - return sID; - } - - topThreeAssignments(arList: Array) { - let arList3: Array = new Array(); - - if (arList && typeof arList == 'object') { - let len = arList.length; - if (len > 3) len = 3; - - for (let i = 0; i < len; i++) { - arList3.push(arList[i]); - } - } - - return arList3; - } - - getCaseInfoAssignment(arList: Array, caseInfoID: string) { - let arList1: Array = new Array(); - for (var aIndex in arList) { - if (arList[aIndex].ID.indexOf(caseInfoID) >= 0) { - let listRow = JSON.parse(JSON.stringify(arList[aIndex])); - - // urgency becomes priority - if (listRow.urgency) { - listRow['priority'] = listRow.urgency; - } - - if (listRow.ID) { - // mimic regular list - listRow['id'] = listRow['ID']; - } - - arList1.push(listRow); - break; - } - } - - return arList1; - } - - _showMore() { - this.ngZone.run(() => { - this.bShowMore$ = false; - this.arAssignments$ = this.assignmentsSource$; - }); - } - - _showLess() { - this.ngZone.run(() => { - this.bShowMore$ = true; - - this.arAssignments$ = this.topThreeAssignments(this.assignmentsSource$); - }); - } - - clickGo(assignment: any) { - let { id, classname } = assignment[0]; - - // capture className, as seem to loose it when - if (classname == null || classname == '') { - classname = this.pConn$.getCaseInfo().getClassName(); - } - - let sTarget = this.pConn$.getContainerName(); - let sTargetContainerName = sTarget; - let sIsActionFromTodoList = 'todo'; - - let options = { containerName: sTarget }; - - if (classname == null || classname == '') { - classname = this.pConn$.getCaseInfo().getClassName(); - } - - if (sTarget === 'workarea') { - options['isActionFromToDoList'] = true; - options['target'] = ''; - options['context'] = this.context$; - options['isChild'] = undefined; - } else { - options['isActionFromToDoList'] = false; - options['target'] = sTarget; - options['context'] = ''; - } - - this.psService.sendMessage(true); - - this.pConn$ - .getActionsApi() - .openAssignment(id, classname, options) - .then(() => {}); - } -} diff --git a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.html b/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.html deleted file mode 100644 index 87b55dca..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.scss b/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.spec.ts b/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.spec.ts deleted file mode 100644 index a6920635..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { UtilityComponent } from './utility.component'; - -describe('UtilityComponent', () => { - let component: UtilityComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ UtilityComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(UtilityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.ts b/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.ts deleted file mode 100644 index f0b81d63..00000000 --- a/tests/assets/components/createAll/override-sdk/widget/utility/utility.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; -import { Utils } from '@pega/angular-sdk-library'; -import { MaterialUtilityComponent } from '@pega/angular-sdk-library'; - -declare const window: any; - -@Component({ - selector: 'app-utility', - templateUrl: './utility.component.html', - styleUrls: ['./utility.component.scss'], - standalone: true, - imports: [MaterialUtilityComponent] -}) -export class UtilityComponent implements OnInit, OnChanges { - @Input() pConn$: any; - - PCore$: any; - - configProps$: any; - headerIcon$: string; - headerText$: string; - headerIconUrl$: string; - noItemsMessage$: string; - - constructor(private utils: Utils) {} - - ngOnInit(): void { - if (!this.PCore$) { - this.PCore$ = window.PCore; - } - - this.updateSelf(); - } - - ngOnChanges(changes: SimpleChanges): void { - const { pConn$ } = changes; - - if (pConn$.previousValue && pConn$.previousValue !== pConn$.currentValue) { - this.updateSelf(); - } - } - - updateSelf() { - this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()); - - this.headerIcon$ = this.configProps$['headerIcon']; - this.headerIconUrl$ = this.utils.getSDKStaticContentUrl(); - this.headerText$ = this.configProps$['headerText']; - this.noItemsMessage$ = this.configProps$['noItemsMessage']; - } -}