@headless-adminapp/app 0.0.8-0.0.9-alpha.1.0 → 0.0.12-alpha.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.
@@ -1,2 +1,2 @@
1
- export { SchemaExperienceBuilder } from './SchemaExperienceBuilder';
2
- export { CommandBuilder } from './CommandBuilder';
1
+ export { SchemaExperienceBuilder, type SchemaExperienceBuilderDefaults, } from './SchemaExperienceBuilder';
2
+ export { CommandBuilder, localizedLabel } from './CommandBuilder';
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandBuilder = exports.SchemaExperienceBuilder = void 0;
3
+ exports.localizedLabel = exports.CommandBuilder = exports.SchemaExperienceBuilder = void 0;
4
4
  var SchemaExperienceBuilder_1 = require("./SchemaExperienceBuilder");
5
5
  Object.defineProperty(exports, "SchemaExperienceBuilder", { enumerable: true, get: function () { return SchemaExperienceBuilder_1.SchemaExperienceBuilder; } });
6
6
  var CommandBuilder_1 = require("./CommandBuilder");
7
7
  Object.defineProperty(exports, "CommandBuilder", { enumerable: true, get: function () { return CommandBuilder_1.CommandBuilder; } });
8
+ Object.defineProperty(exports, "localizedLabel", { enumerable: true, get: function () { return CommandBuilder_1.localizedLabel; } });
@@ -9,3 +9,4 @@ export * from './useMainFormCommands';
9
9
  export * from './useRecordId';
10
10
  export * from './useRecordTitle';
11
11
  export * from './useSelectedForm';
12
+ export * from './useLoadFormGridPage';
@@ -25,3 +25,4 @@ __exportStar(require("./useMainFormCommands"), exports);
25
25
  __exportStar(require("./useRecordId"), exports);
26
26
  __exportStar(require("./useRecordTitle"), exports);
27
27
  __exportStar(require("./useSelectedForm"), exports);
28
+ __exportStar(require("./useLoadFormGridPage"), exports);
@@ -0,0 +1,4 @@
1
+ export { DataFormContext, type DataFormContextState } from './context';
2
+ export * from './hooks';
3
+ export * from './utils';
4
+ export { DataFormProvider } from './DataFormProvider';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.DataFormProvider = exports.DataFormContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "DataFormContext", { enumerable: true, get: function () { return context_1.DataFormContext; } });
20
+ __exportStar(require("./hooks"), exports);
21
+ __exportStar(require("./utils"), exports);
22
+ var DataFormProvider_1 = require("./DataFormProvider");
23
+ Object.defineProperty(exports, "DataFormProvider", { enumerable: true, get: function () { return DataFormProvider_1.DataFormProvider; } });
@@ -3,6 +3,8 @@ import { Form } from '@headless-adminapp/core/experience/form';
3
3
  import { InferredSchemaType, Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
4
4
  import { IDataService } from '@headless-adminapp/core/transport';
5
5
  import { Nullable } from '@headless-adminapp/core/types';
6
+ import { MemoizedFunction } from 'lodash';
7
+ import { ResolverResult } from 'react-hook-form';
6
8
  import * as yup from 'yup';
7
9
  import { FormValidationStringSet } from '../../form/FormValidationStringContext';
8
10
  export declare function getModifiedValues(initialValues: any, values: any, exclude?: string[]): Record<string, any>;
@@ -32,7 +34,7 @@ export declare function getInitialValues({ cloneRecord, form, record, recordId,
32
34
  schema: Schema<SchemaAttributes>;
33
35
  defaultParameters: Record<string, any>;
34
36
  }): Nullable<InferredSchemaType<SchemaAttributes>>;
35
- export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>({ form, schema, readonlyAttributes, formReadOnly, getSchema, language, strings, }: {
37
+ interface FormValidatorOptions<A extends SchemaAttributes = SchemaAttributes> {
36
38
  schema: Schema<A>;
37
39
  form: Form<A>;
38
40
  language: string;
@@ -40,7 +42,9 @@ export declare const formValidator: (<A extends SchemaAttributes = SchemaAttribu
40
42
  readonlyAttributes?: string[];
41
43
  strings: FormValidationStringSet;
42
44
  getSchema: (logicalName: string) => Schema;
43
- }) => (values: Record<string, any>, context: any, options: any) => Promise<import("react-hook-form").ResolverResult<{}>>) & import("lodash").MemoizedFunction;
45
+ }
46
+ type FormValidator = (<A extends SchemaAttributes = SchemaAttributes>(options: FormValidatorOptions<A>) => (values: Record<string, any>, context: any, options: any) => Promise<ResolverResult<{}>>) & MemoizedFunction;
47
+ export declare const formValidator: FormValidator;
44
48
  export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>({ columns, editableGrids, language, schema, strings, readonlyAttributes, }: {
45
49
  schema: Schema<A>;
46
50
  columns: string[];
@@ -57,6 +61,6 @@ export declare const generateValidationSchema: (<A extends SchemaAttributes = Sc
57
61
  [x: string]: any;
58
62
  }, yup.AnyObject, {
59
63
  [x: string]: any;
60
- }, "">) & import("lodash").MemoizedFunction;
61
- export declare const generateAttributeValidationSchema: ((attribute: Attribute, language: string, strings: FormValidationStringSet) => yup.Schema<any, any, any, "">) & import("lodash").MemoizedFunction;
64
+ }, "">) & MemoizedFunction;
65
+ export declare const generateAttributeValidationSchema: ((attribute: Attribute, language: string, strings: FormValidationStringSet) => yup.Schema<any, any, any, "">) & MemoizedFunction;
62
66
  export {};
