neo.mjs 6.9.7 → 6.9.9

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 (90) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/apps/learnneo/index.html +5 -0
  3. package/apps/learnneo/neo-config.json +6 -6
  4. package/apps/learnneo/view/home/ContentTreeList.mjs +14 -5
  5. package/apps/learnneo/view/home/MainContainerController.mjs +22 -3
  6. package/docs/app/view/MainContainerController.mjs +12 -0
  7. package/examples/ServiceWorker.mjs +2 -2
  8. package/examples/button/base/neo-config.json +2 -1
  9. package/package.json +2 -2
  10. package/resources/data/learnneo/p/2023-10-01T18-29-19-158Z.md +7 -1
  11. package/resources/data/learnneo/p/2023-10-07T19-18-28-517Z.md +23 -15
  12. package/resources/data/learnneo/p/2023-10-14T19-25-08-153Z.md +15 -12
  13. package/resources/images/Neo_Vector.svg +3 -0
  14. package/resources/scss/src/apps/learnneo/Viewport.scss +53 -4
  15. package/resources/scss/src/apps/newwebsite/MainContainer.css +33 -0
  16. package/resources/scss/theme-neo-light/Global.scss +7 -0
  17. package/resources/scss/theme-neo-light/apps/covid/HeaderContainer.scss +10 -0
  18. package/resources/scss/theme-neo-light/apps/covid/country/Gallery.scss +7 -0
  19. package/resources/scss/theme-neo-light/apps/covid/country/Helix.scss +8 -0
  20. package/resources/scss/theme-neo-light/apps/covid/country/LineChartComponent.scss +3 -0
  21. package/resources/scss/theme-neo-light/apps/docs/ContentTabContainer.scss +4 -0
  22. package/resources/scss/theme-neo-light/apps/docs/HeaderContainer.scss +10 -0
  23. package/resources/scss/theme-neo-light/apps/docs/MainContainer.scss +3 -0
  24. package/resources/scss/theme-neo-light/apps/docs/classdetails/HeaderComponent.scss +4 -0
  25. package/resources/scss/theme-neo-light/apps/docs/classdetails/MembersList.scss +17 -0
  26. package/resources/scss/theme-neo-light/apps/docs/classdetails/TutorialComponent.scss +4 -0
  27. package/resources/scss/theme-neo-light/apps/website/HeaderContainer.scss +5 -0
  28. package/resources/scss/theme-neo-light/apps/website/MainContainer.scss +4 -0
  29. package/resources/scss/theme-neo-light/apps/website/blog/Container.scss +3 -0
  30. package/resources/scss/theme-neo-light/apps/website/home/TabContainer.scss +4 -0
  31. package/resources/scss/theme-neo-light/button/Base.scss +117 -0
  32. package/resources/scss/theme-neo-light/calendar/view/EditEventContainer.scss +5 -0
  33. package/resources/scss/theme-neo-light/calendar/view/MainContainer.scss +23 -0
  34. package/resources/scss/theme-neo-light/calendar/view/SettingsContainer.scss +3 -0
  35. package/resources/scss/theme-neo-light/calendar/view/YearComponent.scss +10 -0
  36. package/resources/scss/theme-neo-light/calendar/view/calendars/EditContainer.scss +5 -0
  37. package/resources/scss/theme-neo-light/calendar/view/calendars/List.scss +3 -0
  38. package/resources/scss/theme-neo-light/calendar/view/month/Component.scss +10 -0
  39. package/resources/scss/theme-neo-light/calendar/view/week/Component.scss +13 -0
  40. package/resources/scss/theme-neo-light/component/Base.scss +6 -0
  41. package/resources/scss/theme-neo-light/component/BoxLabel.scss +5 -0
  42. package/resources/scss/theme-neo-light/component/Chip.scss +14 -0
  43. package/resources/scss/theme-neo-light/component/DateSelector.scss +24 -0
  44. package/resources/scss/theme-neo-light/component/Process.scss +9 -0
  45. package/resources/scss/theme-neo-light/component/Progress.scss +3 -0
  46. package/resources/scss/theme-neo-light/component/Splitter.scss +5 -0
  47. package/resources/scss/theme-neo-light/component/StatusBadge.scss +19 -0
  48. package/resources/scss/theme-neo-light/component/Timer.scss +6 -0
  49. package/resources/scss/theme-neo-light/component/Toast.scss +9 -0
  50. package/resources/scss/theme-neo-light/component/Video.scss +4 -0
  51. package/resources/scss/theme-neo-light/container/Accordion.scss +5 -0
  52. package/resources/scss/theme-neo-light/container/AccordionItem.scss +10 -0
  53. package/resources/scss/theme-neo-light/container/Base.scss +4 -0
  54. package/resources/scss/theme-neo-light/container/Panel.scss +5 -0
  55. package/resources/scss/theme-neo-light/container/Viewport.scss +3 -0
  56. package/resources/scss/theme-neo-light/design-tokens/Components.scss +3 -0
  57. package/resources/scss/theme-neo-light/dialog/Base.scss +5 -0
  58. package/resources/scss/theme-neo-light/examples/ConfigurationPanel.scss +3 -0
  59. package/resources/scss/theme-neo-light/examples/calendar/basic/MainContainer.scss +4 -0
  60. package/resources/scss/theme-neo-light/form/Fieldset.scss +6 -0
  61. package/resources/scss/theme-neo-light/form/field/CheckBox.scss +8 -0
  62. package/resources/scss/theme-neo-light/form/field/FileUpload.scss +12 -0
  63. package/resources/scss/theme-neo-light/form/field/Picker.scss +5 -0
  64. package/resources/scss/theme-neo-light/form/field/Range.scss +4 -0
  65. package/resources/scss/theme-neo-light/form/field/Search.scss +3 -0
  66. package/resources/scss/theme-neo-light/form/field/Select.scss +9 -0
  67. package/resources/scss/theme-neo-light/form/field/Switch.scss +17 -0
  68. package/resources/scss/theme-neo-light/form/field/Text.scss +32 -0
  69. package/resources/scss/theme-neo-light/form/field/trigger/Base.scss +6 -0
  70. package/resources/scss/theme-neo-light/form/field/trigger/Time.scss +4 -0
  71. package/resources/scss/theme-neo-light/grid/Container.scss +7 -0
  72. package/resources/scss/theme-neo-light/grid/View.scss +13 -0
  73. package/resources/scss/theme-neo-light/grid/header/Button.scss +6 -0
  74. package/resources/scss/theme-neo-light/list/Base.scss +12 -0
  75. package/resources/scss/theme-neo-light/menu/List.scss +21 -0
  76. package/resources/scss/theme-neo-light/menu/Panel.scss +3 -0
  77. package/resources/scss/theme-neo-light/tab/Container.scss +3 -0
  78. package/resources/scss/theme-neo-light/tab/Strip.scss +5 -0
  79. package/resources/scss/theme-neo-light/tab/header/Button.scss +30 -0
  80. package/resources/scss/theme-neo-light/table/Container.scss +10 -0
  81. package/resources/scss/theme-neo-light/table/View.scss +13 -0
  82. package/resources/scss/theme-neo-light/table/header/Button.scss +7 -0
  83. package/resources/scss/theme-neo-light/toolbar/Base.scss +4 -0
  84. package/resources/scss/theme-neo-light/tree/List.scss +4 -0
  85. package/src/DefaultConfig.mjs +2 -2
  86. package/src/form/field/FileUpload.mjs +10 -8
  87. package/src/form/field/Text.mjs +30 -2
  88. package/src/main/addon/HighlightJS.mjs +29 -16
  89. package/src/util/String.mjs +5 -3
  90. package/src/vdom/Helper.mjs +2 -1
