@zohodesk/library-platform 1.1.11 → 1.1.12-exp.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/es/bc/index.js +0 -1
- package/es/bc/zlist/Constants.js +0 -1
- package/es/bc/zlist/Types.js +10 -0
- package/es/bc/zrecord/Constants.js +1 -0
- package/es/bc/zrecord/Schemas.js +29 -0
- package/es/bc/zrecord/Types.js +45 -0
- package/es/cc/fields/lookup/Properties.js +10 -26
- package/es/cc/radio-dropdown/Constants.js +6 -0
- package/es/cc/radio-dropdown/Data.js +1 -0
- package/es/cc/radio-dropdown/Events.js +42 -0
- package/es/cc/radio-dropdown/Properties.js +142 -0
- package/es/cc/radio-dropdown/index.js +4 -0
- package/es/cc/table-column-filter/Properties.js +9 -0
- package/es/cc/table-connected/SdkContract.js +21 -0
- package/es/cc/table-connected/constants/Events.js +2 -0
- package/es/cc/table-list/Actions.js +0 -2
- package/es/cc/table-list/Constants.js +0 -1
- package/es/cc/table-list/Events.js +0 -2
- package/es/cc/table-list/Properties.js +0 -3
- package/es/cc/tag/Constants.js +6 -0
- package/es/cc/tag/Data.js +14 -0
- package/es/cc/tag/EventHandlers.js +1 -0
- package/es/cc/tag/Events.js +26 -0
- package/es/cc/tag/Model.js +30 -0
- package/es/cc/tag/Properties.js +104 -0
- package/es/cc/tag/index.js +6 -0
- package/es/cc/tags-list-dropdown/Constants.js +5 -0
- package/es/cc/tags-list-dropdown/Data.js +1 -0
- package/es/cc/tags-list-dropdown/Events.js +14 -0
- package/es/cc/tags-list-dropdown/Properties.js +96 -0
- package/es/cc/tags-list-dropdown/index.js +4 -0
- package/es/library/custom-component/frameworks/ui/CustomComponentFactory.js +56 -0
- package/es/library/dot/components/form/frameworks/ui/css/Form.module.css +13 -13
- package/es/library/dot/components/form-fields/field/css/FieldItem.module.css +2 -2
- package/es/library/dot/components/section/frameworks/ui/css/Section.module.css +3 -3
- package/es/library/dot/components/table-list/adapters/controllers/index.js +0 -2
- package/es/library/dot/components/table-list/frameworks/ui/EventHandlersFactory.js +1 -2
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +21 -21
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/css/Breadcrumb.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/css/DateView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/css/Label.module.css +4 -4
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/css/MultiSelectView.module.css +7 -7
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdown.js +12 -0
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/RadioDropdownView.js +124 -0
- package/es/library/dot/legacy-to-new-arch/radio-dropdown/frameworks/ui/css/RadioDropdown.module.css +23 -0
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/css/Select.module.css +2 -2
- package/es/library/dot/legacy-to-new-arch/table-column-chooser/frameworks/ui/css/TableColumnChooserView.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/table-column-filter/frameworks/ui/TableColumnFilterView.js +2 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/HighlightedValueField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/highlighted-value-field/frameworks/ui/HighlightedValueFieldView.js +24 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/LabeledAvatarField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/labeled-avatar-field/frameworks/ui/LabeledAvatarFieldView.js +22 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/LinkField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/link-field/frameworks/ui/LinkFieldView.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/EventHandlersFactory.js +32 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownField.js +32 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/RadioDropdownFieldView.js +43 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/radio-dropdown-field/frameworks/ui/css/RadioDropdownField.module.css +3 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/TagField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tag-field/frameworks/ui/TagFieldView.js +34 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/TagsField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-field/frameworks/ui/TagsFieldView.js +18 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownField.js +12 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/tags-list-dropdown-field/frameworks/ui/TagsListDropdownFieldView.js +24 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextField.js +23 -0
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextFieldView.js +20 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/Tag.js +11 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/Tag.module.css +8 -0
- package/es/library/dot/legacy-to-new-arch/tag/frameworks/ui/TagView.js +96 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagContractAdapter.js +24 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagsListDropdown.js +12 -0
- package/es/library/dot/legacy-to-new-arch/tags-list-dropdown/frameworks/ui/TagsListDropdownView.js +42 -0
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/css/TextAreaView.module.css +3 -3
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.module.css +5 -5
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +169 -8
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +11 -2
- package/es/platform/data-source/http-template/fetchLookupFields.js +0 -6
- package/es/platform/data-source/http-template/getComponentMapping.js +17 -0
- package/es/platform/data-source/http-template/getRecords.js +1 -0
- package/es/platform/zform/adapters/gateway/FormRepository.js +3 -1
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +12 -11
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +9 -10
- package/es/platform/zform/domain/ZForm.js +2 -0
- package/es/platform/zlist/adapters/controllers/RefreshRecordsRequestedController.js +21 -0
- package/es/platform/zlist/adapters/controllers/SortController.js +2 -2
- package/es/platform/zlist/adapters/gateways/Repository.js +6 -11
- package/es/platform/zlist/adapters/gateways/Service.js +2 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +9 -6
- package/es/platform/zlist/adapters/presenters/translators/FieldVariations.js +25 -0
- package/es/platform/zlist/adapters/presenters/translators/Header.js +29 -21
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +3 -3
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +7 -4
- package/es/platform/zlist/applications/entities-factory/ListFactory.js +2 -2
- package/es/platform/zlist/applications/interfaces/input/GetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/RefreshRecordsRequestedUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/interfaces/input/SetSortConfigUseCaseInputModel.js +1 -0
- package/es/platform/zlist/applications/usecases/GetSortConfigUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/RecordSuccessCallbackUsecase.js +1 -1
- package/es/platform/zlist/applications/usecases/RefreshRecordsRequestedUseCase.js +17 -0
- package/es/platform/zlist/applications/usecases/SetSortConfigUseCase.js +26 -0
- package/es/platform/zlist/applications/usecases/SortUseCase.js +6 -6
- package/es/platform/zlist/domain/entities/List.js +27 -15
- package/es/platform/zlist/domain/entities/interfaces/Properties.js +5 -5
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +3 -4
- package/es/platform/zlist/frameworks/ZListBehaviourFactory.js +2 -5
- package/es/platform/zrecord/adapters/gateways/Repository.js +5 -2
- package/es/platform/zrecord/applications/entities-factory/RecordsManagerFactory.js +2 -2
- package/es/platform/zrecord/applications/interfaces/input/ClearAllFiltersUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConditionUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/GetFilterConfigUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/RefreshRecordsUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/interfaces/input/SetFilterUseCaseInputModel.js +1 -0
- package/es/platform/zrecord/applications/usecases/ClearAllFiltersUseCase.js +24 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConditionUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/GetFilterConfigUseCase.js +15 -0
- package/es/platform/zrecord/applications/usecases/RefreshRecordsUseCase.js +14 -0
- package/es/platform/zrecord/applications/usecases/SetFilterUseCase.js +24 -0
- package/es/platform/zrecord/domain/entities/Filter.js +247 -0
- package/es/platform/zrecord/domain/entities/RecordsManager.js +19 -1
- package/es/platform/zrecord/domain/entities/interfaces/IFilter.js +1 -0
- package/es/platform/zrecord/frameworks/RecordBehaviourFactory.js +11 -1
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
export default class GetFilterConditionUseCase extends AbstractUseCase {
|
|
3
|
+
execute(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
callback
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
repository
|
|
9
|
+
} = this.dependencies;
|
|
10
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
11
|
+
const filterCondition = recordManager.getFilterCondition();
|
|
12
|
+
callback?.(filterCondition);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
export default class GetFilterConfigUseCase extends AbstractUseCase {
|
|
3
|
+
execute(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
callback
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
repository
|
|
9
|
+
} = this.dependencies;
|
|
10
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
11
|
+
const filterConfig = recordManager.getFilterConfig();
|
|
12
|
+
callback?.(filterConfig);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
export default class RefreshRecordsUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
dispatch
|
|
7
|
+
} = _ref;
|
|
8
|
+
dispatch({
|
|
9
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
10
|
+
metaData: {}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
import { REFRESH_RECORDS_REQUESTED } from "../../../../bc/zrecord/Constants";
|
|
3
|
+
export default class SetFilterUseCase extends AbstractUseCase {
|
|
4
|
+
execute(_ref) {
|
|
5
|
+
let {
|
|
6
|
+
filterConfig,
|
|
7
|
+
dispatch
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
repository,
|
|
11
|
+
presenter
|
|
12
|
+
} = this.dependencies;
|
|
13
|
+
const recordManager = repository.getRecordsManagerEntity();
|
|
14
|
+
recordManager.setFilterConfig(filterConfig);
|
|
15
|
+
presenter.updateRecord(recordManager.toObject());
|
|
16
|
+
dispatch({
|
|
17
|
+
type: REFRESH_RECORDS_REQUESTED,
|
|
18
|
+
metaData: {
|
|
19
|
+
filterConfig
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { CommonComparators, TextComparators, NumberComparators, DateComparators, ConditionTokens } from "../../../../bc/zrecord/Types";
|
|
2
|
+
export class Filter {
|
|
3
|
+
constructor(config, condition, queryString) {
|
|
4
|
+
this.config = config;
|
|
5
|
+
this.condition = condition;
|
|
6
|
+
this.queryString = queryString;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getFilterQuery() {
|
|
10
|
+
return this.queryString;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getConfig() {
|
|
14
|
+
return this.config;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getCondition() {
|
|
18
|
+
return this.condition;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toObject() {
|
|
22
|
+
return {
|
|
23
|
+
config: this.config,
|
|
24
|
+
condition: this.condition,
|
|
25
|
+
queryString: this.queryString
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setConfig(config) {
|
|
30
|
+
const condition = this.convertConfigToCondition(config);
|
|
31
|
+
const queryString = this.convertConditionToQueryStringRecursive(condition);
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.condition = condition;
|
|
34
|
+
this.queryString = queryString;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* input:
|
|
38
|
+
* {
|
|
39
|
+
* conditions: [
|
|
40
|
+
* { fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
41
|
+
* { fieldName: 'quantity', condition: 'is', value: 100 },
|
|
42
|
+
* { fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
43
|
+
* { fieldName: 'discount', condition: 'is not empty', value: null }
|
|
44
|
+
* ],
|
|
45
|
+
* pattern: "((1and2)or(3and4))"
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* output:
|
|
49
|
+
* {
|
|
50
|
+
* type: 'OR',
|
|
51
|
+
* conditions: [
|
|
52
|
+
* {
|
|
53
|
+
* type: 'AND',
|
|
54
|
+
* conditions: [
|
|
55
|
+
* { type: 'CONDITION', fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
56
|
+
* { type: 'CONDITION', fieldName: 'quantity', condition: 'is', value: 100 }
|
|
57
|
+
* ]
|
|
58
|
+
* },
|
|
59
|
+
* {
|
|
60
|
+
* type: 'AND',
|
|
61
|
+
* conditions: [
|
|
62
|
+
* { type: 'CONDITION', fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
63
|
+
* { type: 'CONDITION', fieldName: 'discount', condition: 'is not empty', value: null }
|
|
64
|
+
* ]
|
|
65
|
+
* }
|
|
66
|
+
* ]
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
convertConfigToCondition(config) {
|
|
72
|
+
const {
|
|
73
|
+
conditions,
|
|
74
|
+
pattern
|
|
75
|
+
} = config;
|
|
76
|
+
|
|
77
|
+
if (conditions.length === 0 || pattern.trim() === '') {
|
|
78
|
+
return null;
|
|
79
|
+
} // Tokenize the pattern
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const tokens = this.tokenizePattern(pattern);
|
|
83
|
+
const aliases = this.generateAliases(conditions);
|
|
84
|
+
let pos = 0;
|
|
85
|
+
|
|
86
|
+
const parseExpression = () => {
|
|
87
|
+
if (tokens[pos] === '(') {
|
|
88
|
+
pos++; // skip '('
|
|
89
|
+
|
|
90
|
+
const left = parseExpression();
|
|
91
|
+
|
|
92
|
+
if (pos < tokens.length && tokens[pos] === ')') {
|
|
93
|
+
pos++; // skip ')'
|
|
94
|
+
|
|
95
|
+
return left;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const operator = tokens[pos];
|
|
99
|
+
pos++; // skip operator
|
|
100
|
+
|
|
101
|
+
const right = parseExpression();
|
|
102
|
+
|
|
103
|
+
if (tokens[pos] === ')') {
|
|
104
|
+
pos++; // skip ')'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
type: operator === 'AND' ? ConditionTokens.AND : ConditionTokens.OR,
|
|
109
|
+
conditions: [left, right]
|
|
110
|
+
};
|
|
111
|
+
} else if (/^\d+$/.test(tokens[pos])) {
|
|
112
|
+
const alias = tokens[pos];
|
|
113
|
+
pos++;
|
|
114
|
+
return aliases[alias];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
throw new Error('Invalid pattern');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return parseExpression();
|
|
121
|
+
} // Helper method to tokenize the pattern string (e.g. "(1and2)")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
tokenizePattern(pattern) {
|
|
125
|
+
return pattern.replace(/\(/g, ' ( ').replace(/\)/g, ' ) ').replace(/and/g, ' AND ').replace(/or/g, ' OR ').replace(/not/g, ' NOT ').split(/\s+/).filter(token => token.length > 0);
|
|
126
|
+
} // Helper method to create aliases for the conditions (e.g. "1", "2")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
generateAliases(conditions) {
|
|
130
|
+
const aliases = {};
|
|
131
|
+
conditions.forEach((condition, index) => {
|
|
132
|
+
const alias = String(index + 1); // Starting with "1"
|
|
133
|
+
|
|
134
|
+
aliases[alias] = {
|
|
135
|
+
type: ConditionTokens.CONDITION,
|
|
136
|
+
fieldName: condition.fieldName,
|
|
137
|
+
condition: condition.condition,
|
|
138
|
+
value: condition.value
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
return aliases;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* input:
|
|
145
|
+
* {
|
|
146
|
+
* type: 'OR',
|
|
147
|
+
* conditions: [
|
|
148
|
+
* {
|
|
149
|
+
* type: 'AND',
|
|
150
|
+
* conditions: [
|
|
151
|
+
* { type: 'CONDITION', fieldName: 'productCode', condition: "isn't", value: '12345' },
|
|
152
|
+
* { type: 'CONDITION', fieldName: 'quantity', condition: 'is', value: 100 }
|
|
153
|
+
* ]
|
|
154
|
+
* },
|
|
155
|
+
* {
|
|
156
|
+
* type: 'AND',
|
|
157
|
+
* conditions: [
|
|
158
|
+
* { type: 'CONDITION', fieldName: 'category', condition: 'contains', value: 'electronics' },
|
|
159
|
+
* { type: 'CONDITION', fieldName: 'discount', condition: 'is not empty', value: null }
|
|
160
|
+
* ]
|
|
161
|
+
* }
|
|
162
|
+
* ]
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* output:
|
|
166
|
+
* "((productCode != 12345 AND quantity = 100) OR (category.contains('electronics') AND discount.isNotEmpty()))"
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
convertConditionToQueryStringRecursive(condition) {
|
|
171
|
+
if (!condition) {
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (condition.type === ConditionTokens.CONDITION) {
|
|
176
|
+
const {
|
|
177
|
+
fieldName,
|
|
178
|
+
condition: comp,
|
|
179
|
+
value
|
|
180
|
+
} = condition;
|
|
181
|
+
|
|
182
|
+
switch (comp) {
|
|
183
|
+
case CommonComparators.ISEMPTY:
|
|
184
|
+
return `${fieldName}.isEmpty()`;
|
|
185
|
+
|
|
186
|
+
case CommonComparators.ISNOTEMPTY:
|
|
187
|
+
return `${fieldName}.isNotEmpty()`;
|
|
188
|
+
|
|
189
|
+
case TextComparators.IS:
|
|
190
|
+
return `${fieldName} = '${value}'`;
|
|
191
|
+
|
|
192
|
+
case TextComparators.ISNT:
|
|
193
|
+
return `${fieldName} != '${value}'`;
|
|
194
|
+
|
|
195
|
+
case TextComparators.STARTSWITH:
|
|
196
|
+
return `${fieldName}.startsWith('${value}')`;
|
|
197
|
+
|
|
198
|
+
case TextComparators.ENDSWITH:
|
|
199
|
+
return `${fieldName}.endsWith('${value}')`;
|
|
200
|
+
|
|
201
|
+
case TextComparators.CONTAINS:
|
|
202
|
+
return `${fieldName}.contains('${value}')`;
|
|
203
|
+
|
|
204
|
+
case TextComparators.DOESNTCONTAIN:
|
|
205
|
+
return `!${fieldName}.contains('${value}')`;
|
|
206
|
+
|
|
207
|
+
case NumberComparators.EQUAL:
|
|
208
|
+
return `${fieldName} = ${value}`;
|
|
209
|
+
|
|
210
|
+
case NumberComparators.NOTEQUAL:
|
|
211
|
+
return `${fieldName} != ${value}`;
|
|
212
|
+
|
|
213
|
+
case NumberComparators.LESSTHAN:
|
|
214
|
+
return `${fieldName} < ${value}`;
|
|
215
|
+
|
|
216
|
+
case NumberComparators.LESSTHANEQUAL:
|
|
217
|
+
return `${fieldName} <= ${value}`;
|
|
218
|
+
|
|
219
|
+
case NumberComparators.GREATERTHAN:
|
|
220
|
+
return `${fieldName} > ${value}`;
|
|
221
|
+
|
|
222
|
+
case NumberComparators.GREATERTHANEQUAL:
|
|
223
|
+
return `${fieldName} >= ${value}`;
|
|
224
|
+
|
|
225
|
+
case DateComparators.ISAFTER:
|
|
226
|
+
return `${fieldName} > '${value}'`;
|
|
227
|
+
|
|
228
|
+
case DateComparators.ISBEFORE:
|
|
229
|
+
return `${fieldName} < '${value}'`;
|
|
230
|
+
|
|
231
|
+
case DateComparators.BETWEEN:
|
|
232
|
+
return `${fieldName}.between('${value.start}', '${value.end}')`;
|
|
233
|
+
|
|
234
|
+
case DateComparators.NOTBETWEEN:
|
|
235
|
+
return `!${fieldName}.between('${value.start}', '${value.end}')`;
|
|
236
|
+
|
|
237
|
+
default:
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
const operator = condition.type === ConditionTokens.AND ? ' AND ' : ' OR ';
|
|
242
|
+
const parts = condition.conditions.map(c => this.convertConditionToQueryStringRecursive(c));
|
|
243
|
+
return `(${parts.join(operator)})`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
}
|
|
@@ -14,11 +14,16 @@ const recordExecuteStrategiesMap = {
|
|
|
14
14
|
[RecordApiActionName.GET_REORDERRECORD]: new GetReOrderRecordsStrategy()
|
|
15
15
|
};
|
|
16
16
|
export default class RecordsManager {
|
|
17
|
-
constructor(records) {
|
|
17
|
+
constructor(records, filter) {
|
|
18
18
|
this.records = records;
|
|
19
|
+
this.filter = filter;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
createDataSourceExecuteEvent(props, actionName, metaData) {
|
|
23
|
+
if (actionName === RecordApiActionName.GET_RECORDS && props.filter === undefined) {
|
|
24
|
+
props.filter = this.filter.getFilterQuery();
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
return {
|
|
23
28
|
type: DATA_SOURCE_EXECUTE,
|
|
24
29
|
payload: {
|
|
@@ -249,6 +254,18 @@ export default class RecordsManager {
|
|
|
249
254
|
this.records.updateRecord(recordId, record);
|
|
250
255
|
}
|
|
251
256
|
|
|
257
|
+
getFilterCondition() {
|
|
258
|
+
return this.filter.getCondition();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getFilterConfig() {
|
|
262
|
+
return this.filter.getConfig();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
setFilterConfig(filterConfig) {
|
|
266
|
+
this.filter.setConfig(filterConfig);
|
|
267
|
+
}
|
|
268
|
+
|
|
252
269
|
deleteMultipleRecord(recordIds) {
|
|
253
270
|
this.records.deleteMultipleRecord(recordIds);
|
|
254
271
|
}
|
|
@@ -260,6 +277,7 @@ export default class RecordsManager {
|
|
|
260
277
|
toObject() {
|
|
261
278
|
const recordsObj = this.records.toObject();
|
|
262
279
|
return {
|
|
280
|
+
filter: this.filter.toObject(),
|
|
263
281
|
records: recordsObj.data,
|
|
264
282
|
hasMore: recordsObj.hasMore,
|
|
265
283
|
isFetching: recordsObj.isFetching
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import ActionsHandlersFactory from "./ActionsHandlersFactory";
|
|
2
|
+
import { initialFilterConfig } from "../../../bc/zrecord/Types";
|
|
2
3
|
export default class RecordBehaviourFactory {
|
|
3
4
|
static create(apiDetails) {
|
|
4
5
|
return {
|
|
5
6
|
name: 'zrecord',
|
|
6
7
|
eventHandlers: ActionsHandlersFactory.create(apiDetails),
|
|
7
8
|
properties: {},
|
|
8
|
-
setInitialState: () =>
|
|
9
|
+
setInitialState: () => {
|
|
10
|
+
const filterRestoreObjectInitial = {
|
|
11
|
+
config: initialFilterConfig,
|
|
12
|
+
condition: null,
|
|
13
|
+
queryString: ''
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
filter: filterRestoreObjectInitial
|
|
17
|
+
};
|
|
18
|
+
}
|
|
9
19
|
};
|
|
10
20
|
}
|
|
11
21
|
|
package/package.json
CHANGED