@antelopejs/interface-dms 0.14.7-next.1006.g63d3e11 → 0.14.7-next.1008.g198383f
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/dist/component-options/page-layout.d.ts +5 -2
- package/dist/component-options/page-layout.js.map +1 -1
- package/dist/page/internal/page-record.d.ts +2 -1
- package/dist/page/internal/page-record.js +51 -7
- package/dist/page/internal/page-record.js.map +1 -1
- package/dist/page/layout-filter.js +2 -6
- package/dist/page/layout-filter.js.map +1 -1
- package/dist/utils/internal/type-check.d.ts +7 -0
- package/dist/utils/internal/type-check.js +12 -1
- package/dist/utils/internal/type-check.js.map +1 -1
- package/docs/3.base/11.page-layouts.md +2 -2
- package/package.json +2 -2
|
@@ -14,7 +14,8 @@ export interface PageHeaderButton extends CustomButton {
|
|
|
14
14
|
/**
|
|
15
15
|
* The button acts on the record the page shows (the layout's `record`): it
|
|
16
16
|
* is left out of a page whose record was not found. A target naming
|
|
17
|
-
* `{{record.X}}` implies it
|
|
17
|
+
* `{{record.X}}` implies it: in its `url`, an `api` target's `redirect`, or
|
|
18
|
+
* the options of the component a `drawer`, `modal` or `sidePanel` opens.
|
|
18
19
|
*/
|
|
19
20
|
requiresRecord?: boolean;
|
|
20
21
|
}
|
|
@@ -61,7 +62,9 @@ export interface DefaultLayoutOptions {
|
|
|
61
62
|
* The record the page shows, read on the server with the layout: the
|
|
62
63
|
* header buttons acting on it (`requiresRecord`, or a `{{record.X}}` in
|
|
63
64
|
* their target) are left out without it, and every `availability` of the
|
|
64
|
-
* page reads it as `context.record`.
|
|
65
|
+
* page reads it as `context.record`. A drawer, modal or side panel's
|
|
66
|
+
* component options take `{{record.X}}`, and the block it opens receives
|
|
67
|
+
* the page's route parameters (`{{params.X}}`).
|
|
65
68
|
*/
|
|
66
69
|
record?: PageRecordLoader;
|
|
67
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-layout.js","sourceRoot":"","sources":["../../src/component-options/page-layout.ts"],"names":[],"mappings":";;;;;;AACA,8DAAmE;AACnE,4DAAiE;
|
|
1
|
+
{"version":3,"file":"page-layout.js","sourceRoot":"","sources":["../../src/component-options/page-layout.ts"],"names":[],"mappings":";;;;;;AACA,8DAAmE;AACnE,4DAAiE;AA8EjE,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAE1C,SAAS,mBAAmB,CAC1B,MAAwB,EACxB,KAAa;IAEb,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IACvE,MAAM,QAAQ,GAA6B;QACzC,GAAG,IAAI;QACP,EAAE,EAAE,EAAE,IAAI,GAAG,uBAAuB,GAAG,KAAK,EAAE;QAC9C,MAAM,EAAE,IAAA,qCAAqB,EAAC,MAAM,CAAC;KACtC,CAAC;IACF,IAAI,OAAO;QAAE,QAAQ,CAAC,OAAO,GAAG,IAAA,uCAAsB,EAAC,OAAO,CAAC,CAAC;IAChE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CACtB,aAAqB,EACrB,OAA6B;IAE7B,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,aAAa,GAAmC,IAAI,CAAC;IAC3D,IAAI,aAAa,EAAE,CAAC;QAClB,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC;AAED,uBAA8B,OAA8B;IAC1D,OAAO,eAAe,CAAC,oBAAoB,EAAE;QAC3C,SAAS,EAAE,IAAI;QACf,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,wBACE,OAAiD;IAEjD,OAAO,aAAa,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,CAAC;AAED;;;;;GAKG;AACH,wBACE,OAAiD;IAEjD,OAAO,eAAe,CAAC,qBAAqB,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAChE,CAAC;AAED;IACE,OAAO;QACL,aAAa,EAAE,kBAAkB;QACjC,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -19,7 +19,8 @@ export declare function readPageRecord(layout: ComponentInfo | undefined, contex
|
|
|
19
19
|
* A header button as the page's record leaves it: unchanged when the layout
|
|
20
20
|
* reads no record or the button does not act on it, left out (`undefined`)
|
|
21
21
|
* when the record was not found, the `{{record.X}}` of its target's `url`
|
|
22
|
-
* (and of an `api` target's `redirect`)
|
|
22
|
+
* (and of an `api` target's `redirect`), or of the options of the component a
|
|
23
|
+
* drawer, modal or side panel opens, filled in otherwise.
|
|
23
24
|
*
|
|
24
25
|
* @internal
|
|
25
26
|
*/
|
|
@@ -7,11 +7,15 @@ const type_check_1 = require("../../utils/internal/type-check");
|
|
|
7
7
|
const RECORD_TOKEN = /\{\{\s*record\.([\w.-]+)\s*\}\}/g;
|
|
8
8
|
const NAMES_RECORD = /\{\{\s*record\./;
|
|
9
9
|
const PATH_SEPARATOR = ".";
|
|
10
|
+
const URL_OPTION = /(?:url|^to|^href)$/i;
|
|
11
|
+
const ROOT_KEY = "";
|
|
10
12
|
const targetUrl = (target) => {
|
|
11
13
|
const url = target?.url;
|
|
12
14
|
return (0, type_check_1.isString)(url) ? url : undefined;
|
|
13
15
|
};
|
|
14
16
|
const targetRedirect = (target) => target?.type === "api" ? target.redirect : undefined;
|
|
17
|
+
const targetComponent = (target) => target && "component" in target ? target.component : undefined;
|
|
18
|
+
const namesRecord = (component) => NAMES_RECORD.test(JSON.stringify(component) ?? "");
|
|
15
19
|
const isRecordNode = (value) => !!value && typeof value === "object";
|
|
16
20
|
function leafAt(record, path) {
|
|
17
21
|
const value = path
|
|
@@ -47,24 +51,60 @@ async function readPageRecord(layout, context) {
|
|
|
47
51
|
function isRecordBound(button) {
|
|
48
52
|
if (button.requiresRecord)
|
|
49
53
|
return true;
|
|
54
|
+
if (namesRecord(targetComponent(button.target)))
|
|
55
|
+
return true;
|
|
50
56
|
return [targetUrl(button.target), targetRedirect(button.target)].some((url) => !!url && NAMES_RECORD.test(url));
|
|
51
57
|
}
|
|
58
|
+
const keepRaw = (value) => value;
|
|
52
59
|
/**
|
|
53
|
-
* A
|
|
54
|
-
* (an address is one query value). A token
|
|
55
|
-
* left as written.
|
|
60
|
+
* A text with its `{{record.X}}` tokens filled in, each value written by
|
|
61
|
+
* `encode`: percent-encoded in a URL (an address is one query value). A token
|
|
62
|
+
* the record has no value for is left as written.
|
|
56
63
|
*/
|
|
57
|
-
function fillRecordTokens(
|
|
58
|
-
return
|
|
64
|
+
function fillRecordTokens(text, record, encode = encodeURIComponent) {
|
|
65
|
+
return text.replace(RECORD_TOKEN, (match, path) => {
|
|
59
66
|
const value = leafAt(record, path);
|
|
60
|
-
return value === undefined ? match :
|
|
67
|
+
return value === undefined ? match : encode(String(value));
|
|
61
68
|
});
|
|
62
69
|
}
|
|
70
|
+
const isList = (value) => Array.isArray(value);
|
|
71
|
+
/**
|
|
72
|
+
* The options of a component a target opens with the `{{record.X}}` tokens of
|
|
73
|
+
* every string in them filled in, down their lists and object literals:
|
|
74
|
+
* percent-encoded under a key ending in `url`, or named `to` or `href`, raw
|
|
75
|
+
* under any other. Any other value is left as it is.
|
|
76
|
+
*/
|
|
77
|
+
function fillRecordOptions(node, key, record) {
|
|
78
|
+
if ((0, type_check_1.isString)(node)) {
|
|
79
|
+
const encode = URL_OPTION.test(key) ? encodeURIComponent : keepRaw;
|
|
80
|
+
return fillRecordTokens(node, record, encode);
|
|
81
|
+
}
|
|
82
|
+
if (isList(node)) {
|
|
83
|
+
return node.map((item) => fillRecordOptions(item, key, record));
|
|
84
|
+
}
|
|
85
|
+
if (!(0, type_check_1.isPlainObject)(node))
|
|
86
|
+
return node;
|
|
87
|
+
return Object.fromEntries(Object.entries(node).map(([name, item]) => [
|
|
88
|
+
name,
|
|
89
|
+
fillRecordOptions(item, name, record),
|
|
90
|
+
]));
|
|
91
|
+
}
|
|
92
|
+
function fillRecordComponent(component, record) {
|
|
93
|
+
return {
|
|
94
|
+
...component,
|
|
95
|
+
options: fillRecordOptions(component.options, ROOT_KEY, record),
|
|
96
|
+
children: component.children?.map((child) => ({
|
|
97
|
+
...child,
|
|
98
|
+
component: fillRecordComponent(child.component, record),
|
|
99
|
+
})),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
63
102
|
/**
|
|
64
103
|
* A header button as the page's record leaves it: unchanged when the layout
|
|
65
104
|
* reads no record or the button does not act on it, left out (`undefined`)
|
|
66
105
|
* when the record was not found, the `{{record.X}}` of its target's `url`
|
|
67
|
-
* (and of an `api` target's `redirect`)
|
|
106
|
+
* (and of an `api` target's `redirect`), or of the options of the component a
|
|
107
|
+
* drawer, modal or side panel opens, filled in otherwise.
|
|
68
108
|
*
|
|
69
109
|
* @internal
|
|
70
110
|
*/
|
|
@@ -76,6 +116,10 @@ record) {
|
|
|
76
116
|
if (!record)
|
|
77
117
|
return undefined;
|
|
78
118
|
const { target } = button;
|
|
119
|
+
if (target && "component" in target) {
|
|
120
|
+
const component = fillRecordComponent(target.component, record);
|
|
121
|
+
return { ...button, target: { ...target, component } };
|
|
122
|
+
}
|
|
79
123
|
if (!target || !("url" in target) || !(0, type_check_1.isString)(target.url))
|
|
80
124
|
return button;
|
|
81
125
|
const filled = { ...target, url: fillRecordTokens(target.url, record) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-record.js","sourceRoot":"","sources":["../../../src/page/internal/page-record.ts"],"names":[],"mappings":";;;;AAAA,gEAA6D;AAM7D,
|
|
1
|
+
{"version":3,"file":"page-record.js","sourceRoot":"","sources":["../../../src/page/internal/page-record.ts"],"names":[],"mappings":";;;;AAAA,gEAA6D;AAM7D,g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,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1E,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;IACxE,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3D,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -23,15 +23,11 @@ const isGatedWatch = (value) => (0, type_check_1.isObject)(value) &&
|
|
|
23
23
|
(!("requirePermission" in value) ||
|
|
24
24
|
value.requirePermission === undefined ||
|
|
25
25
|
(0, type_check_1.isString)(value.requirePermission));
|
|
26
|
-
const isPlainObject = (value) => !!value &&
|
|
27
|
-
typeof value === "object" &&
|
|
28
|
-
(Object.getPrototypeOf(value) === Object.prototype ||
|
|
29
|
-
Object.getPrototypeOf(value) === null);
|
|
30
26
|
/** Whether `value` or anything nested in it carries `watchActions`. */
|
|
31
27
|
function holdsWatchActions(value) {
|
|
32
28
|
if (Array.isArray(value))
|
|
33
29
|
return value.some(holdsWatchActions);
|
|
34
|
-
return (isPlainObject(value) &&
|
|
30
|
+
return ((0, type_check_1.isPlainObject)(value) &&
|
|
35
31
|
("watchActions" in value || Object.values(value).some(holdsWatchActions)));
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
@@ -55,7 +51,7 @@ value, permissions) {
|
|
|
55
51
|
const items = await Promise.all(value.map((item) => filterRequiredPermissionWatches(item, permissions)));
|
|
56
52
|
return items.every((item, index) => item === value[index]) ? value : items;
|
|
57
53
|
}
|
|
58
|
-
if (!isPlainObject(value))
|
|
54
|
+
if (!(0, type_check_1.isPlainObject)(value))
|
|
59
55
|
return value;
|
|
60
56
|
const entries = await Promise.all(Object.entries(value).map(async ([key, item]) => [
|
|
61
57
|
key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-filter.js","sourceRoot":"","sources":["../../src/page/layout-filter.ts"],"names":[],"mappings":";;;AAMA,gDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"layout-filter.js","sourceRoot":"","sources":["../../src/page/layout-filter.ts"],"names":[],"mappings":";;;AAMA,gDAA+C;AAC/C,6DAKsC;AAStC,KAAK,UAAU,mBAAmB,CAChC,IAA6B,EAC7B,YAAoB,EACpB,WAAwB,EACxB,YAA8B,EAC9B,OAA+B;IAE/B,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;IAE7B,IAAI,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtD,QAAQ,CAAC,QAAQ,GAAG,MAAM,wBAAwB,CAChD,QAAQ,CAAC,QAAQ,EACjB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,OAAO,CACR,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IAC5D,IAAI,SAAS,EAAE,gBAAgB,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpD,QAAQ,CAAC,OAAO,GAAG,MAAM,SAAS,CAAC,gBAAgB,CACjD,WAAW,EACX,QAAQ,CAAC,OAAO,EAChB,YAAY,EACZ,OAAO,CACR,CAAC;IACJ,CAAC;IAED,IAAI,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,QAAQ,CAAC,OAAO,GAAG,MAAM,+BAA+B,CACtD,QAAQ,CAAC,OAAO,EAChB,WAAW,CACZ,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAID,MAAM,MAAM,GAA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;IAE/B,MAAM,QAAQ,GAA4C,EAAE,CAAC;IAE7D,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,GAAG,QAAQ,IAAI,GAAG,EAAE,CAAC;QAC1C,IAAI,MAAM,IAAA,2BAAa,EAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;YACnD,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,mBAAmB,CACvC,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,OAAO,CACR,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -38,6 +38,13 @@ export declare const isSymbol: (v: unknown) => v is symbol;
|
|
|
38
38
|
export declare const isPrimitive: (value: unknown) => value is PrimitiveValue;
|
|
39
39
|
/** @internal */
|
|
40
40
|
export declare const isNull: (value: unknown) => value is null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether `value` is an object literal (its prototype `Object.prototype` or
|
|
43
|
+
* `null`), not an array, a date or a class instance.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
41
48
|
/** @internal */
|
|
42
49
|
export declare const isDate: (value: unknown) => value is Date;
|
|
43
50
|
/** @internal */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isJSON = exports.isDate = exports.isNull = exports.isPrimitive = exports.isSymbol = exports.isBigint = exports.isClass = exports.isFunction = exports.isObject = exports.isUndefined = exports.isBoolean = exports.isNumber = exports.isString = void 0;
|
|
3
|
+
exports.isJSON = exports.isDate = exports.isPlainObject = exports.isNull = exports.isPrimitive = exports.isSymbol = exports.isBigint = exports.isClass = exports.isFunction = exports.isObject = exports.isUndefined = exports.isBoolean = exports.isNumber = exports.isString = void 0;
|
|
4
4
|
const primitiveTypes = [
|
|
5
5
|
"string",
|
|
6
6
|
"number",
|
|
@@ -48,6 +48,17 @@ exports.isPrimitive = isPrimitive;
|
|
|
48
48
|
/** @internal */
|
|
49
49
|
const isNull = (value) => value === null;
|
|
50
50
|
exports.isNull = isNull;
|
|
51
|
+
/**
|
|
52
|
+
* Whether `value` is an object literal (its prototype `Object.prototype` or
|
|
53
|
+
* `null`), not an array, a date or a class instance.
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
const isPlainObject = (value) => !!value &&
|
|
58
|
+
typeof value === "object" &&
|
|
59
|
+
(Object.getPrototypeOf(value) === Object.prototype ||
|
|
60
|
+
Object.getPrototypeOf(value) === null);
|
|
61
|
+
exports.isPlainObject = isPlainObject;
|
|
51
62
|
/** @internal */
|
|
52
63
|
const isDate = (value) => value instanceof Date && !Number.isNaN(value.getTime());
|
|
53
64
|
exports.isDate = isDate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-check.js","sourceRoot":"","sources":["../../../src/utils/internal/type-check.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;CACA,CAAC;AA6BX,MAAM,eAAe,GACnB,CAAI,IAAkB,EAAE,EAAE,CAC1B,CAAC,CAAU,EAAU,EAAE,CACrB,OAAO,CAAC,KAAK,IAAI,CAAC;AAEtB,gBAAgB;AACH,QAAA,QAAQ,GAAG,eAAe,CAAS,QAAQ,CAAC,CAAC;AAC1D,gBAAgB;AACH,QAAA,QAAQ,GAAG,eAAe,CAAS,QAAQ,CAAC,CAAC;AAC1D,gBAAgB;AACH,QAAA,SAAS,GAAG,eAAe,CAAU,SAAS,CAAC,CAAC;AAC7D,gBAAgB;AACH,QAAA,WAAW,GAAG,eAAe,CAAY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,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,IAAA,QAAA,QAAQ,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,QAAA,MAAM,EAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,MAAM,GAAN,MAAM,CAUjB"}
|
|
@@ -100,7 +100,7 @@ DefaultLayout({
|
|
|
100
100
|
|
|
101
101
|
#### Buttons that follow the page URL
|
|
102
102
|
|
|
103
|
-
A page scoped by its URL, such as `?workspace=web` or a record id in the path, declares its buttons once and lets them follow the URL. A target's URL (`page`, `external`, `download`, `api`, `exportJob`) takes the tokens of a block's `fetchUrl`: `{{params.X}}` is filled with the route parameter `X` of the page, `{{query.X}}` with its query parameter `X`, percent-encoded, again whenever the URL changes. A query pair whose value is a token the page has no value for is left out (`?workspace={{query.workspace}}` on a page without `?workspace=` leads to the target's default), and any other token without a value is left empty. A `download` target's `filename` takes the same tokens, written as they are; while one has no value, the file is saved under the server's name:
|
|
103
|
+
A page scoped by its URL, such as `?workspace=web` or a record id in the path, declares its buttons once and lets them follow the URL. A target's URL (`page`, `external`, `download`, `api`, `exportJob`) takes the tokens of a block's `fetchUrl`: `{{params.X}}` is filled with the route parameter `X` of the page, `{{query.X}}` with its query parameter `X`, percent-encoded, again whenever the URL changes. A query pair whose value is a token the page has no value for is left out (`?workspace={{query.workspace}}` on a page without `?workspace=` leads to the target's default), and any other token without a value is left empty. A `download` target's `filename` takes the same tokens, written as they are; while one has no value, the file is saved under the server's name. The block a `drawer`, `modal` or `sidePanel` target opens receives the page's route parameters as every block of the page does, so its own `fetchUrl: "/api/sites/{{params.id}}"` is filled the same way:
|
|
104
104
|
|
|
105
105
|
```ts fragment
|
|
106
106
|
{
|
|
@@ -145,7 +145,7 @@ Who sees a button is settled on the server when the layout is served: a button w
|
|
|
145
145
|
|
|
146
146
|
#### Buttons acting on the page's record
|
|
147
147
|
|
|
148
|
-
A page about one record (a site, an invoice) reads it with its layout: `record` is a function the server calls each time it serves the layout, with the request's context (the page URL's `params` and `query`, the `user` and the `tenantId`), and answers the record, or `undefined` when there is none to show. A button's target names its fields as `{{record.X}}`, filled in by the server and percent-encoded: a maps link to the site's address, an API call on its own id. A button acting on the record, one whose target names `{{record.X}}` or declaring `requiresRecord: true` (an "Edit" link that only needs `{{params.id}}`), is left out of a page whose record was not found, or whose `record` threw (logged). Every `availability` of the page reads the record as `context.record`, so a button can be disabled on the record's state without reading it again:
|
|
148
|
+
A page about one record (a site, an invoice) reads it with its layout: `record` is a function the server calls each time it serves the layout, with the request's context (the page URL's `params` and `query`, the `user` and the `tenantId`), and answers the record, or `undefined` when there is none to show. A button's target names its fields as `{{record.X}}`, filled in by the server and percent-encoded: a maps link to the site's address, an API call on its own id. A `drawer`, `modal` or `sidePanel` target takes them in the options of its component and of the blocks inside it (`fetchUrl: "/api/sites/{{record._id}}"`, `submitDefaults: { name: "{{record.name}}" }`): a string under a URL option (a key ending in `url`, or named `to` or `href`) has each field percent-encoded, any other string takes it as written. A token names a field holding a string or a number; any other is left as written. A button acting on the record, one whose target names `{{record.X}}` or declaring `requiresRecord: true` (an "Edit" link that only needs `{{params.id}}`), is left out of a page whose record was not found, or whose `record` threw (logged). Every `availability` of the page reads the record as `context.record`, so a button can be disabled on the record's state without reading it again:
|
|
149
149
|
|
|
150
150
|
```typescript
|
|
151
151
|
import { BasicDataModel, Field, GetModel, RegisterTable, Table } from "@antelopejs/interface-database-decorators";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-dms",
|
|
3
|
-
"version": "0.14.7-next.
|
|
3
|
+
"version": "0.14.7-next.1008.g198383f",
|
|
4
4
|
"description": "Public AntelopeJS interfaces of the DMS: pages, components, permissions, tenancy, auth, notifications and HTML rendering.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"provenance": true,
|
|
133
133
|
"registry": "https://registry.npmjs.org/"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "198383faab2618890a103ed9a058f69b9aff9609",
|
|
136
136
|
"scripts": {
|
|
137
137
|
"build": "rimraf dist && antelopejs-tsc",
|
|
138
138
|
"typecheck": "antelopejs-tsc --noEmit",
|