Skip to content

Commit

Permalink
Merge branch 'maintenance-3.1.x' into task-WEBUI-1616-rtl-support
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshkumar1019 authored Jan 23, 2025
2 parents 46633bf + 405a413 commit f7f182a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
41 changes: 23 additions & 18 deletions ui/nuxeo-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
import '@polymer/polymer/polymer-legacy.js';

import '@nuxeo/nuxeo-elements/nuxeo-element.js';
import { config } from '@nuxeo/nuxeo-elements';
import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
import { microTask } from '@polymer/polymer/lib/utils/async.js';
import { enqueueDebouncer } from '@polymer/polymer/lib/utils/flush.js';
Expand Down Expand Up @@ -184,25 +185,29 @@ import Interpreter from './js-interpreter/interpreter.js';
let res = false;

try {
const js = new Interpreter(expression, (interpreter, scope) => {
// set scope
interpreter.setProperty(scope, 'this', interpreter.nativeToPseudo(FiltersBehavior));
Object.entries({ document, user }).forEach(([k, obj]) => {
const v = {};
// filter out private properties
Object.getOwnPropertyNames(obj)
.filter((p) => !p.startsWith('_'))
.forEach((p) => {
v[p] = obj[p];
});
interpreter.setProperty(scope, k, interpreter.nativeToPseudo(v));
if (!config.get('expressions.eval', true)) {
const js = new Interpreter(expression, (interpreter, scope) => {
// set scope
interpreter.setProperty(scope, 'this', interpreter.nativeToPseudo(FiltersBehavior));
Object.entries({ document, user }).forEach(([k, obj]) => {
const v = {};
// filter out private properties
Object.getOwnPropertyNames(obj)
.filter((p) => !p.startsWith('_'))
.forEach((p) => {
v[p] = obj[p];
});
interpreter.setProperty(scope, k, interpreter.nativeToPseudo(v));
});
// XXX: 'this' in the scope of native functions is the interpreter instance
Object.assign(interpreter, FiltersBehavior);
});
// XXX: 'this' in the scope of native functions is the interpreter instance
Object.assign(interpreter, FiltersBehavior);
});
js.run();
res = js.value;

js.run();
res = js.value;
} else {
const fn = new Function(['document', 'user'], `return ${expression};`);
res = fn.apply(this, [document, user]);
}
return res;
} catch (err) {
console.error(`${err} in <nuxeo-filter> expression "${expression}"`);
Expand Down
7 changes: 4 additions & 3 deletions ui/nuxeo-video/nuxeo-video-conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ import '../widgets/nuxeo-tooltip.js';
a:focus {
@apply --nuxeo-link;
}
a:hover {
@apply --nuxeo-link-hover;
}
.properties label {
@apply --nuxeo-label;
min-width: 10rem;
Expand All @@ -56,6 +53,10 @@ import '../widgets/nuxeo-tooltip.js';
.properties .item > * {
unicode-bidi: plaintext;
}
.properties .item span {
flex: 1;
text-align: left;
}
</style>
<dom-if if="[[label]]">
<template>
Expand Down

0 comments on commit f7f182a

Please sign in to comment.