Skip to content

Commit 897f4ab

Browse files
emge-odooged-odoo
authored andcommitted
rename param into params
1 parent edc78d1 commit 897f4ab

File tree

55 files changed

+662
-661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+662
-661
lines changed

addons/html_builder/static/src/core/building_blocks/builder_colorpicker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function useColorPickerBuilderComponent() {
2424
proms.push(
2525
applySpec.apply({
2626
editingElement: applySpec.editingElement,
27-
param: applySpec.actionParam,
27+
params: applySpec.actionParam,
2828
value: applySpec.actionValue,
2929
loadResult: applySpec.loadResult,
3030
dependencyManager: comp.env.dependencyManager,
@@ -43,7 +43,7 @@ export function useColorPickerBuilderComponent() {
4343
({ actionId }) => getAction(actionId).getValue
4444
);
4545
const { actionId, actionParam } = actionWithGetValue;
46-
const actionValue = getAction(actionId).getValue({ editingElement, param: actionParam });
46+
const actionValue = getAction(actionId).getValue({ editingElement, params: actionParam });
4747
return {
4848
selectedColor: actionValue || "#FFFFFF00",
4949
};

addons/html_builder/static/src/core/building_blocks/builder_many2many.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class BuilderMany2Many extends Component {
4141
const { actionId, actionParam } = actionWithGetValue;
4242
const actionValue = getAction(actionId).getValue({
4343
editingElement: el,
44-
param: actionParam,
44+
params: actionParam,
4545
});
4646
return {
4747
selection: JSON.parse(actionValue || "[]"),
@@ -73,7 +73,7 @@ export class BuilderMany2Many extends Component {
7373
proms.push(
7474
applySpec.apply({
7575
editingElement: applySpec.editingElement,
76-
param: applySpec.actionParam,
76+
params: applySpec.actionParam,
7777
value: applySpec.actionValue,
7878
loadResult: applySpec.loadResult,
7979
dependencyManager: this.env.dependencyManager,

addons/html_builder/static/src/core/building_blocks/builder_many2one.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class BuilderMany2One extends Component {
4343
this.domState = useDomState((el) => {
4444
const actionValue = getAction(actionId).getValue({
4545
editingElement: el,
46-
param: actionParam,
46+
params: actionParam,
4747
});
4848
return { selected: actionValue && JSON.parse(actionValue) };
4949
});
@@ -68,14 +68,14 @@ export class BuilderMany2One extends Component {
6868
if (applySpec.clean && applySpec.actionValue === undefined) {
6969
applySpec.clean({
7070
editingElement: applySpec.editingElement,
71-
param: applySpec.actionParam,
71+
params: applySpec.actionParam,
7272
dependencyManager: this.env.dependencyManager,
7373
});
7474
} else {
7575
proms.push(
7676
applySpec.apply({
7777
editingElement: applySpec.editingElement,
78-
param: applySpec.actionParam,
78+
params: applySpec.actionParam,
7979
value: applySpec.actionValue,
8080
loadResult: applySpec.loadResult,
8181
dependencyManager: this.env.dependencyManager,

addons/html_builder/static/src/core/clone_plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class ClonePlugin extends Plugin {
4646
addItem: {
4747
apply: ({
4848
editingElement,
49-
param: { mainParam: itemSelector },
49+
params: { mainParam: itemSelector },
5050
value: position,
5151
}) => {
5252
const itemEl = editingElement.querySelector(itemSelector);

addons/html_builder/static/src/core/composite_action_plugin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class CompositeActionPlugin extends Plugin {
2323
}
2424
await Promise.all(proms);
2525
},
26-
getPriority: ({ param: { mainParam: actions }, value }) => {
26+
getPriority: ({ params: { mainParam: actions }, value }) => {
2727
const results = [];
2828
for (const actionDef of actions) {
2929
const action = this.dependencies.builderActions.getAction(actionDef.action);
@@ -37,7 +37,7 @@ export class CompositeActionPlugin extends Plugin {
3737
},
3838
// We arbitrarily keep the result of the 1st action, as we
3939
// obviously cannot return more than one value.
40-
getValue: ({ editingElement, param: { mainParam: actions } }) => {
40+
getValue: ({ editingElement, params: { mainParam: actions } }) => {
4141
let actionGetValue;
4242
const actionDef = actions.find((actionDef) => {
4343
const action = this.dependencies.builderActions.getAction(actionDef.action);
@@ -54,7 +54,7 @@ export class CompositeActionPlugin extends Plugin {
5454
return actionGetValue(actionDescr);
5555
}
5656
},
57-
isApplied: ({ editingElement, param: { mainParam: actions }, value }) => {
57+
isApplied: ({ editingElement, params: { mainParam: actions }, value }) => {
5858
const results = [];
5959
for (const actionDef of actions) {
6060
const action = this.dependencies.builderActions.getAction(actionDef.action);
@@ -69,7 +69,7 @@ export class CompositeActionPlugin extends Plugin {
6969
}
7070
return results.every((result) => result);
7171
},
72-
load: async ({ editingElement, param: { mainParam: actions }, value }) => {
72+
load: async ({ editingElement, params: { mainParam: actions }, value }) => {
7373
const loadActions = [];
7474
const loadResults = [];
7575
for (const actionDef of actions) {
@@ -95,7 +95,7 @@ export class CompositeActionPlugin extends Plugin {
9595
},
9696
apply: async ({
9797
editingElement,
98-
param: { mainParam: actions },
98+
params: { mainParam: actions },
9999
value,
100100
loadResult,
101101
dependencyManager,
@@ -119,7 +119,7 @@ export class CompositeActionPlugin extends Plugin {
119119
loadOnClean: true,
120120
clean: ({
121121
editingElement,
122-
param: { mainParam: actions },
122+
params: { mainParam: actions },
123123
value,
124124
loadResult,
125125
dependencyManager,
@@ -179,7 +179,7 @@ export class CompositeActionPlugin extends Plugin {
179179
}
180180
}
181181
if (actionParam) {
182-
actionDescr.param = convertParamToObject(actionParam);
182+
actionDescr.params = convertParamToObject(actionParam);
183183
}
184184
if (actionValue || value) {
185185
actionDescr.value = actionValue || value;

addons/html_builder/static/src/core/core_builder_action_plugin.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ export class CoreBuilderActionPlugin extends Plugin {
5454
const match = value.match(/url\(([^)]+)\)/);
5555
return match ? match[1] : "";
5656
},
57-
apply: (el, value, param) => {
57+
apply: (el, value, params) => {
5858
const parts = backgroundImageCssToParts(el.style["background-image"]);
5959
if (value) {
6060
parts.url = `url('${value}')`;
6161
} else {
6262
delete parts.url;
6363
}
6464
// todo: deal with the gradients
65-
setStyle(el, "background-image", backgroundImagePartsToCss(parts), param);
65+
setStyle(el, "background-image", backgroundImagePartsToCss(parts), params);
6666
},
6767
},
6868
"box-shadow": {
@@ -116,7 +116,7 @@ export class CoreBuilderActionPlugin extends Plugin {
116116

117117
getStyleAction() {
118118
const getValue = (el, styleName) =>
119-
// const { editingElement, param } = args[0];
119+
// const { editingElement, params } = args[0];
120120
// Disable all transitions for the duration of the style check
121121
// as we want to know the final value of a property to properly
122122
// update the UI.
@@ -129,16 +129,17 @@ export class CoreBuilderActionPlugin extends Plugin {
129129
}
130130
});
131131
return {
132-
getValue: ({ editingElement, param = {} }) => getValue(editingElement, param.mainParam),
133-
isApplied: ({ editingElement, param = {}, value }) => {
134-
const currentValue = getValue(editingElement, param.mainParam);
132+
getValue: ({ editingElement, params = {} }) =>
133+
getValue(editingElement, params.mainParam),
134+
isApplied: ({ editingElement, params = {}, value }) => {
135+
const currentValue = getValue(editingElement, params.mainParam);
135136
return currentValue === value;
136137
},
137-
apply: ({ editingElement, param = {}, value }) => {
138-
param = { ...param };
139-
const styleName = param.mainParam;
140-
delete param.mainParam;
141-
this.setStyle(editingElement, styleName, value, param);
138+
apply: ({ editingElement, params = {}, value }) => {
139+
params = { ...params };
140+
const styleName = params.mainParam;
141+
delete params.mainParam;
142+
this.setStyle(editingElement, styleName, value, params);
142143
},
143144
// TODO clean() is missing !!
144145
};
@@ -228,24 +229,24 @@ function setStyle(el, styleName, value, { extraClass, force = false, allowImport
228229
}
229230

230231
export const classAction = {
231-
getPriority: ({ param: { mainParam: classNames } = {} }) =>
232+
getPriority: ({ params: { mainParam: classNames } = {} }) =>
232233
(classNames || "")?.trim().split(/\s+/).filter(Boolean).length || 0,
233-
isApplied: ({ editingElement, param: { mainParam: classNames } = {} }) => {
234+
isApplied: ({ editingElement, params: { mainParam: classNames } = {} }) => {
234235
if (classNames === undefined || classNames === "") {
235236
return true;
236237
}
237238
return classNames
238239
.split(" ")
239240
.every((className) => editingElement.classList.contains(className));
240241
},
241-
apply: ({ editingElement, param: { mainParam: classNames } = {} }) => {
242+
apply: ({ editingElement, params: { mainParam: classNames } = {} }) => {
242243
for (const className of (classNames || "").split(" ")) {
243244
if (className !== "") {
244245
editingElement.classList.add(className);
245246
}
246247
}
247248
},
248-
clean: ({ editingElement, param: { mainParam: classNames } = {} }) => {
249+
clean: ({ editingElement, params: { mainParam: classNames } = {} }) => {
249250
for (const className of (classNames || "").split(" ")) {
250251
if (className !== "") {
251252
editingElement.classList.remove(className);
@@ -255,9 +256,9 @@ export const classAction = {
255256
};
256257

257258
const attributeAction = {
258-
getValue: ({ editingElement, param: { mainParam: attributeName } = {} }) =>
259+
getValue: ({ editingElement, params: { mainParam: attributeName } = {} }) =>
259260
editingElement.getAttribute(attributeName),
260-
isApplied: ({ editingElement, param: { mainParam: attributeName } = {}, value }) => {
261+
isApplied: ({ editingElement, params: { mainParam: attributeName } = {}, value }) => {
261262
if (value) {
262263
return (
263264
editingElement.hasAttribute(attributeName) &&
@@ -267,51 +268,51 @@ const attributeAction = {
267268
return !editingElement.hasAttribute(attributeName);
268269
}
269270
},
270-
apply: ({ editingElement, param: { mainParam: attributeName } = {}, value }) => {
271+
apply: ({ editingElement, params: { mainParam: attributeName } = {}, value }) => {
271272
if (value) {
272273
editingElement.setAttribute(attributeName, value);
273274
} else {
274275
editingElement.removeAttribute(attributeName);
275276
}
276277
},
277-
clean: ({ editingElement, param: { mainParam: attributeName } = {} }) => {
278+
clean: ({ editingElement, params: { mainParam: attributeName } = {} }) => {
278279
editingElement.removeAttribute(attributeName);
279280
},
280281
};
281282

282283
const dataAttributeAction = {
283-
getValue: ({ editingElement, param: { mainParam: attributeName } = {} }) =>
284+
getValue: ({ editingElement, params: { mainParam: attributeName } = {} }) =>
284285
editingElement.dataset[attributeName],
285-
isApplied: ({ editingElement, param: { mainParam: attributeName } = {}, value }) => {
286+
isApplied: ({ editingElement, params: { mainParam: attributeName } = {}, value }) => {
286287
if (value) {
287288
return editingElement.dataset[attributeName] === value;
288289
} else {
289290
return !(attributeName in editingElement.dataset);
290291
}
291292
},
292-
apply: ({ editingElement, param: { mainParam: attributeName } = {}, value }) => {
293+
apply: ({ editingElement, params: { mainParam: attributeName } = {}, value }) => {
293294
if (value) {
294295
editingElement.dataset[attributeName] = value;
295296
} else {
296297
delete editingElement.dataset[attributeName];
297298
}
298299
},
299-
clean: ({ editingElement, param: { mainParam: attributeName } = {} }) => {
300+
clean: ({ editingElement, params: { mainParam: attributeName } = {} }) => {
300301
delete editingElement.dataset[attributeName];
301302
},
302303
};
303304

304305
// TODO maybe find a better place for this
305306
const setClassRange = {
306-
getValue: ({ editingElement, param: { mainParam: classNames } }) => {
307+
getValue: ({ editingElement, params: { mainParam: classNames } }) => {
307308
for (const index in classNames) {
308309
const className = classNames[index];
309310
if (editingElement.classList.contains(className)) {
310311
return index;
311312
}
312313
}
313314
},
314-
apply: ({ editingElement, param: { mainParam: classNames }, value: index }) => {
315+
apply: ({ editingElement, params: { mainParam: classNames }, value: index }) => {
315316
for (const className of classNames) {
316317
if (editingElement.classList.contains(className)) {
317318
editingElement.classList.remove(className);

addons/html_builder/static/src/core/utils.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,15 @@ export function useClickableBuilderComponent() {
487487
let nextAction;
488488
getAction(actionId).clean?.({
489489
editingElement,
490-
param: actionParam,
490+
params: actionParam,
491491
value: actionValue,
492492
dependencyManager: comp.env.dependencyManager,
493493
selectableContext: comp.env.selectableContext,
494494
get nextAction() {
495495
nextAction =
496496
nextAction || nextApplySpecs.find((a) => a.actionId === actionId) || {};
497497
return {
498-
param: nextAction.actionParam,
498+
params: nextAction.actionParam,
499499
value: nextAction.actionValue,
500500
};
501501
},
@@ -521,7 +521,7 @@ export function useClickableBuilderComponent() {
521521
proms.push(
522522
applySpec.clean({
523523
editingElement: applySpec.editingElement,
524-
param: applySpec.actionParam,
524+
params: applySpec.actionParam,
525525
value: applySpec.actionValue,
526526
loadResult: applySpec.loadOnClean ? applySpec.loadResult : null,
527527
dependencyManager: comp.env.dependencyManager,
@@ -532,7 +532,7 @@ export function useClickableBuilderComponent() {
532532
proms.push(
533533
applySpec.apply({
534534
editingElement: applySpec.editingElement,
535-
param: applySpec.actionParam,
535+
params: applySpec.actionParam,
536536
value: applySpec.actionValue,
537537
loadResult: applySpec.loadResult,
538538
dependencyManager: comp.env.dependencyManager,
@@ -549,7 +549,7 @@ export function useClickableBuilderComponent() {
549549
.map(
550550
(a) =>
551551
getAction(a.actionId).getPriority?.({
552-
param: a.actionParam,
552+
params: a.actionParam,
553553
value: a.actionValue,
554554
}) || 0
555555
)
@@ -600,7 +600,7 @@ export function useInputBuilderComponent({
600600
proms.push(
601601
applySpec.apply({
602602
editingElement: applySpec.editingElement,
603-
param: applySpec.actionParam,
603+
params: applySpec.actionParam,
604604
value: applySpec.actionValue,
605605
loadResult: applySpec.loadResult,
606606
dependencyManager: comp.env.dependencyManager,
@@ -621,7 +621,7 @@ export function useInputBuilderComponent({
621621
({ actionId }) => getAction(actionId).getValue
622622
);
623623
const { actionId, actionParam } = actionWithGetValue;
624-
const actionValue = getAction(actionId).getValue({ editingElement, param: actionParam });
624+
const actionValue = getAction(actionId).getValue({ editingElement, params: actionParam });
625625
return {
626626
value: actionValue,
627627
};
@@ -845,7 +845,7 @@ export function getAllActionsAndOperations(comp) {
845845
}
846846
const result = await applySpec.load({
847847
editingElement: applySpec.editingElement,
848-
param: applySpec.actionParam,
848+
params: applySpec.actionParam,
849849
value: applySpec.actionValue,
850850
});
851851
applySpec.loadResult = result;
@@ -869,7 +869,7 @@ export function getAllActionsAndOperations(comp) {
869869
}
870870
const isApplied = getAction(actionId).isApplied?.({
871871
editingElement,
872-
param: actionParam,
872+
params: actionParam,
873873
value: actionValue,
874874
});
875875
return comp.props.inverseAction ? !isApplied : isApplied;

addons/html_builder/static/src/plugins/alert_option_plugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class AlertOptionPlugin extends Plugin {
88
resources = {
99
builder_actions: {
1010
alertIcon: {
11-
apply: ({ editingElement, param: { mainParam: className } }) => {
11+
apply: ({ editingElement, params: { mainParam: className } }) => {
1212
const icon = editingElement.querySelector(".s_alert_icon");
1313
if (!icon) {
1414
return;
@@ -18,14 +18,14 @@ class AlertOptionPlugin extends Plugin {
1818
icon.classList.remove(...allFaIcons);
1919
icon.classList.add(className);
2020
},
21-
clean: ({ editingElement, param: { mainParam: className } }) => {
21+
clean: ({ editingElement, params: { mainParam: className } }) => {
2222
const icon = editingElement.querySelector(".s_alert_icon");
2323
if (!icon) {
2424
return;
2525
}
2626
icon.classList.remove(className);
2727
},
28-
isApplied: ({ editingElement, param: { mainParam: className } }) => {
28+
isApplied: ({ editingElement, params: { mainParam: className } }) => {
2929
const iconEl = editingElement.querySelector(".s_alert_icon");
3030
if (!iconEl) {
3131
return;

0 commit comments

Comments
 (0)