@jinntec/fore 2.4.1 → 2.4.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/dist/fore-dev.js +2 -2
- package/dist/fore-dev.js.map +1 -1
- package/dist/fore.js +2 -2
- package/dist/fore.js.map +1 -1
- package/package.json +1 -1
- package/src/fx-model.js +1 -1
- package/src/fx-submission.js +35 -17
- package/src/ui/fx-switch.js +4 -0
package/package.json
CHANGED
package/src/fx-model.js
CHANGED
package/src/fx-submission.js
CHANGED
|
@@ -50,8 +50,8 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
50
50
|
? this.getAttribute('mediatype')
|
|
51
51
|
: 'application/xml';
|
|
52
52
|
|
|
53
|
-
this.responseMediatype = this.hasAttribute('
|
|
54
|
-
? this.getAttribute('
|
|
53
|
+
this.responseMediatype = this.hasAttribute('responsemediatype')
|
|
54
|
+
? this.getAttribute('responsemediatype')
|
|
55
55
|
: this.mediatype;
|
|
56
56
|
this.url = this.hasAttribute('url') ? this.getAttribute('url') : null;
|
|
57
57
|
|
|
@@ -83,7 +83,12 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
async _submit() {
|
|
86
|
-
|
|
86
|
+
console.log('submitting....', this.getAttribute('id'));
|
|
87
|
+
console.info(
|
|
88
|
+
`%csubmitting #${this.id}`,
|
|
89
|
+
'background:yellow; color:black; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
|
|
90
|
+
);
|
|
91
|
+
|
|
87
92
|
this.evalInContext();
|
|
88
93
|
const model = this.getModel();
|
|
89
94
|
|
|
@@ -232,6 +237,11 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
232
237
|
|
|
233
238
|
if (!response.ok || response.status > 400) {
|
|
234
239
|
// this.dispatch('submit-error', { message: `Error while submitting ${this.id}` });
|
|
240
|
+
console.info(
|
|
241
|
+
`%csubmit-error #${this.id}`,
|
|
242
|
+
'background:red; color:black; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
|
|
243
|
+
);
|
|
244
|
+
|
|
235
245
|
Fore.dispatch(this, 'submit-error', { message: `Error while submitting ${this.id}` });
|
|
236
246
|
return;
|
|
237
247
|
}
|
|
@@ -255,6 +265,11 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
255
265
|
// this.dispatch('submit-done', {});
|
|
256
266
|
// console.log(`### <<<<< ${this.id} submit-done >>>>>`);
|
|
257
267
|
Fore.dispatch(this, 'submit-done', {});
|
|
268
|
+
console.info(
|
|
269
|
+
`%csubmit-done #${this.id}`,
|
|
270
|
+
'background:green; color:white; padding:.5rem; display:inline-block; white-space: nowrap; border-radius:0.3rem;width:100%;',
|
|
271
|
+
);
|
|
272
|
+
|
|
258
273
|
} catch (error) {
|
|
259
274
|
Fore.dispatch(this, 'submit-error', { error: error.message });
|
|
260
275
|
} finally {
|
|
@@ -354,13 +369,6 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
354
369
|
_handleResponse(data, resolvedUrl, contentType) {
|
|
355
370
|
// console.log('_handleResponse ', data);
|
|
356
371
|
|
|
357
|
-
/*
|
|
358
|
-
// ### responses need to be handled depending on their type.
|
|
359
|
-
if(this.type === 'json'){
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
*/
|
|
363
|
-
|
|
364
372
|
const targetInstance = this._getTargetInstance();
|
|
365
373
|
|
|
366
374
|
/*
|
|
@@ -386,16 +394,26 @@ export class FxSubmission extends ForeElementMixin {
|
|
|
386
394
|
if (this.replace === 'instance') {
|
|
387
395
|
if (targetInstance) {
|
|
388
396
|
if (this.targetref) {
|
|
397
|
+
|
|
389
398
|
const [theTarget] = evaluateXPath(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
399
|
+
this.targetref,
|
|
400
|
+
targetInstance.instanceData.firstElementChild,
|
|
401
|
+
this,
|
|
393
402
|
);
|
|
394
403
|
console.log('theTarget', theTarget);
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
404
|
+
if(this.responseMediatype === 'application/xml' || this.responseMediatype === 'text/html'){
|
|
405
|
+
const clone = data.firstElementChild;
|
|
406
|
+
const parent = theTarget.parentNode;
|
|
407
|
+
parent.replaceChild(clone, theTarget);
|
|
408
|
+
console.log('finally ', parent);
|
|
409
|
+
}
|
|
410
|
+
if(this.responseMediatype.startsWith('text/')){
|
|
411
|
+
theTarget.textContent = data;
|
|
412
|
+
}
|
|
413
|
+
if(this.responseMediatype === 'application/json'){
|
|
414
|
+
console.warn('targetref is not supported for application/json responses')
|
|
415
|
+
}
|
|
416
|
+
|
|
399
417
|
} else if (this.into) {
|
|
400
418
|
const [theTarget] = evaluateXPath(
|
|
401
419
|
this.into,
|
package/src/ui/fx-switch.js
CHANGED
|
@@ -20,6 +20,7 @@ class FxSwitch extends FxContainer {
|
|
|
20
20
|
this.formerCase = {};
|
|
21
21
|
this.selectedCase = null;
|
|
22
22
|
this.cases = null;
|
|
23
|
+
this.visitedResetted = false;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
connectedCallback() {
|
|
@@ -74,10 +75,13 @@ class FxSwitch extends FxContainer {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
_resetVisited() {
|
|
78
|
+
if(this.visitedResetted) return;
|
|
79
|
+
|
|
77
80
|
const visited = this.selectedCase.querySelectorAll('.visited');
|
|
78
81
|
Array.from(visited).forEach(v => {
|
|
79
82
|
v.classList.remove('visited');
|
|
80
83
|
});
|
|
84
|
+
this.visitedResetted = true;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
/**
|