@@ -1,3 +1,3 @@
1
1
  export { getLocalizedOperatorOptions } from './utils';
2
2
  export { defaultOperatorStrings } from './constants';
3
- export type { OperatorStrings } from './types';
3
+ export type { OperatorStrings, OperatorOption } from './types';
@@ -17,3 +17,4 @@ export * from './useMaxRecords';
17
17
  export * from './useSearchText';
18
18
  export * from './useSelectedView';
19
19
  export * from './useSubGridCommands';
20
+ export * from './useLoadMainGridPage';
@@ -33,3 +33,4 @@ __exportStar(require("./useMaxRecords"), exports);
33
33
  __exportStar(require("./useSearchText"), exports);
34
34
  __exportStar(require("./useSelectedView"), exports);
35
35
  __exportStar(require("./useSubGridCommands"), exports);
36
+ __exportStar(require("./useLoadMainGridPage"), exports);
@@ -0,0 +1,5 @@
1
+ export { GridContext, type GridContextState, type TransformedViewColumn, } from './context';
2
+ export * from './hooks';
3
+ export { type OperatorStrings, type OperatorOption, defaultOperatorStrings, getLocalizedOperatorOptions, } from './column-filter';
4
+ export { DataGridProvider } from './DataGridProvider';
5
+ export { transformViewColumns } from './DataGridProvider/transformViewColumns';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.transformViewColumns = exports.DataGridProvider = exports.getLocalizedOperatorOptions = exports.defaultOperatorStrings = exports.GridContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "GridContext", { enumerable: true, get: function () { return context_1.GridContext; } });
20
+ __exportStar(require("./hooks"), exports);
21
+ var column_filter_1 = require("./column-filter");
22
+ Object.defineProperty(exports, "defaultOperatorStrings", { enumerable: true, get: function () { return column_filter_1.defaultOperatorStrings; } });
23
+ Object.defineProperty(exports, "getLocalizedOperatorOptions", { enumerable: true, get: function () { return column_filter_1.getLocalizedOperatorOptions; } });
24
+ var DataGridProvider_1 = require("./DataGridProvider");
25
+ Object.defineProperty(exports, "DataGridProvider", { enumerable: true, get: function () { return DataGridProvider_1.DataGridProvider; } });
26
+ var transformViewColumns_1 = require("./DataGridProvider/transformViewColumns");
27
+ Object.defineProperty(exports, "transformViewColumns", { enumerable: true, get: function () { return transformViewColumns_1.transformViewColumns; } });
@@ -0,0 +1 @@
1
+ export { FormValidationStringContext, type FormValidationStringSet, defaultFormValidationStrings, useFormValidationStrings, } from './FormValidationStringContext';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useFormValidationStrings = exports.defaultFormValidationStrings = exports.FormValidationStringContext = void 0;
4
+ var FormValidationStringContext_1 = require("./FormValidationStringContext");
5
+ Object.defineProperty(exports, "FormValidationStringContext", { enumerable: true, get: function () { return FormValidationStringContext_1.FormValidationStringContext; } });
6
+ Object.defineProperty(exports, "defaultFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.defaultFormValidationStrings; } });
7
+ Object.defineProperty(exports, "useFormValidationStrings", { enumerable: true, get: function () { return FormValidationStringContext_1.useFormValidationStrings; } });
@@ -0,0 +1,3 @@
1
+ import { InsightsState } from '@headless-adminapp/core/experience/insights';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ export declare function useInsightsState<S extends SchemaAttributes = SchemaAttributes>(): InsightsState<S>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInsightsState = useInsightsState;
4
+ const mutable_1 = require("../../mutable");
5
+ const context_1 = require("../context");
6
+ function useInsightsState() {
7
+ return (0, mutable_1.useContextSelector)(context_1.InsightsContext, (state) => state);
8
+ }
@@ -0,0 +1,2 @@
1
+ export { InsightsContext } from './context';
2
+ export * from './hooks';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.InsightsContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "InsightsContext", { enumerable: true, get: function () { return context_1.InsightsContext; } });
20
+ __exportStar(require("./hooks"), exports);
@@ -1,3 +1,3 @@
1
- export { createContext, useContextSelector, useContextSetValue, useCreateContextStore, type ContextValue, } from './context';
2
- export { useMutableState, useMutableStateSelector } from './state';
1
+ export { createContext, useContextSelector, useContextSetValue, useCreateContextStore, useContextValueSetter, type ContextValue, } from './context';
2
+ export { useMutableState, useMutableStateSelector, type MutableState, } from './state';
3
3
  export * from './type';
