native-document 1.0.76 → 1.0.78

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.
Files changed (154) hide show
  1. package/components.js +26 -1
  2. package/dist/native-document.components.min.js +6447 -1984
  3. package/dist/native-document.dev.js +309 -196
  4. package/dist/native-document.dev.js.map +1 -1
  5. package/dist/native-document.devtools.min.js +1 -1
  6. package/dist/native-document.min.js +1 -1
  7. package/package.json +1 -1
  8. package/rollup.config.js +0 -14
  9. package/src/components/$traits/HasItems.js +38 -0
  10. package/src/components/BaseComponent.js +70 -0
  11. package/src/components/accordion/Accordion.js +133 -0
  12. package/src/components/accordion/AccordionItem.js +119 -0
  13. package/src/components/accordion/index.js +7 -0
  14. package/src/components/alert/Alert.js +155 -0
  15. package/src/components/alert/index.js +6 -0
  16. package/src/components/avatar/Avatar.js +178 -0
  17. package/src/components/avatar/index.js +5 -0
  18. package/src/components/badge/Badge.js +103 -0
  19. package/src/components/badge/index.js +6 -0
  20. package/src/components/breadcrumb/BreadCrumb.js +70 -0
  21. package/src/components/breadcrumb/index.js +5 -0
  22. package/src/components/button/Button.js +174 -0
  23. package/src/components/button/index.js +5 -0
  24. package/src/components/card/Card.js +110 -0
  25. package/src/components/card/index.js +5 -0
  26. package/src/components/context-menu/ContextMenu.js +60 -0
  27. package/src/components/context-menu/ContextMenuGroup.js +16 -0
  28. package/src/components/context-menu/ContextMenuItem.js +16 -0
  29. package/src/components/context-menu/index.js +10 -0
  30. package/src/components/divider/Divider.js +126 -0
  31. package/src/components/divider/index.js +6 -0
  32. package/src/components/dropdown/Dropdown.js +170 -0
  33. package/src/components/dropdown/DropdownDivider.js +24 -0
  34. package/src/components/dropdown/DropdownGroup.js +44 -0
  35. package/src/components/dropdown/DropdownItem.js +71 -0
  36. package/src/components/dropdown/DropdownTrigger.js +64 -0
  37. package/src/components/dropdown/index.js +13 -0
  38. package/src/components/{fom-control → form}/FormControl.js +28 -20
  39. package/src/components/{fom-control → form}/field/DefaultRender.js +1 -15
  40. package/src/components/{fom-control → form}/field/Field.js +64 -137
  41. package/src/components/{fom-control → form}/field/FieldCollection.js +39 -19
  42. package/src/components/{fom-control → form}/field/types/AutocompleteField.js +11 -0
  43. package/src/components/form/field/types/CheckboxField.js +36 -0
  44. package/src/components/{fom-control → form}/field/types/CheckboxGroupField.js +10 -0
  45. package/src/components/{fom-control → form}/field/types/ColorField.js +10 -0
  46. package/src/components/{fom-control → form}/field/types/DateField.js +10 -0
  47. package/src/components/{fom-control → form}/field/types/EmailField.js +10 -0
  48. package/src/components/{fom-control → form}/field/types/FileField.js +10 -0
  49. package/src/components/form/field/types/HiddenField.js +18 -0
  50. package/src/components/{fom-control → form}/field/types/ImageField.js +10 -0
  51. package/src/components/{fom-control → form}/field/types/NumberField.js +10 -0
  52. package/src/components/{fom-control → form}/field/types/PasswordField.js +10 -0
  53. package/src/components/{fom-control → form}/field/types/RadioField.js +28 -2
  54. package/src/components/{fom-control → form}/field/types/RangeField.js +10 -0
  55. package/src/components/{fom-control → form}/field/types/SearchField.js +10 -0
  56. package/src/components/{fom-control → form}/field/types/SelectField.js +10 -0
  57. package/src/components/{fom-control → form}/field/types/StringField.js +10 -0
  58. package/src/components/{fom-control → form}/field/types/TelField.js +10 -1
  59. package/src/components/{fom-control → form}/field/types/TextAreaField.js +10 -0
  60. package/src/components/{fom-control → form}/field/types/TimeField.js +10 -1
  61. package/src/components/{fom-control → form}/field/types/UrlField.js +9 -1
  62. package/src/components/form/index.js +49 -0
  63. package/src/components/list/List.js +106 -0
  64. package/src/components/list/ListGroup.js +67 -0
  65. package/src/components/list/ListItem.js +103 -0
  66. package/src/components/list/index.js +10 -0
  67. package/src/components/menu/Menu.js +82 -0
  68. package/src/components/menu/MenuDivider.js +22 -0
  69. package/src/components/menu/MenuGroup.js +42 -0
  70. package/src/components/menu/MenuItem.js +71 -0
  71. package/src/components/menu/index.js +13 -0
  72. package/src/components/modal/Modal.js +153 -0
  73. package/src/components/modal/index.js +5 -0
  74. package/src/components/pagination/Pagination.js +229 -0
  75. package/src/components/pagination/index.js +5 -0
  76. package/src/components/popover/Popover.js +185 -0
  77. package/src/components/popover/PopoverFooter.js +37 -0
  78. package/src/components/popover/PopoverHeader.js +43 -0
  79. package/src/components/popover/index.js +10 -0
  80. package/src/components/progress/Progress.js +220 -0
  81. package/src/components/progress/index.js +6 -0
  82. package/src/components/skeleton/Skeleton.js +98 -0
  83. package/src/components/skeleton/SkeletonCard.js +0 -0
  84. package/src/components/skeleton/SkeletonList.js +0 -0
  85. package/src/components/skeleton/SkeletonParagraph.js +0 -0
  86. package/src/components/skeleton/SkeletonTable.js +0 -0
  87. package/src/components/skeleton/index.js +6 -0
  88. package/src/components/slider/Slider.js +183 -0
  89. package/src/components/slider/index.js +5 -0
  90. package/src/components/spinner/Spinner.js +160 -0
  91. package/src/components/spinner/index.js +5 -0
  92. package/src/components/splitter/Splitter.js +94 -0
  93. package/src/components/splitter/SplitterGutter.js +57 -0
  94. package/src/components/splitter/SplitterPanel.js +82 -0
  95. package/src/components/splitter/index.js +8 -0
  96. package/src/components/stepper/Stepper.js +229 -0
  97. package/src/components/stepper/StepperStep.js +103 -0
  98. package/src/components/stepper/index.js +8 -0
  99. package/src/components/switch/Switch.js +99 -0
  100. package/src/components/switch/index.js +0 -0
  101. package/src/components/table/SimpleTable.js +36 -32
  102. package/src/components/tabs/Tabs.js +110 -0
  103. package/src/components/tabs/index.js +6 -0
  104. package/src/components/toast/Toast.js +129 -0
  105. package/src/components/toast/ToastError.js +0 -0
  106. package/src/components/toast/ToastInfo.js +0 -0
  107. package/src/components/toast/ToastSuccess.js +0 -0
  108. package/src/components/toast/ToastWarning.js +0 -0
  109. package/src/components/toast/index.js +5 -0
  110. package/src/components/tooltip/Tooltip.js +98 -0
  111. package/src/components/tooltip/index.js +5 -0
  112. package/src/components/tooltip/prototypes.js +6 -0
  113. package/src/core/data/MemoryManager.js +1 -2
  114. package/src/core/data/Observable.js +1 -1
  115. package/src/core/data/ObservableArray.js +10 -4
  116. package/src/core/data/ObservableItem.js +5 -5
  117. package/src/core/data/observable-helpers/array.js +1 -1
  118. package/src/core/data/observable-helpers/batch.js +1 -1
  119. package/src/core/data/observable-helpers/computed.js +1 -1
  120. package/src/core/elements/control/for-each-array.js +37 -64
  121. package/src/core/elements/control/for-each.js +1 -1
  122. package/src/core/elements/control/show-if.js +1 -1
  123. package/src/core/elements/control/switch.js +1 -1
  124. package/src/core/utils/events.js +68 -0
  125. package/src/core/utils/filters/standard.js +1 -1
  126. package/src/core/utils/filters/utils.js +1 -1
  127. package/src/core/utils/helpers.js +10 -7
  128. package/src/core/utils/validator.js +1 -0
  129. package/src/core/wrappers/AttributesWrapper.js +18 -35
  130. package/src/core/wrappers/DocumentObserver.js +0 -1
  131. package/src/core/wrappers/ElementCreator.js +6 -11
  132. package/src/core/wrappers/NdPrototype.js +24 -31
  133. package/src/core/wrappers/TemplateCloner.js +60 -18
  134. package/src/core/wrappers/constants.js +32 -1
  135. package/src/core/wrappers/prototypes/attributes-extensions.js +16 -3
  136. package/src/core/wrappers/prototypes/bind-class-extensions.js +18 -0
  137. package/src/devtools/app/App.js +1 -1
  138. package/src/devtools/hrm/ComponentRegistry.js +1 -1
  139. package/src/router/Router.js +1 -1
  140. package/src/router/link.js +4 -4
  141. package/src/router/modes/HistoryRouter.js +0 -1
  142. package/types/control-flow.d.ts +0 -1
  143. package/types/filters/standard.d.ts +0 -1
  144. package/src/components/fom-control/default/DefaultLayout.js +0 -8
  145. package/src/components/fom-control/default/collection/DefaultCollectionLayout.js +0 -12
  146. package/src/components/fom-control/default/collection/DefaultCollectionTemplate.js +0 -6
  147. package/src/components/fom-control/field/types/CheckboxField.js +0 -17
  148. package/src/components/fom-control/field/types/HiddenField.js +0 -8
  149. package/src/components/fom-control/index.js +0 -8
  150. /package/src/components/{fom-control → form}/field/FieldFactory.js +0 -0
  151. /package/src/components/{fom-control → form}/merge +0 -0
  152. /package/src/components/{fom-control → form}/utils.js +0 -0
  153. /package/src/components/{fom-control → form}/validation/Validation.js +0 -0
  154. /package/src/{core → router}/errors/RouterError.js +0 -0
