neo.mjs 5.10.2 → 5.10.4

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 (44) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/buildScripts/createClass.mjs +10 -2
  3. package/examples/ConfigurationViewport.mjs +6 -2
  4. package/examples/ServiceWorker.mjs +2 -2
  5. package/examples/component/process/MainContainer.mjs +90 -0
  6. package/examples/component/process/app.mjs +6 -0
  7. package/examples/component/process/index.html +11 -0
  8. package/examples/component/process/neo-config.json +6 -0
  9. package/examples/component/process/realWorldExample/MainContainer.mjs +334 -0
  10. package/examples/component/process/realWorldExample/RangeHeader.jpg +0 -0
  11. package/examples/component/process/realWorldExample/app.mjs +6 -0
  12. package/examples/component/process/realWorldExample/index.html +11 -0
  13. package/examples/component/process/realWorldExample/neo-config.json +6 -0
  14. package/examples/component/toast/MainContainer.mjs +9 -6
  15. package/examples/component/toast/MainContainerController.mjs +5 -5
  16. package/examples/component/toast/neo-config.json +1 -1
  17. package/examples/container/accordion/MainContainer.mjs +123 -0
  18. package/examples/container/accordion/app.mjs +6 -0
  19. package/examples/container/accordion/index.html +11 -0
  20. package/examples/container/accordion/neo-config.json +6 -0
  21. package/package.json +1 -1
  22. package/resources/scss/src/component/Process.scss +2 -4
  23. package/resources/scss/src/container/Accordion.scss +25 -0
  24. package/resources/scss/src/container/AccordionItem.scss +83 -0
  25. package/resources/scss/src/form/field/CheckBox.scss +1 -0
  26. package/resources/scss/src/form/field/Range.scss +1 -0
  27. package/resources/scss/theme-dark/component/Process.scss +8 -8
  28. package/resources/scss/theme-dark/container/Accordion.scss +13 -0
  29. package/resources/scss/theme-dark/container/AccordionItem.scss +23 -0
  30. package/resources/scss/theme-light/component/Process.scss +7 -7
  31. package/resources/scss/theme-light/container/Accordion.scss +13 -0
  32. package/resources/scss/theme-light/container/AccordionItem.scss +23 -0
  33. package/src/DefaultConfig.mjs +2 -2
  34. package/src/component/Process.mjs +11 -7
  35. package/src/component/Splitter.mjs +5 -4
  36. package/src/component/Toast.mjs +2 -1
  37. package/src/container/Accordion.mjs +130 -0
  38. package/src/container/AccordionItem.mjs +178 -0
  39. package/src/form/Container.mjs +42 -25
  40. package/src/form/field/CheckBox.mjs +7 -2
  41. package/src/form/field/Number.mjs +49 -37
  42. package/src/form/field/Range.mjs +31 -4
  43. package/src/form/field/Text.mjs +6 -1
  44. package/src/manager/Toast.mjs +5 -1
