@antelopejs/interface-dms 0.14.3 → 0.14.4-next.965.g218ae9d
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/base/data-types/default/choices.d.ts +4 -1
- package/dist/base/data-types/default/choices.js +8 -3
- package/dist/base/data-types/default/choices.js.map +1 -1
- package/dist/base/data-types/default/inputs.d.ts +4 -1
- package/dist/base/data-types/default/inputs.js +5 -4
- package/dist/base/data-types/default/inputs.js.map +1 -1
- package/dist/base/data-types/default/options.d.ts +22 -0
- package/dist/base/empty-state.d.ts +1 -1
- package/dist/base/guard.d.ts +4 -4
- package/dist/base/internal/column-badges.d.ts +44 -0
- package/dist/base/internal/column-badges.js +86 -0
- package/dist/base/internal/column-badges.js.map +1 -0
- package/dist/base/internal/column-references.d.ts +67 -0
- package/dist/base/internal/column-references.js +87 -0
- package/dist/base/internal/column-references.js.map +1 -0
- package/dist/base/key-value-list.d.ts +5 -5
- package/dist/base/meter.d.ts +1 -1
- package/dist/base/table-view/data-functions.d.ts +9 -1
- package/dist/base/table-view/data-functions.js +9 -1
- package/dist/base/table-view/data-functions.js.map +1 -1
- package/dist/base/table-view/factory.js +4 -4
- package/dist/base/table-view/factory.js.map +1 -1
- package/dist/base/table-view/internal/column-values.d.ts +49 -0
- package/dist/base/table-view/internal/column-values.js +182 -0
- package/dist/base/table-view/internal/column-values.js.map +1 -0
- package/dist/base/table-view/internal/data-functions.d.ts +19 -0
- package/dist/base/table-view/internal/data-functions.js +8 -0
- package/dist/base/table-view/internal/data-functions.js.map +1 -1
- package/dist/base/table-view/internal/factory-lifecycle-filter.d.ts +3 -0
- package/dist/base/table-view/internal/factory-lifecycle-filter.js +6 -2
- package/dist/base/table-view/internal/factory-lifecycle-filter.js.map +1 -1
- package/dist/base/table-view/internal/factory-lifecycle-options.d.ts +19 -2
- package/dist/base/table-view/internal/factory-lifecycle-options.js +19 -2
- package/dist/base/table-view/internal/factory-lifecycle-options.js.map +1 -1
- package/dist/base/table-view/internal/option-contract.d.ts +12 -1
- package/dist/base/table-view/internal/tabs.d.ts +1 -1
- package/dist/base/table-view/internal/tabs.js +1 -0
- package/dist/base/table-view/internal/tabs.js.map +1 -1
- package/dist/base/table-view/internal/validation.d.ts +7 -0
- package/dist/base/table-view/internal/validation.js +20 -0
- package/dist/base/table-view/internal/validation.js.map +1 -1
- package/dist/base/table-view.d.ts +1 -1
- package/dist/base/table-view.js +2 -1
- package/dist/base/table-view.js.map +1 -1
- package/dist/component-options/confirm-dialog.d.ts +4 -1
- package/dist/component-options/confirm-dialog.js.map +1 -1
- package/dist/page/internal/layout-request.d.ts +14 -0
- package/dist/page/internal/layout-request.js +25 -0
- package/dist/page/internal/layout-request.js.map +1 -0
- package/dist/page/internal/metadata-layout.js +3 -2
- package/dist/page/internal/metadata-layout.js.map +1 -1
- package/dist/page/internal/metadata-publish.js +2 -0
- package/dist/page/internal/metadata-publish.js.map +1 -1
- package/dist/page/internal/page-registration.d.ts +3 -0
- package/dist/page/internal/page-registration.js.map +1 -1
- package/docs/3.base/2.types.md +1 -1
- package/package.json +2 -2
|
@@ -47,13 +47,16 @@ export declare class SelectType extends DataType {
|
|
|
47
47
|
filterComponents(): {
|
|
48
48
|
default: import("../../..").ComponentInfoSerialized<{
|
|
49
49
|
items: FormComponents.SelectOption[];
|
|
50
|
+
itemsFrom?: {
|
|
51
|
+
column: string;
|
|
52
|
+
};
|
|
50
53
|
placeholder?: string;
|
|
51
54
|
multiple?: boolean;
|
|
52
55
|
deselectable?: boolean;
|
|
53
56
|
fallback?: string;
|
|
54
57
|
}>;
|
|
55
58
|
};
|
|
56
|
-
getValidation(): z.ZodNever | z.ZodEnum<[string, ...string[]]> | z.ZodArray<z.ZodNever | z.ZodEnum<[string, ...string[]]
|
|
59
|
+
getValidation(): z.ZodNever | z.ZodEnum<[string, ...string[]]> | z.ZodArray<z.ZodNever | z.ZodEnum<[string, ...string[]]>> | z.ZodString | z.ZodArray<z.ZodString>;
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
59
62
|
* The `price` data type.
|
|
@@ -17,6 +17,7 @@ const core_1 = require("../core");
|
|
|
17
17
|
const compare_types_1 = require("../compare-types");
|
|
18
18
|
const inputs_1 = require("./inputs");
|
|
19
19
|
const numbers_1 = require("./numbers");
|
|
20
|
+
const column_references_1 = require("../../internal/column-references");
|
|
20
21
|
/**
|
|
21
22
|
* The `boolean` data type.
|
|
22
23
|
*
|
|
@@ -95,6 +96,9 @@ let SelectType = class SelectType extends core_1.DataType {
|
|
|
95
96
|
return { default: form_schema_1.FormComponents.InputSelect(options) };
|
|
96
97
|
}
|
|
97
98
|
getValidation() {
|
|
99
|
+
if (this.options.itemsFrom) {
|
|
100
|
+
return this.options.multiple ? zod_1.z.array(zod_1.z.string()) : zod_1.z.string();
|
|
101
|
+
}
|
|
98
102
|
const [first, ...rest] = this.options.items.map((item) => String(item.value));
|
|
99
103
|
const value = first === undefined ? zod_1.z.never() : zod_1.z.enum([first, ...rest]);
|
|
100
104
|
return this.options.multiple ? zod_1.z.array(value) : value;
|
|
@@ -119,15 +123,16 @@ let PriceType = class PriceType extends numbers_1.NumberType {
|
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
defaultInputComponent() {
|
|
122
|
-
|
|
126
|
+
const { currency, currencyFrom } = this.options;
|
|
127
|
+
return form_schema_1.FormComponents.InputNumber((0, column_references_1.withColumnReference)({
|
|
123
128
|
min: this.options.min,
|
|
124
129
|
max: this.options.max,
|
|
125
130
|
step: this.options.step,
|
|
126
131
|
placeholder: this.options.placeholder,
|
|
127
132
|
suffix: this.options.suffix,
|
|
128
133
|
width: this.options.width,
|
|
129
|
-
...(
|
|
130
|
-
});
|
|
134
|
+
...(currency && { currency }),
|
|
135
|
+
}, column_references_1.CURRENCY_FROM_KEY, currency ? undefined : currencyFrom));
|
|
131
136
|
}
|
|
132
137
|
};
|
|
133
138
|
exports.PriceType = PriceType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../../../../src/base/data-types/default/choices.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAkE;AAClE,6BAAwB;AACxB,mDAAmD;AACnD,kCAAqD;AACrD,oDAA2D;AAO3D,qCAA+E;AAC/E,uCAAuC;
|
|
1
|
+
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../../../../src/base/data-types/default/choices.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAkE;AAClE,6BAAwB;AACxB,mDAAmD;AACnD,kCAAqD;AACrD,oDAA2D;AAO3D,qCAA+E;AAC/E,uCAAuC;AACvC,wEAG0C;AAE1C;;;;GAIG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,eAAQ;IACX;IAA5B,YAA4B,UAA8B,EAAE;QAC1D,KAAK,CACH;YACE,uCAAuB,CAAC,EAAE;YAC1B,uCAAuB,CAAC,KAAK;YAC7B,uCAAuB,CAAC,OAAO;YAC/B,uCAAuB,CAAC,UAAU;SACnC,EACD,uCAAuB,CAAC,EAAE,EAC1B,OAAO,CACR,CAAC;QAVwB,YAAO,GAAP,OAAO,CAAyB;IAW5D,CAAC;IAES,qBAAqB;QAC7B,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACtE,OAAO,uBAAc,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/D,CAAC;IAEQ,gBAAgB;QACvB,MAAM,aAAa,GAAG,4BAAc,CAAC,WAAW,CAAC;YAC/C,KAAK,EAAE;gBACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,mCAAmC,EAAE;gBAC7D,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;aACjE;SACF,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,a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AI,CAAC,CAAC,GAAG,GAAG;YAClC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;YACrC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;SAC1B,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,uBAAgB,EAAC,YAAY,CAAC;;GAClB,cAAc,CAmB1B"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/** Stable built-in input adapters. @packageDocumentation */
|
|
2
2
|
import type { ComponentInfoSerialized } from "../../../component";
|
|
3
3
|
import { FormComponents } from "../../form-schema";
|
|
4
|
+
import { type ColumnReference } from "../../internal/column-references";
|
|
4
5
|
export type SelectDisplay = (typeof import("../default-types").SELECT_DISPLAYS)[number];
|
|
5
6
|
export type BooleanDisplay = (typeof import("../default-types").BOOLEAN_DISPLAYS)[number];
|
|
6
7
|
export declare const SINGLE_PICK_DISPLAYS: Set<"dropdown" | "cards" | "segmented" | "radio">;
|
|
7
|
-
type SelectInputOptions = FormComponents.SelectOptions & Pick<FormComponents.ChoiceCardsOptions, "columns"
|
|
8
|
+
type SelectInputOptions = FormComponents.SelectOptions & Pick<FormComponents.ChoiceCardsOptions, "columns"> & {
|
|
9
|
+
itemsFrom?: ColumnReference;
|
|
10
|
+
};
|
|
8
11
|
export declare const SELECT_INPUTS: Record<SelectDisplay, (options: SelectInputOptions) => ComponentInfoSerialized>;
|
|
9
12
|
type BooleanInputOptions = FormComponents.BooleanCardOptions;
|
|
10
13
|
export declare const BOOLEAN_INPUTS: Record<BooleanDisplay, (options: BooleanInputOptions) => ComponentInfoSerialized>;
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BOOLEAN_INPUTS = exports.SELECT_INPUTS = exports.SINGLE_PICK_DISPLAYS = void 0;
|
|
4
4
|
const form_schema_1 = require("../../form-schema");
|
|
5
|
+
const column_references_1 = require("../../internal/column-references");
|
|
5
6
|
exports.SINGLE_PICK_DISPLAYS = new Set([
|
|
6
7
|
"segmented",
|
|
7
8
|
"radio",
|
|
8
9
|
]);
|
|
9
|
-
function choiceCardsOptions({ items, multiple, columns, }) {
|
|
10
|
+
function choiceCardsOptions({ items, multiple, columns, itemsFrom, }) {
|
|
10
11
|
const options = { items, multiple };
|
|
11
12
|
if (columns !== undefined)
|
|
12
13
|
options.columns = columns;
|
|
13
|
-
return options;
|
|
14
|
+
return (0, column_references_1.withColumnReference)(options, column_references_1.ITEMS_FROM_KEY, itemsFrom);
|
|
14
15
|
}
|
|
15
16
|
exports.SELECT_INPUTS = {
|
|
16
17
|
dropdown: ({ columns: _columns, ...options }) => form_schema_1.FormComponents.InputSelect(options),
|
|
17
18
|
cards: (options) => form_schema_1.FormComponents.InputChoiceCards(choiceCardsOptions(options)),
|
|
18
|
-
segmented: ({ items }) => form_schema_1.FormComponents.InputSegmentedSelect({ items }),
|
|
19
|
-
radio: ({ items }) => form_schema_1.FormComponents.InputRadioGroup({ items }),
|
|
19
|
+
segmented: ({ items, itemsFrom }) => form_schema_1.FormComponents.InputSegmentedSelect((0, column_references_1.withColumnReference)({ items }, column_references_1.ITEMS_FROM_KEY, itemsFrom)),
|
|
20
|
+
radio: ({ items, itemsFrom }) => form_schema_1.FormComponents.InputRadioGroup((0, column_references_1.withColumnReference)({ items }, column_references_1.ITEMS_FROM_KEY, itemsFrom)),
|
|
20
21
|
};
|
|
21
22
|
exports.BOOLEAN_INPUTS = {
|
|
22
23
|
switch: ({ label, description }) => form_schema_1.FormComponents.InputSwitch({ label, description }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../src/base/data-types/default/inputs.ts"],"names":[],"mappings":";;;AAEA,mDAAmD;
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../src/base/data-types/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IACpD,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CACnC,4BAAc,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACtD,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,4BAAc,CAAC,gBAAgB,CAAC,OAAO,CAAC;CAC5D,CAAC"}
|
|
@@ -27,6 +27,16 @@ export type PriceTypeOptions = NumberTypeOptions & {
|
|
|
27
27
|
* are written in euros.
|
|
28
28
|
*/
|
|
29
29
|
currency?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Reads the currency from the rows instead of stating it: the one ISO 4217
|
|
32
|
+
* code that `column`, a column of the table the field belongs to, holds in
|
|
33
|
+
* every row the caller may list, read when a table view serves the page.
|
|
34
|
+
* Amounts are written in euros when the column holds several codes, none,
|
|
35
|
+
* or cannot be read. `currency` wins when both are given.
|
|
36
|
+
*/
|
|
37
|
+
currencyFrom?: {
|
|
38
|
+
column: string;
|
|
39
|
+
};
|
|
30
40
|
};
|
|
31
41
|
export type StringTypeOptions = {
|
|
32
42
|
placeholder?: string;
|
|
@@ -81,6 +91,18 @@ export type BooleanTypeOptions = {
|
|
|
81
91
|
};
|
|
82
92
|
export type SelectTypeOptions = {
|
|
83
93
|
items: FormComponents.SelectOption[];
|
|
94
|
+
/**
|
|
95
|
+
* Reads the options from the rows instead of listing them in `items`
|
|
96
|
+
* (left `[]`): the values `column`, a column of the table the field
|
|
97
|
+
* belongs to, holds in the rows the caller may list, read when a table view
|
|
98
|
+
* serves the page, each labelled and drawn in a tone by the DMS's status
|
|
99
|
+
* rules. A column holding more than 25 values, or that cannot be read,
|
|
100
|
+
* shows its values plain, and so does a `multiple` column whose rows hold
|
|
101
|
+
* more than 1,000 distinct lists. Any text is a valid value.
|
|
102
|
+
*/
|
|
103
|
+
itemsFrom?: {
|
|
104
|
+
column: string;
|
|
105
|
+
};
|
|
84
106
|
placeholder?: string;
|
|
85
107
|
multiple?: boolean;
|
|
86
108
|
deselectable?: boolean;
|
|
@@ -130,8 +130,8 @@ export declare const EmptyStateSchema: z.ZodObject<{
|
|
|
130
130
|
} | undefined;
|
|
131
131
|
size?: "sm" | "md" | "lg" | undefined;
|
|
132
132
|
variant?: "error" | "no-data" | "no-result" | "no-access" | undefined;
|
|
133
|
-
card?: boolean | undefined;
|
|
134
133
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
134
|
+
card?: boolean | undefined;
|
|
135
135
|
actions?: {
|
|
136
136
|
label: string;
|
|
137
137
|
to: string;
|
package/dist/base/guard.d.ts
CHANGED
|
@@ -106,8 +106,8 @@ export declare const GuardSchema: z.ZodObject<{
|
|
|
106
106
|
} | undefined;
|
|
107
107
|
size?: "sm" | "md" | "lg" | undefined;
|
|
108
108
|
variant?: "error" | "no-data" | "no-result" | "no-access" | undefined;
|
|
109
|
-
card?: boolean | undefined;
|
|
110
109
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
110
|
+
card?: boolean | undefined;
|
|
111
111
|
actions?: {
|
|
112
112
|
label: string;
|
|
113
113
|
to: string;
|
|
@@ -127,8 +127,8 @@ export declare const GuardSchema: z.ZodObject<{
|
|
|
127
127
|
} | undefined;
|
|
128
128
|
size?: "sm" | "md" | "lg" | undefined;
|
|
129
129
|
variant?: "error" | "no-data" | "no-result" | "no-access" | undefined;
|
|
130
|
-
card?: boolean | undefined;
|
|
131
130
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
131
|
+
card?: boolean | undefined;
|
|
132
132
|
actions?: {
|
|
133
133
|
label: string;
|
|
134
134
|
to: string;
|
|
@@ -153,8 +153,8 @@ export declare const GuardSchema: z.ZodObject<{
|
|
|
153
153
|
} | undefined;
|
|
154
154
|
size?: "sm" | "md" | "lg" | undefined;
|
|
155
155
|
variant?: "error" | "no-data" | "no-result" | "no-access" | undefined;
|
|
156
|
-
card?: boolean | undefined;
|
|
157
156
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
157
|
+
card?: boolean | undefined;
|
|
158
158
|
actions?: {
|
|
159
159
|
label: string;
|
|
160
160
|
to: string;
|
|
@@ -181,8 +181,8 @@ export declare const GuardSchema: z.ZodObject<{
|
|
|
181
181
|
} | undefined;
|
|
182
182
|
size?: "sm" | "md" | "lg" | undefined;
|
|
183
183
|
variant?: "error" | "no-data" | "no-result" | "no-access" | undefined;
|
|
184
|
-
card?: boolean | undefined;
|
|
185
184
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
185
|
+
card?: boolean | undefined;
|
|
186
186
|
actions?: {
|
|
187
187
|
label: string;
|
|
188
188
|
to: string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** @internal @packageDocumentation */
|
|
2
|
+
import type { Tone } from "../../tones";
|
|
3
|
+
/**
|
|
4
|
+
* One value of a column drawn as a status pill: the value the rows hold, its
|
|
5
|
+
* label and the tone it is drawn in.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface ColumnBadge {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
tone: Tone;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A tab above a table over one value of a badge column, or the "all" tab
|
|
16
|
+
* before them.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export interface ColumnBadgeTab {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
filter?: {
|
|
24
|
+
accessorKey: string;
|
|
25
|
+
value: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
};
|
|
28
|
+
textColor?: Tone;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The badges of a column's values, in the order given: a value named like a
|
|
32
|
+
* state (`paid`, `pending`, `failed`, `new`) takes that state's tone, the
|
|
33
|
+
* others the next tone of the cycle.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function badgeItems(values: readonly string[]): ColumnBadge[];
|
|
38
|
+
/**
|
|
39
|
+
* "All", then a tab per badge of `column` in its order, filtering the rows
|
|
40
|
+
* that hold its value and drawn in its tone.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function badgeTabs(column: string, badges: readonly ColumnBadge[]): ColumnBadgeTab[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.badgeItems = badgeItems;
|
|
4
|
+
exports.badgeTabs = badgeTabs;
|
|
5
|
+
/** The value words a status is toned by; a word in none of these takes the next tone of the cycle. */
|
|
6
|
+
const TONE_WORDS = [
|
|
7
|
+
[
|
|
8
|
+
"success",
|
|
9
|
+
["paid", "active", "done", "completed", "shipped", "delivered", "approved"],
|
|
10
|
+
],
|
|
11
|
+
["warning", ["pending", "draft", "processing", "waiting", "review"]],
|
|
12
|
+
[
|
|
13
|
+
"error",
|
|
14
|
+
[
|
|
15
|
+
"failed",
|
|
16
|
+
"cancelled",
|
|
17
|
+
"canceled",
|
|
18
|
+
"refunded",
|
|
19
|
+
"rejected",
|
|
20
|
+
"error",
|
|
21
|
+
"blocked",
|
|
22
|
+
],
|
|
23
|
+
],
|
|
24
|
+
["info", ["new", "open"]],
|
|
25
|
+
];
|
|
26
|
+
const TONE_OF_WORD = new Map(TONE_WORDS.flatMap(([tone, list]) => list.map((word) => [word, tone])));
|
|
27
|
+
/** The tones the values no word tones take in turn, in the order the values are given. */
|
|
28
|
+
const TONE_CYCLE = ["primary", "secondary", "info", "neutral"];
|
|
29
|
+
/** A code such as a country or currency code (`NL`, `EUR`), which reads as written, not humanized. */
|
|
30
|
+
const CODE_VALUE = /^[A-Z][A-Z0-9_-]*$/;
|
|
31
|
+
const ALL_TAB_ID = "all";
|
|
32
|
+
const IS_MODE = "is";
|
|
33
|
+
function words(value) {
|
|
34
|
+
return value
|
|
35
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
36
|
+
.split(/[^A-Za-z0-9]+/)
|
|
37
|
+
.filter((part) => part.length > 0)
|
|
38
|
+
.map((part) => part.toLowerCase());
|
|
39
|
+
}
|
|
40
|
+
function humanized(value) {
|
|
41
|
+
const spaced = words(value).join(" ");
|
|
42
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
43
|
+
}
|
|
44
|
+
function badgeLabel(value) {
|
|
45
|
+
return CODE_VALUE.test(value) ? value : humanized(value) || value;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The badges of a column's values, in the order given: a value named like a
|
|
49
|
+
* state (`paid`, `pending`, `failed`, `new`) takes that state's tone, the
|
|
50
|
+
* others the next tone of the cycle.
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
function badgeItems(values) {
|
|
55
|
+
let cycled = 0;
|
|
56
|
+
return values.map((value) => {
|
|
57
|
+
const known = TONE_OF_WORD.get(value.trim().toLowerCase());
|
|
58
|
+
const tone = known ?? TONE_CYCLE[cycled++ % TONE_CYCLE.length];
|
|
59
|
+
return { value, label: badgeLabel(value), tone };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function tabId(column, value) {
|
|
63
|
+
return [...words(column), ...words(value)].join("-");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* "All", then a tab per badge of `column` in its order, filtering the rows
|
|
67
|
+
* that hold its value and drawn in its tone.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function badgeTabs(column, badges) {
|
|
72
|
+
const taken = new Set([ALL_TAB_ID]);
|
|
73
|
+
const tabs = badges.map((badge, index) => {
|
|
74
|
+
const id = tabId(column, badge.value);
|
|
75
|
+
const unique = taken.has(id) ? `${id}-${index}` : id;
|
|
76
|
+
taken.add(unique);
|
|
77
|
+
return {
|
|
78
|
+
id: unique,
|
|
79
|
+
label: badge.label,
|
|
80
|
+
filter: { accessorKey: column, value: badge.value, mode: IS_MODE },
|
|
81
|
+
textColor: badge.tone,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
return [{ id: ALL_TAB_ID, label: "All" }, ...tabs];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=column-badges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-badges.js","sourceRoot":"","sources":["../../../src/base/internal/column-badges.ts"],"names":[],"mappings":";;AAyFA,gCAOC;AAYD,8BAiBC;AAjGD,sGAAsG;AACtG,MAAM,UAAU,GAAoD;IAClE;QACE,SAAS;QACT,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC;KAC5E;IACD,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpE;QACE,OAAO;QACP;YACE,QAAQ;YACR,WAAW;YACX,UAAU;YACV,UAAU;YACV,UAAU;YACV,OAAO;YACP,SAAS;SACV;KACF;IACD,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAClC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACjD,CACF,CAAC;AAEF,0FAA0F;AAC1F,MAAM,UAAU,GAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAEhF,sGAAsG;AACtG,MAAM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AAE,IAAI,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,KAAK,CAAC,MAAc,EAAE,KAAa;IAC1C,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CACvB,MAAc,EACd,MAA8B;IAE9B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO;YACL,EAAE,EAAE,MAAM;YACV,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;YAClE,SAAS,EAAE,KAAK,CAAC,IAAI;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A column of the table a field or a table view reads, whose values the DMS
|
|
3
|
+
* reads from the rows when a table view serves the page.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface ColumnReference {
|
|
8
|
+
column: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The option a select's input carries the column its `items` are read from under.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const ITEMS_FROM_KEY = "itemsFrom";
|
|
16
|
+
/**
|
|
17
|
+
* The option a price's input carries the column its `currency` is read from under.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const CURRENCY_FROM_KEY = "currencyFrom";
|
|
22
|
+
type ColumnReferenceKey = typeof ITEMS_FROM_KEY | typeof CURRENCY_FROM_KEY;
|
|
23
|
+
/**
|
|
24
|
+
* The text values a request read from each column it references, sorted. A
|
|
25
|
+
* column that could not be read, or holds more values than a badge draws, is
|
|
26
|
+
* absent.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export type ReadColumnValues = ReadonlyMap<string, readonly string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The options of a serialized input that read its items or its currency
|
|
33
|
+
* from a column.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export interface ReferencingOptions {
|
|
38
|
+
[ITEMS_FROM_KEY]?: ColumnReference;
|
|
39
|
+
[CURRENCY_FROM_KEY]?: ColumnReference;
|
|
40
|
+
items?: unknown;
|
|
41
|
+
currency?: unknown;
|
|
42
|
+
}
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare function isReferencingOptions(value: unknown): value is ReferencingOptions;
|
|
45
|
+
/**
|
|
46
|
+
* `options` carrying `reference` under `key`, for the table view that serves
|
|
47
|
+
* the input to read; `options` itself without a reference.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function withColumnReference<T extends object>(options: T, key: ColumnReferenceKey, reference: ColumnReference | undefined): T;
|
|
52
|
+
/**
|
|
53
|
+
* The columns an input reads its items or its currency from.
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export declare function referencedColumns(options: ReferencingOptions): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Fills an input that reads from a column, in place: a select's `items`
|
|
60
|
+
* from the badges of its column's values, a price's `currency` from the one
|
|
61
|
+
* ISO 4217 code its column holds. An input whose column `read` lacks keeps
|
|
62
|
+
* its own. Its references are cleared either way, so no client reads one.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare function fillReferencingOptions(options: ReferencingOptions, read: ReadColumnValues | undefined): void;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CURRENCY_FROM_KEY = exports.ITEMS_FROM_KEY = void 0;
|
|
4
|
+
exports.isReferencingOptions = isReferencingOptions;
|
|
5
|
+
exports.withColumnReference = withColumnReference;
|
|
6
|
+
exports.referencedColumns = referencedColumns;
|
|
7
|
+
exports.fillReferencingOptions = fillReferencingOptions;
|
|
8
|
+
/** @internal @packageDocumentation */
|
|
9
|
+
const type_check_1 = require("../../utils/internal/type-check");
|
|
10
|
+
const column_badges_1 = require("./column-badges");
|
|
11
|
+
/**
|
|
12
|
+
* The option a select's input carries the column its `items` are read from under.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
exports.ITEMS_FROM_KEY = "itemsFrom";
|
|
17
|
+
/**
|
|
18
|
+
* The option a price's input carries the column its `currency` is read from under.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
exports.CURRENCY_FROM_KEY = "currencyFrom";
|
|
23
|
+
const KNOWN_CURRENCIES = new Set(Intl.supportedValuesOf("currency"));
|
|
24
|
+
function isColumnReference(value) {
|
|
25
|
+
return ((0, type_check_1.isObject)(value) &&
|
|
26
|
+
!(0, type_check_1.isNull)(value) &&
|
|
27
|
+
"column" in value &&
|
|
28
|
+
(0, type_check_1.isString)(value.column));
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
function isReferencingOptions(value) {
|
|
32
|
+
if (!(0, type_check_1.isObject)(value) || (0, type_check_1.isNull)(value))
|
|
33
|
+
return false;
|
|
34
|
+
const itemsFrom = exports.ITEMS_FROM_KEY in value ? value[exports.ITEMS_FROM_KEY] : undefined;
|
|
35
|
+
const currencyFrom = exports.CURRENCY_FROM_KEY in value ? value[exports.CURRENCY_FROM_KEY] : undefined;
|
|
36
|
+
return ((itemsFrom !== undefined || currencyFrom !== undefined) &&
|
|
37
|
+
(itemsFrom === undefined || isColumnReference(itemsFrom)) &&
|
|
38
|
+
(currencyFrom === undefined || isColumnReference(currencyFrom)));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `options` carrying `reference` under `key`, for the table view that serves
|
|
42
|
+
* the input to read; `options` itself without a reference.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
function withColumnReference(options, key, reference) {
|
|
47
|
+
return reference ? { ...options, [key]: reference } : options;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The columns an input reads its items or its currency from.
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
function referencedColumns(options) {
|
|
55
|
+
return [options.itemsFrom, options.currencyFrom].flatMap((reference) => reference ? [reference.column] : []);
|
|
56
|
+
}
|
|
57
|
+
function soleCurrency(values) {
|
|
58
|
+
const [only, ...rest] = values ?? [];
|
|
59
|
+
return only !== undefined && rest.length === 0 && KNOWN_CURRENCIES.has(only)
|
|
60
|
+
? only
|
|
61
|
+
: undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Fills an input that reads from a column, in place: a select's `items`
|
|
65
|
+
* from the badges of its column's values, a price's `currency` from the one
|
|
66
|
+
* ISO 4217 code its column holds. An input whose column `read` lacks keeps
|
|
67
|
+
* its own. Its references are cleared either way, so no client reads one.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function fillReferencingOptions(options, read) {
|
|
72
|
+
const { itemsFrom, currencyFrom } = options;
|
|
73
|
+
const values = itemsFrom && read?.get(itemsFrom.column);
|
|
74
|
+
if (values) {
|
|
75
|
+
options.items = (0, column_badges_1.badgeItems)(values).map(({ value, label, tone }) => ({
|
|
76
|
+
label,
|
|
77
|
+
value,
|
|
78
|
+
textColor: tone,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
const currency = currencyFrom && soleCurrency(read?.get(currencyFrom.column));
|
|
82
|
+
if (currency)
|
|
83
|
+
options.currency = currency;
|
|
84
|
+
options[exports.ITEMS_FROM_KEY] = undefined;
|
|
85
|
+
options[exports.CURRENCY_FROM_KEY] = undefined;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=column-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-references.js","sourceRoot":"","sources":["../../../src/base/internal/column-references.ts"],"names":[],"mappings":";;;AAkEA,oDAYC;AAQD,kDAMC;AAOD,8CAIC;AAmBD,wDAiBC;AA3ID,sCAAsC;AACtC,gEAA6E;AAC7E,mDAA6C;AAY7C;;;;GAIG;AACU,QAAA,cAAc,GAAG,WAAW,CAAC;AAE1C;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,cAAc,CAAC;AA0BhD,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CACnD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CACnC,CAAC;AAEF,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,IAAA,qBAAQ,EAAC,KAAK,CAAC;QACf,CAAC,IAAA,mBAAM,EAAC,KAAK,CAAC;QACd,QAAQ,IAAI,KAAK;QACjB,IAAA,qBAAQ,EAAC,KAAK,CAAC,MAAM,C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EAAE,CAAC;IACrC,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC;QAC1E,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,OAA2B,EAC3B,IAAkC;IAElC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,MAAM,GAAG,SAAS,IAAI,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,GAAG,IAAA,0BAAU,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YAClE,KAAK;YACL,KAAK;YACL,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC,CAAC;IACN,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,IAAI,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,IAAI,QAAQ;QAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1C,OAAO,CAAC,sBAAc,CAAC,GAAG,SAAS,CAAC;IACpC,OAAO,CAAC,yBAAiB,CAAC,GAAG,SAAS,CAAC;AACzC,CAAC"}
|
|
@@ -118,8 +118,8 @@ export declare const KeyValueListSchema: z.ZodObject<{
|
|
|
118
118
|
type?: "link" | "text" | "date" | "status" | "money" | "mono" | undefined;
|
|
119
119
|
id?: string | undefined;
|
|
120
120
|
value?: number | BlockText | null | undefined;
|
|
121
|
-
currency?: string | undefined;
|
|
122
121
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
122
|
+
currency?: string | undefined;
|
|
123
123
|
to?: string | undefined;
|
|
124
124
|
copy?: boolean | undefined;
|
|
125
125
|
detail?: BlockText | undefined;
|
|
@@ -129,8 +129,8 @@ export declare const KeyValueListSchema: z.ZodObject<{
|
|
|
129
129
|
type?: "link" | "text" | "date" | "status" | "money" | "mono" | undefined;
|
|
130
130
|
id?: string | undefined;
|
|
131
131
|
value?: number | BlockText | null | undefined;
|
|
132
|
-
currency?: string | undefined;
|
|
133
132
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
133
|
+
currency?: string | undefined;
|
|
134
134
|
to?: string | undefined;
|
|
135
135
|
copy?: boolean | undefined;
|
|
136
136
|
detail?: BlockText | undefined;
|
|
@@ -149,8 +149,8 @@ export declare const KeyValueListSchema: z.ZodObject<{
|
|
|
149
149
|
type?: "link" | "text" | "date" | "status" | "money" | "mono" | undefined;
|
|
150
150
|
id?: string | undefined;
|
|
151
151
|
value?: number | BlockText | null | undefined;
|
|
152
|
-
currency?: string | undefined;
|
|
153
152
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
153
|
+
currency?: string | undefined;
|
|
154
154
|
to?: string | undefined;
|
|
155
155
|
copy?: boolean | undefined;
|
|
156
156
|
detail?: BlockText | undefined;
|
|
@@ -174,8 +174,8 @@ export declare const KeyValueListSchema: z.ZodObject<{
|
|
|
174
174
|
type?: "link" | "text" | "date" | "status" | "money" | "mono" | undefined;
|
|
175
175
|
id?: string | undefined;
|
|
176
176
|
value?: number | BlockText | null | undefined;
|
|
177
|
-
currency?: string | undefined;
|
|
178
177
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | undefined;
|
|
178
|
+
currency?: string | undefined;
|
|
179
179
|
to?: string | undefined;
|
|
180
180
|
copy?: boolean | undefined;
|
|
181
181
|
detail?: BlockText | undefined;
|
|
@@ -183,9 +183,9 @@ export declare const KeyValueListSchema: z.ZodObject<{
|
|
|
183
183
|
}[] | undefined;
|
|
184
184
|
fetchUrl?: string | undefined;
|
|
185
185
|
fetchUrlMethod?: import("./types").HttpMethod | undefined;
|
|
186
|
+
currency?: string | undefined;
|
|
186
187
|
card?: boolean | undefined;
|
|
187
188
|
columns?: number | undefined;
|
|
188
|
-
currency?: string | undefined;
|
|
189
189
|
periodScope?: string | undefined;
|
|
190
190
|
realtimeTopic?: string | string[] | undefined;
|
|
191
191
|
empty?: {
|
package/dist/base/meter.d.ts
CHANGED
|
@@ -188,8 +188,8 @@ export declare const MeterSchema: z.ZodObject<{
|
|
|
188
188
|
fetchUrl?: string | undefined;
|
|
189
189
|
fetchUrlMethod?: HttpMethod | undefined;
|
|
190
190
|
valueLabel?: BlockText | undefined;
|
|
191
|
-
card?: boolean | undefined;
|
|
192
191
|
tone?: "primary" | "neutral" | "secondary" | "success" | "warning" | "error" | "info" | "soft" | undefined;
|
|
192
|
+
card?: boolean | undefined;
|
|
193
193
|
legend?: boolean | undefined;
|
|
194
194
|
periodScope?: string | undefined;
|
|
195
195
|
actions?: {
|
|
@@ -4,7 +4,7 @@ import type { User } from "../../auth/db";
|
|
|
4
4
|
import type { RowActionRule } from "../types/row-action";
|
|
5
5
|
import type { TableViewMeta } from "./meta";
|
|
6
6
|
import type { TableViewFooterSummary } from "./options";
|
|
7
|
-
import type { FooterSummaryValues } from "./internal/data-functions";
|
|
7
|
+
import type { ColumnValues, FooterSummaryValues } from "./internal/data-functions";
|
|
8
8
|
/**
|
|
9
9
|
* The page of rows a table view's list answers: the listable fields of each
|
|
10
10
|
* row, read through a guard, and where the page sits among every row the
|
|
@@ -24,6 +24,14 @@ export declare const countWithSearch: (thisObj: object, ctx: RequestContext, lis
|
|
|
24
24
|
}>;
|
|
25
25
|
/** @internal */
|
|
26
26
|
export declare const summarizeWithSearch: (thisObj: object, ctx: RequestContext, listParams: Parameters.ListParameters, summaries: Record<string, TableViewFooterSummary<Record<string, unknown>>>, user?: User | undefined, permissions?: Set<string> | undefined) => Promise<FooterSummaryValues>;
|
|
27
|
+
/**
|
|
28
|
+
* The distinct values of each column over every row a list request reads,
|
|
29
|
+
* its filters and archive view included: at most `MAX_COLUMN_VALUES + 1`
|
|
30
|
+
* read per column. A column the controller does not list answers nothing.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare const distinctWithSearch: (thisObj: object, ctx: RequestContext, columns: string[], user?: User | undefined, permissions?: Set<string> | undefined) => Promise<ColumnValues[]>;
|
|
27
35
|
/**
|
|
28
36
|
* A table's rows as a route outside its data controller reads them (a page's
|
|
29
37
|
* route, another controller's): the model they are read with and the table's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchRowForGuard = exports.validateRowsAgainstRule = exports.restoreRows = exports.archiveRows = exports.downloadExport = exports.getExportStatus = exports.startExport = exports.BULK_ALL_MATCHING_KEY = exports.MAX_BULK_MATCHING_ROWS = exports.resolveBulkRowIds = exports.summarizeWithSearch = exports.countWithSearch = exports.listWithSearch = void 0;
|
|
3
|
+
exports.fetchRowForGuard = exports.validateRowsAgainstRule = exports.restoreRows = exports.archiveRows = exports.downloadExport = exports.getExportStatus = exports.startExport = exports.BULK_ALL_MATCHING_KEY = exports.MAX_BULK_MATCHING_ROWS = exports.resolveBulkRowIds = exports.distinctWithSearch = exports.summarizeWithSearch = exports.countWithSearch = exports.listWithSearch = void 0;
|
|
4
4
|
const interface_core_1 = require("@antelopejs/interface-core");
|
|
5
5
|
/** @internal */
|
|
6
6
|
exports.listWithSearch = (0, interface_core_1.InterfaceFunction)();
|
|
@@ -8,6 +8,14 @@ exports.listWithSearch = (0, interface_core_1.InterfaceFunction)();
|
|
|
8
8
|
exports.countWithSearch = (0, interface_core_1.InterfaceFunction)();
|
|
9
9
|
/** @internal */
|
|
10
10
|
exports.summarizeWithSearch = (0, interface_core_1.InterfaceFunction)();
|
|
11
|
+
/**
|
|
12
|
+
* The distinct values of each column over every row a list request reads,
|
|
13
|
+
* its filters and archive view included: at most `MAX_COLUMN_VALUES + 1`
|
|
14
|
+
* read per column. A column the controller does not list answers nothing.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
exports.distinctWithSearch = (0, interface_core_1.InterfaceFunction)();
|
|
11
19
|
/**
|
|
12
20
|
* The ids of the rows a bulk custom action runs on: the `ids` the selection
|
|
13
21
|
* sent, or — after "Select all N matching" (`allMatching=true`) — every row
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-functions.js","sourceRoot":"","sources":["../../../src/base/table-view/data-functions.ts"],"names":[],"mappings":";;;AACA,+DAA+D;
|
|
1
|
+
{"version":3,"file":"data-functions.js","sourceRoot":"","sources":["../../../src/base/table-view/data-functions.ts"],"names":[],"mappings":";;;AACA,+DAA+D;AA0B/D,gBAAgB;AACH,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAQd,CAAC;AAEN,gBAAgB;AACH,QAAA,eAAe,GAC1B,IAAA,kCAAiB,GAQd,CAAC;AAEN,gBAAgB;AACH,QAAA,mBAAmB,GAAG,IAAA,kCAAiB,GAUjD,CAAC;AAEJ;;;;;;GAMG;AACU,QAAA,kBAAkB,GAC7B,IAAA,kCAAiB,GAQd,CAAC;AAiBN;;;;;;;;;;;;GAYG;AACU,QAAA,iBAAiB,GAAG,IAAA,kCAAiB,GAO/C,CAAC;AAEJ,yEAAyE;AAC5D,QAAA,sBAAsB,GAAG,MAAM,CAAC;AAE7C,gEAAgE;AACnD,QAAA,qBAAqB,GAAG,aAAa,CAAC;AAEnD,gBAAgB;AACH,QAAA,WAAW,GAAG,IAAA,kCAAiB,GAWzC,CAAC;AAEJ,gBAAgB;AACH,QAAA,eAAe,GAAG,IAAA,kCAAiB,GAW7C,CAAC;AAEJ,gBAAgB;AACH,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAOd,CAAC;AAEN,gBAAgB;AACH,QAAA,WAAW,GAAG,IAAA,kCAAiB,GAKzC,CAAC;AAEJ,gBAAgB;AACH,QAAA,WAAW,GAAG,IAAA,kCAAiB,GAKzC,CAAC;AAOJ,gBAAgB;AACH,QAAA,uBAAuB,GAClC,IAAA,kCAAiB,GAQd,CAAC;AAEN,gBAAgB;AACH,QAAA,gBAAgB,GAAG,IAAA,kCAAiB,GAO9C,CAAC"}
|