@luminix/mui-cms 0.0.1-beta.9 → 0.1.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.
Files changed (31) hide show
  1. package/bundle/mui-cms.bundle.iife.js +37 -54
  2. package/dist/mui-cms.js +3324 -1619
  3. package/package.json +6 -7
  4. package/types/components/ModelIndex/InstanceActions.d.ts +1 -1
  5. package/types/{providers → components/providers}/ModelProvider.d.ts +1 -1
  6. package/types/{providers → components/providers}/NotificationProvider.d.ts +1 -1
  7. package/types/{providers → components/providers}/TableProvider.d.ts +1 -1
  8. package/types/dist.d.ts +6 -6
  9. package/types/facades/Cms.d.ts +6 -30
  10. package/types/facades/Filter.d.ts +6 -23
  11. package/types/hooks/useCurrentModel.d.ts +1 -1
  12. package/types/hooks/useLayoutConfig.d.ts +1 -1
  13. package/types/hooks/useSelection.d.ts +2 -2
  14. package/types/providers/CmsServiceProvider.d.ts +15 -0
  15. package/types/providers/i18NextServiceProvider.d.ts +14 -0
  16. package/types/services/CmsService.d.ts +20 -0
  17. package/types/services/FilterService.d.ts +14 -0
  18. package/types/support/ModelIndex/Filter/inputs.d.ts +1 -1
  19. package/types/support/ModelIndex/relation.d.ts +2 -2
  20. package/types/types/Contexts.d.ts +2 -2
  21. package/types/types/PropTypes.d.ts +3 -7
  22. package/types/types/Reducers.d.ts +1 -1
  23. package/types/types/Table.d.ts +3 -3
  24. package/types/plugins/CmsPlugin.d.ts +0 -18
  25. package/types/plugins/i18NextPlugin.d.ts +0 -19
  26. package/types/support/array.d.ts +0 -9
  27. package/types/support/date.d.ts +0 -1
  28. package/types/support/searchParams.d.ts +0 -1
  29. package/types/support/string.d.ts +0 -3
  30. /package/types/{providers → components/providers}/DialogProvider.d.ts +0 -0
  31. /package/types/{providers → components/providers}/LayoutProvider.d.ts +0 -0
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@luminix/mui-cms",
3
- "version": "0.0.1-beta.9",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
- "main": "dist/mui-cms.js",
5
+ "main": "bundle/mui-cms.js",
6
+ "module": "dist/mui-cms.js",
6
7
  "types": "types/index.d.ts",