@@ -0,0 +1,123 @@
1
+ import ConfigurationViewport from '../../ConfigurationViewport.mjs';
2
+ import Accordion from '../../../src/container/Accordion.mjs';
3
+ import Container from '../../../src/container/Base.mjs';
4
+
5
+ /**
6
+ * @class Neo.examples.button.base.MainContainer
7
+ * @extends Neo.examples.ConfigurationViewport
8
+ */
9
+ class MainContainer extends ConfigurationViewport {
10
+ static config = {
11
+ className : 'Neo.examples.button.base.MainContainer',
12
+ configItemLabelWidth: 160,
13
+ configItemWidth : 280,
14
+ layout : {ntype: 'hbox', align: 'stretch'}
15
+ }
16
+
17
+ createConfigurationComponents() {
18
+ let me = this;
19
+
20
+ return [{
21
+ ntype: 'component',
22
+ html : '<u><b>TOP ACCORDION</b></u>',
23
+ style: {marginTop: '10px'},
24
+ }, {
25
+ ntype: 'component',
26
+ html : '<b>maxExpandedItems:</b> 2',
27
+ style: {marginTop: '10px'},
28
+ }, {
29
+ ntype: 'component',
30
+ html : '<b>initialOpen:</b> [0, 1]',
31
+ style: {marginTop: '10px'},
32
+ }, {
33
+ ntype: 'component',
34
+ html : '<u><b>BOTTOM ACCORDION</b></u>',
35
+ style: {marginTop: '10px'},
36
+ }, {
37
+ ntype: 'component',
38
+ html : '<b>maxExpandedItems:</b> 1',
39
+ style: {marginTop: '10px'},
40
+ }, {
41
+ ntype: 'component',
42
+ html : '<b>initialOpen:</b> [0]',
43
+ style: {marginTop: '10px'},
44
+ }];
45
+ }
46
+
47
+ createExampleComponent() {
48
+ return Neo.create({
49
+ module: Container,
50
+ items : [{
51
+ module: Accordion,
52
+
53
+ title : 'TOP',
54
+ maxExpandedItems: 2,
55
+ initialOpen : [0, 1],
56
+
57
+ height: 550,
58
+ style : {
59
+ backgroundColor: 'grey',
60
+ padding : '15px'
61
+ },
62
+
63
+ items: [{
64
+ iconCls: 'fa fa-dice-one',
65
+ title : 'First Headerbar',
66
+ items : [{
67
+ ntype: 'component',
68
+ html : 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.'
69
+ }]
70
+ }, {
71
+ iconCls: 'fa-dice-two',
72
+ title : 'Second Headerbar',
73
+ items : [{
74
+ html: 'Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.'
75
+ }]
76
+ }, {
77
+ iconCls: 'fa-dice-three',
78
+ title : 'Third Headerbar',
79
+ items : [{
80
+ html: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.'
81
+ }]
82
+ }]
83
+ }, {
84
+ module: Accordion,
85
+
86
+ title : 'bottom',
87
+ maxExpandedItems: 1,
88
+ initialOpen : [0],
89
+
90
+ height: 550,
91
+ style : {
92
+ backgroundColor: 'darkgrey',
93
+ padding : '15px'
94
+ },
95
+
96
+ items: [{
97
+ iconCls: 'fa fa-1',
98
+ title : 'Define Content',
99
+ items : [{
100
+ ntype: 'component',
101
+ html : 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.'
102
+ }]
103
+ }, {
104
+ iconCls: 'fa-2',
105
+ title : 'Mark Best Fit',
106
+ items : [{
107
+ html: 'Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.'
108
+ }]
109
+ }, {
110
+ iconCls: 'fa-3',
111
+ title : 'Create Invoice',
112
+ items : [{
113
+ html: 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.'
114
+ }]
115
+ }]
116
+ }]
117
+ });
118
+ }
119
+ }
120
+
121
+ Neo.applyClassConfig(MainContainer);
122
+
123
+ export default MainContainer;
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.container.accordion'
6
+ });
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta charset="UTF-8">
6
+ <title>Neo Accordion</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ {
2
+ "appPath": "examples/container/accordion/app.mjs",
3
+ "basePath": "../../../",
4
+ "environment": "development",
5
+ "mainPath": "./Main.mjs"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.10.2",
3
+ "version": "5.10.4",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,14 +1,12 @@
1
1
  .neo-process {
2
- // will be set by the component if changes
3
- --process-arrow-color: v(process-arrow-color);
4
- --process-icon-color: v(process-icon-color);
5
-
6
2
  display: flex;
3
+ flex-wrap: wrap;
7
4
  background-color: v(process-background-color);
8
5
  padding: 0.5rem;
9
6
 
10
7
  .process-step {
11
8
  position: relative;
9
+ flex: 1;
12
10
  z-index: 0;
13
11
  padding: 0.75rem;
14
12
 
@@ -0,0 +1,25 @@
1
+ .neo-accordion {
2
+
3
+ & > div:not(.neo-accordion-item, .neo-accordion-title) {
4
+ background-color: transparent;
5
+ overflow: unset;
6
+
7
+ }
8
+
9
+ .neo-accordion-title {
10
+ background-color: v(accordion-title-bg-color);
11
+ margin-bottom: 15px;
12
+ padding: 5px;
13
+ border-radius: v(accordion-item-radius);
14
+ color: v(accordion-title-color);
15
+
16
+ label {
17
+ text-transform: uppercase;
18
+ font-weight: 600;
19
+ font-size: 1.1rem;
20
+ text-align: center;
21
+ width: 100%;
22
+ }
23
+ }
24
+ }
25
+
@@ -0,0 +1,83 @@
1
+ .neo-accordion-item {
2
+ box-shadow: v(accordion-item-shadow);
3
+ background-color: v(accordion-item-bg-color);
4
+ border: 1px solid v(accordion-item-border-color);
5
+ border-radius: v(accordion-item-radius);
6
+
7
+ transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
8
+ max-height: v(accordion-item-header-height);
9
+
10
+ overflow: hidden;
11
+
12
+ &:not(:first-child) {
13
+ margin-top: 15px;
14
+ }
15
+
16
+ & > div {
17
+ background-color: transparent;
18
+ }
19
+
20
+ &.neo-expanded {
21
+ max-height: 1000px;
22
+ transition: max-height 1s ease-in-out;
23
+
24
+ .neo-toolbar {
25
+ border-bottom-color: v(accordion-item-border-color);
26
+
27
+ .neo-accordion-header-arrow::before {
28
+ transform: rotate(0deg);
29
+ }
30
+ }
31
+ }
32
+
33
+ &.neo-scrollable {
34
+ .neo-accordion-content {
35
+ overflow: auto;
36
+ }
37
+ }
38
+
39
+ .neo-toolbar {
40
+ max-height: v(accordion-item-header-height);
41
+ min-height: v(accordion-item-header-height);
42
+ border-bottom: 1px solid transparent;
43
+
44
+ .neo-accordion-header-icon {
45
+ &::before {
46
+ margin: 0 15px 0 10px;
47
+ }
48
+
49
+ &.no-icon {
50
+ margin-left: 10px;
51
+ }
52
+ }
53
+
54
+ .neo-accordion-header-title {
55
+ flex: 1 !important;
56
+ font-weight: 600;
57
+ }
58
+
59
+ .neo-accordion-header-arrow {
60
+ background-color: v(accordion-item-arrow-bg-color);
61
+ height: 30px;
62
+ width: 30px;
63
+ border-radius: v(accordion-item-radius);
64
+ box-shadow: v(accordion-item-arrow-shadow);
65
+ padding: 7px;
66
+ text-align: center;
67
+
68
+
69
+ &::before {
70
+ display: inline-block;
71
+ transform: rotate(-180deg);
72
+ transition: transform .5s ease-out;
73
+ }
74
+ }
75
+ }
76
+
77
+ .neo-accordion-content {
78
+ background-color: v(accordion-item-content-bg-color);
79
+ border-bottom-left-radius: v(accordion-item-radius);
80
+ border-bottom-right-radius: v(accordion-item-radius);
81
+ padding: 15px;
82
+ }
83
+ }
@@ -1,5 +1,6 @@
1
1
  .neo-checkboxfield {
2
2
  .neo-checkbox-input {
3
+ margin: 0;
3
4
  width: 0; // using display: none would break the keynav
4
5
 
5
6
  &:checked {
@@ -1,6 +1,7 @@
1
1
  .neo-rangefield {
2
2
  .neo-rangefield-input {
3
3
  margin-top: 12px;
4
+ flex:1;
4
5
  }
5
6
 
6
7
  input[type=range] {
@@ -1,11 +1,11 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'process-arrow-color' : #ffdb4a,
3
- 'process-background-color': #fff,
4
- 'process-icon-color' : steelblue,
5
- 'process-icon-size' : 2rem,
6
- 'process-shadow-color' : rgba(0, 0, 0, .5),
7
- 'process-title-color' : #363636,
8
- 'process-text-color' : #444444
2
+ 'process-arrow-color' : #6d5f28,
3
+ 'process-background-color': #2b2b2b,
4
+ 'process-icon-color' : #a3996f,
5
+ 'process-icon-size' : 2rem,
6
+ 'process-shadow-color' : rgba(0, 0, 0, .5),
7
+ 'process-text-color' : #bbb,
8
+ 'process-title-color' : #ccc
9
9
  ));
10
10
 
11
11
  @if $useCssVars == true {
@@ -15,7 +15,7 @@ $neoMap: map-merge($neoMap, (
15
15
  --process-icon-color : #{neo(process-icon-color)};
16
16
  --process-icon-size : #{neo(process-icon-size)};
17
17
  --process-shadow-color : #{neo(process-shadow-color)};
18
- --process-title-color : #{neo(process-title-color)};
19
18
  --process-text-color : #{neo(process-text-color)};
19
+ --process-title-color : #{neo(process-title-color)};
20
20
  }
21
21
  }
@@ -0,0 +1,13 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'accordion-title-bg-color': #292929,
3
+ 'accordion-title-color' : #ccc,
4
+ 'accordion-item-radius' : 5px
5
+ ));
6
+
7
+ @if $useCssVars == true {
8
+ :root .neo-theme-dark { // .neo-accordion
9
+ --accordion-title-bg-color: #{neo(accordion-title-bg-color)};
10
+ --accordion-title-color: #{neo(accordion-title-color)};
11
+ --accordion-item-radius: #{neo(accordion-item-radius)};
12
+ }
13
+ }
@@ -0,0 +1,23 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'accordion-item-bg-color' : #212121,
3
+ 'accordion-item-content-bg-color': #050505,
4
+ 'accordion-item-arrow-bg-color' : #323232,
5
+ 'accordion-item-border-color' : #333,
6
+ 'accordion-item-shadow' : 0 4px 8px rgba(0 0 0 / .5),
7
+ 'accordion-item-arrow-shadow' : 0 4px 16px rgba(0 0 0 / .15),
8
+ 'accordion-item-radius' : 5px,
9
+ 'accordion-item-header-height' : 50px
10
+ ));
11
+
12
+ @if $useCssVars == true {
13
+ :root .neo-theme-dark { // .neo-accordion-item
14
+ --accordion-item-bg-color : #{neo(accordion-item-bg-color)};
15
+ --accordion-item-content-bg-color: #{neo(accordion-item-content-bg-color)};
16
+ --accordion-item-arrow-bg-color : #{neo(accordion-item-arrow-bg-color)};
17
+ --accordion-item-border-color : #{neo(accordion-item-border-color)};
18
+ --accordion-item-shadow : #{neo(accordion-item-shadow)};
19
+ --accordion-item-arrrow-shadow : #{neo(accordion-item-arrow-shadow)};
20
+ --accordion-item-radius : #{neo(accordion-item-radius)};
21
+ --accordion-item-header-height : #{neo(accordion-item-header-height)};
22
+ }
23
+ }
@@ -1,11 +1,11 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'process-arrow-color' : #ffdb4a,
3
- 'process-background-color': #fff,
4
- 'process-icon-color' : steelblue,
5
- 'process-icon-size' : 2rem,
6
- 'process-shadow-color' : rgba(0, 0, 0, .5),
7
- 'process-title-color' : #363636,
8
- 'process-text-color' : #444444
2
+ 'process-arrow-color' : #6d5f28,
3
+ 'process-background-color': #fff,
4
+ 'process-icon-color' : #a3996f,
5
+ 'process-icon-size' : 2rem,
6
+ 'process-shadow-color' : rgba(0, 0, 0, .5),
7
+ 'process-title-color' : #363636,
8
+ 'process-text-color' : #444444
9
9
  ));
10
10
 
11
11
  @if $useCssVars == true {
@@ -0,0 +1,13 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'accordion-title-bg-color': #292929,
3
+ 'accordion-title-color' : #fff,
4
+ 'accordion-item-radius' : 5px
5
+ ));
6
+
7
+ @if $useCssVars == true {
8
+ :root .neo-theme-light { // .neo-accordion
9
+ --accordion-title-bg-color: #{neo(accordion-title-bg-color)};
10
+ --accordion-title-color: #{neo(accordion-title-color)};
11
+ --accordion-item-radius: #{neo(accordion-item-radius)};
12
+ }
13
+ }
@@ -0,0 +1,23 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'accordion-item-bg-color' : #f9f9f9,
3
+ 'accordion-item-content-bg-color': #ffffff,
4
+ 'accordion-item-arrow-bg-color' : #dedede,
5
+ 'accordion-item-border-color' : #ddd,
6
+ 'accordion-item-shadow' : 0 4px 16px rgba(0 0 0 / .1),
7
+ 'accordion-item-arrow-shadow' : 0 4px 16px rgba(0 0 0 / .1),
8
+ 'accordion-item-radius' : 5px,
9
+ 'accordion-item-header-height' : 50px
10
+ ));
11
+
12
+ @if $useCssVars == true {
13
+ :root .neo-theme-light { // .neo-accordion-item
14
+ --accordion-item-bg-color : #{neo(accordion-item-bg-color)};
15
+ --accordion-item-content-bg-color: #{neo(accordion-item-content-bg-color)};
16
+ --accordion-item-arrow-bg-color : #{neo(accordion-item-arrow-bg-color)};
17
+ --accordion-item-border-color : #{neo(accordion-item-border-color)};
18
+ --accordion-item-shadow : #{neo(accordion-item-shadow)};
19
+ --accordion-item-arrow-shadow : #{neo(accordion-item-arrow-shadow)};
20
+ --accordion-item-radius : #{neo(accordion-item-radius)};
21
+ --accordion-item-header-height : #{neo(accordion-item-header-height)};
22
+ }
23
+ }
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '5.10.2'
239
+ * @default '5.10.3'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '5.10.2'
244
+ version: '5.10.3'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -114,10 +114,11 @@ class Process extends Base {
114
114
  * @protected
115
115
  */
116
116
  afterSetArrowColor(newValue) {
117
- let style = this.style;
117
+ if (newValue === null) return;
118
118
 
119
- style['--process-arrow-color'] = newValue;
119
+ let style = this.style;
120
120
 
121
+ style['--process-arrow-color'] = newValue + '!important';
121
122
  this.style = style;
122
123
  }
123
124
 
@@ -127,10 +128,12 @@ class Process extends Base {
127
128
  * @protected
128
129
  */
129
130
  afterSetHorizontal(isHorizontal) {
130
- let cls = this.cls,
131
- positionCls = isHorizontal ? 'neo-process-horizontal' : 'neo-process-vertical';
131
+ let cls = this.cls,
132
+ positionCls = isHorizontal ? 'neo-process-horizontal' : 'neo-process-vertical',
133
+ removeCls = !isHorizontal ? 'neo-process-horizontal' : 'neo-process-vertical';
132
134
 
133
135
  NeoArray.add(cls, positionCls);
136
+ NeoArray.remove(cls, removeCls);
134
137
 
135
138
  this.cls = cls;
136
139
  }
@@ -141,9 +144,10 @@ class Process extends Base {
141
144
  * @protected
142
145
  */
143
146
  afterSetIconColor(newValue) {
147
+ if (newValue === null) return;
144
148
  let style = this.style;
145
149
 
146
- style['--process-icon-color'] = newValue;
150
+ style['--process-icon-color'] = newValue + '!important';
147
151
 
148
152
  this.style = style;
149
153
  }
@@ -159,7 +163,7 @@ class Process extends Base {
159
163
  items = [items];
160
164
  }
161
165
 
162
- let vdomRoot = this.vdom,
166
+ let vdomRoot = this.vdom,
163
167
  itemLayout = this.itemLayout;
164
168
 
165
169
  items.forEach((newItem) => {
@@ -167,7 +171,7 @@ class Process extends Base {
167
171
  content = curItem.cn[3];
168
172
 
169
173
  content.cn[0].cls.push(newItem.iconCls);
170
- content.cn[1].innerHTML = newItem.header;
174
+ content.cn[1].innerHTML = newItem.title;
171
175
  content.cn[2].innerHTML = newItem.text;
172
176
 
173
177
  NeoArray.add(vdomRoot.cn, curItem);
@@ -136,16 +136,17 @@ class Splitter extends Component {
136
136
  }
137
137
 
138
138
  /**
139
- * @param data
139
+ * @param {Object} data
140
140
  */
141
141
  onDragEnd(data) {
142
142
  let me = this,
143
143
  style = me.style || {},
144
+ parentId = me.parentId,
144
145
  resizeNext = me.resizeTarget === 'next',
145
146
  size = me.size,
146
147
  index, newSize, sibling, parent;
147
148
 
148
- Neo.getComponent(me.parentId).disabled = false;
149
+ Neo.getComponent(parentId).disabled = false;
149
150
 
150
151
  me.dragZone.dragEnd(data);
151
152
 
@@ -153,8 +154,8 @@ class Splitter extends Component {
153
154
 
154
155
  me.style = style;
155
156
 
156
- me.getDomRect(me.parentId).then(parentRect => {
157
- parent = Neo.getComponent(me.parentId);
157
+ me.getDomRect(parentId).then(parentRect => {
158
+ parent = Neo.getComponent(parentId);
158
159
  index = parent.indexOf(me);
159
160
  sibling = parent.items[resizeNext ? index + 1 :index - 1];
160
161
  style = sibling.style || {};
@@ -245,12 +245,13 @@ class Toast extends Base {
245
245
  */
246
246
  async destroy(...args) {
247
247
  let me = this;
248
+ const superDestroy = super.destroy.bind(me);
248
249
 
249
250
  me.addDomListeners({
250
251
  animationend: function () {
251
252
  ToastManager.removeToast(me.id);
252
253
  ToastManager.unregister(me);
253
- me.destroy(true);
254
+ superDestroy(...args);
254
255
  }
255
256
  });
256
257