cloudmr-ux 1.7.1 → 1.7.3

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/index.js CHANGED
@@ -1117,7 +1117,6 @@ var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText
1117
1117
  var import_Box3 = __toESM(require("@mui/material/Box"));
1118
1118
  var import_Autocomplete = __toESM(require("@mui/material/Autocomplete"));
1119
1119
  var import_TextField5 = __toESM(require("@mui/material/TextField"));
1120
- var import_Autocomplete2 = require("@mui/material/Autocomplete");
1121
1120
  var import_jsx_runtime18 = require("react/jsx-runtime");
1122
1121
  var CMRSelectUpload = (props) => {
1123
1122
  let [open, setOpen] = import_react8.default.useState(false);
@@ -1135,14 +1134,6 @@ var CMRSelectUpload = (props) => {
1135
1134
  props.onSelected(props.fileSelection[fileIndex]);
1136
1135
  setOpen(false);
1137
1136
  };
1138
- const sortedFiles = [...props.fileSelection].sort(
1139
- (a, b) => a.fileName.localeCompare(b.fileName)
1140
- );
1141
- const stringMatchFilter = (0, import_Autocomplete2.createFilterOptions)({
1142
- stringify: (option) => option.fileName || "",
1143
- trim: true,
1144
- ignoreCase: true
1145
- });
1146
1137
  const selectionDialog = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Dialog6.default, { open, onClose: handleClose, children: [
1147
1138
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
1148
1139
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
@@ -1151,10 +1142,16 @@ var CMRSelectUpload = (props) => {
1151
1142
  import_Autocomplete.default,
1152
1143
  {
1153
1144
  disabled: uploading,
1154
- options: sortedFiles,
1155
- filterOptions: (options, state) => stringMatchFilter(options, state).sort(
1156
- (a, b) => a.fileName.localeCompare(b.fileName)
1157
- ),
1145
+ options: props.fileSelection,
1146
+ filterOptions: (options, state) => {
1147
+ const input = state.inputValue.toLowerCase();
1148
+ const filtered = options.filter(
1149
+ (option) => option.fileName.toLowerCase().startsWith(input)
1150
+ );
1151
+ return filtered.sort(
1152
+ (a, b) => a.fileName.toLowerCase().localeCompare(b.fileName.toLowerCase())
1153
+ );
1154
+ },
1158
1155
  getOptionLabel: (option) => option.fileName,
1159
1156
  isOptionEqualToValue: (option, value) => option.id === value.id,
1160
1157
  value: fileIndex === -1 ? null : props.fileSelection[fileIndex],
package/dist/index.mjs CHANGED
@@ -1069,7 +1069,6 @@ import DialogContentText5 from "@mui/material/DialogContentText";
1069
1069
  import Box4 from "@mui/material/Box";
1070
1070
  import Autocomplete from "@mui/material/Autocomplete";
1071
1071
  import TextField5 from "@mui/material/TextField";
1072
- import { createFilterOptions } from "@mui/material/Autocomplete";
1073
1072
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1074
1073
  var CMRSelectUpload = (props) => {
1075
1074
  let [open, setOpen] = React11.useState(false);
@@ -1087,14 +1086,6 @@ var CMRSelectUpload = (props) => {
1087
1086
  props.onSelected(props.fileSelection[fileIndex]);
1088
1087
  setOpen(false);
1089
1088
  };
1090
- const sortedFiles = [...props.fileSelection].sort(
1091
- (a, b) => a.fileName.localeCompare(b.fileName)
1092
- );
1093
- const stringMatchFilter = createFilterOptions({
1094
- stringify: (option) => option.fileName || "",
1095
- trim: true,
1096
- ignoreCase: true
1097
- });
1098
1089
  const selectionDialog = /* @__PURE__ */ jsxs12(Dialog6, { open, onClose: handleClose, children: [
1099
1090
  /* @__PURE__ */ jsx18(DialogTitle6, { children: "Select or Upload" }),
1100
1091
  /* @__PURE__ */ jsxs12(DialogContent6, { sx: { width: 520 }, children: [
@@ -1103,10 +1094,16 @@ var CMRSelectUpload = (props) => {
1103
1094
  Autocomplete,
1104
1095
  {
1105
1096
  disabled: uploading,
1106
- options: sortedFiles,
1107
- filterOptions: (options, state) => stringMatchFilter(options, state).sort(
1108
- (a, b) => a.fileName.localeCompare(b.fileName)
1109
- ),
1097
+ options: props.fileSelection,
1098
+ filterOptions: (options, state) => {
1099
+ const input = state.inputValue.toLowerCase();
1100
+ const filtered = options.filter(
1101
+ (option) => option.fileName.toLowerCase().startsWith(input)
1102
+ );
1103
+ return filtered.sort(
1104
+ (a, b) => a.fileName.toLowerCase().localeCompare(b.fileName.toLowerCase())
1105
+ );
1106
+ },
1110
1107
  getOptionLabel: (option) => option.fileName,
1111
1108
  isOptionEqualToValue: (option, value) => option.id === value.id,
1112
1109
  value: fileIndex === -1 ? null : props.fileSelection[fileIndex],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",