@pega/lists-react 9.0.0-build.24.7 → 9.0.0-build.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Core/Components/RenderingEngine/RenderCell.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.js +16 -4
- package/lib/Core/Components/RenderingEngine/RenderCell.js.map +1 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.js +0 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderCell.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/RenderCell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"RenderCell.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/RenderCell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA4B7E,UAAU,oBAAqB,SAAQ,WAAW,CAAC,0BAA0B;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAgB,EAChB,WAAmB,EACnB,mBAA2B,EAC3B,YAAoB,EACpB,OAAe,EACf,OAAO,EACP,MAAM,EACN,KAAY,EACZ,SAAS,EACV,EAAE,oBAAoB,2CAiDtB;;AAED,wBAAqC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo, useRef, useContext } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
4
|
import { FieldType } from 'pega-repeating-structures-core';
|
|
5
|
+
import { defaultThemeProp } from '@pega/cosmos-react-core';
|
|
6
|
+
import { markStyles } from '@pega/cosmos-react-core/lib/components/Mark/Mark';
|
|
5
7
|
import { createClassName as cx } from '../../Utils';
|
|
6
8
|
import GlobalContext from '../../Context/GlobalContext';
|
|
7
9
|
import Formatter from './Formatter';
|
|
@@ -9,9 +11,19 @@ import ExpresssionEvaluator from './ExpresssionEvaluator';
|
|
|
9
11
|
import Flasher from './Flasher';
|
|
10
12
|
import useHighlighter from './useHighlighter';
|
|
11
13
|
import ErrorHandler from './ErrorHandler';
|
|
12
|
-
const StyledSpan = styled.span
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const StyledSpan = styled.span(({ style }) => {
|
|
15
|
+
return css `
|
|
16
|
+
${style}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Using mark tag instead of <Mark /> component as the search in RS needs to be done on the rendered DOM content instead of string value.
|
|
20
|
+
*/
|
|
21
|
+
mark {
|
|
22
|
+
${markStyles}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
});
|
|
26
|
+
StyledSpan.defaultProps = defaultThemeProp;
|
|
15
27
|
function RenderingEngine({ formatter = true, highlighter = false, expressionEvaluator = false, errorHandler = false, flasher = false, context, column, style = null /* This prop is provided by CellWrapper.jsx */, className }) {
|
|
16
28
|
const { resolveCellComponent, resolveViewComponent } = useContext(GlobalContext);
|
|
17
29
|
const engineWrapper = useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderCell.js","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/RenderCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RenderCell.js","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/RenderCell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAoB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAE9E,OAAO,EAAE,eAAe,IAAI,EAAE,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAA2C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrF,OAAO,GAAG,CAAA;MACN,KAAK;;;;;;QAMH,UAAU;;GAEf,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAa3C,SAAS,eAAe,CAAC,EACvB,SAAS,GA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AAC,CAAC,CAAC;IAChF,IAAI,YAAY;QAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,OAAO;QAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEpC,cAAc,CAAC,aAAa,EAAE;QAC5B,eAAe,EAAE,WAAW,IAAI,uBAAuB;KACxD,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;IAExC,OAAO,CACL,KAAC,UAAU,IACT,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,KACpC,CAAC,WAAW;YACd,uBAAuB;YACvB,aAAa,CAAC,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,gBAAgB,EAAE,EAAE,CAAC,YAE/E,oBAAoB,CAAC,eAAe,EAAE,EAAE,IAAI,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC,GAC/E,CACd,CAAC;AACJ,CAAC;AAED,eAAe,IAAI,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { memo, useMemo, useRef, useContext } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { CSSObject } from 'styled-components';\n\nimport { FieldType, type RsCoreTypes } from 'pega-repeating-structures-core';\nimport { defaultThemeProp } from '@pega/cosmos-react-core';\nimport { markStyles } from '@pega/cosmos-react-core/lib/components/Mark/Mark';\n\nimport { createClassName as cx } from '../../Utils';\nimport GlobalContext from '../../Context/GlobalContext';\n\nimport Formatter from './Formatter';\nimport ExpresssionEvaluator from './ExpresssionEvaluator';\nimport Flasher from './Flasher';\nimport useHighlighter from './useHighlighter';\nimport ErrorHandler from './ErrorHandler';\n\nconst StyledSpan = styled.span<{ style: RenderingEngineProps['style'] }>(({ style }) => {\n return css`\n ${style}\n\n /**\n * Using mark tag instead of <Mark /> component as the search in RS needs to be done on the rendered DOM content instead of string value.\n */\n mark {\n ${markStyles}\n }\n `;\n});\n\nStyledSpan.defaultProps = defaultThemeProp;\n\ninterface RenderingEngineProps extends RsCoreTypes.ColumnRenderingEngineProps {\n formatter?: boolean;\n highlighter?: boolean;\n expressionEvaluator?: boolean;\n errorHandler?: boolean;\n flasher?: boolean;\n context?: any;\n style?: CSSObject | null;\n className?: string;\n}\n\nfunction RenderingEngine({\n formatter = true,\n highlighter = false,\n expressionEvaluator = false,\n errorHandler = false,\n flasher = false,\n context,\n column,\n style = null /* This prop is provided by CellWrapper.jsx */,\n className\n}: RenderingEngineProps) {\n const { resolveCellComponent, resolveViewComponent } = useContext(GlobalContext);\n\n const engineWrapper = useRef();\n const { renderFactory } = column;\n\n const columnExecutionContext = column.getExecutionContext();\n\n const engineContext = {\n getElement: () => engineWrapper.current,\n ...column.getContext(columnExecutionContext),\n ...context,\n renderFactory,\n resolveCellComponent,\n resolveViewComponent,\n formatterConfig: column.formatterConfig\n };\n const pipeline: any[] = [];\n const { getField, getRendererType } = engineContext;\n const field = getField();\n\n const isHighlighterApplicable = useMemo(\n () => !!(field.type === FieldType.TEXT && column.parent?.meta?.globalSearch),\n [field.type, column]\n );\n\n if (expressionEvaluator) pipeline.push(ExpresssionEvaluator);\n if (column.formatterAllowed) pipeline.push((c: any) => Formatter(c, formatter));\n if (errorHandler) pipeline.push(ErrorHandler);\n if (flasher) pipeline.push(Flasher);\n\n useHighlighter(engineContext, {\n shouldHighlight: highlighter && isHighlighterApplicable\n });\n\n pipeline.forEach(p => p(engineContext));\n\n return (\n <StyledSpan\n ref={engineWrapper}\n style={style}\n className={cx('cell-content', className)}\n {...(highlighter &&\n isHighlighterApplicable &&\n engineContext.getSearchKeyword() && { key: engineContext.getSearchKeyword() })}\n >\n {resolveCellComponent(getRendererType?.() || 'cellRenderer', renderFactory, engineContext)}\n </StyledSpan>\n );\n}\n\nexport default memo(RenderingEngine);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHighlighter.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/useHighlighter.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,GAAG,EACZ,EAAE,aAAqB,EAAE,eAAuB,EAAE;;;CAAK,
|
|
1
|
+
{"version":3,"file":"useHighlighter.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/useHighlighter.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,GAAG,EACZ,EAAE,aAAqB,EAAE,eAAuB,EAAE;;;CAAK,QA6CxD"}
|
|
@@ -33,7 +33,6 @@ export default function useHighlighter(context, { caseSensitive = false, shouldH
|
|
|
33
33
|
child.textContent.replace(keywordRegex, (match, idx) => {
|
|
34
34
|
const part = document.createTextNode(child.textContent.slice(lastIdx, idx));
|
|
35
35
|
const highlighted = document.createElement('mark');
|
|
36
|
-
highlighted.style.background = '#fffc65';
|
|
37
36
|
highlighted.textContent = match;
|
|
38
37
|
frag.appendChild(part);
|
|
39
38
|
frag.appendChild(highlighted);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHighlighter.js","sourceRoot":"","sources":["../../../../Core/Components/RenderingEngine/useHighlighter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AAClE,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK,EAAE,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAY,EACZ,EAAE,aAAa,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK,EAAE,GAAG,EAAE;IAEvD,+EAA+E;IAC/E,wDAAwD;IACxD,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,C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CAAC,CAAC,CAAC;oBACH,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;oBACtE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;oBACtB,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,eAAe,IAAI,OAAO,CAAC,MAAM;YAAE,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { useEffect } from 'react';\n\nconst SPECIAL_CHARS_REGEX = /(\\[|\\\\|\\^|\\$|\\.|\\||\\?|\\*|\\+|\\(|\\))/g;\nfunction sanitizeRegex(regex: string) {\n return regex?.replace(SPECIAL_CHARS_REGEX, '\\\\$1');\n}\n\nexport default function useHighlighter(\n context: any,\n { caseSensitive = false, shouldHighlight = false } = {}\n) {\n // Context is executional context and wont be available in asynchronous method.\n // We have to keep reference of used objects in closure.\n const getElement = context?.getElement;\n const getSearchKeyword = context?.getSearchKeyword;\n\n useEffect(() => {\n const flags = caseSensitive ? 'g' : 'gi';\n const keyword = [sanitizeRegex(getSearchKeyword?.()?.trim())].filter((_: string) => _);\n\n const keywordRegex = new RegExp(keyword[0], flags);\n function highlight(element: Node) {\n if (!element?.textContent || !keywordRegex.test(element.textContent)) {\n // in case there is no match\n return;\n }\n // Sort longer matches first to avoid\n // highlighting keywords within keywords.\n Array.from(element?.childNodes || []).forEach(child => {\n keywordRegex.lastIndex = 0;\n if (child.nodeType !== 3) {\n // not a text node\n if (child.nodeName !== 'SCRIPT' && child.nodeName !== 'STYLE') {\n highlight(child);\n }\n } else if (child.textContent && keywordRegex.test(child.textContent)) {\n const frag = document.createDocumentFragment();\n let lastIdx = 0;\n child.textContent.replace(keywordRegex, (match: string, idx: number): any => {\n const part = document.createTextNode(child.textContent!.slice(lastIdx, idx));\n const highlighted = document.createElement('mark');\n highlighted.textContent = match;\n frag.appendChild(part);\n frag.appendChild(highlighted);\n lastIdx = idx + match.length;\n });\n const end = document.createTextNode(child.textContent.slice(lastIdx));\n frag.appendChild(end);\n child.parentNode?.replaceChild(frag, child);\n }\n });\n }\n if (shouldHighlight && keyword.length) highlight(getElement?.());\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/lists-react",
|
|
3
|
-
"version": "9.0.0-build.
|
|
3
|
+
"version": "9.0.0-build.25.1",
|
|
4
4
|
"description": "Repeating view structures such as Table, Gallery(Repeating layouts), Kanban etc.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-condition-builder": "9.0.0-build.
|
|
18
|
-
"@pega/cosmos-react-core": "9.0.0-build.
|
|
19
|
-
"@pega/cosmos-react-rte": "9.0.0-build.
|
|
17
|
+
"@pega/cosmos-react-condition-builder": "9.0.0-build.25.1",
|
|
18
|
+
"@pega/cosmos-react-core": "9.0.0-build.25.1",
|
|
19
|
+
"@pega/cosmos-react-rte": "9.0.0-build.25.1",
|
|
20
20
|
"@types/lodash-es": "^4.17.12",
|
|
21
21
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
22
22
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dayjs": "^1.11.13",
|
|
25
25
|
"fast-deep-equal": "^3.1.3",
|
|
26
26
|
"lodash-es": "^4.18.1",
|
|
27
|
-
"pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.
|
|
28
|
-
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.
|
|
27
|
+
"pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.25.1",
|
|
28
|
+
"pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.25.1",
|
|
29
29
|
"polished": "^4.1.0",
|
|
30
30
|
"prop-types": "^15.8.1",
|
|
31
31
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@testing-library/react": "^16.0.0",
|
|
45
45
|
"@testing-library/user-event": "^14.6.1",
|
|
46
46
|
"jest-axe": "^8.0.0",
|
|
47
|
-
"srs-utils": "9.0.0-build.
|
|
47
|
+
"srs-utils": "9.0.0-build.25.1",
|
|
48
48
|
"typescript": "~5.9.3"
|
|
49
49
|
}
|
|
50
50
|
}
|