wcz-test 2.10.0 → 2.11.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/index.d.ts CHANGED
@@ -57,7 +57,7 @@ declare const RouterTab: LinkComponent<typeof Component>;
57
57
  declare function RouterNotFound(): react_jsx_runtime.JSX.Element;
58
58
 
59
59
  interface RouterErrorProps {
60
- error: ErrorComponentProps['error'];
60
+ error: ErrorComponentProps["error"];
61
61
  }
62
62
  declare const RouterError: FC<RouterErrorProps>;
63
63
 
@@ -76,8 +76,8 @@ interface NavigationParams {
76
76
  }
77
77
 
78
78
  interface ProvidersProps {
79
- getNavigation?: (params: NavigationParams) => Navigation;
80
- theme?: Pick<CssVarsThemeOptions, 'colorSchemes' | 'components'>;
79
+ getNavigation?: (parameters: NavigationParams) => Navigation;
80
+ theme?: Pick<CssVarsThemeOptions, "colorSchemes" | "components">;
81
81
  children: React.ReactNode;
82
82
  }
83
83
  declare const LayoutProvider: FC<ProvidersProps>;
@@ -179,9 +179,7 @@ interface FormAutocompleteProps extends Omit<AutocompleteProps<any, boolean, boo
179
179
  textFieldProps?: Omit<TextFieldProps, FormOmittedProps>;
180
180
  }
181
181
 
