@synerise/ds-factors 1.11.11 → 1.11.12
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/CHANGELOG.md +4 -0
- package/dist/FactorTypeSelector/FactorTypeSelector.d.ts +2 -2
- package/dist/FactorTypeSelector/FactorTypeSelector.js +37 -58
- package/dist/FactorTypeSelector/FactorTypeSelector.styles.d.ts +18 -18
- package/dist/FactorTypeSelector/FactorTypeSelector.styles.js +10 -10
- package/dist/FactorValue/Array/Array.const.js +8 -3
- package/dist/FactorValue/Array/Array.d.ts +2 -2
- package/dist/FactorValue/Array/Array.js +45 -57
- package/dist/FactorValue/Array/Array.styles.d.ts +39 -39
- package/dist/FactorValue/Array/Array.styles.js +44 -33
- package/dist/FactorValue/Array/Array.types.d.ts +3 -3
- package/dist/FactorValue/Array/Array.types.js +1 -1
- package/dist/FactorValue/Array/Array.utils.d.ts +2 -2
- package/dist/FactorValue/Array/Array.utils.js +21 -18
- package/dist/FactorValue/Array/components/ArrayCollector.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayCollector.js +70 -94
- package/dist/FactorValue/Array/components/ArrayCreator.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayCreator.js +43 -75
- package/dist/FactorValue/Array/components/ArrayLimit.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayLimit.js +16 -14
- package/dist/FactorValue/Array/components/ArrayModal.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayModal.js +78 -143
- package/dist/FactorValue/Array/components/ArrayRaw.d.ts +2 -2
- package/dist/FactorValue/Array/components/ArrayRaw.js +47 -58
- package/dist/FactorValue/Array/components/CopyButton.d.ts +2 -2
- package/dist/FactorValue/Array/components/CopyButton.js +20 -30
- package/dist/FactorValue/Array/hooks/useCollector.d.ts +3 -3
- package/dist/FactorValue/Array/hooks/useCollector.js +21 -22
- package/dist/FactorValue/Date/Date.d.ts +2 -2
- package/dist/FactorValue/Date/Date.js +38 -53
- package/dist/FactorValue/DateRange/DateRange.d.ts +2 -2
- package/dist/FactorValue/DateRange/DateRange.js +26 -41
- package/dist/FactorValue/DynamicKey/DynamicKey.d.ts +2 -2
- package/dist/FactorValue/DynamicKey/DynamicKey.js +37 -66
- package/dist/FactorValue/DynamicKey/DynamicKey.style.d.ts +2 -2
- package/dist/FactorValue/DynamicKey/DynamicKey.style.js +10 -8
- package/dist/FactorValue/FactorValue.d.ts +2 -2
- package/dist/FactorValue/FactorValue.js +68 -70
- package/dist/FactorValue/FactorValue.style.d.ts +1 -1
- package/dist/FactorValue/FactorValue.style.js +20 -20
- package/dist/FactorValue/Formula/Formula.d.ts +2 -2
- package/dist/FactorValue/Formula/Formula.js +36 -54
- package/dist/FactorValue/Formula/Formula.styles.d.ts +1 -1
- package/dist/FactorValue/Formula/Formula.styles.js +6 -5
- package/dist/FactorValue/Formula/FormulaModal.d.ts +2 -2
- package/dist/FactorValue/Formula/FormulaModal.js +27 -42
- package/dist/FactorValue/Number/NumberInput.d.ts +2 -2
- package/dist/FactorValue/Number/NumberInput.js +21 -31
- package/dist/FactorValue/Parameter/Parameter.constants.d.ts +1 -1
- package/dist/FactorValue/Parameter/Parameter.constants.js +27 -13
- package/dist/FactorValue/Parameter/Parameter.d.ts +2 -2
- package/dist/FactorValue/Parameter/Parameter.js +82 -127
- package/dist/FactorValue/Parameter/Parameter.style.d.ts +28 -28
- package/dist/FactorValue/Parameter/Parameter.style.js +34 -31
- package/dist/FactorValue/Parameter/Parameter.types.d.ts +2 -2
- package/dist/FactorValue/Parameter/Parameter.types.js +1 -1
- package/dist/FactorValue/Parameter/ParameterDropdown.d.ts +2 -2
- package/dist/FactorValue/Parameter/ParameterDropdown.js +155 -226
- package/dist/FactorValue/Parameter/ParameterDropdownItem.d.ts +3 -3
- package/dist/FactorValue/Parameter/ParameterDropdownItem.js +27 -33
- package/dist/FactorValue/Parameter/useGroups.d.ts +2 -2
- package/dist/FactorValue/Parameter/useGroups.js +30 -42
- package/dist/FactorValue/Parameter/utils.d.ts +2 -2
- package/dist/FactorValue/Parameter/utils.js +22 -17
- package/dist/FactorValue/RelativeDate/RelativeDate.const.d.ts +1 -1
- package/dist/FactorValue/RelativeDate/RelativeDate.const.js +12 -5
- package/dist/FactorValue/RelativeDate/RelativeDate.d.ts +2 -2
- package/dist/FactorValue/RelativeDate/RelativeDate.js +57 -88
- package/dist/FactorValue/RelativeDate/RelativeDate.utils.d.ts +1 -1
- package/dist/FactorValue/RelativeDate/RelativeDate.utils.js +14 -10
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.d.ts +2 -2
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.js +56 -87
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.styles.d.ts +7 -7
- package/dist/FactorValue/RelativeDate/RelativeDateDropdown.styles.js +23 -20
- package/dist/FactorValue/Text/Text.d.ts +2 -2
- package/dist/FactorValue/Text/Text.js +56 -121
- package/dist/FactorValue/Text/Text.styles.d.ts +3 -3
- package/dist/FactorValue/Text/Text.styles.js +11 -10
- package/dist/FactorValue/Text/TextModal.d.ts +2 -2
- package/dist/FactorValue/Text/TextModal.js +19 -33
- package/dist/Factors.d.ts +2 -2
- package/dist/Factors.js +95 -132
- package/dist/Factors.types.d.ts +9 -9
- package/dist/Factors.types.js +8 -3
- package/dist/hooks/useTexts.d.ts +2 -2
- package/dist/hooks/useTexts.js +287 -291
- package/dist/index.js +7 -6
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/style/Factors.style.d.ts +1 -1
- package/dist/style/Factors.style.js +10 -11
- package/package.json +32 -32
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { v4
|
|
2
|
-
|
|
1
|
+
import { v4 } from "uuid";
|
|
2
|
+
const matchesSearchQuery = (item, searchQuery) => {
|
|
3
3
|
return String(item).toLocaleLowerCase().includes(searchQuery.toLocaleLowerCase());
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
return items.map(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
});
|
|
5
|
+
const arrayWithUUID = (items) => {
|
|
6
|
+
return items.map((item) => ({
|
|
7
|
+
value: item,
|
|
8
|
+
id: v4()
|
|
9
|
+
}));
|
|
12
10
|
};
|
|
13
|
-
|
|
11
|
+
const sanitiseValues = (element) => {
|
|
14
12
|
return element.trim();
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
return sanitiseValues(value) ===
|
|
14
|
+
const isNumberAsString = (value) => {
|
|
15
|
+
return sanitiseValues(value) === `${parseFloat(sanitiseValues(value))}`;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return "" + parseFloat(sanitiseValues(item));
|
|
23
|
-
});
|
|
17
|
+
const isArrayOfNumbersAsString = (array) => {
|
|
18
|
+
const sanitisedArray = array.map(sanitiseValues);
|
|
19
|
+
const comparisonArray = array.map((item) => `${parseFloat(sanitiseValues(item))}`);
|
|
24
20
|
return JSON.stringify(sanitisedArray) === JSON.stringify(comparisonArray);
|
|
25
|
-
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
arrayWithUUID,
|
|
24
|
+
isArrayOfNumbersAsString,
|
|
25
|
+
isNumberAsString,
|
|
26
|
+
matchesSearchQuery,
|
|
27
|
+
sanitiseValues
|
|
28
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayCollectorProps } from '../Array.types';
|
|
3
3
|
export declare const ArrayCollector: <ItemType extends "string" | "number">({ limit, itemType, arrayValueCount, texts, onConfirm, collectorSuggestions, }: ArrayCollectorProps<ItemType>) => React.JSX.Element;
|
|
@@ -1,113 +1,89 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { v4 } from "uuid";
|
|
4
|
+
import Collector from "@synerise/ds-collector";
|
|
5
|
+
import { COMMA } from "../Array.const.js";
|
|
6
|
+
import { CollectorWrapper } from "../Array.styles.js";
|
|
7
|
+
import { sanitiseValues, isArrayOfNumbersAsString, isNumberAsString } from "../Array.utils.js";
|
|
8
|
+
import { useCollector } from "../hooks/useCollector.js";
|
|
9
|
+
const ArrayCollector = ({
|
|
10
|
+
limit,
|
|
11
|
+
itemType,
|
|
12
|
+
arrayValueCount,
|
|
13
|
+
texts,
|
|
14
|
+
onConfirm,
|
|
15
|
+
collectorSuggestions
|
|
16
|
+
}) => {
|
|
17
|
+
const [collectorValues, setCollectorValues] = useState([]);
|
|
18
|
+
const {
|
|
19
|
+
disabled,
|
|
20
|
+
error,
|
|
21
|
+
errorMessage,
|
|
22
|
+
addEnabled,
|
|
23
|
+
setHasTypeError,
|
|
24
|
+
exceedsLimit
|
|
25
|
+
} = useCollector({
|
|
26
|
+
limit,
|
|
27
|
+
collectorCount: collectorValues.length,
|
|
28
|
+
arrayValueCount,
|
|
29
|
+
texts
|
|
30
|
+
});
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (itemType === "number") {
|
|
33
|
+
const plainValues = collectorValues.map((item) => sanitiseValues(item.value));
|
|
35
34
|
setHasTypeError(!isArrayOfNumbersAsString(plainValues));
|
|
36
35
|
}
|
|
37
36
|
}, [collectorValues, setHasTypeError, itemType]);
|
|
38
|
-
|
|
37
|
+
const handleCancel = () => {
|
|
39
38
|
setCollectorValues([]);
|
|
40
39
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
var hasExceededLimit = exceedsLimit(items.length);
|
|
40
|
+
const handleConfirm = (items) => {
|
|
41
|
+
const hasError = items.some((item) => item.hasError);
|
|
42
|
+
const hasExceededLimit = exceedsLimit(items.length);
|
|
46
43
|
if (!hasError && !hasExceededLimit) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
});
|
|
44
|
+
const rawItemValues = items.map((item) => ({
|
|
45
|
+
value: itemType === "number" ? Number(item.value) : item.value,
|
|
46
|
+
id: item.id
|
|
47
|
+
}));
|
|
53
48
|
onConfirm(rawItemValues);
|
|
54
49
|
setCollectorValues([]);
|
|
55
50
|
} else {
|
|
56
51
|
setCollectorValues(items);
|
|
57
52
|
}
|
|
58
53
|
};
|
|
59
|
-
|
|
54
|
+
const handleItemAdd = (text) => {
|
|
60
55
|
return {
|
|
61
|
-
value: sanitiseValues(
|
|
56
|
+
value: sanitiseValues(`${text}`),
|
|
62
57
|
type: itemType,
|
|
63
|
-
hasError: itemType ===
|
|
64
|
-
id:
|
|
58
|
+
hasError: itemType === "number" && !isNumberAsString(`${text}`),
|
|
59
|
+
id: v4()
|
|
65
60
|
};
|
|
66
61
|
};
|
|
67
|
-
|
|
68
|
-
setCollectorValues([
|
|
62
|
+
const handleItemSelect = (item) => {
|
|
63
|
+
setCollectorValues([...collectorValues, item]);
|
|
69
64
|
};
|
|
70
|
-
|
|
71
|
-
setCollectorValues(collectorValues.filter(
|
|
72
|
-
return collectorItem.id !== deselectedItem.id;
|
|
73
|
-
}));
|
|
65
|
+
const handleItemDeselect = (deselectedItem) => {
|
|
66
|
+
setCollectorValues(collectorValues.filter((collectorItem) => collectorItem.id !== deselectedItem.id));
|
|
74
67
|
};
|
|
75
|
-
|
|
76
|
-
setCollectorValues([
|
|
68
|
+
const handleMultipleItemSelect = (items) => {
|
|
69
|
+
setCollectorValues([...collectorValues, ...items]);
|
|
77
70
|
};
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
'data-testid': 'array-collector-add-button'
|
|
98
|
-
},
|
|
99
|
-
allowMultipleValues: true,
|
|
100
|
-
lookupConfig: {
|
|
101
|
-
display: 'value',
|
|
102
|
-
filter: 'value'
|
|
103
|
-
},
|
|
104
|
-
onItemDeselect: handleItemDeselect,
|
|
105
|
-
allowPaste: true,
|
|
106
|
-
suggestions: collectorSuggestions || [],
|
|
107
|
-
texts: {
|
|
108
|
-
add: texts.array.collectorAdd,
|
|
109
|
-
placeholder: texts.array.collectorPlaceholder,
|
|
110
|
-
cancel: texts.array.collectorCancel
|
|
111
|
-
}
|
|
112
|
-
}));
|
|
113
|
-
};
|
|
71
|
+
return /* @__PURE__ */ jsx(CollectorWrapper, { children: /* @__PURE__ */ jsx(Collector, { valuesSeparator: COMMA, error, errorText: errorMessage, onConfirm: addEnabled ? handleConfirm : void 0, onItemSelect: handleItemSelect, onMultipleItemsSelect: handleMultipleItemSelect, selected: collectorValues, onCancel: handleCancel, onItemAdd: handleItemAdd, allowCustomValue: true, disabled, cancelButtonProps: {
|
|
72
|
+
"data-testid": "array-collector-cancel-button"
|
|
73
|
+
}, addButtonProps: addEnabled ? {
|
|
74
|
+
"data-testid": "array-collector-add-button"
|
|
75
|
+
} : {
|
|
76
|
+
disabled: true,
|
|
77
|
+
"data-testid": "array-collector-add-button"
|
|
78
|
+
}, allowMultipleValues: true, lookupConfig: {
|
|
79
|
+
display: "value",
|
|
80
|
+
filter: "value"
|
|
81
|
+
}, onItemDeselect: handleItemDeselect, allowPaste: true, suggestions: collectorSuggestions || [], texts: {
|
|
82
|
+
add: texts.array.collectorAdd,
|
|
83
|
+
placeholder: texts.array.collectorPlaceholder,
|
|
84
|
+
cancel: texts.array.collectorCancel
|
|
85
|
+
} }) });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
ArrayCollector
|
|
89
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayCreatorProps } from '../Array.types';
|
|
3
3
|
export declare const ArrayCreator: <ItemType extends "string" | "number">({ value: arrayValue, searchQuery, itemType, onValueChange, limit, readOnly, texts, collectorSuggestions, }: ArrayCreatorProps<ItemType>) => React.JSX.Element;
|
|
@@ -1,81 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { CloseM, InboxNoResultsL } from
|
|
4
|
-
import { Input } from
|
|
5
|
-
import InputNumber from
|
|
6
|
-
import Tooltip from
|
|
7
|
-
import
|
|
8
|
-
import { matchesSearchQuery } from
|
|
9
|
-
import { ArrayCollector } from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return [].
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { CloseM, InboxNoResultsL } from "@synerise/ds-icon";
|
|
4
|
+
import { Input } from "@synerise/ds-input";
|
|
5
|
+
import InputNumber from "@synerise/ds-input-number";
|
|
6
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
7
|
+
import { ModalContentWrapper, CreatorItemsList, CreatorRow, DeleteIcon, EmptyState } from "../Array.styles.js";
|
|
8
|
+
import { matchesSearchQuery } from "../Array.utils.js";
|
|
9
|
+
import { ArrayCollector } from "./ArrayCollector.js";
|
|
10
|
+
const ArrayCreator = ({
|
|
11
|
+
value: arrayValue = [],
|
|
12
|
+
searchQuery,
|
|
13
|
+
itemType,
|
|
14
|
+
onValueChange,
|
|
15
|
+
limit,
|
|
16
|
+
readOnly,
|
|
17
|
+
texts,
|
|
18
|
+
collectorSuggestions
|
|
19
|
+
}) => {
|
|
20
|
+
const arrayReversed = useMemo(() => {
|
|
21
|
+
return [...arrayValue].reverse();
|
|
22
22
|
}, [arrayValue]);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}).reverse();
|
|
23
|
+
const handleItemChange = (valueIndex, newValue) => {
|
|
24
|
+
const updatedArray = arrayReversed.map((currentValue, index) => index === valueIndex ? {
|
|
25
|
+
...currentValue,
|
|
26
|
+
value: newValue
|
|
27
|
+
} : currentValue).reverse();
|
|
29
28
|
onValueChange(updatedArray);
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
onValueChange([
|
|
30
|
+
const handleItemRemove = (valueIndex) => {
|
|
31
|
+
onValueChange([...arrayReversed.slice(0, valueIndex), ...arrayReversed.slice(valueIndex + 1)].reverse());
|
|
33
32
|
};
|
|
34
|
-
|
|
35
|
-
onValueChange([
|
|
33
|
+
const handleConfirm = (rawItemValues) => {
|
|
34
|
+
onValueChange([...arrayValue, ...rawItemValues]);
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
return searchQuery ? arrayReversed.filter(
|
|
39
|
-
return matchesSearchQuery(item.value, searchQuery);
|
|
40
|
-
}) : arrayReversed;
|
|
36
|
+
const filteredItems = useMemo(() => {
|
|
37
|
+
return searchQuery ? arrayReversed.filter((item) => matchesSearchQuery(item.value, searchQuery)) : arrayReversed;
|
|
41
38
|
}, [searchQuery, arrayReversed]);
|
|
42
|
-
return
|
|
43
|
-
arrayValueCount: arrayValue.length,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
texts: texts,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, itemType === 'string' ? /*#__PURE__*/React.createElement(Input, {
|
|
54
|
-
resetMargin: true,
|
|
55
|
-
readOnly: readOnly,
|
|
56
|
-
onChange: function onChange(event) {
|
|
57
|
-
return handleItemChange(index, event.target.value);
|
|
58
|
-
},
|
|
59
|
-
value: item.value
|
|
60
|
-
}) : /*#__PURE__*/React.createElement(InputNumber, {
|
|
61
|
-
raw: true,
|
|
62
|
-
readOnly: readOnly,
|
|
63
|
-
onChange: function onChange(changedValue) {
|
|
64
|
-
return changedValue && handleItemChange(index, changedValue);
|
|
65
|
-
},
|
|
66
|
-
value: item.value
|
|
67
|
-
}), !readOnly && /*#__PURE__*/React.createElement(Tooltip, {
|
|
68
|
-
title: texts.array.deleteItemTooltip
|
|
69
|
-
}, /*#__PURE__*/React.createElement(S.DeleteIcon, {
|
|
70
|
-
"data-testid": "ds-factors-array-remove-item",
|
|
71
|
-
onClick: function onClick() {
|
|
72
|
-
return handleItemRemove(index);
|
|
73
|
-
},
|
|
74
|
-
component: /*#__PURE__*/React.createElement(CloseM, null)
|
|
75
|
-
})));
|
|
76
|
-
})) : /*#__PURE__*/React.createElement(S.EmptyState, {
|
|
77
|
-
customIcon: /*#__PURE__*/React.createElement(InboxNoResultsL, null),
|
|
78
|
-
text: searchQuery ? texts.array.emptyResultsTitle : texts.array.emptyTitle,
|
|
79
|
-
label: searchQuery ? texts.array.emptyResultsDescription : texts.array.emptyDescription
|
|
80
|
-
})));
|
|
81
|
-
};
|
|
39
|
+
return /* @__PURE__ */ jsx(ModalContentWrapper, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
!readOnly && /* @__PURE__ */ jsx(ArrayCollector, { arrayValueCount: arrayValue.length, limit, itemType, onConfirm: handleConfirm, texts, collectorSuggestions }),
|
|
41
|
+
filteredItems?.length ? /* @__PURE__ */ jsx(CreatorItemsList, { children: filteredItems.map((item, index) => /* @__PURE__ */ jsxs(CreatorRow, { "data-testid": "ds-factors-array-item", children: [
|
|
42
|
+
itemType === "string" ? /* @__PURE__ */ jsx(Input, { resetMargin: true, readOnly, onChange: (event) => handleItemChange(index, event.target.value), value: item.value }) : /* @__PURE__ */ jsx(InputNumber, { raw: true, readOnly, onChange: (changedValue) => changedValue && handleItemChange(index, changedValue), value: item.value }),
|
|
43
|
+
!readOnly && /* @__PURE__ */ jsx(Tooltip, { title: texts.array.deleteItemTooltip, children: /* @__PURE__ */ jsx(DeleteIcon, { "data-testid": "ds-factors-array-remove-item", onClick: () => handleItemRemove(index), component: /* @__PURE__ */ jsx(CloseM, {}) }) })
|
|
44
|
+
] }, item.id)) }) : /* @__PURE__ */ jsx(EmptyState, { customIcon: /* @__PURE__ */ jsx(InboxNoResultsL, {}), text: searchQuery ? texts.array.emptyResultsTitle : texts.array.emptyTitle, label: searchQuery ? texts.array.emptyResultsDescription : texts.array.emptyDescription })
|
|
45
|
+
] }) });
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
ArrayCreator
|
|
49
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayLimitProps } from '../Array.types';
|
|
3
3
|
export declare const ArrayLimit: ({ limit, count, texts }: ArrayLimitProps) => React.JSX.Element;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IconAlert } from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
iconAlert: true,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconAlert } from "@synerise/ds-alert";
|
|
3
|
+
import { Limit, LimitPart } from "../Array.styles.js";
|
|
4
|
+
const ArrayLimit = ({
|
|
5
|
+
limit,
|
|
6
|
+
count = 0,
|
|
7
|
+
texts
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Limit, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(LimitPart, { children: count === limit ? /* @__PURE__ */ jsx(IconAlert, { iconAlert: true, type: "warning", message: texts.array.limitReached }) : texts.array.limitPrefix }),
|
|
11
|
+
/* @__PURE__ */ jsx(LimitPart, { children: ` ${count}/${limit}` })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
ArrayLimit
|
|
16
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayModalProps } from '../Array.types';
|
|
3
3
|
export declare const ArrayModal: <ItemType extends "string" | "number">({ value, itemType, onApply, onCancel, visible, readOnly, texts, limit, collectorSuggestions, }: ArrayModalProps<ItemType>) => React.JSX.Element;
|