Skip to content

Commit

Permalink
Fix #4089: Orderlist require dataKey (#5732)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 11, 2024
1 parent 6f05fd4 commit c00c029
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions components/doc/orderlist/basicdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function BasicDoc(props) {

const code = {
basic: `
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
`,
javascript: `
import React, { useState, useEffect } from 'react';
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function BasicDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
</div>
)
}
Expand Down Expand Up @@ -109,7 +109,7 @@ export default function BasicDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
</div>
)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ export default function BasicDemo() {
</p>
</DocSectionText>
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
</div>
<DocSectionCode code={code} service={['ProductService']} />
</>
Expand Down
8 changes: 4 additions & 4 deletions components/doc/orderlist/dragdropdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function DragDropDoc(props) {

const code = {
basic: `
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate}
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate}
header="Products" dragdrop></OrderList>
`,
javascript: `
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function BasicDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
</div>
)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ export default function BasicDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
</div>
)
}
Expand Down Expand Up @@ -141,7 +141,7 @@ export default function BasicDemo() {
</p>
</DocSectionText>
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" dragdrop></OrderList>
</div>
<DocSectionCode code={code} service={['ProductService']} />
</>
Expand Down
8 changes: 4 additions & 4 deletions components/doc/orderlist/filterdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function FilterDoc(props) {

const code = {
basic: `
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
`,
javascript: `
import React, { useState, useEffect } from 'react';
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function FilterDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
</div>
)
}
Expand Down Expand Up @@ -109,7 +109,7 @@ export default function FilterDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
</div>
)
}
Expand Down Expand Up @@ -141,7 +141,7 @@ export default function FilterDemo() {
</p>
</DocSectionText>
<div className="card xl:flex xl:justify-content-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products" filter filterBy="name"></OrderList>
</div>
<DocSectionCode code={code} service={['ProductService']} />
</>
Expand Down
4 changes: 4 additions & 0 deletions components/doc/orderlist/pt/ptdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function PTDoc(props) {
const code = {
basic: `
<OrderList
dataKey="id"
value={products}
onChange={(e) => setProducts(e.value)}
itemTemplate={itemTemplate}
Expand Down Expand Up @@ -74,6 +75,7 @@ export default function PTDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList
dataKey="id"
value={products}
onChange={(e) => setProducts(e.value)}
itemTemplate={itemTemplate}
Expand Down Expand Up @@ -134,6 +136,7 @@ export default function PTDemo() {
return (
<div className="card xl:flex xl:justify-content-center">
<OrderList
dataKey="id"
value={products}
onChange={(e) => setProducts(e.value)}
itemTemplate={itemTemplate}
Expand Down Expand Up @@ -173,6 +176,7 @@ export default function PTDemo() {
<DocSectionText {...props}></DocSectionText>
<div className="card xl:flex xl:justify-content-center">
<OrderList
dataKey="id"
value={products}
onChange={(e) => setProducts(e.value)}
itemTemplate={itemTemplate}
Expand Down
2 changes: 1 addition & 1 deletion components/doc/orderlist/theming/tailwinddoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function UnstyledDemo() {
return (
<div className="card xl:flex xl:justify-center">
<OrderList value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
<OrderList dataKey="id" value={products} onChange={(e) => setProducts(e.value)} itemTemplate={itemTemplate} header="Products"></OrderList>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion components/lib/orderlist/orderlist.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export interface OrderListProps extends Omit<React.DetailedHTMLProps<React.HTMLA
/**
* Name of the field that uniquely identifies the a record in the data.
*/
dataKey?: string | undefined;
dataKey: string;
/**
* The breakpoint to define the maximum width boundary when responsiveness is enabled.
* @defaultValue '960px'.
Expand Down

0 comments on commit c00c029

Please sign in to comment.