native-document 1.0.150 → 1.0.152
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/cdn.js +4 -0
- package/components.js +1 -0
- package/devtools/plugin/dev-tools-plugin.js +1 -1
- package/devtools/widget/Widget.js +2 -1
- package/devtools/widget.js +1 -1
- package/dist/native-document.components.min.js +1657 -3477
- package/dist/native-document.dev.js +3384 -3637
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/elements.js +5 -0
- package/index.js +3 -2
- package/package.json +1 -1
- package/rollup.config.js +1 -1
- package/src/components/$traits/has-items/HasItems.js +1 -1
- package/src/components/BaseComponent.js +3 -7
- package/src/components/accordion/AccordionItem.js +1 -1
- package/src/components/avatar/Avatar.js +0 -2
- package/src/components/breadcrumb/BreadCrumb.js +1 -1
- package/src/components/context-menu/ContextMenu.js +1 -1
- package/src/components/dropdown/Dropdown.js +1 -1
- package/src/components/dropdown/DropdownGroup.js +1 -1
- package/src/components/dropdown/helpers.js +2 -1
- package/src/components/form/FormControl.js +2 -1
- package/src/components/form/field/DefaultRender.js +1 -1
- package/src/components/form/field/Field.js +2 -1
- package/src/components/form/field/FieldCollection.js +2 -1
- package/src/components/form/field/types/CheckboxField.js +1 -1
- package/src/components/form/field/types/FileField.js +1 -1
- package/src/components/form/field/types/RadioField.js +1 -1
- package/src/components/form/field/types/file-field-mode/FileItemPreview.js +1 -1
- package/src/components/form/validation/Validation.js +1 -1
- package/src/components/list/ListItem.js +1 -1
- package/src/components/menu/Menu.js +1 -1
- package/src/components/menu/MenuGroup.js +1 -1
- package/src/components/menu/MenuItem.js +1 -1
- package/src/components/modal/Modal.js +1 -1
- package/src/components/pagination/Pagination.js +1 -1
- package/src/components/popover/Popover.js +1 -1
- package/src/components/progress/Progress.js +0 -1
- package/src/components/splitter/Splitter.js +1 -1
- package/src/components/splitter/SplitterGutter.js +1 -1
- package/src/components/splitter/SplitterPanel.js +1 -1
- package/src/components/stepper/Stepper.js +1 -1
- package/src/components/stepper/StepperStep.js +1 -1
- package/src/components/switch/Switch.js +1 -1
- package/src/components/table/DataTable.js +1 -1
- package/src/components/table/index.js +0 -2
- package/src/components/tabs/Tabs.js +1 -1
- package/src/components/toast/Toast.js +1 -1
- package/src/components/tooltip/Tooltip.js +1 -1
- package/src/core/data/ObservableItem.js +0 -113
- package/src/core/data/observable-helpers/observable.prototypes.js +119 -0
- package/src/core/elements/anchor/one-child-anchor-overwriting.js +1 -1
- package/src/core/utils/validator.js +4 -6
- package/src/core/wrappers/ElementCreator.js +0 -9
- package/src/core/wrappers/NDElement.js +3 -3
- package/src/core/wrappers/prototypes/nd-element-extensions.js +3 -0
- package/src/i18n/service/I18nService.js +1 -1
- package/src/i18n/service/functions.js +1 -1
- package/cdn.components.js +0 -28
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../../../../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../../../../core/utils/HasEventEmitter";
|
|
3
|
-
import { $ } from '
|
|
3
|
+
import { $ } from '../../../../../core/data/Observable';
|
|
4
4
|
|
|
5
5
|
export default function FileItemPreview(file, props = {}) {
|
|
6
6
|
if(!(this instanceof FileItemPreview)) {
|
|
@@ -3,7 +3,7 @@ import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
|
3
3
|
import HasItems from "../$traits/has-items/HasItems";
|
|
4
4
|
import MenuGroup from "./MenuGroup";
|
|
5
5
|
import HasMenuItem from "./HasMenuItem";
|
|
6
|
-
import { $ } from '
|
|
6
|
+
import { $ } from '../../core/data/Observable'
|
|
7
7
|
|
|
8
8
|
export default function Menu(props = {}) {
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ import BaseComponent from "../BaseComponent";
|
|
|
2
2
|
import HasItems from "../$traits/has-items/HasItems";
|
|
3
3
|
import MenuDivider from "./MenuDivider";
|
|
4
4
|
import HasMenuItem from "./HasMenuItem";
|
|
5
|
-
import { $ } from '
|
|
5
|
+
import { $ } from '../../core/data/Observable';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export default function MenuGroup(label, props = {}) {
|
|
@@ -3,7 +3,7 @@ import HasItems from "../$traits/has-items/HasItems";
|
|
|
3
3
|
import MenuDivider from "./MenuDivider";
|
|
4
4
|
import MenuGroup from "./MenuGroup";
|
|
5
5
|
import HasMenuItem from "./HasMenuItem";
|
|
6
|
-
import { $ } from '
|
|
6
|
+
import { $ } from '../../core/data/Observable';
|
|
7
7
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
8
8
|
|
|
9
9
|
const EMPTY_PROPS = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import { Observable } from "
|
|
3
|
+
import { Observable } from "../../core/data/Observable";
|
|
4
4
|
import {NDElement} from "../../core/wrappers/NDElement";
|
|
5
5
|
import HasDraggable from "../$traits/has-draggable/HasDraggable";
|
|
6
6
|
import HasResizable from "../$traits/has-resizable/HasResizable";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import { Observable } from "
|
|
3
|
+
import { Observable } from "../../core/data/Observable";
|
|
4
4
|
import {ElementCreator} from "../../core/wrappers/ElementCreator";
|
|
5
5
|
import {NDElement} from "../../core/wrappers/NDElement";
|
|
6
6
|
import DebugManager from "../../core/utils/debug-manager";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import
|
|
3
|
+
import Validator from "../../core/utils/validator";
|
|
4
4
|
import SplitterPanel from "./SplitterPanel";
|
|
5
5
|
|
|
6
6
|
export default function Splitter(props = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import { $ } from '
|
|
3
|
+
import { $ } from '../../core/data/Observable';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default function SplitterGutter(leftPanel, rightPanel, props = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import {
|
|
3
|
+
import { $ } from "../../core/data/Observable";
|
|
4
4
|
import DebugManager from "../../core/utils/debug-manager";
|
|
5
5
|
import StepperStep from "./StepperStep";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import { $ } from '
|
|
3
|
+
import { $ } from '../../core/data/Observable'
|
|
4
4
|
|
|
5
5
|
export default function Switch(props = {}) {
|
|
6
6
|
if (!(this instanceof Switch)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Column from "./Column";
|
|
2
2
|
import ColumnGroup from "./ColumnGroup";
|
|
3
3
|
import BaseComponent from "../BaseComponent";
|
|
4
|
-
import {Observable as $} from "
|
|
4
|
+
import {Observable as $} from "../../core/data/Observable";
|
|
5
5
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
6
6
|
import DebugManager from "../../core/utils/debug-manager";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
-
import {Observable} from "
|
|
3
|
+
import {Observable} from "../../core/data/Observable";
|
|
4
4
|
|
|
5
5
|
export default function Toast(content, props = {}) {
|
|
6
6
|
if (!(this instanceof Toast)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tooltip - Interface
|
|
3
3
|
*/
|
|
4
|
-
import {Observable} from "
|
|
4
|
+
import {Observable} from "../../core/data/Observable";
|
|
5
5
|
import {NDElement} from "../../core/wrappers/NDElement";
|
|
6
6
|
import BaseComponent from "../BaseComponent";
|
|
7
7
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import DebugManager from "../../core/utils/debug-manager";
|
|
2
2
|
import MemoryManager from "./MemoryManager";
|
|
3
3
|
import NativeDocumentError from "../../core/errors/NativeDocumentError";
|
|
4
|
-
import ObservableChecker from "./ObservableChecker";
|
|
5
4
|
import PluginsManager from "../../core/utils/plugins-manager";
|
|
6
5
|
import Validator from "../../core/utils/validator";
|
|
7
|
-
import {ObservableWhen} from "./ObservableWhen";
|
|
8
6
|
import {deepClone} from "../utils/helpers";
|
|
9
|
-
import { Formatters} from "../utils/formatters";
|
|
10
|
-
import {Observable} from "./Observable";
|
|
11
7
|
import {$getFromStorage, $saveToStorage} from "../utils/localstorage";
|
|
12
8
|
|
|
13
9
|
/**
|
|
@@ -364,27 +360,6 @@ ObservableItem.prototype.unsubscribe = function(callback) {
|
|
|
364
360
|
}
|
|
365
361
|
};
|
|
366
362
|
|
|
367
|
-
/**
|
|
368
|
-
* Create an Observable checker instance
|
|
369
|
-
* @param callback
|
|
370
|
-
* @returns {ObservableChecker}
|
|
371
|
-
*/
|
|
372
|
-
ObservableItem.prototype.check = function(callback) {
|
|
373
|
-
return new ObservableChecker(this, callback)
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
ObservableItem.prototype.transform = ObservableItem.prototype.check;
|
|
377
|
-
ObservableItem.prototype.pluck = function(property) {
|
|
378
|
-
return new ObservableChecker(this, (value) => value[property]);
|
|
379
|
-
};
|
|
380
|
-
ObservableItem.prototype.is = function(callbackOrValue) {
|
|
381
|
-
if(typeof callbackOrValue === 'function') {
|
|
382
|
-
return new ObservableChecker(this, callbackOrValue);
|
|
383
|
-
}
|
|
384
|
-
return new ObservableChecker(this, (value) => value === callbackOrValue);
|
|
385
|
-
};
|
|
386
|
-
ObservableItem.prototype.select = ObservableItem.prototype.check;
|
|
387
|
-
|
|
388
363
|
|
|
389
364
|
|
|
390
365
|
|
|
@@ -404,21 +379,6 @@ ObservableItem.prototype.get = function(key) {
|
|
|
404
379
|
return Validator.isObservable(item) ? item.val() : item;
|
|
405
380
|
};
|
|
406
381
|
|
|
407
|
-
/**
|
|
408
|
-
* Creates an ObservableWhen that represents whether the observable equals a specific value.
|
|
409
|
-
* Returns an object that can be subscribed to and will emit true/false.
|
|
410
|
-
*
|
|
411
|
-
* @param {*} value - The value to compare against
|
|
412
|
-
* @returns {ObservableWhen} An ObservableWhen instance that tracks when the observable equals the value
|
|
413
|
-
* @example
|
|
414
|
-
* const status = Observable('idle');
|
|
415
|
-
* const isLoading = status.when('loading');
|
|
416
|
-
* isLoading.subscribe(active => console.log('Loading:', active));
|
|
417
|
-
* status.set('loading'); // Logs: "Loading: true"
|
|
418
|
-
*/
|
|
419
|
-
ObservableItem.prototype.when = function(value) {
|
|
420
|
-
return new ObservableWhen(this, value);
|
|
421
|
-
};
|
|
422
382
|
|
|
423
383
|
/**
|
|
424
384
|
* Compares the observable's current value with another value or observable.
|
|
@@ -506,79 +466,6 @@ ObservableItem.prototype.valueOf = function() {
|
|
|
506
466
|
};
|
|
507
467
|
|
|
508
468
|
|
|
509
|
-
/**
|
|
510
|
-
* Creates a derived observable that formats the current value using Intl.
|
|
511
|
-
* Automatically reacts to both value changes and locale changes (Store.__nd.locale).
|
|
512
|
-
*
|
|
513
|
-
* @param {string | Function} type - Format type or custom formatter function
|
|
514
|
-
* @param {Object} [options={}] - Options passed to the formatter
|
|
515
|
-
* @returns {ObservableItem<string>}
|
|
516
|
-
*
|
|
517
|
-
* @example
|
|
518
|
-
* // Currency
|
|
519
|
-
* price.format('currency') // "15 000 FCFA"
|
|
520
|
-
* price.format('currency', { currency: 'EUR' }) // "15 000,00 €"
|
|
521
|
-
* price.format('currency', { notation: 'compact' }) // "15 K FCFA"
|
|
522
|
-
*
|
|
523
|
-
* // Number
|
|
524
|
-
* count.format('number') // "15 000"
|
|
525
|
-
*
|
|
526
|
-
* // Percent
|
|
527
|
-
* rate.format('percent') // "15,0 %"
|
|
528
|
-
* rate.format('percent', { decimals: 2 }) // "15,00 %"
|
|
529
|
-
*
|
|
530
|
-
* // Date
|
|
531
|
-
* date.format('date') // "3 mars 2026"
|
|
532
|
-
* date.format('date', { dateStyle: 'full' }) // "mardi 3 mars 2026"
|
|
533
|
-
* date.format('date', { format: 'DD/MM/YYYY' }) // "03/03/2026"
|
|
534
|
-
* date.format('date', { format: 'DD MMM YYYY' }) // "03 mar 2026"
|
|
535
|
-
* date.format('date', { format: 'DD MMMM YYYY' }) // "03 mars 2026"
|
|
536
|
-
*
|
|
537
|
-
* // Time
|
|
538
|
-
* date.format('time') // "20:30"
|
|
539
|
-
* date.format('time', { second: '2-digit' }) // "20:30:00"
|
|
540
|
-
* date.format('time', { format: 'HH:mm:ss' }) // "20:30:00"
|
|
541
|
-
*
|
|
542
|
-
* // Datetime
|
|
543
|
-
* date.format('datetime') // "3 mars 2026, 20:30"
|
|
544
|
-
* date.format('datetime', { dateStyle: 'full' }) // "mardi 3 mars 2026, 20:30"
|
|
545
|
-
* date.format('datetime', { format: 'DD/MM/YYYY HH:mm' }) // "03/03/2026 20:30"
|
|
546
|
-
*
|
|
547
|
-
* // Relative
|
|
548
|
-
* date.format('relative') // "dans 11 jours"
|
|
549
|
-
* date.format('relative', { unit: 'month' }) // "dans 1 mois"
|
|
550
|
-
*
|
|
551
|
-
* // Plural
|
|
552
|
-
* count.format('plural', { singular: 'billet', plural: 'billets' }) // "3 billets"
|
|
553
|
-
*
|
|
554
|
-
* // Custom formatter
|
|
555
|
-
* price.format(value => `${value.toLocaleString()} FCFA`)
|
|
556
|
-
*
|
|
557
|
-
* // Reacts to locale changes automatically
|
|
558
|
-
* Store.setLocale('en-US');
|
|
559
|
-
*/
|
|
560
|
-
ObservableItem.prototype.format = function(type, options = {}) {
|
|
561
|
-
const self = this;
|
|
562
|
-
|
|
563
|
-
if (typeof type === 'function') {
|
|
564
|
-
return new ObservableChecker(self, type);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if (process.env.NODE_ENV === 'development') {
|
|
568
|
-
if (!Formatters[type]) {
|
|
569
|
-
throw new NativeDocumentError(
|
|
570
|
-
`Observable.format : unknown type '${type}'. Available : ${Object.keys(Formatters).join(', ')}.`
|
|
571
|
-
);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
const formatter = Formatters[type];
|
|
576
|
-
const localeObservable = Formatters.locale;
|
|
577
|
-
|
|
578
|
-
return Observable.computed(() => formatter(self.val(), localeObservable.val(), options),
|
|
579
|
-
[self, localeObservable]
|
|
580
|
-
);
|
|
581
|
-
};
|
|
582
469
|
|
|
583
470
|
ObservableItem.prototype.persist = function(key, options = {}) {
|
|
584
471
|
let value = $getFromStorage(key, this.$currentValue);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an ObservableWhen that represents whether the observable equals a specific value.
|
|
3
|
+
* Returns an object that can be subscribed to and will emit true/false.
|
|
4
|
+
*
|
|
5
|
+
* @param {*} value - The value to compare against
|
|
6
|
+
* @returns {ObservableWhen} An ObservableWhen instance that tracks when the observable equals the value
|
|
7
|
+
* @example
|
|
8
|
+
* const status = Observable('idle');
|
|
9
|
+
* const isLoading = status.when('loading');
|
|
10
|
+
* isLoading.subscribe(active => console.log('Loading:', active));
|
|
11
|
+
* status.set('loading'); // Logs: "Loading: true"
|
|
12
|
+
*/
|
|
13
|
+
import {ObservableWhen} from "../ObservableWhen";
|
|
14
|
+
import ObservableItem from "../ObservableItem";
|
|
15
|
+
import ObservableChecker from "../ObservableChecker";
|
|
16
|
+
import {Formatters} from "../../utils/formatters";
|
|
17
|
+
import NativeDocumentError from "../../errors/NativeDocumentError";
|
|
18
|
+
import {Observable} from "../Observable";
|
|
19
|
+
|
|
20
|
+
ObservableItem.prototype.when = function(value) {
|
|
21
|
+
return new ObservableWhen(this, value);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create an Observable checker instance
|
|
28
|
+
* @param callback
|
|
29
|
+
* @returns {ObservableChecker}
|
|
30
|
+
*/
|
|
31
|
+
ObservableItem.prototype.check = function(callback) {
|
|
32
|
+
return new ObservableChecker(this, callback)
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
ObservableItem.prototype.transform = ObservableItem.prototype.check;
|
|
36
|
+
ObservableItem.prototype.pluck = function(property) {
|
|
37
|
+
return new ObservableChecker(this, (value) => value[property]);
|
|
38
|
+
};
|
|
39
|
+
ObservableItem.prototype.is = function(callbackOrValue) {
|
|
40
|
+
if(typeof callbackOrValue === 'function') {
|
|
41
|
+
return new ObservableChecker(this, callbackOrValue);
|
|
42
|
+
}
|
|
43
|
+
return new ObservableChecker(this, (value) => value === callbackOrValue);
|
|
44
|
+
};
|
|
45
|
+
ObservableItem.prototype.select = ObservableItem.prototype.check;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates a derived observable that formats the current value using Intl.
|
|
49
|
+
* Automatically reacts to both value changes and locale changes (Store.__nd.locale).
|
|
50
|
+
*
|
|
51
|
+
* @param {string | Function} type - Format type or custom formatter function
|
|
52
|
+
* @param {Object} [options={}] - Options passed to the formatter
|
|
53
|
+
* @returns {ObservableItem<string>}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Currency
|
|
57
|
+
* price.format('currency') // "15 000 FCFA"
|
|
58
|
+
* price.format('currency', { currency: 'EUR' }) // "15 000,00 €"
|
|
59
|
+
* price.format('currency', { notation: 'compact' }) // "15 K FCFA"
|
|
60
|
+
*
|
|
61
|
+
* // Number
|
|
62
|
+
* count.format('number') // "15 000"
|
|
63
|
+
*
|
|
64
|
+
* // Percent
|
|
65
|
+
* rate.format('percent') // "15,0 %"
|
|
66
|
+
* rate.format('percent', { decimals: 2 }) // "15,00 %"
|
|
67
|
+
*
|
|
68
|
+
* // Date
|
|
69
|
+
* date.format('date') // "3 mars 2026"
|
|
70
|
+
* date.format('date', { dateStyle: 'full' }) // "mardi 3 mars 2026"
|
|
71
|
+
* date.format('date', { format: 'DD/MM/YYYY' }) // "03/03/2026"
|
|
72
|
+
* date.format('date', { format: 'DD MMM YYYY' }) // "03 mar 2026"
|
|
73
|
+
* date.format('date', { format: 'DD MMMM YYYY' }) // "03 mars 2026"
|
|
74
|
+
*
|
|
75
|
+
* // Time
|
|
76
|
+
* date.format('time') // "20:30"
|
|
77
|
+
* date.format('time', { second: '2-digit' }) // "20:30:00"
|
|
78
|
+
* date.format('time', { format: 'HH:mm:ss' }) // "20:30:00"
|
|
79
|
+
*
|
|
80
|
+
* // Datetime
|
|
81
|
+
* date.format('datetime') // "3 mars 2026, 20:30"
|
|
82
|
+
* date.format('datetime', { dateStyle: 'full' }) // "mardi 3 mars 2026, 20:30"
|
|
83
|
+
* date.format('datetime', { format: 'DD/MM/YYYY HH:mm' }) // "03/03/2026 20:30"
|
|
84
|
+
*
|
|
85
|
+
* // Relative
|
|
86
|
+
* date.format('relative') // "dans 11 jours"
|
|
87
|
+
* date.format('relative', { unit: 'month' }) // "dans 1 mois"
|
|
88
|
+
*
|
|
89
|
+
* // Plural
|
|
90
|
+
* count.format('plural', { singular: 'billet', plural: 'billets' }) // "3 billets"
|
|
91
|
+
*
|
|
92
|
+
* // Custom formatter
|
|
93
|
+
* price.format(value => `${value.toLocaleString()} FCFA`)
|
|
94
|
+
*
|
|
95
|
+
* // Reacts to locale changes automatically
|
|
96
|
+
* Store.setLocale('en-US');
|
|
97
|
+
*/
|
|
98
|
+
ObservableItem.prototype.format = function(type, options = {}) {
|
|
99
|
+
const self = this;
|
|
100
|
+
|
|
101
|
+
if (typeof type === 'function') {
|
|
102
|
+
return new ObservableChecker(self, type);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (process.env.NODE_ENV === 'development') {
|
|
106
|
+
if (!Formatters[type]) {
|
|
107
|
+
throw new NativeDocumentError(
|
|
108
|
+
`Observable.format : unknown type '${type}'. Available : ${Object.keys(Formatters).join(', ')}.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const formatter = Formatters[type];
|
|
114
|
+
const localeObservable = Formatters.locale;
|
|
115
|
+
|
|
116
|
+
return Observable.computed(() => formatter(self.val(), localeObservable.val(), options),
|
|
117
|
+
[self, localeObservable]
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import DebugManager from "./debug-manager";
|
|
2
2
|
import NativeDocumentError from "../errors/NativeDocumentError";
|
|
3
|
-
import ObservableChecker from "../data/ObservableChecker";
|
|
4
|
-
import {NDElement} from "../wrappers/NDElement";
|
|
5
3
|
|
|
6
4
|
const COMMON_NODE_TYPES = {
|
|
7
5
|
ELEMENT: 1,
|
|
@@ -40,7 +38,7 @@ const Validator = {
|
|
|
40
38
|
return value?.__Anchor__
|
|
41
39
|
},
|
|
42
40
|
isObservableChecker(value) {
|
|
43
|
-
return value?.__$isObservableChecker
|
|
41
|
+
return value?.__$isObservableChecker;
|
|
44
42
|
},
|
|
45
43
|
isArray(value) {
|
|
46
44
|
return Array.isArray(value);
|
|
@@ -81,12 +79,12 @@ const Validator = {
|
|
|
81
79
|
isValidChild(child) {
|
|
82
80
|
return child === null ||
|
|
83
81
|
this.isElement(child) ||
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
child.__$Observable ||
|
|
83
|
+
child?.__$isNDElement ||
|
|
86
84
|
['string', 'number', 'boolean'].includes(typeof child);
|
|
87
85
|
},
|
|
88
86
|
isNDElement(child) {
|
|
89
|
-
return child?.__$isNDElement
|
|
87
|
+
return child?.__$isNDElement;
|
|
90
88
|
},
|
|
91
89
|
isValidChildren(children) {
|
|
92
90
|
if (!Array.isArray(children)) {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import Anchor from "../elements/anchor/anchor";
|
|
2
1
|
import Validator from "../utils/validator";
|
|
3
2
|
import AttributesWrapper, { bindClassAttribute, bindStyleAttribute } from "./AttributesWrapper";
|
|
4
3
|
import PluginsManager from "../utils/plugins-manager";
|
|
5
|
-
import './prototypes/nd-element-extensions';
|
|
6
|
-
import './prototypes/nd-element.transition.extensions';
|
|
7
|
-
import './prototypes/attributes-extensions';
|
|
8
|
-
import './prototypes/bind-class-extensions';
|
|
9
4
|
|
|
10
|
-
const $nodeCache = new Map();
|
|
11
5
|
let $textNodeCache = null;
|
|
12
6
|
|
|
13
7
|
export const ElementCreator = {
|
|
@@ -64,9 +58,6 @@ export const ElementCreator = {
|
|
|
64
58
|
const node = document.createElement(name);
|
|
65
59
|
return node.cloneNode();
|
|
66
60
|
},
|
|
67
|
-
createFragment: (name) => {
|
|
68
|
-
return Anchor('Fragment');
|
|
69
|
-
},
|
|
70
61
|
bindTextNode: (textNode, value) => {
|
|
71
62
|
if(value?.__$isObservable) {
|
|
72
63
|
value.subscribe(newValue => textNode.nodeValue = newValue);
|
|
@@ -2,8 +2,6 @@ import DocumentObserver from "./DocumentObserver";
|
|
|
2
2
|
import PluginsManager from "../utils/plugins-manager";
|
|
3
3
|
import NativeDocumentError from "../errors/NativeDocumentError.js";
|
|
4
4
|
import DebugManager from "../utils/debug-manager.js";
|
|
5
|
-
import Anchor from "../elements/anchor/anchor";
|
|
6
|
-
import {ElementCreator} from "./ElementCreator";
|
|
7
5
|
|
|
8
6
|
export function NDElement(element) {
|
|
9
7
|
this.$element = element;
|
|
@@ -15,11 +13,13 @@ export function NDElement(element) {
|
|
|
15
13
|
|
|
16
14
|
NDElement.prototype.__$isNDElement = true;
|
|
17
15
|
|
|
16
|
+
NDElement.$getChild = (el) => el;
|
|
17
|
+
|
|
18
18
|
NDElement.prototype.ghostDom = function(element) {
|
|
19
19
|
if(!this.$attachements) {
|
|
20
20
|
this.$attachements = document.createDocumentFragment();
|
|
21
21
|
}
|
|
22
|
-
this.$attachements.appendChild(
|
|
22
|
+
this.$attachements.appendChild(NDElement.$getChild(element));
|
|
23
23
|
return this;
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -5,6 +5,9 @@ import {ElementCreator} from "../ElementCreator";
|
|
|
5
5
|
import PluginsManager from "../../utils/plugins-manager";
|
|
6
6
|
import ObservableChecker from "../../data/ObservableChecker";
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
NDElement.$getChild = ElementCreator.getChild;
|
|
10
|
+
|
|
8
11
|
String.prototype.toNdElement = function () {
|
|
9
12
|
return ElementCreator.createStaticTextNode(null, this);
|
|
10
13
|
};
|
package/cdn.components.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export * from './src/components/accordion/index';
|
|
2
|
-
export * from './src/components/alert/index';
|
|
3
|
-
export * from './src/components/avatar/index';
|
|
4
|
-
export * from './src/components/badge/index';
|
|
5
|
-
export * from './src/components/breadcrumb/index';
|
|
6
|
-
export * from './src/components/button/index';
|
|
7
|
-
export * from './src/components/card/index';
|
|
8
|
-
export * from './src/components/context-menu/index';
|
|
9
|
-
export * from './src/components/divider/index';
|
|
10
|
-
export * from './src/components/dropdown/index';
|
|
11
|
-
export * from './src/components/form/index';
|
|
12
|
-
export * from './src/components/list/index';
|
|
13
|
-
export * from './src/components/menu/index';
|
|
14
|
-
export * from './src/components/modal/index';
|
|
15
|
-
export * from './src/components/pagination/index';
|
|
16
|
-
export * from './src/components/popover/index';
|
|
17
|
-
export * from './src/components/progress/index';
|
|
18
|
-
export * from './src/components/skeleton/index';
|
|
19
|
-
export * from './src/components/slider/index';
|
|
20
|
-
export * from './src/components/spinner/index';
|
|
21
|
-
export * from './src/components/splitter/index';
|
|
22
|
-
export * from './src/components/stepper/index';
|
|
23
|
-
export * from './src/components/switch/index';
|
|
24
|
-
export * from './src/components/table/index';
|
|
25
|
-
export * from './src/components/tabs/index';
|
|
26
|
-
export * from './src/components/toast/index';
|
|
27
|
-
export * from './src/components/tooltip/index';
|
|
28
|
-
export * from './src/components/stacks/index';
|