@@ -14,12 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useMutableStateSelector = exports.useMutableState = exports.useCreateContextStore = exports.useContextSetValue = exports.useContextSelector = exports.createContext = void 0;
17
+ exports.useMutableStateSelector = exports.useMutableState = exports.useContextValueSetter = exports.useCreateContextStore = exports.useContextSetValue = exports.useContextSelector = exports.createContext = void 0;
18
18
  var context_1 = require("./context");
19
19
  Object.defineProperty(exports, "createContext", { enumerable: true, get: function () { return context_1.createContext; } });
20
20
  Object.defineProperty(exports, "useContextSelector", { enumerable: true, get: function () { return context_1.useContextSelector; } });
21
21
  Object.defineProperty(exports, "useContextSetValue", { enumerable: true, get: function () { return context_1.useContextSetValue; } });
22
22
  Object.defineProperty(exports, "useCreateContextStore", { enumerable: true, get: function () { return context_1.useCreateContextStore; } });
23
+ Object.defineProperty(exports, "useContextValueSetter", { enumerable: true, get: function () { return context_1.useContextValueSetter; } });
23
24
  var state_1 = require("./state");
24
25
  Object.defineProperty(exports, "useMutableState", { enumerable: true, get: function () { return state_1.useMutableState; } });
25
26
  Object.defineProperty(exports, "useMutableStateSelector", { enumerable: true, get: function () { return state_1.useMutableStateSelector; } });
@@ -2,3 +2,4 @@ export * from './usePathname';
2
2
  export * from './useSearchParams';
3
3
  export * from './useRouter';
4
4
  export * from './useBasePath';
5
+ export * from './useRouteResolver';
@@ -18,3 +18,4 @@ __exportStar(require("./usePathname"), exports);
18
18
  __exportStar(require("./useSearchParams"), exports);
19
19
  __exportStar(require("./useRouter"), exports);
20
20
  __exportStar(require("./useBasePath"), exports);
21
+ __exportStar(require("./useRouteResolver"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "0.0.8-0.0.9-alpha.1.0",
3
+ "version": "0.0.12-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,5 +41,5 @@
41
41
  "clsx": "2.1.1",
42
42
  "react-custom-scrollbars-2": "^4.5.0"
43
43
  },
44
- "gitHead": "fd2c574005892ac216056df7b69837112ca35bf9"
44
+ "gitHead": "620194bcd40d1f234186af49ce976053bd8231b7"
45
45
  }
@@ -1,2 +1,5 @@
1
- export { SchemaExperienceBuilder } from './SchemaExperienceBuilder';
2
- export { CommandBuilder } from './CommandBuilder';
1
+ export {
2
+ SchemaExperienceBuilder,
3
+ type SchemaExperienceBuilderDefaults,
4
+ } from './SchemaExperienceBuilder';
5
+ export { CommandBuilder, localizedLabel } from './CommandBuilder';
@@ -9,3 +9,4 @@ export * from './useMainFormCommands';
9
9
  export * from './useRecordId';
10
10
  export * from './useRecordTitle';
11
11
  export * from './useSelectedForm';
12
+ export * from './useLoadFormGridPage';
@@ -0,0 +1,4 @@
1
+ export { DataFormContext, type DataFormContextState } from './context';
2
+ export * from './hooks';
3
+ export * from './utils';
4
+ export { DataFormProvider } from './DataFormProvider';
@@ -11,7 +11,8 @@ import {
11
11
  import { IDataService } from '@headless-adminapp/core/transport';
12
12
  import { Nullable } from '@headless-adminapp/core/types';
13
13
  import { yupResolver } from '@hookform/resolvers/yup';
14
- import { memoize } from 'lodash';
14
+ import { memoize, MemoizedFunction } from 'lodash';
15
+ import { ResolverResult } from 'react-hook-form';
15
16
  import * as yup from 'yup';
16
17
 
17
18
  import { localizedLabel } from '../../builders/CommandBuilder';
@@ -317,7 +318,26 @@ export function getInitialValues({
317
318
  }, {} as Nullable<InferredSchemaType<SchemaAttributes>>);
318
319
  }
