@headless-adminapp/app 0.0.17-alpha.10 → 0.0.17-alpha.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.
@@ -1,7 +1,7 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
2
  import { AuthProviderPlaceholderProps } from '../auth';
3
3
  interface AuthWrapperProps {
4
- Placeholder: FC<AuthProviderPlaceholderProps>;
4
+ Placeholder?: FC<AuthProviderPlaceholderProps>;
5
5
  }
6
6
  export declare const AuthWrapper: FC<PropsWithChildren<AuthWrapperProps>>;
7
7
  export {};
@@ -4,7 +4,10 @@ exports.AuthWrapper = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const auth_1 = require("../auth");
6
6
  const mutable_1 = require("../mutable");
7
- const AuthWrapper = ({ children, Placeholder, }) => {
7
+ const DefaultPlaceHolder = () => {
8
+ return null;
9
+ };
10
+ const AuthWrapper = ({ children, Placeholder = DefaultPlaceHolder, }) => {
8
11
  const state = (0, mutable_1.useContextSelector)(auth_1.AuthContext, (state) => state);
9
12
  if (state.loadError) {
10
13
  return (0, jsx_runtime_1.jsx)(Placeholder, { loadingError: true, retry: state.loadSession });
@@ -8,10 +8,10 @@ import { RouteProviderProps } from '../route/RouteProvider';
8
8
  export interface LayoutProviderProps {
9
9
  routeProps: RouteProviderProps;
10
10
  queryClient: QueryClient;
11
- localeProps: LocaleProviderProps;
11
+ localeProps?: LocaleProviderProps;
12
12
  dataService: IDataService;
13
- authProps: AuthProviderProps;
14
- authPlaceholder: FC<AuthProviderPlaceholderProps>;
13
+ authProps?: AuthProviderProps;
14
+ authPlaceholder?: FC<AuthProviderPlaceholderProps>;
15
15
  metadataProps: MetadataProviderProps;
16
16
  containers: {
17
17
  DialogContainer: FC;
@@ -2,6 +2,6 @@ import { FC, PropsWithChildren } from 'react';
2
2
  import { SessionResolver, UnauthorizeReason } from './types';
3
3
  export interface AuthProviderProps {
4
4
  onUnauthenticated?: (reason: UnauthorizeReason) => void;
5
- sessionResolver: SessionResolver;
5
+ sessionResolver?: SessionResolver;
6
6
  }
7
7
  export declare const AuthProvider: FC<PropsWithChildren<AuthProviderProps>>;
@@ -14,7 +14,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
14
14
  const react_1 = require("react");
15
15
  const context_1 = require("../mutable/context");
16
16
  const context_2 = require("./context");
17
- const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
17
+ const defaultSessionResolver = () => __awaiter(void 0, void 0, void 0, function* () {
18
+ return {
19
+ email: 'demo@example.com',
20
+ fullName: 'Demo User',
21
+ exp: Date.now() / 1000 + 60 * 60 * 24,
22
+ };
23
+ });
24
+ const AuthProvider = ({ sessionResolver = defaultSessionResolver, onUnauthenticated, children, }) => {
18
25
  const onUnauthenticatedRef = (0, react_1.useRef)(onUnauthenticated);
19
26
  onUnauthenticatedRef.current = onUnauthenticated;
20
27
  const onUnauthenticatedInternal = (0, react_1.useCallback)((reason) => {
@@ -28,10 +28,10 @@ function getControls(form) {
28
28
  return controls;
29
29
  }
30
30
  function getColumns(form) {
31
- var _a;
31
+ var _a, _b;
32
32
  const columns = Array.from(new Set([
33
33
  ...((_a = form.experience.includeAttributes) !== null && _a !== void 0 ? _a : []),
34
- ...form.experience.headerControls,
34
+ ...((_b = form.experience.headerControls) !== null && _b !== void 0 ? _b : []),
35
35
  ...getControls(form)
36
36
  .filter((control) => control.type === 'standard')
37
37
  .map((control) => control.attributeName),
@@ -463,8 +463,42 @@ const booleanOperatorOptions = [
463
463
  controls: [],
464
464
  },
465
465
  ];
466
- const idOperatorOptions = [];
467
- const attachmentOperatorOptions = [];
466
+ const idOperatorOptions = [
467
+ {
468
+ value: 'not-null',
469
+ labelKey: 'containsData',
470
+ controls: [],
471
+ },
472
+ {
473
+ value: 'null',
474
+ labelKey: 'doesNotContainData',
475
+ controls: [],
476
+ },
477
+ ];
478
+ const attachmentOperatorOptions = [
479
+ {
480
+ value: 'not-null',
481
+ labelKey: 'containsData',
482
+ controls: [],
483
+ },
484
+ {
485
+ value: 'null',
486
+ labelKey: 'doesNotContainData',
487
+ controls: [],
488
+ },
489
+ ];
490
+ const mixedOperatorOptions = [
491
+ {
492
+ value: 'not-null',
493
+ labelKey: 'containsData',
494
+ controls: [],
495
+ },
496
+ {
497
+ value: 'null',
498
+ labelKey: 'doesNotContainData',
499
+ controls: [],
500
+ },
501
+ ];
468
502
  exports.operatorOptions = {
469
503
  id: idOperatorOptions,
470
504
  boolean: booleanOperatorOptions,
@@ -476,7 +510,7 @@ exports.operatorOptions = {
476
510
  number: numberOperatorOptions,
477
511
  string: stringOperatorOptions,
478
512
  attachment: attachmentOperatorOptions,
479
- mixed: [],
513
+ mixed: mixedOperatorOptions,
480
514
  daterange: [],
481
515
  lookups: [],
482
516
  };
@@ -1,7 +1,7 @@
1
1
  import { Locale } from '@headless-adminapp/core/experience/locale';
2
2
  import { FC, PropsWithChildren } from 'react';
3
3
  export interface LocaleProviderProps {
4
- locale: string;
4
+ locale?: string;
5
5
  options?: {
6
6
  direction?: Locale['direction'];
7
7
  dateFormats?: Locale['dateFormats'];
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const locale_1 = require("@headless-adminapp/core/experience/locale");
6
6
  const react_1 = require("react");
7
7
  const context_1 = require("./context");
8
- const LocaleProvider = ({ children, locale, options, }) => {
8
+ const LocaleProvider = ({ children, locale = 'en-US', options, }) => {
9
9
  const localeState = (0, react_1.useMemo)(() => {
10
10
  return (0, locale_1.getLocale)(locale, options);
11
11
  }, [locale, options]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "0.0.17-alpha.10",
3
+ "version": "0.0.17-alpha.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -39,5 +39,5 @@
39
39
  "react-hook-form": "7.52.2",
40
40
  "yup": "^1.4.0"
41
41
  },
42
- "gitHead": "533252eef44109b7973eefdda309a87407ad0ce3"
42
+ "gitHead": "0ffc57a7efdb38bd07f8e880c8727da517a91c96"
43
43
  }
@@ -7,7 +7,7 @@ export interface RouteProviderProps {
7
7
  pathname: string;
8
8
  searchParams: ReadonlyURLSearchParams;
9
9
  basePath?: string;
10
- routeResolver: RouteResolver;
11
- isRouteActive: IsRouteActive;
10
+ routeResolver?: RouteResolver;
11
+ isRouteActive?: IsRouteActive;
12
12
  }
13
13
  export declare const RouteProvider: FC<PropsWithChildren<RouteProviderProps>>;
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RouteProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const route_1 = require("@headless-adminapp/core/experience/route");
5
6
  const react_1 = require("react");
6
7
  const context_1 = require("./context");
7
- const RouteProvider = ({ children, pathname, router, searchParams, basePath, routeResolver, isRouteActive, }) => {
8
+ const defaultRouteResolver = (0, route_1.createRouteResolver)(route_1.defaultRouteInfo);
9
+ const defaultIsRouteActive = (0, route_1.createIsRouteActive)(route_1.defaultRouteInfo);
10
+ const RouteProvider = ({ children, pathname, router, searchParams, basePath, routeResolver = defaultRouteResolver, isRouteActive = defaultIsRouteActive, }) => {
8
11
  const basePathRef = (0, react_1.useRef)(basePath);
9
12
  basePathRef.current = basePath;
10
13
  const routeResolverRef = (0, react_1.useRef)(routeResolver);