neo.mjs 6.6.0 → 6.6.2
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.
- package/apps/ServiceWorker.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/form/field/FileUpload.scss +1 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +2 -2
- package/src/core/Base.mjs +7 -7
- package/src/form/field/FileUpload.mjs +58 -73
- package/src/main/DomAccess.mjs +8 -1
- package/src/vdom/Helper.mjs +6 -3
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '6.6.
|
239
|
+
* @default '6.6.2'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '6.6.
|
244
|
+
version: '6.6.2'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
package/src/core/Base.mjs
CHANGED
@@ -11,13 +11,6 @@ const configSymbol = Symbol.for('configSymbol'),
|
|
11
11
|
* @class Neo.core.Base
|
12
12
|
*/
|
13
13
|
class Base {
|
14
|
-
/**
|
15
|
-
* Regex to grab the MethodName from an error
|
16
|
-
* which is a second generation function
|
17
|
-
* @member {RegExp} methodNameRegex
|
18
|
-
* @static
|
19
|
-
*/
|
20
|
-
static methodNameRegex = /\n.*\n\s+at\s+.*\.(\w+)\s+.*/
|
21
14
|
/**
|
22
15
|
* You can define methods which should get delayed
|
23
16
|
* @example
|
@@ -32,6 +25,13 @@ class Base {
|
|
32
25
|
* @static
|
33
26
|
*/
|
34
27
|
static delayable = {}
|
28
|
+
/**
|
29
|
+
* Regex to grab the MethodName from an error
|
30
|
+
* which is a second generation function
|
31
|
+
* @member {RegExp} methodNameRegex
|
32
|
+
* @static
|
33
|
+
*/
|
34
|
+
static methodNameRegex = /\n.*\n\s+at\s+.*\.(\w+)\s+.*/
|
35
35
|
/**
|
36
36
|
* True automatically applies the core.Observable mixin
|
37
37
|
* @member {Boolean} observable=false
|
@@ -96,70 +96,55 @@ class FileUpload extends Base {
|
|
96
96
|
* @protected
|
97
97
|
*/
|
98
98
|
baseCls: ['neo-file-upload-field'],
|
99
|
+
/**
|
100
|
+
* @member {String[]} cls=['neo-field-empty']
|
101
|
+
*/
|
102
|
+
cls: ['neo-field-empty'],
|
99
103
|
/**
|
100
104
|
* @member {Object} _vdom
|
101
105
|
*/
|
102
|
-
_vdom:
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
}]
|
115
|
-
},
|
116
|
-
{
|
117
|
-
cls : 'neo-file-upload-action-button',
|
118
|
-
tag : 'button'
|
119
|
-
},
|
120
|
-
{
|
121
|
-
cls : 'neo-file-upload-input',
|
122
|
-
tag : 'input',
|
123
|
-
type : 'file'
|
124
|
-
},
|
125
|
-
{
|
126
|
-
cls : 'neo-file-upload-label',
|
127
|
-
tag : 'label'
|
128
|
-
},
|
129
|
-
{
|
130
|
-
cls : 'neo-file-upload-error-message'
|
131
|
-
}
|
132
|
-
]
|
133
|
-
},
|
134
|
-
|
135
|
-
cls : ['neo-field-empty'],
|
106
|
+
_vdom:
|
107
|
+
{cn: [
|
108
|
+
{tag: 'i', cls: 'neo-file-upload-state-icon'},
|
109
|
+
{cls: 'neo-file-upload-body', cn: [
|
110
|
+
{cls: 'neo-file-upload-filename'},
|
111
|
+
{cls: 'neo-file-upload-state'}
|
112
|
+
]},
|
113
|
+
{tag: 'button', cls: 'neo-file-upload-action-button'},
|
114
|
+
{tag: 'input', cls: 'neo-file-upload-input', type: 'file'},
|
115
|
+
{tag: 'label', cls: 'neo-file-upload-label'},
|
116
|
+
{cls: 'neo-file-upload-error-message'}
|
117
|
+
]},
|
136
118
|
|
137
119
|
/**
|
138
120
|
* An Object containing a default set of headers to be passed to the server on every HTTP request.
|
139
121
|
* @member {Object} headers
|
140
122
|
*/
|
141
|
-
headers_
|
123
|
+
headers_: {},
|
142
124
|
|
143
125
|
/**
|
144
126
|
* An Object which allows the status text returned from the {@link #property-documentStatusUrl} to be
|
145
127
|
* mapped to the corresponding next widget state.
|
146
128
|
* @member {Object} documentStatusMap
|
147
129
|
*/
|
148
|
-
documentStatusMap
|
130
|
+
documentStatusMap: {
|
149
131
|
SCANNING : 'scanning',
|
150
132
|
|
151
133
|
// The server doing its own secondary upload to the final storage location may return this.
|
152
134
|
// We enter the same state as scanning. A spinner shows for the duration of this state
|
153
|
-
UPLOADING
|
135
|
+
UPLOADING : 'scanning',
|
154
136
|
|
155
|
-
MALWARE_DETECTED
|
156
|
-
UN_DOWNLOADABLE
|
157
|
-
AVAILABLE
|
158
|
-
DOWNLOADABLE
|
159
|
-
DELETED
|
137
|
+
MALWARE_DETECTED: 'scan-failed',
|
138
|
+
UN_DOWNLOADABLE : 'not-downloadable',
|
139
|
+
AVAILABLE : 'not-downloadable',
|
140
|
+
DOWNLOADABLE : 'downloadable',
|
141
|
+
DELETED : 'deleted'
|
160
142
|
},
|
161
143
|
|
162
|
-
|
144
|
+
/**
|
145
|
+
* @member {String|null} document_=null
|
146
|
+
*/
|
147
|
+
document_: null,
|
163
148
|
|
164
149
|
/**
|
165
150
|
* If this widget should reference an existing document, configure the widget with a documentId
|
@@ -169,7 +154,7 @@ class FileUpload extends Base {
|
|
169
154
|
* the id returned from the {@link #property-uploadUrl}.
|
170
155
|
* @member {String|Number} documentId
|
171
156
|
*/
|
172
|
-
documentId
|
157
|
+
documentId: null,
|
173
158
|
|
174
159
|
/**
|
175
160
|
* The URL of the file upload service to which the selected file is sent.
|
@@ -188,9 +173,9 @@ class FileUpload extends Base {
|
|
188
173
|
* scan operation to see if the file was accepted, and whether it is to be subsequently downloadable.
|
189
174
|
*
|
190
175
|
* The document status request URL must be configured in {@link #member-documentStatusUrl}
|
191
|
-
* @member {String} uploadUrl
|
176
|
+
* @member {String|null} uploadUrl=null
|
192
177
|
*/
|
193
|
-
uploadUrl
|
178
|
+
uploadUrl: null,
|
194
179
|
|
195
180
|
/**
|
196
181
|
* The name of the JSON property in which the document id is returned in the upload response
|
@@ -199,18 +184,18 @@ class FileUpload extends Base {
|
|
199
184
|
*
|
200
185
|
* Defaults fro `documentId`
|
201
186
|
*
|
202
|
-
* @member {String}
|
187
|
+
* @member {String} documentIdParameter='documentId'
|
203
188
|
*/
|
204
|
-
documentIdParameter
|
189
|
+
documentIdParameter: 'documentId',
|
205
190
|
|
206
191
|
/**
|
207
192
|
* The URL from which the file may be downloaded after it has finished its scan.
|
208
193
|
*
|
209
194
|
* This must contain a substitution token named the same as the {@link #property-documentIdParameter}
|
210
195
|
* which is used when creating a URL
|
211
|
-
*
|
196
|
+
*
|
212
197
|
* for example:
|
213
|
-
*
|
198
|
+
*
|
214
199
|
* ```json
|
215
200
|
* {
|
216
201
|
* downloadUrl : '/getDocument/${documentId}'
|
@@ -220,18 +205,18 @@ class FileUpload extends Base {
|
|
220
205
|
* The document id returned from the {@link #member-uploadUrl upload} is passed in the parameter named
|
221
206
|
* by the {@link #member-documentIdParameter}. It defaults to `'documentId'`.
|
222
207
|
*
|
223
|
-
* @member {String}
|
208
|
+
* @member {String|null} downloadUrl_=null
|
224
209
|
*/
|
225
|
-
downloadUrl_
|
210
|
+
downloadUrl_: null,
|
226
211
|
|
227
212
|
/**
|
228
213
|
* The URL of the file status reporting service.
|
229
214
|
*
|
230
215
|
* This must contain a substitution token named the same as the {@link #property-documentIdParameter}
|
231
216
|
* which is used when creating a URL
|
232
|
-
*
|
217
|
+
*
|
233
218
|
* for example:
|
234
|
-
*
|
219
|
+
*
|
235
220
|
* ```json
|
236
221
|
* {
|
237
222
|
* documentStatusUrl : '/getDocumentStatus/${documentId}'
|
@@ -249,9 +234,9 @@ class FileUpload extends Base {
|
|
249
234
|
* }
|
250
235
|
* ```
|
251
236
|
*
|
252
|
-
* @member {String}
|
237
|
+
* @member {String|null} documentStatusUrl_=null
|
253
238
|
*/
|
254
|
-
documentStatusUrl_
|
239
|
+
documentStatusUrl_: null,
|
255
240
|
|
256
241
|
/**
|
257
242
|
* The polling interval *in milliseconds* to wait between asking the server how the document scan
|
@@ -259,18 +244,18 @@ class FileUpload extends Base {
|
|
259
244
|
*
|
260
245
|
* Defaults to 2000ms
|
261
246
|
*
|
262
|
-
* @member {
|
247
|
+
* @member {Number} statusScanInterval=2000
|
263
248
|
*/
|
264
|
-
statusScanInterval
|
249
|
+
statusScanInterval: 2000,
|
265
250
|
|
266
251
|
/**
|
267
252
|
* The URL of the file deletion service.
|
268
253
|
*
|
269
254
|
* This must contain a substitution token named the same as the {@link #property-documentIdParameter}
|
270
255
|
* which is used when creating a URL
|
271
|
-
*
|
256
|
+
*
|
272
257
|
* for example:
|
273
|
-
*
|
258
|
+
*
|
274
259
|
* ```json
|
275
260
|
* {
|
276
261
|
* documentDeleteUrl : '/deleteDocument/${documentId}'
|
@@ -282,17 +267,17 @@ class FileUpload extends Base {
|
|
282
267
|
*
|
283
268
|
* If this service yields an HTTP 200 status, the deletion is taken to have been successful.
|
284
269
|
*
|
285
|
-
* @member {String}
|
270
|
+
* @member {String|null} documentDeleteUrl_=null
|
286
271
|
*/
|
287
|
-
documentDeleteUrl_
|
272
|
+
documentDeleteUrl_: null,
|
288
273
|
|
289
274
|
/**
|
290
275
|
* The HTTP method to use when requesting a document deletion using the {@link #member-documentDeleteUrl}.
|
291
|
-
*
|
276
|
+
*
|
292
277
|
* Defaults to `DELETE`.
|
293
|
-
* @member {String} documentDeleteMethod
|
278
|
+
* @member {String} documentDeleteMethod='DELETE'
|
294
279
|
*/
|
295
|
-
documentDeleteMethod
|
280
|
+
documentDeleteMethod: 'DELETE',
|
296
281
|
|
297
282
|
/**
|
298
283
|
* @member {String} state_=null
|
@@ -302,16 +287,16 @@ class FileUpload extends Base {
|
|
302
287
|
/**
|
303
288
|
* @member {Object} types=null
|
304
289
|
*/
|
305
|
-
types_
|
290
|
+
types_: null,
|
306
291
|
|
307
292
|
/**
|
308
|
-
* @member {String|Number} maxSize
|
293
|
+
* @member {String|Number|null} maxSize=null
|
309
294
|
*/
|
310
295
|
maxSize_: null,
|
311
296
|
|
312
297
|
/**
|
313
298
|
* The error text to show below the widget
|
314
|
-
* @member {String}
|
299
|
+
* @member {String|null} error_=null
|
315
300
|
*/
|
316
301
|
error_ : null,
|
317
302
|
|
@@ -362,7 +347,7 @@ class FileUpload extends Base {
|
|
362
347
|
|
363
348
|
this.vdom.cn[4].html = this.chooseFile;
|
364
349
|
}
|
365
|
-
|
350
|
+
|
366
351
|
/**
|
367
352
|
* @returns {Object}
|
368
353
|
*/
|
@@ -410,7 +395,7 @@ class FileUpload extends Base {
|
|
410
395
|
if (files.length) {
|
411
396
|
NeoArray.remove(cls, 'neo-field-empty');
|
412
397
|
me.cls = cls;
|
413
|
-
|
398
|
+
|
414
399
|
const
|
415
400
|
file = files.item(0),
|
416
401
|
pointPos = file.name.lastIndexOf('.'),
|
@@ -643,7 +628,7 @@ class FileUpload extends Base {
|
|
643
628
|
|
644
629
|
// Success
|
645
630
|
if (String(statusResponse.status).slice(0, 1) === '2') {
|
646
|
-
const
|
631
|
+
const
|
647
632
|
serverJson = await statusResponse.json(),
|
648
633
|
serverStatus = serverJson.status,
|
649
634
|
// Map the server's states codes to our own status codes
|
@@ -746,8 +731,8 @@ class FileUpload extends Base {
|
|
746
731
|
/**
|
747
732
|
* Creates a URL substituting the passed parameter names in at the places where the name
|
748
733
|
* occurs within `{}` in the pattern.
|
749
|
-
* @param {String} urlPattern
|
750
|
-
* @param {Object} params
|
734
|
+
* @param {String} urlPattern
|
735
|
+
* @param {Object} params
|
751
736
|
*/
|
752
737
|
createUrl(urlPattern, params) {
|
753
738
|
for (const paramName in params) {
|
package/src/main/DomAccess.mjs
CHANGED
@@ -801,12 +801,19 @@ class DomAccess extends Base {
|
|
801
801
|
|
802
802
|
// Keep all registered aligns aligned on any detected change
|
803
803
|
_aligns?.forEach(align => {
|
804
|
+
const targetPresent = document.contains(align.targetElement);
|
805
|
+
|
804
806
|
// Align subject and target still in the DOM - correct its alignment
|
805
|
-
if (document.contains(align.subject) &&
|
807
|
+
if (document.contains(align.subject) && targetPresent) {
|
806
808
|
me.align(align);
|
807
809
|
}
|
808
810
|
// Align subject or target no longer in the DOM - remove it.
|
809
811
|
else {
|
812
|
+
// If target is no longer in the DOM, hide the subject component
|
813
|
+
if (!targetPresent) {
|
814
|
+
Neo.worker.App.setConfigs({ id: align.id, hidden: true });
|
815
|
+
}
|
816
|
+
|
810
817
|
const
|
811
818
|
{ _alignResizeObserver } = me,
|
812
819
|
{ constrainToElement } = align;
|
package/src/vdom/Helper.mjs
CHANGED
@@ -189,10 +189,13 @@ class Helper extends Base {
|
|
189
189
|
} else {
|
190
190
|
// console.log('top level removed node', oldVnode.id, oldVnode);
|
191
191
|
|
192
|
+
let removedNodeDetails = me.findVnode(oldVnodeRoot, oldVnode.id);
|
193
|
+
|
192
194
|
deltas.push({
|
193
|
-
action: 'removeNode',
|
194
|
-
id
|
195
|
-
|
195
|
+
action : 'removeNode',
|
196
|
+
id : oldVnode.id,
|
197
|
+
parentId: removedNodeDetails?.parentNode.id
|
198
|
+
})
|
196
199
|
}
|
197
200
|
} else {
|
198
201
|
if (newVnode && oldVnode && newVnode.id !== oldVnode.id) {
|