@pega/lists-react 9.0.0-build.1.0 → 9.0.0-build.2.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.
@@ -18,7 +18,7 @@ Footer.propTypes = {
18
18
  };
19
19
  const Body = memo(({ templateNameEditHandler, templateChangeHandler, hideColChangeHandler, templates, fieldName, bHideColumns, error, translate }) => {
20
20
  const selectedTemplate = templates.find(t => t.selected).value;
21
- return (_jsxs(_Fragment, { children: [_jsx(StyledRow, { children: _jsx(Input, { id: 'column-name', type: 'text', onChange: templateNameEditHandler, label: translate('Column name:'), placeholder: 'Enter a name', value: fieldName, required: true, status: error ? 'error' : null, info: error }) }), _jsx(StyledRow, { children: _jsx(Select, { id: 'select-template', value: selectedTemplate, onChange: templateChangeHandler, label: translate('Template:'), children: templates.map(v => (_jsx(Option, { value: v.value, children: translate(v.name) }, v.value))) }) }), _jsx(StyledRow, { children: _jsx(Checkbox, { checked: bHideColumns, id: 'hideColumns', onChange: hideColChangeHandler, label: translate('Hide columns'), name: 'Hide columns' }, 'hideColumns') })] }));
21
+ return (_jsxs(_Fragment, { children: [_jsx(StyledRow, { children: _jsx(Input, { id: 'column-name', type: 'text', onChange: templateNameEditHandler, label: translate('Column name:'), placeholder: translate('Enter a name'), value: fieldName, required: true, status: error ? 'error' : null, info: error }) }), _jsx(StyledRow, { children: _jsx(Select, { id: 'select-template', value: selectedTemplate, onChange: templateChangeHandler, label: translate('Template:'), children: templates.map(v => (_jsx(Option, { value: v.value, children: translate(v.name) }, v.value))) }) }), _jsx(StyledRow, { children: _jsx(Checkbox, { checked: bHideColumns, id: 'hideColumns', onChange: hideColChangeHandler, label: translate('Hide columns'), name: 'Hide columns' }, 'hideColumns') })] }));
22
22
  });
