@easyquery/ui 7.4.1 → 7.4.2-rc01

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.
@@ -6030,7 +6030,6 @@ class SimpleConditionRenderer extends ConditionRenderer {
6030
6030
  .data('condrow', '')
6031
6031
  .addChildElement(this.renderCheckbox())
6032
6032
  .addChildElement(this.renderConjunction());
6033
- let mayAppear = autoAppear;
6034
6033
  const minLength = operator == model.nullOperator
6035
6034
  ? Math.min(arrLength, this.condition.expressions.length + 1)
6036
6035
  : arrLength;
@@ -6043,7 +6042,7 @@ class SimpleConditionRenderer extends ConditionRenderer {
6043
6042
  }
6044
6043
  }
6045
6044
  else if (item.type === 'expression') {
6046
- const toAppear = mayAppear && (item.index > 0);
6045
+ const toAppear = autoAppear && (item.index == 1);
6047
6046
  const exprRenderer = this.panel.getExpressionRenderer(this.condition.expressions[item.index]);
6048
6047
  if (exprRenderer) {
6049
6048
  const el = exprRenderer.render(toAppear);
@@ -6052,7 +6051,6 @@ class SimpleConditionRenderer extends ConditionRenderer {
6052
6051
  exprRenderer.adjustWidth();
6053
6052
  }, 100);
6054
6053
  }
6055
- mayAppear = mayAppear && !toAppear;
6056
6054
  }
6057
6055
  else if (item.type === 'text') {
6058
6056
  builder.addChildElement(new TextRenderer(this.panel, item.text).render());
@@ -7094,7 +7092,6 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7094
7092
  constructor() {
7095
7093
  super(...arguments);
7096
7094
  this.isLoading = false;
7097
- this.onClickTemp = null;
7098
7095
  }
7099
7096
  renderEditor() {
7100
7097
  if (this.isLoading)
@@ -7141,12 +7138,26 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7141
7138
  }
7142
7139
  }
