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.
Files changed (184) hide show
  1. package/components.js +26 -1
  2. package/dist/native-document.components.min.js +6360 -1925
  3. package/dist/native-document.dev.js +122 -56
  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/jsconfig.json +15 -0
  8. package/package.json +1 -1
  9. package/rollup.config.js +4 -2
  10. package/src/components/$traits/HasItems.js +38 -0
  11. package/src/components/BaseComponent.js +70 -0
  12. package/src/components/accordion/Accordion.js +133 -0
  13. package/src/components/accordion/AccordionItem.js +119 -0
  14. package/src/components/accordion/index.js +7 -0
  15. package/src/components/alert/Alert.js +155 -0
  16. package/src/components/alert/index.js +6 -0
  17. package/src/components/avatar/Avatar.js +178 -0
  18. package/src/components/avatar/index.js +5 -0
  19. package/src/components/badge/Badge.js +103 -0
  20. package/src/components/badge/index.js +6 -0
  21. package/src/components/breadcrumb/BreadCrumb.js +70 -0
  22. package/src/components/breadcrumb/index.js +5 -0
  23. package/src/components/button/Button.js +174 -0
  24. package/src/components/button/index.js +5 -0
  25. package/src/components/card/Card.js +110 -0
  26. package/src/components/card/index.js +5 -0
  27. package/src/components/context-menu/ContextMenu.js +60 -0
  28. package/src/components/context-menu/ContextMenuGroup.js +16 -0
  29. package/src/components/context-menu/ContextMenuItem.js +16 -0
  30. package/src/components/context-menu/index.js +10 -0
  31. package/src/components/divider/Divider.js +126 -0
  32. package/src/components/divider/index.js +6 -0
  33. package/src/components/dropdown/Dropdown.js +170 -0
  34. package/src/components/dropdown/DropdownDivider.js +24 -0
  35. package/src/components/dropdown/DropdownGroup.js +44 -0
  36. package/src/components/dropdown/DropdownItem.js +71 -0
  37. package/src/components/dropdown/DropdownTrigger.js +64 -0
  38. package/src/components/dropdown/index.js +13 -0
  39. package/src/components/{fom-control → form}/FormControl.js +30 -22
  40. package/src/components/{fom-control → form}/field/DefaultRender.js +2 -16
  41. package/src/components/{fom-control → form}/field/Field.js +67 -140
  42. package/src/components/{fom-control → form}/field/FieldCollection.js +42 -22
  43. package/src/components/{fom-control → form}/field/types/AutocompleteField.js +11 -0
  44. package/src/components/form/field/types/CheckboxField.js +36 -0
  45. package/src/components/{fom-control → form}/field/types/CheckboxGroupField.js +10 -0
  46. package/src/components/{fom-control → form}/field/types/ColorField.js +11 -1
  47. package/src/components/{fom-control → form}/field/types/DateField.js +11 -1
  48. package/src/components/{fom-control → form}/field/types/EmailField.js +11 -1
  49. package/src/components/{fom-control → form}/field/types/FileField.js +11 -1
  50. package/src/components/form/field/types/HiddenField.js +18 -0
  51. package/src/components/{fom-control → form}/field/types/ImageField.js +11 -1
  52. package/src/components/{fom-control → form}/field/types/NumberField.js +11 -1
  53. package/src/components/{fom-control → form}/field/types/PasswordField.js +11 -1
  54. package/src/components/{fom-control → form}/field/types/RadioField.js +28 -2
  55. package/src/components/{fom-control → form}/field/types/RangeField.js +10 -0
  56. package/src/components/{fom-control → form}/field/types/SearchField.js +10 -0
  57. package/src/components/{fom-control → form}/field/types/SelectField.js +10 -0
  58. package/src/components/{fom-control → form}/field/types/StringField.js +11 -1
  59. package/src/components/{fom-control → form}/field/types/TelField.js +11 -2
  60. package/src/components/{fom-control → form}/field/types/TextAreaField.js +10 -0
  61. package/src/components/{fom-control → form}/field/types/TimeField.js +11 -2
  62. package/src/components/{fom-control → form}/field/types/UrlField.js +10 -2
  63. package/src/components/form/index.js +49 -0
  64. package/src/components/{fom-control → form}/validation/Validation.js +1 -1
  65. package/src/components/list/List.js +106 -0
  66. package/src/components/list/ListGroup.js +67 -0
  67. package/src/components/list/ListItem.js +103 -0
  68. package/src/components/list/index.js +10 -0
  69. package/src/components/menu/Menu.js +82 -0
  70. package/src/components/menu/MenuDivider.js +22 -0
  71. package/src/components/menu/MenuGroup.js +42 -0
  72. package/src/components/menu/MenuItem.js +71 -0
  73. package/src/components/menu/index.js +13 -0
  74. package/src/components/modal/Modal.js +153 -0
  75. package/src/components/modal/index.js +5 -0
  76. package/src/components/pagination/Pagination.js +229 -0
  77. package/src/components/pagination/index.js +5 -0
  78. package/src/components/popover/Popover.js +185 -0
  79. package/src/components/popover/PopoverFooter.js +37 -0
  80. package/src/components/popover/PopoverHeader.js +43 -0
  81. package/src/components/popover/index.js +10 -0
  82. package/src/components/progress/Progress.js +220 -0
  83. package/src/components/progress/index.js +6 -0
  84. package/src/components/skeleton/Skeleton.js +98 -0
  85. package/src/components/skeleton/SkeletonCard.js +0 -0
  86. package/src/components/skeleton/SkeletonList.js +0 -0
  87. package/src/components/skeleton/SkeletonParagraph.js +0 -0
  88. package/src/components/skeleton/SkeletonTable.js +0 -0
  89. package/src/components/skeleton/index.js +6 -0
  90. package/src/components/slider/Slider.js +183 -0
  91. package/src/components/slider/index.js +5 -0
  92. package/src/components/spinner/Spinner.js +160 -0
  93. package/src/components/spinner/index.js +5 -0
  94. package/src/components/splitter/Splitter.js +95 -0
  95. package/src/components/splitter/SplitterGutter.js +57 -0
  96. package/src/components/splitter/SplitterPanel.js +82 -0
  97. package/src/components/splitter/index.js +8 -0
  98. package/src/components/stepper/Stepper.js +229 -0
  99. package/src/components/stepper/StepperStep.js +103 -0
  100. package/src/components/stepper/index.js +8 -0
  101. package/src/components/switch/Switch.js +99 -0
  102. package/src/components/switch/index.js +0 -0
  103. package/src/components/table/ColumnGroup.js +1 -1
  104. package/src/components/table/DataTable.js +1 -1
  105. package/src/components/table/SimpleTable.js +36 -32
  106. package/src/components/tabs/Tabs.js +110 -0
  107. package/src/components/tabs/index.js +6 -0
  108. package/src/components/toast/Toast.js +129 -0
  109. package/src/components/toast/ToastError.js +0 -0
  110. package/src/components/toast/ToastInfo.js +0 -0
  111. package/src/components/toast/ToastSuccess.js +0 -0
  112. package/src/components/toast/ToastWarning.js +0 -0
  113. package/src/components/toast/index.js +5 -0
  114. package/src/components/tooltip/Tooltip.js +98 -0
  115. package/src/components/tooltip/index.js +5 -0
  116. package/src/components/tooltip/prototypes.js +6 -0
  117. package/src/core/data/MemoryManager.js +2 -2
  118. package/src/core/data/Observable.js +1 -1
  119. package/src/core/data/ObservableArray.js +14 -8
  120. package/src/core/data/ObservableItem.js +5 -5
  121. package/src/core/data/observable-helpers/array.js +2 -2
  122. package/src/core/data/observable-helpers/batch.js +2 -2
  123. package/src/core/data/observable-helpers/computed.js +6 -6
  124. package/src/core/data/observable-helpers/object.js +2 -2
  125. package/src/core/elements/anchor.js +3 -3
  126. package/src/core/elements/content-formatter.js +1 -1
  127. package/src/core/elements/control/for-each-array.js +42 -68
  128. package/src/core/elements/control/for-each.js +7 -7
  129. package/src/core/elements/control/show-if.js +5 -5
  130. package/src/core/elements/control/show-when.js +2 -2
  131. package/src/core/elements/control/switch.js +4 -4
  132. package/src/core/elements/description-list.js +1 -1
  133. package/src/core/elements/form.js +1 -1
  134. package/src/core/elements/html5-semantics.js +1 -1
  135. package/src/core/elements/img.js +3 -3
  136. package/src/core/elements/index.js +1 -1
  137. package/src/core/elements/interactive.js +1 -1
  138. package/src/core/elements/list.js +1 -1
  139. package/src/core/elements/medias.js +1 -1
  140. package/src/core/elements/meta-data.js +1 -1
  141. package/src/core/elements/table.js +1 -1
  142. package/src/core/utils/EventEmitter.js +1 -1
  143. package/src/core/utils/args-types.js +2 -2
  144. package/src/core/utils/events.js +68 -0
  145. package/src/core/utils/filters/standard.js +1 -1
  146. package/src/core/utils/filters/utils.js +1 -1
  147. package/src/core/utils/helpers.js +10 -7
  148. package/src/core/utils/prototypes.js +2 -2
  149. package/src/core/utils/validator.js +6 -5
  150. package/src/core/wrappers/AttributesWrapper.js +21 -38
  151. package/src/core/wrappers/DocumentObserver.js +1 -1
  152. package/src/core/wrappers/ElementCreator.js +9 -14
  153. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  154. package/src/core/wrappers/NDElement.js +3 -3
  155. package/src/core/wrappers/NdPrototype.js +24 -31
  156. package/src/core/wrappers/SingletonView.js +1 -1
  157. package/src/core/wrappers/TemplateCloner.js +60 -18
  158. package/src/core/wrappers/constants.js +32 -1
  159. package/src/core/wrappers/prototypes/attributes-extensions.js +18 -5
  160. package/src/core/wrappers/prototypes/bind-class-extensions.js +18 -0
  161. package/src/core/wrappers/prototypes/nd-element-extensions.js +6 -6
  162. package/src/devtools/app/App.js +2 -2
  163. package/src/devtools/hrm/ComponentRegistry.js +2 -2
  164. package/src/devtools/plugin.js +1 -1
  165. package/src/devtools/widget/DevToolsWidget.js +2 -2
  166. package/src/router/Route.js +1 -1
  167. package/src/router/RouteGroupHelper.js +1 -1
  168. package/src/router/Router.js +4 -4
  169. package/src/router/RouterComponent.js +1 -1
  170. package/src/router/link.js +3 -3
  171. package/src/router/modes/HistoryRouter.js +1 -2
  172. package/types/filters/dates.d.ts +1 -1
  173. package/types/filters/standard.d.ts +0 -1
  174. package/types/filters/types.d.ts +1 -1
  175. package/utils.js +3 -3
  176. package/src/components/fom-control/default/DefaultLayout.js +0 -8
  177. package/src/components/fom-control/default/collection/DefaultCollectionLayout.js +0 -12
  178. package/src/components/fom-control/default/collection/DefaultCollectionTemplate.js +0 -6
  179. package/src/components/fom-control/field/types/CheckboxField.js +0 -17
  180. package/src/components/fom-control/field/types/HiddenField.js +0 -8
  181. package/src/components/fom-control/index.js +0 -8
  182. /package/src/components/{fom-control → form}/field/FieldFactory.js +0 -0
  183. /package/src/components/{fom-control → form}/merge +0 -0
  184. /package/src/components/{fom-control → form}/utils.js +0 -0
