@protobase/schema 0.53.2 → 0.53.4
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/model.d.ts +2 -0
- package/dist/view-field.d.ts +6 -0
- package/dist/view-field.js +9 -0
- package/package.json +1 -1
package/dist/model.d.ts
CHANGED
|
@@ -299,6 +299,8 @@ export type FieldViewModel = {
|
|
|
299
299
|
helpWhen?: HelpWhen;
|
|
300
300
|
/** When the field shows on the record page: always, the default, only on its form or only on its read view. */
|
|
301
301
|
when?: ShowWhen;
|
|
302
|
+
/** The question a form or a list cell asks before the field's value first changes; cancelling keeps the value. */
|
|
303
|
+
confirm?: string;
|
|
302
304
|
/** How the value is shown. */
|
|
303
305
|
format?: FieldFormat;
|
|
304
306
|
/** A text that runs over several lines: forms edit it in a box that grows with it, and its line breaks show. */
|
package/dist/view-field.d.ts
CHANGED
|
@@ -26,6 +26,12 @@ export declare class FieldView<N extends string = string, V = unknown> {
|
|
|
26
26
|
* view and locked form; `always` when omitted. Its lists, cards and filters show it either way.
|
|
27
27
|
*/
|
|
28
28
|
when(when: ShowWhen): FieldView<N, V>;
|
|
29
|
+
/**
|
|
30
|
+
* Asks `question` before a person changes the value in a form or a list cell, such as a flag that is easy to set by
|
|
31
|
+
* mistake: once as the value first moves away from the saved one, not on every key. Cancelling keeps the value. See
|
|
32
|
+
* [Confirming a change](website/src/content/docs/reference/ui-config.mdx#confirming-a-change).
|
|
33
|
+
*/
|
|
34
|
+
confirm(question: string): FieldView<N, V>;
|
|
29
35
|
/**
|
|
30
36
|
* How the value shows: `badge` for statuses, `code` in monospace, `percent` with a % sign; for a text field, `email`,
|
|
31
37
|
* `phone` and `url` as a mail, call or open link, edited with an email, phone or address keyboard on a mobile screen.
|
package/dist/view-field.js
CHANGED
|
@@ -31,6 +31,15 @@ var FieldView = class FieldView {
|
|
|
31
31
|
return this.with({ when });
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
+
* Asks `question` before a person changes the value in a form or a list cell, such as a flag that is easy to set by
|
|
35
|
+
* mistake: once as the value first moves away from the saved one, not on every key. Cancelling keeps the value. See
|
|
36
|
+
* [Confirming a change](website/src/content/docs/reference/ui-config.mdx#confirming-a-change).
|
|
37
|
+
*/
|
|
38
|
+
confirm(question) {
|
|
39
|
+
if (question.trim() === "") throw new Error(`Field "${this.name}": .confirm() needs the question to ask`);
|
|
40
|
+
return this.with({ confirm: question });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
34
43
|
* How the value shows: `badge` for statuses, `code` in monospace, `percent` with a % sign; for a text field, `email`,
|
|
35
44
|
* `phone` and `url` as a mail, call or open link, edited with an email, phone or address keyboard on a mobile screen.
|
|
36
45
|
*/
|