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,183 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+
4
+ export default function Slider(config = {}) {
5
+ if (!(this instanceof Slider)) {
6
+ return new Slider(config);
7
+ }
8
+
9
+ this.$description = {
10
+ value: null,
11
+ defaultValue: null,
12
+ range: null,
13
+ min: null,
14
+ max: null,
15
+ step: null,
16
+ showValue: null,
17
+ showTooltip: null,
18
+ tooltipFormat: null,
19
+ marks: null,
20
+ showMarks: null,
21
+ variant: null,
22
+ color: null,
23
+ trackColor: null,
24
+ vertical: null,
25
+ height: null,
26
+ disabled: null,
27
+ readonly: null,
28
+ reverse: null,
29
+ snapToMarks: null,
30
+ render: null,
31
+ renderCursor: null,
32
+ ...config
33
+ };
34
+ }
35
+
36
+ BaseComponent.extends(Slider, EventEmitter);
37
+
38
+ Slider.use = function(template) {};
39
+ Slider.defaultTemplate = null;
40
+
41
+
42
+ Slider.prototype.value = function(value) {
43
+ this.$description.value = value;
44
+ return this;
45
+ };
46
+
47
+ Slider.prototype.value = function() {
48
+ return this.$description.value?.val();
49
+ };
50
+
51
+ Slider.prototype.setCurrentStep = function(value) {
52
+ this.$description.value?.set(value);
53
+ this.emit('change', value);
54
+ return this;
55
+ };
56
+
57
+ Slider.prototype.range = function(min, max) {
58
+ this.$description.range = {min, max};
59
+ return this;
60
+ };
61
+
62
+ Slider.prototype.min = function(min) {
63
+ this.$description.min = min;
64
+ return this;
65
+ };
66
+
67
+ Slider.prototype.max = function(max) {
68
+ this.$description.max = max;
69
+ return this;
70
+ };
71
+
72
+ Slider.prototype.step = function(step) {
73
+ this.$description.step = step;
74
+ return this;
75
+ };
76
+
77
+ Slider.prototype.showValue = function(enabled = true) {
78
+ this.$description.showValue = enabled;
79
+ return this;
80
+ };
81
+
82
+ Slider.prototype.showTooltip = function(enabled = true) {
83
+ this.$description.showTooltip = enabled;
84
+ return this;
85
+ };
86
+
87
+ Slider.prototype.tooltipFormat = function(formatFn) {
88
+ this.$description.tooltipFormat = formatFn;
89
+ return this;
90
+ };
91
+
92
+ Slider.prototype.marks = function(marks) {
93
+ this.$description.marks = marks;
94
+ return this;
95
+ };
96
+
97
+ Slider.prototype.showMarks = function(enabled = true) {
98
+ this.$description.showMarks = enabled;
99
+ return this;
100
+ };
101
+
102
+ Slider.prototype.variant = function(name) {
103
+ this.$description.variant = name;
104
+ return this;
105
+ };
106
+
107
+ Slider.prototype.primary = function() {
108
+ return this.variant('primary');
109
+ };
110
+ Slider.prototype.secondary = function() {
111
+ return this.variant('secondary');
112
+ };
113
+ Slider.prototype.success = function() {
114
+ return this.variant('success');
115
+ };
116
+ Slider.prototype.warning = function() {
117
+ return this.variant('warning');
118
+ };
119
+ Slider.prototype.danger = function() {
120
+ return this.variant('danger');
121
+ };
122
+ Slider.prototype.info = function() {
123
+ return this.variant('info');
124
+ };
125
+
126
+ Slider.prototype.vertical = function(enabled = true) {
127
+ this.$description.vertical = enabled;
128
+ return this;
129
+ };
130
+
131
+ Slider.prototype.height = function(height) {
132
+ this.$description.height = height;
133
+ return this;
134
+ };
135
+
136
+ Slider.prototype.disabled = function(condition = true) {
137
+ this.$description.disabled = condition;
138
+ return this;
139
+ };
140
+
141
+ Slider.prototype.readonly = function(condition = true) {
142
+ this.$description.readonly = condition;
143
+ return this;
144
+ };
145
+
146
+ Slider.prototype.reverse = function(enabled = true) {
147
+ this.$description.reverse = enabled;
148
+ return this;
149
+ };
150
+
151
+ Slider.prototype.snapToMarks = function(enabled = true) {
152
+ this.$description.snapToMarks = enabled;
153
+ return this;
154
+ };
155
+
156
+ Slider.prototype.onChange = function(handler) {
157
+ this.on('change', handler);
158
+ return this;
159
+ };
160
+
161
+ Slider.prototype.onComplete = function(handler) {
162
+ this.on('complete', handler);
163
+ return this;
164
+ };
165
+
166
+
167
+ Slider.prototype.renderCursor = function(renderFn) {
168
+ this.$description.renderCursor = renderFn;
169
+ return this;
170
+ };
171
+
172
+ Slider.prototype.render = function(renderFn) {
173
+ this.$description.render = renderFn;
174
+ };
175
+
176
+
177
+ Slider.prototype.$build = function() {
178
+ // TODO: Implementation
179
+ };
180
+
181
+ Slider.prototype.toNdElement = function() {
182
+ return this.$build();
183
+ };
@@ -0,0 +1,5 @@
1
+ import Slider from "./Slider";
2
+
3
+ export {
4
+ Slider
5
+ };
@@ -0,0 +1,160 @@
1
+
2
+ export default function Spinner(config = {}) {
3
+ if (!(this instanceof Spinner)) {
4
+ return new Spinner(config);
5
+ }
6
+
7
+ this.$description = {
8
+ type: 'circle',
9
+ variant: null,
10
+ color: null,
11
+ size: 'small',
12
+ label: null,
13
+ labelPosition: null,
14
+ overlay: null,
15
+ backdrop: null,
16
+ render: null,
17
+ loading: null,
18
+ speed: null,
19
+ ...config
20
+ };
21
+ }
22
+
23
+ Spinner.use = function(template) {};
24
+ Spinner.defaultTemplate = null;
25
+
26
+ Spinner.prototype.type = function(type) {
27
+ this.$description.type = type;
28
+ return this;
29
+ };
30
+
31
+ Spinner.prototype.circle = function() {
32
+ return this.type('circle');
33
+ };
34
+ Spinner.prototype.dots = function() {
35
+ return this.type('dots');
36
+ };
37
+ Spinner.prototype.bars = function() {
38
+ return this.type('bars');
39
+ };
40
+ Spinner.prototype.pulse = function() {
41
+ return this.type('pulse');
42
+ };
43
+ Spinner.prototype.ring = function() {
44
+ return this.type('ring');
45
+ };
46
+
47
+ /**
48
+ * @param {string|int} size
49
+ * @returns {Spinner}
50
+ */
51
+ Spinner.prototype.size = function(size) {
52
+ this.$description.size = size;
53
+ return this;
54
+ };
55
+ Spinner.prototype.extraSmall = function() {
56
+ return this.size('extra-small');
57
+ };
58
+ Spinner.prototype.small = function() {
59
+ return this.size('small');
60
+ };
61
+ Spinner.prototype.medium = function() {
62
+ return this.size('medium');
63
+ };
64
+ Spinner.prototype.large = function() {
65
+ return this.size('large');
66
+ };
67
+ Spinner.prototype.extraLarge = function() {
68
+ return this.size('extra-large');
69
+ };
70
+
71
+ Spinner.prototype.variant = function(name) {
72
+ this.$description.variant = name;
73
+ return this;
74
+ };
75
+ Spinner.prototype.primary = function() {
76
+ return this.variant('primary');
77
+ };
78
+ Spinner.prototype.secondary = function() {
79
+ return this.variant('secondary');
80
+ };
81
+ Spinner.prototype.success = function() {
82
+ return this.variant('success');
83
+ };
84
+ Spinner.prototype.danger = function() {
85
+ return this.variant('danger');
86
+ };
87
+ Spinner.prototype.warning = function() {
88
+ return this.variant('warning');
89
+ }
90
+ Spinner.prototype.color = function(color) {
91
+ this.$description.color = color;
92
+ return this;
93
+ };
94
+
95
+ Spinner.prototype.label = function(label) {
96
+ this.$description.label = label;
97
+ return this;
98
+ };
99
+ Spinner.prototype.labelPosition = function(position) {
100
+ this.$description.labelPosition = position;
101
+ return this;
102
+ };
103
+ Spinner.prototype.labelAtTop = function() {
104
+ return this.labelPosition('top');
105
+ };
106
+ Spinner.prototype.labelAtBottom = function() {
107
+ return this.labelPosition('bottom');
108
+ };
109
+ Spinner.prototype.labelAtLeft = function() {
110
+ return this.labelPosition('left');
111
+ };
112
+ Spinner.prototype.labelAtRight = function() {
113
+ return this.labelPosition('right');
114
+ };
115
+
116
+ Spinner.prototype.overlay = function(enabled = true) {
117
+ this.$description.overlay = enabled;
118
+ return this;
119
+ };
120
+ Spinner.prototype.fullscreen = function() {
121
+ return this.overlay(true);
122
+ };
123
+ Spinner.prototype.backdrop = function(enabled = true) {
124
+ this.$description.backdrop = enabled;
125
+ return this;
126
+ };
127
+
128
+ /**
129
+ *
130
+ * @param {string|int} speed
131
+ * @returns {Spinner}
132
+ */
133
+ Spinner.prototype.speed = function(speed) {
134
+ this.$description.speed = speed;
135
+ return this;
136
+ };
137
+ Spinner.prototype.slow = function() {
138
+ return this.speed('slow');
139
+ };
140
+ Spinner.prototype.normal = function() {
141
+ return this.speed('normal');
142
+ };
143
+ Spinner.prototype.fast = function() {
144
+ return this.speed('fast');
145
+ };
146
+ Spinner.prototype.loading = function(isLoading) {
147
+ this.$description.loading = isLoading;
148
+ return this;
149
+ };
150
+
151
+ Spinner.prototype.show = function() {};
152
+ Spinner.prototype.hide = function() {};
153
+
154
+ Spinner.prototype.render = function(renderFn) {
155
+ this.$description.render = renderFn;
156
+ return this;
157
+ };
158
+
159
+ Spinner.prototype.$build = function() {};
160
+ Spinner.prototype.toNdElement = function() {};
@@ -0,0 +1,5 @@
1
+ import Spinner from './Spinner'
2
+
3
+ export {
4
+ Spinner
5
+ }
@@ -0,0 +1,95 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+ import EventEmitter from "@src/core/utils/EventEmitter";
3
+ import SplitterPanel from "./SplitterPanel";
4
+ import {Validator} from "@core";
5
+
6
+ export default function Splitter(config = {}) {
7
+ if(!(this instanceof Splitter)) {
8
+ return new Splitter(config);
9
+ }
10
+
11
+ this.$description = {
12
+ orientation: 'horizontal',
13
+ panels: [],
14
+ gutterSize: 8,
15
+ render: null,
16
+ ...config
17
+ };
18
+
19
+ this.$element = null;
20
+ }
21
+
22
+ BaseComponent.extends(Splitter, EventEmitter);
23
+
24
+ Splitter.defaultTemplate = null;
25
+
26
+ Splitter.use = function(template) {
27
+ Splitter.defaultTemplate = template.splitter;
28
+ };
29
+
30
+ Splitter.prototype.dynamic = function(){
31
+ this.$description.panels = $.array([]);
32
+ return this;
33
+ };
34
+
35
+ Splitter.prototype.orientation = function(orientation) {
36
+ this.$description.orientation = orientation;
37
+ return this;
38
+ };
39
+
40
+ Splitter.prototype.horizontal = function() {
41
+ this.$description.orientation = 'horizontal';
42
+ return this;
43
+ };
44
+
45
+ Splitter.prototype.vertical = function() {
46
+ this.$description.orientation = 'vertical';
47
+ return this;
48
+ };
49
+
50
+ Splitter.prototype.gutterSize = function(gutterSize) {
51
+ this.$description.gutterSize = gutterSize;
52
+ return this;
53
+ };
54
+
55
+ Splitter.prototype.panel = function(panel) {
56
+ this.$description.panels.push(panel);
57
+ return this;
58
+ };
59
+
60
+ Splitter.prototype.panels = function(panels) {
61
+ if(Validator.isObservable(this.$description.panels)) {
62
+ this.$description.panels.set(panels);
63
+ return this;
64
+ }
65
+ this.$description.panels = [];
66
+ panels.forEach(panel => this.panel(panel));
67
+ return this;
68
+ };
69
+
70
+
71
+ Splitter.prototype.removePanel = function(panel) {
72
+ this.$description.panels.remove(panel);
73
+ // TODO: remove the unnecessary gutter
74
+ return this;
75
+ }
76
+
77
+ Splitter.prototype.onResize = function(handler) {
78
+ this.on('resize', handler);
79
+ return this;
80
+ };
81
+
82
+ Splitter.prototype.onPanelAdd = function(handler) {
83
+ this.on('panelAdd', handler);
84
+ return this;
85
+ };
86
+
87
+ Splitter.prototype.onPanelRemove = function(handler) {
88
+ this.on('panelRemove', handler);
89
+ return this;
90
+ };
91
+
92
+ Splitter.prototype.render = function(renderFn) {
93
+ this.$description.render = renderFn;
94
+ return this;
95
+ };
@@ -0,0 +1,57 @@
1
+
2
+
3
+ export default function SplitterGutter(leftPanel, rightPanel, config = {}) {
4
+ if(!(this instanceof SplitterGutter)) {
5
+ return new SplitterGutter(config);
6
+ }
7
+
8
+ this.$description = {
9
+ leftPanel: leftPanel || null,
10
+ rightPanel: rightPanel || null,
11
+ orientation: config.orientation || 'horizontal',
12
+ cursor: config.orientation === 'vertical' ? 'row-resize' : 'col-resize',
13
+ size: 8,
14
+ isDragging: $(false)
15
+ }
16
+ }
17
+
18
+ SplitterGutter.defaultTemplate = null;
19
+
20
+ SplitterGutter.use = function(template) {
21
+ SplitterGutter.defaultTemplate = template.splitterGutter;
22
+ };
23
+
24
+ SplitterGutter.prototype.panels = function(leftPanel, rightPanel) {
25
+ this.$description.leftPanel = leftPanel;
26
+ this.$description.rightPanel = rightPanel;
27
+ return this;
28
+ };
29
+
30
+ SplitterGutter.prototype.leftPanel = function(leftPanel) {
31
+ this.$description.leftPanel = leftPanel;
32
+ return this;
33
+ };
34
+ SplitterGutter.prototype.rightPanel = function(rightPanel) {
35
+ this.$description.rightPanel = rightPanel;
36
+ return this;
37
+ };
38
+
39
+ SplitterGutter.prototype.size = function(size) {
40
+ this.$description.size = size;
41
+ return this;
42
+ };
43
+
44
+ SplitterGutter.prototype.onDragStart = function(handler) {
45
+ this.on('dragStart', handler);
46
+ return this;
47
+ };
48
+
49
+ SplitterGutter.prototype.onDrag = function(handler) {
50
+ this.on('drag', handler);
51
+ return this;
52
+ };
53
+
54
+ SplitterGutter.prototype.onDragEnd = function(handler) {
55
+ this.on('dragEnd', handler);
56
+ return this;
57
+ };
@@ -0,0 +1,82 @@
1
+ import BaseComponent from "@components/BaseComponent";
2
+
3
+ export default function SplitterPanel(content, config = {}) {
4
+ if(!(this instanceof SplitterPanel)) {
5
+ return new SplitterPanel(content, config);
6
+ }
7
+
8
+ if (typeof content === 'object' && !content.tagName) {
9
+ config = content;
10
+ content = config.content || null;
11
+ }
12
+
13
+ this.$description = {
14
+ content: content || null,
15
+ size: null,
16
+ minSize: null,
17
+ maxSize: null,
18
+ collapsible: false,
19
+ collapsed: false,
20
+ resizable: true,
21
+ data: null,
22
+ render: null,
23
+ ...config
24
+ };
25
+ }
26
+
27
+ BaseComponent.extends(SplitterPanel, BaseComponent);
28
+
29
+ SplitterPanel.defaultTemplate = null;
30
+
31
+ SplitterPanel.use = function(template) {
32
+ SplitterPanel.defaultTemplate = template.splitterPanel;
33
+ };
34
+
35
+ SplitterPanel.prototype.content = function(content) {
36
+ this.$description.content = content;
37
+ return this;
38
+ };
39
+
40
+ SplitterPanel.prototype.size = function(size) {
41
+ this.$description.size = size;
42
+ return this;
43
+ };
44
+
45
+ SplitterPanel.prototype.minSize = function(size) {
46
+ this.$description.minSize = size;
47
+ return this;
48
+ };
49
+
50
+ SplitterPanel.prototype.maxSize = function(size) {
51
+ this.$description.maxSize = size;
52
+ return this;
53
+ };
54
+
55
+ SplitterPanel.prototype.collapsible = function(collapsible = true) {
56
+ this.$description.collapsible = collapsible;
57
+ return this;
58
+ };
59
+
60
+ SplitterPanel.prototype.collapsed = function(collapsed = true) {
61
+ this.$description.collapsed = collapsed;
62
+ return this;
63
+ };
64
+
65
+ SplitterPanel.prototype.resizable = function(resizable = true) {
66
+ this.$description.resizable = resizable;
67
+ return this;
68
+ };
69
+
70
+ SplitterPanel.prototype.fixed = function() {
71
+ return this.resizable(false);
72
+ };
73
+
74
+ SplitterPanel.prototype.data = function(data) {
75
+ this.$description.data = data;
76
+ return this;
77
+ };
78
+
79
+ SplitterPanel.prototype.render = function(renderFn) {
80
+ this.$description.render = renderFn;
81
+ return this;
82
+ };
@@ -0,0 +1,8 @@
1
+ import Splitter from "./Splitter";
2
+ import SplitterPanel from "./SplitterPanel";
3
+
4
+
5
+ export {
6
+ Splitter,
7
+ SplitterPanel
8
+ }