23
23
  Body.propTypes = {
24
24
  templateNameEditHandler: PropTypes.func.isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicFieldConfiguration.js","sourceRoot":"","sources":["../../../Core/Components/DynamicFieldConfi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AAgB,CAAC,OAAO,YAEhC,KAAC,IAAI,IACH,uBAAuB,EAAE,uBAAuB,EAChD,qBAAqB,EAAE,qBAAqB,EAC5C,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GACpB,GACS,CACd,CAAC,CAAC,CAAC,IAAI,GACP,CACJ,CAAC;AACJ,CAAC;AAED,yBAAyB,CAAC,SAAS,GAAG;IACpC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IACpD,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI;CACzB,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG;IACvC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { memo, useCallback, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { Select, Option, Button, Input, Checkbox, FormDialog } from '@pega/cosmos-react-core';\n\nimport { deepCopy } from '../Utils';\nimport useTranslate from '../Hooks/useTranslate';\n\nconst StyledRow = styled.div`\n margin: 0.625rem 0;\n`;\n\nconst Footer = memo(({ cancel, submit, translate }) => {\n return (\n <footer>\n <Button onClick={cancel}>{translate('Cancel')}</Button>\n <Button variant='primary' onClick={submit}>\n {translate('Submit')}\n </Button>\n </footer>\n );\n});\n\nFooter.propTypes = {\n cancel: PropTypes.func.isRequired,\n submit: PropTypes.func.isRequired,\n translate: PropTypes.func.isRequired\n};\n\nconst Body = memo(\n ({\n templateNameEditHandler,\n templateChangeHandler,\n hideColChangeHandler,\n templates,\n fieldName,\n bHideColumns,\n error,\n translate\n }) => {\n const selectedTemplate = templates.find(t => t.selected).value;\n return (\n <>\n <StyledRow>\n <Input\n id='column-name'\n type='text'\n onChange={templateNameEditHandler}\n label={translate('Column name:')}\n placeholder='Enter a name'\n value={fieldName}\n required\n status={error ? 'error' : null}\n info={error}\n />\n </StyledRow>\n <StyledRow>\n <Select\n id='select-template'\n value={selectedTemplate}\n onChange={templateChangeHandler}\n label={translate('Template:')}\n >\n {templates.map(v => (\n <Option key={v.value} value={v.value}>\n {translate(v.name)}\n </Option>\n ))}\n </Select>\n </StyledRow>\n <StyledRow>\n <Checkbox\n checked={bHideColumns}\n key='hideColumns'\n id='hideColumns'\n onChange={hideColChangeHandler}\n label={translate('Hide columns')}\n name='Hide columns'\n />\n </StyledRow>\n </>\n );\n }\n);\n\nBody.propTypes = {\n templateNameEditHandler: PropTypes.func.isRequired,\n templateChangeHandler: PropTypes.func.isRequired,\n hideColChangeHandler: PropTypes.func.isRequired,\n templates: PropTypes.arrayOf(PropTypes.any).isRequired,\n fieldName: PropTypes.string.isRequired,\n bHideColumns: PropTypes.bool.isRequired,\n error: PropTypes.string,\n translate: PropTypes.func.isRequired\n};\n\nBody.defaultProps = {\n error: null\n};\n\nexport default function DynamicFieldConfiguration({\n column,\n onSubmit,\n onCancel,\n popoverButtonRef,\n heading\n}) {\n const [translate] = useTranslate();\n\n const { dynamicFieldTemplates } = column.parent.meta;\n\n const [templates, updateTemplates] = useState(\n dynamicFieldTemplates ? deepCopy(dynamicFieldTemplates) : []\n );\n const [fieldName, updateFieldName] = useState('');\n const [bHideColumns, updateHideColumns] = useState(true);\n const [error, setError] = useState();\n const columnNameEmptyError = translate('Column name cannot be empty.');\n\n const templateChangeHandler = useCallback(\n e => {\n const items = [...templates];\n items.find(t => t.selected).selected = false;\n items.find(t => t.value === e.target.value).selected = true;\n updateTemplates(items);\n },\n [templates, updateTemplates]\n );\n\n const templateNameEditHandler = useCallback(\n e => {\n updateFieldName(e.target.value);\n },\n [updateFieldName]\n );\n const hideColChangeHandler = useCallback(\n e => {\n updateHideColumns(e.target.checked);\n },\n [updateHideColumns]\n );\n\n const submit = useCallback(() => {\n if (!fieldName.trim()) {\n setError(columnNameEmptyError);\n return;\n }\n setError(null);\n\n onSubmit(fieldName, templates.find(t => t.selected).value, bHideColumns);\n }, [onSubmit, fieldName, templates, bHideColumns, columnNameEmptyError]);\n\n const cancel = useCallback(() => {\n onCancel();\n }, [onCancel]);\n return (\n <>\n {popoverButtonRef.current ? (\n <FormDialog\n heading={translate(heading)}\n onSubmit={submit}\n onCancel={cancel}\n target={popoverButtonRef.current}\n >\n <Body\n templateNameEditHandler={templateNameEditHandler}\n templateChangeHandler={templateChangeHandler}\n hideColChangeHandler={hideColChangeHandler}\n templates={templates}\n fieldName={fieldName}\n bHideColumns={bHideColumns}\n error={error}\n translate={translate}\n />\n </FormDialog>\n ) : null}\n </>\n );\n}\n\nDynamicFieldConfiguration.propTypes = {\n column: PropTypes.objectOf(PropTypes.any).isRequired,\n onCancel: PropTypes.func,\n onSubmit: PropTypes.func\n};\n\nDynamicFieldConfiguration.defaultProps = {\n onCancel: () => {},\n onSubmit: () => {}\n};\n"]}
1
+ {"version":3,"file":"DynamicFieldConfiguration.js","sourceRoot":"","sources":["../../../Core/Components/DynamicFieldConfiguration.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE3B,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAA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AAS,CAAC,IAAI;CACzB,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG;IACvC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { memo, useCallback, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { Select, Option, Button, Input, Checkbox, FormDialog } from '@pega/cosmos-react-core';\n\nimport { deepCopy } from '../Utils';\nimport useTranslate from '../Hooks/useTranslate';\n\nconst StyledRow = styled.div`\n margin: 0.625rem 0;\n`;\n\nconst Footer = memo(({ cancel, submit, translate }) => {\n return (\n <footer>\n <Button onClick={cancel}>{translate('Cancel')}</Button>\n <Button variant='primary' onClick={submit}>\n {translate('Submit')}\n </Button>\n </footer>\n );\n});\n\nFooter.propTypes = {\n cancel: PropTypes.func.isRequired,\n submit: PropTypes.func.isRequired,\n translate: PropTypes.func.isRequired\n};\n\nconst Body = memo(\n ({\n templateNameEditHandler,\n templateChangeHandler,\n hideColChangeHandler,\n templates,\n fieldName,\n bHideColumns,\n error,\n translate\n }) => {\n const selectedTemplate = templates.find(t => t.selected).value;\n return (\n <>\n <StyledRow>\n <Input\n id='column-name'\n type='text'\n onChange={templateNameEditHandler}\n label={translate('Column name:')}\n placeholder={translate('Enter a name')}\n value={fieldName}\n required\n status={error ? 'error' : null}\n info={error}\n />\n </StyledRow>\n <StyledRow>\n <Select\n id='select-template'\n value={selectedTemplate}\n onChange={templateChangeHandler}\n label={translate('Template:')}\n >\n {templates.map(v => (\n <Option key={v.value} value={v.value}>\n {translate(v.name)}\n </Option>\n ))}\n </Select>\n </StyledRow>\n <StyledRow>\n <Checkbox\n checked={bHideColumns}\n key='hideColumns'\n id='hideColumns'\n onChange={hideColChangeHandler}\n label={translate('Hide columns')}\n name='Hide columns'\n />\n </StyledRow>\n </>\n );\n }\n);\n\nBody.propTypes = {\n templateNameEditHandler: PropTypes.func.isRequired,\n templateChangeHandler: PropTypes.func.isRequired,\n hideColChangeHandler: PropTypes.func.isRequired,\n templates: PropTypes.arrayOf(PropTypes.any).isRequired,\n fieldName: PropTypes.string.isRequired,\n bHideColumns: PropTypes.bool.isRequired,\n error: PropTypes.string,\n translate: PropTypes.func.isRequired\n};\n\nBody.defaultProps = {\n error: null\n};\n\nexport default function DynamicFieldConfiguration({\n column,\n onSubmit,\n onCancel,\n popoverButtonRef,\n heading\n}) {\n const [translate] = useTranslate();\n\n const { dynamicFieldTemplates } = column.parent.meta;\n\n const [templates, updateTemplates] = useState(\n dynamicFieldTemplates ? deepCopy(dynamicFieldTemplates) : []\n );\n const [fieldName, updateFieldName] = useState('');\n const [bHideColumns, updateHideColumns] = useState(true);\n const [error, setError] = useState();\n const columnNameEmptyError = translate('Column name cannot be empty.');\n\n const templateChangeHandler = useCallback(\n e => {\n const items = [...templates];\n items.find(t => t.selected).selected = false;\n items.find(t => t.value === e.target.value).selected = true;\n updateTemplates(items);\n },\n [templates, updateTemplates]\n );\n\n const templateNameEditHandler = useCallback(\n e => {\n updateFieldName(e.target.value);\n },\n [updateFieldName]\n );\n const hideColChangeHandler = useCallback(\n e => {\n updateHideColumns(e.target.checked);\n },\n [updateHideColumns]\n );\n\n const submit = useCallback(() => {\n if (!fieldName.trim()) {\n setError(columnNameEmptyError);\n return;\n }\n setError(null);\n\n onSubmit(fieldName, templates.find(t => t.selected).value, bHideColumns);\n }, [onSubmit, fieldName, templates, bHideColumns, columnNameEmptyError]);\n\n const cancel = useCallback(() => {\n onCancel();\n }, [onCancel]);\n return (\n <>\n {popoverButtonRef.current ? (\n <FormDialog\n heading={translate(heading)}\n onSubmit={submit}\n onCancel={cancel}\n target={popoverButtonRef.current}\n >\n <Body\n templateNameEditHandler={templateNameEditHandler}\n templateChangeHandler={templateChangeHandler}\n hideColChangeHandler={hideColChangeHandler}\n templates={templates}\n fieldName={fieldName}\n bHideColumns={bHideColumns}\n error={error}\n translate={translate}\n />\n </FormDialog>\n ) : null}\n </>\n );\n}\n\nDynamicFieldConfiguration.propTypes = {\n column: PropTypes.objectOf(PropTypes.any).isRequired,\n onCancel: PropTypes.func,\n onSubmit: PropTypes.func\n};\n\nDynamicFieldConfiguration.defaultProps = {\n onCancel: () => {},\n onSubmit: () => {}\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  export function CosmosProviders({ children }: {
2
2
  children: any;
3
3
  }): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<any>>;
4
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RSWrapper/index.jsx"],"names":[],"mappings":"AA+BO;;4CAEN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Components/RSWrapper/index.jsx"],"names":[],"mappings":"AAgCO;;4CAEN"}
@@ -13,6 +13,7 @@ import repeatComponent from '../../index';
13
13
  import { rowDensityClasses } from '../../constants';
14
14
  import useConfirmationModal from '../../Hooks/useConfirmationModal';
15
15
  import useSmallScreen from '../../Hooks/useSmallScreen';
16
+ import { LocalizationProvider } from '../../Context/LocalizationContext';
16
17
  const StyledRSContainer = styled(forwardRef((props, ref) => _jsx("div", { ref: ref, ...props })))(() => {
17
18
  const fullscreen = useFullscreenContext();
18
19
  return css `
@@ -80,5 +81,9 @@ RSWrapper.displayName = 'RSWrapper';
80
81
  RSWrapper.propTypes = {
81
82
  view: PropTypes.objectOf(PropTypes.any).isRequired
82
83
  };
83
- export default memo(forwardRef(repeatComponent(RSWrapper)));
84
+ const RepeatComponent = memo(forwardRef(repeatComponent(RSWrapper)));
85
+ const WithLocalization = (props, ref) => {
86
+ return (_jsx(LocalizationProvider, { children: _jsx(RepeatComponent, { ...props, ref: ref }) }));
87
+ };
88
+ export default memo(forwardRef(WithLocalization));
84
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/RSWrapper/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,eAAe,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,cAAc,MAAM,4BAA4B,CAAC;AAExD,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,cAAK,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC,CAAC,CAAC,GAAG,EAAE;IAC9F,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAE1C,OAAO,GAAG,CAAA;MACN,MAAM;;MAEN,UAAU;QACZ,UAAU,CAAC,CAAC,CAAC;QACb,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;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AE,KAAK,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE;QAChD,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,EAC3C,CAAC;QACD,kIAAkI;QAClI,OAAO,YAAY,CAAC,eAAe,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,EAAE,CAAC;IACjC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAEtC,OAAO,CACL,KAAC,eAAe,cACd,KAAC,iBAAiB,IAChB,GAAG,EAAE,CAAC,CAAC,EAAE;gBACP,eAAe,CAAC,CAAC,CAAC,CAAC;gBACnB,eAAe,CAAC,OAAO,GAAG,CAAC,CAAC;YAC9B,CAAC,EACD,KAAK,EAAE,YAAY,EACnB,SAAS,EAAC,YAAY,YAEtB,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,GACP,GACJ,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,SAAS,CAAC,SAAS,GAAG;IACpB,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;CACnD,CAAC;AAEF,eAAe,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { forwardRef, memo, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport styled, { css } from 'styled-components';\n\nimport { Fullscreen, useFullscreenContext } from '@pega/cosmos-react-core';\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport styles from '../../Views/rs-styles';\nimport Table from '../../Views/Table';\nimport Gallery from '../../Views/Gallery';\nimport Timeline from '../../Views/Timeline';\nimport Map from '../../Views/Map';\nimport repeatComponent from '../../index';\nimport { rowDensityClasses } from '../../constants';\nimport useConfirmationModal from '../../Hooks/useConfirmationModal';\nimport useSmallScreen from '../../Hooks/useSmallScreen';\n\nconst StyledRSContainer = styled(forwardRef((props, ref) => <div ref={ref} {...props} />))(() => {\n const fullscreen = useFullscreenContext();\n\n return css`\n ${styles}\n\n ${fullscreen &&\n fullscreen[0] &&\n css`\n height: 100%;\n `}\n `;\n});\n\nexport const CosmosProviders = ({ children }) => {\n return <Fullscreen>{children}</Fullscreen>;\n};\n\nconst RSWrapper = ({ view }) => {\n const { meta: { template } = {}, setDomContainer, columns } = view;\n\n let Component;\n switch (template) {\n case REPEATING_STRUCTURE_TEMPLATES.GALLERY:\n Component = Gallery;\n break;\n case REPEATING_STRUCTURE_TEMPLATES.TIMELINE:\n Component = Timeline;\n break;\n case REPEATING_STRUCTURE_TEMPLATES.MAP:\n Component = Map;\n break;\n default:\n Component = Table;\n }\n\n useConfirmationModal({ view });\n\n /**\n * Adding all column level styles into columnStyles on DOMContainer.\n * Since domContainer is the only ref available across the features.\n * If some feature want to override something (say Resize the width), that only refelects if we add styles here.\n * Other wise fall into specificity/precedence of local CSS variables.\n * This won't effect other RS views, since these styles are generated through features.\n * If a feature is not applicable it won't add styles to this object.\n */\n const columnStyles = columns?.reduce((acc, column) => {\n const { style, field, hidden } = column;\n if (hidden) return acc;\n Object.entries(style).forEach(([s, v]) => {\n acc[`--col-${s}-${field.idHash}`] = v;\n });\n return acc;\n }, {});\n const visibleColumns = view.getVisibleColumns();\n if (\n visibleColumns.length === 1 &&\n view.getRowDensity() === rowDensityClasses[4].id &&\n visibleColumns[0].field.width === undefined\n ) {\n // If table has only one column then make column width as auto. flex-grow on cell-last will stretch the column to available width.\n delete columnStyles[`--col-width-${visibleColumns[0].field.idHash}`];\n }\n\n const domContainerRef = useRef();\n useSmallScreen(view, domContainerRef);\n\n return (\n <CosmosProviders>\n <StyledRSContainer\n ref={r => {\n setDomContainer(r);\n domContainerRef.current = r;\n }}\n style={columnStyles}\n className='rs-wrapper'\n >\n <Component view={view} />\n </StyledRSContainer>\n </CosmosProviders>\n );\n};\n\nRSWrapper.displayName = 'RSWrapper';\n\nRSWrapper.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired\n};\n\nexport default memo(forwardRef(repeatComponent(RSWrapper)));\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/RSWrapper/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,eAAe,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,cAAK,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC,CAAC,CAAC,GAAG,EAAE;IAC9F,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAE1C,OAAO,GAAG,CAAA;MACN,MAAM;;MAEN,UAAU;QACZ,UAAU,CAAC,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AAC,CAAC;AAEF,eAAe,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC","sourcesContent":["import { forwardRef, memo, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport styled, { css } from 'styled-components';\n\nimport { Fullscreen, useFullscreenContext } from '@pega/cosmos-react-core';\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport styles from '../../Views/rs-styles';\nimport Table from '../../Views/Table';\nimport Gallery from '../../Views/Gallery';\nimport Timeline from '../../Views/Timeline';\nimport Map from '../../Views/Map';\nimport repeatComponent from '../../index';\nimport { rowDensityClasses } from '../../constants';\nimport useConfirmationModal from '../../Hooks/useConfirmationModal';\nimport useSmallScreen from '../../Hooks/useSmallScreen';\nimport { LocalizationProvider } from '../../Context/LocalizationContext';\n\nconst StyledRSContainer = styled(forwardRef((props, ref) => <div ref={ref} {...props} />))(() => {\n const fullscreen = useFullscreenContext();\n\n return css`\n ${styles}\n\n ${fullscreen &&\n fullscreen[0] &&\n css`\n height: 100%;\n `}\n `;\n});\n\nexport const CosmosProviders = ({ children }) => {\n return <Fullscreen>{children}</Fullscreen>;\n};\n\nconst RSWrapper = ({ view }) => {\n const { meta: { template } = {}, setDomContainer, columns } = view;\n\n let Component;\n switch (template) {\n case REPEATING_STRUCTURE_TEMPLATES.GALLERY:\n Component = Gallery;\n break;\n case REPEATING_STRUCTURE_TEMPLATES.TIMELINE:\n Component = Timeline;\n break;\n case REPEATING_STRUCTURE_TEMPLATES.MAP:\n Component = Map;\n break;\n default:\n Component = Table;\n }\n\n useConfirmationModal({ view });\n\n /**\n * Adding all column level styles into columnStyles on DOMContainer.\n * Since domContainer is the only ref available across the features.\n * If some feature want to override something (say Resize the width), that only refelects if we add styles here.\n * Other wise fall into specificity/precedence of local CSS variables.\n * This won't effect other RS views, since these styles are generated through features.\n * If a feature is not applicable it won't add styles to this object.\n */\n const columnStyles = columns?.reduce((acc, column) => {\n const { style, field, hidden } = column;\n if (hidden) return acc;\n Object.entries(style).forEach(([s, v]) => {\n acc[`--col-${s}-${field.idHash}`] = v;\n });\n return acc;\n }, {});\n const visibleColumns = view.getVisibleColumns();\n if (\n visibleColumns.length === 1 &&\n view.getRowDensity() === rowDensityClasses[4].id &&\n visibleColumns[0].field.width === undefined\n ) {\n // If table has only one column then make column width as auto. flex-grow on cell-last will stretch the column to available width.\n delete columnStyles[`--col-width-${visibleColumns[0].field.idHash}`];\n }\n\n const domContainerRef = useRef();\n useSmallScreen(view, domContainerRef);\n\n return (\n <CosmosProviders>\n <StyledRSContainer\n ref={r => {\n setDomContainer(r);\n domContainerRef.current = r;\n }}\n style={columnStyles}\n className='rs-wrapper'\n >\n <Component view={view} />\n </StyledRSContainer>\n </CosmosProviders>\n );\n};\n\nRSWrapper.displayName = 'RSWrapper';\n\nRSWrapper.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired\n};\n\nconst RepeatComponent = memo(forwardRef(repeatComponent(RSWrapper)));\n\nconst WithLocalization = (props, ref) => {\n return (\n <LocalizationProvider>\n <RepeatComponent {...props} ref={ref} />\n </LocalizationProvider>\n );\n};\n\nexport default memo(forwardRef(WithLocalization));\n"]}
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import defaultTranslations from '../Localization/defaultTranslations';
3
3
  export type RepeatingStructureTranslationPack = Readonly<typeof defaultTranslations>;
4
4
  interface LocalizationContextValue {
5
- translate: (rawString: string) => string;
5
+ translate: <T extends string | string[]>(rawString: T) => T;
6
6
  }
7
7
  declare const LocalizationContext: import("react").Context<LocalizationContextValue>;
8
8
  export default LocalizationContext;
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationContext.d.ts","sourceRoot":"","sources":["../../../Core/Context/LocalizationContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,MAAM,MAAM,iCAAiC,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrF,UAAU,wBAAwB;IAChC,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C;AAED,QAAA,MAAM,mBAAmB,mDAAmE,CAAC;AAC7F,eAAe,mBAAmB,CAAC;AAEnC,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAuBzE"}
1
+ {"version":3,"file":"LocalizationContext.d.ts","sourceRoot":"","sources":["../../../Core/Context/LocalizationContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,MAAM,MAAM,iCAAiC,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrF,UAAU,wBAAwB;IAChC,SAAS,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;CAC7D;AAED,QAAA,MAAM,mBAAmB,mDAEvB,CAAC;AACH,eAAe,mBAAmB,CAAC;AAEnC,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CA6BzE"}
@@ -2,7 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useCallback, useMemo } from 'react';
3
3
  import { useConfiguration } from '@pega/cosmos-react-core';
4
4
  import defaultTranslations from '../Localization/defaultTranslations';
5
- const LocalizationContext = createContext({ translate: () => '' });
5
+ const LocalizationContext = createContext({
6
+ translate: (rawString) => rawString
7
+ });
6
8
  export default LocalizationContext;
7
9
  export function LocalizationProvider({ children }) {
8
10
  const { translations } = useConfiguration();
@@ -11,9 +13,14 @@ export function LocalizationProvider({ children }) {
11
13
  // TODO: until translations pack is updated to have lists key specific to lists-lib static translations, we have to type cast.
12
14
  ...('lists' in translations && translations.lists)
13
15
  }), []);
14
- const translate = useCallback((rawString) => rawString in repeatingStructureTranslation
15
- ? repeatingStructureTranslation[rawString]
16
- : rawString, [repeatingStructureTranslation]);
16
+ const translateString = (str) => str in repeatingStructureTranslation
17
+ ? repeatingStructureTranslation[str]
18
+ : str;
19
+ const translate = useCallback((rawString) => {
20
+ return Array.isArray(rawString)
21
+ ? rawString.map(str => translateString(str))
22
+ : translateString(rawString);
23
+ }, [repeatingStructureTranslation]);
17
24
  const providerValue = useMemo(() => ({ translate }), [translate]);
18
25
  return (_jsx(LocalizationContext.Provider, { value: providerValue, children: children }));
19
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationContext.js","sourceRoot":"","sources":["../../../Core/Context/LocalizationContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAOtE,MAAM,mBAAmB,GAAG,aAAa,CAA2B,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7F,eAAe,mBAAmB,CAAC;AAEnC,MAAM,UAAU,oBAAoB,CAAC,EAAE,QAAQ,EAA2B;IACxE,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC5C,MAAM,6BAA6B,GAAG,OAAO,CAC3C,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,mBAAmB;QACtB,8HAA8H;QAC9H,GAAG,CAAC,OAAO,IAAI,YAAY,IAAK,YAAY,CAAC,KAA2C,CAAC;KAC1F,CAAC,EACF,EAAE,CACH,CAAC;IAEF,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,SAAiB,EAAE,EAAE,CACpB,SAAS,IAAI,6BAA6B;QACxC,CAAC,CAAC,6BAA6B,CAAC,SAAoD,CAAC;QACrF,CAAC,CAAC,SAAS,EACf,CAAC,6BAA6B,CAAC,CAChC,CAAC;IAEF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAAG,QAAQ,GAAgC,CAC9F,CAAC;AACJ,CAAC","sourcesContent":["import { createContext, useCallback, useMemo } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { useConfiguration } from '@pega/cosmos-react-core';\n\nimport defaultTranslations from '../Localization/defaultTranslations';\n\nexport type RepeatingStructureTranslationPack = Readonly<typeof defaultTranslations>;\ninterface LocalizationContextValue {\n translate: (rawString: string) => string;\n}\n\nconst LocalizationContext = createContext<LocalizationContextValue>({ translate: () => '' });\nexport default LocalizationContext;\n\nexport function LocalizationProvider({ children }: { children: ReactNode }) {\n const { translations } = useConfiguration();\n const repeatingStructureTranslation = useMemo(\n () => ({\n ...defaultTranslations,\n // TODO: until translations pack is updated to have lists key specific to lists-lib static translations, we have to type cast.\n ...('lists' in translations && (translations.lists as RepeatingStructureTranslationPack))\n }),\n []\n );\n\n const translate = useCallback(\n (rawString: string) =>\n rawString in repeatingStructureTranslation\n ? repeatingStructureTranslation[rawString as keyof RepeatingStructureTranslationPack]\n : rawString,\n [repeatingStructureTranslation]\n );\n\n const providerValue = useMemo(() => ({ translate }), [translate]);\n return (\n <LocalizationContext.Provider value={providerValue}>{children}</LocalizationContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"LocalizationContext.js","sourceRoot":"","sources":["../../../Core/Context/LocalizationContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA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Node } from 'react';\n\nimport { useConfiguration } from '@pega/cosmos-react-core';\n\nimport defaultTranslations from '../Localization/defaultTranslations';\n\nexport type RepeatingStructureTranslationPack = Readonly<typeof defaultTranslations>;\ninterface LocalizationContextValue {\n translate: <T extends string | string[]>(rawString: T) => T;\n}\n\nconst LocalizationContext = createContext<LocalizationContextValue>({\n translate: <T extends string | string[]>(rawString: T) => rawString\n});\nexport default LocalizationContext;\n\nexport function LocalizationProvider({ children }: { children: ReactNode }) {\n const { translations } = useConfiguration();\n const repeatingStructureTranslation = useMemo(\n () => ({\n ...defaultTranslations,\n // TODO: until translations pack is updated to have lists key specific to lists-lib static translations, we have to type cast.\n ...('lists' in translations && (translations.lists as RepeatingStructureTranslationPack))\n }),\n []\n );\n\n const translateString = (str: string): string =>\n str in repeatingStructureTranslation\n ? repeatingStructureTranslation[str as keyof RepeatingStructureTranslationPack]\n : str;\n\n const translate = useCallback(\n <T extends string | string[]>(rawString: T): T => {\n return Array.isArray(rawString)\n ? (rawString.map(str => translateString(str)) as T)\n : (translateString(rawString) as T);\n },\n [repeatingStructureTranslation]\n );\n\n const providerValue = useMemo(() => ({ translate }), [translate]);\n return (\n <LocalizationContext.Provider value={providerValue}>{children}</LocalizationContext.Provider>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useRepeat.d.ts","sourceRoot":"","sources":["../../../Core/Hooks/useRepeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAI1F;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,uGAAuG;IACvG,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC;IACnC,8GAA8G;IAC9G,SAAS,EAAE,WAAW,C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,SAAS,CAAC,EAChC,IAAI,EACJ,UAAU,EACV,OAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,WAAW,EACX,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,uBAAuB,EACxB,EAAE,wBAAwB,GAAG;IAAE,uBAAuB,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;CAAE,GAAG,QAAQ,CAoQjG"}
@@ -3,6 +3,7 @@ import { v4 as uuidV4 } from 'uuid';
3
3
  import { initializeRsCore, rowDragDropColumnMeta, sanitizeConditionalStyleFormats } from 'pega-repeating-structures-core';
4
4
  import { deepEqual, isRowReorderFieldEnabled } from '../Utils';
5
5
  import useThunkReducer from './useThunkReducer';
6
+ import useTranslate from './useTranslate';
6
7
  function getRsCoreApi(instance, opt) {
7
8
  if (instance.rsCoreApi)
8
9
  return instance.rsCoreApi;
@@ -24,7 +25,19 @@ export default function useRepeat({ meta, apiContext, presets = [], persistedInf
24
25
  // Normalize metadata everytime as you might have added custom column.
25
26
  // TODO: refactor this to normalizeMeta when required.
26
27
  const [, dispatch] = useThunkReducer();
27
- // FIXME: remove renderFactory from RsApi params
28
+ const rsCoreTranslationKeys = [
29
+ 'created_view',
30
+ 'created_view_with_default',
31
+ 'deleted_view',
32
+ 'saved_changes',
33
+ 'saved_changes_with_default',
34
+ 'view_marked_app_default',
35
+ 'view_marked_default',
36
+ 'view_navigation_instructions'
37
+ ];
38
+ const [translate] = useTranslate();
39
+ const rsCoreTranslationValues = translate(rsCoreTranslationKeys);
40
+ const rsCoreTranslations = Object.fromEntries(rsCoreTranslationKeys.map((key, index) => [key, rsCoreTranslationValues[index]]));
28
41
  Object.assign(instance, {
29
42
  apiContext,
30
43
  rsCoreApi: getRsCoreApi(instance, {
@@ -39,7 +52,8 @@ export default function useRepeat({ meta, apiContext, presets = [], persistedInf
39
52
  dispatch,
40
53
  mode,
41
54
  renderFactory,
42
- styleFormats
55
+ styleFormats,
56
+ translations: rsCoreTranslations
43
57
  })
44
58
  });
45
59
  Object.assign(instance, {
@@ -1 +1 @@
1
- {"version":3,"file":"useRepeat.js","sourceRoot":"","sources":["../../../Core/Hooks/useRepeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAkB,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,+BAA+B,EAEhC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAwBhD,SAAS,YAAY,CAAC,QAAkB,EAAE,GAA+B;IACvE,IAAI,QAAQ,CAAC,SAAS;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC;IAClD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,IAAI,EACJ,UAAU,EACV,OAAO,GAAG,EAAE,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,WAAW,EACX,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,uBAAuB,EAC8D;IACrF,6BAA6B;IAC7B,MAAM,QAAQ,GAAa,MAAM,CAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAc,CAAC,CAAC,OAAO,CAAC;IAEpF,sEAAsE;IACtE,sDAAsD;IAEtD,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,eAAe,EAAE,CAAC;IACvC,gDAAgD;IAChD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;QACtB,UAAU;QACV,SAAS,EAAE,YAAY,CAAC,QAAQ,EAAE;YAChC,UAAU;YACV,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WAAW,EAAE,CAAC;QACtC,IAAI,WAAW;YAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,QAAQ,CAAC,UAAU,CAAC,YAAY,IAAI,uBAAuB,EAAE,OAAO,EAAE,CAAC;YACzE,+FAA+F;YAC/F,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;gBAC/B,GAAG,uBAAuB,CAAC,OAAO;gBAClC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,YAAY;aACnD,CAAC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QAEvD,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,CAAC;YAC/C,oGAAoG;YACpG,aAAa;YACb,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;YAC1B,aAAa;YACb,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEzC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { useEffect, useCallback, useRef, useImperativeHandle, type RefObject } from 'react';\nimport { v4 as uuidV4 } from 'uuid';\n\nimport {\n initializeRsCore,\n rowDragDropColumnMeta,\n sanitizeConditionalStyleFormats,\n type RsCoreTypes\n} from 'pega-repeating-structures-core';\n\nimport { deepEqual, isRowReorderFieldEnabled } from '../Utils';\nimport type { RepeatingStructuresProps } from '../../types/RepeatingStructuresBoot.types';\n\nimport useThunkReducer from './useThunkReducer';\n\n/**\n * Represents the instance of a repeating structure, containing methods and properties\n * to interact with it.\n */\nexport interface Instance {\n /** A unique identifier for the repeating structure instance. */\n rsID: string;\n /** The API context for interacting with the repeating structure. See {@link RsCoreTypes.ApiContext} */\n apiContext: RsCoreTypes.ApiContext;\n /** The core API for managing the repeating structure's state and behavior. See {@link RsCoreTypes.RsCore}. */\n rsCoreApi: RsCoreTypes.RsCore;\n /** A method to retrieve the current view of the repeating structure. See {@link RsCoreTypes.RsCore.getView} */\n getView: RsCoreTypes.RsCore['getView'];\n /**\n * @deprecated This set of methods is deprecated and will be removed in future versions.\n * Use methods exposed using repeatComponentInstance instead.\n *\n * A set of APIs to interact with the repeating structure. See {@link RsCoreTypes.RsApi}.\n * */\n api: Pick<RsCoreTypes.RsApi, 'dispatchAction' | 'setRecordCount'>;\n}\n\nfunction getRsCoreApi(instance: Instance, opt: RsCoreTypes.RsCoreInitArgs) {\n if (instance.rsCoreApi) return instance.rsCoreApi;\n return initializeRsCore(opt);\n}\n\n/**\n * A custom React hook to manage the lifecycle of repeating structures using `RsCore` library.\n * It provides an RsCoreTypes.RsApi for interacting with the view.\n * Provide additional callbacks to API Context via `addCallbacks` method.\n *\n * @param props - RepeatingStructuresProps required to initialize and manage the repeating structures.\n * @see {@link RepeatingStructuresProps}\n * @returns A singleton instance object that contains methods to interact with repeating structure.\n * @see {@link Instance}\n */\nexport default function useRepeat({\n meta,\n apiContext,\n presets = [],\n persistedInfo,\n onRowClickAction,\n renderFactory,\n renderFormatterTypeMap,\n formatters,\n onViewReady,\n mode,\n toolBarOptions,\n styleFormats,\n repeatComponentInstance\n}: RepeatingStructuresProps & { repeatComponentInstance: RefObject<RsCoreTypes.RsApi> }): Instance {\n // Create the repeat instance\n const instance: Instance = useRef<Instance>({ rsID: uuidV4() } as Instance).current;\n\n // Normalize metadata everytime as you might have added custom column.\n // TODO: refactor this to normalizeMeta when required.\n\n const [, dispatch] = useThunkReducer();\n // FIXME: remove renderFactory from RsApi params\n Object.assign(instance, {\n apiContext,\n rsCoreApi: getRsCoreApi(instance, {\n formatters,\n renderFormatterTypeMap,\n toolBarOptions,\n meta,\n onRowClickAction,\n apiContext,\n presets,\n persistedInfo,\n dispatch,\n mode,\n renderFactory,\n styleFormats\n })\n });\n\n Object.assign(instance, {\n getView: instance.rsCoreApi.getView\n });\n\n // TODO: enrich this to take meta as well\n instance.rsCoreApi.updateInitArgs({ apiContext, styleFormats });\n\n instance.api = {\n ...(instance.api || {}),\n setRecordCount: instance.getView().type.setRecordCount,\n dispatchAction: instance.getView().type.dispatchAction\n };\n\n /** Compare new payload with current state to avoid unnecessary rerenders */\n // TODO: create separate api for setting visibility state for OOTB columns.\n const setHiddenColumns = useCallback(\n (hiddenColumns: string[], ootbColumns?: { dragHandle?: boolean }) => {\n if (\n hiddenColumns &&\n !ootbColumns &&\n hiddenColumns.length === instance.getView().state.hiddenColumns?.length &&\n hiddenColumns.every(id => instance.getView().state.hiddenColumns?.includes(id))\n ) {\n return;\n }\n if (ootbColumns?.dragHandle && !isRowReorderFieldEnabled(instance.getView().meta)) {\n delete ootbColumns.dragHandle;\n }\n instance.getView().type.applyHiddenColumns(hiddenColumns, ootbColumns);\n },\n [instance]\n );\n\n const setColumnOrder: RsCoreTypes.RsApi['setColumnOrder'] = useCallback(\n (colOrder: string[]) => {\n if (colOrder && deepEqual(colOrder, instance.getView().state.colOrder)) {\n return;\n }\n instance.getView().type.applyOrder(colOrder);\n },\n [instance]\n );\n\n const setAggregations: RsCoreTypes.RsApi['setAggregations'] = useCallback(\n (agg: RsCoreTypes.State['aggregationInfo']) => {\n if (agg && deepEqual(agg, instance.getView().state.aggregationInfo)) {\n return;\n }\n if (agg) instance.getView().type.applyAggregations(agg);\n },\n [instance]\n );\n\n const setFilter: RsCoreTypes.RsApi['setFilter'] = useCallback(\n newFilter => {\n if (newFilter && deepEqual(newFilter, instance.getView().state.filterExpression)) {\n return;\n }\n instance.getView().type.applyFilter({ filterExp: newFilter });\n },\n [instance]\n );\n\n const setAliases: RsCoreTypes.RsApi['setAliases'] = useCallback(\n aliases => {\n if (!aliases) {\n return;\n }\n instance.getView().type.applyAliases({ aliases });\n },\n [instance]\n );\n\n const setSorting: RsCoreTypes.RsApi['setSorting'] = useCallback(\n sortingOrder => {\n if (sortingOrder && deepEqual(sortingOrder, instance.getView().state.sortingOrder)) {\n return;\n }\n instance.getView().type.applySorting(sortingOrder);\n },\n [instance]\n );\n\n const setGrouping: RsCoreTypes.RsApi['setGrouping'] = useCallback(\n (groups: RsCoreTypes.Group[]) => {\n if (groups && deepEqual(groups, instance.getView().state.groups)) {\n return;\n }\n instance.getView().type.applyGrouping(groups);\n },\n [instance]\n );\n\n const setRowReorderFieldVisibility: RsCoreTypes.RsApi['setRowReorderFieldVisibility'] =\n useCallback(\n visibility => {\n if (isRowReorderFieldEnabled(instance.getView().meta)) {\n instance\n .getView()\n .type.updateColumnsVisibility({ [rowDragDropColumnMeta.field.id]: visibility });\n }\n },\n [instance]\n );\n\n const updateColumnsVisibility: RsCoreTypes.RsApi['updateColumnsVisibility'] = useCallback(\n columns => {\n const fieldDefs = instance.getView().meta.fieldDefs.map(field => field.id);\n const columnsToBeToggled: Record<string, boolean> = {};\n Object.keys(columns).forEach(column => {\n if (fieldDefs.includes(column)) {\n columnsToBeToggled[column] = columns[column];\n }\n });\n if (Object.keys(columnsToBeToggled).length) {\n instance.getView().type.updateColumnsVisibility(columnsToBeToggled);\n }\n },\n [instance]\n );\n\n const getActiveViewInfo = useCallback(() => {\n const {\n state: { personalization }\n } = instance.getView();\n\n const activePersonalization = personalization?.active;\n const activePersonalizationName = activePersonalization\n ? personalization?.allPersonalizations?.[activePersonalization]?.name\n : undefined;\n return {\n id: activePersonalization,\n name: activePersonalizationName,\n isDirty: !!personalization?.dirty\n };\n }, [instance]);\n\n const setConditionalStyleFormats: RsCoreTypes.RsApi['setConditionalStyleFormats'] = useCallback(\n conditionalStyleFormats => {\n const {\n meta: { fieldDefs }\n } = instance.getView();\n\n if (\n conditionalStyleFormats &&\n deepEqual(conditionalStyleFormats, instance.getView().state.conditionalStyleFormats)\n ) {\n return;\n }\n\n const sanitizedFormats = sanitizeConditionalStyleFormats(conditionalStyleFormats, fieldDefs);\n instance.getView().type.setConditionalStyleFormats(sanitizedFormats);\n },\n []\n );\n\n // TODO: Move the RsCoreTypes.RsApi's to separate file, maybe useRsApi.ts\n // TODO:\n useImperativeHandle(\n repeatComponentInstance,\n () => ({\n refreshView: instance.getView().type.forceRefresh,\n setRecordCount: instance.getView().type.setRecordCount,\n dispatchAction: instance.getView().type.dispatchAction,\n getActiveViewInfo,\n /** Only expose below APIs when those features are enabled */\n setHiddenColumns: instance.getView().meta.toggleFieldVisibility\n ? setHiddenColumns\n : undefined,\n setColumnOrder: instance.getView().meta.reorderFields ? setColumnOrder : undefined,\n setFilter,\n setSorting,\n setAliases,\n setGrouping: instance.getView().meta.grouping ? setGrouping : undefined,\n setAggregations,\n setRowReorderFieldVisibility,\n updateColumnsVisibility,\n setConditionalStyleFormats\n }),\n\n []\n );\n\n // When ever component mounts, do this after first render of component\n useEffect(() => {\n instance.getView().type.doBootstrap();\n if (onViewReady) onViewReady(instance.api);\n if (instance.apiContext.addCallbacks && repeatComponentInstance?.current) {\n // add instance APIs as callbacks <setRecordCount> for push communication from Nebula to Client\n instance.apiContext.addCallbacks({\n ...repeatComponentInstance.current,\n forceRefresh: instance.getView().type.forceRefresh\n });\n }\n\n instance.apiContext.setRsID?.(instance.getView().rsID);\n\n instance.rsCoreApi.notifyViewEvent().mount();\n return () => {\n instance.rsCoreApi.notifyViewEvent().unmount();\n // Marking it as ts-ignore. Making these objects take null will increase conditional blocks in code.\n // @ts-ignore\n instance.rsCoreApi = null;\n // @ts-ignore\n instance.getView = null;\n };\n }, [instance]);\n\n useEffect(() => {\n instance.rsCoreApi.notifyViewEvent().afterRender();\n }, [instance, instance.getView().state]);\n\n return instance;\n}\n"]}
1
+ {"version":3,"file":"useRepeat.js","sourceRoot":"","sources":["../../../Core/Hooks/useRepeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAkB,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,+BAA+B,EAEhC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAwB1C,SAAS,YAAY,CAAC,QAAkB,EAAE,GAA+B;IACvE,IAAI,QAAQ,CAAC,SAAS;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC;IAClD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,IAAI,EACJ,UAAU,EACV,OAAO,GAAG,EAAE,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,WAAW,EACX,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,uBAAuB,EAC8D;IACrF,6BAA6B;IAC7B,MAAM,QAAQ,GAAa,MAAM,CAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAc,CAAC,CAAC,OAAO,CAAC;IAEpF,sEAAsE;IACtE,sDAAsD;IAEtD,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,eAAe,EAAE,CAAC;IAIvC,MAAM,qBAAqB,GAA4B;QACrD,cAAc;QACd,2BAA2B;QAC3B,cAAc;QACd,eAAe;QACf,4BAA4B;QAC5B,yBAAyB;QACzB,qBAAqB;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;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEzC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { useEffect, useCallback, useRef, useImperativeHandle, type RefObject } from 'react';\nimport { v4 as uuidV4 } from 'uuid';\n\nimport {\n initializeRsCore,\n rowDragDropColumnMeta,\n sanitizeConditionalStyleFormats,\n type RsCoreTypes\n} from 'pega-repeating-structures-core';\n\nimport { deepEqual, isRowReorderFieldEnabled } from '../Utils';\nimport type { RepeatingStructuresProps } from '../../types/RepeatingStructuresBoot.types';\n\nimport useThunkReducer from './useThunkReducer';\nimport useTranslate from './useTranslate';\n\n/**\n * Represents the instance of a repeating structure, containing methods and properties\n * to interact with it.\n */\nexport interface Instance {\n /** A unique identifier for the repeating structure instance. */\n rsID: string;\n /** The API context for interacting with the repeating structure. See {@link RsCoreTypes.ApiContext} */\n apiContext: RsCoreTypes.ApiContext;\n /** The core API for managing the repeating structure's state and behavior. See {@link RsCoreTypes.RsCore}. */\n rsCoreApi: RsCoreTypes.RsCore;\n /** A method to retrieve the current view of the repeating structure. See {@link RsCoreTypes.RsCore.getView} */\n getView: RsCoreTypes.RsCore['getView'];\n /**\n * @deprecated This set of methods is deprecated and will be removed in future versions.\n * Use methods exposed using repeatComponentInstance instead.\n *\n * A set of APIs to interact with the repeating structure. See {@link RsCoreTypes.RsApi}.\n * */\n api: Pick<RsCoreTypes.RsApi, 'dispatchAction' | 'setRecordCount'>;\n}\n\nfunction getRsCoreApi(instance: Instance, opt: RsCoreTypes.RsCoreInitArgs) {\n if (instance.rsCoreApi) return instance.rsCoreApi;\n return initializeRsCore(opt);\n}\n\n/**\n * A custom React hook to manage the lifecycle of repeating structures using `RsCore` library.\n * It provides an RsCoreTypes.RsApi for interacting with the view.\n * Provide additional callbacks to API Context via `addCallbacks` method.\n *\n * @param props - RepeatingStructuresProps required to initialize and manage the repeating structures.\n * @see {@link RepeatingStructuresProps}\n * @returns A singleton instance object that contains methods to interact with repeating structure.\n * @see {@link Instance}\n */\nexport default function useRepeat({\n meta,\n apiContext,\n presets = [],\n persistedInfo,\n onRowClickAction,\n renderFactory,\n renderFormatterTypeMap,\n formatters,\n onViewReady,\n mode,\n toolBarOptions,\n styleFormats,\n repeatComponentInstance\n}: RepeatingStructuresProps & { repeatComponentInstance: RefObject<RsCoreTypes.RsApi> }): Instance {\n // Create the repeat instance\n const instance: Instance = useRef<Instance>({ rsID: uuidV4() } as Instance).current;\n\n // Normalize metadata everytime as you might have added custom column.\n // TODO: refactor this to normalizeMeta when required.\n\n const [, dispatch] = useThunkReducer();\n // FIXME: remove renderFactory from RsApi params\n\n type RsCoreTranslationKeys = keyof NonNullable<RsCoreTypes.RsCoreInitArgs['translations']>;\n const rsCoreTranslationKeys: RsCoreTranslationKeys[] = [\n 'created_view',\n 'created_view_with_default',\n 'deleted_view',\n 'saved_changes',\n 'saved_changes_with_default',\n 'view_marked_app_default',\n 'view_marked_default',\n 'view_navigation_instructions'\n ];\n\n const [translate] = useTranslate();\n const rsCoreTranslationValues = translate(rsCoreTranslationKeys);\n const rsCoreTranslations = Object.fromEntries(\n rsCoreTranslationKeys.map((key, index) => [key, rsCoreTranslationValues[index]])\n );\n\n Object.assign(instance, {\n apiContext,\n rsCoreApi: getRsCoreApi(instance, {\n formatters,\n renderFormatterTypeMap,\n toolBarOptions,\n meta,\n onRowClickAction,\n apiContext,\n presets,\n persistedInfo,\n dispatch,\n mode,\n renderFactory,\n styleFormats,\n translations: rsCoreTranslations\n })\n });\n\n Object.assign(instance, {\n getView: instance.rsCoreApi.getView\n });\n\n // TODO: enrich this to take meta as well\n instance.rsCoreApi.updateInitArgs({ apiContext, styleFormats });\n\n instance.api = {\n ...(instance.api || {}),\n setRecordCount: instance.getView().type.setRecordCount,\n dispatchAction: instance.getView().type.dispatchAction\n };\n\n /** Compare new payload with current state to avoid unnecessary rerenders */\n // TODO: create separate api for setting visibility state for OOTB columns.\n const setHiddenColumns = useCallback(\n (hiddenColumns: string[], ootbColumns?: { dragHandle?: boolean }) => {\n if (\n hiddenColumns &&\n !ootbColumns &&\n hiddenColumns.length === instance.getView().state.hiddenColumns?.length &&\n hiddenColumns.every(id => instance.getView().state.hiddenColumns?.includes(id))\n ) {\n return;\n }\n if (ootbColumns?.dragHandle && !isRowReorderFieldEnabled(instance.getView().meta)) {\n delete ootbColumns.dragHandle;\n }\n instance.getView().type.applyHiddenColumns(hiddenColumns, ootbColumns);\n },\n [instance]\n );\n\n const setColumnOrder: RsCoreTypes.RsApi['setColumnOrder'] = useCallback(\n (colOrder: string[]) => {\n if (colOrder && deepEqual(colOrder, instance.getView().state.colOrder)) {\n return;\n }\n instance.getView().type.applyOrder(colOrder);\n },\n [instance]\n );\n\n const setAggregations: RsCoreTypes.RsApi['setAggregations'] = useCallback(\n (agg: RsCoreTypes.State['aggregationInfo']) => {\n if (agg && deepEqual(agg, instance.getView().state.aggregationInfo)) {\n return;\n }\n if (agg) instance.getView().type.applyAggregations(agg);\n },\n [instance]\n );\n\n const setFilter: RsCoreTypes.RsApi['setFilter'] = useCallback(\n newFilter => {\n if (newFilter && deepEqual(newFilter, instance.getView().state.filterExpression)) {\n return;\n }\n instance.getView().type.applyFilter({ filterExp: newFilter });\n },\n [instance]\n );\n\n const setAliases: RsCoreTypes.RsApi['setAliases'] = useCallback(\n aliases => {\n if (!aliases) {\n return;\n }\n instance.getView().type.applyAliases({ aliases });\n },\n [instance]\n );\n\n const setSorting: RsCoreTypes.RsApi['setSorting'] = useCallback(\n sortingOrder => {\n if (sortingOrder && deepEqual(sortingOrder, instance.getView().state.sortingOrder)) {\n return;\n }\n instance.getView().type.applySorting(sortingOrder);\n },\n [instance]\n );\n\n const setGrouping: RsCoreTypes.RsApi['setGrouping'] = useCallback(\n (groups: RsCoreTypes.Group[]) => {\n if (groups && deepEqual(groups, instance.getView().state.groups)) {\n return;\n }\n instance.getView().type.applyGrouping(groups);\n },\n [instance]\n );\n\n const setRowReorderFieldVisibility: RsCoreTypes.RsApi['setRowReorderFieldVisibility'] =\n useCallback(\n visibility => {\n if (isRowReorderFieldEnabled(instance.getView().meta)) {\n instance\n .getView()\n .type.updateColumnsVisibility({ [rowDragDropColumnMeta.field.id]: visibility });\n }\n },\n [instance]\n );\n\n const updateColumnsVisibility: RsCoreTypes.RsApi['updateColumnsVisibility'] = useCallback(\n columns => {\n const fieldDefs = instance.getView().meta.fieldDefs.map(field => field.id);\n const columnsToBeToggled: Record<string, boolean> = {};\n Object.keys(columns).forEach(column => {\n if (fieldDefs.includes(column)) {\n columnsToBeToggled[column] = columns[column];\n }\n });\n if (Object.keys(columnsToBeToggled).length) {\n instance.getView().type.updateColumnsVisibility(columnsToBeToggled);\n }\n },\n [instance]\n );\n\n const getActiveViewInfo = useCallback(() => {\n const {\n state: { personalization }\n } = instance.getView();\n\n const activePersonalization = personalization?.active;\n const activePersonalizationName = activePersonalization\n ? personalization?.allPersonalizations?.[activePersonalization]?.name\n : undefined;\n return {\n id: activePersonalization,\n name: activePersonalizationName,\n isDirty: !!personalization?.dirty\n };\n }, [instance]);\n\n const setConditionalStyleFormats: RsCoreTypes.RsApi['setConditionalStyleFormats'] = useCallback(\n conditionalStyleFormats => {\n const {\n meta: { fieldDefs }\n } = instance.getView();\n\n if (\n conditionalStyleFormats &&\n deepEqual(conditionalStyleFormats, instance.getView().state.conditionalStyleFormats)\n ) {\n return;\n }\n\n const sanitizedFormats = sanitizeConditionalStyleFormats(conditionalStyleFormats, fieldDefs);\n instance.getView().type.setConditionalStyleFormats(sanitizedFormats);\n },\n []\n );\n\n // TODO: Move the RsCoreTypes.RsApi's to separate file, maybe useRsApi.ts\n // TODO:\n useImperativeHandle(\n repeatComponentInstance,\n () => ({\n refreshView: instance.getView().type.forceRefresh,\n setRecordCount: instance.getView().type.setRecordCount,\n dispatchAction: instance.getView().type.dispatchAction,\n getActiveViewInfo,\n /** Only expose below APIs when those features are enabled */\n setHiddenColumns: instance.getView().meta.toggleFieldVisibility\n ? setHiddenColumns\n : undefined,\n setColumnOrder: instance.getView().meta.reorderFields ? setColumnOrder : undefined,\n setFilter,\n setSorting,\n setAliases,\n setGrouping: instance.getView().meta.grouping ? setGrouping : undefined,\n setAggregations,\n setRowReorderFieldVisibility,\n updateColumnsVisibility,\n setConditionalStyleFormats\n }),\n\n []\n );\n\n // When ever component mounts, do this after first render of component\n useEffect(() => {\n instance.getView().type.doBootstrap();\n if (onViewReady) onViewReady(instance.api);\n if (instance.apiContext.addCallbacks && repeatComponentInstance?.current) {\n // add instance APIs as callbacks <setRecordCount> for push communication from Nebula to Client\n instance.apiContext.addCallbacks({\n ...repeatComponentInstance.current,\n forceRefresh: instance.getView().type.forceRefresh\n });\n }\n\n instance.apiContext.setRsID?.(instance.getView().rsID);\n\n instance.rsCoreApi.notifyViewEvent().mount();\n return () => {\n instance.rsCoreApi.notifyViewEvent().unmount();\n // Marking it as ts-ignore. Making these objects take null will increase conditional blocks in code.\n // @ts-ignore\n instance.rsCoreApi = null;\n // @ts-ignore\n instance.getView = null;\n };\n }, [instance]);\n\n useEffect(() => {\n instance.rsCoreApi.notifyViewEvent().afterRender();\n }, [instance, instance.getView().state]);\n\n return instance;\n}\n"]}
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @returns An array containing the `translate` function for localization.
5
5
  */
6
- export default function useTranslate(): ((rawString: string) => string)[];
6
+ export default function useTranslate(): (<T extends string | string[]>(rawString: T) => T)[];
7
7
  //# sourceMappingURL=useTranslate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTranslate.d.ts","sourceRoot":"","sources":["../../../Core/Hooks/useTranslate.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,sCAGnC"}
1
+ {"version":3,"file":"useTranslate.d.ts","sourceRoot":"","sources":["../../../Core/Hooks/useTranslate.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,yDAGnC"}
@@ -149,6 +149,14 @@ declare const defaultTranslations: {
149
149
  table_a11y_instructions_enter_description: string;
150
150
  table_a11y_instructions_escape_label: string;
151
151
  table_a11y_instructions_escape_description: string;
152
+ saved_changes: string;
153
+ saved_changes_with_default: string;
154
+ view_marked_default: string;
155
+ view_marked_app_default: string;
156
+ created_view: string;
157
+ created_view_with_default: string;
158
+ deleted_view: string;
159
+ view_navigation_instructions: string;
152
160
  };
153
161
  export default defaultTranslations;
154
162
  //# sourceMappingURL=defaultTranslations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTranslations.d.ts","sourceRoot":"","sources":["../../../Core/Localization/defaultTranslations.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"defaultTranslations.d.ts","sourceRoot":"","sources":["../../../Core/Localization/defaultTranslations.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -149,7 +149,15 @@ const defaultTranslations = {
149
149
  table_a11y_instructions_enter_label: 'Enter key',
150
150
  table_a11y_instructions_enter_description: 'when on a cell with editable controls, switches to Tab navigation mode. Tab key now navigates between all interactive controls in the grid',
151
151
  table_a11y_instructions_escape_label: 'Escape key',
152
- table_a11y_instructions_escape_description: 'restores arrow-based grid navigation'
152
+ table_a11y_instructions_escape_description: 'restores arrow-based grid navigation',
153
+ saved_changes: '{0} saved with changes',
154
+ saved_changes_with_default: 'saved with changes {0} and marked as default view',
155
+ view_marked_default: '{0} view is marked as Default',
156
+ view_marked_app_default: '{0} view is marked as App Default',
157
+ created_view: 'Created view {0}',
158
+ created_view_with_default: 'Created view {0} and marked as default view',
159
+ deleted_view: 'Deleted view {0}',
160
+ view_navigation_instructions: '{0}, Refer to keyboard instructions for navigation.'
153
161
  };
154
162
  export default defaultTranslations;
155
163
  //# sourceMappingURL=defaultTranslations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTranslations.js","sourceRoot":"","sources":["../../../Core/Localization/defaultTranslations.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,mBAAmB,EAAE,mBAAmB;IACxC,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,eAAe,EAAE,eAAe;IAChC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,eAAe;IAChC,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,IAAI;IACR,0DAA0D,EACxD,0DAA0D;IAC5D,OAAO,EAAE,SAAS;IAClB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,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,wBAAwB,EAAE,wBAAwB;IAClD,qBAAqB,EAAE,qBAAqB;IAC5C,aAAa,EAAE,aAAa;IAC5B,iBAAiB,EAAE,iBAAiB;IACpC,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,aAAa;IAC5B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,qBAAqB,EAAE,qBAAqB;IAC5C,cAAc,EAAE,cAAc;IAC9B,mBAAmB,EAAE,mBAAmB;IACxC,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,eAAe;IAChC,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,iDAAiD;IACnE,wCAAwC,EAAE,oCAAoC;IAC9E,8CAA8C,EAAE,gBAAgB;IAChE,mCAAmC,EAAE,WAAW;IAChD,yCAAyC,EACvC,4IAA4I;IAC9I,oCAAoC,EAAE,YAAY;IAClD,0CAA0C,EAAE,sCAAsC;CACnF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// FIXME: Move this file to Demo folder once the typings are available from cosmos translations pack\nconst defaultTranslations = {\n Submit: 'Submit',\n 'Hide header icons': 'Hide header icons',\n 'Column name:': 'Column name:',\n 'Template:': 'Template:',\n 'Hide columns': 'Hide columns',\n 'Remove filter': 'Remove filter',\n Year: 'Year',\n Quarter: 'Quarter',\n Month: 'Month',\n Week: 'Week',\n Day: 'Day',\n Hour: 'Hour',\n Minute: 'Minute',\n 'Month of year': 'Month of year',\n 'Day of month': 'Day of month',\n 'Day of week': 'Day of week',\n 'Hour of day': 'Hour of day',\n Add: 'Add',\n Aggregate: 'Aggregate',\n Cancel: 'Cancel',\n Ok: 'Ok',\n 'has unsaved changes, do you want to discard and proceed?':\n 'has unsaved changes, do you want to discard and proceed?',\n Actions: 'Actions',\n actions: 'actions',\n 'Edit details': 'Edit details',\n 'Change stage': 'Change stage',\n Preview: 'Preview',\n 'Open in a new tab': 'Open in a new tab',\n Edit: 'Edit',\n 'Copy text': 'Copy text',\n 'Paste text': 'Paste text',\n 'Filter by this': 'Filter by this',\n 'Open link in new tab': 'Open link in new tab',\n default: 'default',\n Grouping: 'Grouping',\n to: 'to',\n Filter: 'Filter',\n Freeze: 'Freeze',\n Hide: 'Hide',\n Summarize: 'Summarize',\n 'Combine with left': 'Combine with left',\n 'Combine with right': 'Combine with right',\n Delete: 'Delete',\n Format: 'Format',\n Alias: 'Alias',\n 'Enter alias': 'Enter alias',\n 'Filter by': 'Filter by',\n Group: 'Group',\n 'Group by': 'Group by',\n Sort: 'Sort',\n 'Sort by': 'Sort by',\n 'Row density': 'Row density',\n 'Show/hide columns': 'Show/hide columns',\n 'Freeze columns': 'Freeze columns',\n 'Save view as..': 'Save view as..',\n 'Save changes': 'Save changes',\n 'View as...': 'View as...',\n 'Edit view': 'Edit view',\n 'Set as default': 'Set as default',\n 'Mark as default?': 'Mark as default?',\n 'Mark as app default': 'Mark as app default',\n 'Delete view': 'Delete view',\n 'Reset column widths': 'Reset column widths',\n 'Auto size columns': 'Auto size columns',\n ShowHeaderIcons: 'ShowHeaderIcons',\n 'Query info': 'Query info',\n 'Export to Excel': 'Export to Excel',\n 'Export to CSV': 'Export to CSV',\n Class: 'Class',\n 'Data page': 'Data page',\n 'Data source': 'Data source',\n 'Time taken': 'Time taken',\n 'Insight ID': 'Insight ID',\n 'Undo hierarchy': 'Undo hierarchy',\n Normal: 'Normal',\n Hierarchical: 'Hierarchical',\n Display: 'Display',\n table: 'table',\n 'Use arrow keys or Shift plus Alt plus arrow keys to navigate':\n 'Use arrow keys or Shift plus Alt plus arrow keys to navigate',\n 'No actions available': 'No actions available',\n 'Use Enter to open header menu': 'Use Enter to open header menu',\n 'Loading more results': 'Loading more results',\n Sorted: 'Sorted',\n 'Sort priority': 'Sort priority',\n 'Filtered column': 'Filtered column',\n Ascending: 'Ascending',\n Descending: 'Descending',\n Select: 'Select',\n 'Select all': 'Select all',\n 'Collapse all groups': 'Collapse all groups',\n 'Expand all groups': 'Expand all groups',\n Sum: 'Sum',\n Min: 'Min',\n Max: 'Max',\n Avg: 'Avg',\n 'Aggregate options': 'Aggregate options',\n 'Select two or more items to enable bulk actions':\n 'Select two or more items to enable bulk actions',\n 'Bulk actions': 'Bulk actions',\n 'Group applied': 'Group applied',\n 'Group modified': 'Group modified',\n 'Group removed': 'Group removed',\n Loading: 'Loading',\n 'Loading completed': 'Loading completed',\n 'name is reserved for non Personalized view and cannot be used.':\n 'name is reserved for non Personalized view and cannot be used.',\n 'This view is already present.': 'This view is already present.',\n 'This view name cannot be empty.': 'This view name cannot be empty.',\n 'View name must contain less than 65 characters.':\n 'View name must contain less than 65 characters.',\n 'Sort order': 'Sort order',\n Field: 'Field',\n 'Column name cannot be empty.': 'Column name cannot be empty.',\n 'Sort ascending': 'Sort ascending',\n 'Sort descending': 'Sort descending',\n 'Remove sort': 'Remove sort',\n 'No records found.': 'No records found.',\n 'Clear filter': 'Clear filter',\n Equals: 'Equals',\n 'Not equals': 'Not equals',\n After: 'After',\n Before: 'Before',\n 'On or after': 'On or after',\n 'On or before': 'On or before',\n 'Greater than': 'Greater than',\n 'Less than': 'Less than',\n 'Greater than or equals': 'Greater than or equals',\n 'Less than or equals': 'Less than or equals',\n 'Starts with': 'Starts with',\n 'Not starts with': 'Not starts with',\n 'Ends with': 'Ends with',\n 'Not ends with': 'Not ends with',\n Contains: 'Contains',\n 'Not contains': 'Not contains',\n 'Is any of': 'Is any of',\n 'Is not any of': 'Is not any of',\n 'Is null': 'Is null',\n 'Is not null': 'Is not null',\n true: 'true',\n false: 'false',\n 'Interactive content': 'Interactive content',\n 'Filter value': 'Filter value',\n 'Filter comparison': 'Filter comparison',\n state: 'state',\n 'Filter column': 'Filter column',\n Refresh: 'Refresh',\n table_a11y_intro: 'Tab or click into the grid to use key commands.',\n table_a11y_instructions_arrow_keys_label: 'Arrow keys or Shift+Alt+Arrow keys',\n table_a11y_instructions_arrow_keys_description: 'navigate cells',\n table_a11y_instructions_enter_label: 'Enter key',\n table_a11y_instructions_enter_description:\n 'when on a cell with editable controls, switches to Tab navigation mode. Tab key now navigates between all interactive controls in the grid',\n table_a11y_instructions_escape_label: 'Escape key',\n table_a11y_instructions_escape_description: 'restores arrow-based grid navigation'\n};\n\nexport default defaultTranslations;\n"]}
1
+ {"version":3,"file":"defaultTranslations.js","sourceRoot":"","sources":["../../../Core/Localization/defaultTranslations.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,mBAAmB,EAAE,mBAAmB;IACxC,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,cAAc,EAAE,cAAc;IAC9B,eAAe,EAAE,eAAe;IAChC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,eAAe;IAChC,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,IAAI;IACR,0DAA0D,EACxD,0DAA0D;IAC5D,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,SAAS;IAClB,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cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,wBAAwB,EAAE,wBAAwB;IAClD,qBAAqB,EAAE,qBAAqB;IAC5C,aAAa,EAAE,aAAa;IAC5B,iBAAiB,EAAE,iBAAiB;IACpC,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,aAAa;IAC5B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,qBAAqB,EAAE,qBAAqB;IAC5C,cAAc,EAAE,cAAc;IAC9B,mBAAmB,EAAE,mBAAmB;IACxC,KAAK,EAAE,OAAO;IACd,eAAe,EAAE,eAAe;IAChC,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,iDAAiD;IACnE,wCAAwC,EAAE,oCAAoC;IAC9E,8CAA8C,EAAE,gBAAgB;IAChE,mCAAmC,EAAE,WAAW;IAChD,yCAAyC,EACvC,4IAA4I;IAC9I,oCAAoC,EAAE,YAAY;IAClD,0CAA0C,EAAE,sCAAsC;IAClF,aAAa,EAAE,wBAAwB;IACvC,0BAA0B,EAAE,mDAAmD;IAC/E,mBAAmB,EAAE,+BAA+B;IACpD,uBAAuB,EAAE,mCAAmC;IAC5D,YAAY,EAAE,kBAAkB;IAChC,yBAAyB,EAAE,6CAA6C;IACxE,YAAY,EAAE,kBAAkB;IAChC,4BAA4B,EAAE,qDAAqD;CACpF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// FIXME: Move this file to Demo folder once the typings are available from cosmos translations pack\nconst defaultTranslations = {\n Submit: 'Submit',\n 'Hide header icons': 'Hide header icons',\n 'Column name:': 'Column name:',\n 'Template:': 'Template:',\n 'Hide columns': 'Hide columns',\n 'Remove filter': 'Remove filter',\n Year: 'Year',\n Quarter: 'Quarter',\n Month: 'Month',\n Week: 'Week',\n Day: 'Day',\n Hour: 'Hour',\n Minute: 'Minute',\n 'Month of year': 'Month of year',\n 'Day of month': 'Day of month',\n 'Day of week': 'Day of week',\n 'Hour of day': 'Hour of day',\n Add: 'Add',\n Aggregate: 'Aggregate',\n Cancel: 'Cancel',\n Ok: 'Ok',\n 'has unsaved changes, do you want to discard and proceed?':\n 'has unsaved changes, do you want to discard and proceed?',\n Actions: 'Actions',\n actions: 'actions',\n 'Edit details': 'Edit details',\n 'Change stage': 'Change stage',\n Preview: 'Preview',\n 'Open in a new tab': 'Open in a new tab',\n Edit: 'Edit',\n 'Copy text': 'Copy text',\n 'Paste text': 'Paste text',\n 'Filter by this': 'Filter by this',\n 'Open link in new tab': 'Open link in new tab',\n default: 'default',\n Grouping: 'Grouping',\n to: 'to',\n Filter: 'Filter',\n Freeze: 'Freeze',\n Hide: 'Hide',\n Summarize: 'Summarize',\n 'Combine with left': 'Combine with left',\n 'Combine with right': 'Combine with right',\n Delete: 'Delete',\n Format: 'Format',\n Alias: 'Alias',\n 'Enter alias': 'Enter alias',\n 'Filter by': 'Filter by',\n Group: 'Group',\n 'Group by': 'Group by',\n Sort: 'Sort',\n 'Sort by': 'Sort by',\n 'Row density': 'Row density',\n 'Show/hide columns': 'Show/hide columns',\n 'Freeze columns': 'Freeze columns',\n 'Save view as..': 'Save view as..',\n 'Save changes': 'Save changes',\n 'View as...': 'View as...',\n 'Edit view': 'Edit view',\n 'Set as default': 'Set as default',\n 'Mark as default?': 'Mark as default?',\n 'Mark as app default': 'Mark as app default',\n 'Delete view': 'Delete view',\n 'Reset column widths': 'Reset column widths',\n 'Auto size columns': 'Auto size columns',\n ShowHeaderIcons: 'ShowHeaderIcons',\n 'Query info': 'Query info',\n 'Export to Excel': 'Export to Excel',\n 'Export to CSV': 'Export to CSV',\n Class: 'Class',\n 'Data page': 'Data page',\n 'Data source': 'Data source',\n 'Time taken': 'Time taken',\n 'Insight ID': 'Insight ID',\n 'Undo hierarchy': 'Undo hierarchy',\n Normal: 'Normal',\n Hierarchical: 'Hierarchical',\n Display: 'Display',\n table: 'table',\n 'Use arrow keys or Shift plus Alt plus arrow keys to navigate':\n 'Use arrow keys or Shift plus Alt plus arrow keys to navigate',\n 'No actions available': 'No actions available',\n 'Use Enter to open header menu': 'Use Enter to open header menu',\n 'Loading more results': 'Loading more results',\n Sorted: 'Sorted',\n 'Sort priority': 'Sort priority',\n 'Filtered column': 'Filtered column',\n Ascending: 'Ascending',\n Descending: 'Descending',\n Select: 'Select',\n 'Select all': 'Select all',\n 'Collapse all groups': 'Collapse all groups',\n 'Expand all groups': 'Expand all groups',\n Sum: 'Sum',\n Min: 'Min',\n Max: 'Max',\n Avg: 'Avg',\n 'Aggregate options': 'Aggregate options',\n 'Select two or more items to enable bulk actions':\n 'Select two or more items to enable bulk actions',\n 'Bulk actions': 'Bulk actions',\n 'Group applied': 'Group applied',\n 'Group modified': 'Group modified',\n 'Group removed': 'Group removed',\n Loading: 'Loading',\n 'Loading completed': 'Loading completed',\n 'name is reserved for non Personalized view and cannot be used.':\n 'name is reserved for non Personalized view and cannot be used.',\n 'This view is already present.': 'This view is already present.',\n 'This view name cannot be empty.': 'This view name cannot be empty.',\n 'View name must contain less than 65 characters.':\n 'View name must contain less than 65 characters.',\n 'Sort order': 'Sort order',\n Field: 'Field',\n 'Column name cannot be empty.': 'Column name cannot be empty.',\n 'Sort ascending': 'Sort ascending',\n 'Sort descending': 'Sort descending',\n 'Remove sort': 'Remove sort',\n 'No records found.': 'No records found.',\n 'Clear filter': 'Clear filter',\n Equals: 'Equals',\n 'Not equals': 'Not equals',\n After: 'After',\n Before: 'Before',\n 'On or after': 'On or after',\n 'On or before': 'On or before',\n 'Greater than': 'Greater than',\n 'Less than': 'Less than',\n 'Greater than or equals': 'Greater than or equals',\n 'Less than or equals': 'Less than or equals',\n 'Starts with': 'Starts with',\n 'Not starts with': 'Not starts with',\n 'Ends with': 'Ends with',\n 'Not ends with': 'Not ends with',\n Contains: 'Contains',\n 'Not contains': 'Not contains',\n 'Is any of': 'Is any of',\n 'Is not any of': 'Is not any of',\n 'Is null': 'Is null',\n 'Is not null': 'Is not null',\n true: 'true',\n false: 'false',\n 'Interactive content': 'Interactive content',\n 'Filter value': 'Filter value',\n 'Filter comparison': 'Filter comparison',\n state: 'state',\n 'Filter column': 'Filter column',\n Refresh: 'Refresh',\n table_a11y_intro: 'Tab or click into the grid to use key commands.',\n table_a11y_instructions_arrow_keys_label: 'Arrow keys or Shift+Alt+Arrow keys',\n table_a11y_instructions_arrow_keys_description: 'navigate cells',\n table_a11y_instructions_enter_label: 'Enter key',\n table_a11y_instructions_enter_description:\n 'when on a cell with editable controls, switches to Tab navigation mode. Tab key now navigates between all interactive controls in the grid',\n table_a11y_instructions_escape_label: 'Escape key',\n table_a11y_instructions_escape_description: 'restores arrow-based grid navigation',\n saved_changes: '{0} saved with changes',\n saved_changes_with_default: 'saved with changes {0} and marked as default view',\n view_marked_default: '{0} view is marked as Default',\n view_marked_app_default: '{0} view is marked as App Default',\n created_view: 'Created view {0}',\n created_view_with_default: 'Created view {0} and marked as default view',\n deleted_view: 'Deleted view {0}',\n view_navigation_instructions: '{0}, Refer to keyboard instructions for navigation.'\n};\n\nexport default defaultTranslations;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Core/index.jsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,yDAFa,OAAO,OAAO,EAAE,wBAAwB,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,UAAU,EAAE,wBAAwB,CAAC,CA4DvI"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Core/index.jsx"],"names":[],"mappings":"AAWA;;GAEG;AACH,yDAFa,OAAO,OAAO,EAAE,wBAAwB,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,UAAU,EAAE,wBAAwB,CAAC,CA0DvI"}
package/lib/Core/index.js CHANGED
@@ -3,7 +3,6 @@ import { useMemo } from 'react';
3
3
  import { resolveCellComponent, resolveViewComponent } from './Components/RenderingEngine/ComponentResolverFactory';
4
4
  import GlobalContext from './Context/GlobalContext';
5
5
  import useRepeat from './Hooks/useRepeat';
6
- import { LocalizationProvider } from './Context/LocalizationContext';
7
6
  import useReactToProps from './Hooks/useReactToProps';
8
7
  import { ToolbarProvider } from './Context/ToolbarContext';
9
8
  /**
@@ -34,7 +33,7 @@ export default function repeatComponent(Component) {
34
33
  }), []);
35
34
  const toolbarContextValue = useMemo(() => ({ additionalInfo }), [additionalInfo]);
36
35
  // TODO : Freeze view object before passing it down to component except columns.
37
- return (_jsx(GlobalContext.Provider, { value: globalContext, children: _jsx(LocalizationProvider, { children: _jsx(ToolbarProvider, { value: toolbarContextValue, children: _jsx(Component, { view: instance.getView() }) }) }) }));
36
+ return (_jsx(GlobalContext.Provider, { value: globalContext, children: _jsx(ToolbarProvider, { value: toolbarContextValue, children: _jsx(Component, { view: instance.getView() }) }) }));
38
37
  };
39
38
  }
40
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Core/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS;IAC/C,OAAO,SAAS,oBAAoB,CAAC,KAAK,EAAE,GAAG;QAC7C,MAAM,EACJ,IAAI,EACJ,UAAU,EACV,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,cAAc,EACd,YAAY,EACb,GAAG,KAAK,CAAC;QAEV,MAAM,QAAQ,GAAG,SAAS,CAAC;YACzB,IAAI;YACJ,UAAU;YACV,aAAa;YACb,aAAa;YACb,sBAAsB;YACtB,WAAW;YACX,UAAU;YACV,IAAI;YACJ,cAAc;YACd,gBAAgB;YAChB,OAAO;YACP,YAAY;YACZ,uBAAuB,EAAE,GAAG;SAC7B,CAAC,CAAC;QAEH,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAClC,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;YACL,oBAAoB;YACpB,oBAAoB;SACrB,CAAC,EACF,EAAE,CACH,CAAC;QAEF,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAElF,gFAAgF;QAEhF,OAAO,CACL,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAC1C,KAAC,oBAAoB,cACnB,KAAC,eAAe,IAAC,KAAK,EAAE,mBAAmB,YACzC,KAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAI,GACvB,GACG,GACA,CAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport {\n resolveCellComponent,\n resolveViewComponent\n} from './Components/RenderingEngine/ComponentResolverFactory';\nimport GlobalContext from './Context/GlobalContext';\nimport useRepeat from './Hooks/useRepeat';\nimport { LocalizationProvider } from './Context/LocalizationContext';\nimport useReactToProps from './Hooks/useReactToProps';\nimport { ToolbarProvider } from './Context/ToolbarContext';\n\n/**\n * @returns {import('react').ForwardRefRenderFunction<import('../types').RsCoreTypes.RsApi, import('../types').RepeatingStructuresProps>}\n */\nexport default function repeatComponent(Component) {\n return function RepeatInnerComponent(props, ref) {\n const {\n meta,\n apiContext,\n persistedInfo,\n renderFactory,\n renderFormatterTypeMap,\n onViewReady,\n formatters,\n mode,\n toolBarOptions,\n onRowClickAction,\n presets,\n errors,\n additionalInfo,\n styleFormats\n } = props;\n\n const instance = useRepeat({\n meta,\n apiContext,\n persistedInfo,\n renderFactory,\n renderFormatterTypeMap,\n onViewReady,\n formatters,\n mode,\n toolBarOptions,\n onRowClickAction,\n presets,\n styleFormats,\n repeatComponentInstance: ref\n });\n\n useReactToProps(errors, instance);\n const globalContext = useMemo(\n () => ({\n resolveCellComponent,\n resolveViewComponent\n }),\n []\n );\n\n const toolbarContextValue = useMemo(() => ({ additionalInfo }), [additionalInfo]);\n\n // TODO : Freeze view object before passing it down to component except columns.\n\n return (\n <GlobalContext.Provider value={globalContext}>\n <LocalizationProvider>\n <ToolbarProvider value={toolbarContextValue}>\n <Component view={instance.getView()} />\n </ToolbarProvider>\n </LocalizationProvider>\n </GlobalContext.Provider>\n );\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Core/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS;IAC/C,OAAO,SAAS,oBAAoB,CAAC,KAAK,EAAE,GAAG;QAC7C,MAAM,EACJ,IAAI,EACJ,UAAU,EACV,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,cAAc,EACd,YAAY,EACb,GAAG,KAAK,CAAC;QAEV,MAAM,QAAQ,GAAG,SAAS,CAAC;YACzB,IAAI;YACJ,UAAU;YACV,aAAa;YACb,aAAa;YACb,sBAAsB;YACtB,WAAW;YACX,UAAU;YACV,IAAI;YACJ,cAAc;YACd,gBAAgB;YAChB,OAAO;YACP,YAAY;YACZ,uBAAuB,EAAE,GAAG;SAC7B,CAAC,CAAC;QAEH,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAClC,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;YACL,oBAAoB;YACpB,oBAAoB;SACrB,CAAC,EACF,EAAE,CACH,CAAC;QAEF,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAElF,gFAAgF;QAEhF,OAAO,CACL,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAC1C,KAAC,eAAe,IAAC,KAAK,EAAE,mBAAmB,YACzC,KAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAI,GACvB,GACK,CAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport {\n resolveCellComponent,\n resolveViewComponent\n} from './Components/RenderingEngine/ComponentResolverFactory';\nimport GlobalContext from './Context/GlobalContext';\nimport useRepeat from './Hooks/useRepeat';\nimport useReactToProps from './Hooks/useReactToProps';\nimport { ToolbarProvider } from './Context/ToolbarContext';\n\n/**\n * @returns {import('react').ForwardRefRenderFunction<import('../types').RsCoreTypes.RsApi, import('../types').RepeatingStructuresProps>}\n */\nexport default function repeatComponent(Component) {\n return function RepeatInnerComponent(props, ref) {\n const {\n meta,\n apiContext,\n persistedInfo,\n renderFactory,\n renderFormatterTypeMap,\n onViewReady,\n formatters,\n mode,\n toolBarOptions,\n onRowClickAction,\n presets,\n errors,\n additionalInfo,\n styleFormats\n } = props;\n\n const instance = useRepeat({\n meta,\n apiContext,\n persistedInfo,\n renderFactory,\n renderFormatterTypeMap,\n onViewReady,\n formatters,\n mode,\n toolBarOptions,\n onRowClickAction,\n presets,\n styleFormats,\n repeatComponentInstance: ref\n });\n\n useReactToProps(errors, instance);\n const globalContext = useMemo(\n () => ({\n resolveCellComponent,\n resolveViewComponent\n }),\n []\n );\n\n const toolbarContextValue = useMemo(() => ({ additionalInfo }), [additionalInfo]);\n\n // TODO : Freeze view object before passing it down to component except columns.\n\n return (\n <GlobalContext.Provider value={globalContext}>\n <ToolbarProvider value={toolbarContextValue}>\n <Component view={instance.getView()} />\n </ToolbarProvider>\n </GlobalContext.Provider>\n );\n };\n}\n"]}
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { RsCoreTypes } from 'pega-repeating-structures-core';
3
3
  import type { FormControlProps, IconName, OmitStrict } from '@pega/cosmos-react-core';
4
4
  import type { RsApi } from 'pega-repeating-structures-core/lib/types/ApiContext.types';
5
+ import type RsCoreBootArgs from 'pega-repeating-structures-core/lib/types/RsCoreBootArgs.types';
5
6
  type PropsFromRenderFactory = Pick<RsCoreTypes.RenderFactoryWithProps, 'props'>;
6
7
  type ColumnContext = ReturnType<RsCoreTypes.Column['getContext']>;
7
8
  type ViewContext = ReturnType<RsCoreTypes.View['getContext']>;
@@ -124,6 +125,7 @@ export type RepeatingStructuresProps = {
124
125
  onRowClickAction?: RsCoreTypes.RsCoreInitArgs['onRowClickAction'];
125
126
  /** Pass a heading and content to show additional information in the toolbar */
126
127
  additionalInfo?: FormControlProps['additionalInfo'];
128
+ translations?: RsCoreBootArgs['translations'];
127
129
  };
128
130
  export {};
129
131
  //# sourceMappingURL=RepeatingStructuresBoot.types.d.ts.map
@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AAI,CAAC;IAE3F,oEAAoE;IACpE,UAAU,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAEtD;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAE/B,4FAA4F;IAC5F,cAAc,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAE9D;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAElE,+EAA+E;IAC/E,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAGpD,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepeatingStructuresBoot.types.js","sourceRoot":"","sources":["../../types/RepeatingStructuresBoot.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { FormControlProps, IconName, OmitStrict } from '@pega/cosmos-react-core';\nimport type { RsApi } from 'pega-repeating-structures-core/lib/types/ApiContext.types';\n\ntype PropsFromRenderFactory = Pick<RsCoreTypes.RenderFactoryWithProps, 'props'>;\ntype ColumnContext = ReturnType<RsCoreTypes.Column['getContext']>;\ntype ViewContext = ReturnType<RsCoreTypes.View['getContext']>;\n\n// Contract for Cell renderer props.\n/**\n * A set of props that will be exposed to Cell renderers.\n *\n */\ntype CellRendererProps = {\n /** Reference to the cell body element */\n getElement: () => HTMLElement;\n /** Styles applicable to current cell. This should be applied to cell renderers.\n * This is method is only available for data cells.\n */\n getStyles?: () => {\n /**\n * Foreground color applicable to the cell content, otherwise undefined.\n *\n * Note: This will be applied by default to `cell container`(having class `cell-content`) of repeating structures.\n *\n * Supports standard CSS color formats like below:\n * - Named colors: `'red'`, `'blue'`, `'green'`, `'yellow'`, `'black'`, `'white'`, etc.\n * - Hex codes: `'#RRGGBB'`, `'#RGB'`, `'#RRGGBBAA'`, `'#RGBA'`\n * - RGB: `'rgb(255, 0, 0)'`\n * - RGBA: `'rgba(255, 0, 0, 0.5)'`\n *\n * Optional\n */\n foregroundColor?: string;\n };\n /** Formatted value of the cell. */\n value: ReturnType<ColumnContext['getFormattedValue']>;\n /** Tooltip value of the cell. */\n title: ReturnType<ColumnContext['getToolTipValue']>;\n} & ColumnContext &\n PropsFromRenderFactory;\n\n// Contract for View renderer props.\ntype ExternalStateInfo = {\n /** External state key and its persisted value in the RS state. Supported external state keys are:\n * - Value of {@link RsCoreTypes.Meta.externalFilters externalFilters}\n */\n [externalStateKey: string]: NonNullable<RsCoreTypes.State['externalState']>[''];\n};\n\n/**\n * A set of props that will be exposed to View renderer. Supported view renderers are:\n * - Renderer for {@link RsCoreTypes.Meta.externalFilters externalFilters}\n */\ntype ViewRendererProps = ViewContext & {\n /** A unique id to identify the current repeating structure. */\n rsID: RsCoreTypes.View['rsID'];\n} & ExternalStateInfo &\n PropsFromRenderFactory;\n\ntype RendererProps = CellRendererProps | ViewRendererProps;\n\n// RsCore exposes generic function types for `component`.\n// For RepeatingStructures, these types are overridden to include additional renderer props, and the return type is specified as ReactNode.\nexport interface RsRenderFactoryReturnType\n extends OmitStrict<RsCoreTypes.RenderFactoryWithProps, 'component'> {\n /**\n * A function that accepts component props and returns a React node to be rendered as a cell within repeating structures.\n * @param props - The props passed by repeating structures and {@link PropsFromRenderFactory static props } from the render factory.\n * @returns The component function or null or undefined. If component definition is null/undefined then cell will be rendered directly with value derived for the cell or the formatted value(if {@link RsCoreTypes.RsCoreInitArgs.formatters formatters} are provided for that column)\n */\n component: ((props: RendererProps) => ReactNode) | null | undefined;\n}\n\ntype RsCoreStyleFormat = NonNullable<RsCoreTypes.RsCoreInitArgs['styleFormats']>[number];\ninterface RsStyleFormatConfig extends OmitStrict<RsCoreStyleFormat['config'], 'icon'> {\n /**\n * An icon used as a visual indicator of the applied format.\n * Optional.\n */\n icon?: {\n /** Icon from 'budicon' set of cosmos. */\n name: IconName;\n /** The color of icon. */\n color: string;\n };\n}\n\n// RS can only accept icons that are supported in cosmos, while RsCore accepts icon generically, therefore overriding the interface.\nexport interface RsStyleFormat extends OmitStrict<RsCoreStyleFormat, 'config'> {\n config: RsStyleFormatConfig;\n}\n\nexport type RepeatingStructuresProps = {\n /** An initial state that can be provided to repeating structure to load repeating structure instance with that state.\\\n * **Note**: If {@link RSTypes.Meta.personalization personalization} in meta is set to true then persistedInfo will be ignored. */\n persistedInfo?: RsCoreTypes.PersonalizedState;\n\n /** A meta data object to provide definition of repeating structure */\n meta: RsCoreTypes.Meta;\n\n /** A set of api's provided to repeating structure to establish communication b/w repeating structure and its consumer (e.g. providing data to repeating structure) */\n apiContext: RsCoreTypes.ApiContext;\n\n /** To provide multiple variants of metadata of repeating structures. If multiple variations is provided make sure the first variation should be part of {@link RepeatingStructuresProps.meta meta} key and rest all should be fed to presets. */\n presets?: RsCoreTypes.RsCoreInitArgs['presets'];\n\n /** A debug mode will print logs in console for the action dispatched by RsCore and the state derived after consumption of it. */\n mode?: 'info' | 'debug' | 'normal';\n\n errors?: RsCoreTypes.Errors;\n\n /** This should be a factory function that returns component or component definition for specified type.\n * @param type -\n * - For cell renderer - Value of {@link RsCoreTypes.FieldDef.cellRenderer cellRenderer}(if added in fieldDefs of that column).\n * - For view renderer - Value of supported external view renderers in `Meta`. Supported view renderer is {@link RsCoreTypes.Meta.externalFilters externalFilters}.\n *\n * @param field - Metadata which contains info configured for that column. Applicable only in case of `cell renderer`.\n * @returns It should return a component definition (or an object that contains component definition).\n * This component definition will be used by RepeatingStructures to render a cell with the component provided by renderFactory.\n * If component definition is not provided from render factory or renderFactory is not provided to Repeating structures then cell will be rendered directly with value derived for the cell or the formatted value(if {@link RsCoreTypes.RsCoreInitArgs.formatters formatters} are provided for that column)\n */\n renderFactory?: (\n type: string,\n field?: RsCoreTypes.FieldDef\n ) => Pick<RsRenderFactoryReturnType, 'component'> | RsRenderFactoryReturnType;\n\n /** A map of formatters that will be displayed to consumer to format a fieldDef in repeating structure */\n renderFormatterTypeMap?: RsCoreTypes.RsCoreInitArgs['renderFormatterTypeMap'];\n\n /**\n * This function acts as a callback that is invoked when the view is ready\n * @param utilityCallbacks - Few utility callbacks to interact with Repeating structures.\n * @returns {void} void\n */\n onViewReady?: (utilityCallbacks: Pick<RsApi, 'setRecordCount' | 'dispatchAction'>) => void;\n\n /** An object of formatter functions which formats the raw value. */\n formatters?: RsCoreTypes.RsCoreInitArgs['formatters'];\n\n /** A set of style formatters to be applied on FieldDef. E.g. background, icon.\n *\n * **Note**: Style formats are only supported for `Table` template.\n */\n styleFormats?: RsStyleFormat[];\n\n /** A list of all the toolbar actions to be displayed at the top of a repeating structure */\n toolBarOptions?: RsCoreTypes.RsCoreInitArgs['toolBarOptions'];\n\n /**\n * This function is provided as ui props in row generator to attach it as click handler to a row in repeating structure\n * @param {RsCoreTypes.RowData} data - current row data\n * @returns {void} void\n */\n onRowClickAction?: RsCoreTypes.RsCoreInitArgs['onRowClickAction'];\n\n /** Pass a heading and content to show additional information in the toolbar */\n additionalInfo?: FormControlProps['additionalInfo'];\n};\n"]}
1
+ {"version":3,"file":"RepeatingStructuresBoot.types.js","sourceRoot":"","sources":["../../types/RepeatingStructuresBoot.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { FormControlProps, IconName, OmitStrict } from '@pega/cosmos-react-core';\nimport type { RsApi } from 'pega-repeating-structures-core/lib/types/ApiContext.types';\nimport type RsCoreBootArgs from 'pega-repeating-structures-core/lib/types/RsCoreBootArgs.types';\n\ntype PropsFromRenderFactory = Pick<RsCoreTypes.RenderFactoryWithProps, 'props'>;\ntype ColumnContext = ReturnType<RsCoreTypes.Column['getContext']>;\ntype ViewContext = ReturnType<RsCoreTypes.View['getContext']>;\n\n// Contract for Cell renderer props.\n/**\n * A set of props that will be exposed to Cell renderers.\n *\n */\ntype CellRendererProps = {\n /** Reference to the cell body element */\n getElement: () => HTMLElement;\n /** Styles applicable to current cell. This should be applied to cell renderers.\n * This is method is only available for data cells.\n */\n getStyles?: () => {\n /**\n * Foreground color applicable to the cell content, otherwise undefined.\n *\n * Note: This will be applied by default to `cell container`(having class `cell-content`) of repeating structures.\n *\n * Supports standard CSS color formats like below:\n * - Named colors: `'red'`, `'blue'`, `'green'`, `'yellow'`, `'black'`, `'white'`, etc.\n * - Hex codes: `'#RRGGBB'`, `'#RGB'`, `'#RRGGBBAA'`, `'#RGBA'`\n * - RGB: `'rgb(255, 0, 0)'`\n * - RGBA: `'rgba(255, 0, 0, 0.5)'`\n *\n * Optional\n */\n foregroundColor?: string;\n };\n /** Formatted value of the cell. */\n value: ReturnType<ColumnContext['getFormattedValue']>;\n /** Tooltip value of the cell. */\n title: ReturnType<ColumnContext['getToolTipValue']>;\n} & ColumnContext &\n PropsFromRenderFactory;\n\n// Contract for View renderer props.\ntype ExternalStateInfo = {\n /** External state key and its persisted value in the RS state. Supported external state keys are:\n * - Value of {@link RsCoreTypes.Meta.externalFilters externalFilters}\n */\n [externalStateKey: string]: NonNullable<RsCoreTypes.State['externalState']>[''];\n};\n\n/**\n * A set of props that will be exposed to View renderer. Supported view renderers are:\n * - Renderer for {@link RsCoreTypes.Meta.externalFilters externalFilters}\n */\ntype ViewRendererProps = ViewContext & {\n /** A unique id to identify the current repeating structure. */\n rsID: RsCoreTypes.View['rsID'];\n} & ExternalStateInfo &\n PropsFromRenderFactory;\n\ntype RendererProps = CellRendererProps | ViewRendererProps;\n\n// RsCore exposes generic function types for `component`.\n// For RepeatingStructures, these types are overridden to include additional renderer props, and the return type is specified as ReactNode.\nexport interface RsRenderFactoryReturnType\n extends OmitStrict<RsCoreTypes.RenderFactoryWithProps, 'component'> {\n /**\n * A function that accepts component props and returns a React node to be rendered as a cell within repeating structures.\n * @param props - The props passed by repeating structures and {@link PropsFromRenderFactory static props } from the render factory.\n * @returns The component function or null or undefined. If component definition is null/undefined then cell will be rendered directly with value derived for the cell or the formatted value(if {@link RsCoreTypes.RsCoreInitArgs.formatters formatters} are provided for that column)\n */\n component: ((props: RendererProps) => ReactNode) | null | undefined;\n}\n\ntype RsCoreStyleFormat = NonNullable<RsCoreTypes.RsCoreInitArgs['styleFormats']>[number];\ninterface RsStyleFormatConfig extends OmitStrict<RsCoreStyleFormat['config'], 'icon'> {\n /**\n * An icon used as a visual indicator of the applied format.\n * Optional.\n */\n icon?: {\n /** Icon from 'budicon' set of cosmos. */\n name: IconName;\n /** The color of icon. */\n color: string;\n };\n}\n\n// RS can only accept icons that are supported in cosmos, while RsCore accepts icon generically, therefore overriding the interface.\nexport interface RsStyleFormat extends OmitStrict<RsCoreStyleFormat, 'config'> {\n config: RsStyleFormatConfig;\n}\n\nexport type RepeatingStructuresProps = {\n /** An initial state that can be provided to repeating structure to load repeating structure instance with that state.\\\n * **Note**: If {@link RSTypes.Meta.personalization personalization} in meta is set to true then persistedInfo will be ignored. */\n persistedInfo?: RsCoreTypes.PersonalizedState;\n\n /** A meta data object to provide definition of repeating structure */\n meta: RsCoreTypes.Meta;\n\n /** A set of api's provided to repeating structure to establish communication b/w repeating structure and its consumer (e.g. providing data to repeating structure) */\n apiContext: RsCoreTypes.ApiContext;\n\n /** To provide multiple variants of metadata of repeating structures. If multiple variations is provided make sure the first variation should be part of {@link RepeatingStructuresProps.meta meta} key and rest all should be fed to presets. */\n presets?: RsCoreTypes.RsCoreInitArgs['presets'];\n\n /** A debug mode will print logs in console for the action dispatched by RsCore and the state derived after consumption of it. */\n mode?: 'info' | 'debug' | 'normal';\n\n errors?: RsCoreTypes.Errors;\n\n /** This should be a factory function that returns component or component definition for specified type.\n * @param type -\n * - For cell renderer - Value of {@link RsCoreTypes.FieldDef.cellRenderer cellRenderer}(if added in fieldDefs of that column).\n * - For view renderer - Value of supported external view renderers in `Meta`. Supported view renderer is {@link RsCoreTypes.Meta.externalFilters externalFilters}.\n *\n * @param field - Metadata which contains info configured for that column. Applicable only in case of `cell renderer`.\n * @returns It should return a component definition (or an object that contains component definition).\n * This component definition will be used by RepeatingStructures to render a cell with the component provided by renderFactory.\n * If component definition is not provided from render factory or renderFactory is not provided to Repeating structures then cell will be rendered directly with value derived for the cell or the formatted value(if {@link RsCoreTypes.RsCoreInitArgs.formatters formatters} are provided for that column)\n */\n renderFactory?: (\n type: string,\n field?: RsCoreTypes.FieldDef\n ) => Pick<RsRenderFactoryReturnType, 'component'> | RsRenderFactoryReturnType;\n\n /** A map of formatters that will be displayed to consumer to format a fieldDef in repeating structure */\n renderFormatterTypeMap?: RsCoreTypes.RsCoreInitArgs['renderFormatterTypeMap'];\n\n /**\n * This function acts as a callback that is invoked when the view is ready\n * @param utilityCallbacks - Few utility callbacks to interact with Repeating structures.\n * @returns {void} void\n */\n onViewReady?: (utilityCallbacks: Pick<RsApi, 'setRecordCount' | 'dispatchAction'>) => void;\n\n /** An object of formatter functions which formats the raw value. */\n formatters?: RsCoreTypes.RsCoreInitArgs['formatters'];\n\n /** A set of style formatters to be applied on FieldDef. E.g. background, icon.\n *\n * **Note**: Style formats are only supported for `Table` template.\n */\n styleFormats?: RsStyleFormat[];\n\n /** A list of all the toolbar actions to be displayed at the top of a repeating structure */\n toolBarOptions?: RsCoreTypes.RsCoreInitArgs['toolBarOptions'];\n\n /**\n * This function is provided as ui props in row generator to attach it as click handler to a row in repeating structure\n * @param {RsCoreTypes.RowData} data - current row data\n * @returns {void} void\n */\n onRowClickAction?: RsCoreTypes.RsCoreInitArgs['onRowClickAction'];\n\n /** Pass a heading and content to show additional information in the toolbar */\n additionalInfo?: FormControlProps['additionalInfo'];\n\n /* Used to provide localized strings, typically overriding default translations */\n translations?: RsCoreBootArgs['translations'];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/lists-react",
3
- "version": "9.0.0-build.1.0",
3
+ "version": "9.0.0-build.2.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,10 +14,10 @@
14
14
  "build": "tsc -b tsconfig.build.json"
15
15
  },
16
16
  "dependencies": {
17
- "@pega/cosmos-react-condition-builder": "9.0.0-build.1.0",
18
- "@pega/cosmos-react-core": "9.0.0-build.1.0",
19
- "@pega/cosmos-react-rte": "9.0.0-build.1.0",
20
- "@pega/cosmos-react-work": "9.0.0-build.1.0",
17
+ "@pega/cosmos-react-condition-builder": "9.0.0-build.2.1",
18
+ "@pega/cosmos-react-core": "9.0.0-build.2.1",
19
+ "@pega/cosmos-react-rte": "9.0.0-build.2.1",
20
+ "@pega/cosmos-react-work": "9.0.0-build.2.1",
21
21
  "@types/lodash.get": "^4.4.9",
22
22
  "@types/react": "^17.0.62 || ^18.3.3",
23
23
  "@types/react-dom": "^17.0.20 || ^18.3.0",
@@ -25,8 +25,8 @@
25
25
  "dayjs": "^1.11.13",
26
26
  "fast-deep-equal": "^3.1.3",
27
27
  "lodash.get": "^4.4.2",
28
- "pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.1.0",
29
- "pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.1.0",
28
+ "pega-repeating-structures-core": "npm:@pega/lists-core@9.0.0-build.2.1",
29
+ "pega-ui-list-data-apis": "npm:@pega/lists-core-utils@9.0.0-build.2.1",
30
30
  "polished": "^4.1.0",
31
31
  "prop-types": "^15.8.1",
32
32
  "react": "^17.0.0 || ^18.0.0",
@@ -45,7 +45,7 @@
45
45
  "@testing-library/react": "^16.0.0",
46
46
  "@testing-library/user-event": "^14.6.1",
47
47
  "jest-axe": "^8.0.0",
48
- "srs-utils": "9.0.0-build.1.0",
48
+ "srs-utils": "9.0.0-build.2.1",
49
49
  "typescript": "~5.8.3"
50
50
  }
51
51
  }