319
320
 
320
- export const formValidator = memoize(
321
+ interface FormValidatorOptions<A extends SchemaAttributes = SchemaAttributes> {
322
+ schema: Schema<A>;
323
+ form: Form<A>;
324
+ language: string;
325
+ formReadOnly?: boolean;
326
+ readonlyAttributes?: string[];
327
+ strings: FormValidationStringSet;
328
+ getSchema: (logicalName: string) => Schema;
329
+ }
330
+
331
+ type FormValidator = (<A extends SchemaAttributes = SchemaAttributes>(
332
+ options: FormValidatorOptions<A>
333
+ ) => (
334
+ values: Record<string, any>,
335
+ context: any,
336
+ options: any
337
+ ) => Promise<ResolverResult<{}>>) &
338
+ MemoizedFunction;
339
+
340
+ export const formValidator: FormValidator = memoize(
321
341
  function formValidator<A extends SchemaAttributes = SchemaAttributes>({
322
342
  form,
323
343
  schema,
@@ -326,15 +346,7 @@ export const formValidator = memoize(
326
346
  getSchema,
327
347
  language,
328
348
  strings,
329
- }: {
330
- schema: Schema<A>;
331
- form: Form<A>;
332
- language: string;
333
- formReadOnly?: boolean;
334
- readonlyAttributes?: string[];
335
- strings: FormValidationStringSet;
336
- getSchema: (logicalName: string) => Schema;
337
- }) {
349
+ }: FormValidatorOptions<A>) {
338
350
  return async (values: Record<string, any>, context: any, options: any) => {
339
351
  // console.log('formValidator', values);
340
352
  let validator = yup.object().shape({});
@@ -1,3 +1,3 @@
1
1
  export { getLocalizedOperatorOptions } from './utils';
2
2
  export { defaultOperatorStrings } from './constants';
3
- export type { OperatorStrings } from './types';
3
+ export type { OperatorStrings, OperatorOption } from './types';
@@ -17,3 +17,4 @@ export * from './useMaxRecords';
17
17
  export * from './useSearchText';
18
18
  export * from './useSelectedView';
19
19
  export * from './useSubGridCommands';
20
+ export * from './useLoadMainGridPage';
@@ -0,0 +1,14 @@
1
+ export {
2
+ GridContext,
3
+ type GridContextState,
4
+ type TransformedViewColumn,
5
+ } from './context';
6
+ export * from './hooks';
7
+ export {
8
+ type OperatorStrings,
9
+ type OperatorOption,
10
+ defaultOperatorStrings,
11
+ getLocalizedOperatorOptions,
12
+ } from './column-filter';
13
+ export { DataGridProvider } from './DataGridProvider';
14
+ export { transformViewColumns } from './DataGridProvider/transformViewColumns';
@@ -0,0 +1,6 @@
1
+ export {
2
+ FormValidationStringContext,
3
+ type FormValidationStringSet,
4
+ defaultFormValidationStrings,
5
+ useFormValidationStrings,
6
+ } from './FormValidationStringContext';
@@ -0,0 +1,14 @@
1
+ import { InsightsState } from '@headless-adminapp/core/experience/insights';
2
+ import { SchemaAttributes } from '@headless-adminapp/core/schema';
3
+
4
+ import { useContextSelector } from '../../mutable';
5
+ import { InsightsContext } from '../context';
6
+
7
+ export function useInsightsState<
8
+ S extends SchemaAttributes = SchemaAttributes
9
+ >() {
10
+ return useContextSelector(
11
+ InsightsContext,
12
+ (state) => state as unknown as InsightsState<S>
13
+ );
14
+ }
@@ -0,0 +1,2 @@
1
+ export { InsightsContext } from './context';
2
+ export * from './hooks';
@@ -3,7 +3,12 @@ export {
3
3
  useContextSelector,
4
4
  useContextSetValue,
5
5
  useCreateContextStore,
6
+ useContextValueSetter,
6
7
  type ContextValue,
7
8
  } from './context';
8
- export { useMutableState, useMutableStateSelector } from './state';
9
+ export {
10
+ useMutableState,
11
+ useMutableStateSelector,
12
+ type MutableState,
13
+ } from './state';
9
14
  export * from './type';
@@ -2,3 +2,4 @@ export * from './usePathname';
2
2
  export * from './useSearchParams';
3
3
  export * from './useRouter';
4
4
  export * from './useBasePath';
5
+ export * from './useRouteResolver';