eze-factory 1.0.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/README.md +59 -0
- package/dist/Bees/ArrayBee.d.ts +2 -0
- package/dist/Bees/Bee.d.ts +3 -0
- package/dist/Bees/Bees.d.ts +3 -0
- package/dist/Bees/FormBee.d.ts +3 -0
- package/dist/Bees/FormBees.d.ts +3 -0
- package/dist/Bees/ObserverBee.d.ts +3 -0
- package/dist/Bees/ObserverBees.d.ts +3 -0
- package/dist/Bees/ObserverFormBee.d.ts +3 -0
- package/dist/Bees/ProxyBee.d.ts +13 -0
- package/dist/Bees/Types.d.ts +74 -0
- package/dist/Bees/index.d.ts +10 -0
- package/dist/Factory/factory.d.ts +9 -0
- package/dist/Factory/index.d.ts +2 -0
- package/dist/Factory/types.d.ts +2 -0
- package/dist/Hives/AsyncHive.d.ts +2 -0
- package/dist/Hives/FormHive.d.ts +16 -0
- package/dist/Hives/Hive.d.ts +2 -0
- package/dist/Hives/HiveArray.d.ts +2 -0
- package/dist/Hives/HiveBase.d.ts +2 -0
- package/dist/Hives/HiveObserver.d.ts +3 -0
- package/dist/Hives/HiveUtils.d.ts +3 -0
- package/dist/Hives/ProxyHive.d.ts +2 -0
- package/dist/Hives/Types.d.ts +98 -0
- package/dist/Hives/index.d.ts +6 -0
- package/dist/Hooks/index.d.ts +4 -0
- package/dist/Hooks/useFormHive.d.ts +5 -0
- package/dist/Hooks/useFormHoney.d.ts +5 -0
- package/dist/Hooks/useHive.d.ts +2 -0
- package/dist/Hooks/useHoney.d.ts +2 -0
- package/dist/System/Constants/Kit/Error.d.ts +3 -0
- package/dist/System/Constants/Kit/IosLoader.d.ts +3 -0
- package/dist/System/Constants/Kit/ItemsLoading.d.ts +3 -0
- package/dist/System/Constants/Kit/Loader.d.ts +6 -0
- package/dist/System/Constants/Kit/LoaderTwo.d.ts +7 -0
- package/dist/System/Constants/Kit/Loading.d.ts +3 -0
- package/dist/System/Constants/Kit/NoContent.d.ts +6 -0
- package/dist/System/Constants/Kit/Progressing.d.ts +7 -0
- package/dist/System/Constants/Kit/Searching.d.ts +3 -0
- package/dist/System/Constants/Kit/StateKit.d.ts +21 -0
- package/dist/System/Constants/Kit/index.d.ts +4 -0
- package/dist/System/Constants/QueryDefaults.d.ts +17 -0
- package/dist/System/Constants/StatusDefaults.d.ts +8 -0
- package/dist/System/Factories/DetailFactory.d.ts +25 -0
- package/dist/System/Factories/FactoryPackage.d.ts +6 -0
- package/dist/System/Factories/ListFactory.d.ts +34 -0
- package/dist/System/Factories/StaticTableFactory.d.ts +33 -0
- package/dist/System/Factories/TableFactory.d.ts +40 -0
- package/dist/System/Factories/Types.d.ts +25 -0
- package/dist/System/Factories/index.d.ts +4 -0
- package/dist/System/Slices/Exporter/ExporterMechanics.d.ts +17 -0
- package/dist/System/Slices/Exporter/ExporterSlice.d.ts +4 -0
- package/dist/System/Slices/Exporter/Types.d.ts +35 -0
- package/dist/System/Slices/Loader/LoaderMechanics.d.ts +5 -0
- package/dist/System/Slices/Loader/LoaderSlice.d.ts +15 -0
- package/dist/System/Slices/Loader/Types.d.ts +25 -0
- package/dist/System/Slices/Paginator/PaginatorMechanics.d.ts +17 -0
- package/dist/System/Slices/Paginator/PaginatorSlice.d.ts +22 -0
- package/dist/System/Slices/Paginator/Types.d.ts +30 -0
- package/dist/System/Slices/Query/Components/Filters.d.ts +8 -0
- package/dist/System/Slices/Query/Components/QueryContainer.d.ts +9 -0
- package/dist/System/Slices/Query/Components/QueryElements.d.ts +18 -0
- package/dist/System/Slices/Query/Components/Sorts.d.ts +0 -0
- package/dist/System/Slices/Query/QueryMechanics.d.ts +13 -0
- package/dist/System/Slices/Query/QuerySlice.d.ts +4 -0
- package/dist/System/Slices/Query/Types.d.ts +46 -0
- package/dist/System/Slices/Status/Components/StatusIndicator.d.ts +91 -0
- package/dist/System/Slices/Status/Components/StatutsComopnent.d.ts +12 -0
- package/dist/System/Slices/Status/StatusSlice.d.ts +22 -0
- package/dist/System/Slices/Status/Types.d.ts +76 -0
- package/dist/System/Slices/Table/Components.d.ts +2 -0
- package/dist/System/Slices/Table/TableMechanics.d.ts +20 -0
- package/dist/System/Slices/Table/TableSlice.d.ts +4 -0
- package/dist/System/Slices/Table/Types.d.ts +71 -0
- package/dist/System/Slices/Types.d.ts +39 -0
- package/dist/System/StatusKit.d.ts +76 -0
- package/dist/Types.d.ts +15 -0
- package/dist/Ui/Containers/ControllerContainers.d.ts +17 -0
- package/dist/Ui/Containers/index.d.ts +1 -0
- package/dist/Ui/StatusKit/StateBuilder.d.ts +8 -0
- package/dist/Ui/StatusKit/StatusBee.d.ts +15 -0
- package/dist/Ui/StatusKit/StatusKit.d.ts +16 -0
- package/dist/Ui/StatusKit/empty.d.ts +6 -0
- package/dist/Ui/StatusKit/error.d.ts +7 -0
- package/dist/Ui/StatusKit/index.d.ts +4 -0
- package/dist/Ui/StatusKit/loading.d.ts +6 -0
- package/dist/Ui/StatusKit/loadingMore.d.ts +6 -0
- package/dist/Ui/StatusKit/processing.d.ts +6 -0
- package/dist/Ui/Wrappers/Wrapper.d.ts +17 -0
- package/dist/Ui/Wrappers/index.d.ts +2 -0
- package/dist/Ui/Wrappers/types.d.ts +38 -0
- package/dist/Ui/index.d.ts +2 -0
- package/dist/Utils/Storable.d.ts +20 -0
- package/dist/Utils/Utils.d.ts +3 -0
- package/dist/Utils/index.d.ts +5 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IHive } from "../../../Hives";
|
|
2
|
+
import { PaginatorAPI } from "../Paginator/Types";
|
|
3
|
+
import { LoaderAPI } from "../Loader/Types";
|
|
4
|
+
export type TableExportFn<T> = (item: T) => string | number | boolean | Date | null | undefined;
|
|
5
|
+
export type TableColumnDef<T> = {
|
|
6
|
+
id: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
colSpan?: number;
|
|
10
|
+
cell?: (item: T) => JSX.Element;
|
|
11
|
+
hideOnPrint?: boolean;
|
|
12
|
+
hideInHeader?: boolean;
|
|
13
|
+
export?: {
|
|
14
|
+
value: TableExportFn<T>;
|
|
15
|
+
calcTotal?: boolean;
|
|
16
|
+
width?: number;
|
|
17
|
+
getStyle?: (item: T) => any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type TableSort<T> = {
|
|
21
|
+
id: keyof T | string;
|
|
22
|
+
dir: "asc" | "desc";
|
|
23
|
+
index?: number;
|
|
24
|
+
};
|
|
25
|
+
export type TableSliceConfig<TItem, Ctx = any> = {
|
|
26
|
+
columns: (ctx: Ctx) => TableColumnDef<TItem>[];
|
|
27
|
+
showCheckBox?: boolean;
|
|
28
|
+
showIndex?: boolean;
|
|
29
|
+
toggleColumnsBtnVisible?: boolean;
|
|
30
|
+
storeKey?: string;
|
|
31
|
+
idKey?: string;
|
|
32
|
+
restoreFromStore?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export interface TableAPI<TItem> {
|
|
35
|
+
columnsHive: IHive<TableColumnDef<TItem>[]>;
|
|
36
|
+
selectedItemsHive: IHive<Record<string, TItem>>;
|
|
37
|
+
sortingHive: IHive<TableSort<TItem>[]>;
|
|
38
|
+
storeKey: string;
|
|
39
|
+
showIndex: boolean;
|
|
40
|
+
showCheckBox: boolean;
|
|
41
|
+
toggleColumnsBtnVisible: boolean;
|
|
42
|
+
setVisibleColumns: (cols: TableColumnDef<TItem>[]) => void;
|
|
43
|
+
getVisibleColumns: () => TableColumnDef<TItem>[];
|
|
44
|
+
toggleColumnVisibility: (colId: string) => void;
|
|
45
|
+
toggleAllColumns: (val?: boolean) => void;
|
|
46
|
+
resetColumns: () => void;
|
|
47
|
+
restoreColumns: () => void;
|
|
48
|
+
clearStoredColumns: () => void;
|
|
49
|
+
setSelected: (next: Record<string, TItem> | ((prev: Record<string, TItem>) => Record<string, TItem>)) => void;
|
|
50
|
+
toggleItemSelection: (item: TItem) => void;
|
|
51
|
+
toggleAllItemsSelection: () => void;
|
|
52
|
+
selectAllItems: () => void;
|
|
53
|
+
unselectAllItems: () => void;
|
|
54
|
+
isAllSelected: () => boolean;
|
|
55
|
+
setSorting: (sorts: TableSort<TItem>[]) => void;
|
|
56
|
+
clearSorting: () => void;
|
|
57
|
+
addSort: (s: TableSort<TItem>) => void;
|
|
58
|
+
getRawRows: () => TItem[];
|
|
59
|
+
getFilteredRows: () => TItem[];
|
|
60
|
+
getSortedRows: () => TItem[];
|
|
61
|
+
getViewRows: (applySorting?: boolean) => TItem[];
|
|
62
|
+
getExportColumns: () => TableColumnDef<TItem>[];
|
|
63
|
+
}
|
|
64
|
+
export type TableDataSource<TItem> = {
|
|
65
|
+
paginator: PaginatorAPI<TItem>;
|
|
66
|
+
loader?: never;
|
|
67
|
+
} | {
|
|
68
|
+
loader: LoaderAPI<TItem[]>;
|
|
69
|
+
paginator?: never;
|
|
70
|
+
};
|
|
71
|
+
export type TableDependencies<TItem> = TableDataSource<TItem>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type IListOption = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export type IQueryFilterBuilder = {
|
|
6
|
+
value?: any;
|
|
7
|
+
label?: string;
|
|
8
|
+
placement?: "InLine" | "InPopup" | "Auto";
|
|
9
|
+
isMain?: boolean;
|
|
10
|
+
} & ({
|
|
11
|
+
id: string;
|
|
12
|
+
Element?: React.FC<any>;
|
|
13
|
+
type: FilterType | (string & {});
|
|
14
|
+
} | {
|
|
15
|
+
id: string;
|
|
16
|
+
type: "text" | "number" | "boolean" | "DateTime" | "Date" | "Time";
|
|
17
|
+
} | {
|
|
18
|
+
id: string;
|
|
19
|
+
type: "selector";
|
|
20
|
+
options: IListOption[];
|
|
21
|
+
getOptions?: () => Promise<IListOption[]>;
|
|
22
|
+
} | {
|
|
23
|
+
type: "string-selector" | "number-selector";
|
|
24
|
+
selectorId: string;
|
|
25
|
+
inputId: string;
|
|
26
|
+
options: IListOption[];
|
|
27
|
+
} | {
|
|
28
|
+
type: "Date" | "Time" | "DateTime";
|
|
29
|
+
max?: string;
|
|
30
|
+
min?: string;
|
|
31
|
+
} | PaginatorFilterBuilder | {
|
|
32
|
+
type: string;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
});
|
|
35
|
+
type FilterType = "hidden" | "text" | "number" | "DateTime" | "Date" | "Time" | "boolean" | "selector" | "string-selector" | "number-selector" | "selector-api" | "multi-selector";
|
|
36
|
+
export type PaginatorFilterBuilder = {
|
|
37
|
+
type: "selector-api";
|
|
38
|
+
} & any;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StatusKit } from "./Slices/Status/Types";
|
|
3
|
+
/**
|
|
4
|
+
* Default StatusKit with standard status types.
|
|
5
|
+
* Extend or override this in your factory configuration.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Use default kit
|
|
9
|
+
* StatusSlice({ statusKit: DefaultStatusKit })
|
|
10
|
+
*
|
|
11
|
+
* // Extend with custom types
|
|
12
|
+
* StatusSlice({
|
|
13
|
+
* statusKit: {
|
|
14
|
+
* ...DefaultStatusKit,
|
|
15
|
+
* uploadProgress: {
|
|
16
|
+
* priority: 3,
|
|
17
|
+
* props: {} as { fileName: string; progress: number },
|
|
18
|
+
* component: ({ fileName, progress }) => <UploadBar fileName={fileName} progress={progress} />,
|
|
19
|
+
* },
|
|
20
|
+
* }
|
|
21
|
+
* })
|
|
22
|
+
*/
|
|
23
|
+
export declare const DefaultStatusKit: {
|
|
24
|
+
idle: {
|
|
25
|
+
priority: number;
|
|
26
|
+
props: {};
|
|
27
|
+
component: () => null;
|
|
28
|
+
};
|
|
29
|
+
loading: {
|
|
30
|
+
priority: number;
|
|
31
|
+
props: {
|
|
32
|
+
message?: string;
|
|
33
|
+
variant?: "full" | "skeleton" | "spinner";
|
|
34
|
+
};
|
|
35
|
+
component: ({ message, variant }: any) => React.JSX.Element;
|
|
36
|
+
};
|
|
37
|
+
saving: {
|
|
38
|
+
priority: number;
|
|
39
|
+
props: {
|
|
40
|
+
message: string;
|
|
41
|
+
disableUI?: boolean;
|
|
42
|
+
};
|
|
43
|
+
component: ({ message, disableUI }: any) => React.JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
success: {
|
|
46
|
+
priority: number;
|
|
47
|
+
props: {
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
50
|
+
component: ({ message }: any) => React.JSX.Element;
|
|
51
|
+
};
|
|
52
|
+
error: {
|
|
53
|
+
priority: number;
|
|
54
|
+
props: {
|
|
55
|
+
message: string;
|
|
56
|
+
retry?: () => void;
|
|
57
|
+
};
|
|
58
|
+
component: ({ message, retry }: any) => React.JSX.Element;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Extract status type names from DefaultStatusKit
|
|
63
|
+
*/
|
|
64
|
+
export type DefaultStatusType = keyof typeof DefaultStatusKit;
|
|
65
|
+
/**
|
|
66
|
+
* Extract props for a specific default status type
|
|
67
|
+
*/
|
|
68
|
+
export type DefaultStatusProps<T extends DefaultStatusType> = (typeof DefaultStatusKit)[T]["props"];
|
|
69
|
+
/**
|
|
70
|
+
* Helper to create a StatusKit with type inference
|
|
71
|
+
*/
|
|
72
|
+
export declare function createStatusKit<K extends StatusKit>(kit: K): K;
|
|
73
|
+
/**
|
|
74
|
+
* Helper to extend the default kit with custom status types
|
|
75
|
+
*/
|
|
76
|
+
export declare function extendStatusKit<K extends StatusKit>(customKit: K): typeof DefaultStatusKit & K;
|
package/dist/Types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StatusKit } from "./Ui";
|
|
2
|
+
export type Status = keyof typeof StatusKit;
|
|
3
|
+
export type ServiceStatus<S = any> = S | Status | {
|
|
4
|
+
status: S | Status;
|
|
5
|
+
props: any;
|
|
6
|
+
parent?: HTMLElement | undefined;
|
|
7
|
+
};
|
|
8
|
+
export interface QueryParam {
|
|
9
|
+
id: string;
|
|
10
|
+
value: any;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IQueryParams {
|
|
14
|
+
[id: string]: QueryParam;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IFormHive } from "../../Hives/Types";
|
|
3
|
+
import { INestedFormHoneySetter } from "../../Bees/Types";
|
|
4
|
+
interface ControllerContainerProps<T, K extends keyof T> {
|
|
5
|
+
formHive: IFormHive<T>;
|
|
6
|
+
id: K;
|
|
7
|
+
Element: React.ComponentType<{
|
|
8
|
+
setValue: INestedFormHoneySetter<T[K]>;
|
|
9
|
+
silentSetHoney?: (value: T[K]) => void;
|
|
10
|
+
value: T[K];
|
|
11
|
+
error?: string;
|
|
12
|
+
id?: K;
|
|
13
|
+
}>;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export declare function ControllerContainer<T, K extends keyof T>({ id, formHive, Element, ...props }: ControllerContainerProps<T, K>): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ControllerContainers";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IHive } from "../../Hives";
|
|
2
|
+
import { ServiceStatus, Status } from "../../Types";
|
|
3
|
+
export default class StatusService<S = Status> {
|
|
4
|
+
statusHive: IHive<S | ServiceStatus>;
|
|
5
|
+
statusKit?: any;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export type IStateBuilder<S = Status> = StatusService<S>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IHive } from "../../Hives";
|
|
2
|
+
interface IStateBuilderProps {
|
|
3
|
+
factory?: {
|
|
4
|
+
status?: {
|
|
5
|
+
getStatusComponent: () => any;
|
|
6
|
+
hive: IHive<any>;
|
|
7
|
+
};
|
|
8
|
+
canLoadHive?: IHive<boolean>;
|
|
9
|
+
statusHive?: IHive<any>;
|
|
10
|
+
statusKit?: any;
|
|
11
|
+
};
|
|
12
|
+
hive?: IHive<any>;
|
|
13
|
+
}
|
|
14
|
+
declare function StatusBee({ factory, hive }: IStateBuilderProps): any;
|
|
15
|
+
export default StatusBee;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const StatusKit: IStatusKit;
|
|
3
|
+
export declare const setDefaultStatusKit: (kit: Partial<IStatusKit>) => void;
|
|
4
|
+
type StatusKitType = React.ReactNode | React.FC;
|
|
5
|
+
interface IStatusKit {
|
|
6
|
+
error: StatusKitType;
|
|
7
|
+
loading: StatusKitType;
|
|
8
|
+
processing: StatusKitType;
|
|
9
|
+
empty: StatusKitType;
|
|
10
|
+
loadingMore: StatusKitType;
|
|
11
|
+
reloading: StatusKitType;
|
|
12
|
+
searching: StatusKitType;
|
|
13
|
+
success: StatusKitType;
|
|
14
|
+
[key: string]: StatusKitType;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IWrapperProps, onPullProps } from "./types";
|
|
3
|
+
declare const Wrapper: ({ service, reload, loadMore, subscribeToStatus, statusHive, canLoadHive, statusKit, isScrollPositionTopHive, className, rememberScrollPosition, ...props }: IWrapperProps) => React.JSX.Element;
|
|
4
|
+
export default Wrapper;
|
|
5
|
+
export type ReloaderProps = {
|
|
6
|
+
[P in keyof typeof _reloaderProps]?: (typeof _reloaderProps)[P];
|
|
7
|
+
};
|
|
8
|
+
declare const _reloaderProps: {
|
|
9
|
+
id: string;
|
|
10
|
+
reloadingClass: string;
|
|
11
|
+
disappearingClass: string;
|
|
12
|
+
pullingClass: string;
|
|
13
|
+
onPull: ({ diff, diffPercentage, reloader }: onPullProps) => void;
|
|
14
|
+
Component: React.JSX.Element;
|
|
15
|
+
className: string;
|
|
16
|
+
position: "absolute" | "fixed" | "relative";
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IHive } from "../../Hives";
|
|
2
|
+
import { ReloaderProps } from "./Wrapper";
|
|
3
|
+
export type IServiceAsProp = {
|
|
4
|
+
laod?: () => void;
|
|
5
|
+
loadMore?: () => void;
|
|
6
|
+
reload?: () => void;
|
|
7
|
+
canLoadHive?: IHive<boolean>;
|
|
8
|
+
statusHive?: IHive<string>;
|
|
9
|
+
statusKit?: any;
|
|
10
|
+
};
|
|
11
|
+
export interface IWrapperProps {
|
|
12
|
+
id?: string;
|
|
13
|
+
service?: IServiceAsProp | any;
|
|
14
|
+
className?: string;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
reloader?: React.ReactNode;
|
|
17
|
+
subscribeToStatus?: boolean;
|
|
18
|
+
canLoadHive?: IHive<boolean>;
|
|
19
|
+
statusHive?: IHive<string>;
|
|
20
|
+
statusKit?: any;
|
|
21
|
+
reloaderProps?: ReloaderProps;
|
|
22
|
+
loadMore?: (() => void) | null;
|
|
23
|
+
reload?: (() => void) | null;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
rememberScrollPosition?: boolean;
|
|
26
|
+
isScrollPositionTopHive?: IHive<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export interface onPullProps {
|
|
29
|
+
diff: number;
|
|
30
|
+
diffPercentage: number;
|
|
31
|
+
reloader: HTMLElement;
|
|
32
|
+
}
|
|
33
|
+
export interface ListenToPullProps {
|
|
34
|
+
container: HTMLElement;
|
|
35
|
+
statusHive: IHive<any>;
|
|
36
|
+
reloaderProps: ReloaderProps;
|
|
37
|
+
reload: () => void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default class Storable {
|
|
2
|
+
storage: Storage;
|
|
3
|
+
storeKey: string;
|
|
4
|
+
set: (store_key: string, data: any) => void;
|
|
5
|
+
get: (store_key: string) => any;
|
|
6
|
+
insert: (key: string, value: Array<any> | Object) => void;
|
|
7
|
+
remove: (store_key: string) => void;
|
|
8
|
+
clear: (storageKey?: string) => void;
|
|
9
|
+
select: (key: string, value: any) => any;
|
|
10
|
+
private getCleanString;
|
|
11
|
+
constructor({ storage, storeKey }: StorableConstructor);
|
|
12
|
+
static clear: (storage: "localStorage" | "sessionStorage", storageKey: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export type StorageType = "localStorage" | "sessionStorage" | "memoryStorage" | Storage;
|
|
15
|
+
type StorableConstructor = {
|
|
16
|
+
storage?: StorageType;
|
|
17
|
+
storeKey?: string;
|
|
18
|
+
};
|
|
19
|
+
export type IStorable = InstanceType<typeof Storable>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Utils } from "./Utils";
|
|
2
|
+
export declare const ExtractId: (obj: any, key: string) => void;
|
|
3
|
+
export declare const ExtractIds: (obj: any, keys: string[]) => void;
|
|
4
|
+
export declare const ExtractValue: (obj: any, key: string) => any;
|
|
5
|
+
export declare const ExtractValues: (obj: any, keys: string[]) => any[];
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react");function t(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}t("@layer eze-factory{#reloader-container{height:100px;margin-inline:auto;margin-top:var(--reloader-m-top);pointer-events:none;width:100px;z-index:399}.reloader-svg{fill:#83d6e1;border-radius:100px;box-shadow:0 0 10px rgba(131,214,225,.5)!important;color:#83d6e1;height:100px!important;scale:.5;width:100px!important}.pulling{transition:unset}.reloading{animation:reload .6s linear infinite;margin-top:0!important;opacity:1;transition:all .3s ease-out}.disappearing{margin-top:var(--reloader-m-top)!important;opacity:0;transition:all .3s ease-in-out}@keyframes reload{0%{transform:rotate(1turn)}to{transform:rotate(2turn)}}}");var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function a(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function l(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;t(':root{--blur:#ffffff80;--base-color:#00000080}.dark{--blur:#00000080;--base-color:#ffffff80}.animate-bounce{animation:bounce 4s ease-in-out infinite}@keyframes bounce{0%,20%,50%,80%,to{transform:translateY(0)}40%{transform:translateY(-10px)}60%{transform:translateY(-5px)}}.s-processing-container{background-color:var(--blur);z-index:99999999}.s-loading-container{pointer-events:none;touch-action:none;z-index:99999999}.s-loading{display:inline-block;height:48px;position:relative;transform:rotate(45deg);width:48px}.s-loading:before{animation:animloader 4s ease infinite;top:-24px}.s-loading:after,.s-loading:before{box-sizing:border-box;content:"";height:24px;left:0;position:absolute;width:24px}.s-loading:after{animation:animloader2 2s ease infinite;background:hsla(0,0%,100%,.85);box-shadow:0 0 10px rgba(0,0,0,.15);top:0}@keyframes animloader{0%{box-shadow:0 24px hsla(0,0%,100%,0),24px 24px hsla(0,0%,100%,0),24px 48px hsla(0,0%,100%,0),0 48px hsla(0,0%,100%,0)}12%{box-shadow:0 24px var(--base-color),24px 24px hsla(0,0%,100%,0),24px 48px hsla(0,0%,100%,0),0 48px hsla(0,0%,100%,0)}25%{box-shadow:0 24px var(--base-color),24px 24px var(--base-color),24px 48px hsla(0,0%,100%,0),0 48px hsla(0,0%,100%,0)}37%{box-shadow:0 24px var(--base-color),24px 24px var(--base-color),24px 48px var(--base-color),0 48px hsla(0,0%,100%,0)}50%{box-shadow:0 24px var(--base-color),24px 24px var(--base-color),24px 48px var(--base-color),0 48px var(--base-color)}62%{box-shadow:0 24px hsla(0,0%,100%,0),24px 24px var(--base-color),24px 48px var(--base-color),0 48px var(--base-color)}75%{box-shadow:0 24px hsla(0,0%,100%,0),24px 24px hsla(0,0%,100%,0),24px 48px var(--base-color),0 48px var(--base-color)}87%{box-shadow:0 24px hsla(0,0%,100%,0),24px 24px hsla(0,0%,100%,0),24px 48px hsla(0,0%,100%,0),0 48px var(--base-color)}to{box-shadow:0 24px hsla(0,0%,100%,0),24px 24px hsla(0,0%,100%,0),24px 48px hsla(0,0%,100%,0),0 48px hsla(0,0%,100%,0)}}@keyframes animloader2{0%{transform:translate(0) rotateX(0) rotateY(0)}25%{transform:translate(100%) rotateX(0) rotateY(180deg)}50%{transform:translate(100%,100%) rotateX(-180deg) rotateY(180deg)}75%{transform:translateY(100%) rotateX(-180deg) rotateY(1turn)}to{transform:translate(0) rotateX(0) rotateY(1turn)}}.s-processing{--base-color:var(--prim);display:inline-block;height:40px;position:relative;width:60px}.s-processing:before{animation:rotationBack 3s linear infinite;background-image:radial-gradient(circle 8px at 18px 18px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 18px 0,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 0 18px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 36px 18px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 18px 36px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 30px 5px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 30px 5px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 30px 30px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 5px 30px,var(--base-color) 100%,transparent 0),radial-gradient(circle 4px at 5px 5px,var(--base-color) 100%,transparent 0);height:36px;left:0;top:0;width:36px}.s-processing:after,.s-processing:before{background-color:#fff;background-repeat:no-repeat;border-radius:50%;box-sizing:border-box;content:"";position:absolute}.s-processing:after{animation:rotationBack 4s linear infinite reverse;background-image:radial-gradient(circle 5px at 12px 12px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 12px 0,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 0 12px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 24px 12px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 12px 24px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 20px 3px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 20px 3px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 20px 20px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 3px 20px,var(--base-color) 100%,transparent 0),radial-gradient(circle 2.5px at 3px 3px,var(--base-color) 100%,transparent 0);height:24px;left:35px;top:15px;width:24px}@keyframes rotationBack{0%{transform:rotate(0deg)}to{transform:rotate(-1turn)}}.s-reloading{animation:rotate 1s infinite;height:50px;width:50px}.s-reloading:after,.s-reloading:before{content:"";display:block;height:20px;width:20px}.s-reloading:before{animation:box1 1s infinite;background-color:#fff;box-shadow:30px 0 0 #ff3d00;margin-bottom:10px}.s-reloading:after{animation:box2 1s infinite;background-color:#ff3d00;box-shadow:30px 0 0 #fff}@keyframes rotate{0%{transform:rotate(0deg) scale(.8)}50%{transform:rotate(1turn) scale(1.2)}to{transform:rotate(2turn) scale(.8)}}@keyframes box1{0%{box-shadow:30px 0 0 #ff3d00}50%{box-shadow:0 0 0 #ff3d00;margin-bottom:0;transform:translate(15px,15px)}to{box-shadow:30px 0 0 #ff3d00;margin-bottom:10px}}@keyframes box2{0%{box-shadow:30px 0 0 #fff}50%{box-shadow:0 0 0 #fff;margin-top:-20px;transform:translate(15px,15px)}to{box-shadow:30px 0 0 #fff;margin-top:0}}.s-uploading{background:#fff;display:inline-block;height:12px;margin-top:40px;position:relative;width:48px}.s-uploading:after{border:15px solid transparent;border-bottom-color:#fff;top:-47px}.s-uploading:after,.s-uploading:before{animation:bump .4s ease-in-out infinite alternate;box-sizing:border-box;content:"";left:50%;position:absolute;transform:translate(-50%)}.s-uploading:before{background:#fff;bottom:15px;height:20px;width:15px}@keyframes bump{0%{transform:translate(-50%,5px)}to{transform:translate(-50%,-5px)}}.s-loading-2{--loader-clr:var(--owl);height:48px;margin:auto;position:relative;width:48px}.s-loading-2:before{animation:shadow .5s linear infinite;background:#000;border-radius:50%;content:"";height:5px;left:0;opacity:.25;position:absolute;top:60px;width:48px}.s-loading-2:after{animation:bxSpin .5s linear infinite;background:var(--loader-clr);border-radius:4px;content:"";height:100%;left:0;position:absolute;top:0;width:100%}@keyframes bxSpin{17%{border-bottom-right-radius:3px}25%{transform:translateY(9px) rotate(22.5deg)}50%{border-bottom-right-radius:40px;transform:translateY(18px) scaleY(.9) rotate(45deg)}75%{transform:translateY(9px) rotate(67.5deg)}to{transform:translateY(0) rotate(90deg)}}@keyframes shadow{0%,to{transform:scale(1)}50%{transform:scaleX(1.2)}}');var c=function(){function e(e){var t,r=e.storage,o=void 0===r?"sessionStorage":r,a=e.storeKey,i=void 0===a?"storable":a,c=this;this.set=function(e,t){return t&&Object.values(t).length>0?c.storage.setItem(c.getCleanString(e),JSON.stringify(t)):c.remove(e)},this.get=function(e){return JSON.parse(c.storage.getItem(c.getCleanString(e)))},this.insert=function(e,t){var r,o,a=Array.isArray(t),i=null!==(r=c.get(e))&&void 0!==r?r:a?[]:{},u=t;(null===(o=Object.keys(i))||void 0===o?void 0:o.length)&&(a?u=l(l([],s(i),!1),s(u),!1):"object"==typeof u&&(u=n(n({},i),u))),c.set(e,u)},this.remove=function(e){return c.storage.removeItem(c.getCleanString(e))},this.clear=function(e){var t,r;if(e)for(var n=0;n<(null===(t=c.storage)||void 0===t?void 0:t.length);n++){(o=c.storage.key(n)).startsWith(c.getCleanString(e))&&c.storage.removeItem(o)}else for(n=0;n<(null===(r=c.storage)||void 0===r?void 0:r.length);n++){var o;(o=c.storage.key(n)).startsWith(c.storeKey)&&c.storage.removeItem(o)}},this.select=function(e,t){var r;return(null!==(r=c.get(e))&&void 0!==r?r:[])[t]},this.getCleanString=function(e){return void 0===e&&(e=""),c.storeKey+e.replace(/[?&=/!]/g,"-")},this.storage={},"localStorage"===o?this.storage=localStorage:"sessionStorage"===o?this.storage=sessionStorage:"memoryStorage"===o?this.storage=(t={getItem:function(e){var r;return null!==(r=t[e])&&void 0!==r?r:null},setItem:function(e,r){t[e]=r,t.length++},removeItem:function(e){delete t[e],t.length--},key:function(e){var r;return null!==(r=Object.keys(t)[e])&&void 0!==r?r:null},length:0},t):o instanceof Storage?this.storage=o:o=null,this.storeKey=i}return e.clear=function(e,t){for(var r="localStorage"===e?localStorage:sessionStorage,n=0;n<(null==r?void 0:r.length);n++){var o=r.key(n);o.startsWith(t)&&r.removeItem(o)}},e}();var u={localStorage:null,sessionStorage:null,memoryStorage:null},f=function(e,t){if(typeof e!=typeof t)return!1;if("object"==typeof e&&"object"==typeof t)if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!f(e[r],t[r]))return!1}else{if(null===e||null===t)return e===t;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(r=0;r<n.length;r++)if(!f(e[n[r]],t[o[r]]))return!1}else if(e!==t)return!1;return!0};function p(e,t){var r=this,n=new Set,o=function(){return a(r,void 0,void 0,(function(){var e,t,r,o,a;return i(this,(function(i){try{for(e=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),t=e.next();!t.done;t=e.next())(r=t.value).weakRef?r.weakRef.deref()?r.callback(s.honey):n.delete(r):r.callback(s.honey)}catch(e){o={error:e}}finally{try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(o)throw o.error}}return[2]}))}))},s={initialValue:e,honey:e,setHoney:function(e){e!==s.honey&&(s.silentSetHoney(e),o())},silentSetHoney:function(e){s.honey="function"==typeof e?e(s.honey):e},subscribe:function(t,r){s.honey!==e&&t(s.honey);var o={callback:t,weakRef:r?new WeakRef(r):void 0};return n.add(o),function(){n.delete(o)}},_subscribers:function(){return n.size},reset:function(){return s.setHoney(e)}};if(t){var l="memoryStorage";"object"==typeof t&&(l=t.storage,t=t.storeKey);var f=function(e){return void 0===e&&(e="memoryStorage"),null===u[e]&&(u[e]=new c({storeKey:"BeehiveStore_",storage:e})),u[e]}(l),p=f.get(t);p&&s.setHoney(p),s.subscribe((function(e){return f.set(t,e)})),s.clearStore=function(){s.setHoney(e),f.clear(t)}}else o();return[s,o]}function d(e,t){return p(e,t)[0]}var v=function(){this.statusHive=d("idle")};function h(t){var r=s(e.useState(t.honey),2)[1];return e.useEffect((function(){return t.subscribe(r)}),[t]),t.honey}function y(t){var r=s(e.useState(t.honey),2)[1];return e.useEffect((function(){return t.subscribe(r)}),[t]),t.honey}function m(t){var r,n,o=t.factory,a=t.hive||(null===(r=null==o?void 0:o.status)||void 0===r?void 0:r.hive)||(null==o?void 0:o.statusHive);if(h(a),null===(n=null==o?void 0:o.status)||void 0===n?void 0:n.getStatusComponent)return o.status.getStatusComponent();if(a){var i=a.honey,s=null==o?void 0:o.statusKit;if(s){var l=s[i]||s.default||s.error||null;return"function"==typeof l?e.createElement(l,null):l}}return null}var x=function(t){var r=t.children;return e.createElement("div",{className:"fixed inset-0 col s-loading-container"},e.createElement("div",{className:"col-center m-auto"},e.createElement(g,null),r))},g=function(){return e.createElement("span",{className:"s-loading-2"})},b=function(){return e.createElement("span",{className:"s-Processing"})},H=function(){return e.createElement("span",{className:"s-loading-2"})},S=function(){return e.createElement("span",null,"No Content!")},w={processing:function(t){var r=t.children,n=void 0===r?e.createElement("p",null,"Processing..."):r;return e.createElement("div",{className:"fixed inset-0 col s-Processing-container"},e.createElement("div",{className:"col-center m-auto"},e.createElement(b,null),n))},loading:x,error:function(t){var r=t.service,n=t.error,o=void 0===n?{Error:"not passed"}:n;return"production"===process.env.NODE_ENV?e.createElement(e.Fragment,null):e.createElement("div",{onClick:function(e){var t;e.target,(null==r?void 0:r.retry)?null==r||r.retry():(null==r?void 0:r.reload)?null==r||r.reload():null===(t=null==r?void 0:r.statusHive)||void 0===t||t.setHoney("idle")},className:"fixed bg-blur inset-0 overflow-auto",style:{zIndex:1e6,paddingBlock:100}},e.createElement("div",{className:"col-center m-auto",style:{maxWidth:720}},e.createElement("div",{className:"animate-bounce round-full bg-red row-center justify-center",style:{opacity:.3,width:100,height:100,boxShadow:" 0 0 10px var(--red)"}},e.createElement("p",{className:"text-white text-center "},"Error!")),e.createElement("div",null,JSON.stringify(o))))},loadingMore:function(t){var r=t.children;return e.createElement("div",{className:"col-span-full col s-loading-container"},e.createElement("div",{className:"col-center m-auto"},e.createElement(H,null),r))},empty:function(t){var r=t.children;return e.createElement("div",{className:"fixed inset-0 col s-loading-container"},e.createElement("div",{className:"col-center m-auto"},e.createElement(S,null),r))},reloading:x,searching:x,success:function(){return e.createElement("p",null,"nice")},idle:null},E=function(t){function a(e){var r=t.call(this,e)||this;r.container=null,r.id="wrapper-".concat(window.location.pathname.replace(/\//g,""),"-").concat(e.id),r.reloaderProps=n(n({},k),e.reloaderProps);var o=r.reloaderProps,a=o.position,i=o.className;return r.reloaderProps.className="".concat(i?"".concat(i," "):"").concat(a),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(a,t),a.prototype.componentDidMount=function(){var e=this.props,t=e.loadMore,r=e.reload,n=e.canLoadHive,o=e.statusHive,a=e.rememberScrollPosition;t&&this.listnToScroll(t,n),r&&N({reload:r,container:this.container,statusHive:o,reloaderProps:this.reloaderProps}),a&&this.returnToLastScrollPostion()},a.prototype.returnToLastScrollPostion=function(){var e=this;setTimeout((function(){O[e.id]&&e.container.scrollTo({top:O[e.id],left:0,behavior:"instant"})}),20)},a.prototype.listnToScroll=function(e,t){var r=this.props.isScrollPositionTopHive,n=0;t?this.container.onscroll=r?function(o){var a=o.target;!0===r.honey?a.scrollTop>n&&r.setHoney(!1):a.scrollTop<n&&r.setHoney(!0),n=a.scrollTop,t.honey&&a.scrollHeight-a.scrollTop<a.clientHeight+400&&e()}:function(r){var n=r.target;t.honey&&n.scrollHeight-n.scrollTop<n.clientHeight+400&&e()}:r&&(this.container.onscroll=function(e){var t=e.target;!1!==r.honey?t.scrollTop>n&&r.setHoney(!1):t.scrollTop<n&&r.setHoney(!0),n=t.scrollTop})},a.prototype.componentWillUnmount=function(){var e=this.container.scrollTop;0!==e&&(O[this.id]=e)},a.prototype.render=function(){var t=this,r=this.props,a=r.service,i=r.statusKit,s=r.statusHive,l=r.children;r.reloader;var c=r.subscribeToStatus,u=r.reload;r.loadMore,r.reloaderProps,r.canLoadHive,r.rememberScrollPosition,r.isScrollPositionTopHive;var f=o(r,["service","statusKit","statusHive","children","reloader","subscribeToStatus","reload","loadMore","reloaderProps","canLoadHive","rememberScrollPosition","isScrollPositionTopHive"]),p=this.reloaderProps,d=p.Component,v=p.className;return e.createElement("div",n({ref:function(e){e&&(t.container=e)}},f),u&&e.createElement("div",{className:v,style:{display:"none"},id:"reloader-container"},d),l,c&&e.createElement(m,{hive:s,factory:a||{statusHive:s,statusKit:i}}))},a}(e.Component),N=function(e){var t=e.reload,r=e.container,n=e.statusHive,o=e.reloaderProps;if(r){var s=parseInt(window.getComputedStyle(r).gap.replace("px",""))||0,l=!1,c=0,u=0,f=r.querySelector("#reloader-container");document.documentElement.style.setProperty("--reloader-m-top","-".concat(100+s,"px")),f.remove=function(){return a(void 0,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return e="".concat(o.reloadingClass," ").concat(o.disappearingClass),f.style="",f.setClassName(e),[4,new Promise((function(e){return setTimeout(e,500)}))];case 1:return t.sent(),l=!1,f.className===e&&f.setClassName(o.disappearingClass),f.style.display="none",[2]}}))}))},f.setClassName=function(e){f.className="".concat(o.className," ").concat(e)};var p=function(e){if((u=e.touches[0].clientY-c)>20){u>200&&(u=200);var t=u/100,r=(1-t)*f.offsetHeight;f.style.marginTop=-r-s+"px",f.style.opacity=t,o.onPull({diff:u,diffPercentage:t,reloader:f})}},d=function(){r.removeEventListener("touchend",d),r.removeEventListener("touchmove",p),u<100?setTimeout((function(){return a(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,f.remove()];case 1:return e.sent(),[2]}}))}))}),0):(f.setClassName(o.reloadingClass),setTimeout((function(){return a(void 0,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,t()];case 1:return e.sent(),[4,null==f?void 0:f.remove()];case 2:return e.sent(),[2]}}))}))}),500))};r.addEventListener("touchstart",(function(e){r.scrollTop>5||l||"reloading"===n.honey||(l=!0,f.style.display="",f.style.opacity="0",f.style.marginTop=-100-s+"px",f.setClassName(o.pullingClass),u=0,r.addEventListener("touchmove",p),r.addEventListener("touchend",d),c=e.touches[0].clientY)}))}},O={},k={id:"reloader",reloadingClass:"reloading",disappearingClass:"disappearing",pullingClass:"pulling",onPull:function(e){e.diff;var t=e.diffPercentage;e.reloader.style.transform="rotate(".concat(-360*t,"deg)")},Component:e.createElement("svg",{className:"reloader-svg",viewBox:"0 0 512 512"},e.createElement("path",{d:"M256,431.967c-97.03,0-175.967-78.939-175.967-175.967c0-28.668,7.013-56.655,20.156-81.677l-25.144-16.639l107.282-54.228l-7.974,119.943l-26.111-17.279c-7.203,15.517-11.041,32.51-11.041,49.879c0,65.507,53.294,118.801,118.801,118.801s118.801-53.294,118.801-118.801s-53.295-118.8-118.802-118.8V80.033c97.028,0,175.967,78.938,175.967,175.967S353.028,431.967,256,431.967z"})),className:"",position:"relative"};var C=function(){function e(e){this.ctx=e}return e.prototype.use=function(t){var r=t(this.ctx);return new e(n(n({},this.ctx),r))},e.prototype.build=function(){return this.ctx},e}(),P=function(e,t){"object"==typeof e[t]&&(e[t]=e[t].id)},T=function(e,t){var r=e[t];return delete e[t],r};exports.ArrayBee=function(t){var r=t.hive,n=t.Component;return h(r).map((function(t,r){return e.createElement(n,{key:t.id,honey:t,i:r})}))},exports.Bee=function(t){var r=t.hive,n=t.Component;return e.createElement(n,{honey:h(r),setHoney:r.setHoney,silentSetHoney:r.silentSetHoney})},exports.Bees=function(t){var r=t.hiveCluster,n=t.Component,o={};return Object.entries(r).map((function(e){var t=s(e,2),r=t[0],n=t[1];o[r]=h(n)})),e.createElement(n,{cell:o,set:function(e,t){void 0===t&&(t=!1),t?Object.entries(r).forEach((function(t){var r=s(t,2),n=r[0];return r[1].setHoney(e[n])})):Object.entries(e).forEach((function(e){var t=s(e,2),n=t[0],o=t[1];return r[n].setHoney(o)}))}})},exports.ExtractId=P,exports.ExtractIds=function(e,t){t.forEach((function(t){return P(e,t)}))},exports.ExtractValue=T,exports.ExtractValues=function(e,t){return t.map((function(t){return T(e,t)}))},exports.FormBee=function(t){var r=t.hive,n=t.Component,o=y(r),a=o.value,i=o.error;return e.createElement(n,{honey:a,error:i,setHoney:r.setHoney,silentSetHoney:r.silentSetHoney,validate:r.validate})},exports.FormBees=function(t){var r=t.hiveCluster,n=t.Component,o={};return Object.entries(r).map((function(e){var t=s(e,2),r=t[0],n=h(t[1]),a=n.value,i=n.error;o[r]={value:a,error:i}})),e.createElement(n,{cell:o,set:function(e,t){void 0===t&&(t=!1),t?Object.entries(r).forEach((function(t){var r=s(t,2),n=r[0];return r[1].setHoney(e[n])})):Object.entries(e).forEach((function(e){var t=s(e,2),n=t[0],o=t[1];return r[n].setHoney(o)}))},validate:function(e){Object.entries(e).forEach((function(e){var t=s(e,2),n=t[0],o=t[1];return r[n].validate(o)}))}})},exports.ObserverBee=function(t){var r=t.hive,n=t.Component;return e.createElement(n,{honey:h(r)})},exports.ObserverBees=function(t){var r=t.hiveCluster,n=t.Component,o={};return Object.entries(r).map((function(e){var t=s(e,2),r=t[0],n=t[1];o[r]=h(n)})),e.createElement(n,{cell:o})},exports.ObserverFormBee=function(t){var r=t.hive,n=t.Component,o=y(r),a=o.value,i=o.error;return e.createElement(n,{honey:a,error:i})},exports.ProxyBee=function(t){var r=t.hive,n=t.Component,o=t.id,a=r.getNestedHive(o);return e.createElement(n,{honey:h(a),setHoney:a.setHoney,silentSetHoney:a.silentSetHoney})},exports.StateBuilder=v,exports.StatusBee=m,exports.StatusKit=w,exports.Wrapper=function(t){var r=t.service,a=void 0===r?{}:r,i=t.reload,s=void 0===i?a.reload:i,l=t.loadMore,c=void 0===l?a.loadMore:l,u=t.subscribeToStatus,f=void 0===u?!!a.statusHive:u,p=t.statusHive,d=void 0===p?a.statusHive:p,v=t.canLoadHive,h=void 0===v?a.canLoadHive:v,y=t.statusKit,m=void 0===y?a.statusKit:y,x=t.isScrollPositionTopHive,g=void 0===x?a.isScrollPositionTopHive:x,b=t.className,H=void 0===b?"":b,S=t.rememberScrollPosition,w=void 0===S||S,N=o(t,["service","reload","loadMore","subscribeToStatus","statusHive","canLoadHive","statusKit","isScrollPositionTopHive","className","rememberScrollPosition"]);return e.createElement(E,n({service:a,reload:s,loadMore:c,subscribeToStatus:f,className:H,statusHive:d,canLoadHive:h,statusKit:m,rememberScrollPosition:w,isScrollPositionTopHive:g},N))},exports.createFactory=function(){return new C({})},exports.createFormHive=function(e){var t=e.initialValue,r=e.storeKey,o=e.validator,a=e.getValidator,i=e.validateMode,l=void 0===i?"onBlur":i,c=e.onSubmit,u=JSON.parse(JSON.stringify(t)),v=d(JSON.parse(JSON.stringify(u)),r);v.validateMode=l,v.isDirtyHive=d(!1),v.isValidHive=d(!0);var h=new Map;return v.createNestedHive=function(e,t,r){var i,c=s(p({value:t,error:null},r),2),d=c[0],y=c[1];if(v.silentSetHoney=function(e){v.honey="function"==typeof e?e(v.honey):e,v.isDirtyHive.setHoney(!f(v.honey,u)),v.isValidHive.setHoney(!Object.values(v.errors).some((function(e){return e})))},h.set(e,d),v.errors={},v.getError=function(e){return v.errors[e]},v.setError=function(e,t){return v.getNestedHive(e).setError(t)},v.clearErrors=function(){h.forEach((function(e){e.setError()}))},d.silentSetHoney=function(e){"function"==typeof e&&(e=e(d.honey.value)),d.honey={error:d.honey.error,value:e}},d.setError=function(t){t||(t=void 0),v.errors[e]!==t&&(v.errors[e]=t,d.honey={value:d.honey.value,error:t},d._subscribers()<2&&alert({title:JSON.stringify({error:t})}),y())},a){var m=a(v);o=function(e,t){var r;return null===(r=m[e])||void 0===r?void 0:r.call(m,t)}}return d.validate=o?function(t,r){if("function"==typeof t&&(t=t(d.honey.value)),d.honey.error)d.setError(o(e,t));else if("onSubmit"!==l)if("onChange"===l)d.setError(o(e,t));else if("onBlur"===l){var a=document.querySelector(":focus");a&&!a.willValidateOnBlur&&(a.willValidateOnBlur=!0,a.addEventListener("blur",(function(){setTimeout((function(){d.setError(o(e,d.honey.value)),a.willValidateOnBlur=!1}),10)}),{once:!0}))}r?v.setHoney((function(r){var o;return n(n({},r),((o={})[e]=t,o))})):d.setHoney(t)}:d.setHoney,d.isValid=o?function(){return d.setError(o(e,d.honey.value)),!d.honey.error}:function(){return!0},d.subscribe((function(t){v.honey[e]=t.value,v.silentSetHoney(v.honey)})),v.subscribe((function(t){t[e]!==d.honey.value&&d.setHoney(t[e])})),v.honey[e]!==t&&(v.setHoney((function(r){var o;return n(n({},r),((o={})[e]=t,o))})),u=n(n({},u),((i={})[e]=t,i))),d},v.setNestedHoney=function(e,t,r){var o;"function"==typeof t&&(t=t(v.honey[e])),r?v.setHoney((function(r){var o;return n(n({},r),((o={})[e]=t,o))})):null===(o=h.get(e))||void 0===o||o.setHoney(t)},v.getNestedHoney=function(e){return h.get(e).honey.value},v.getNestedHive=function(e){return h.get(e)},v.subscribeToNestedHive=function(e,t){var r;null===(r=h.get(e))||void 0===r||r.subscribe(t)},v.validate=function(e,t,r){v.getNestedHive(e).validate(t,r)},Object.entries(u).forEach((function(e){var t=s(e,2),r=t[0],n=t[1];v.createNestedHive(r,n)})),v.reValidate=function(e){return new Promise((function(t){v.clearErrors(),e||(e=Object.keys(u)),setTimeout((function(){var r=!0;if(!o)return t(r);h.forEach((function(t,n){e.includes(n)&&(t.setError(o(n,t.honey.value)),r&&!t.isValid()&&(r=!1))})),t(r)}),100)}))},v.submit=function(e,t){null==e||e.preventDefault(),v.reValidate(t).then((function(e){e&&c(v.honey)}))},v.reset=function(e){void 0===e&&(e={});var t=JSON.parse(JSON.stringify(u));e&&Object.keys(t).forEach((function(r){var n=e[r];n&&(t[r]=n)})),v.setHoney(t),u=JSON.parse(JSON.stringify(t)),v.clearErrors(),v.isDirtyHive.setHoney(!1)},v},exports.createHive=d,exports.createHiveArray=function(e,t){var r=d(e,t);return r.push=function(e){return r.setHoney((function(t){return l(l([],s(t),!1),[e],!1)}))},r.pop=function(){return r.setHoney((function(e){return e.slice(0,-1)}))},r.shift=function(){return r.setHoney((function(e){return e.slice(1)}))},r.unshift=function(e){return r.setHoney((function(t){return l([e],s(t),!1)}))},r.splice=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r.setHoney((function(r){return l(l(l([],s(r.slice(0,e)),!1),s(n),!1),s(r.slice(e+t)),!1)}))},r.removeById=function(e){return r.setHoney((function(t){return t.filter((function(t){return t.id!==e}))}))},r.removeByIndex=function(e){return r.setHoney((function(t){return l(l([],s(t.slice(0,e)),!1),s(t.slice(e+1)),!1)}))},r.remove=function(e){return r.setHoney((function(t){return l(l([],s(t.slice(0,e)),!1),s(t.slice(e+1)),!1)}))},r.append=function(e){return r.setHoney((function(t){return l(l([],s(t),!1),s(e),!1)}))},r.update=function(){return r.setHoney((function(e){return l([],s(e),!1)}))},r.updateByIndex=function(e,t){return r.setHoney((function(r){return r[e]=t,l([],s(r),!1)}))},r.updateById=function(e,t){return r.setHoney((function(r){return r.map((function(r){return r.id===e?t:r}))}))},r},exports.createHiveObserver=function(e){var t=this,r=s(p(null),2),n=r[0],o=r[1];n.setHoney=function(){throw new Error("Cannot set honey on an observable hive")},n.silentSetHoney=function(){throw new Error("Cannot set honey on an observable hive")};var l=new Set,c=function(e){var t=e.honey;return l.has(e)||(l.add(e),e.subscribe(u)),t},u=function(){return a(t,void 0,void 0,(function(){return i(this,(function(t){return n.honey=e(c),o(),[2]}))}))};return u(),n},exports.createProxyHive=function(e,t){var r=d(e,t),o=new Map;return r.createNestedHive=function(e,t,a){var i=d(t,a);return i.subscribe((function(t){var o;r.silentSetHoney(n(n({},r.honey),((o={})[e]=t,o)))})),r.subscribe((function(t){t[e]!==i.honey&&i.setHoney(t[e])})),o.set(e,i),r.setHoney((function(r){var o;return n(n({},r),((o={})[e]=t,o))})),i},r.setNestedHoney=function(e,t,a){var i;"function"==typeof t&&(t=t(r.honey[e])),a?r.setHoney((function(r){var o;return n(n({},r),((o={})[e]=t,o))})):null===(i=o.get(e))||void 0===i||i.setHoney(t)},r.getNestedHoney=function(e){return o.get(e).honey},r.subscribeToNestedHive=function(e,t){var r;null===(r=o.get(e))||void 0===r||r.subscribe(t)},r.reset=function(){r.setHoney(e)},r.getNestedHive=function(e){return o.get(e)},Object.entries(e).forEach((function(e){var t=s(e,2),n=t[0],o=t[1];r.createNestedHive(n,o)})),r},exports.setDefaultStatusKit=function(e){Object.keys(e).forEach((function(t){w[t]=e[t]}))},exports.useFormHive=function(e){return[y(e),e.validate]},exports.useFormHoney=y,exports.useHive=function(e){return[h(e),e.setHoney]},exports.useHoney=h;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|