@@ -0,0 +1,103 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+
4
+
5
+ export default function Badge(config = {}) {
6
+ if(!(this instanceof Badge)) {
7
+ return new Badge(config);
8
+ }
9
+
10
+ this.$description = {
11
+ style: null,
12
+ shape: null,
13
+ variant,
14
+ ...config
15
+ };
16
+ }
17
+
18
+ BaseComponent.extends(Badge);
19
+
20
+ Badge.defaultTemplate = null;
21
+
22
+ Badge.use = function(template) {};
23
+
24
+ Badge.prototype.variant = function(variant) {
25
+ this.$description.variant = variant;
26
+ return this;
27
+ };
28
+ Badge.prototype.primary = function() {
29
+ return this.variant('primary');
30
+ };
31
+ Badge.prototype.secondary = function() {
32
+ return this.variant('secondary');
33
+ };
34
+ Badge.prototype.success = function() {
35
+ return this.variant('success');
36
+ };
37
+ Badge.prototype.danger = function() {
38
+ return this.variant('danger');
39
+ };
40
+ Badge.prototype.warning = function() {
41
+ return this.variant('warning');
42
+ };
43
+ Badge.prototype.info = function() {
44
+ return this.variant('info');
45
+ };
46
+
47
+ Badge.prototype.size = function(size) {
48
+ this.$description.size = size;
49
+ return this;
50
+ };
51
+ Badge.prototype.small = function() {
52
+ return this.size('small');
53
+ };
54
+ Badge.prototype.medium = function() {
55
+ return this.size('medium');
56
+ };
57
+ Badge.prototype.large = function() {
58
+ return this.size('large');
59
+ };
60
+
61
+ Badge.prototype.shape = function(shape) {
62
+ this.$description.shape = shape;
63
+ return this;
64
+ };
65
+
66
+ Badge.prototype.rounded = function() {
67
+ return this.shape('rounded');
68
+ };
69
+ Badge.prototype.pill = function() {
70
+ return this.shape('pill');
71
+ };
72
+
73
+ Badge.prototype.style = function(style) {
74
+ this.$description.style = style;
75
+ return this;
76
+ };
77
+ Badge.prototype.outline = function() {
78
+ return this.style('outline');
79
+ };
80
+ Badge.prototype.filled = function() {
81
+ return this.style('filled');
82
+ };
83
+ Badge.prototype.bordered = function() {
84
+ return this.style('bordered');
85
+ };
86
+
87
+ Badge.prototype.content = function(content) {
88
+ this.$description.content = content;
89
+ return this;
90
+ };
91
+
92
+ Badge.prototype.clickable = function(handler) {};
93
+
94
+
95
+ Badge.prototype.render = function(renderFn) {
96
+ this.$description.render = renderFn;
97
+ return this;
98
+ };
99
+
100
+ Badge.prototype.$build = function() {
101
+
102
+ };
103
+ Badge.prototype.toNdElement = function() {};
@@ -0,0 +1,6 @@
1
+ import Badge from './Badge'
2
+
3
+
4
+ export {
5
+ Badge
6
+ };
@@ -0,0 +1,70 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+
4
+ export default function Breadcrumb(config = {}) {
5
+ if (!(this instanceof Breadcrumb)) {
6
+ return new Breadcrumb(config);
7
+ }
8
+
9
+ this.$description = {
10
+ separator: null,
11
+ items: [],
12
+ renderSeparator: null,
13
+ renderItem: null,
14
+ ...config,
15
+ };
16
+ }
17
+
18
+ BaseComponent.extends(Breadcrumb, EventEmitter);
19
+
20
+ Breadcrumb.use = function(template) {};
21
+ Breadcrumb.defaultTemplate = null;
22
+
23
+ Breadcrumb.prototype.item = function(label, href) {
24
+ this.$description.items.push({ label, href });
25
+ return this;
26
+ };
27
+ Breadcrumb.prototype.items = function(items) {
28
+ this.$description.items = [];
29
+ for(const item of items) {
30
+ this.addItem(item.label, item.href);
31
+ }
32
+ return this;
33
+ };
34
+ Breadcrumb.prototype.addItem = function(label, href) {
35
+ this.$description.items.push({ label, href });
36
+ return this;
37
+ };
38
+ Breadcrumb.prototype.removeItem = function(index) {
39
+ this.$description.items.splice(index, 1);
40
+ };
41
+
42
+ Breadcrumb.prototype.separator = function(separator) {
43
+ this.$description.separator = separator;
44
+ return this;
45
+ };
46
+
47
+
48
+ Breadcrumb.prototype.onItemClick = function(handler) {
49
+ this.on('clickItem', handler);
50
+ return this;
51
+ };
52
+
53
+ // Render
54
+ Breadcrumb.prototype.renderSeparator = function(renderFn) {
55
+ this.$description.renderSeparator = renderFn;
56
+ return this;
57
+ };
58
+ Breadcrumb.prototype.renderItem = function(renderFn) {
59
+ this.$description.renderItem = renderFn;
60
+ return this;
61
+ };
62
+ Breadcrumb.prototype.render = function(renderFn) {
63
+ this.$description.render = renderFn;
64
+ return this;
65
+ };
66
+
67
+ Breadcrumb.prototype.$build = function() {
68
+
69
+ };
70
+ Breadcrumb.prototype.toNdElement = function() {};
@@ -0,0 +1,5 @@
1
+ import Breadcrumb from './BreadCrumb';
2
+
3
+ export {
4
+ Breadcrumb
5
+ }
@@ -0,0 +1,174 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import { Button as NativeButton } from "@elements";
3
+
4
+ export default function Button(label, config = {}) {
5
+ if(!(this instanceof Button)) {
6
+ return new Button(label, config);
7
+ }
8
+
9
+ BaseComponent.call(this, config);
10
+
11
+ this.$description = {
12
+ label: label,
13
+ type: null,
14
+ variant: null,
15
+ size: null,
16
+ icon: null,
17
+ iconPosition: null,
18
+ loading: null,
19
+ disabled: null,
20
+ template: null,
21
+ block: null,
22
+ borderRadiusType: null,
23
+ outline: null,
24
+ };
25
+
26
+ this.$element = null;
27
+ }
28
+
29
+ Button.defaultTemplate = null;
30
+ Button.defaultLoaderTemplate = null;
31
+
32
+ Button.use = function(template = {}) {
33
+ Button.defaultTemplate = template.button;
34
+ Button.defaultLoaderTemplate = template.loader;
35
+ };
36
+
37
+ BaseComponent.extends(Button);
38
+
39
+ Button.prototype.type = function(type) {
40
+ this.$description.type = type;
41
+ return this;
42
+ };
43
+
44
+ Button.prototype.variant = function(variant) {
45
+ this.$description.variant = variant;
46
+ return this;
47
+ };
48
+ Button.prototype.primary = function() {
49
+ return this.variant('primary');
50
+ };
51
+ Button.prototype.secondary = function() {
52
+ return this.variant('secondary');
53
+ };
54
+ Button.prototype.danger = function() {
55
+ return this.variant('danger');
56
+ };
57
+ Button.prototype.success = function() {
58
+ return this.variant('success');
59
+ };
60
+ Button.prototype.warning = function() {
61
+ return this.variant('warning');
62
+ };
63
+ Button.prototype.ghost = function() {
64
+ return this.variant('ghost');
65
+ };
66
+ Button.prototype.link = function() {
67
+ return this.variant('link');
68
+ };
69
+ Button.prototype.outline = function() {
70
+ this.$description.outline = true;
71
+ return this;
72
+ };
73
+
74
+ Button.prototype.size = function(size) {
75
+ this.$description.size = size;
76
+ return this;
77
+ };
78
+ Button.prototype.small = function() {
79
+ return this.size('small');
80
+ };
81
+ Button.prototype.large = function() {
82
+ return this.size('large');
83
+ };
84
+ Button.prototype.medium = function() {
85
+ return this.size('medium');
86
+ };
87
+
88
+ Button.prototype.icon = function(icon, iconPosition = 'left') {
89
+ this.$description.icon = icon;
90
+ this.$description.iconPosition = iconPosition;
91
+ return this;
92
+ };
93
+
94
+ Button.prototype.iconAtLeft = function(position) {
95
+ return this.iconPosition('left');
96
+ };
97
+ Button.prototype.iconAtRight = function(position) {
98
+ return this.iconPosition('right');
99
+ };
100
+ Button.prototype.iconAtTop = function() {
101
+ return this.iconPosition('top');
102
+ };
103
+
104
+ Button.prototype.iconAtBottom = function() {
105
+ return this.iconPosition('bottom');
106
+ };
107
+
108
+ Button.prototype.iconOnly = function() {
109
+ return this;
110
+ };
111
+
112
+ Button.prototype.loading = function(loading = true) {
113
+ this.$description.loading = loading;
114
+ return this;
115
+ }
116
+
117
+ Button.prototype.disable = function(disabled = true) {
118
+ this.$description.disabled = disabled;
119
+ return this;
120
+ };
121
+
122
+ Button.prototype.enable = function() {
123
+ return this.disable(false);
124
+ };
125
+
126
+ Button.prototype.render = function(renderFunction) {
127
+ this.$description.render = renderFunction;
128
+ return this;
129
+ };
130
+
131
+ Button.prototype.rounded = function() {
132
+ this.$description.borderRadiusType = 'rounded';
133
+ return this;
134
+ };
135
+ Button.prototype.circle = function() {
136
+ this.$description.borderRadiusType = 'circle';
137
+ return this;
138
+ };
139
+ Button.prototype.pill = function() {
140
+ this.$description.shape = 'circle';
141
+ return this;
142
+ };
143
+ Button.prototype.smooth = function() {
144
+ this.$description.shape = 'smooth';
145
+ return this;
146
+ };
147
+ Button.prototype.block = function() {
148
+ this.$description.block = true;
149
+ return this;
150
+ };
151
+
152
+ Button.prototype.$build = function() {
153
+ if(this.$element) {
154
+ return this.$element;
155
+ }
156
+ const renderFn = this.$description.render || Button.defaultTemplate;
157
+
158
+ if(typeof renderFn === 'function') {
159
+ this.$element = renderFn(this);
160
+ }
161
+ else {
162
+ const props = {};
163
+ this.$element = NativeButton(props, this.$description.label);
164
+ }
165
+ return this.$element;
166
+ };
167
+
168
+ Button.prototype.node = function() {
169
+ return this.$build();
170
+ };
171
+
172
+ Button.prototype.toNdElement = function() {
173
+ return this.$build();
174
+ };
@@ -0,0 +1,5 @@
1
+ import Button from './Button';
2
+
3
+ export {
4
+ Button
5
+ };
@@ -0,0 +1,110 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+
3
+ export default function Card(config = {}) {
4
+ if(!(this instanceof Card)) {
5
+ return new Card(config);
6
+ }
7
+ this.$description = {
8
+ ...config
9
+ };
10
+ };
11
+
12
+ BaseComponent.extends(Card);
13
+
14
+ Card.defaultTemplate = null;
15
+
16
+ Card.use = function(template) {};
17
+
18
+ Card.prototype.title = function(title) {
19
+ return this;
20
+ };
21
+ Card.prototype.subtitle = function(title) {
22
+ return this;
23
+ };
24
+ Card.prototype.image = function(src, position = 'top') {
25
+ return this;
26
+ };
27
+ Card.prototype.content = function(content) {
28
+ return this;
29
+ };
30
+
31
+ // Appearance
32
+ Card.prototype.variant = function(name) {
33
+ return this;
34
+ };
35
+ Card.prototype.outlined = function() {
36
+ return this;
37
+ };
38
+ Card.prototype.elevated = function() {
39
+ return this;
40
+ };
41
+ Card.prototype.flat = function() {
42
+ return this;
43
+ };
44
+
45
+ // Behavior
46
+ Card.prototype.clickable = function(handler) {
47
+ return this;
48
+ };
49
+ Card.prototype.hoverable = function() {
50
+ return this;
51
+ };
52
+ Card.prototype.loading = function(isLoading = true) {
53
+ return this;
54
+ };
55
+
56
+ // Layout
57
+ Card.prototype.horizontal = function() {
58
+ return this;
59
+ };
60
+
61
+ // Events
62
+ Card.prototype.onClick = function(handler) {
63
+ return this;
64
+ };
65
+ Card.prototype.onHover = function(handler) {
66
+ return this;
67
+ };
68
+
69
+ Card.prototype.clearActions = function() {
70
+ this.$description.actions = [];
71
+ return this;
72
+ };
73
+
74
+ Card.prototype.action = function(label, callback) {
75
+ this.$description.actions.push({ label, callback });
76
+ return this;
77
+ };
78
+
79
+ Card.prototype.renderImage = function(renderFn) {
80
+ this.$description.renderImage = renderFn;
81
+ return this;
82
+ };
83
+ Card.prototype.renderHeader = function(renderFn) {
84
+ this.$description.renderHeader = renderFn;
85
+ return this;
86
+ };
87
+ Card.prototype.renderContent = function(renderFn) {
88
+ this.$description.renderContent = renderFn;
89
+ return this;
90
+ };
91
+ Card.prototype.renderFooter = function(renderFn) {
92
+ this.$description.renderFooter = renderFn;
93
+ return this;
94
+ };
95
+ Card.prototype.layout = function(layoutFn) {
96
+ this.$description.layout = layoutFn;
97
+ return this;
98
+ };
99
+
100
+ Card.prototype.render = function(renderFn) {
101
+ this.$description.render = renderFn;
102
+ return this;
103
+ };
104
+
105
+ Card.prototype.$build = function() {
106
+
107
+ };
108
+ Card.prototype.toNdElement = function() {
109
+ return this;
110
+ };
@@ -0,0 +1,5 @@
1
+ import Card from './Card'
2
+
3
+ export default {
4
+ Card
5
+ }
@@ -0,0 +1,60 @@
1
+ import Menu from "@components/menu/Menu";
2
+ import BaseComponent from "@components/BaseComponent";
3
+
4
+ export default function ContextMenu(config = {}) {
5
+ if(!(this instanceof ContextMenu)) {
6
+ return ContextMenu(config);
7
+ }
8
+ Menu.call(this, config);
9
+
10
+ Object.assign(this.$description, {
11
+ positionX: $(0),
12
+ positionY: $(0),
13
+ target: null,
14
+ data: null,
15
+ visibility: $(false)
16
+ });
17
+
18
+ this.onItemClick( () => this.hide());
19
+ }
20
+
21
+ ContextMenu.defaultTemplate = null;
22
+ BaseComponent.extends(ContextMenu, Menu);
23
+
24
+ ContextMenu.defaultTemplate = null;
25
+
26
+ ContextMenu.use = function(template) {
27
+ ContextMenu.defaultTemplate = template.contextMenu;
28
+ };
29
+
30
+ ContextMenu.prototype.attachTo = function(target, data) {
31
+ this.$description.target = target;
32
+ target.addEventListener('contextmenu', (e) => {
33
+ e.preventDefault();
34
+ this.data(data);
35
+ this.position(e.clientX, e.clientY).show();
36
+ });
37
+ return this;
38
+ };
39
+
40
+
41
+ ContextMenu.prototype.position = function(x, y) {
42
+ this.$description.positionX.set(x);
43
+ this.$description.positionY.set(y);
44
+ return this;
45
+ }
46
+
47
+ ContextMenu.prototype.show = function() {
48
+ this.$description.visibility.set(true);
49
+ return this;
50
+ };
51
+
52
+ ContextMenu.prototype.hide = function() {
53
+ this.$description.visibility.set(false);
54
+ return this;
55
+ };
56
+
57
+ ContextMenu.prototype.data = function(data) {
58
+ this.$description.data = data;
59
+ return this;
60
+ };
@@ -0,0 +1,16 @@
1
+ import MenuGroup from "@components/menu/MenuGroup";
2
+
3
+ export default function ContextMenuGroup(label, config) {
4
+ if(!(this instanceof ContextMenuGroup)) {
5
+ return new ContextMenuGroup(label, config);
6
+ }
7
+
8
+ MenuGroup.call(this, label, config);
9
+ }
10
+
11
+
12
+ ContextMenuGroup.defaultTemplate = null;
13
+
14
+ ContextMenuGroup.use = function(template) {
15
+ ContextMenuGroup.defaultTemplate = template.contextMenuGroup;
16
+ };
@@ -0,0 +1,16 @@
1
+ import MenuItem from "@components/menu/MenuItem";
2
+
3
+ export default function ContextMenuItem(config) {
4
+ if(!(this instanceof ContextMenuItem)) {
5
+ return new ContextMenuItem(config);
6
+ }
7
+
8
+ MenuItem.call(this, config);
9
+ }
10
+
11
+
12
+ ContextMenuItem.defaultTemplate = null;
13
+
14
+ ContextMenuItem.use = function(template) {
15
+ ContextMenuItem.defaultTemplate = template.contextMenuItem;
16
+ };
@@ -0,0 +1,10 @@
1
+ import ContextMenu from "./ContextMenu";
2
+ import ContextMenuItem from "./ContextMenuItem";
3
+ import ContextMenuGroup from "./ContextMenuGroup";
4
+
5
+
6
+ export {
7
+ ContextMenu,
8
+ ContextMenuItem,
9
+ ContextMenuGroup
10
+ }