native-document 1.0.76 → 1.0.77
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/components.js +26 -1
- package/dist/native-document.components.min.js +6360 -1925
- package/dist/native-document.dev.js +122 -56
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.devtools.min.js +1 -1
- package/dist/native-document.min.js +1 -1
- package/jsconfig.json +15 -0
- package/package.json +1 -1
- package/rollup.config.js +4 -2
- package/src/components/$traits/HasItems.js +38 -0
- package/src/components/BaseComponent.js +70 -0
- package/src/components/accordion/Accordion.js +133 -0
- package/src/components/accordion/AccordionItem.js +119 -0
- package/src/components/accordion/index.js +7 -0
- package/src/components/alert/Alert.js +155 -0
- package/src/components/alert/index.js +6 -0
- package/src/components/avatar/Avatar.js +178 -0
- package/src/components/avatar/index.js +5 -0
- package/src/components/badge/Badge.js +103 -0
- package/src/components/badge/index.js +6 -0
- package/src/components/breadcrumb/BreadCrumb.js +70 -0
- package/src/components/breadcrumb/index.js +5 -0
- package/src/components/button/Button.js +174 -0
- package/src/components/button/index.js +5 -0
- package/src/components/card/Card.js +110 -0
- package/src/components/card/index.js +5 -0
- package/src/components/context-menu/ContextMenu.js +60 -0
- package/src/components/context-menu/ContextMenuGroup.js +16 -0
- package/src/components/context-menu/ContextMenuItem.js +16 -0
- package/src/components/context-menu/index.js +10 -0
- package/src/components/divider/Divider.js +126 -0
- package/src/components/divider/index.js +6 -0
- package/src/components/dropdown/Dropdown.js +170 -0
- package/src/components/dropdown/DropdownDivider.js +24 -0
- package/src/components/dropdown/DropdownGroup.js +44 -0
- package/src/components/dropdown/DropdownItem.js +71 -0
- package/src/components/dropdown/DropdownTrigger.js +64 -0
- package/src/components/dropdown/index.js +13 -0
- package/src/components/{fom-control → form}/FormControl.js +30 -22
- package/src/components/{fom-control → form}/field/DefaultRender.js +2 -16
- package/src/components/{fom-control → form}/field/Field.js +67 -140
- package/src/components/{fom-control → form}/field/FieldCollection.js +42 -22
- package/src/components/{fom-control → form}/field/types/AutocompleteField.js +11 -0
- package/src/components/form/field/types/CheckboxField.js +36 -0
- package/src/components/{fom-control → form}/field/types/CheckboxGroupField.js +10 -0
- package/src/components/{fom-control → form}/field/types/ColorField.js +11 -1
- package/src/components/{fom-control → form}/field/types/DateField.js +11 -1
- package/src/components/{fom-control → form}/field/types/EmailField.js +11 -1
- package/src/components/{fom-control → form}/field/types/FileField.js +11 -1
- package/src/components/form/field/types/HiddenField.js +18 -0
- package/src/components/{fom-control → form}/field/types/ImageField.js +11 -1
- package/src/components/{fom-control → form}/field/types/NumberField.js +11 -1
- package/src/components/{fom-control → form}/field/types/PasswordField.js +11 -1
- package/src/components/{fom-control → form}/field/types/RadioField.js +28 -2
- package/src/components/{fom-control → form}/field/types/RangeField.js +10 -0
- package/src/components/{fom-control → form}/field/types/SearchField.js +10 -0
- package/src/components/{fom-control → form}/field/types/SelectField.js +10 -0
- package/src/components/{fom-control → form}/field/types/StringField.js +11 -1
- package/src/components/{fom-control → form}/field/types/TelField.js +11 -2
- package/src/components/{fom-control → form}/field/types/TextAreaField.js +10 -0
- package/src/components/{fom-control → form}/field/types/TimeField.js +11 -2
- package/src/components/{fom-control → form}/field/types/UrlField.js +10 -2
- package/src/components/form/index.js +49 -0
- package/src/components/{fom-control → form}/validation/Validation.js +1 -1
- package/src/components/list/List.js +106 -0
- package/src/components/list/ListGroup.js +67 -0
- package/src/components/list/ListItem.js +103 -0
- package/src/components/list/index.js +10 -0
- package/src/components/menu/Menu.js +82 -0
- package/src/components/menu/MenuDivider.js +22 -0
- package/src/components/menu/MenuGroup.js +42 -0
- package/src/components/menu/MenuItem.js +71 -0
- package/src/components/menu/index.js +13 -0
- package/src/components/modal/Modal.js +153 -0
- package/src/components/modal/index.js +5 -0
- package/src/components/pagination/Pagination.js +229 -0
- package/src/components/pagination/index.js +5 -0
- package/src/components/popover/Popover.js +185 -0
- package/src/components/popover/PopoverFooter.js +37 -0
- package/src/components/popover/PopoverHeader.js +43 -0
- package/src/components/popover/index.js +10 -0
- package/src/components/progress/Progress.js +220 -0
- package/src/components/progress/index.js +6 -0
- package/src/components/skeleton/Skeleton.js +98 -0
- package/src/components/skeleton/SkeletonCard.js +0 -0
- package/src/components/skeleton/SkeletonList.js +0 -0
- package/src/components/skeleton/SkeletonParagraph.js +0 -0
- package/src/components/skeleton/SkeletonTable.js +0 -0
- package/src/components/skeleton/index.js +6 -0
- package/src/components/slider/Slider.js +183 -0
- package/src/components/slider/index.js +5 -0
- package/src/components/spinner/Spinner.js +160 -0
- package/src/components/spinner/index.js +5 -0
- package/src/components/splitter/Splitter.js +95 -0
- package/src/components/splitter/SplitterGutter.js +57 -0
- package/src/components/splitter/SplitterPanel.js +82 -0
- package/src/components/splitter/index.js +8 -0
- package/src/components/stepper/Stepper.js +229 -0
- package/src/components/stepper/StepperStep.js +103 -0
- package/src/components/stepper/index.js +8 -0
- package/src/components/switch/Switch.js +99 -0
- package/src/components/switch/index.js +0 -0
- package/src/components/table/ColumnGroup.js +1 -1
- package/src/components/table/DataTable.js +1 -1
- package/src/components/table/SimpleTable.js +36 -32
- package/src/components/tabs/Tabs.js +110 -0
- package/src/components/tabs/index.js +6 -0
- package/src/components/toast/Toast.js +129 -0
- package/src/components/toast/ToastError.js +0 -0
- package/src/components/toast/ToastInfo.js +0 -0
- package/src/components/toast/ToastSuccess.js +0 -0
- package/src/components/toast/ToastWarning.js +0 -0
- package/src/components/toast/index.js +5 -0
- package/src/components/tooltip/Tooltip.js +98 -0
- package/src/components/tooltip/index.js +5 -0
- package/src/components/tooltip/prototypes.js +6 -0
- package/src/core/data/MemoryManager.js +2 -2
- package/src/core/data/Observable.js +1 -1
- package/src/core/data/ObservableArray.js +14 -8
- package/src/core/data/ObservableItem.js +5 -5
- package/src/core/data/observable-helpers/array.js +2 -2
- package/src/core/data/observable-helpers/batch.js +2 -2
- package/src/core/data/observable-helpers/computed.js +6 -6
- package/src/core/data/observable-helpers/object.js +2 -2
- package/src/core/elements/anchor.js +3 -3
- package/src/core/elements/content-formatter.js +1 -1
- package/src/core/elements/control/for-each-array.js +42 -68
- package/src/core/elements/control/for-each.js +7 -7
- package/src/core/elements/control/show-if.js +5 -5
- package/src/core/elements/control/show-when.js +2 -2
- package/src/core/elements/control/switch.js +4 -4
- package/src/core/elements/description-list.js +1 -1
- package/src/core/elements/form.js +1 -1
- package/src/core/elements/html5-semantics.js +1 -1
- package/src/core/elements/img.js +3 -3
- package/src/core/elements/index.js +1 -1
- package/src/core/elements/interactive.js +1 -1
- package/src/core/elements/list.js +1 -1
- package/src/core/elements/medias.js +1 -1
- package/src/core/elements/meta-data.js +1 -1
- package/src/core/elements/table.js +1 -1
- package/src/core/utils/EventEmitter.js +1 -1
- package/src/core/utils/args-types.js +2 -2
- package/src/core/utils/events.js +68 -0
- package/src/core/utils/filters/standard.js +1 -1
- package/src/core/utils/filters/utils.js +1 -1
- package/src/core/utils/helpers.js +10 -7
- package/src/core/utils/prototypes.js +2 -2
- package/src/core/utils/validator.js +6 -5
- package/src/core/wrappers/AttributesWrapper.js +21 -38
- package/src/core/wrappers/DocumentObserver.js +1 -1
- package/src/core/wrappers/ElementCreator.js +9 -14
- package/src/core/wrappers/HtmlElementWrapper.js +2 -2
- package/src/core/wrappers/NDElement.js +3 -3
- package/src/core/wrappers/NdPrototype.js +24 -31
- package/src/core/wrappers/SingletonView.js +1 -1
- package/src/core/wrappers/TemplateCloner.js +60 -18
- package/src/core/wrappers/constants.js +32 -1
- package/src/core/wrappers/prototypes/attributes-extensions.js +18 -5
- package/src/core/wrappers/prototypes/bind-class-extensions.js +18 -0
- package/src/core/wrappers/prototypes/nd-element-extensions.js +6 -6
- package/src/devtools/app/App.js +2 -2
- package/src/devtools/hrm/ComponentRegistry.js +2 -2
- package/src/devtools/plugin.js +1 -1
- package/src/devtools/widget/DevToolsWidget.js +2 -2
- package/src/router/Route.js +1 -1
- package/src/router/RouteGroupHelper.js +1 -1
- package/src/router/Router.js +4 -4
- package/src/router/RouterComponent.js +1 -1
- package/src/router/link.js +3 -3
- package/src/router/modes/HistoryRouter.js +1 -2
- package/types/filters/dates.d.ts +1 -1
- package/types/filters/standard.d.ts +0 -1
- package/types/filters/types.d.ts +1 -1
- package/utils.js +3 -3
- package/src/components/fom-control/default/DefaultLayout.js +0 -8
- package/src/components/fom-control/default/collection/DefaultCollectionLayout.js +0 -12
- package/src/components/fom-control/default/collection/DefaultCollectionTemplate.js +0 -6
- package/src/components/fom-control/field/types/CheckboxField.js +0 -17
- package/src/components/fom-control/field/types/HiddenField.js +0 -8
- package/src/components/fom-control/index.js +0 -8
- /package/src/components/{fom-control → form}/field/FieldFactory.js +0 -0
- /package/src/components/{fom-control → form}/merge +0 -0
- /package/src/components/{fom-control → form}/utils.js +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import BaseComponent from "@components/BaseComponent";
|
|
2
|
+
import EventEmitter from "@src/core/utils/EventEmitter";
|
|
3
|
+
|
|
4
|
+
export default function Popover(config = {}) {
|
|
5
|
+
if (!(this instanceof Popover)) {
|
|
6
|
+
return new Popover(config);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
this.$description = {
|
|
10
|
+
trigger: null,
|
|
11
|
+
content: null,
|
|
12
|
+
header: null,
|
|
13
|
+
footer: null,
|
|
14
|
+
isOpen: $(false),
|
|
15
|
+
defaultOpen: false,
|
|
16
|
+
modal: false,
|
|
17
|
+
closeOnEscape: true,
|
|
18
|
+
closeOnClickOutside: true,
|
|
19
|
+
focusTrap: true,
|
|
20
|
+
returnFocus: true,
|
|
21
|
+
position: 'bottom',
|
|
22
|
+
offset: [0, 8],
|
|
23
|
+
data: null,
|
|
24
|
+
renderContent: null,
|
|
25
|
+
renderHeader: null,
|
|
26
|
+
renderFooter: null,
|
|
27
|
+
render: null,
|
|
28
|
+
...config,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
this.$element = null;
|
|
32
|
+
|
|
33
|
+
if (this.$description.defaultOpen) {
|
|
34
|
+
this.$description.isOpen.set(true);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
BaseComponent.extends(Popover, EventEmitter);
|
|
39
|
+
|
|
40
|
+
Popover.defaultTemplate = null;
|
|
41
|
+
|
|
42
|
+
Popover.use = function(template) {
|
|
43
|
+
Popover.defaultTemplate = template.popover;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Popover.prototype.trigger = function(trigger) {
|
|
47
|
+
if (trigger instanceof PopoverTrigger) {
|
|
48
|
+
this.$description.trigger = trigger.toJSON();
|
|
49
|
+
} else {
|
|
50
|
+
this.$description.trigger = trigger;
|
|
51
|
+
}
|
|
52
|
+
return this;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
Popover.prototype.content = function(content) {
|
|
56
|
+
this.$description.content = content;
|
|
57
|
+
return this;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
Popover.prototype.header = function(header) {
|
|
61
|
+
this.$description.header = header;
|
|
62
|
+
return this;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Popover.prototype.footer = function(footer) {
|
|
66
|
+
this.$description.footer = footer;
|
|
67
|
+
return this;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
Popover.prototype.closeOnEscape = function(closeOnEscape = true) {
|
|
71
|
+
this.$description.closeOnEscape = closeOnEscape;
|
|
72
|
+
return this;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
Popover.prototype.closeOnClickOutside = function(closeOnClickOutside = true) {
|
|
76
|
+
this.$description.closeOnClickOutside = closeOnClickOutside;
|
|
77
|
+
return this;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
Popover.prototype.focusTrap = function(trap = true) {
|
|
81
|
+
this.$description.focusTrap = trap;
|
|
82
|
+
return this;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Popover.prototype.returnFocus = function(returnFocus = true) {
|
|
86
|
+
this.$description.returnFocus = returnFocus;
|
|
87
|
+
return this;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
Popover.prototype.position = function(position) {
|
|
91
|
+
this.$description.position = position;
|
|
92
|
+
return this;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
Popover.prototype.atTop = function() {
|
|
96
|
+
return this.position('top');
|
|
97
|
+
};
|
|
98
|
+
Popover.prototype.atBottom = function() {
|
|
99
|
+
return this.position('bottom');
|
|
100
|
+
};
|
|
101
|
+
Popover.prototype.atLeft = function() {
|
|
102
|
+
return this.position('left');
|
|
103
|
+
};
|
|
104
|
+
Popover.prototype.atRight = function() {
|
|
105
|
+
return this.position('right');
|
|
106
|
+
};
|
|
107
|
+
Popover.prototype.atTopStart = function() {
|
|
108
|
+
return this.position('top-start');
|
|
109
|
+
};
|
|
110
|
+
Popover.prototype.atTopEnd = function() {
|
|
111
|
+
return this.position('top-end');
|
|
112
|
+
};
|
|
113
|
+
Popover.prototype.atBottomStart = function() {
|
|
114
|
+
return this.position('bottom-start');
|
|
115
|
+
};
|
|
116
|
+
Popover.prototype.atBottomEnd = function() {
|
|
117
|
+
return this.position('bottom-end');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
Popover.prototype.offset = function(skidding, distance) {
|
|
121
|
+
this.$description.offset = [skidding, distance];
|
|
122
|
+
return this;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Popover.prototype.bindOpen = function(observable) {
|
|
126
|
+
this.$description.isOpen = observable;
|
|
127
|
+
return this;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
Popover.prototype.data = function(data) {
|
|
131
|
+
this.$description.data = data;
|
|
132
|
+
return this;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
Popover.prototype.open = function() {
|
|
136
|
+
this.$description.isOpen.set(true);
|
|
137
|
+
this.emit('open');
|
|
138
|
+
return this;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
Popover.prototype.close = function() {
|
|
142
|
+
this.$description.isOpen.set(false);
|
|
143
|
+
this.emit('close');
|
|
144
|
+
return this;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
Popover.prototype.toggle = function() {
|
|
148
|
+
this.$description.isOpen.val() ? this.close() : this.open();
|
|
149
|
+
return this;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
Popover.prototype.onOpen = function(handler) {
|
|
153
|
+
this.on('open', handler);
|
|
154
|
+
return this;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
Popover.prototype.onClose = function(handler) {
|
|
158
|
+
this.on('close', handler);
|
|
159
|
+
return this;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
Popover.prototype.renderTrigger = function(renderFn) {
|
|
163
|
+
this.$description.renderTrigger = renderFn;
|
|
164
|
+
return this;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
Popover.prototype.renderContent = function(renderFn) {
|
|
168
|
+
this.$description.renderContent = renderFn;
|
|
169
|
+
return this;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
Popover.prototype.renderHeader = function(renderFn) {
|
|
173
|
+
this.$description.renderHeader = renderFn;
|
|
174
|
+
return this;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
Popover.prototype.renderFooter = function(renderFn) {
|
|
178
|
+
this.$description.renderFooter = renderFn;
|
|
179
|
+
return this;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
Popover.prototype.render = function(renderFn) {
|
|
183
|
+
this.$description.render = renderFn;
|
|
184
|
+
return this;
|
|
185
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import BaseComponent from "@components/BaseComponent";
|
|
2
|
+
|
|
3
|
+
export default function PopoverFooter(content, config = {}) {
|
|
4
|
+
if(!(this instanceof PopoverFooter)) {
|
|
5
|
+
return new PopoverFooter(content, config);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
this.$description = {
|
|
9
|
+
content: content || null,
|
|
10
|
+
data: null,
|
|
11
|
+
render: null,
|
|
12
|
+
...config
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
BaseComponent.extends(PopoverFooter);
|
|
17
|
+
|
|
18
|
+
PopoverFooter.defaultTemplate = null;
|
|
19
|
+
|
|
20
|
+
PopoverFooter.use = function(template) {
|
|
21
|
+
PopoverFooter.defaultTemplate = template.popoverFooter;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
PopoverFooter.prototype.content = function(content) {
|
|
25
|
+
this.$description.content = content;
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
PopoverFooter.prototype.data = function(data) {
|
|
30
|
+
this.$description.data = data;
|
|
31
|
+
return this;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
PopoverFooter.prototype.render = function(renderFn) {
|
|
35
|
+
this.$description.render = renderFn;
|
|
36
|
+
return this;
|
|
37
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import BaseComponent from "@components/BaseComponent";
|
|
2
|
+
|
|
3
|
+
export default function PopoverHeader(content, config = {}) {
|
|
4
|
+
if(!(this instanceof PopoverHeader)) {
|
|
5
|
+
return new PopoverHeader(content, config);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
this.$description = {
|
|
9
|
+
content: content || null,
|
|
10
|
+
showClose: false,
|
|
11
|
+
data: null,
|
|
12
|
+
render: null,
|
|
13
|
+
...config
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
BaseComponent.extends(PopoverHeader);
|
|
18
|
+
|
|
19
|
+
PopoverHeader.defaultTemplate = null;
|
|
20
|
+
|
|
21
|
+
PopoverHeader.use = function(template) {
|
|
22
|
+
PopoverHeader.defaultTemplate = template.popoverHeader;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
PopoverHeader.prototype.content = function(content) {
|
|
26
|
+
this.$description.content = content;
|
|
27
|
+
return this;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
PopoverHeader.prototype.showClose = function(show = true) {
|
|
31
|
+
this.$description.showClose = show;
|
|
32
|
+
return this;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
PopoverHeader.prototype.data = function(data) {
|
|
36
|
+
this.$description.data = data;
|
|
37
|
+
return this;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
PopoverHeader.prototype.render = function(renderFn) {
|
|
41
|
+
this.$description.render = renderFn;
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import BaseComponent from "@components/BaseComponent";
|
|
2
|
+
import EventEmitter from "@src/core/utils/EventEmitter";
|
|
3
|
+
import {Validator} from "@core";
|
|
4
|
+
|
|
5
|
+
export default function Progress(config = {}) {
|
|
6
|
+
if (!(this instanceof Progress)) {
|
|
7
|
+
return new Progress(config);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
this.$description = {
|
|
11
|
+
value: null,
|
|
12
|
+
type: null,
|
|
13
|
+
variant: null,
|
|
14
|
+
max: 100,
|
|
15
|
+
size: null,
|
|
16
|
+
height: null,
|
|
17
|
+
showValue: null,
|
|
18
|
+
showPercentage: null,
|
|
19
|
+
label: null,
|
|
20
|
+
format: null,
|
|
21
|
+
indeterminate: null,
|
|
22
|
+
striped: null,
|
|
23
|
+
animated: null,
|
|
24
|
+
render: null,
|
|
25
|
+
...config
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
BaseComponent.extends(Progress, EventEmitter);
|
|
30
|
+
|
|
31
|
+
Progress.defaultTemplate = null;
|
|
32
|
+
|
|
33
|
+
Progress.use = function(template) {};
|
|
34
|
+
|
|
35
|
+
Progress.prototype.model = function(observable) {
|
|
36
|
+
this.$description.value = observable;
|
|
37
|
+
return this;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
Progress.prototype.setCurrentStep = function(step) {
|
|
41
|
+
this.$description.value?.set(step);
|
|
42
|
+
this.emit('change', step);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Progress.prototype.value = function() {
|
|
46
|
+
const value = this.$description.value;
|
|
47
|
+
if(Validator.isObservable(value)) {
|
|
48
|
+
return value.val();
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
Progress.prototype.setValue = function(newValue) {
|
|
54
|
+
const value = this.$description.value;
|
|
55
|
+
if(Validator.isObservable(value)) {
|
|
56
|
+
value.set(newValue);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
this.$description.value = newValue;
|
|
60
|
+
return this;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Progress.prototype.max = function(max) {
|
|
64
|
+
this.$description.max = max;
|
|
65
|
+
return this;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Progress.prototype.type = function(type) {
|
|
69
|
+
this.$description.type = type;
|
|
70
|
+
return this;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
Progress.prototype.bar = function() {
|
|
74
|
+
return this.type('bar');
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Progress.prototype.circle = function() {
|
|
78
|
+
return this.type('circle');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Progress.prototype.line = function() {
|
|
82
|
+
return this.type('line');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Variant
|
|
86
|
+
Progress.prototype.variant = function(name) {
|
|
87
|
+
this.$description.variant = name;
|
|
88
|
+
return this;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
Progress.prototype.primary = function() {
|
|
92
|
+
return this.variant('primary');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
Progress.prototype.secondary = function() {
|
|
96
|
+
return this.variant('secondary');
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Progress.prototype.success = function() {
|
|
100
|
+
return this.variant('success');
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
Progress.prototype.warning = function() {
|
|
104
|
+
return this.variant('warning');
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
Progress.prototype.danger = function() {
|
|
108
|
+
return this.variant('danger');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
Progress.prototype.info = function() {
|
|
112
|
+
return this.variant('info');
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
Progress.prototype.size = function(size) {
|
|
117
|
+
this.$description.size = size;
|
|
118
|
+
return this;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
Progress.prototype.small = function() {
|
|
122
|
+
return this.size('small');
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Progress.prototype.medium = function() {
|
|
126
|
+
return this.size('medium');
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
Progress.prototype.large = function() {
|
|
130
|
+
return this.size('large');
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
Progress.prototype.height = function(height) {
|
|
134
|
+
this.$description.height = height;
|
|
135
|
+
return this;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Progress.prototype.showValue = function(enabled = true) {
|
|
140
|
+
this.$description.showValue = enabled;
|
|
141
|
+
return this;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
Progress.prototype.label = function(text) {
|
|
145
|
+
this.$description.label = text;
|
|
146
|
+
return this;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
Progress.prototype.format = function(formatFn) {
|
|
150
|
+
this.$description.format = formatFn;
|
|
151
|
+
return this;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
Progress.prototype.indeterminate = function(enabled = true) {
|
|
155
|
+
this.$description.indeterminate = enabled;
|
|
156
|
+
return this;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
Progress.prototype.striped = function(enabled = true) {
|
|
160
|
+
this.$description.striped = enabled;
|
|
161
|
+
return this;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
Progress.prototype.animated = function(enabled = true) {
|
|
165
|
+
this.$description.animated = enabled;
|
|
166
|
+
return this;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
Progress.prototype.start = function() {
|
|
171
|
+
// TODO: Implementation
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
Progress.prototype.complete = function() {
|
|
175
|
+
this.setCurrentStep(100);
|
|
176
|
+
this.emit('complete');
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
Progress.prototype.increment = function(step) {
|
|
180
|
+
const current = this.value() || 0;
|
|
181
|
+
this.setCurrentStep(Math.min(this.$description.max, current + step));
|
|
182
|
+
return this;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
Progress.prototype.reset = function() {
|
|
186
|
+
this.setCurrentStep(0);
|
|
187
|
+
this.emit('reset');
|
|
188
|
+
return this;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// Events
|
|
192
|
+
Progress.prototype.onChange = function(handler) {
|
|
193
|
+
this.on('change', handler);
|
|
194
|
+
return this;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
Progress.prototype.onComplete = function(handler) {
|
|
198
|
+
this.on('complete', handler);
|
|
199
|
+
return this;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
Progress.prototype.onReset = function(handler) {
|
|
203
|
+
this.on('reset', handler);
|
|
204
|
+
return this;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
Progress.prototype.render = function(renderFn) {
|
|
209
|
+
this.$description.render = renderFn;
|
|
210
|
+
return this;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// Build & Render
|
|
214
|
+
Progress.prototype.$build = function() {
|
|
215
|
+
// TODO: Implementation
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
Progress.prototype.toNdElement = function() {
|
|
219
|
+
return this.$build();
|
|
220
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
export default function Skeleton(type = 'rect', config = {}) {
|
|
3
|
+
if (!(this instanceof Skeleton)) {
|
|
4
|
+
return new Skeleton(config);
|
|
5
|
+
}
|
|
6
|
+
this.$description = {
|
|
7
|
+
type,
|
|
8
|
+
lines: null,
|
|
9
|
+
width: null,
|
|
10
|
+
height: null,
|
|
11
|
+
loading: null,
|
|
12
|
+
repeat: null,
|
|
13
|
+
...config
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Skeleton.defaultTemplate = null;
|
|
18
|
+
|
|
19
|
+
Skeleton.use = function(template) {};
|
|
20
|
+
|
|
21
|
+
Skeleton.prototype.type = function(type) {
|
|
22
|
+
this.$description.type = type;
|
|
23
|
+
return this;
|
|
24
|
+
};
|
|
25
|
+
Skeleton.prototype.text = function(lines = 1) {
|
|
26
|
+
this.$description.lines = lines;
|
|
27
|
+
return this.type('text');
|
|
28
|
+
};
|
|
29
|
+
Skeleton.prototype.circle = function() {
|
|
30
|
+
return this.type('circle');
|
|
31
|
+
};
|
|
32
|
+
Skeleton.prototype.rect = function() {
|
|
33
|
+
return this.type('rect');
|
|
34
|
+
};
|
|
35
|
+
Skeleton.prototype.avatar = function() {
|
|
36
|
+
return this.type('avatar');
|
|
37
|
+
};
|
|
38
|
+
Skeleton.prototype.image = function() {
|
|
39
|
+
return this.type('image');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
Skeleton.prototype.width = function(width) {
|
|
43
|
+
this.$description.width = width;
|
|
44
|
+
return this;
|
|
45
|
+
};
|
|
46
|
+
Skeleton.prototype.height = function(height) {
|
|
47
|
+
this.$description.height = height;
|
|
48
|
+
return this;
|
|
49
|
+
};
|
|
50
|
+
Skeleton.prototype.size = function(width, height) {
|
|
51
|
+
this.width(width);
|
|
52
|
+
this.height(height);
|
|
53
|
+
return this;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Skeleton.prototype.variant = function(name) {
|
|
57
|
+
this.$description.variant = name;
|
|
58
|
+
return this;
|
|
59
|
+
};
|
|
60
|
+
Skeleton.prototype.wave = function() {
|
|
61
|
+
return this.variant('wave');
|
|
62
|
+
};
|
|
63
|
+
Skeleton.prototype.pulse = function() {
|
|
64
|
+
return this.variant('pulse');
|
|
65
|
+
};
|
|
66
|
+
Skeleton.prototype.rounded = function() {};
|
|
67
|
+
|
|
68
|
+
Skeleton.prototype.loading = function(isLoading) {
|
|
69
|
+
this.$description.loading = isLoading;
|
|
70
|
+
return this;
|
|
71
|
+
};
|
|
72
|
+
Skeleton.prototype.show = function() {};
|
|
73
|
+
Skeleton.prototype.hide = function() {};
|
|
74
|
+
|
|
75
|
+
Skeleton.prototype.repeat = function(times) {
|
|
76
|
+
this.$description.repeat = times;
|
|
77
|
+
return this;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
Skeleton.prototype.render = function(renderFn) {
|
|
82
|
+
this.$description.render = renderFn;
|
|
83
|
+
return this;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
Skeleton.prototype.$build = function() {
|
|
88
|
+
|
|
89
|
+
};
|
|
90
|
+
Skeleton.prototype.toNdElement = function() {
|
|
91
|
+
return this.$build();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Presets
|
|
95
|
+
Skeleton.card = function() {}; // Preset pour card
|
|
96
|
+
Skeleton.list = function(items = 3) {}; // Preset pour liste
|
|
97
|
+
Skeleton.table = function(rows = 5, cols = 4) {}; // Preset pour tableau
|
|
98
|
+
Skeleton.paragraph = function(lines = 3) {}; // Preset pour paragraphe
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|