@@ -0,0 +1,103 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import { $ } from '../../../index';
3
+
4
+ export default function StepperStep(label, config = {}) {
5
+ if(!(this instanceof StepperStep)) {
6
+ return new StepperStep(label, config);
7
+ }
8
+
9
+ this.$description = {
10
+ icon: null,
11
+ label: label,
12
+ description: null,
13
+ content: null,
14
+ status: $('pending'),
15
+ optional: $(false),
16
+ disabled: $(false),
17
+ completed: $(false),
18
+ error: $(false),
19
+ data: null,
20
+ render: null,
21
+ validator: null,
22
+ key: null,
23
+ ...config
24
+ };
25
+ }
26
+
27
+ BaseComponent.extends(StepperStep);
28
+
29
+ StepperStep.defaultTemplate = null;
30
+
31
+ StepperStep.use = function(template) {
32
+ StepperStep.defaultTemplate = template.stepperStep;
33
+ };
34
+
35
+ StepperStep.prototype.icon = function(icon) {
36
+ this.$description.icon = icon;
37
+ return this;
38
+ };
39
+
40
+ StepperStep.prototype.label = function(label) {
41
+ this.$description.label = label;
42
+ return this;
43
+ };
44
+
45
+ StepperStep.prototype.description = function(description) {
46
+ this.$description.description = description;
47
+ return this;
48
+ };
49
+
50
+ StepperStep.prototype.content = function(content) {
51
+ this.$description.content = content;
52
+ return this;
53
+ };
54
+
55
+ StepperStep.prototype.status = function(status) {
56
+ this.$description.status.set(status);
57
+ return this;
58
+ };
59
+
60
+ StepperStep.prototype.optional = function(optional = true) {
61
+ this.$description.optional.set(optional);
62
+ return this;
63
+ };
64
+
65
+ StepperStep.prototype.disabled = function(disabled = true) {
66
+ this.$description.disabled.set(disabled);
67
+ return this;
68
+ };
69
+
70
+ StepperStep.prototype.completed = function(completed = true) {
71
+ this.$description.completed.set(completed);
72
+ this.$description.status.set(completed ? 'completed' : 'pending');
73
+ return this;
74
+ };
75
+
76
+ StepperStep.prototype.error = function(error = true) {
77
+ this.$description.error.set(error);
78
+ this.$description.status.set(error ? 'error' : 'pending');
79
+ return this;
80
+ };
81
+
82
+ StepperStep.prototype.data = function(data) {
83
+ this.$description.data = data;
84
+ return this;
85
+ };
86
+
87
+ StepperStep.prototype.key = function(key) {
88
+ this.$description.key = key;
89
+ return this;
90
+ };
91
+
92
+ StepperStep.prototype.getKey = function() {
93
+ return this.$description.key;
94
+ };
95
+
96
+ StepperStep.prototype.validator = function(validatorFn) {
97
+ this.$description.validator = validatorFn;
98
+ return this;
99
+ };
100
+
101
+ StepperStep.prototype.validate = function() {
102
+ return true;
103
+ };
@@ -0,0 +1,8 @@
1
+ import Stepper from "./Stepper";
2
+ import StepperStep from "./StepperStep";
3
+
4
+
5
+ export {
6
+ Stepper,
7
+ StepperStep
8
+ }
@@ -0,0 +1,99 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
+
4
+ function Switch(config = {}) {
5
+ if (!(this instanceof Switch)) {
6
+ return new Switch(config);
7
+ }
8
+
9
+ this.$description = {
10
+
11
+ };
12
+ }
13
+
14
+ BaseComponent.extends(Switch, EventEmitter);
15
+
16
+ // Theming
17
+ Switch.defaultTemplate = null;
18
+ Switch.use = function(template) {
19
+
20
+ };
21
+
22
+ Switch.prototype.model = function(value) {};
23
+ Switch.prototype.value = function() {};
24
+
25
+ Switch.prototype.label = function(label) {};
26
+ Switch.prototype.labelPosition = function(position) {};
27
+
28
+ Switch.prototype.variant = function(name) {
29
+ this.$description.variant = name;
30
+ return this;
31
+ };
32
+ Switch.prototype.primary = function() {
33
+ return this.variant('primary');
34
+ };
35
+ Switch.prototype.secondary = function() {
36
+ return this.variant('secondary');
37
+ };
38
+ Switch.prototype.danger = function() {
39
+ return this.variant('danger');
40
+ };
41
+ Switch.prototype.success = function() {
42
+ return this.variant('success');
43
+ };
44
+ Switch.prototype.warning = function() {
45
+ return this.variant('warning');
46
+ };
47
+ Switch.prototype.ghost = function() {
48
+ return this.variant('ghost');
49
+ };
50
+ Switch.prototype.link = function() {
51
+ return this.variant('link');
52
+ };
53
+ Switch.prototype.outline = function() {
54
+ this.$description.outline = true;
55
+ return this;
56
+ };
57
+
58
+ Switch.prototype.disabled = function(condition = true) {
59
+ this.$description.disabled = condition;
60
+ return this;
61
+ };
62
+ Switch.prototype.loading = function(isLoading = true) {
63
+ this.$description.loading = isLoading;
64
+ return this;
65
+ };
66
+ Switch.prototype.readonly = function(condition = true) {
67
+ this.$description.readonly = condition;
68
+ return this;
69
+ };
70
+
71
+ Switch.prototype.icon = function(onIcon, offIcon) {};
72
+
73
+ Switch.prototype.toggle = function() {};
74
+ Switch.prototype.on = function() {};
75
+ Switch.prototype.off = function() {};
76
+
77
+ Switch.prototype.onChange = function(handler) {
78
+ this.on('change', handler);
79
+ return this;
80
+ };
81
+ Switch.prototype.onOn = function(handler) {
82
+ this.on('on', handler);
83
+ return this;
84
+ };
85
+ Switch.prototype.onOff = function(handler) {
86
+ this.on('off', handler);
87
+ return this;
88
+ };
89
+
90
+ // Render
91
+ Switch.prototype.render = function(renderFn) {
92
+ this.$description.render = renderFn;
93
+ return this;
94
+ };
95
+
96
+ Switch.prototype.$build = function() {
97
+
98
+ };
99
+ Switch.prototype.toNdElement = function() {};
File without changes
@@ -1,6 +1,6 @@
1
1
  import Column from "./Column";