@@ -0,0 +1,10 @@
1
+ :root .neo-theme-neo-light { // .neo-table-container
2
+ --table-container-border-color : #ddd;
3
+ --table-container-cell-background-color : #fff;
4
+ --table-container-cell-background-color-even: #f2f2f2;
5
+ --table-container-cell-border-bottom : 1px solid #ddd;
6
+ --table-container-cell-height : 32px;
7
+ --table-container-cell-padding : 2px 10px 2px;
8
+ --table-container-color : #666;
9
+ --table-container-header-cell-border-bottom : 1px solid #ddd;
10
+ }
@@ -0,0 +1,13 @@
1
+ :root .neo-theme-neo-light { // .neo-table-view
2
+ --table-cell-background-color-hover : #{lighten(#33343d, 70%)};
3
+ --table-cellmodel-selected-cell-background-color : #{lighten(#64B5F6, 22%)};
4
+ --table-cellmodel-selected-cell-color : #2b2b2b;
5
+ --table-cellmodel-selected-column-cell-background-color: #{lighten(#4f558a, 52%)};
6
+ --table-cellmodel-selected-column-cell-color : #2b2b2b;
7
+ --table-cellrowmodel-selected-cell-background-color : #{lighten(#64B5F6, 22%)};
8
+ --table-cellrowmodel-selected-cell-color : #2b2b2b;
9
+ --table-cellrowmodel-selected-row-cell-background-color: #{lighten(#4f558a, 52%)};
10
+ --table-cellrowmodel-selected-row-cell-color : #2b2b2b;
11
+ --table-rowmodel-selected-cell-background-color : #{lighten(#64B5F6, 22%)};
12
+ --table-rowmodel-selected-cell-color : #2b2b2b;
13
+ }
@@ -0,0 +1,7 @@
1
+ :root .neo-theme-neo-light { // .neo-table-header-button
2
+ --table-header-button-background-color : #5d83a7;
3
+ --table-header-button-background-image : none;
4
+ --table-header-button-color : #fff;
5
+ --table-header-button-glyph-color : #fff;
6
+ --table-header-button-ripple-background-color: #{darken(#5d83a7, 10%)};
7
+ }
@@ -0,0 +1,4 @@
1
+ :root .neo-theme-neo-light { // .neo-toolbar
2
+ --toolbar-background-color: #fff;
3
+ --toolbar-padding : 5px;
4
+ }
@@ -0,0 +1,4 @@
1
+ :root .neo-theme-neo-light { // .neo-tree-list
2
+ --tree-list-color : #666;
3
+ --tree-list-menu-item-color: #1c60a0;
4
+ }
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '6.9.7'
239
+ * @default '6.9.9'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '6.9.7'
244
+ version: '6.9.9'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {
@@ -1,5 +1,6 @@
1
- import Base from '../../form/field/Base.mjs';
2
- import NeoArray from '../../util/Array.mjs';
1
+ import Base from '../../form/field/Base.mjs';
2
+ import NeoArray from '../../util/Array.mjs';
3
+ import StringUtil from '../../util/String.mjs';
3
4
 
4
5
  const
5
6
  sizeRE = /^(\d+)(kb|mb|gb)?$/i,
@@ -404,15 +405,16 @@ class FileUpload extends Base {
404
405
  const
405
406
  file = files.item(0),
406
407
  pointPos = file.name.lastIndexOf('.'),
407
- type = pointPos > -1 ? file.name.slice(pointPos + 1) : '';
408
+ type = pointPos > -1 ? file.name.slice(pointPos + 1) : '',
409
+ escapedFileName = StringUtil.escapeHtml(file.name);
408
410
 
409
411
  if (me.types && !types[type]) {
410
- body.cn[0].innerHTML = file.name;
412
+ body.cn[0].innerHTML = escapedFileName;
411
413
  body.cn[1].innerHTML = `${me.invalidFileFormat} (.${type}) ${me.formatSize(file.size)}`;
412
414
  me.error = me.pleaseUseTheseTypes?.replace('{allowedFileTypes}', Object.keys(types).join(' .'))
413
415
  }
414
416
  else if (file.size > me.maxSize) {
415
- body.cn[0].innerHTML = file.name;
417
+ body.cn[0].innerHTML = escapedFileName;
416
418
  body.cn[1].innerHTML = me.formatSize(file.size);
417
419
  me.error = me.fileSizeMoreThan?.replace('{allowedFileSize}', String(me._maxSize).toUpperCase());
418
420
  }
@@ -444,8 +446,8 @@ class FileUpload extends Base {
444
446
  // We have to wait for the DOM to have changed, and the action button to be visible
445
447
  await new Promise(resolve => setTimeout(resolve, 100));
446
448
  me.focus(me.vdom.cn[2].id);
447
-
448
- me.vdom.cn[1].cn[0].innerHTML = file.name;
449
+
450
+ me.vdom.cn[1].cn[0].innerHTML = StringUtil.escapeHtml(file.name);
449
451
  me.update();
450
452
  me.state = 'uploading';
451
453
 
@@ -669,7 +671,7 @@ class FileUpload extends Base {
669
671
 
670
672
  me.documentId = document.id;
671
673
  me.fileSize = me.formatSize(document.size);
672
- me.vdom.cn[1].cn[0].innerHTML = document.fileName;
674
+ me.vdom.cn[1].cn[0].innerHTML = StringUtil.escapeHtml(document.fileName);
673
675
  me.state = me.documentStatusMap[document.status];
674
676
  }
675
677
  }
@@ -2,6 +2,7 @@ import Base from './Base.mjs';
2
2
  import BaseTrigger from './trigger/Base.mjs';
3
3
  import ClearTrigger from './trigger/Clear.mjs';
4
4
  import NeoArray from '../../util/Array.mjs';
5
+ import StringUtil from '../../util/String.mjs';
5
6
  import VDomUtil from '../../util/VDom.mjs';
6
7
  import VNodeUtil from '../../util/VNode.mjs';
7
8
 
@@ -234,6 +235,14 @@ class Text extends Base {
234
235
  * @member {Function|String|null} validator=null
235
236
  */
236
237
  validator: null,
238
+ /**
239
+ * getVlue can be xssProtected and values are escaped
240
+ * @member {Boolean} xssProtected=false
241
+ */
242
+ xssProtected_: false,
243
+ /**
244
+ * @member {Object} _vdom
245
+ */
237
246
  /**
238
247
  * @member {Object} _vdom
239
248
  */
@@ -1144,6 +1153,17 @@ class Text extends Base {
1144
1153
  return this.id + '-trigger-' + type
1145
1154
  }
1146
1155
 
1156
+ /**
1157
+ * @returns {*}
1158
+ */
1159
+ getValue() {
1160
+ if (this.xssProtected) {
1161
+ return StringUtil.escapeHtml(super.getValue())
1162
+ } else {
1163
+ return super.getValue()
1164
+ }
1165
+ }
1166
+
1147
1167
  /**
1148
1168
  * @returns {Boolean}
1149
1169
  */
@@ -1269,10 +1289,14 @@ class Text extends Base {
1269
1289
  if (centerBorderEl && me.isEmpty()) {
1270
1290
  delete centerBorderEl.width;
1271
1291
  }
1292
+ }
1272
1293
 
1273
- me.update()
1294
+ if (Neo.isString(me.value)) {
1295
+ me.value = me.value.trim()
1274
1296
  }
1275
1297
 
1298
+ me.update();
1299
+
1276
1300
  super.onFocusLeave(data)
1277
1301
  }
1278
1302
 
@@ -1288,7 +1312,11 @@ class Text extends Base {
1288
1312
 
1289
1313
  if (vnode) {
1290
1314
  // required for validation -> revert a wrong user input
1291
- vnode.vnode.attributes.value = value;
1315
+ vnode.vnode.attributes.value = value
1316
+ }
1317
+
1318
+ if (Neo.isString(value)) {
1319
+ value = value.trim()
1292
1320
  }
1293
1321
 
1294
1322
  me.clean = false;
@@ -32,6 +32,7 @@ class HighlightJS extends Base {
32
32
  */
33
33
  remote: {
34
34
  app: [
35
+ 'loadLibrary',
35
36
  'scrollIntoView',
36
37
  'syntaxHighlight',
37
38
  'switchTheme',
@@ -56,14 +57,26 @@ class HighlightJS extends Base {
56
57
  */
57
58
  construct(config) {
58
59
  super.construct(config);
60
+ }
61
+
62
+ /**
63
+ * @param {Object} data
64
+ * @returns {Boolean}
65
+ */
66
+ async loadLibrary(data) {
67
+ delete data.appName;
59
68
 
60
69
  let me = this;
61
70
 
62
- DomAccess.loadScript(me.highlightJsPath).then(() => {
71
+ me.set(data);
72
+
73
+ await DomAccess.loadScript(me.highlightJsPath).then(() => {
63
74
  DomAccess.addScript({src: me.highlightJsLineNumbersPath});
64
75
  });
65
76
 
66
77
  Stylesheet.createStyleSheet(null, 'hljs-theme', me.themePath)
78
+
79
+ return true
67
80
  }
68
81
 
69
82
  /**
@@ -83,21 +96,6 @@ class HighlightJS extends Base {
83
96
  })
84
97
  }
85
98
 
86
- /**
87
- * @param {Object} data
88
- * @param {String} data.vnodeId
89
- */
90
- syntaxHighlight(data) {
91
- if (hljs) {
92
- let node = document.getElementById(data.vnodeId);
93
-
94
- hljs.highlightBlock(node);
95
- hljs.lineNumbersBlock(node);
96
- } else {
97
- console.error('highlight.js is not included inside the main thread.')
98
- }
99
- }
100
-
101
99
  /**
102
100
  * You can pass in 'light', 'dark', or a path for a custom theme
103
101
  * @param {String} theme
@@ -114,6 +112,21 @@ class HighlightJS extends Base {
114
112
  Stylesheet.createStyleSheet(null, 'hljs-theme', switchToTheme);
115
113
  }
116
114
 
115
+ /**
116
+ * @param {Object} data
117
+ * @param {String} data.vnodeId
118
+ */
119
+ syntaxHighlight(data) {
120
+ if (hljs) {
121
+ let node = document.getElementById(data.vnodeId);
122
+
123
+ hljs.highlightBlock(node);
124
+ hljs.lineNumbersBlock(node);
125
+ } else {
126
+ console.error('highlight.js is not included inside the main thread.')
127
+ }
128
+ }
129
+
117
130
  /**
118
131
  * @param {Object} data
119
132
  */
@@ -14,18 +14,20 @@ class StringUtil extends Base {
14
14
  '<' : '&lt;',
15
15
  '>' : '&gt;',
16
16
  '"' : '&quot;',
17
- '\'': '&#039;'
17
+ '\'': '&apos;',
18
+ '$' : '&dollar;',
19
+ '\\': '&bsol;'
18
20
  }
19
21
  /**
20
22
  * @member {RegExp} charPattern
21
23
  * @static
22
24
  */
23
- static charPattern = /[&<>"']/g
25
+ static charPattern = /[&<>"'$\\]/g
24
26
  /**
25
27
  * @member {RegExp} entityPattern
26
28
  * @static
27
29
  */
28
- static entityPattern = /(&amp;)|(&lt;)|(&gt;)|(&quot;)|(&#039;)/g
30
+ static entityPattern = /(&amp;)|(&lt;)|(&gt;)|(&quot;)|(&apos;)|(&dollar;)|(&bsol;)/g
29
31
 
30
32
  static config = {
31
33
  /**
@@ -580,7 +580,8 @@ class Helper extends Base {
580
580
  string += ` ${key}`;
581
581
  }
582
582
  } else if (key !== 'removeDom') {
583
- string += ` ${key}="${value}"`;
583
+
584
+ string += ` ${key}="${value.replaceAll('"', '&quot;')}"`;
584
585
  }
585
586
  });
586
587