@uipath/apollo-wind 2.92.0 → 2.94.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/dist/components/forms/field-renderer.cjs +1 -1
- package/dist/components/forms/field-renderer.js +1 -1
- package/dist/components/forms/field-rules-strings.cjs +40 -0
- package/dist/components/forms/field-rules-strings.d.ts +17 -0
- package/dist/components/forms/field-rules-strings.js +6 -0
- package/dist/components/forms/field-rules.cjs +526 -0
- package/dist/components/forms/field-rules.d.ts +97 -0
- package/dist/components/forms/field-rules.js +468 -0
- package/dist/components/forms/form-designer.cjs +208 -592
- package/dist/components/forms/form-designer.js +210 -594
- package/dist/components/forms/form-schema.d.ts +5 -0
- package/dist/components/forms/index.cjs +43 -3
- package/dist/components/forms/index.d.ts +4 -0
- package/dist/components/forms/index.js +5 -1
- package/dist/components/forms/metadata-form.cjs +1 -1
- package/dist/components/forms/metadata-form.js +1 -1
- package/dist/components/forms/rules-engine-dialect.cjs +644 -0
- package/dist/components/forms/rules-engine-dialect.d.ts +90 -0
- package/dist/components/forms/rules-engine-dialect.js +537 -0
- package/dist/components/forms/rules-engine.cjs +99 -10
- package/dist/components/forms/rules-engine.d.ts +5 -0
- package/dist/components/forms/rules-engine.js +99 -10
- package/dist/components/forms/use-field-rules.cjs +122 -0
- package/dist/components/forms/use-field-rules.d.ts +31 -0
- package/dist/components/forms/use-field-rules.js +88 -0
- package/dist/components/ui/conditions-editor/condition-row.cjs +458 -0
- package/dist/components/ui/conditions-editor/condition-row.d.ts +23 -0
- package/dist/components/ui/conditions-editor/condition-row.js +421 -0
- package/dist/components/ui/conditions-editor/conditions-editor.cjs +363 -0
- package/dist/components/ui/conditions-editor/conditions-editor.d.ts +67 -0
- package/dist/components/ui/conditions-editor/conditions-editor.js +329 -0
- package/dist/components/ui/conditions-editor/context.cjs +45 -0
- package/dist/components/ui/conditions-editor/context.d.ts +54 -0
- package/dist/components/ui/conditions-editor/context.js +8 -0
- package/dist/components/ui/conditions-editor/index.cjs +55 -0
- package/dist/components/ui/conditions-editor/index.d.ts +6 -0
- package/dist/components/ui/conditions-editor/index.js +6 -0
- package/dist/components/ui/conditions-editor/model.cjs +126 -0
- package/dist/components/ui/conditions-editor/model.d.ts +39 -0
- package/dist/components/ui/conditions-editor/model.js +71 -0
- package/dist/components/ui/conditions-editor/status.cjs +198 -0
- package/dist/components/ui/conditions-editor/status.d.ts +44 -0
- package/dist/components/ui/conditions-editor/status.js +131 -0
- package/dist/components/ui/conditions-editor/strings.cjs +86 -0
- package/dist/components/ui/conditions-editor/strings.d.ts +62 -0
- package/dist/components/ui/conditions-editor/strings.js +52 -0
- package/dist/components/ui/conditions-editor/vocabulary.cjs +163 -0
- package/dist/components/ui/conditions-editor/vocabulary.d.ts +51 -0
- package/dist/components/ui/conditions-editor/vocabulary.js +129 -0
- package/dist/components/ui/data-table.cjs +493 -104
- package/dist/components/ui/data-table.d.ts +88 -5
- package/dist/components/ui/data-table.js +491 -105
- package/dist/components/ui/editable-cell.cjs +91 -27
- package/dist/components/ui/editable-cell.d.ts +14 -1
- package/dist/components/ui/editable-cell.js +91 -27
- package/dist/components/ui/field-actions/index.cjs +9 -2
- package/dist/components/ui/field-actions/index.d.ts +1 -0
- package/dist/components/ui/field-actions/index.js +2 -1
- package/dist/components/ui/field-actions/insert-variable-action.cjs +3 -1
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
- package/dist/components/ui/field-actions/insert-variable-action.js +3 -1
- package/dist/components/ui/field-actions/rules-action.cjs +244 -0
- package/dist/components/ui/field-actions/rules-action.d.ts +42 -0
- package/dist/components/ui/field-actions/rules-action.js +207 -0
- package/dist/components/ui/index.cjs +282 -243
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.js +3 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +137 -167
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +1 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +138 -168
- package/dist/components/ui/quick-form-field/components/header-actions.cjs +187 -0
- package/dist/components/ui/quick-form-field/components/header-actions.d.ts +59 -0
- package/dist/components/ui/quick-form-field/components/header-actions.js +138 -0
- package/dist/components/ui/quick-form-field/components/header-context.cjs +59 -0
- package/dist/components/ui/quick-form-field/components/header-context.d.ts +33 -0
- package/dist/components/ui/quick-form-field/components/header-context.js +16 -0
- package/dist/components/ui/quick-form-field/index.cjs +18 -4
- package/dist/components/ui/quick-form-field/index.d.ts +2 -0
- package/dist/components/ui/quick-form-field/index.js +3 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -6
- package/dist/components/ui/quick-form-field/quick-form-field.js +1 -1
- package/dist/components/ui/quick-form-field/types.d.ts +42 -11
- package/dist/components/ui/row-groups/add-row-button.cjs +54 -0
- package/dist/components/ui/row-groups/add-row-button.d.ts +10 -0
- package/dist/components/ui/row-groups/add-row-button.js +20 -0
- package/dist/components/ui/row-groups/after-press.cjs +73 -0
- package/dist/components/ui/row-groups/after-press.d.ts +7 -0
- package/dist/components/ui/row-groups/after-press.js +36 -0
- package/dist/components/ui/row-groups/collapsible-row-group.cjs +83 -0
- package/dist/components/ui/row-groups/collapsible-row-group.d.ts +13 -0
- package/dist/components/ui/row-groups/collapsible-row-group.js +49 -0
- package/dist/components/ui/row-groups/empty-rows.cjs +42 -0
- package/dist/components/ui/row-groups/empty-rows.d.ts +7 -0
- package/dist/components/ui/row-groups/empty-rows.js +8 -0
- package/dist/components/ui/row-groups/group-mode-toggle.cjs +80 -0
- package/dist/components/ui/row-groups/group-mode-toggle.d.ts +26 -0
- package/dist/components/ui/row-groups/group-mode-toggle.js +40 -0
- package/dist/components/ui/row-groups/index.cjs +62 -0
- package/dist/components/ui/row-groups/index.d.ts +6 -0
- package/dist/components/ui/row-groups/index.js +7 -0
- package/dist/components/ui/row-groups/row-delete-button.cjs +54 -0
- package/dist/components/ui/row-groups/row-delete-button.d.ts +18 -0
- package/dist/components/ui/row-groups/row-delete-button.js +20 -0
- package/dist/components/ui/row-groups/use-row-focus.cjs +82 -0
- package/dist/components/ui/row-groups/use-row-focus.d.ts +17 -0
- package/dist/components/ui/row-groups/use-row-focus.js +48 -0
- package/dist/components/ui/rules-editor/context.cjs +45 -0
- package/dist/components/ui/rules-editor/context.d.ts +52 -0
- package/dist/components/ui/rules-editor/context.js +8 -0
- package/dist/components/ui/rules-editor/index.cjs +56 -0
- package/dist/components/ui/rules-editor/index.d.ts +4 -0
- package/dist/components/ui/rules-editor/index.js +4 -0
- package/dist/components/ui/rules-editor/model.cjs +205 -0
- package/dist/components/ui/rules-editor/model.d.ts +128 -0
- package/dist/components/ui/rules-editor/model.js +144 -0
- package/dist/components/ui/rules-editor/rule-card.cjs +470 -0
- package/dist/components/ui/rules-editor/rule-card.d.ts +14 -0
- package/dist/components/ui/rules-editor/rule-card.js +436 -0
- package/dist/components/ui/rules-editor/rules-editor.cjs +160 -0
- package/dist/components/ui/rules-editor/rules-editor.d.ts +66 -0
- package/dist/components/ui/rules-editor/rules-editor.js +126 -0
- package/dist/components/ui/rules-editor/strings.cjs +68 -0
- package/dist/components/ui/rules-editor/strings.d.ts +56 -0
- package/dist/components/ui/rules-editor/strings.js +34 -0
- package/dist/index.cjs +132 -8
- package/dist/index.d.ts +19 -6
- package/dist/index.js +11 -4
- package/dist/styles.css +119 -24
- package/package.json +2 -2
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function newId(prefix) {
|
|
2
|
+
return `${prefix}-${crypto.randomUUID()}`;
|
|
3
|
+
}
|
|
4
|
+
function createCondition(init = {}) {
|
|
5
|
+
return {
|
|
6
|
+
kind: 'condition',
|
|
7
|
+
id: init.id ?? newId('condition'),
|
|
8
|
+
...init
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function createConditionGroup(mode = 'all', children = [], id = newId('group')) {
|
|
12
|
+
return {
|
|
13
|
+
kind: 'group',
|
|
14
|
+
id,
|
|
15
|
+
mode,
|
|
16
|
+
children
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function updateNode(root, id, update) {
|
|
20
|
+
if (root.id === id) return update(root);
|
|
21
|
+
let changed = false;
|
|
22
|
+
const children = root.children.map((child)=>{
|
|
23
|
+
const next = child.id === id ? update(child) : 'group' === child.kind ? updateNode(child, id, update) : child;
|
|
24
|
+
if (next !== child) changed = true;
|
|
25
|
+
return next;
|
|
26
|
+
});
|
|
27
|
+
return changed ? {
|
|
28
|
+
...root,
|
|
29
|
+
children
|
|
30
|
+
} : root;
|
|
31
|
+
}
|
|
32
|
+
function removeNode(root, id) {
|
|
33
|
+
let changed = false;
|
|
34
|
+
const children = [];
|
|
35
|
+
for (const child of root.children){
|
|
36
|
+
if (child.id === id) {
|
|
37
|
+
changed = true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const next = 'group' === child.kind ? removeNode(child, id) : child;
|
|
41
|
+
if (next !== child) changed = true;
|
|
42
|
+
children.push(next);
|
|
43
|
+
}
|
|
44
|
+
return changed ? {
|
|
45
|
+
...root,
|
|
46
|
+
children
|
|
47
|
+
} : root;
|
|
48
|
+
}
|
|
49
|
+
function countConditions(node) {
|
|
50
|
+
return node.children.reduce((total, child)=>total + ('condition' === child.kind ? 1 : countConditions(child)), 0);
|
|
51
|
+
}
|
|
52
|
+
function numberConditions(node, map = new Map()) {
|
|
53
|
+
for (const child of node.children)if ('condition' === child.kind) map.set(child.id, map.size + 1);
|
|
54
|
+
else numberConditions(child, map);
|
|
55
|
+
return map;
|
|
56
|
+
}
|
|
57
|
+
function numberGroups(node, map = new Map()) {
|
|
58
|
+
for (const child of node.children)if ('group' === child.kind) {
|
|
59
|
+
map.set(child.id, map.size + 1);
|
|
60
|
+
numberGroups(child, map);
|
|
61
|
+
}
|
|
62
|
+
return map;
|
|
63
|
+
}
|
|
64
|
+
function collectIds(node, ids = new Set()) {
|
|
65
|
+
for (const child of node.children){
|
|
66
|
+
ids.add(child.id);
|
|
67
|
+
if ('group' === child.kind) collectIds(child, ids);
|
|
68
|
+
}
|
|
69
|
+
return ids;
|
|
70
|
+
}
|
|
71
|
+
export { collectIds, countConditions, createCondition, createConditionGroup, numberConditions, numberGroups, removeNode, updateNode };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
isConditionComplete: ()=>isConditionComplete,
|
|
28
|
+
conditionError: ()=>conditionError,
|
|
29
|
+
hasShownProblems: ()=>hasShownProblems,
|
|
30
|
+
isComplete: ()=>isComplete,
|
|
31
|
+
formatDateValue: ()=>formatDateValue,
|
|
32
|
+
resolveCondition: ()=>resolveCondition,
|
|
33
|
+
allowedModes: ()=>allowedModes,
|
|
34
|
+
describeGroup: ()=>describeGroup,
|
|
35
|
+
defaultValueModes: ()=>defaultValueModes,
|
|
36
|
+
isValueInvalid: ()=>isValueInvalid,
|
|
37
|
+
operatorsFor: ()=>operatorsFor,
|
|
38
|
+
parseDateValue: ()=>parseDateValue
|
|
39
|
+
});
|
|
40
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
41
|
+
const external_vocabulary_cjs_namespaceObject = require("./vocabulary.cjs");
|
|
42
|
+
const MODES_WITH_VARIABLES = [
|
|
43
|
+
'literal',
|
|
44
|
+
'expression',
|
|
45
|
+
'variable'
|
|
46
|
+
];
|
|
47
|
+
const MODES = [
|
|
48
|
+
'literal',
|
|
49
|
+
'expression'
|
|
50
|
+
];
|
|
51
|
+
function defaultValueModes(variables) {
|
|
52
|
+
return variables ? MODES_WITH_VARIABLES : MODES;
|
|
53
|
+
}
|
|
54
|
+
function allowedModes(operator, valueModes) {
|
|
55
|
+
const only = operator?.valueModes;
|
|
56
|
+
return only ? valueModes.filter((mode)=>only.includes(mode)) : valueModes;
|
|
57
|
+
}
|
|
58
|
+
function operatorsFor(field, operators) {
|
|
59
|
+
return operators[field?.type ?? 'string'] ?? [];
|
|
60
|
+
}
|
|
61
|
+
function resolveCondition(c, vocabulary) {
|
|
62
|
+
const field = vocabulary.fields.find((option)=>option.value === c.field);
|
|
63
|
+
const operators = operatorsFor(field, vocabulary.operators);
|
|
64
|
+
const operator = void 0 === c.operator ? operators[0] : operators.find((option)=>option.value === c.operator);
|
|
65
|
+
const allowed = allowedModes(operator, vocabulary.valueModes);
|
|
66
|
+
const mode = c.valueMode && vocabulary.valueModes.includes(c.valueMode) ? c.valueMode : allowed[0] ?? vocabulary.valueModes[0] ?? 'literal';
|
|
67
|
+
return {
|
|
68
|
+
field,
|
|
69
|
+
operators,
|
|
70
|
+
operator,
|
|
71
|
+
mode,
|
|
72
|
+
allowedModes: allowed,
|
|
73
|
+
hasValue: operator?.hasValue !== false
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function parseDateValue(value) {
|
|
77
|
+
if (!value) return;
|
|
78
|
+
const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
79
|
+
const date = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(value);
|
|
80
|
+
return (0, external_date_fns_namespaceObject.isValid)(date) ? date : void 0;
|
|
81
|
+
}
|
|
82
|
+
function formatDateValue(date) {
|
|
83
|
+
return (0, external_date_fns_namespaceObject.format)(date, 'yyyy-MM-dd');
|
|
84
|
+
}
|
|
85
|
+
function takesOptions(resolved) {
|
|
86
|
+
return 'literal' === resolved.mode && resolved.operator?.multiple === true;
|
|
87
|
+
}
|
|
88
|
+
function valueProblem(c, resolved) {
|
|
89
|
+
const { field, mode } = resolved;
|
|
90
|
+
if (takesOptions(resolved)) {
|
|
91
|
+
const values = c.values ?? [];
|
|
92
|
+
if (0 === values.length) return 'options';
|
|
93
|
+
const known = field?.options;
|
|
94
|
+
return known && values.some((value)=>!known.some((option)=>option.value === value)) ? 'options' : void 0;
|
|
95
|
+
}
|
|
96
|
+
const value = c.value?.trim();
|
|
97
|
+
if (!value) return 'missing';
|
|
98
|
+
if ('literal' === mode) {
|
|
99
|
+
if (field?.type === 'number' && !Number.isFinite(Number(value))) return 'number';
|
|
100
|
+
if (field?.type === 'date' && !parseDateValue(value)) return 'date';
|
|
101
|
+
if (field?.type === 'enum' && !field.options?.some((option)=>option.value === c.value)) return 'option';
|
|
102
|
+
}
|
|
103
|
+
return field && resolved.operator?.valueError?.(c.value ?? '', {
|
|
104
|
+
field,
|
|
105
|
+
mode
|
|
106
|
+
}) ? 'operator' : void 0;
|
|
107
|
+
}
|
|
108
|
+
function isValueInvalid(c, resolved) {
|
|
109
|
+
return void 0 !== valueProblem(c, resolved);
|
|
110
|
+
}
|
|
111
|
+
function isComplete(c, vocabulary) {
|
|
112
|
+
const resolved = resolveCondition(c, vocabulary);
|
|
113
|
+
if (!resolved.field || !resolved.operator) return false;
|
|
114
|
+
return !resolved.hasValue || void 0 === valueProblem(c, resolved);
|
|
115
|
+
}
|
|
116
|
+
function isConditionComplete(condition, vocabulary) {
|
|
117
|
+
return isComplete(condition, {
|
|
118
|
+
operators: external_vocabulary_cjs_namespaceObject.DEFAULT_CONDITION_OPERATORS,
|
|
119
|
+
valueModes: [
|
|
120
|
+
'literal',
|
|
121
|
+
'expression',
|
|
122
|
+
'variable'
|
|
123
|
+
],
|
|
124
|
+
...vocabulary
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function conditionError(c, vocabulary, strings) {
|
|
128
|
+
if (isComplete(c, vocabulary)) return;
|
|
129
|
+
const resolved = resolveCondition(c, vocabulary);
|
|
130
|
+
const problem = resolved.hasValue ? valueProblem(c, resolved) : void 0;
|
|
131
|
+
if (!resolved.field) {
|
|
132
|
+
if (c.field) return strings.errorUnknownField(c.field);
|
|
133
|
+
return 'missing' === problem || 'options' === problem ? strings.errorFieldAndValue : strings.errorField;
|
|
134
|
+
}
|
|
135
|
+
if (!resolved.operator) return strings.errorOperator;
|
|
136
|
+
if ('number' === problem) return strings.errorNumber;
|
|
137
|
+
if ('date' === problem) return strings.errorDate;
|
|
138
|
+
if ('operator' === problem) return resolved.operator.valueError?.(c.value ?? '', {
|
|
139
|
+
field: resolved.field,
|
|
140
|
+
mode: resolved.mode
|
|
141
|
+
});
|
|
142
|
+
return 'options' === problem ? strings.errorOptions : strings.errorValue;
|
|
143
|
+
}
|
|
144
|
+
function describeValue(c, resolved, strings) {
|
|
145
|
+
const { field, mode } = resolved;
|
|
146
|
+
const optionLabel = (value)=>field?.options?.find((option)=>option.value === value)?.label ?? value;
|
|
147
|
+
if (takesOptions(resolved)) return strings.summaryList((c.values ?? []).map(optionLabel));
|
|
148
|
+
if ('literal' === mode && field?.type === 'date') {
|
|
149
|
+
const date = parseDateValue(c.value);
|
|
150
|
+
return date ? strings.formatDate(date) : c.value ?? '';
|
|
151
|
+
}
|
|
152
|
+
if ('literal' === mode && field?.type === 'enum') return optionLabel(c.value ?? '');
|
|
153
|
+
return c.value ?? '';
|
|
154
|
+
}
|
|
155
|
+
function describeGroup(node, vocabulary, strings, nested = false) {
|
|
156
|
+
const parts = node.children.map((child)=>{
|
|
157
|
+
if ('group' === child.kind) return describeGroup(child, vocabulary, strings, true);
|
|
158
|
+
if (!isComplete(child, vocabulary)) return '';
|
|
159
|
+
const resolved = resolveCondition(child, vocabulary);
|
|
160
|
+
return strings.summaryCondition(resolved.field?.label ?? '', resolved.operator?.label ?? '', resolved.hasValue ? describeValue(child, resolved, strings) : void 0);
|
|
161
|
+
}).filter(Boolean);
|
|
162
|
+
if (0 === parts.length) return '';
|
|
163
|
+
const joined = parts.join(` ${'all' === node.mode ? strings.summaryAnd : strings.summaryOr} `);
|
|
164
|
+
return nested && parts.length > 1 ? `(${joined})` : joined;
|
|
165
|
+
}
|
|
166
|
+
function hasShownProblems(node, vocabulary, shown, nested = false) {
|
|
167
|
+
if (nested && 0 === node.children.length) return true;
|
|
168
|
+
return node.children.some((child)=>'condition' === child.kind ? shown(child.id) && !isComplete(child, vocabulary) : hasShownProblems(child, vocabulary, shown, true));
|
|
169
|
+
}
|
|
170
|
+
exports.allowedModes = __webpack_exports__.allowedModes;
|
|
171
|
+
exports.conditionError = __webpack_exports__.conditionError;
|
|
172
|
+
exports.defaultValueModes = __webpack_exports__.defaultValueModes;
|
|
173
|
+
exports.describeGroup = __webpack_exports__.describeGroup;
|
|
174
|
+
exports.formatDateValue = __webpack_exports__.formatDateValue;
|
|
175
|
+
exports.hasShownProblems = __webpack_exports__.hasShownProblems;
|
|
176
|
+
exports.isComplete = __webpack_exports__.isComplete;
|
|
177
|
+
exports.isConditionComplete = __webpack_exports__.isConditionComplete;
|
|
178
|
+
exports.isValueInvalid = __webpack_exports__.isValueInvalid;
|
|
179
|
+
exports.operatorsFor = __webpack_exports__.operatorsFor;
|
|
180
|
+
exports.parseDateValue = __webpack_exports__.parseDateValue;
|
|
181
|
+
exports.resolveCondition = __webpack_exports__.resolveCondition;
|
|
182
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
183
|
+
"allowedModes",
|
|
184
|
+
"conditionError",
|
|
185
|
+
"defaultValueModes",
|
|
186
|
+
"describeGroup",
|
|
187
|
+
"formatDateValue",
|
|
188
|
+
"hasShownProblems",
|
|
189
|
+
"isComplete",
|
|
190
|
+
"isConditionComplete",
|
|
191
|
+
"isValueInvalid",
|
|
192
|
+
"operatorsFor",
|
|
193
|
+
"parseDateValue",
|
|
194
|
+
"resolveCondition"
|
|
195
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
196
|
+
Object.defineProperty(exports, '__esModule', {
|
|
197
|
+
value: true
|
|
198
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Condition, ConditionGroup, ConditionValueMode } from './model';
|
|
2
|
+
import type { ConditionsEditorStrings } from './strings';
|
|
3
|
+
import { type ConditionField, type ConditionOperator, type ConditionOperators } from './vocabulary';
|
|
4
|
+
/** What the editor offers, which every row reads to resolve its parts. */
|
|
5
|
+
export interface ConditionVocabulary {
|
|
6
|
+
fields: readonly ConditionField[];
|
|
7
|
+
operators: ConditionOperators;
|
|
8
|
+
valueModes: readonly ConditionValueMode[];
|
|
9
|
+
}
|
|
10
|
+
/** The editor's modes when none are given: Variable only when there is something to pick. */
|
|
11
|
+
export declare function defaultValueModes(variables: unknown): readonly ConditionValueMode[];
|
|
12
|
+
export interface ResolvedCondition {
|
|
13
|
+
field?: ConditionField;
|
|
14
|
+
operators: readonly ConditionOperator[];
|
|
15
|
+
/**
|
|
16
|
+
* The row's operator. A row without one means its field type's first; an id the type does not
|
|
17
|
+
* offer resolves to none, so it is flagged rather than shown as another operator.
|
|
18
|
+
*/
|
|
19
|
+
operator?: ConditionOperator;
|
|
20
|
+
/** The row's mode, or the first one allowed when the editor does not offer it. */
|
|
21
|
+
mode: ConditionValueMode;
|
|
22
|
+
/** The editor's modes the operator can compare against, in the editor's order. */
|
|
23
|
+
allowedModes: readonly ConditionValueMode[];
|
|
24
|
+
hasValue: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function allowedModes(operator: ConditionOperator | undefined, valueModes: readonly ConditionValueMode[]): readonly ConditionValueMode[];
|
|
27
|
+
export declare function operatorsFor(field: ConditionField | undefined, operators: ConditionOperators): readonly ConditionOperator[];
|
|
28
|
+
export declare function resolveCondition(c: Condition, vocabulary: ConditionVocabulary): ResolvedCondition;
|
|
29
|
+
/** A date value as stored: `yyyy-MM-dd`, read as a local date so no time zone shifts the day. */
|
|
30
|
+
export declare function parseDateValue(value: string | undefined): Date | undefined;
|
|
31
|
+
export declare function formatDateValue(date: Date): string;
|
|
32
|
+
export declare function isValueInvalid(c: Condition, resolved: ResolvedCondition): boolean;
|
|
33
|
+
export declare function isComplete(c: Condition, vocabulary: ConditionVocabulary): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a condition is complete: it has a known field and operator, and a value the operator
|
|
36
|
+
* can use. The editor flags every other row, and a host should ignore them when it runs the rules.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isConditionComplete(condition: Condition, vocabulary: Pick<ConditionVocabulary, 'fields'> & Partial<ConditionVocabulary>): boolean;
|
|
39
|
+
/** The row's message, naming only what is still missing. */
|
|
40
|
+
export declare function conditionError(c: Condition, vocabulary: ConditionVocabulary, strings: ConditionsEditorStrings): string | undefined;
|
|
41
|
+
/** Plain-language reading of a group. Incomplete conditions are left out, as they are ignored. */
|
|
42
|
+
export declare function describeGroup(node: ConditionGroup, vocabulary: ConditionVocabulary, strings: ConditionsEditorStrings, nested?: boolean): string;
|
|
43
|
+
/** Whether the group, or any group inside it, shows a problem: an incomplete row or an empty group. */
|
|
44
|
+
export declare function hasShownProblems(node: ConditionGroup, vocabulary: ConditionVocabulary, shown: (id: string) => boolean, nested?: boolean): boolean;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { format, isValid } from "date-fns";
|
|
2
|
+
import { DEFAULT_CONDITION_OPERATORS } from "./vocabulary.js";
|
|
3
|
+
const MODES_WITH_VARIABLES = [
|
|
4
|
+
'literal',
|
|
5
|
+
'expression',
|
|
6
|
+
'variable'
|
|
7
|
+
];
|
|
8
|
+
const MODES = [
|
|
9
|
+
'literal',
|
|
10
|
+
'expression'
|
|
11
|
+
];
|
|
12
|
+
function defaultValueModes(variables) {
|
|
13
|
+
return variables ? MODES_WITH_VARIABLES : MODES;
|
|
14
|
+
}
|
|
15
|
+
function allowedModes(operator, valueModes) {
|
|
16
|
+
const only = operator?.valueModes;
|
|
17
|
+
return only ? valueModes.filter((mode)=>only.includes(mode)) : valueModes;
|
|
18
|
+
}
|
|
19
|
+
function operatorsFor(field, operators) {
|
|
20
|
+
return operators[field?.type ?? 'string'] ?? [];
|
|
21
|
+
}
|
|
22
|
+
function resolveCondition(c, vocabulary) {
|
|
23
|
+
const field = vocabulary.fields.find((option)=>option.value === c.field);
|
|
24
|
+
const operators = operatorsFor(field, vocabulary.operators);
|
|
25
|
+
const operator = void 0 === c.operator ? operators[0] : operators.find((option)=>option.value === c.operator);
|
|
26
|
+
const allowed = allowedModes(operator, vocabulary.valueModes);
|
|
27
|
+
const mode = c.valueMode && vocabulary.valueModes.includes(c.valueMode) ? c.valueMode : allowed[0] ?? vocabulary.valueModes[0] ?? 'literal';
|
|
28
|
+
return {
|
|
29
|
+
field,
|
|
30
|
+
operators,
|
|
31
|
+
operator,
|
|
32
|
+
mode,
|
|
33
|
+
allowedModes: allowed,
|
|
34
|
+
hasValue: operator?.hasValue !== false
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function parseDateValue(value) {
|
|
38
|
+
if (!value) return;
|
|
39
|
+
const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
40
|
+
const date = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(value);
|
|
41
|
+
return isValid(date) ? date : void 0;
|
|
42
|
+
}
|
|
43
|
+
function formatDateValue(date) {
|
|
44
|
+
return format(date, 'yyyy-MM-dd');
|
|
45
|
+
}
|
|
46
|
+
function takesOptions(resolved) {
|
|
47
|
+
return 'literal' === resolved.mode && resolved.operator?.multiple === true;
|
|
48
|
+
}
|
|
49
|
+
function valueProblem(c, resolved) {
|
|
50
|
+
const { field, mode } = resolved;
|
|
51
|
+
if (takesOptions(resolved)) {
|
|
52
|
+
const values = c.values ?? [];
|
|
53
|
+
if (0 === values.length) return 'options';
|
|
54
|
+
const known = field?.options;
|
|
55
|
+
return known && values.some((value)=>!known.some((option)=>option.value === value)) ? 'options' : void 0;
|
|
56
|
+
}
|
|
57
|
+
const value = c.value?.trim();
|
|
58
|
+
if (!value) return 'missing';
|
|
59
|
+
if ('literal' === mode) {
|
|
60
|
+
if (field?.type === 'number' && !Number.isFinite(Number(value))) return 'number';
|
|
61
|
+
if (field?.type === 'date' && !parseDateValue(value)) return 'date';
|
|
62
|
+
if (field?.type === 'enum' && !field.options?.some((option)=>option.value === c.value)) return 'option';
|
|
63
|
+
}
|
|
64
|
+
return field && resolved.operator?.valueError?.(c.value ?? '', {
|
|
65
|
+
field,
|
|
66
|
+
mode
|
|
67
|
+
}) ? 'operator' : void 0;
|
|
68
|
+
}
|
|
69
|
+
function isValueInvalid(c, resolved) {
|
|
70
|
+
return void 0 !== valueProblem(c, resolved);
|
|
71
|
+
}
|
|
72
|
+
function isComplete(c, vocabulary) {
|
|
73
|
+
const resolved = resolveCondition(c, vocabulary);
|
|
74
|
+
if (!resolved.field || !resolved.operator) return false;
|
|
75
|
+
return !resolved.hasValue || void 0 === valueProblem(c, resolved);
|
|
76
|
+
}
|
|
77
|
+
function isConditionComplete(condition, vocabulary) {
|
|
78
|
+
return isComplete(condition, {
|
|
79
|
+
operators: DEFAULT_CONDITION_OPERATORS,
|
|
80
|
+
valueModes: [
|
|
81
|
+
'literal',
|
|
82
|
+
'expression',
|
|
83
|
+
'variable'
|
|
84
|
+
],
|
|
85
|
+
...vocabulary
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function conditionError(c, vocabulary, strings) {
|
|
89
|
+
if (isComplete(c, vocabulary)) return;
|
|
90
|
+
const resolved = resolveCondition(c, vocabulary);
|
|
91
|
+
const problem = resolved.hasValue ? valueProblem(c, resolved) : void 0;
|
|
92
|
+
if (!resolved.field) {
|
|
93
|
+
if (c.field) return strings.errorUnknownField(c.field);
|
|
94
|
+
return 'missing' === problem || 'options' === problem ? strings.errorFieldAndValue : strings.errorField;
|
|
95
|
+
}
|
|
96
|
+
if (!resolved.operator) return strings.errorOperator;
|
|
97
|
+
if ('number' === problem) return strings.errorNumber;
|
|
98
|
+
if ('date' === problem) return strings.errorDate;
|
|
99
|
+
if ('operator' === problem) return resolved.operator.valueError?.(c.value ?? '', {
|
|
100
|
+
field: resolved.field,
|
|
101
|
+
mode: resolved.mode
|
|
102
|
+
});
|
|
103
|
+
return 'options' === problem ? strings.errorOptions : strings.errorValue;
|
|
104
|
+
}
|
|
105
|
+
function describeValue(c, resolved, strings) {
|
|
106
|
+
const { field, mode } = resolved;
|
|
107
|
+
const optionLabel = (value)=>field?.options?.find((option)=>option.value === value)?.label ?? value;
|
|
108
|
+
if (takesOptions(resolved)) return strings.summaryList((c.values ?? []).map(optionLabel));
|
|
109
|
+
if ('literal' === mode && field?.type === 'date') {
|
|
110
|
+
const date = parseDateValue(c.value);
|
|
111
|
+
return date ? strings.formatDate(date) : c.value ?? '';
|
|
112
|
+
}
|
|
113
|
+
if ('literal' === mode && field?.type === 'enum') return optionLabel(c.value ?? '');
|
|
114
|
+
return c.value ?? '';
|
|
115
|
+
}
|
|
116
|
+
function describeGroup(node, vocabulary, strings, nested = false) {
|
|
117
|
+
const parts = node.children.map((child)=>{
|
|
118
|
+
if ('group' === child.kind) return describeGroup(child, vocabulary, strings, true);
|
|
119
|
+
if (!isComplete(child, vocabulary)) return '';
|
|
120
|
+
const resolved = resolveCondition(child, vocabulary);
|
|
121
|
+
return strings.summaryCondition(resolved.field?.label ?? '', resolved.operator?.label ?? '', resolved.hasValue ? describeValue(child, resolved, strings) : void 0);
|
|
122
|
+
}).filter(Boolean);
|
|
123
|
+
if (0 === parts.length) return '';
|
|
124
|
+
const joined = parts.join(` ${'all' === node.mode ? strings.summaryAnd : strings.summaryOr} `);
|
|
125
|
+
return nested && parts.length > 1 ? `(${joined})` : joined;
|
|
126
|
+
}
|
|
127
|
+
function hasShownProblems(node, vocabulary, shown, nested = false) {
|
|
128
|
+
if (nested && 0 === node.children.length) return true;
|
|
129
|
+
return node.children.some((child)=>'condition' === child.kind ? shown(child.id) && !isComplete(child, vocabulary) : hasShownProblems(child, vocabulary, shown, true));
|
|
130
|
+
}
|
|
131
|
+
export { allowedModes, conditionError, defaultValueModes, describeGroup, formatDateValue, hasShownProblems, isComplete, isConditionComplete, isValueInvalid, operatorsFor, parseDateValue, resolveCondition };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
DEFAULT_CONDITIONS_EDITOR_STRINGS: ()=>DEFAULT_CONDITIONS_EDITOR_STRINGS
|
|
28
|
+
});
|
|
29
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
30
|
+
const DEFAULT_CONDITIONS_EDITOR_STRINGS = {
|
|
31
|
+
fieldLabel: 'Field',
|
|
32
|
+
operatorLabel: 'Operator',
|
|
33
|
+
valueLabel: 'Value',
|
|
34
|
+
fieldPlaceholder: 'Select a field',
|
|
35
|
+
operatorPlaceholder: 'Select an operator',
|
|
36
|
+
valuePlaceholder: 'Enter a value',
|
|
37
|
+
expressionPlaceholder: '',
|
|
38
|
+
optionPlaceholder: 'Choose a value',
|
|
39
|
+
optionsPlaceholder: 'Choose values',
|
|
40
|
+
datePlaceholder: 'Pick a date',
|
|
41
|
+
matchAll: 'All (AND)',
|
|
42
|
+
matchAny: 'Any (OR)',
|
|
43
|
+
addCondition: 'Add condition',
|
|
44
|
+
addGroup: 'Add group',
|
|
45
|
+
empty: 'No conditions.',
|
|
46
|
+
emptyGroup: 'No conditions in this group.',
|
|
47
|
+
conditionName: (position)=>`Condition ${position}`,
|
|
48
|
+
removeCondition: (position)=>`Remove condition ${position}`,
|
|
49
|
+
groupName: (position)=>`Group ${position}`,
|
|
50
|
+
groupActions: (group)=>`${group} actions`,
|
|
51
|
+
groupMatchMode: (group)=>`${group} match mode`,
|
|
52
|
+
valueModeMenu: (condition, mode)=>`${condition} mode: ${mode}`,
|
|
53
|
+
valueModeUnavailable: (operator)=>`Not available with ${operator}`,
|
|
54
|
+
deleteGroup: 'Delete group',
|
|
55
|
+
deleteGroupTitle: 'Delete this group?',
|
|
56
|
+
deleteGroupDescription: (conditions)=>1 === conditions ? 'The group and its condition will be removed.' : `The group and its ${conditions} conditions will be removed.`,
|
|
57
|
+
cancel: 'Cancel',
|
|
58
|
+
errorFieldAndValue: 'Select a field and enter a value.',
|
|
59
|
+
errorField: 'Select a field.',
|
|
60
|
+
errorUnknownField: (field)=>`The form does not contain ${field}. Select another field.`,
|
|
61
|
+
unknownField: (field)=>`${field} (not in form)`,
|
|
62
|
+
errorOperator: 'Select an operator.',
|
|
63
|
+
errorNumber: 'Enter a number.',
|
|
64
|
+
errorDate: 'Enter a valid date.',
|
|
65
|
+
errorOptions: 'Choose at least one value.',
|
|
66
|
+
errorValue: 'Enter a value.',
|
|
67
|
+
incomplete: 'Some conditions are incomplete and will be ignored.',
|
|
68
|
+
count: (conditions)=>1 === conditions ? '1 condition' : `${conditions} conditions`,
|
|
69
|
+
summaryLabel: 'Reads as:',
|
|
70
|
+
summaryCondition: (field, operator, value)=>[
|
|
71
|
+
field,
|
|
72
|
+
operator.toLowerCase(),
|
|
73
|
+
value
|
|
74
|
+
].filter((part)=>void 0 !== part).join(' '),
|
|
75
|
+
summaryList: (values)=>`(${values.join(', ')})`,
|
|
76
|
+
summaryAnd: 'and',
|
|
77
|
+
summaryOr: 'or',
|
|
78
|
+
formatDate: (date)=>(0, external_date_fns_namespaceObject.format)(date, 'PPP')
|
|
79
|
+
};
|
|
80
|
+
exports.DEFAULT_CONDITIONS_EDITOR_STRINGS = __webpack_exports__.DEFAULT_CONDITIONS_EDITOR_STRINGS;
|
|
81
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
82
|
+
"DEFAULT_CONDITIONS_EDITOR_STRINGS"
|
|
83
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
84
|
+
Object.defineProperty(exports, '__esModule', {
|
|
85
|
+
value: true
|
|
86
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface ConditionsEditorStrings {
|
|
2
|
+
/** Column labels in one-line rows, and each control's own label in stacked rows. */
|
|
3
|
+
fieldLabel: string;
|
|
4
|
+
operatorLabel: string;
|
|
5
|
+
valueLabel: string;
|
|
6
|
+
fieldPlaceholder: string;
|
|
7
|
+
operatorPlaceholder: string;
|
|
8
|
+
valuePlaceholder: string;
|
|
9
|
+
/** An example of a valid expression, never the field's name. Empty shows none. */
|
|
10
|
+
expressionPlaceholder: string;
|
|
11
|
+
optionPlaceholder: string;
|
|
12
|
+
optionsPlaceholder: string;
|
|
13
|
+
datePlaceholder: string;
|
|
14
|
+
/** The group mode switch's options. */
|
|
15
|
+
matchAll: string;
|
|
16
|
+
matchAny: string;
|
|
17
|
+
addCondition: string;
|
|
18
|
+
addGroup: string;
|
|
19
|
+
/** Says what happens with no conditions, e.g. "No conditions. The rule always applies." Empty shows none. */
|
|
20
|
+
empty: string;
|
|
21
|
+
emptyGroup: string;
|
|
22
|
+
/** The row half of every control's name, e.g. "Condition 2" + "Field". */
|
|
23
|
+
conditionName: (position: number) => string;
|
|
24
|
+
removeCondition: (position: number) => string;
|
|
25
|
+
groupName: (position: number) => string;
|
|
26
|
+
groupActions: (group: string) => string;
|
|
27
|
+
groupMatchMode: (group: string) => string;
|
|
28
|
+
/** Names a value's mode menu, e.g. "Condition 2 Value mode: Expression". */
|
|
29
|
+
valueModeMenu: (condition: string, mode: string) => string;
|
|
30
|
+
/** A disabled mode's description in the mode menu. */
|
|
31
|
+
valueModeUnavailable: (operator: string) => string;
|
|
32
|
+
deleteGroup: string;
|
|
33
|
+
deleteGroupTitle: string;
|
|
34
|
+
deleteGroupDescription: (conditions: number) => string;
|
|
35
|
+
cancel: string;
|
|
36
|
+
errorFieldAndValue: string;
|
|
37
|
+
errorField: string;
|
|
38
|
+
/** For a row on a field `fields` does not list, by the key it stores. */
|
|
39
|
+
errorUnknownField: (field: string) => string;
|
|
40
|
+
/** The field select's text for such a field. */
|
|
41
|
+
unknownField: (field: string) => string;
|
|
42
|
+
errorOperator: string;
|
|
43
|
+
errorNumber: string;
|
|
44
|
+
errorDate: string;
|
|
45
|
+
errorOptions: string;
|
|
46
|
+
errorValue: string;
|
|
47
|
+
/** Below the group while any row shows a message, or a nested group is empty. */
|
|
48
|
+
incomplete: string;
|
|
49
|
+
/** A collapsible editor's header. */
|
|
50
|
+
count: (conditions: number) => string;
|
|
51
|
+
/** Leads the plain-language reading below the rows. */
|
|
52
|
+
summaryLabel: string;
|
|
53
|
+
/** One condition in the reading. `value` is omitted for operators that take none. */
|
|
54
|
+
summaryCondition: (field: string, operator: string, value?: string) => string;
|
|
55
|
+
/** Several chosen options in the reading. */
|
|
56
|
+
summaryList: (values: string[]) => string;
|
|
57
|
+
summaryAnd: string;
|
|
58
|
+
summaryOr: string;
|
|
59
|
+
/** A date in the reading. */
|
|
60
|
+
formatDate: (date: Date) => string;
|
|
61
|
+
}
|
|
62
|
+
export declare const DEFAULT_CONDITIONS_EDITOR_STRINGS: ConditionsEditorStrings;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { format } from "date-fns";
|
|
2
|
+
const DEFAULT_CONDITIONS_EDITOR_STRINGS = {
|
|
3
|
+
fieldLabel: 'Field',
|
|
4
|
+
operatorLabel: 'Operator',
|
|
5
|
+
valueLabel: 'Value',
|
|
6
|
+
fieldPlaceholder: 'Select a field',
|
|
7
|
+
operatorPlaceholder: 'Select an operator',
|
|
8
|
+
valuePlaceholder: 'Enter a value',
|
|
9
|
+
expressionPlaceholder: '',
|
|
10
|
+
optionPlaceholder: 'Choose a value',
|
|
11
|
+
optionsPlaceholder: 'Choose values',
|
|
12
|
+
datePlaceholder: 'Pick a date',
|
|
13
|
+
matchAll: 'All (AND)',
|
|
14
|
+
matchAny: 'Any (OR)',
|
|
15
|
+
addCondition: 'Add condition',
|
|
16
|
+
addGroup: 'Add group',
|
|
17
|
+
empty: 'No conditions.',
|
|
18
|
+
emptyGroup: 'No conditions in this group.',
|
|
19
|
+
conditionName: (position)=>`Condition ${position}`,
|
|
20
|
+
removeCondition: (position)=>`Remove condition ${position}`,
|
|
21
|
+
groupName: (position)=>`Group ${position}`,
|
|
22
|
+
groupActions: (group)=>`${group} actions`,
|
|
23
|
+
groupMatchMode: (group)=>`${group} match mode`,
|
|
24
|
+
valueModeMenu: (condition, mode)=>`${condition} mode: ${mode}`,
|
|
25
|
+
valueModeUnavailable: (operator)=>`Not available with ${operator}`,
|
|
26
|
+
deleteGroup: 'Delete group',
|
|
27
|
+
deleteGroupTitle: 'Delete this group?',
|
|
28
|
+
deleteGroupDescription: (conditions)=>1 === conditions ? 'The group and its condition will be removed.' : `The group and its ${conditions} conditions will be removed.`,
|
|
29
|
+
cancel: 'Cancel',
|
|
30
|
+
errorFieldAndValue: 'Select a field and enter a value.',
|
|
31
|
+
errorField: 'Select a field.',
|
|
32
|
+
errorUnknownField: (field)=>`The form does not contain ${field}. Select another field.`,
|
|
33
|
+
unknownField: (field)=>`${field} (not in form)`,
|
|
34
|
+
errorOperator: 'Select an operator.',
|
|
35
|
+
errorNumber: 'Enter a number.',
|
|
36
|
+
errorDate: 'Enter a valid date.',
|
|
37
|
+
errorOptions: 'Choose at least one value.',
|
|
38
|
+
errorValue: 'Enter a value.',
|
|
39
|
+
incomplete: 'Some conditions are incomplete and will be ignored.',
|
|
40
|
+
count: (conditions)=>1 === conditions ? '1 condition' : `${conditions} conditions`,
|
|
41
|
+
summaryLabel: 'Reads as:',
|
|
42
|
+
summaryCondition: (field, operator, value)=>[
|
|
43
|
+
field,
|
|
44
|
+
operator.toLowerCase(),
|
|
45
|
+
value
|
|
46
|
+
].filter((part)=>void 0 !== part).join(' '),
|
|
47
|
+
summaryList: (values)=>`(${values.join(', ')})`,
|
|
48
|
+
summaryAnd: 'and',
|
|
49
|
+
summaryOr: 'or',
|
|
50
|
+
formatDate: (date)=>format(date, 'PPP')
|
|
51
|
+
};
|
|
52
|
+
export { DEFAULT_CONDITIONS_EDITOR_STRINGS };
|