2
2
  import ColumnGroup from "./ColumnGroup";
3
- import {Table, TFoot, TRow} from "../../../elements";
3
+ import { Table, TFoot, TRow } from "../../../elements";
4
4
  import DataTable from "./DataTable";
5
5
 
6
6
 
@@ -122,37 +122,6 @@ SimpleTable.prototype.buildTable = function(slots = {}) {
122
122
  ]);
123
123
  };
124
124
 
125
- SimpleTable.prototype.build = function() {
126
- const header = [];
127
- if(this.$description.hasGroups) {
128
- const firstRow = [];
129
- const secondRow = [];
130
-
131
- this.$description.header.forEach(columnOrGroup => {
132
- if(columnOrGroup.isGroup) {
133
- const columns = columnOrGroup.columns();
134
- firstRow.push(columnOrGroup.buildHeader());
135
- secondRow.push(columns.map(column => THeadCell({}, column.buildHeader())));
136
- } else {
137
- firstRow.push(columnOrGroup.buildHeader(2));
138
- }
139
- });
140
-
141
- header.push(TRow(firstRow));
142
- header.push(TRow(secondRow));
143
- } else {
144
- header.push(TRow(
145
- this.$description.columns.map(column => column.buildHeader())
146
- ));
147
- }
148
-
149
- return this.buildTable({ headerRows: header });
150
- };
151
-
152
- SimpleTable.prototype.toNdElement = function() {
153
- return this.build();
154
- };
155
-
156
125
  SimpleTable.prototype.onClick = function(callback) {
157
126
  this.$description.onClick = callback;
158
127
  };