182
- interface FormTextFieldProps$1 extends Omit<TextFieldProps, FormOmittedProps> {
183
- }
184
- interface FormNumberFieldProps extends FormTextFieldProps$1 {
182
+ interface FormNumberFieldProps extends Omit<TextFieldProps, FormOmittedProps> {
185
183
  defaultValue?: number | null;
186
184
  options?: Omit<NumericFormatProps<InputAttributes>, "customInput" | "onValueChange" | keyof InputAttributes>;
187
185
  }
@@ -190,8 +188,7 @@ interface FormTextFieldProps extends Omit<TextFieldProps, FormOmittedProps> {
190
188
  type?: "color" | "email" | "password" | "search" | "tel" | "text" | "url";
191
189
  }
192
190
 
193
- interface FormSubmitButtonProps extends Omit<ButtonProps, "loading" | "disabled" | "onClick" | "type"> {
194
- }
191
+ type FormSubmitButtonProps = Omit<ButtonProps, "loading" | "disabled" | "onClick" | "type">;
195
192
 
196
193
  declare const useFieldContext: <TData>() => _tanstack_form_core.FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
197
194
  declare const useFormContext: () => _tanstack_react_form.ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any>;
package/dist/index.js CHANGED
@@ -1024,13 +1024,15 @@ var stackSxProps = [
1024
1024
  ];
1025
1025
  var TypographyWithIcon = ({ startIcon, endIcon, children, sx, gutterBottom, ...props }) => {
1026
1026
  const sxCopy = { ...sx };
1027
- const stackStyles = stackSxProps.reduce((acc, curr) => {
1028
- if (sxCopy && sxCopy[curr]) {
1029
- acc[curr] = sxCopy[curr];
1030
- delete sxCopy[curr];
1027
+ const stackStyles = {};
1028
+ if (sxCopy) {
1029
+ for (const current of stackSxProps) {
1030
+ if (sxCopy[current]) {
1031
+ stackStyles[current] = sxCopy[current];
1032
+ delete sxCopy[current];
1033
+ }
1031
1034
  }
1032
- return acc;
1033
- }, {});
1035
+ }
1034
1036
  return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, sx: stackStyles, mb: gutterBottom ? 0.7 : void 0, children: [
1035
1037
  startIcon,
1036
1038
  /* @__PURE__ */ jsx(Typography, { ...props, sx: sxCopy, children }),
@@ -1090,7 +1092,9 @@ import { Button } from "@mui/material";
1090
1092
  import { createLink } from "@tanstack/react-router";
1091
1093
  import React from "react";
1092
1094
  import { jsx as jsx5 } from "react/jsx-runtime";
1093
- var Component = React.forwardRef((props, ref) => /* @__PURE__ */ jsx5(Button, { ref, component: "a", ...props }));
1095
+ var Component = React.forwardRef(function ButtonComponent(props, reference) {
1096
+ return /* @__PURE__ */ jsx5(Button, { ref: reference, component: "a", ...props });
1097
+ });
1094
1098
  var CreatedComponent = createLink(Component);
1095
1099
  var RouterButton = (props) => {
1096
1100
  return /* @__PURE__ */ jsx5(CreatedComponent, { preload: "intent", ...props });
@@ -1102,7 +1106,9 @@ import { createLink as createLink2 } from "@tanstack/react-router";
1102
1106
  import React2 from "react";
1103
1107
  import { jsx as jsx6 } from "react/jsx-runtime";
1104
1108
  var Component2 = React2.forwardRef(
1105
- (props, ref) => /* @__PURE__ */ jsx6(GridActionsCellItem, { ref, component: "a", ...props })
1109
+ function GridActionsCellItemComponent(props, reference) {
1110
+ return /* @__PURE__ */ jsx6(GridActionsCellItem, { ref: reference, component: "a", ...props });
1111
+ }
1106
1112
  );
1107
1113
  var CreatedComponent2 = createLink2(Component2);
1108
1114
  var RouterGridActionsCellItem = (props) => {
@@ -1114,7 +1120,9 @@ import { IconButton } from "@mui/material";
1114
1120
  import { createLink as createLink3 } from "@tanstack/react-router";
1115
1121
  import React3 from "react";
1116
1122
  import { jsx as jsx7 } from "react/jsx-runtime";
1117
- var Component3 = React3.forwardRef((props, ref) => /* @__PURE__ */ jsx7(IconButton, { ref, component: "a", ...props }));
1123
+ var Component3 = React3.forwardRef(function IconButtonComponent(props, reference) {
1124
+ return /* @__PURE__ */ jsx7(IconButton, { ref: reference, component: "a", ...props });
1125
+ });
1118
1126
  var CreatedComponent3 = createLink3(Component3);
1119
1127
  var RouterIconButton = (props) => {
1120
1128
  return /* @__PURE__ */ jsx7(CreatedComponent3, { preload: "intent", ...props });
@@ -1125,7 +1133,9 @@ import { Link } from "@mui/material";
1125
1133
  import { createLink as createLink4 } from "@tanstack/react-router";
1126
1134
  import React4 from "react";
1127
1135
  import { jsx as jsx8 } from "react/jsx-runtime";
1128
- var Component4 = React4.forwardRef((props, ref) => /* @__PURE__ */ jsx8(Link, { ref, ...props }));
1136
+ var Component4 = React4.forwardRef(function LinkComponent(props, reference) {
1137
+ return /* @__PURE__ */ jsx8(Link, { ref: reference, ...props });
1138
+ });
1129
1139
  var CreatedComponent4 = createLink4(Component4);
1130
1140
  var RouterLink = (props) => {
1131
1141
  return /* @__PURE__ */ jsx8(CreatedComponent4, { preload: "intent", ...props });
@@ -1136,7 +1146,9 @@ import { Tab } from "@mui/material";
1136
1146
  import { createLink as createLink5 } from "@tanstack/react-router";
1137
1147
  import React5 from "react";
1138
1148
  import { jsx as jsx9 } from "react/jsx-runtime";
1139
- var Component5 = React5.forwardRef((props, ref) => /* @__PURE__ */ jsx9(Tab, { ref, component: "a", ...props }));
1149
+ var Component5 = React5.forwardRef(function TabComponent(props, reference) {
1150
+ return /* @__PURE__ */ jsx9(Tab, { ref: reference, component: "a", ...props });
1151
+ });
1140
1152
  var CreatedComponent5 = createLink5(Component5);
1141
1153
  var RouterTab = (props) => {
1142
1154
  return /* @__PURE__ */ jsx9(CreatedComponent5, { preload: "intent", ...props });
@@ -1900,9 +1912,9 @@ var user = {
1900
1912
  }
1901
1913
  };
1902
1914
  var ToolbarAccount = () => {
1903
- const [anchorEl, setAnchorEl] = useState2(null);
1915
+ const [anchorElement, setAnchorElement] = useState2();
1904
1916
  const [tab, setTab] = useState2("settings");
1905
- const open = Boolean(anchorEl);
1917
+ const open = Boolean(anchorElement);
1906
1918
  const { t, i18n: i18n2 } = useTranslation3();
1907
1919
  const { mode, setMode } = useColorScheme();
1908
1920
  const changeLanguage = (newLanguage) => () => {
@@ -1914,21 +1926,24 @@ var ToolbarAccount = () => {
1914
1926
  };
1915
1927
  const getModeText = () => {
1916
1928
  switch (mode) {
1917
- case "light":
1929
+ case "light": {
1918
1930
  return t("Layout.Light");
1919
- case "dark":
1931
+ }
1932
+ case "dark": {
1920
1933
  return t("Layout.Dark");
1921
- default:
1934
+ }
1935
+ default: {
1922
1936
  return t("Layout.System");
1937
+ }
1923
1938
  }
1924
1939
  };
1925
1940
  const usernameInitials = () => {
1926
1941
  const splittedName = user.name.split(" ");
1927
1942
  return `${splittedName[0][0]}${splittedName.length > 1 ? splittedName[1][0] : ""}`;
1928
1943
  };
1929
- const openMenu = (e) => setAnchorEl(e.currentTarget);
1944
+ const openMenu = (event) => setAnchorElement(event.currentTarget);
1930
1945
  const closeMenu = () => {
1931
- setAnchorEl(null);
1946
+ setAnchorElement(void 0);
1932
1947
  setTimeout(() => setTab("settings"), 300);
1933
1948
  };
1934
1949
  const login = () => user.login();
@@ -1974,7 +1989,7 @@ var ToolbarAccount = () => {
1974
1989
  ] });
1975
1990
  return /* @__PURE__ */ jsxs6(Fragment, { children: [
1976
1991
  /* @__PURE__ */ jsx14(IconButton3, { size: "small", onClick: openMenu, children: user.name ? /* @__PURE__ */ jsx14(Avatar, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx14(Typography6, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx14(AccountCircle, {}) }),
1977
- /* @__PURE__ */ jsx14(Menu, { anchorEl, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs6(Box3, { sx: { width: 240 }, children: [
1992
+ /* @__PURE__ */ jsx14(Menu, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs6(Box3, { sx: { width: 240 }, children: [
1978
1993
  /* @__PURE__ */ jsx14(List, { children: user.name ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1979
1994
  /* @__PURE__ */ jsx14(ListItem, { children: /* @__PURE__ */ jsx14(ListItemText, { primary: user.name, secondary: /* @__PURE__ */ jsxs6("span", { children: [
1980
1995
  /* @__PURE__ */ jsx14("span", { children: user.employeeId }),
@@ -2014,9 +2029,9 @@ var Platform = class {
2014
2029
  static isMacOS = /Macintosh|MacIntel|MacPPC|Mac68K/.test(navigator.userAgent);
2015
2030
  };
2016
2031
  var getContrastTextColor = (color) => {
2017
- const r = parseInt(color.substring(1, 3), 16);
2018
- const g = parseInt(color.substring(3, 5), 16);
2019
- const b = parseInt(color.substring(5, 7), 16);
2032
+ const r = Number.parseInt(color.slice(1, 3), 16);
2033
+ const g = Number.parseInt(color.slice(3, 5), 16);
2034
+ const b = Number.parseInt(color.slice(5, 7), 16);
2020
2035
  const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
2021
2036
  return yiq >= 128 ? "black" : "white";
2022
2037
  };
@@ -2061,8 +2076,8 @@ var useGetTheme = (theme) => {
2061
2076
  },
2062
2077
  dark: {
2063
2078
  palette: {
2064
- primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.1) },
2065
- secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.1) }
2079
+ primary: { main: lighten(WISTRON_PRIMARY_COLOR, 0.5) },
2080
+ secondary: { main: darken(WISTRON_SECONDARY_COLOR, 0.5) }
2066
2081
  }
2067
2082
  },
2068
2083
  ...theme?.colorSchemes
@@ -2148,13 +2163,13 @@ import { useLocation, useNavigate, useSearch, Link as TanstackRouterLink } from
2148
2163
  import { AppProvider } from "@toolpad/core/AppProvider";
2149
2164
  import { useCallback, useMemo as useMemo2, forwardRef } from "react";
2150
2165
  import { jsx as jsx15 } from "react/jsx-runtime";
2151
- var Link2 = forwardRef((props, ref) => {
2166
+ var Link2 = forwardRef(function Link3(props, reference) {
2152
2167
  const { href, history, ...rest } = props;
2153
- return /* @__PURE__ */ jsx15(TanstackRouterLink, { ref, to: href, replace: history === "replace", ...rest });
2168
+ return /* @__PURE__ */ jsx15(TanstackRouterLink, { ref: reference, to: href, replace: history === "replace", ...rest });
2154
2169
  });
2155
2170
  var TanstackRouterAppProvider = (props) => {
2156
2171
  const { pathname } = useLocation();
2157
- const searchParams = useSearch({ strict: false });
2172
+ const searchParameters = useSearch({ strict: false });
2158
2173
  const _navigate = useNavigate();
2159
2174
  const navigate = useCallback(
2160
2175
  (url, { history = "auto" } = {}) => {
@@ -2162,7 +2177,7 @@ var TanstackRouterAppProvider = (props) => {
2162
2177
  },
2163
2178
  [_navigate]
2164
2179
  );
2165
- const router = useMemo2(() => ({ pathname, searchParams: new URLSearchParams(searchParams), navigate, Link: Link2 }), [pathname, searchParams, navigate]);
2180
+ const router = useMemo2(() => ({ pathname, searchParams: new URLSearchParams(searchParameters), navigate, Link: Link2 }), [pathname, searchParameters, navigate]);
2166
2181
  return /* @__PURE__ */ jsx15(AppProvider, { router, ...props });
2167
2182
  };
2168
2183
 
@@ -2197,7 +2212,7 @@ var LayoutProvider = (props) => {
2197
2212
  DashboardLayout,
2198
2213
  {
2199
2214
  defaultSidebarCollapsed: true,
2200
- hideNavigation: !navigation.length,
2215
+ hideNavigation: navigation.length === 0,
2201
2216
  slots: {
2202
2217
  toolbarActions: () => null,
2203
2218
  toolbarAccount: ToolbarAccount,
@@ -2205,7 +2220,7 @@ var LayoutProvider = (props) => {
2205
2220
  },
2206
2221
  children: [
2207
2222
  props.children,
2208
- /* @__PURE__ */ jsx16(DevelopmentBanner, { hasNavigationRoutes: !!navigation.length }),
2223
+ /* @__PURE__ */ jsx16(DevelopmentBanner, { hasNavigationRoutes: navigation.length > 0 }),
2209
2224
  (isFetching || isMutating) && /* @__PURE__ */ jsx16(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
2210
2225
  ]
2211
2226
  }
@@ -2244,10 +2259,10 @@ var FormAutocomplete = ({ textFieldProps, ...autocompleteProps }) => {
2244
2259
  onBlur: field.handleBlur,
2245
2260
  "aria-label": field.name,
2246
2261
  ...autocompleteProps,
2247
- renderInput: (params) => /* @__PURE__ */ jsx17(
2262
+ renderInput: (parameters) => /* @__PURE__ */ jsx17(
2248
2263
  TextField,
2249
2264
  {
2250
- ...params,
2265
+ ...parameters,
2251
2266
  name: field.name,
2252
2267
  error: isTouched && hasError,
2253
2268
  helperText: isTouched && helperText,
@@ -2273,7 +2288,7 @@ var FormCheckbox = (props) => {
2273
2288
  {
2274
2289
  name: field.name,
2275
2290
  checked: Boolean(field.state.value),
2276
- onChange: (e) => field.handleChange(e.target.checked),
2291
+ onChange: (event) => field.handleChange(event.target.checked),
2277
2292
  onBlur: field.handleBlur,
2278
2293
  "aria-label": field.name,
2279
2294
  ...props
@@ -2379,7 +2394,7 @@ var FormRadioGroup = ({ label, options, ...props }) => {
2379
2394
  {
2380
2395
  name: field.name,
2381
2396
  value: field.state.value ?? "",
2382
- onChange: (e) => field.handleChange(e.target.value),
2397
+ onChange: (event) => field.handleChange(event.target.value),
2383
2398
  onBlur: field.handleBlur,
2384
2399
  "aria-label": field.name,
2385
2400
  ...props,
@@ -2426,9 +2441,9 @@ import { Button as Button2 } from "@mui/material";
2426
2441
  import { jsx as jsx24 } from "react/jsx-runtime";
2427
2442
  var FormSubmitButton = (props) => {
2428
2443
  const form = useFormContext();
2429
- const handleClick = (e) => {
2430
- e.preventDefault();
2431
- e.stopPropagation();
2444
+ const handleClick = (event) => {
2445
+ event.preventDefault();
2446
+ event.stopPropagation();
2432
2447
  form.handleSubmit();
2433
2448
  };
2434
2449
  return /* @__PURE__ */ jsx24(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx24(
@@ -2459,7 +2474,7 @@ var FormSwitch = (props) => {
2459
2474
  {
2460
2475
  name: field.name,
2461
2476
  checked: Boolean(field.state.value),
2462
- onChange: (e) => field.handleChange(e.target.checked),
2477
+ onChange: (event) => field.handleChange(event.target.checked),
2463
2478
  onBlur: field.handleBlur,
2464
2479
  "aria-label": field.name,
2465
2480
  ...props
@@ -2483,7 +2498,7 @@ var FormTextField = (props) => {
2483
2498
  {
2484
2499
  name: field.name,
2485
2500
  value: field.state.value ?? "",
2486
- onChange: (e) => field.handleChange(e.target.value),
2501
+ onChange: (event) => field.handleChange(event.target.value),
2487
2502
  onBlur: field.handleBlur,
2488
2503
  error: isTouched && hasError,
2489
2504
  helperText: isTouched && helperText,
@@ -2532,7 +2547,7 @@ var useGetFileMetas = (subId, options) => {
2532
2547
  const { appTitle } = useLayout();
2533
2548
  return useQuery({
2534
2549
  ...options,
2535
- queryKey: [QUERY_KEY, "meta", subId],
2550
+ queryKey: [QUERY_KEY, "meta", subId, appTitle],
2536
2551
  queryFn: ({ signal }) => wczApiClient.request({
2537
2552
  url: `${BASE_URL}/v1/meta?appName=${appTitle}&subId=${subId}`,
2538
2553
  method: "GET",
@@ -2546,7 +2561,7 @@ var useGetFileThumbnail = (meta, options) => {
2546
2561
  const { appTitle } = useLayout();
2547
2562
  return useQuery({
2548
2563
  ...options,
2549
- queryKey: [QUERY_KEY, "thumbnail", meta?.id],
2564
+ queryKey: [QUERY_KEY, "thumbnail", meta?.id, appTitle],
2550
2565
  queryFn: ({ signal }) => wczApiClient.request({
2551
2566
  url: `${BASE_URL}/v1/thumbnail?appName=${appTitle}&id=${meta?.id}`,
2552
2567
  method: "GET",
@@ -2564,7 +2579,7 @@ var useGetFile = (meta, options) => {
2564
2579
  const { appTitle } = useLayout();
2565
2580
  return useQuery({
2566
2581
  ...options,
2567
- queryKey: [QUERY_KEY, meta?.id],
2582
+ queryKey: [QUERY_KEY, meta?.id, appTitle],
2568
2583
  queryFn: ({ signal }) => wczApiClient.request({
2569
2584
  url: `${BASE_URL}/v1?appName=${appTitle}&id=${meta?.id}`,
2570
2585
  method: "GET",
@@ -2672,7 +2687,7 @@ var useUploadFile = ({ subId, onSuccess, onError }) => {
2672
2687
  }
2673
2688
  });
2674
2689
  const previousUploads = await upload.findPreviousUploads();
2675
- if (previousUploads.length) {
2690
+ if (previousUploads.length > 0) {
2676
2691
  upload.resumeFromPreviousUpload(previousUploads[0]);
2677
2692
  }
2678
2693
  upload.start();