7
8
  "scripts": {
8
9
  "dev": "vite --port=3333 --config=vite.config.dev.ts",
@@ -17,20 +18,18 @@
17
18
  "@emotion/react": "^11.13.0",
18
19
  "@emotion/styled": "^11.13.0",
19
20
  "@fontsource/roboto": "^5.0.12",
20
- "@luminix/core": "^0.0.1-beta.21",
21
- "@luminix/react": "^0.0.1-beta.22",
21
+ "@luminix/core": "^0.2.1",
22
+ "@luminix/react": "^0.1.1",
23
+ "@luminix/support": "^0.3.0",
22
24
  "@mui/icons-material": "^5.16.5",
23
25
  "@mui/material": "^5.16.5",
24
- "axios": "^1.6.4",
25
26
  "i18next": "^23.12.2",
26
- "lodash": "^4.17.21",
27
27
  "react": "^18.3.1",
28
28
  "react-dom": "^18.3.1",
29
29
  "react-i18next": "^15.0.1",
30
30
  "react-router-dom": "6.25.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/lodash": "^4.17.0",
34
33
  "@types/react": "^18.3.3",
35
34
  "@types/react-dom": "^18.3.0",
36
35
  "@typescript-eslint/eslint-plugin": "^7.2.0",
@@ -1,4 +1,4 @@
1
- import { Model } from '@luminix/core';
1
+ import { ModelType as Model } from '@luminix/core';
2
2
  declare const InstanceActions: ({ item }: {
3
3
  item: Model;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
- import { ModelProviderProps } from '../types/PropTypes';
1
+ import { ModelProviderProps } from '../../types/PropTypes';
2
2
  declare const ModelProvider: React.FunctionComponent<ModelProviderProps>;
3
3
  export default ModelProvider;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { NotificationProviderProps } from '../types/PropTypes';
2
+ import { NotificationProviderProps } from '../../types/PropTypes';
3
3
  declare const NotificationProvider: React.FC<NotificationProviderProps>;
4
4
  export default NotificationProvider;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
- import { TableProps } from '../types/PropTypes';
2
+ import { TableProps } from '../../types/PropTypes';
3
3
  declare const TableProvider: React.FunctionComponent<TableProps>;
4
4
  export default TableProvider;
package/types/dist.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { default as CmsPlugin } from './plugins/CmsPlugin';
1
+ import { default as CmsServiceProvider } from './providers/CmsServiceProvider';
2
2
  import { default as LuminixCms } from './components/LuminixCms';
3
3
  import { default as Link } from './components/Link';
4
- import { default as DialogProvider } from './providers/DialogProvider';
5
- import { default as LayoutProvider } from './providers/LayoutProvider';
6
- import { default as ModelProvider } from './providers/ModelProvider';
7
- import { default as NotificationProvider } from './providers/NotificationProvider';
4
+ import { default as DialogProvider } from './components/providers/DialogProvider';
5
+ import { default as LayoutProvider } from './components/providers/LayoutProvider';
6
+ import { default as ModelProvider } from './components/providers/ModelProvider';
7
+ import { default as NotificationProvider } from './components/providers/NotificationProvider';
8
8
  import { default as useActionEvent } from './hooks/useActionEvent';
9
9
  import { default as useBackButton } from './hooks/useBackButton';
10
10
  import { default as useCurrentModel } from './hooks/useCurrentModel';
@@ -21,4 +21,4 @@ import { default as useSearch } from './hooks/useSearch';
21
21
  import { default as useSelection } from './hooks/useSelection';
22
22
  import { default as useSetPageTitle } from './hooks/useSetPageTitle';
23
23
  import { default as useTable } from './hooks/useTable';
24
- export { CmsPlugin, LuminixCms, Link, useActionEvent, useBackButton, useCurrentModel, useDialog, useDisplaceNotifications, useHandleError, useHasSearch, useIsDesktopMode, useLayoutConfig, useMenu, useNotify, usePageTitle, useSearch, useSelection, useSetPageTitle, useTable, DialogProvider, LayoutProvider, ModelProvider, NotificationProvider, };
24
+ export { CmsServiceProvider, LuminixCms, Link, useActionEvent, useBackButton, useCurrentModel, useDialog, useDisplaceNotifications, useHandleError, useHasSearch, useIsDesktopMode, useLayoutConfig, useMenu, useNotify, usePageTitle, useSearch, useSelection, useSetPageTitle, useTable, DialogProvider, LayoutProvider, ModelProvider, NotificationProvider, };
@@ -1,31 +1,7 @@
1
- import { default as React } from 'react';
2
- import { Model } from '@luminix/core';
3
- import { RouteObject } from 'react-router-dom';
4
- import { MenuItem } from '../types/Menu';
5
- import { ModelFormProps } from '@luminix/react/dist/types/Form';
6
- import { StaticAction, MassAction } from '../types/Table';
7
- import { ReducerCallback } from '@luminix/core/dist/types/Reducer';
8
- declare class CmsFacade {
9
- [key: string]: ReducerCallback;
10
- constructor();
11
- getComponents(): Record<string, React.ComponentType>;
12
- getComponent(name: string): React.ComponentType;
13
- getRoutes(): RouteObject[];
14
- getMenuItems(): MenuItem[];
15
- getModelFormProps(item: Model): ModelFormProps;
16
- getMassActions(ModelClass: typeof Model, currentTab: string): MassAction[];
17
- getInstanceActions(ModelClass: typeof Model, currentTab: string): StaticAction[];
18
- getStaticActions(ModelClass: typeof Model, currentTab: string): StaticAction[];
1
+ import { HasFacadeAccessor } from '@luminix/support';
2
+ import { CmsService } from '../services/CmsService';
3
+ declare class CmsFacade implements HasFacadeAccessor {
4
+ getFacadeAccessor(): string;
19
5
  }
20
- declare const _default: (new (...args: any[]) => {
21
- reducers: {
22
- [name: string]: import('@luminix/core/dist/types/Collection').Collection<import('@luminix/core/dist/types/Reducer').Reducer>;
23
- };
24
- reducer(name: string, callback: ReducerCallback, priority?: number): () => void;
25
- removeReducer(name: string, callback: ReducerCallback): void;
26
- getReducer(name: string): import('@luminix/core/dist/types/Collection').Collection<import('@luminix/core/dist/types/Reducer').Reducer>;
27
- hasReducer(name: string): boolean;
28
- clearReducer(name: string): void;
29
- flushReducers(): void;
30
- }) & typeof CmsFacade;
31
- export default _default;
6
+ declare const Cms: import('@luminix/support').FacadeOf<CmsService, CmsFacade>;
7
+ export default Cms;
@@ -1,24 +1,7 @@
1
- import { Model } from '@luminix/core';
2
- import { ReducerCallback } from '@luminix/core/dist/types/Reducer';
3
- import { InputOption } from '../types/PropTypes';
4
- import { FilterColumn, FilteredColumn } from '../types/Filter';
5
- declare class FilterFacade {
6
- [key: string]: ReducerCallback;
7
- getInputType(type: string): string;
8
- getOperators(): string[];
9
- getMatchingOperators(column: FilterColumn): InputOption[];
10
- getFilterableColumns(ModelClass: typeof Model): FilterColumn[];
11
- checkIfCanApplyFilters(columnsFilter: FilteredColumn[]): boolean;
1
+ import { HasFacadeAccessor } from '@luminix/support';
2
+ import { FilterService } from '../services/FilterService';
3
+ declare class FilterFacade implements HasFacadeAccessor {
4
+ getFacadeAccessor(): string;
12
5
  }
13
- declare const _default: (new (...args: any[]) => {
14
- reducers: {
15
- [name: string]: import('@luminix/core/dist/types/Collection').Collection<import('@luminix/core/dist/types/Reducer').Reducer>;
16
- };
17
- reducer(name: string, callback: ReducerCallback, priority?: number): () => void;
18
- removeReducer(name: string, callback: ReducerCallback): void;
19
- getReducer(name: string): import('@luminix/core/dist/types/Collection').Collection<import('@luminix/core/dist/types/Reducer').Reducer>;
20
- hasReducer(name: string): boolean;
21
- clearReducer(name: string): void;
22
- flushReducers(): void;
23
- }) & typeof FilterFacade;
24
- export default _default;
6
+ declare const Filter: import('@luminix/support').FacadeOf<FilterService, FilterFacade>;
7
+ export default Filter;
@@ -1 +1 @@
1
- export default function useCurrentModel(): typeof import('@luminix/core').Model;
1
+ export default function useCurrentModel(): typeof import('@luminix/core').ModelType;
@@ -5,4 +5,4 @@
5
5
  * @param {string} path The path to the configuration.
6
6
  * @param {unknown} defaultValue The default value to return if the configuration is not found.
7
7
  */
8
- export default function useLayoutConfig(path: string, defaultValue?: unknown): unknown;
8
+ export default function useLayoutConfig(path: string, defaultValue?: unknown): any;
@@ -1,6 +1,6 @@
1
- import { Model } from '@luminix/core';
1
+ import { ModelType as Model } from '@luminix/core';
2
2
  export default function useSelection(): {
3
- selected: import('@luminix/core/dist/types/Collection').Collection<Model>;
3
+ selected: import('@luminix/support').Collection<Model>;
4
4
  indeterminate: boolean;
5
5
  allSelected: boolean;
6
6
  isSelected: (item: Model) => boolean;
@@ -0,0 +1,15 @@
1
+ import { ServiceProvider } from '@luminix/support';
2
+ declare class CmsServiceProvider extends ServiceProvider {
3
+ static applyUserDefaults: boolean;
4
+ register(): void;
5
+ boot(): void;
6
+ private bootModels;
7
+ private bootRoutes;
8
+ private bootComponents;
9
+ private bootMenu;
10
+ private bootDefaultUserModifiers;
11
+ private bootMassActions;
12
+ private bootInstanceActions;
13
+ private bootStaticActions;
14
+ }
15
+ export default CmsServiceProvider;
@@ -0,0 +1,14 @@
1
+ import { ServiceProvider } from '@luminix/support';
2
+ declare class i18NextServiceProvider extends ServiceProvider {
3
+ register(): void;
4
+ boot(): void;
5
+ private initI18Next;
6
+ private translateModelNames;
7
+ private translateModelColumns;
8
+ private translateMenuEntries;
9
+ private translateMassActions;
10
+ private translateInstanceActions;
11
+ private translateStaticActions;
12
+ private translateFormLabels;
13
+ }
14
+ export default i18NextServiceProvider;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ import { ReducerCallback } from '@luminix/support';
3
+ import { ModelType } from '@luminix/core';
4
+ import { ModelFormProps } from '@luminix/react';
5
+ import { RouteObject } from 'react-router-dom';
6
+ import { MenuItem } from '../types/Menu';
7
+ import { StaticAction, MassAction } from '../types/Table';
8
+ export declare class CmsService {
9
+ [key: string]: ReducerCallback;
10
+ getComponents(): Record<string, React.ComponentType<any>>;
11
+ getComponent(name: string): React.ComponentType<any>;
12
+ getRoutes(): RouteObject[];
13
+ getMenuItems(): MenuItem[];
14
+ getModelFormProps(item: ModelType): ModelFormProps;
15
+ getMassActions(ModelClass: typeof ModelType, currentTab: string): MassAction[];
16
+ getInstanceActions(ModelClass: typeof ModelType, currentTab: string): StaticAction[];
17
+ getStaticActions(ModelClass: typeof ModelType, currentTab: string): StaticAction[];
18
+ }
19
+ declare const _default: import('@luminix/support').ReducibleOf<typeof CmsService, import('@luminix/support/types/Mixins/Reducible').ReducerMethodMap>;
20
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { ReducerCallback } from '@luminix/support';
2
+ import { ModelType } from '@luminix/core';
3
+ import { InputOption } from '../types/PropTypes';
4
+ import { FilterColumn, FilteredColumn } from '../types/Filter';
5
+ export declare class FilterService {
6
+ [key: string]: ReducerCallback;
7
+ getInputType(type: string): string;
8
+ getOperators(): string[];
9
+ getMatchingOperators(column: FilterColumn): InputOption[];
10
+ getFilterableColumns(ModelClass: typeof ModelType): FilterColumn[];
11
+ checkIfCanApplyFilters(columnsFilter: FilteredColumn[]): boolean;
12
+ }
13
+ declare const _default: import('@luminix/support').ReducibleOf<typeof FilterService, import('@luminix/support/types/Mixins/Reducible').ReducerMethodMap>;
14
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { Model } from '@luminix/core';
1
+ import { ModelType as Model } from '@luminix/core';
2
2
  export declare const changeValueFromArray: (input: any) => any;
3
3
  export declare const changeValueToArray: (input: any) => any;
4
4
  export declare const mountRelationModelOption: (ModelClass: typeof Model, key: string, input: string[] | number[]) => Promise<Model[]>;
@@ -1,4 +1,4 @@
1
- import { Model } from '@luminix/core';
2
- import { Collection } from '@luminix/core/dist/types/Collection';
1
+ import { ModelType as Model } from '@luminix/core';
2
+ import { Collection } from '@luminix/support';
3
3
  export declare const loadRelationOptions: (ModelClass: typeof Model, key: string, loadedOptions: Model[]) => Promise<Collection<Model>>;
4
4
  export declare const aggregateRelationOptions: (ModelClass: typeof Model, key: string, term: string | undefined, loadedOptions: Collection<Model>) => Promise<Collection<Model>>;
@@ -1,7 +1,7 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { SetURLSearchParams } from 'react-router-dom';
3
- import { Model } from '@luminix/core';
4
- import { Collection } from '@luminix/core/dist/types/Collection';
3
+ import { Collection } from '@luminix/support';
4
+ import { ModelType as Model } from '@luminix/core';
5
5
  import { CmsConfig } from './Config';
6
6
  import { Column, MassAction } from './Table';
7
7
  import { Notification, NotifyFunction } from './Notifications';
@@ -1,16 +1,12 @@
1
- import { Model } from '@luminix/core';
1
+ import { Collection, CollectionIteratorCallback } from '@luminix/support';
2
+ import { ModelType as Model, ModelPaginatedResponse, Scope } from '@luminix/core';
3
+ import { LuminixProviderProps } from '@luminix/react';
2
4
  import { DrawerProps as MuiDrawerProps, AppBarProps as MuiAppBarProps, BoxProps, DrawerProps, MenuProps, TableProps as MuiTableProps, StackProps, TableHeadProps as MuiTableHeadProps, TableBodyProps as MuiTableBodyProps, TableRowProps as MuiTableRowProps, ThemeOptions, BreadcrumbsOwnProps, SnackbarProps, AlertProps } from '@mui/material';
3
5
  import { ListTypeMap } from '@mui/material/List';
4
6
  import { DefaultComponentProps } from '@mui/material/OverridableComponent';
5
7
  import { MenuItem } from './Menu';
6
- import { ModelPaginatedResponse } from '@luminix/core/dist/types/Model';
7
- import { Collection, CollectionIteratorCallback } from '@luminix/core/dist/types/Collection';
8
- import { Scope } from '@luminix/core/dist/types/Builder';
9
- import { InitOptions } from 'i18next';
10
- import { LuminixProviderProps } from '@luminix/react/dist/components/LuminixProvider';
11
8
  export type LuminixCmsProps = Partial<LuminixProviderProps> & {
12
9
  theme?: ThemeOptions;
13
- i18nOptions?: InitOptions;
14
10
  };
15
11
  export type LayoutProps = BoxProps & {
16
12
  slotProps?: {
@@ -1,4 +1,4 @@
1
- import { Model } from '@luminix/core';
1
+ import { ModelType as Model } from '@luminix/core';
2
2
  import { RouteObject } from 'react-router-dom';
3
3
  export type ComponentMapReducer = (components: Record<string, React.FunctionComponent>) => Record<string, React.FunctionComponent>;
4
4
  export type CmsRoutesReducer = (routes: RouteObject[], components: Record<string, React.FunctionComponent<any>>, models: Record<string, typeof Model>) => RouteObject[];
@@ -1,9 +1,9 @@
1
- import { Model } from '@luminix/core';
2
- import { Collection } from '@luminix/core/dist/types/Collection';
1
+ import { Collection } from '@luminix/support';
2
+ import { ModelType as Model } from '@luminix/core';
3
3
  import { TableCellProps } from '@mui/material';
4
+ import { TFunction } from 'i18next';
4
5
  import { NotifyFunction } from './Notifications';
5
6
  import { DialogFunction } from './Dialog';
6
- import { TFunction } from 'i18next';
7
7
  export type StaticAction = {
8
8
  key?: string;
9
9
  label: string;
@@ -1,18 +0,0 @@
1
- import { AppFacade, Plugin } from '@luminix/core';
2
- import { CmsPluginOptions } from '../types/Plugin';
3
- declare class CmsPlugin extends Plugin {
4
- options: CmsPluginOptions;
5
- name: string;
6
- constructor(options?: CmsPluginOptions);
7
- register(appFacade: AppFacade): void;
8
- boot(): void;
9
- private bootModels;
10
- private bootRoutes;
11
- private bootComponents;
12
- private bootMenu;
13
- private bootDefaultUserModifiers;
14
- private bootMassActions;
15
- private bootInstanceActions;
16
- private bootStaticActions;
17
- }
18
- export default CmsPlugin;
@@ -1,19 +0,0 @@
1
- import { Plugin } from '@luminix/core';
2
- import { AppFacade, AppFacades } from '@luminix/core/dist/types/App';
3
- import { InitOptions } from 'i18next';
4
- declare class i18NextPlugin extends Plugin {
5
- private options;
6
- name: string;
7
- constructor(options: InitOptions);
8
- register(app: AppFacade): void;
9
- boot({ cms, model, forms }: AppFacades): void;
10
- private initI18Next;
11
- private translateModelNames;
12
- private translateModelColumns;
13
- private translateMenuEntries;
14
- private translateMassActions;
15
- private translateInstanceActions;
16
- private translateStaticActions;
17
- private translateFormLabels;
18
- }
19
- export default i18NextPlugin;
@@ -1,9 +0,0 @@
1
- /**
2
- * Removes duplicates from an array.
3
- * If a key is provided, duplicates are removed based on the value of that key.
4
- *
5
- * @param value
6
- * @param key
7
- * @returns
8
- */
9
- export declare const unique: (value: any[], key?: string) => any[];
@@ -1 +0,0 @@
1
- export declare const fromIsoString: (value: Date | string) => string;
@@ -1 +0,0 @@
1
- export declare const searchParamsToObject: (searchParams: URLSearchParams) => Record<string, any>;
@@ -1,3 +0,0 @@
1
- export declare const trim: (value: string, mask: string) => string;
2
- export declare const removeSurrounding: (value: string, prefix: string, suffix: string) => string;
3
- export declare const pascalCase: (value: string) => string;