@@ -182,3 +151,38 @@ DataTable.prototype.isRowExpanded = function(row) {
182
151
  // TODO: implement this action
183
152
  return this;
184
153
  };
154
+
155
+
156
+ //
157
+
158
+
159
+ SimpleTable.prototype.$build = function() {
160
+ const header = [];
161
+ if(this.$description.hasGroups) {
162
+ const firstRow = [];
163
+ const secondRow = [];
164
+
165
+ this.$description.header.forEach(columnOrGroup => {
166
+ if(columnOrGroup.isGroup) {
167
+ const columns = columnOrGroup.columns();
168
+ firstRow.push(columnOrGroup.buildHeader());
169
+ secondRow.push(columns.map(column => THeadCell({}, column.buildHeader())));
170
+ } else {
171
+ firstRow.push(columnOrGroup.buildHeader(2));
172
+ }
173
+ });
174
+
175
+ header.push(TRow(firstRow));
176
+ header.push(TRow(secondRow));
177
+ } else {
178
+ header.push(TRow(
179
+ this.$description.columns.map(column => column.buildHeader())
180
+ ));
181
+ }
182
+
183
+ return this.buildTable({ headerRows: header });
184
+ };
185
+
186
+ SimpleTable.prototype.toNdElement = function() {
187
+ return this.$build();
188
+ };
@@ -0,0 +1,110 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
+
4
+
5
+ export default function Tabs(config = {}) {
6
+ if(!(this instanceof Tabs)) {
7
+ return new Tabs();
8
+ }
9
+ BaseComponent.apply(this);
10
+ this.$description = {
11
+ active: $(''),
12
+ tabs: {},
13
+ ...config,
14
+ };
15
+
16
+ this.tabsMap = {};
17
+ }
18
+
19
+ BaseComponent.extends(Tabs, EventEmitter);
20
+
21
+ Tabs.defaultTemplate = null;
22
+ Tabs.defaultTabTemplate = null;
23
+ Tabs.defaultNavigationBarTemplate = null;
24
+
25
+ Tabs.use = function(template) {};
26
+
27
+ Tabs.prototype.activateTab = function(key) {};
28
+ Tabs.prototype.closeTab = function(key) {};
29
+
30
+ Tabs.prototype.tab = function(label, content, key) {
31
+ this.$description.tabs[key] = { label, content };
32
+ this.tabsMap[key] = content;
33
+ return this;
34
+ };
35
+ Tabs.prototype.tabs = function(tabs) {
36
+ for(const item of tabs) {
37
+ this.tab(item.label, item.content, item.key);
38
+ }
39
+ return this;
40
+ };
41
+ Tabs.prototype.removeTab = function(key) {
42
+ delete this.$description.tabs[key];
43
+ delete this.tabsMap[key];
44
+ // Todo: remove tab from Match element
45
+ this.active(Object.keys(this.$description.tabs)[0]);
46
+ return this;
47
+ };
48
+
49
+ Tabs.prototype.active = function(key) {
50
+ this.$description.active.set(key);
51
+ };
52
+ Tabs.prototype.defaultActive = function(key) {};
53
+ Tabs.prototype.getActive = function() {};
54
+
55
+ Tabs.prototype.navigationBarPosition = function(position) {
56
+ this.$description.navigationBarPosition = position;
57
+ return this;
58
+ };
59
+ Tabs.prototype.navigationBarAtLeft = function() {
60
+ return this.navigationBarPosition('left');
61
+ };
62
+ Tabs.prototype.navigationBarAtRight = function() {
63
+ return this.navigationBarPosition('right');
64
+ };
65
+ Tabs.prototype.navigationBarAtTop = function() {
66
+ return this.navigationBarPosition('top');
67
+ }
68
+ Tabs.prototype.navigationBarAsDock = function() {
69
+ return this.navigationBarPosition('dock');
70
+ };
71
+
72
+ // Events
73
+ Tabs.prototype.onChange = function(handler) {
74
+ this.on('change', handler);
75
+ return this;
76
+ };
77
+ Tabs.prototype.onBeforeChange = function(handler) {
78
+ this.on('beforeChange', handler);
79
+ return this;
80
+ };
81
+ Tabs.prototype.onTabClick = function(handler) {
82
+ this.on('tabClick', handler);
83
+ return this;
84
+ };
85
+ Tabs.prototype.onTabClose = function(handler) {
86
+ this.on('tabClose', handler);
87
+ return this;
88
+ };
89
+
90
+
91
+ Tabs.prototype.renderTab = function(renderFn) {
92
+ this.$description.renderTab = renderFn;
93
+ return this;
94
+ };
95
+ Tabs.prototype.renderNavigationBar = function(renderFn) {
96
+ return this.$description.renderNavigationBar = renderFn;
97
+ };
98
+
99
+ Tabs.prototype.layout = function(layoutFn) {
100
+ this.$description.layout = layoutFn;
101
+ return this;
102
+ };
103
+
104
+ Tabs.prototype.$build = function() {
105
+
106
+ };
107
+
108
+ Tabs.prototype.toNdElement = function() {
109
+
110
+ };
@@ -0,0 +1,6 @@
1
+ import Tabs from './Tabs'
2
+
3
+
4
+ export {
5
+ Tabs
6
+ }
@@ -0,0 +1,129 @@
1
+ import BaseComponent from "../BaseComponent";
2
+ import EventEmitter from "../../../src/core/utils/EventEmitter";
3
+
4
+ export default function Toast(message, config = {}) {
5
+ if (!(this instanceof Toast)) {
6
+ return new Toast(message, config);
7
+ }
8
+
9
+ this.$description = {
10
+ type: null,
11
+ title: null,
12
+ content: null,
13
+ icon: null,
14
+ showIcon: true,
15
+ duration: 3000,
16
+ closable: true,
17
+ pauseOnHover: true,
18
+ position: 'top-right',
19
+ actions: [],
20
+ render: null,
21
+ ...config
22
+ };
23
+ }
24
+
25
+ BaseComponent.extends(Toast, EventEmitter);
26
+
27
+ Toast.use = function(template) {};
28
+ Toast.defaultTemplate = null;
29
+
30
+ // Types
31
+ Toast.prototype.type = function(type) {
32
+ this.$description.type = type;
33
+ return this;
34
+ };
35
+ Toast.prototype.info = function() {
36
+ return this.type('info');
37
+ };
38
+ Toast.prototype.success = function() {
39
+ return this.type('success');
40
+ };
41
+ Toast.prototype.warning = function() {
42
+ return this.type('warning');
43
+ };
44
+ Toast.prototype.error = function() {
45
+ return this.type('error');
46
+ };
47
+
48
+
49
+ Toast.prototype.title = function(title) {
50
+ this.$description.title = title;
51
+ return this;
52
+ };
53
+ Toast.prototype.content = function(content) {
54
+ this.$description.content = content;
55
+ return this;
56
+ };
57
+
58
+ Toast.prototype.icon = function(icon) {
59
+ this.$description.icon = icon;
60
+ return this;
61
+ };
62
+ Toast.prototype.showIcon = function(show = true) {
63
+ this.$description.showIcon = show;
64
+ return this;
65
+ };
66
+
67
+ // Behavior
68
+ Toast.prototype.duration = function(ms) {
69
+ this.$description.duration = ms;
70
+ return this;
71
+ };
72
+ Toast.prototype.closable = function(closable = true) {
73
+ this.$description.closable = closable;
74
+ return this;
75
+ };
76
+ Toast.prototype.pauseOnHover = function(pauseOnHover = true) {
77
+ this.$description.pauseOnHover = pauseOnHover;
78
+ return this;
79
+ };
80
+
81
+ // Position
82
+ Toast.prototype.position = function(position) {
83
+ this.$description.position = position;
84
+ return this;
85
+ };
86
+ Toast.prototype.atTopStart = function() {
87
+ return this.position('top-start');
88
+ };
89
+
90
+ Toast.prototype.atTopEnd = function() {
91
+ return this.position('top-end');
92
+ };
93
+ Toast.prototype.atBottomStart = function() {
94
+ return this.position('bottom-start');
95
+ };
96
+ Toast.prototype.atBottomEnd = function() {
97
+ return this.position('bottom-end');
98
+ };
99
+ Toast.prototype.atTopCenter = function() {
100
+ return this.position('top-center');
101
+ };
102
+ Toast.prototype.atBottomCenter = function() {
103
+ return this.position('bottom-center');
104
+ };
105
+
106
+ Toast.prototype.clearActions = function() {
107
+ this.$description.actions = [];
108
+ return this;
109
+ };
110
+ Toast.prototype.action = function(label, handler) {
111
+ this.$description.actions.push({ label, handler });
112
+ return this;
113
+ };
114
+
115
+ Toast.prototype.close = function() {};
116
+ Toast.prototype.onClose = function(handler) {
117
+ this.on('close', handler);
118
+ return this;
119
+ };
120
+
121
+ Toast.prototype.render = function(renderFn) {
122
+ this.$description.render = renderFn;
123
+ return this;
124
+ };
125
+
126
+ Toast.prototype.$build = function() {
127
+
128
+ };
129
+ Toast.prototype.toNdElement = function() {};
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ import Toast from './Toast'
2
+
3
+ export {
4
+ Toast
5
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Tooltip - Interface
3
+ */
4
+
5
+ export default function Tooltip(target, content, config = {}) {
6
+ if (!(this instanceof Tooltip)) {
7
+ return new Tooltip(target, content, config);
8
+ }
9
+
10
+ this.$description = {
11
+ title: null,
12
+ content: null,
13
+ position: 'top',
14
+ trigger: 'hover',
15
+ target: target,
16
+ hideDelay: 0,
17
+ arrow: true,
18
+ interactive: true,
19
+ variant: null,
20
+ ...config,
21
+ };
22
+ }
23
+
24
+ Tooltip.use = function(template) {};
25
+ Tooltip.defaultTemplate = null;
26
+
27
+ Tooltip.prototype.title = function(title) {
28
+ this.$description.title = title;
29
+ return this;
30
+ };
31
+ Tooltip.prototype.content = function(content) {
32
+ this.$description.content = content;
33
+ return this;
34
+ };
35
+
36
+ Tooltip.prototype.position = function(position) {
37
+ this.$description.position = position;
38
+ return this;
39
+ };
40
+ Tooltip.prototype.top = function() {
41
+ return this.position('top');
42
+ };
43
+ Tooltip.prototype.bottom = function() {
44
+ return this.position('bottom');
45
+ };
46
+ Tooltip.prototype.left = function() {
47
+ return this.position('left');
48
+ };
49
+ Tooltip.prototype.right = function() {
50
+ return this.position('right');
51
+ };
52
+ Tooltip.prototype.auto = function() {
53
+ return this.position('auto');
54
+ };
55
+
56
+ Tooltip.prototype.trigger = function(trigger, target = null) {
57
+ this.$description.trigger = trigger;
58
+ this.$description.target = target;
59
+ return this;
60
+ };
61
+ Tooltip.prototype.showOnHover = function(target = null) {
62
+ return this.trigger('hover', target);
63
+ };
64
+ Tooltip.prototype.showOnClick = function(target = null) {
65
+ return this.trigger('click', target);
66
+ };
67
+ Tooltip.prototype.showOnFocus = function(target = null) {
68
+ return this.trigger('focus', target);
69
+ };
70
+
71
+ Tooltip.prototype.hideDelay = function(ms) {
72
+ this.$description.hideDelay = ms;
73
+ return this;
74
+ };
75
+ Tooltip.prototype.arrow = function(enabled = true) {
76
+ this.$description.arrow = enabled;
77
+ return this;
78
+ };
79
+ Tooltip.prototype.interactive = function(isInteractive = true) {
80
+ this.$description.interactive = isInteractive;
81
+ return this;
82
+ }
83
+
84
+ Tooltip.prototype.variant = function(variant) {
85
+ this.$description.variant = variant;
86
+ return this;
87
+ };
88
+
89
+ Tooltip.prototype.show = function() {};
90
+ Tooltip.prototype.hide = function() {};
91
+
92
+ Tooltip.prototype.render = function(renderFn) {
93
+ this.$description.render = renderFn;
94
+ return this;
95
+ };
96
+
97
+ Tooltip.prototype.$build = function() {};
98
+ Tooltip.prototype.toNdElement = function() {};
@@ -0,0 +1,5 @@
1
+ import Tooltip from './Tooltip';
2
+
3
+ export {
4
+ Tooltip
5
+ }
@@ -0,0 +1,6 @@
1
+
2
+ import {NDElement} from "../../../src/core/wrappers/NDElement";
3
+
4
+ NDElement.prototype.tooltip = function (tooltip) {
5
+ // TODO: implement tooltip
6
+ };
@@ -1,5 +1,4 @@
1
- import DebugManager from "../utils/debug-manager";
2
- import Validator from "../utils/validator";
1
+ import DebugManager from "../../core/utils/debug-manager";
3
2
 
4
3
 
5
4
  const MemoryManager = (function() {
@@ -1,6 +1,6 @@
1
1
  import ObservableItem from './ObservableItem';
2
2
  import MemoryManager from "./MemoryManager";
3
- import NativeDocumentError from "../errors/NativeDocumentError";
3
+ import NativeDocumentError from "../../core/errors/NativeDocumentError";
4
4
 
5
5
  /**
6
6
  *