7143
7140
  else if (listRequestHandler) {
7144
- listRequestHandler({
7141
+ let eParams = this.valueEditor.extraParams ? Object.assign({}, this.valueEditor.extraParams) : {};
7142
+ let requestData = {
7145
7143
  listName: listName,
7146
7144
  editorId: this.valueEditor.id,
7147
- editorParams: this.valueEditor.extraParams,
7145
+ editorParams: eParams,
7148
7146
  value: this.getValue()
7149
- }, (list) => {
7147
+ };
7148
+ if (this.valueEditor.dependsOnAttr) {
7149
+ const query = this.panel.getQuery();
7150
+ if (query) {
7151
+ const rootCond = query.getRootCondition ? query.getRootCondition() : query.root;
7152
+ if (rootCond) {
7153
+ const pValue = query.getOneValueForAttr(this.valueEditor.dependsOnAttr);
7154
+ if (pValue) {
7155
+ requestData.parentValue = pValue;
7156
+ }
7157
+ }
7158
+ }
7159
+ }
7160
+ listRequestHandler(requestData, (list) => {
7150
7161
  this.menuItemsList = list;
7151
7162
  if (onComplete) {
7152
7163
  onComplete();
@@ -7158,7 +7169,6 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7158
7169
  class SqlListExpressionRenderer extends CustomListExpressionRenderer {
7159
7170
  fillMenuItemsList(onComplete) {
7160
7171
  const context = this.panel.getContext();
7161
- this.valueEditor;
7162
7172
  const listRequestHandler = context.getListRequestHandler();
7163
7173
  if (listRequestHandler) {
7164
7174
  let requestData = {
@@ -7167,7 +7177,6 @@ class SqlListExpressionRenderer extends CustomListExpressionRenderer {
7167
7177
  editorParams: this.valueEditor.extraParams,
7168
7178
  value: this.getValue()
7169
7179
  };
7170
- //requestData.sql = editor.sql;
7171
7180
  listRequestHandler(requestData, (list) => {
7172
7181
  this.menuItemsList = list;
7173
7182
  if (onComplete) {
@@ -7901,6 +7910,51 @@ class QueryPanel extends core.Widget {
7901
7910
  else {
7902
7911
  modifyCondition(conds, autoEdit);
7903
7912
  }
7913
+ const checkAndClearDependents = (masterCond, masterAttrId) => {
7914
+ const model = this.getContext().getModel();
7915
+ const query = this.getQuery();
7916
+ const rootCond = query.getRootCondition();
7917
+ const processCond = (c) => {
7918
+ if (c.isGroup()) {
7919
+ c.getConditions().forEach(processCond);
7920
+ }
7921
+ else if (c !== masterCond && c.expressions.length > 0) {
7922
+ const attrExpr = c.expressions[0];
7923
+ if (attrExpr.tag === core.ExprTag.EntityAttribute) {
7924
+ const operator = model.getOperatorById(c.getOperatorId());
7925
+ const attribute = model.getAttributeByIdSafe(attrExpr.value);
7926
+ if (c.expressions.length > 1 && operator) {
7927
+ const operand = model.getOperand(attribute, operator, 1);
7928
+ let editor = operand.editor;
7929
+ if (editor && editor.dependsOnAttr === masterAttrId) {
7930
+ for (let i = 1; i < c.expressions.length; i++) {
7931
+ // Only clear if it's not already empty to prevent infinite loops
7932
+ if (!c.expressions[i].isEmpty()) {
7933
+ c.expressions[i].setContent('', '');
7934
+ }
7935
+ modifyCondition(c, false);
7936
+ }
7937
+ }
7938
+ }
7939
+ }
7940
+ }
7941
+ };
7942
+ if (rootCond) {
7943
+ processCond(rootCond);
7944
+ }
7945
+ };
7946
+ if (!Array.isArray(conds)) {
7947
+ const masterCond = conds;
7948
+ const operatorId = masterCond.getOperatorId();
7949
+ if ((edata.condPart & core.ConditionPart.Value) === core.ConditionPart.Value
7950
+ && (operatorId == "Equal" || operatorId == "IsInList")) {
7951
+ const baseExpr = masterCond.expressions[0];
7952
+ if (baseExpr.tag == core.ExprTag.EntityAttribute) {
7953
+ const attrId = baseExpr.value;
7954
+ checkAndClearDependents(masterCond, attrId);
7955
+ }
7956
+ }
7957
+ }
7904
7958
  break;
7905
7959
  }
7906
7960
  case core.QueryChangeAction.Add: {
@@ -6028,7 +6028,6 @@ class SimpleConditionRenderer extends ConditionRenderer {
6028
6028
  .data('condrow', '')
6029
6029
  .addChildElement(this.renderCheckbox())
6030
6030
  .addChildElement(this.renderConjunction());
6031
- let mayAppear = autoAppear;
6032
6031
  const minLength = operator == model.nullOperator
6033
6032
  ? Math.min(arrLength, this.condition.expressions.length + 1)
6034
6033
  : arrLength;
@@ -6041,7 +6040,7 @@ class SimpleConditionRenderer extends ConditionRenderer {
6041
6040
  }
6042
6041
  }
6043
6042
  else if (item.type === 'expression') {
6044
- const toAppear = mayAppear && (item.index > 0);
6043
+ const toAppear = autoAppear && (item.index == 1);
6045
6044
  const exprRenderer = this.panel.getExpressionRenderer(this.condition.expressions[item.index]);
6046
6045
  if (exprRenderer) {
6047
6046
  const el = exprRenderer.render(toAppear);
@@ -6050,7 +6049,6 @@ class SimpleConditionRenderer extends ConditionRenderer {
6050
6049
  exprRenderer.adjustWidth();
6051
6050
  }, 100);
6052
6051
  }
6053
- mayAppear = mayAppear && !toAppear;
6054
6052
  }
6055
6053
  else if (item.type === 'text') {
6056
6054
  builder.addChildElement(new TextRenderer(this.panel, item.text).render());
@@ -7092,7 +7090,6 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7092
7090
  constructor() {
7093
7091
  super(...arguments);
7094
7092
  this.isLoading = false;
7095
- this.onClickTemp = null;
7096
7093
  }
7097
7094
  renderEditor() {
7098
7095
  if (this.isLoading)
@@ -7139,12 +7136,26 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7139
7136
  }
7140
7137
  }
7141
7138
  else if (listRequestHandler) {
7142
- listRequestHandler({
7139
+ let eParams = this.valueEditor.extraParams ? Object.assign({}, this.valueEditor.extraParams) : {};
7140
+ let requestData = {
7143
7141
  listName: listName,
7144
7142
  editorId: this.valueEditor.id,
7145
- editorParams: this.valueEditor.extraParams,
7143
+ editorParams: eParams,
7146
7144
  value: this.getValue()
7147
- }, (list) => {
7145
+ };
7146
+ if (this.valueEditor.dependsOnAttr) {
7147
+ const query = this.panel.getQuery();
7148
+ if (query) {
7149
+ const rootCond = query.getRootCondition ? query.getRootCondition() : query.root;
7150
+ if (rootCond) {
7151
+ const pValue = query.getOneValueForAttr(this.valueEditor.dependsOnAttr);
7152
+ if (pValue) {
7153
+ requestData.parentValue = pValue;
7154
+ }
7155
+ }
7156
+ }
7157
+ }
7158
+ listRequestHandler(requestData, (list) => {
7148
7159
  this.menuItemsList = list;
7149
7160
  if (onComplete) {
7150
7161
  onComplete();
@@ -7156,7 +7167,6 @@ class CustomListExpressionRenderer extends ListExpressionRenderer {
7156
7167
  class SqlListExpressionRenderer extends CustomListExpressionRenderer {
7157
7168
  fillMenuItemsList(onComplete) {
7158
7169
  const context = this.panel.getContext();
7159
- this.valueEditor;
7160
7170
  const listRequestHandler = context.getListRequestHandler();
7161
7171
  if (listRequestHandler) {
7162
7172
  let requestData = {
@@ -7165,7 +7175,6 @@ class SqlListExpressionRenderer extends CustomListExpressionRenderer {
7165
7175
  editorParams: this.valueEditor.extraParams,
7166
7176
  value: this.getValue()
7167
7177
  };
7168
- //requestData.sql = editor.sql;
7169
7178
  listRequestHandler(requestData, (list) => {
7170
7179
  this.menuItemsList = list;
7171
7180
  if (onComplete) {
@@ -7899,6 +7908,51 @@ class QueryPanel extends Widget {
7899
7908
  else {
7900
7909
  modifyCondition(conds, autoEdit);
7901
7910
  }
7911
+ const checkAndClearDependents = (masterCond, masterAttrId) => {
7912
+ const model = this.getContext().getModel();
7913
+ const query = this.getQuery();
7914
+ const rootCond = query.getRootCondition();
7915
+ const processCond = (c) => {
7916
+ if (c.isGroup()) {
7917
+ c.getConditions().forEach(processCond);
7918
+ }
7919
+ else if (c !== masterCond && c.expressions.length > 0) {
7920
+ const attrExpr = c.expressions[0];
7921
+ if (attrExpr.tag === ExprTag.EntityAttribute) {
7922
+ const operator = model.getOperatorById(c.getOperatorId());
7923
+ const attribute = model.getAttributeByIdSafe(attrExpr.value);
7924
+ if (c.expressions.length > 1 && operator) {
7925
+ const operand = model.getOperand(attribute, operator, 1);
7926
+ let editor = operand.editor;
7927
+ if (editor && editor.dependsOnAttr === masterAttrId) {
7928
+ for (let i = 1; i < c.expressions.length; i++) {
7929
+ // Only clear if it's not already empty to prevent infinite loops
7930
+ if (!c.expressions[i].isEmpty()) {
7931
+ c.expressions[i].setContent('', '');
7932
+ }
7933
+ modifyCondition(c, false);
7934
+ }
7935
+ }
7936
+ }
7937
+ }
7938
+ }
7939
+ };
7940
+ if (rootCond) {
7941
+ processCond(rootCond);
7942
+ }
7943
+ };
7944
+ if (!Array.isArray(conds)) {
7945
+ const masterCond = conds;
7946
+ const operatorId = masterCond.getOperatorId();
7947
+ if ((edata.condPart & ConditionPart.Value) === ConditionPart.Value
7948
+ && (operatorId == "Equal" || operatorId == "IsInList")) {
7949
+ const baseExpr = masterCond.expressions[0];
7950
+ if (baseExpr.tag == ExprTag.EntityAttribute) {
7951
+ const attrId = baseExpr.value;
7952
+ checkAndClearDependents(masterCond, attrId);
7953
+ }
7954
+ }
7955
+ }
7902
7956
  break;
7903
7957
  }
7904
7958
  case QueryChangeAction.Add: {
@@ -6,7 +6,7 @@ export declare class ChartFacet extends ResultFacet {
6
6
  protected chart: ChartWidget;
7
7
  title: string;
8
8
  protected settings: any;
9
- protected dialogTitle: any;
9
+ protected dialogTitle: string;
10
10
  init(slot: HTMLElement): void;
11
11
  destroy(): void;
12
12
  getType(): FacetType;
@@ -4,7 +4,7 @@ import { FacetType } from '../types/facet_type';
4
4
  export declare class DataTableFacet extends ResultFacet {
5
5
  protected grid: Widget;
6
6
  title: string;
7
- protected dialogTitle: any;
7
+ protected dialogTitle: string;
8
8
  init(slot: HTMLElement): void;
9
9
  getSettings(): any;
10
10
  protected reinitGrid(): void;
@@ -21,7 +21,7 @@ interface CrossTabOptions {
21
21
  export declare class PivotTableFacet extends ResultFacet {
22
22
  protected grid: EasyGrid;
23
23
  title: string;
24
- protected dialogTitle: any;
24
+ protected dialogTitle: string;
25
25
  protected pivotTable: EasyDataTable;
26
26
  protected settings: CrossTabOptions;
27
27
  init(slot: HTMLElement): void;
@@ -10,7 +10,7 @@ export declare abstract class ResultFacet {
10
10
  private displayMessageDiv;
11
11
  title: string;
12
12
  protected cssPrefix: string;
13
- protected dialogTitle: any;
13
+ protected dialogTitle: string;
14
14
  protected options: any;
15
15
  protected canDisplayFlag: boolean;
16
16
  constructor(container: FacetContainer, options?: any);
@@ -51,11 +51,11 @@ export declare class ColumnsPanel extends Widget {
51
51
  private createEntitiesMenu;
52
52
  getSortMenuList(): {
53
53
  id: string;
54
- text: any;
54
+ text: string;
55
55
  }[];
56
56
  getMoveMenuList(): {
57
57
  id: string;
58
- text: any;
58
+ text: string;
59
59
  }[];
60
60
  private createSortMenu;
61
61
  private createMoveMenu;
@@ -24,7 +24,6 @@ export declare class ListExpressionRenderer extends ExpressionRenderer {
24
24
  export declare class CustomListExpressionRenderer extends ListExpressionRenderer {
25
25
  loaderElement: HTMLElement | null;
26
26
  private isLoading;
27
- private onClickTemp;
28
27
  protected renderEditor(): void;
29
28
  protected showLoader(): void;
30
29
  protected hideLoader(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyquery/ui",
3
- "version": "7.4.1",
3
+ "version": "7.4.2-rc01",
4
4
  "description": "EasyQuery.JS Community UI widgets",
5
5
  "types": "./dist/types/public_api.d.ts",
6
6
  "main": "./dist/easyquery.ui.cjs.js",
@@ -30,7 +30,7 @@
30
30
  "bugs": "https://korzh.com/support",
31
31
  "license": "LGPL-3.0",
32
32
  "peerDependencies": {
33
- "@easyquery/core": "^7.4.1"
33
+ "@easyquery/core": "^7.4.2-rc01"
34
34
  },
35
35
  "files": [
36
36
  "dist",