Skip to content

Commit dedcd80

Browse files
authored
Merge branch 'primefaces:master' into new-feature-primefaces#4134
2 parents 95e48df + f151504 commit dedcd80

File tree

158 files changed

+2004
-781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2004
-781
lines changed

components/doc/common/apidoc/index.json

Lines changed: 710 additions & 137 deletions
Large diffs are not rendered by default.

components/doc/common/docapisection.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,24 @@ import DocApiTable from './docapitable';
88
export function DocApiSection(props) {
99
const { doc, header } = props;
1010
const capitalize = (s) => (s && s[0].toUpperCase() + s.slice(1)) || '';
11+
const exclude = props.apiExclude;
1112

1213
const docs = doc.reduce((cDocs, name) => {
1314
const splitedName = name.split('.');
1415
const modName = capitalize(splitedName[0]);
1516
const mod = APIDoc[modName.toLowerCase()];
1617

18+
const isExcluded = (option, key) => {
19+
return exclude && exclude[option] && exclude[option].includes(key);
20+
};
21+
22+
const isExcludedAll = (option) => {
23+
return exclude && exclude[option] && exclude[option] === 'excludeAll';
24+
};
25+
1726
if (mod) {
1827
const addToChildDoc = (childDoc, componentName) => {
19-
if (ObjectUtils.isNotEmpty(mod.events) && ObjectUtils.isNotEmpty(mod.events.values)) {
28+
if (ObjectUtils.isNotEmpty(mod.events) && ObjectUtils.isNotEmpty(mod.events.values) && !isExcludedAll('events')) {
2029
const eMap = {
2130
id: `api.${componentName}.events`,
2231
label: 'Events',
@@ -27,6 +36,8 @@ export function DocApiSection(props) {
2736
Object.entries(mod.events.values).forEach(([eKey, eValue]) => {
2837
const [id, label] = [`api.${componentName}.${eKey}`, eKey];
2938

39+
if (isExcluded('event', eKey)) return;
40+
3041
eMap.children.push({
3142
id,
3243
label,
@@ -48,7 +59,7 @@ export function DocApiSection(props) {
4859
childDoc.push(eMap);
4960
}
5061

51-
if (ObjectUtils.isNotEmpty(mod.interfaces) && ObjectUtils.isNotEmpty(mod.interfaces.values)) {
62+
if (ObjectUtils.isNotEmpty(mod.interfaces) && ObjectUtils.isNotEmpty(mod.interfaces.values) && !isExcludedAll('interfaces')) {
5263
const iMap = {
5364
id: `api.${componentName}.interfaces`,
5465
label: 'Interfaces',
@@ -59,6 +70,8 @@ export function DocApiSection(props) {
5970
Object.entries(mod.interfaces.values).forEach(([iKey, iValue]) => {
6071
const [id, label] = [`api.${componentName}.${iKey}`, iKey];
6172

73+
if (isExcluded('interfaces', iKey)) return;
74+
6275
iMap.children.push({
6376
id,
6477
label,
@@ -85,7 +98,7 @@ export function DocApiSection(props) {
8598
childDoc.push(iMap);
8699
}
87100

88-
if (ObjectUtils.isNotEmpty(mod.types) && ObjectUtils.isNotEmpty(mod.types.values)) {
101+
if (ObjectUtils.isNotEmpty(mod.types) && ObjectUtils.isNotEmpty(mod.types.values) && !isExcludedAll('types')) {
89102
const tMap = {
90103
id: `api.${componentName}.types`,
91104
label: 'Types',
@@ -96,6 +109,8 @@ export function DocApiSection(props) {
96109
Object.entries(mod.types.values).forEach(([tKey, tValue]) => {
97110
const [id, label] = [`api.${componentName}.${tKey}`, tKey];
98111

112+
if (isExcluded('types', tKey)) return;
113+
99114
tMap.children.push({
100115
id,
101116
label,
@@ -199,29 +214,35 @@ export function DocApiSection(props) {
199214
children: []
200215
};
201216

202-
if (ObjectUtils.isNotEmpty(cValue.props) && ObjectUtils.isNotEmpty(cValue.props.values)) {
217+
if (ObjectUtils.isNotEmpty(cValue.props) && ObjectUtils.isNotEmpty(cValue.props.values) && !isExcludedAll('props')) {
203218
const [id, label] = [`api.${cKey}.props`, 'Props'];
204219

220+
if (isExcluded('props', cKey)) return;
221+
205222
cMap.children.push({
206223
id,
207224
label,
208225
component: (inProps) => <DocApiTable name={cKey} data={cValue.props.values} description={cValue.props.description} {...inProps} />
209226
});
210227
}
211228

212-
if (ObjectUtils.isNotEmpty(cValue.callbacks) && ObjectUtils.isNotEmpty(cValue.callbacks.values)) {
229+
if (ObjectUtils.isNotEmpty(cValue.callbacks) && ObjectUtils.isNotEmpty(cValue.callbacks.values) && !isExcludedAll('callbacks')) {
213230
const [id, label] = [`api.${cKey}.callbacks`, 'Callbacks'];
214231

232+
if (isExcluded('callbacks', cKey)) return;
233+
215234
cMap.children.push({
216235
id,
217236
label,
218237
component: (inProps) => <DocApiTable name={cKey} data={cValue.callbacks.values} description={cValue.callbacks.description} {...inProps} />
219238
});
220239
}
221240

222-
if (ObjectUtils.isNotEmpty(cValue.methods) && ObjectUtils.isNotEmpty(cValue.methods.values)) {
241+
if (ObjectUtils.isNotEmpty(cValue.methods) && ObjectUtils.isNotEmpty(cValue.methods.values) && !isExcludedAll('methods')) {
223242
const [id, label] = [`api.${cKey}.methods`, 'Methods'];
224243

244+
if (isExcluded('methods', cKey)) return;
245+
225246
cMap.children.push({
226247
id,
227248
label,
@@ -245,9 +266,11 @@ export function DocApiSection(props) {
245266
children: []
246267
};
247268

248-
if (ObjectUtils.isNotEmpty(mValue.props) && ObjectUtils.isNotEmpty(mValue.props.values)) {
269+
if (ObjectUtils.isNotEmpty(mValue.props) && ObjectUtils.isNotEmpty(mValue.props.values) && !isExcludedAll('props')) {
249270
const [id, label] = [`api.${mKey}.props`, 'Props'];
250271

272+
if (isExcluded('props', mKey)) return;
273+
251274
mMap.children.push({
252275
id,
253276
label,
@@ -261,6 +284,8 @@ export function DocApiSection(props) {
261284

262285
cDocs.push(mMap);
263286
});
287+
288+
!mod.components && !mod.model && addToChildDoc(cDocs, modName);
264289
}
265290
}
266291

components/doc/common/doccomponent.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ import { DocSections } from './docsections';
99
export function DocComponent(props) {
1010
const [tab, setTab] = useState(0);
1111
const router = useRouter();
12+
let header;
13+
14+
if (props.header.startsWith('use')) header = 'HOOK';
15+
else if (props.header === 'PassThrough' || props.header === 'Configuration') header = 'OVERVIEW';
16+
else header = 'FEATURES';
1217

1318
const activateTab = (i) => {
1419
setTab(i);
1520
router.replace(router.pathname);
1621
};
1722

1823
useEffect(() => {
19-
if (router.asPath.includes('#api.')) setTab(1);
20-
if (router.asPath.includes('#pt.')) setTab(2);
24+
if (router.asPath.includes('#api')) setTab(1);
25+
if (router.asPath.includes('#pt')) setTab(2);
2126
}, [router.asPath]);
2227

2328
return (
@@ -30,7 +35,7 @@ export function DocComponent(props) {
3035
<ul className="doc-tabmenu">
3136
<li className={classNames({ 'doc-tabmenu-active': tab === 0 })}>
3237
<button type="button" onClick={() => activateTab(0)}>
33-
{props.header.startsWith('use') ? 'HOOK' : 'FEATURES'}
38+
{header}
3439
</button>
3540
</li>
3641

@@ -65,7 +70,7 @@ export function DocComponent(props) {
6570
{tab === 1 ? (
6671
<div className="doc-tabpanel">
6772
{props.apiDocs ? (
68-
<DocApiSection header={props.header} doc={props.apiDocs} />
73+
<DocApiSection header={props.header} doc={props.apiDocs} apiExclude={props.apiExclude} />
6974
) : (
7075
<>
7176
<div className="doc-main">

components/doc/configuration/appendtodoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function AppendToDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.appendTo = 'self';
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setAppendTo } = useContext(PrimeReactContext);
11+
12+
setAppendTo('self');
813
`
914
};
1015

components/doc/configuration/csstransitiondoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function CSSTransitionDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.cssTransition = false;
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setCSSTransition } = useContext(PrimeReactContext);
11+
12+
setCSSTransition(false);
813
`
914
};
1015

components/doc/configuration/filtermatchmodedoc.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function FilterMatchModeDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.filterMatchModeOptions = {
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setFilterMatchMode } = useContext(PrimeReactContext);
11+
12+
setFilterMatchMode({
813
text: [FilterMatchMode.STARTS_WITH, FilterMatchMode.CONTAINS, FilterMatchMode.NOT_CONTAINS, FilterMatchMode.ENDS_WITH, FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS],
914
numeric: [FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS, FilterMatchMode.LESS_THAN, FilterMatchMode.LESS_THAN_OR_EQUAL_TO, FilterMatchMode.GREATER_THAN, FilterMatchMode.GREATER_THAN_OR_EQUAL_TO],
1015
date: [FilterMatchMode.DATE_IS, FilterMatchMode.DATE_IS_NOT, FilterMatchMode.DATE_BEFORE, FilterMatchMode.DATE_AFTER]
11-
};
16+
});
1217
`
1318
};
1419

components/doc/configuration/hideoverlaysdoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function HideOverlaysDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.hideOverlaysOnDocumentScrolling = true;
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setHideOverlayOnScroll } = useContext(PrimeReactContext);
11+
12+
setHideOverlayOnScroll(true);
813
`
914
};
1015

components/doc/configuration/importdoc.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

components/doc/configuration/inputstyledoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function InputStyleDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.inputStyle = 'filled';
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setInputStyle } = useContext(PrimeReactContext);
11+
12+
setInputStyle('filled');
813
`
914
};
1015

components/doc/configuration/localedoc.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

components/doc/configuration/noncedoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function NonceDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.nonce = '.........';
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setNonce } = useContext(PrimeReactContext);
11+
12+
setNonce('.........');
813
`
914
};
1015

components/doc/configuration/nullsortorderdoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function NullSortOrderDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.nullSortOrder = 1;
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setNullSortOrder } = useContext(PrimeReactContext);
11+
12+
setNullSortOrder(1);
813
`
914
};
1015

components/doc/configuration/rippledoc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function RippleDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.ripple = true;
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setRipple } = useContext(PrimeReactContext);
11+
12+
setRipple(true);
813
`
914
};
1015

components/doc/configuration/zindexdoc.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ import { DocSectionText } from '../common/docsectiontext';
44
export function ZIndexDoc(props) {
55
const code = {
66
basic: `
7-
PrimeReact.zIndex = {
7+
import { PrimeReactContext } from 'primereact/api';
8+
9+
//use in a component
10+
const { setZIndex, autoZIndex } = useContext(PrimeReactContext);
11+
12+
setZIndex({
813
modal: 1100, // dialog, sidebar
914
overlay: 1000, // dropdown, overlaypanel
1015
menu: 1000, // overlay menus
1116
tooltip: 1100 // tooltip
1217
toast: 1200 // toast
13-
}
18+
});
1419
15-
PrimeReact.autoZIndex = true;
20+
setAutoZIndex(true);
1621
`
1722
};
1823

@@ -22,7 +27,7 @@ PrimeReact.autoZIndex = true;
2227
<p>
2328
ZIndexes are managed automatically to make sure layering of overlay components work seamlessly when combining multiple components. Still there may be cases where you'd like to configure the configure default values such as a
2429
custom layout where header section is fixed. In a case like this, dropdown needs to be displayed below the application header but a modal dialog should be displayed above. PrimeReact configuration offers the <i>zIndex</i> property
25-
to customize the default values for components categories. Default values are described below and can be customized when setting up PrimeReact.
30+
to customize the default values for components categories. Default values are described below and can be customized when setting up the context value.
2631
</p>
2732
<p>
2833
The ZIndex of all components is increased according to their groups in harmony with each other. When <i>autoZIndex</i> is false, each group increments its zIndex within itself.

components/doc/dock/advanceddoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useContext, useEffect, useRef, useState } from 'react';
22
import { NodeService } from '../../../service/NodeService';
33
import { PhotoService } from '../../../service/PhotoService';
4-
import { PrimeReactContext } from '../../lib/api/context';
4+
import { PrimeReactContext } from '../../lib/api/Api';
55
import { Dialog } from '../../lib/dialog/Dialog';
66
import { Dock } from '../../lib/dock/Dock';
77
import { Galleria } from '../../lib/galleria/Galleria';

components/doc/galleria/responsivedoc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export default function ResponsiveDoc() {
154154
return (
155155
<>
156156
<DocSectionText {...props}>
157-
<p>Responsive Doc</p>
157+
<p>
158+
Galleria responsiveness is defined with the <i>responsiveOptions</i> property.
159+
</p>
158160
</DocSectionText>
159161
<div className="card flex justify-content-center">
160162
<div>

0 commit comments

Comments
 (0)