native-document 1.0.219 → 1.0.221
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/package.json +1 -1
- package/src/components/$traits/has-items/HasItems.d.ts +2 -1
- package/src/components/form/index.js +2 -1
- package/src/components/index.d.ts +1 -0
- package/src/components/modal/createModal.js +11 -0
- package/src/components/modal/types/createModal.d.ts +20 -0
- package/src/core/data/Store.js +7 -1
- package/src/ui/components/modal/ModalRender.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.221",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,6 +8,7 @@ import TextAreaField from './field/types/TextAreaField';
|
|
|
8
8
|
import CheckboxField from './field/types/CheckboxField';
|
|
9
9
|
import RadioField from './field/types/RadioField';
|
|
10
10
|
import SelectField from './field/types/SelectField';
|
|
11
|
+
import SearchField from './field/types/SearchField';
|
|
11
12
|
import HiddenField from './field/types/HiddenField';
|
|
12
13
|
import FileField from './field/types/FileField';
|
|
13
14
|
import DateField from './field/types/DateField';
|
|
@@ -57,5 +58,5 @@ export {
|
|
|
57
58
|
FileWallMode,
|
|
58
59
|
FileUploadButtonMode,
|
|
59
60
|
FileDropzoneMode,
|
|
60
|
-
|
|
61
|
+
SearchField
|
|
61
62
|
};
|
|
@@ -99,6 +99,7 @@ export type { MenuLink, MenuLinkInterface } from './menu/types/MenuLink';
|
|
|
99
99
|
|
|
100
100
|
// --- Modal -------------------------------------------------------------------
|
|
101
101
|
export type { Modal, ModalInterface, ModalDescription } from './modal/types/Modal';
|
|
102
|
+
export type { createModal, ModalInstance, ModalBuilderContext } from './modal/types/createModal';
|
|
102
103
|
|
|
103
104
|
// --- Pagination --------------------------------------------------------------
|
|
104
105
|
export type { Pagination, PaginationInterface, PaginationDescription } from './pagination/types/Pagination';
|
|
@@ -3,6 +3,17 @@ import {createPortal} from '../../core/elements/anchor/anchor';
|
|
|
3
3
|
import Modal from './Modal';
|
|
4
4
|
import {once} from '../../core/utils/cache';
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates a singleton Promise-based modal factory.
|
|
9
|
+
* The modal is created once (via `once`) and reused on every subsequent call.
|
|
10
|
+
* Opening the modal returns a Promise that resolves with the selected value
|
|
11
|
+
* or null if the modal is dismissed.
|
|
12
|
+
*
|
|
13
|
+
* @param {{resolve: Function, reject: Function, onOpen: (callback: Function) => {}, onClose: (callback: Function) => {} }} builder
|
|
14
|
+
*
|
|
15
|
+
* @return {{ open: (params: *) => {}, close: () => {}, instance: Modal }}
|
|
16
|
+
*/
|
|
6
17
|
export function createModal(builder) {
|
|
7
18
|
return once(() => {
|
|
8
19
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {RefItem} from "../../../../types/ref";
|
|
2
|
+
import {ModalInterface} from "./Modal";
|
|
3
|
+
import {ValidChild} from "../../../../types/elements";
|
|
4
|
+
|
|
5
|
+
export type ModalBuilderContext<TResult = any, TParams = any> = {
|
|
6
|
+
resolve(value: TResult): void;
|
|
7
|
+
reject(): void;
|
|
8
|
+
onOpen(callback: (params: TParams) => void): void;
|
|
9
|
+
onClose(callback: () => void): void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ModalInstance<TResult = any, TParams = any> = {
|
|
13
|
+
open(params?: TParams): Promise<TResult | null>;
|
|
14
|
+
close(): void;
|
|
15
|
+
instance: RefItem<ModalInstance> & ModalInterface;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export declare function createModal<TResult = any, TParams = any>(
|
|
19
|
+
builder: (context: ModalBuilderContext<TResult, TParams>) => ValidChild | ModalInterface
|
|
20
|
+
): () => ModalInstance<TResult, TParams>;
|
package/src/core/data/Store.js
CHANGED
|
@@ -472,7 +472,13 @@ export const StoreFactory = function() {
|
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
474
|
if (target.has(prop)) {
|
|
475
|
-
|
|
475
|
+
if ($followersCache.has(prop)) {
|
|
476
|
+
return $followersCache.get(prop);
|
|
477
|
+
}
|
|
478
|
+
const follower = target.follow(prop);
|
|
479
|
+
$followersCache.set(prop, follower);
|
|
480
|
+
|
|
481
|
+
return follower;
|
|
476
482
|
}
|
|
477
483
|
return target[prop];
|
|
478
484
|
},
|