trotl-filter 1.0.11 → 1.0.13
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/README.md +16 -2
- package/dist/index.cjs.js +15 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +15 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6994,7 +6994,9 @@ const MultiSelectDropdown = ({
|
|
|
6994
6994
|
pushUrlParamObj = false,
|
|
6995
6995
|
// pushUrlParamObj={"ids"}
|
|
6996
6996
|
addItem = undefined,
|
|
6997
|
-
style = {}
|
|
6997
|
+
style = {},
|
|
6998
|
+
allowClear = false,
|
|
6999
|
+
disabled = false
|
|
6998
7000
|
}) => {
|
|
6999
7001
|
const containerRef = useRef(null);
|
|
7000
7002
|
const [maxVisible, setMaxVisible] = useState(1);
|
|
@@ -7095,6 +7097,7 @@ const MultiSelectDropdown = ({
|
|
|
7095
7097
|
return options;
|
|
7096
7098
|
}, [options, inputValue, inputExists, addItem]);
|
|
7097
7099
|
const handleAddNew = () => {
|
|
7100
|
+
if (disabled) return;
|
|
7098
7101
|
if (!inputValue.trim()) return;
|
|
7099
7102
|
const newLabel = inputValue.trim();
|
|
7100
7103
|
// Prevent duplicate by value or label (case-insensitive)
|
|
@@ -7142,6 +7145,7 @@ const MultiSelectDropdown = ({
|
|
|
7142
7145
|
return /*#__PURE__*/React__default.createElement(components.Option, props);
|
|
7143
7146
|
};
|
|
7144
7147
|
const handleChange = selectedItems => {
|
|
7148
|
+
if (disabled) return;
|
|
7145
7149
|
if (isMulti) {
|
|
7146
7150
|
const values = selectedItems ? selectedItems.map(item => item.value) : [];
|
|
7147
7151
|
onChange(values);
|
|
@@ -7262,15 +7266,22 @@ const MultiSelectDropdown = ({
|
|
|
7262
7266
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
7263
7267
|
style: {
|
|
7264
7268
|
width: "100%",
|
|
7265
|
-
...style
|
|
7269
|
+
...style,
|
|
7270
|
+
...(disabled ? {
|
|
7271
|
+
opacity: 0.6
|
|
7272
|
+
} : {})
|
|
7266
7273
|
},
|
|
7267
7274
|
ref: containerRef,
|
|
7268
|
-
className: showRequiredError ? "select-required-error" : ""
|
|
7275
|
+
className: showRequiredError ? "select-required-error" : "",
|
|
7276
|
+
"aria-disabled": disabled
|
|
7269
7277
|
}, /*#__PURE__*/React__default.createElement(StateManagedSelect$1, {
|
|
7270
7278
|
isMulti: isMulti,
|
|
7279
|
+
isClearable: allowClear,
|
|
7280
|
+
isDisabled: disabled,
|
|
7271
7281
|
options: menuOptions,
|
|
7272
7282
|
value: selectedOptions,
|
|
7273
7283
|
onChange: (val, action) => {
|
|
7284
|
+
if (disabled) return;
|
|
7274
7285
|
// If user selects the +Add option, handle it
|
|
7275
7286
|
if (action && action.action === 'select-option' && val && val.length && val[val.length - 1]?.__isAddNew) {
|
|
7276
7287
|
handleAddNew();
|
|
@@ -7289,6 +7300,7 @@ const MultiSelectDropdown = ({
|
|
|
7289
7300
|
"aria-required": required,
|
|
7290
7301
|
inputValue: inputValue,
|
|
7291
7302
|
onInputChange: (val, action) => {
|
|
7303
|
+
if (disabled) return;
|
|
7292
7304
|
if (action.action === "input-change") setInputValue(val);
|
|
7293
7305
|
}
|
|
7294
7306
|
}), showRequiredError && /*#__PURE__*/React__default.createElement("div", {
|