Skip to content

Commit

Permalink
[IMP] demo: add demo data for data validation
Browse files Browse the repository at this point in the history
closes #3167

X-original-commit: 742581e
Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
  • Loading branch information
hokolomopo committed Nov 16, 2023
1 parent 86c44d5 commit fc912f6
Showing 1 changed file with 89 additions and 3 deletions.
92 changes: 89 additions & 3 deletions demo/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const demoData = {
A21: { content: "[Sheet2 => B2:](o-spreadsheet://sh2)" },
B2: { content: "[Owl is awesome](https://github.com/odoo/owl)", style: 1 },
B4: { content: "Numbers", style: 4 },
B21: { content: "=Sheet2!B2", style: 7 },
B21: { content: "=Charts!B2", style: 7 },
A23: { content: "https://odoo.com" },
C1: { content: "CF =42" },
C4: { content: "12.4" },
Expand Down Expand Up @@ -82,6 +82,7 @@ export const demoData = {
A33: { content: "Jessica Alcock (Jess)" },
A34: { content: "Charlotte Anaya" },
A35: { content: "Lauren Anthony" },
H22: { content: "Col 1" },
H23: { content: "0" },
H24: { content: "1" },
H25: { content: "2" },
Expand Down Expand Up @@ -159,7 +160,7 @@ export const demoData = {
],
},
{
name: "Sheet2",
name: "Charts",
id: "sh2",
cells: {
B2: { content: "42" },
Expand Down Expand Up @@ -221,7 +222,6 @@ export const demoData = {
type: "scorecard",
keyValue: "Sheet1!B29",
title: "Scorecard",
sheetId: "Sheet2",
baselineMode: "absolute",
baselineColorUp: "#00A04A",
baselineColorDown: "#DC6965",
Expand Down Expand Up @@ -1933,6 +1933,89 @@ export const demoData = {
F2: { content: "mixed", border: 10 },
},
},
{
name: "Data Validation",
id: "sh5",
colNumber: 26,
rowNumber: 50,
cols: { 5: { size: 150 } },
cells: {
A1: { content: "Data Validation Corner", style: 8 },
A2: { style: 8, border: 10 },
A3: { content: "Perceval", border: 1 },
A4: { content: "Arthur" },
A5: { content: "Gauvin" },
A6: { content: "Yvain", border: 8 },
B2: { content: "Age", style: 8, border: 2 },
B3: { content: "unknown" },
B4: { content: "42" },
B5: { content: "20" },
B6: { content: "19", border: 4 },
C2: { content: "Birthday", style: 8, border: 2 },
C3: { content: "unknown", format: "m/d/yyyy" },
C4: { content: "05/01/657", format: "m/d/yyyy" },
C5: { content: "11/30/679", format: "m/d/yyyy" },
C6: { content: "12/12/680", format: "m/d/yyyy", border: 4 },
D2: { content: "Origin", style: 8, border: 2 },
D3: { content: "Wales" },
D4: { content: "Britain" },
D5: { content: "Britain" },
D6: { content: "Britain", border: 4 },
E2: { content: "Is king ?", style: 8, border: 2 },
E3: { content: "false", style: 9 },
E4: { content: "true", style: 9 },
E5: { content: "false", style: 9 },
E6: { content: "false", style: 9, border: 4 },
F2: { content: "Email", style: 8, border: 11 },
F3: { content: "[email protected]", border: 3 },
F4: { content: "[email protected]", border: 3 },
F5: { content: "[email protected]", border: 3 },
F6: { content: "Yvain{at}odoo.com", border: 9 },
},
dataValidationRules: [
{
id: "dv1",
criterion: {
type: "isBetween",
values: ["0", "100"],
},
ranges: ["B3:B6"],
},
{
id: "dv2",
criterion: {
type: "dateIsValid",
values: [],
},
ranges: ["C3:C6"],
},
{
id: "dv3",
criterion: {
type: "isValueInList",
values: ["Wales", "Britain", "Rome"],
displayStyle: "arrow",
},
ranges: ["D3:D6"],
},
{
id: "dv4",
criterion: {
type: "isBoolean",
values: [],
},
ranges: ["E3:E6"],
},
{
id: "dv5",
criterion: {
type: "textIsEmail",
values: [],
},
ranges: ["F3:F6"],
},
],
},
],
styles: {
1: { bold: true, textColor: "#3A3791", fontSize: 18 },
Expand Down Expand Up @@ -1991,6 +2074,9 @@ export const demoData = {
},
7: { bottom: ["thin", "#000"] },
8: { bottom: ["thin", "#000"], left: ["thin", "#000"] },
9: { bottom: ["thin", "#000"], right: ["thin", "#000"] },
10: { top: ["thin", "#000"], left: ["thin", "#000"] },
11: { top: ["thin", "#000"], right: ["thin", "#000"] },
},
};

Expand Down

0 comments on commit fc912f6

Please sign in to comment.