@fieldia/core 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -1
- package/package.json +1 -1
- package/schema/page.schema.json +149 -1
- package/src/index.d.mts +2 -2
- package/src/index.d.ts +2 -2
- package/src/index.js +3 -1
- package/src/index.js.map +1 -1
- package/src/index.mjs +2 -2
- package/src/index.mjs.map +1 -1
- package/src/lib/format/check-page.d.mts +3 -2
- package/src/lib/format/check-page.d.ts +3 -2
- package/src/lib/format/check-page.js +9 -4
- package/src/lib/format/check-page.js.map +1 -1
- package/src/lib/format/check-page.mjs +10 -5
- package/src/lib/format/check-page.mjs.map +1 -1
- package/src/lib/format/field.d.mts +85 -0
- package/src/lib/format/field.d.ts +85 -0
- package/src/lib/format/field.js +14 -1
- package/src/lib/format/field.js.map +1 -1
- package/src/lib/format/field.mjs +13 -0
- package/src/lib/format/field.mjs.map +1 -1
- package/src/lib/format/layout.d.mts +142 -17
- package/src/lib/format/layout.d.ts +142 -17
- package/src/lib/format/layout.js +18 -1
- package/src/lib/format/layout.js.map +1 -1
- package/src/lib/format/layout.mjs +17 -0
- package/src/lib/format/layout.mjs.map +1 -1
- package/src/lib/format/layout.types.d.mts +6 -2
- package/src/lib/format/layout.types.d.ts +6 -2
- package/src/lib/format/page.d.mts +69 -10
- package/src/lib/format/page.d.ts +69 -10
- package/src/lib/format/page.js +4 -1
- package/src/lib/format/page.js.map +1 -1
- package/src/lib/format/page.mjs +5 -2
- package/src/lib/format/page.mjs.map +1 -1
- package/src/lib/format/references.d.mts +7 -0
- package/src/lib/format/references.d.ts +7 -0
- package/src/lib/format/references.js +46 -0
- package/src/lib/format/references.js.map +1 -1
- package/src/lib/format/references.mjs +46 -0
- package/src/lib/format/references.mjs.map +1 -1
- package/src/lib/format/translate.js +3 -2
- package/src/lib/format/translate.js.map +1 -1
- package/src/lib/format/translate.mjs +3 -2
- package/src/lib/format/translate.mjs.map +1 -1
- package/src/lib/format/upgrade.d.mts +41 -0
- package/src/lib/format/upgrade.d.ts +41 -0
- package/src/lib/format/upgrade.js +41 -0
- package/src/lib/format/upgrade.js.map +1 -0
- package/src/lib/format/upgrade.mjs +37 -0
- package/src/lib/format/upgrade.mjs.map +1 -0
- package/src/lib/format/validate.d.mts +2 -1
- package/src/lib/format/validate.d.ts +2 -1
- package/src/lib/format/validate.js +4 -2
- package/src/lib/format/validate.js.map +1 -1
- package/src/lib/format/validate.mjs +4 -2
- package/src/lib/format/validate.mjs.map +1 -1
- package/src/lib/format/version.d.mts +16 -1
- package/src/lib/format/version.d.ts +16 -1
- package/src/lib/format/version.js +39 -2
- package/src/lib/format/version.js.map +1 -1
- package/src/lib/format/version.mjs +36 -1
- package/src/lib/format/version.mjs.map +1 -1
- package/src/lib/record/data-source.d.mts +224 -10
- package/src/lib/record/data-source.d.ts +224 -10
- package/src/lib/record/data-source.js +29 -0
- package/src/lib/record/data-source.js.map +1 -1
- package/src/lib/record/data-source.mjs +25 -0
- package/src/lib/record/data-source.mjs.map +1 -1
- package/src/lib/record/form.d.mts +144 -5
- package/src/lib/record/form.d.ts +144 -5
- package/src/lib/record/form.js +792 -42
- package/src/lib/record/form.js.map +1 -1
- package/src/lib/record/form.mjs +791 -43
- package/src/lib/record/form.mjs.map +1 -1
- package/src/lib/record/locales/ar.js +10 -0
- package/src/lib/record/locales/ar.js.map +1 -1
- package/src/lib/record/locales/ar.mjs +10 -0
- package/src/lib/record/locales/ar.mjs.map +1 -1
- package/src/lib/record/locales/de.js +10 -0
- package/src/lib/record/locales/de.js.map +1 -1
- package/src/lib/record/locales/de.mjs +10 -0
- package/src/lib/record/locales/de.mjs.map +1 -1
- package/src/lib/record/locales/fr.js +10 -0
- package/src/lib/record/locales/fr.js.map +1 -1
- package/src/lib/record/locales/fr.mjs +10 -0
- package/src/lib/record/locales/fr.mjs.map +1 -1
- package/src/lib/record/memory-data-source.d.mts +40 -3
- package/src/lib/record/memory-data-source.d.ts +40 -3
- package/src/lib/record/memory-data-source.js +164 -20
- package/src/lib/record/memory-data-source.js.map +1 -1
- package/src/lib/record/memory-data-source.mjs +164 -20
- package/src/lib/record/memory-data-source.mjs.map +1 -1
- package/src/lib/record/messages.d.mts +21 -0
- package/src/lib/record/messages.d.ts +21 -0
- package/src/lib/record/messages.js +10 -0
- package/src/lib/record/messages.js.map +1 -1
- package/src/lib/record/messages.mjs +10 -0
- package/src/lib/record/messages.mjs.map +1 -1
- package/src/lib/record/run.d.mts +50 -7
- package/src/lib/record/run.d.ts +50 -7
- package/src/lib/record/run.js +67 -20
- package/src/lib/record/run.js.map +1 -1
- package/src/lib/record/run.mjs +67 -20
- package/src/lib/record/run.mjs.map +1 -1
- package/src/lib/record/upload-to.d.mts +50 -0
- package/src/lib/record/upload-to.d.ts +50 -0
- package/src/lib/record/upload-to.js +117 -0
- package/src/lib/record/upload-to.js.map +1 -0
- package/src/lib/record/upload-to.mjs +114 -0
- package/src/lib/record/upload-to.mjs.map +1 -0
- package/src/lib/record/uploads.d.mts +152 -0
- package/src/lib/record/uploads.d.ts +152 -0
- package/src/lib/record/uploads.js +345 -0
- package/src/lib/record/uploads.js.map +1 -0
- package/src/lib/record/uploads.mjs +337 -0
- package/src/lib/record/uploads.mjs.map +1 -0
- package/src/lib/record/values.d.mts +6 -0
- package/src/lib/record/values.d.ts +6 -0
- package/src/lib/record/values.js.map +1 -1
- package/src/lib/record/values.mjs.map +1 -1
- package/src/runtime.d.mts +10 -6
- package/src/runtime.d.ts +10 -6
- package/src/runtime.js +19 -2
- package/src/runtime.js.map +1 -1
- package/src/runtime.mjs +7 -3
- package/src/runtime.mjs.map +1 -1
package/src/lib/format/page.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type PartsLook } from './part-look';
|
|
|
6
6
|
import { type Theme } from './themes';
|
|
7
7
|
export { THEMES, type Theme } from './themes';
|
|
8
8
|
import { type Skin } from './themes';
|
|
9
|
-
import {
|
|
9
|
+
import { type FormatVersion } from './version';
|
|
10
10
|
import type { DateOrder } from '../record/input-rules';
|
|
11
11
|
export { FORMAT_VERSION } from './version';
|
|
12
12
|
/**
|
|
@@ -81,8 +81,11 @@ export interface PageLook {
|
|
|
81
81
|
dateOrder?: DateOrder;
|
|
82
82
|
}
|
|
83
83
|
export interface Page {
|
|
84
|
-
/**
|
|
85
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The format the page is written in, so a reader can tell one it cannot read yet (a newer Fieldia's) from one it can
|
|
86
|
+
* bring up to date (an older one's: `upgradePage`). A page made now says FORMAT_VERSION.
|
|
87
|
+
*/
|
|
88
|
+
fieldia: FormatVersion;
|
|
86
89
|
id: string;
|
|
87
90
|
title?: string;
|
|
88
91
|
description?: string;
|
|
@@ -116,7 +119,10 @@ export declare const PageDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
116
119
|
kind: z.ZodLiteral<"responses">;
|
|
117
120
|
}, z.z.core.$strict>], "kind">;
|
|
118
121
|
export declare const PageSchema: z.ZodObject<{
|
|
119
|
-
fieldia: z.
|
|
122
|
+
fieldia: z.ZodEnum<{
|
|
123
|
+
0.2: "0.2";
|
|
124
|
+
0.1: "0.1";
|
|
125
|
+
}>;
|
|
120
126
|
id: z.ZodString;
|
|
121
127
|
title: z.ZodOptional<z.ZodString>;
|
|
122
128
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -326,6 +332,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
326
332
|
type: z.ZodLiteral<"selection">;
|
|
327
333
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
328
334
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
335
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
336
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
337
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
}, z.z.core.$strict>]>>;
|
|
329
339
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
330
340
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
331
341
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -345,6 +355,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
345
355
|
type: z.ZodLiteral<"binary">;
|
|
346
356
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
347
357
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
358
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
359
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
360
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
361
|
+
}, z.z.core.$strict>]>>;
|
|
348
362
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
349
363
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
350
364
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -880,6 +894,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
880
894
|
type: z.ZodLiteral<"selection">;
|
|
881
895
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
882
896
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
897
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
898
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
899
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
900
|
+
}, z.z.core.$strict>]>>;
|
|
883
901
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
884
902
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
885
903
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -899,6 +917,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
899
917
|
type: z.ZodLiteral<"binary">;
|
|
900
918
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
901
919
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
920
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
921
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
922
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
923
|
+
}, z.z.core.$strict>]>>;
|
|
902
924
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
903
925
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
904
926
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -1511,6 +1533,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
1511
1533
|
type: z.ZodLiteral<"selection">;
|
|
1512
1534
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
1513
1535
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
1536
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
1537
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
1538
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
1539
|
+
}, z.z.core.$strict>]>>;
|
|
1514
1540
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
1515
1541
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
1516
1542
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -1530,6 +1556,10 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
1530
1556
|
type: z.ZodLiteral<"binary">;
|
|
1531
1557
|
}, z.z.core.$strict>, z.ZodObject<{
|
|
1532
1558
|
maxSize: z.ZodOptional<z.ZodInt>;
|
|
1559
|
+
shrink: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
1560
|
+
maxSide: z.ZodOptional<z.ZodInt>;
|
|
1561
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
1562
|
+
}, z.z.core.$strict>]>>;
|
|
1533
1563
|
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
1534
1564
|
minFiles: z.ZodOptional<z.ZodInt>;
|
|
1535
1565
|
maxFiles: z.ZodOptional<z.ZodInt>;
|
|
@@ -2183,8 +2213,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
2183
2213
|
always: "always";
|
|
2184
2214
|
}>>;
|
|
2185
2215
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
2186
|
-
content: "content";
|
|
2187
2216
|
shrink: "shrink";
|
|
2217
|
+
content: "content";
|
|
2188
2218
|
}>>;
|
|
2189
2219
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
2190
2220
|
cell: "cell";
|
|
@@ -2638,8 +2668,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
2638
2668
|
always: "always";
|
|
2639
2669
|
}>>;
|
|
2640
2670
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
2641
|
-
content: "content";
|
|
2642
2671
|
shrink: "shrink";
|
|
2672
|
+
content: "content";
|
|
2643
2673
|
}>>;
|
|
2644
2674
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
2645
2675
|
cell: "cell";
|
|
@@ -3417,8 +3447,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
3417
3447
|
always: "always";
|
|
3418
3448
|
}>>;
|
|
3419
3449
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
3420
|
-
content: "content";
|
|
3421
3450
|
shrink: "shrink";
|
|
3451
|
+
content: "content";
|
|
3422
3452
|
}>>;
|
|
3423
3453
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
3424
3454
|
cell: "cell";
|
|
@@ -3556,8 +3586,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
3556
3586
|
always: "always";
|
|
3557
3587
|
}>>;
|
|
3558
3588
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
3559
|
-
content: "content";
|
|
3560
3589
|
shrink: "shrink";
|
|
3590
|
+
content: "content";
|
|
3561
3591
|
}>>;
|
|
3562
3592
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
3563
3593
|
cell: "cell";
|
|
@@ -3695,8 +3725,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
3695
3725
|
always: "always";
|
|
3696
3726
|
}>>;
|
|
3697
3727
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
3698
|
-
content: "content";
|
|
3699
3728
|
shrink: "shrink";
|
|
3729
|
+
content: "content";
|
|
3700
3730
|
}>>;
|
|
3701
3731
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
3702
3732
|
cell: "cell";
|
|
@@ -3834,8 +3864,8 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
3834
3864
|
always: "always";
|
|
3835
3865
|
}>>;
|
|
3836
3866
|
fit: z.ZodOptional<z.ZodEnum<{
|
|
3837
|
-
content: "content";
|
|
3838
3867
|
shrink: "shrink";
|
|
3868
|
+
content: "content";
|
|
3839
3869
|
}>>;
|
|
3840
3870
|
editMode: z.ZodOptional<z.ZodEnum<{
|
|
3841
3871
|
cell: "cell";
|
|
@@ -5323,6 +5353,35 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
5323
5353
|
}>>;
|
|
5324
5354
|
fitZoom: z.ZodOptional<z.ZodInt>;
|
|
5325
5355
|
}, z.z.core.$strict>>;
|
|
5356
|
+
calendar: z.ZodOptional<z.ZodObject<{
|
|
5357
|
+
start: z.ZodString;
|
|
5358
|
+
end: z.ZodOptional<z.ZodString>;
|
|
5359
|
+
title: z.ZodString;
|
|
5360
|
+
colour: z.ZodOptional<z.ZodString>;
|
|
5361
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
5362
|
+
views: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
5363
|
+
day: "day";
|
|
5364
|
+
week: "week";
|
|
5365
|
+
month: "month";
|
|
5366
|
+
agenda: "agenda";
|
|
5367
|
+
}>>>;
|
|
5368
|
+
view: z.ZodOptional<z.ZodEnum<{
|
|
5369
|
+
day: "day";
|
|
5370
|
+
week: "week";
|
|
5371
|
+
month: "month";
|
|
5372
|
+
agenda: "agenda";
|
|
5373
|
+
}>>;
|
|
5374
|
+
opens: z.ZodOptional<z.ZodEnum<{
|
|
5375
|
+
list: "list";
|
|
5376
|
+
calendar: "calendar";
|
|
5377
|
+
}>>;
|
|
5378
|
+
firstDay: z.ZodOptional<z.ZodInt>;
|
|
5379
|
+
hours: z.ZodOptional<z.ZodObject<{
|
|
5380
|
+
start: z.ZodInt;
|
|
5381
|
+
end: z.ZodInt;
|
|
5382
|
+
}, z.z.core.$strict>>;
|
|
5383
|
+
slot: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<15>, z.ZodLiteral<30>, z.ZodLiteral<60>]>>;
|
|
5384
|
+
}, z.z.core.$strict>>;
|
|
5326
5385
|
cells: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
5327
5386
|
widget: z.ZodOptional<z.ZodString>;
|
|
5328
5387
|
options: z.ZodOptional<z.ZodObject<{
|
package/src/lib/format/page.js
CHANGED
|
@@ -30,7 +30,10 @@ const PART_SETTING = {
|
|
|
30
30
|
const PartsLookSchema = z.strictObject(Object.fromEntries(Object.entries(part_look_1.PART_LOOKS).map(([kind, settings]) => [kind, z.strictObject(Object.fromEntries(settings.map((name) => [name, PART_SETTING[name].optional()]))).optional()])));
|
|
31
31
|
exports.PageSchema = z
|
|
32
32
|
.strictObject({
|
|
33
|
-
|
|
33
|
+
// Newer than this Fieldia, or no format at all: said in words (formatProblem), not as a literal expected.
|
|
34
|
+
// Any format Fieldia has had: a page is brought up to date before it is checked, and an app's own older pages
|
|
35
|
+
// ("0.1", from 0.20 and 0.21) still type as pages.
|
|
36
|
+
fieldia: z.enum(version_1.FORMAT_VERSIONS, { error: (issue) => (0, version_1.formatProblem)(issue.input) ?? undefined }),
|
|
34
37
|
id: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),
|
|
35
38
|
title: z.string().optional(),
|
|
36
39
|
description: z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/page.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,uCAA8D;AAC9D,mCAAoD;AACpD,qCAA8F;AAC9F,2CAAwE;AACxE,qCAA8C;AAC9C,mCAA8C;AAArC,gGAAA,MAAM,OAAA;AACf,qCAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/page.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,uCAA8D;AAC9D,mCAAoD;AACpD,qCAA8F;AAC9F,2CAAwE;AACxE,qCAA8C;AAC9C,mCAA8C;AAArC,gGAAA,MAAM,OAAA;AACf,qCAA4C;AAE5C,uCAA+E;AAE/E,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AAoGV,QAAA,cAAc,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACzD,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACpD,MAAM,YAAY,GAAmD;IACnE,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM;CACf,CAAC;AACF,4DAA4D;AAC5D,MAAM,e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CAAC,CAAC,QAAQ,EAAE;KACpD,CAAC;SACD,QAAQ,EAAE;IACb,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC,QAAQ,EAAE;IACzE,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzH,EAAE,EAAE,0BAAgB,CAAC,QAAQ,EAAE;CAChC,CAAC;KACD,IAAI,CAAC;IACJ,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,8HAA8H;CACjI,CAAC,CAAC"}
|
package/src/lib/format/page.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { PART_LOOKS } from './part-look.mjs';
|
|
|
6
6
|
import { THEMES } from './themes.mjs';
|
|
7
7
|
export { THEMES } from './themes.mjs';
|
|
8
8
|
import { SKINS } from './themes.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { FORMAT_VERSIONS, formatProblem } from './version.mjs';
|
|
10
10
|
export { FORMAT_VERSION } from './version.mjs';
|
|
11
11
|
export const PageDataSchema = z.discriminatedUnion('kind', [
|
|
12
12
|
z.strictObject({ kind: z.literal('record'), model: z.string().min(1) }),
|
|
@@ -25,7 +25,10 @@ const PART_SETTING = {
|
|
|
25
25
|
const PartsLookSchema = z.strictObject(Object.fromEntries(Object.entries(PART_LOOKS).map(([kind, settings]) => [kind, z.strictObject(Object.fromEntries(settings.map((name) => [name, PART_SETTING[name].optional()]))).optional()])));
|
|
26
26
|
export const PageSchema = z
|
|
27
27
|
.strictObject({
|
|
28
|
-
|
|
28
|
+
// Newer than this Fieldia, or no format at all: said in words (formatProblem), not as a literal expected.
|
|
29
|
+
// Any format Fieldia has had: a page is brought up to date before it is checked, and an app's own older pages
|
|
30
|
+
// ("0.1", from 0.20 and 0.21) still type as pages.
|
|
31
|
+
fieldia: z.enum(FORMAT_VERSIONS, { error: (issue) => formatProblem(issue.input) ?? undefined }),
|
|
29
32
|
id: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),
|
|
30
33
|
title: z.string().optional(),
|
|
31
34
|
description: z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAmB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAmC,MAAM,UAAU,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAiC,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAa,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"page.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAmB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAmC,MAAM,UAAU,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAiC,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAa,MA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AC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzH,EAAE,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CAChC,CAAC;KACD,IAAI,CAAC;IACJ,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,8HAA8H;CACjI,CAAC,CAAC"}
|
|
@@ -91,6 +91,13 @@ export declare class ReferenceCheck {
|
|
|
91
91
|
private walkFooter;
|
|
92
92
|
private walkRoot;
|
|
93
93
|
private walkList;
|
|
94
|
+
/**
|
|
95
|
+
* A list's calendar: when each record starts (a date, or a date and time)
|
|
96
|
+
* and ends (the same kind), its words, its colour and its columns, each
|
|
97
|
+
* from a field that can; the view it opens on is one it offers, its hours
|
|
98
|
+
* run forward, and the list opens on one thing.
|
|
99
|
+
*/
|
|
100
|
+
private walkListCalendar;
|
|
94
101
|
/**
|
|
95
102
|
* A list drawn as a backlog: each column's cells are a column's, a lead's
|
|
96
103
|
* icon is by a field's values; the filter bar's fields can list their
|
|
@@ -91,6 +91,13 @@ export declare class ReferenceCheck {
|
|
|
91
91
|
private walkFooter;
|
|
92
92
|
private walkRoot;
|
|
93
93
|
private walkList;
|
|
94
|
+
/**
|
|
95
|
+
* A list's calendar: when each record starts (a date, or a date and time)
|
|
96
|
+
* and ends (the same kind), its words, its colour and its columns, each
|
|
97
|
+
* from a field that can; the view it opens on is one it offers, its hours
|
|
98
|
+
* run forward, and the list opens on one thing.
|
|
99
|
+
*/
|
|
100
|
+
private walkListCalendar;
|
|
94
101
|
/**
|
|
95
102
|
* A list drawn as a backlog: each column's cells are a column's, a lead's
|
|
96
103
|
* icon is by a field's values; the filter bar's fields can list their
|
|
@@ -17,6 +17,14 @@ const EXPRESSIBLE = new Set(['char', 'text', 'html', 'integer', 'float', 'moneta
|
|
|
17
17
|
const EXPRESSIBLE_WORDS = 'text, numbers, yes or no, dates, choices and json can';
|
|
18
18
|
/** The kinds of field a list's filter bar can list the values of. */
|
|
19
19
|
const LISTS_ITS_VALUES = new Set(['selection', 'many2one', 'many2many', 'boolean', 'char', 'integer']);
|
|
20
|
+
/** What a calendar's start and end can be: a day, or a day and a time. */
|
|
21
|
+
const CALENDAR_TIMES = new Set(['date', 'datetime']);
|
|
22
|
+
/** What a record's words on a calendar can be. */
|
|
23
|
+
const CALENDAR_WORDS = new Set(['char', 'text', 'selection', 'many2one', 'integer', 'float', 'monetary', 'date', 'datetime']);
|
|
24
|
+
/** What a calendar's columns come from: a value that repeats. */
|
|
25
|
+
const CALENDAR_COLUMNS = new Set(['many2one', 'selection', 'char', 'integer']);
|
|
26
|
+
/** What a record's colour comes from. */
|
|
27
|
+
const CALENDAR_COLOURS = new Set(['many2one', 'selection', 'char', 'integer', 'boolean']);
|
|
20
28
|
/** Names quoted and joined as a person lists them: "a", "b" and "c". */
|
|
21
29
|
const listed = (names) => {
|
|
22
30
|
const quoted = names.map((name) => `"${name}"`);
|
|
@@ -515,8 +523,46 @@ class ReferenceCheck {
|
|
|
515
523
|
});
|
|
516
524
|
if (list.map)
|
|
517
525
|
this.walkListMap(list.map, `${path}.map`);
|
|
526
|
+
if (list.calendar)
|
|
527
|
+
this.walkListCalendar(list, `${path}.calendar`);
|
|
518
528
|
this.checkListCells(list, path);
|
|
519
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* A list's calendar: when each record starts (a date, or a date and time)
|
|
532
|
+
* and ends (the same kind), its words, its colour and its columns, each
|
|
533
|
+
* from a field that can; the view it opens on is one it offers, its hours
|
|
534
|
+
* run forward, and the list opens on one thing.
|
|
535
|
+
*/
|
|
536
|
+
walkListCalendar(list, path) {
|
|
537
|
+
const calendar = list.calendar;
|
|
538
|
+
const typed = (name, key, ok, says) => {
|
|
539
|
+
if (name === undefined)
|
|
540
|
+
return undefined;
|
|
541
|
+
const def = this.need(name, `${path}.${key}`);
|
|
542
|
+
if (def && !ok.has(def.type))
|
|
543
|
+
this.report(`${path}.${key}`, `"${name}" is a ${def.type}; ${says}`);
|
|
544
|
+
return def;
|
|
545
|
+
};
|
|
546
|
+
const start = typed(calendar.start, 'start', CALENDAR_TIMES, "a calendar's start is a date, or a date and time");
|
|
547
|
+
const end = typed(calendar.end, 'end', CALENDAR_TIMES, "a calendar's end is a date, or a date and time");
|
|
548
|
+
if (start && end && CALENDAR_TIMES.has(start.type) && CALENDAR_TIMES.has(end.type) && start.type !== end.type) {
|
|
549
|
+
this.report(`${path}.end`, `"${calendar.end}" is a ${end.type}; an end is the same kind of field as its start, a ${start.type}`);
|
|
550
|
+
}
|
|
551
|
+
typed(calendar.title, 'title', CALENDAR_WORDS, "a record's words on a calendar are a field that can be said");
|
|
552
|
+
typed(calendar.colour, 'colour', CALENDAR_COLOURS, 'a colour comes from a link, a choice, text, a whole number or a yes or no');
|
|
553
|
+
typed(calendar.resource, 'resource', CALENDAR_COLUMNS, 'a column for each comes from a link, a choice, text or a whole number');
|
|
554
|
+
const views = calendar.views ?? ['day', 'week', 'month', 'agenda'];
|
|
555
|
+
views.forEach((view, i) => {
|
|
556
|
+
if (views.indexOf(view) !== i)
|
|
557
|
+
this.report(`${path}.views[${i}]`, `"${view}" is offered twice`);
|
|
558
|
+
});
|
|
559
|
+
if (calendar.view && !views.includes(calendar.view))
|
|
560
|
+
this.report(`${path}.view`, `"${calendar.view}" is not one of its views (${views.join(', ')})`);
|
|
561
|
+
if (calendar.hours && calendar.hours.end <= calendar.hours.start)
|
|
562
|
+
this.report(`${path}.hours`, `the hours end at ${calendar.hours.end}, before they start at ${calendar.hours.start}`);
|
|
563
|
+
if (calendar.opens === 'calendar' && list.map?.view && list.map.view !== 'list')
|
|
564
|
+
this.report(`${path}.opens`, 'the list opens on its map (map.view) and on its calendar: say one');
|
|
565
|
+
}
|
|
520
566
|
/**
|
|
521
567
|
* A list drawn as a backlog: each column's cells are a column's, a lead's
|
|
522
568
|
* icon is by a field's values; the filter bar's fields can list their
|