cloudmr-ux 1.7.0 → 1.7.1

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,6 +1117,7 @@ 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");
1120
1121
  var import_jsx_runtime18 = require("react/jsx-runtime");
1121
1122
  var CMRSelectUpload = (props) => {
1122
1123
  let [open, setOpen] = import_react8.default.useState(false);
@@ -1134,6 +1135,14 @@ var CMRSelectUpload = (props) => {
1134
1135
  props.onSelected(props.fileSelection[fileIndex]);
1135
1136
  setOpen(false);
1136
1137
  };
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
+ });
1137
1146
  const selectionDialog = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Dialog6.default, { open, onClose: handleClose, children: [
1138
1147
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
1139
1148
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
@@ -1142,7 +1151,10 @@ var CMRSelectUpload = (props) => {
1142
1151
  import_Autocomplete.default,
1143
1152
  {
1144
1153
  disabled: uploading,
1145
- options: props.fileSelection,
1154
+ options: sortedFiles,
1155
+ filterOptions: (options, state) => stringMatchFilter(options, state).sort(
1156
+ (a, b) => a.fileName.localeCompare(b.fileName)
1157
+ ),
1146
1158
  getOptionLabel: (option) => option.fileName,
1147
1159
  isOptionEqualToValue: (option, value) => option.id === value.id,
1148
1160
  value: fileIndex === -1 ? null : props.fileSelection[fileIndex],
package/dist/index.mjs CHANGED
@@ -1069,6 +1069,7 @@ 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";
1072
1073
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1073
1074
  var CMRSelectUpload = (props) => {
1074
1075
  let [open, setOpen] = React11.useState(false);
@@ -1086,6 +1087,14 @@ var CMRSelectUpload = (props) => {
1086
1087
  props.onSelected(props.fileSelection[fileIndex]);
1087
1088
  setOpen(false);
1088
1089
  };
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
+ });
1089
1098
  const selectionDialog = /* @__PURE__ */ jsxs12(Dialog6, { open, onClose: handleClose, children: [
1090
1099
  /* @__PURE__ */ jsx18(DialogTitle6, { children: "Select or Upload" }),
1091
1100
  /* @__PURE__ */ jsxs12(DialogContent6, { sx: { width: 520 }, children: [
@@ -1094,7 +1103,10 @@ var CMRSelectUpload = (props) => {
1094
1103
  Autocomplete,
1095
1104
  {
1096
1105
  disabled: uploading,
1097
- options: props.fileSelection,
1106
+ options: sortedFiles,
1107
+ filterOptions: (options, state) => stringMatchFilter(options, state).sort(
1108
+ (a, b) => a.fileName.localeCompare(b.fileName)
1109
+ ),
1098
1110
  getOptionLabel: (option) => option.fileName,
1099
1111
  isOptionEqualToValue: (option, value) => option.id === value.id,
1100
1112
  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.0",
3
+ "version": "1.7.1",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",