native-document 1.0.218 → 1.0.220
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.220",
|
|
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>;
|
|
@@ -193,7 +193,7 @@ const _prevent = function(element, eventName, callback, options) {
|
|
|
193
193
|
callback && callback.call(element, event);
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
const inlineHandler = '
|
|
196
|
+
const inlineHandler = 'on' + eventName;
|
|
197
197
|
if(!element[inlineHandler] && !options) {
|
|
198
198
|
element[inlineHandler] = handler;
|
|
199
199
|
return;
|
|
@@ -207,7 +207,7 @@ const _stop = function(element, eventName, callback, options) {
|
|
|
207
207
|
callback && callback.call(element, event);
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
const inlineHandler = '
|
|
210
|
+
const inlineHandler = 'on' + eventName;
|
|
211
211
|
if(!element[inlineHandler] && !options) {
|
|
212
212
|
element[inlineHandler] = handler;
|
|
213
213
|
return;
|
|
@@ -223,7 +223,7 @@ const _preventStop = function(element, eventName, callback, options) {
|
|
|
223
223
|
event.preventDefault();
|
|
224
224
|
callback && callback.call(element, event);
|
|
225
225
|
};
|
|
226
|
-
const inlineHandler = '
|
|
226
|
+
const inlineHandler = 'on' + eventName;
|
|
227
227
|
if(!element[inlineHandler] && !options) {
|
|
228
228
|
element[inlineHandler] = handler;
|
|
229
229
|
return;
|