@zeedhi/common 1.105.1 → 1.106.1
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/zd-common.esm.js +195 -16
- package/dist/zd-common.umd.js +194 -14
- package/package.json +2 -2
- package/types/components/zd-iterable/column.d.ts +2 -1
- package/types/components/zd-iterable/interfaces.d.ts +3 -0
- package/types/components/zd-iterable/iterable-controller.d.ts +4 -0
- package/types/components/zd-iterable/iterable.d.ts +1 -0
- package/types/components/zd-iterable/search.d.ts +1 -1
- package/types/components/zd-select/interfaces.d.ts +3 -0
- package/types/components/zd-select/select.d.ts +12 -2
- package/types/utils/report/errors/empty-data-error.d.ts +6 -0
- package/types/utils/report/index.d.ts +1 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessorManager, Event, KeyMap, MethodNotAssignedError, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, ViewService, MemoryDatasource, URL as URL$1, Http, Cookie, VersionService } from '@zeedhi/core';
|
|
1
|
+
import { AccessorManager, Event, KeyMap, MethodNotAssignedError, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, ViewService, MemoryDatasource, URL as URL$1, Http, Messages, Cookie, VersionService } from '@zeedhi/core';
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import cloneDeep from 'lodash.clonedeep';
|
|
4
4
|
import debounce from 'lodash.debounce';
|
|
@@ -1914,7 +1914,7 @@ class Input extends ComponentRender {
|
|
|
1914
1914
|
this.internalDisplayValue = '';
|
|
1915
1915
|
this.internalValue = null;
|
|
1916
1916
|
this.formParent = this.getFormParent();
|
|
1917
|
-
this.lastInputValue =
|
|
1917
|
+
this.lastInputValue = '';
|
|
1918
1918
|
this.callInputEvent = debounce(({ event, element, component }) => {
|
|
1919
1919
|
this.callEvent('input', { event, element, component });
|
|
1920
1920
|
}, 50);
|
|
@@ -5396,6 +5396,8 @@ class Column extends Component {
|
|
|
5396
5396
|
this.actionFactoredConditions = {};
|
|
5397
5397
|
this.helperText = '';
|
|
5398
5398
|
this.defaultData = [];
|
|
5399
|
+
/* Column search mode */
|
|
5400
|
+
this.searchMode = 'any';
|
|
5399
5401
|
this.lookup = debounce((lookupColumn) => {
|
|
5400
5402
|
this.loading = true;
|
|
5401
5403
|
const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
|
|
@@ -5426,6 +5428,7 @@ class Column extends Component {
|
|
|
5426
5428
|
this.componentProps = this.getInitValue('componentProps', props.componentProps, this.componentProps);
|
|
5427
5429
|
this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
|
|
5428
5430
|
this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
|
|
5431
|
+
this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
|
|
5429
5432
|
this.helperText = this.getInitValue('', props.helperText, this.helperText);
|
|
5430
5433
|
this.createConditions();
|
|
5431
5434
|
this.createActionConditions();
|
|
@@ -5586,6 +5589,7 @@ class ColumnNotFoundError extends Error {
|
|
|
5586
5589
|
class IterableController {
|
|
5587
5590
|
constructor(iterable) {
|
|
5588
5591
|
this.searchInValue = undefined;
|
|
5592
|
+
this.searchInParamsValue = undefined;
|
|
5589
5593
|
this.iterable = iterable;
|
|
5590
5594
|
}
|
|
5591
5595
|
get searchIn() {
|
|
@@ -5598,6 +5602,16 @@ class IterableController {
|
|
|
5598
5602
|
set searchIn(value) {
|
|
5599
5603
|
this.searchInValue = value;
|
|
5600
5604
|
}
|
|
5605
|
+
get searchInParams() {
|
|
5606
|
+
return this.searchInParamsValue || this.iterable.columns.reduce((result, column) => {
|
|
5607
|
+
if (!!column.searchMode && column.searchMode !== 'any')
|
|
5608
|
+
result[column.name] = column.searchMode;
|
|
5609
|
+
return result;
|
|
5610
|
+
}, {});
|
|
5611
|
+
}
|
|
5612
|
+
set searchInParams(value) {
|
|
5613
|
+
this.searchInParamsValue = value;
|
|
5614
|
+
}
|
|
5601
5615
|
}
|
|
5602
5616
|
|
|
5603
5617
|
/**
|
|
@@ -5646,12 +5660,13 @@ class Iterable extends ComponentRender {
|
|
|
5646
5660
|
this.searchVisibleOnly = this.getInitValue('searchVisibleOnly', props.searchVisibleOnly, this.defaultSearchVisibleOnly);
|
|
5647
5661
|
this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
|
|
5648
5662
|
this.virtualScrollCache = this.getInitValue('virtualScrollCache', props.virtualScrollCache, this.virtualScrollCache);
|
|
5663
|
+
this.searchIn = this.getInitValue('searchIn', props.searchIn, this.searchIn);
|
|
5649
5664
|
}
|
|
5650
5665
|
getDatasourceDefaults() {
|
|
5651
5666
|
return {};
|
|
5652
5667
|
}
|
|
5653
5668
|
initializeDatasource(props) {
|
|
5654
|
-
var _a;
|
|
5669
|
+
var _a, _b;
|
|
5655
5670
|
let datasourceProps = props.datasource;
|
|
5656
5671
|
// if using accessor, get props from the controller
|
|
5657
5672
|
if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
|
|
@@ -5659,7 +5674,7 @@ class Iterable extends ComponentRender {
|
|
|
5659
5674
|
const instance = Loader.getInstance(controller);
|
|
5660
5675
|
datasourceProps = instance[accessor];
|
|
5661
5676
|
}
|
|
5662
|
-
this.datasource = DatasourceFactory.factory(Object.assign(Object.assign(Object.assign({}, datasourceProps), this.getDatasourceDefaults()), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
|
|
5677
|
+
this.datasource = DatasourceFactory.factory(Object.assign(Object.assign(Object.assign({}, datasourceProps), this.getDatasourceDefaults()), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}`, searchInParams: ((_b = props.datasource) === null || _b === void 0 ? void 0 : _b.searchInParams) || `{{IterableController_${this.name}.searchInParams}}` }));
|
|
5663
5678
|
}
|
|
5664
5679
|
createController() {
|
|
5665
5680
|
const controller = new IterableController(this);
|
|
@@ -5762,7 +5777,7 @@ class Iterable extends ComponentRender {
|
|
|
5762
5777
|
});
|
|
5763
5778
|
}
|
|
5764
5779
|
isColumnSearchable(column) {
|
|
5765
|
-
return !this.searchVisibleOnly || column.isVisible;
|
|
5780
|
+
return (!this.searchVisibleOnly || column.isVisible) && (this.searchIn === undefined || this.searchIn === column.name);
|
|
5766
5781
|
}
|
|
5767
5782
|
}
|
|
5768
5783
|
|
|
@@ -5897,7 +5912,7 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
|
|
|
5897
5912
|
});
|
|
5898
5913
|
}
|
|
5899
5914
|
}
|
|
5900
|
-
const textColumn =
|
|
5915
|
+
const textColumn = dataTextDiscrete || formatterDataText || dataTextForeign;
|
|
5901
5916
|
if (!textColumn)
|
|
5902
5917
|
return value;
|
|
5903
5918
|
if (typeof textColumn === 'string') {
|
|
@@ -7893,6 +7908,7 @@ Icons.mdiIcons = {
|
|
|
7893
7908
|
success: 'mdi-check-circle',
|
|
7894
7909
|
tableConfig: 'mdi-table-cog',
|
|
7895
7910
|
tableColumns: 'mdi-table-headers-eye',
|
|
7911
|
+
tableSearch: 'mdi-table-search',
|
|
7896
7912
|
unfold: 'mdi-unfold-more-horizontal',
|
|
7897
7913
|
warning: 'mdi-exclamation',
|
|
7898
7914
|
zoom: 'mdi-magnify',
|
|
@@ -7951,6 +7967,7 @@ Icons.faIcons = {
|
|
|
7951
7967
|
success: 'fa fa-check-circle',
|
|
7952
7968
|
tableConfig: 'fa fa-columns',
|
|
7953
7969
|
tableColumns: 'fa fa-columns',
|
|
7970
|
+
tableSearch: 'fa fa-search',
|
|
7954
7971
|
unfold: 'fa fa-sort',
|
|
7955
7972
|
warning: 'fa fa-exclamation',
|
|
7956
7973
|
zoom: 'fa fa-search',
|
|
@@ -8994,6 +9011,16 @@ class GroupedPDFFormatter {
|
|
|
8994
9011
|
}
|
|
8995
9012
|
}
|
|
8996
9013
|
|
|
9014
|
+
/**
|
|
9015
|
+
* Empty data error
|
|
9016
|
+
*/
|
|
9017
|
+
class EmptyDataError extends Error {
|
|
9018
|
+
constructor() {
|
|
9019
|
+
super('Can\'t get report when datasource is empty');
|
|
9020
|
+
this.name = 'EmptyDataError';
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9023
|
+
|
|
8997
9024
|
class Report {
|
|
8998
9025
|
constructor(iterable, title) {
|
|
8999
9026
|
this.endPoint = Config.reportsEndPoint;
|
|
@@ -9042,6 +9069,9 @@ class Report {
|
|
|
9042
9069
|
var _a;
|
|
9043
9070
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9044
9071
|
const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
|
|
9072
|
+
if (!data || data.length === 0) {
|
|
9073
|
+
throw new EmptyDataError();
|
|
9074
|
+
}
|
|
9045
9075
|
const origin = {
|
|
9046
9076
|
containerLabel: this.title,
|
|
9047
9077
|
widgetLabel: this.title,
|
|
@@ -9644,6 +9674,10 @@ class Select extends TextInput {
|
|
|
9644
9674
|
*/
|
|
9645
9675
|
this.dataValueOutFormName = '';
|
|
9646
9676
|
this.closeOnScroll = true;
|
|
9677
|
+
/* Defines if should open modal with grid to make the selection */
|
|
9678
|
+
this.modalSelection = false;
|
|
9679
|
+
/* Defines fields to show on modal */
|
|
9680
|
+
this.modalSelectionFields = [];
|
|
9647
9681
|
this.dsSearch = {
|
|
9648
9682
|
SEARCH: (value, searchIn) => ({
|
|
9649
9683
|
searchIn: [searchIn],
|
|
@@ -9679,6 +9713,7 @@ class Select extends TextInput {
|
|
|
9679
9713
|
this.pushedValue = null;
|
|
9680
9714
|
this.loadMoreQtty = 0;
|
|
9681
9715
|
this.debounceSearch = debounce(this.doSearch, 500);
|
|
9716
|
+
this.modalSelectionObj = undefined;
|
|
9682
9717
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
9683
9718
|
this.dataText = this.getInitValue('dataText', props.dataText, this.dataText);
|
|
9684
9719
|
this.dataTextDiscrete = this.getInitValue('dataTextDiscrete', props.dataTextDiscrete, this.dataTextDiscrete);
|
|
@@ -9697,6 +9732,8 @@ class Select extends TextInput {
|
|
|
9697
9732
|
this.dataValueOut = this.getInitValue('dataValueOut', props.dataValueOut, this.dataValueOut);
|
|
9698
9733
|
this.dataValueOutFormName = this.getInitValue('dataValueOutFormName', props.dataValueOutFormName, this.dataValueOutFormName);
|
|
9699
9734
|
this.closeOnScroll = this.getInitValue('closeOnScroll', props.closeOnScroll, this.closeOnScroll);
|
|
9735
|
+
this.modalSelection = this.getInitValue('modalSelection', props.modalSelection, this.modalSelection);
|
|
9736
|
+
this.modalSelectionFields = this.getInitValue('modalSelectionFields', props.modalSelectionFields, this.modalSelectionFields);
|
|
9700
9737
|
if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
|
|
9701
9738
|
this.dataValue = 'value';
|
|
9702
9739
|
this.dataText = this.dataText || this.dataValue;
|
|
@@ -9709,8 +9746,8 @@ class Select extends TextInput {
|
|
|
9709
9746
|
dataText: this.dataTextDiscrete,
|
|
9710
9747
|
dataTextSeparator: this.dataTextSeparator,
|
|
9711
9748
|
};
|
|
9712
|
-
|
|
9713
|
-
this.datasource = DatasourceFactory.factory(defaultDatasource);
|
|
9749
|
+
this.defaultDatasource = this.getDefaultDatasource(props);
|
|
9750
|
+
this.datasource = DatasourceFactory.factory(this.defaultDatasource);
|
|
9714
9751
|
this.overrideGet();
|
|
9715
9752
|
let defaultValue = props.value;
|
|
9716
9753
|
if (Accessor.isAccessorDefinition(props.value)) {
|
|
@@ -9718,7 +9755,7 @@ class Select extends TextInput {
|
|
|
9718
9755
|
this.getInitValue('value', props.value, this.value);
|
|
9719
9756
|
}
|
|
9720
9757
|
this.setDefaultValue(defaultValue, (_b = props.datasource) === null || _b === void 0 ? void 0 : _b.lazyLoad);
|
|
9721
|
-
this.preventLoadOnFocus = !defaultDatasource.lazyLoad;
|
|
9758
|
+
this.preventLoadOnFocus = !this.defaultDatasource.lazyLoad;
|
|
9722
9759
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
9723
9760
|
this.loadMoreQtty = this.datasource.limit;
|
|
9724
9761
|
this.itemAfterSlot = props.itemAfterSlot || this.itemAfterSlot;
|
|
@@ -9732,6 +9769,31 @@ class Select extends TextInput {
|
|
|
9732
9769
|
const instance = Loader.getInstance(controller);
|
|
9733
9770
|
return instance[accessor];
|
|
9734
9771
|
}
|
|
9772
|
+
onMounted(element) {
|
|
9773
|
+
super.onMounted(element);
|
|
9774
|
+
if (this.modalSelection && this.modalSelectionFields.length) {
|
|
9775
|
+
KeyMap.bind({
|
|
9776
|
+
'shift+enter': {
|
|
9777
|
+
active: true,
|
|
9778
|
+
input: true,
|
|
9779
|
+
stop: true,
|
|
9780
|
+
prevent: true,
|
|
9781
|
+
event: this.openModalSelection.bind(this),
|
|
9782
|
+
},
|
|
9783
|
+
}, this, element);
|
|
9784
|
+
}
|
|
9785
|
+
}
|
|
9786
|
+
onBeforeDestroy() {
|
|
9787
|
+
super.onBeforeDestroy();
|
|
9788
|
+
this.datasource.destroy();
|
|
9789
|
+
if (this.modalSelection && this.modalSelectionFields.length) {
|
|
9790
|
+
KeyMap.unbind({
|
|
9791
|
+
'shift+enter': {
|
|
9792
|
+
event: this.openModalSelection.bind(this),
|
|
9793
|
+
},
|
|
9794
|
+
}, this);
|
|
9795
|
+
}
|
|
9796
|
+
}
|
|
9735
9797
|
/**
|
|
9736
9798
|
* Retrieves datasource structure applying infinity scroll
|
|
9737
9799
|
* @param field Field structure
|
|
@@ -10106,10 +10168,6 @@ class Select extends TextInput {
|
|
|
10106
10168
|
&& !this.datasource.loadAll
|
|
10107
10169
|
&& this.datasource.data.length - (this.pushedValue ? 1 : 0) < this.datasource.total;
|
|
10108
10170
|
}
|
|
10109
|
-
onBeforeDestroy() {
|
|
10110
|
-
super.onBeforeDestroy();
|
|
10111
|
-
this.datasource.destroy();
|
|
10112
|
-
}
|
|
10113
10171
|
indexOf(search) {
|
|
10114
10172
|
const value = search && typeof search === 'object' ? search[this.dataValue] : search;
|
|
10115
10173
|
return this.datasource.data.findIndex((row) => row[this.dataValue] === value);
|
|
@@ -10117,6 +10175,109 @@ class Select extends TextInput {
|
|
|
10117
10175
|
isFilledObj(obj) {
|
|
10118
10176
|
return obj && typeof obj === 'object' && !Array.isArray(obj) && Object.keys(obj).length;
|
|
10119
10177
|
}
|
|
10178
|
+
hideModalSelection() {
|
|
10179
|
+
if (this.modalSelectionObj)
|
|
10180
|
+
this.modalSelectionObj.hide();
|
|
10181
|
+
}
|
|
10182
|
+
modalSelectionGridClick({ row }) {
|
|
10183
|
+
this.setValue(row);
|
|
10184
|
+
this.hideModalSelection();
|
|
10185
|
+
setTimeout(() => {
|
|
10186
|
+
if (this.viewCloseMenu)
|
|
10187
|
+
this.viewCloseMenu();
|
|
10188
|
+
}, 200);
|
|
10189
|
+
}
|
|
10190
|
+
openModalSelection() {
|
|
10191
|
+
const modalSelectionDef = {
|
|
10192
|
+
name: `${this.name}-modal-selection`,
|
|
10193
|
+
persistent: true,
|
|
10194
|
+
escKeydownStop: false,
|
|
10195
|
+
children: [
|
|
10196
|
+
{
|
|
10197
|
+
name: `${this.name}-modal-selection-content-container`,
|
|
10198
|
+
component: 'ZdContainer',
|
|
10199
|
+
scrollView: true,
|
|
10200
|
+
cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-content-container',
|
|
10201
|
+
children: [
|
|
10202
|
+
{
|
|
10203
|
+
name: `${this.name}-modal-selection-grid`,
|
|
10204
|
+
component: 'ZdGrid',
|
|
10205
|
+
cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
|
|
10206
|
+
columns: this.modalSelectionFields,
|
|
10207
|
+
datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
|
|
10208
|
+
toolbarSlot: [
|
|
10209
|
+
{
|
|
10210
|
+
name: `${this.name}-modal-selection-title`,
|
|
10211
|
+
component: 'ZdText',
|
|
10212
|
+
cssStyle: `color: ${'var(--v-primary-base);'}`,
|
|
10213
|
+
text: this.label,
|
|
10214
|
+
tag: 'h3',
|
|
10215
|
+
},
|
|
10216
|
+
{
|
|
10217
|
+
name: `${this.name}-modal-selection-spacer`,
|
|
10218
|
+
component: 'VSpacer',
|
|
10219
|
+
},
|
|
10220
|
+
{
|
|
10221
|
+
name: `${this.name}-modal-selection_gridSearch`,
|
|
10222
|
+
component: 'ZdSearch',
|
|
10223
|
+
cssClass: 'zd-grid-search',
|
|
10224
|
+
autofocus: true,
|
|
10225
|
+
},
|
|
10226
|
+
],
|
|
10227
|
+
events: {
|
|
10228
|
+
rowClick: this.modalSelectionGridClick.bind(this),
|
|
10229
|
+
},
|
|
10230
|
+
},
|
|
10231
|
+
],
|
|
10232
|
+
},
|
|
10233
|
+
{
|
|
10234
|
+
name: `${this.name}-modal-selection-footer-container`,
|
|
10235
|
+
component: 'ZdContainer',
|
|
10236
|
+
cssClass: 'zd-pa-0',
|
|
10237
|
+
children: [
|
|
10238
|
+
{
|
|
10239
|
+
name: `${this.name}-modal-selection-footer`,
|
|
10240
|
+
component: 'ZdFooter',
|
|
10241
|
+
color: 'transparent',
|
|
10242
|
+
padless: true,
|
|
10243
|
+
rightSlot: [
|
|
10244
|
+
{
|
|
10245
|
+
name: `${this.name}-modal-selection-cancelButton`,
|
|
10246
|
+
component: 'ZdButton',
|
|
10247
|
+
label: 'CANCEL',
|
|
10248
|
+
keyMap: {
|
|
10249
|
+
esc: {
|
|
10250
|
+
event: this.hideModalSelection.bind(this),
|
|
10251
|
+
focus: true,
|
|
10252
|
+
visible: true,
|
|
10253
|
+
input: true,
|
|
10254
|
+
stop: true,
|
|
10255
|
+
},
|
|
10256
|
+
},
|
|
10257
|
+
outline: true,
|
|
10258
|
+
events: {
|
|
10259
|
+
click: this.hideModalSelection.bind(this),
|
|
10260
|
+
},
|
|
10261
|
+
},
|
|
10262
|
+
],
|
|
10263
|
+
},
|
|
10264
|
+
],
|
|
10265
|
+
},
|
|
10266
|
+
],
|
|
10267
|
+
events: {
|
|
10268
|
+
onShow: () => {
|
|
10269
|
+
const grid = Metadata.getInstance(`${this.name}-modal-selection-grid`);
|
|
10270
|
+
grid.datasource.currentRow = {};
|
|
10271
|
+
},
|
|
10272
|
+
},
|
|
10273
|
+
};
|
|
10274
|
+
if (this.modalSelectionObj)
|
|
10275
|
+
this.modalSelectionObj.destroy();
|
|
10276
|
+
ViewService.nextTick(() => {
|
|
10277
|
+
this.modalSelectionObj = ModalService.create(modalSelectionDef);
|
|
10278
|
+
this.modalSelectionObj.show();
|
|
10279
|
+
});
|
|
10280
|
+
}
|
|
10120
10281
|
}
|
|
10121
10282
|
FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
|
|
10122
10283
|
if (value === null || value === undefined) {
|
|
@@ -10157,7 +10318,24 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
|
|
|
10157
10318
|
return result;
|
|
10158
10319
|
}, '');
|
|
10159
10320
|
});
|
|
10160
|
-
InputFactory.register('ZdSelect', Select);
|
|
10321
|
+
InputFactory.register('ZdSelect', Select);
|
|
10322
|
+
Messages.add({
|
|
10323
|
+
'pt-BR': {
|
|
10324
|
+
translation: {
|
|
10325
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) para abrir modal',
|
|
10326
|
+
},
|
|
10327
|
+
},
|
|
10328
|
+
'en-US': {
|
|
10329
|
+
translation: {
|
|
10330
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) to open modal',
|
|
10331
|
+
},
|
|
10332
|
+
},
|
|
10333
|
+
'es-ES': {
|
|
10334
|
+
translation: {
|
|
10335
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) para abrir el modal',
|
|
10336
|
+
},
|
|
10337
|
+
},
|
|
10338
|
+
});
|
|
10161
10339
|
|
|
10162
10340
|
/**
|
|
10163
10341
|
* Base class for Iterable Page Size component
|
|
@@ -10303,6 +10481,7 @@ class Search extends TextInput {
|
|
|
10303
10481
|
this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
|
|
10304
10482
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
|
|
10305
10483
|
this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
|
|
10484
|
+
this.debounceSetSearch = this.debounceSetSearch.bind(this);
|
|
10306
10485
|
if (!this.lazyAttach)
|
|
10307
10486
|
this.setIterableComponent();
|
|
10308
10487
|
this.createAccessors();
|
|
@@ -10321,7 +10500,7 @@ class Search extends TextInput {
|
|
|
10321
10500
|
}
|
|
10322
10501
|
setSearch(search) {
|
|
10323
10502
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10324
|
-
yield this.iterableComponent.setSearch(search);
|
|
10503
|
+
yield this.iterableComponent.setSearch(search.component.internalValue);
|
|
10325
10504
|
});
|
|
10326
10505
|
}
|
|
10327
10506
|
}
|
|
@@ -15332,4 +15511,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
|
15332
15511
|
const packageContent = require('../package.json');
|
|
15333
15512
|
VersionService.addPackageVersion(packageContent.name, packageContent.version);
|
|
15334
15513
|
|
|
15335
|
-
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, DataValueOutHelper, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GroupedPDFFormatter, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
|
15514
|
+
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, DataValueOutHelper, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, EmptyDataError, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, GroupedPDFFormatter, Header, Icon, Icons, Image, Increment, Input, InputFactory, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -1921,7 +1921,7 @@
|
|
|
1921
1921
|
this.internalDisplayValue = '';
|
|
1922
1922
|
this.internalValue = null;
|
|
1923
1923
|
this.formParent = this.getFormParent();
|
|
1924
|
-
this.lastInputValue =
|
|
1924
|
+
this.lastInputValue = '';
|
|
1925
1925
|
this.callInputEvent = debounce__default["default"](({ event, element, component }) => {
|
|
1926
1926
|
this.callEvent('input', { event, element, component });
|
|
1927
1927
|
}, 50);
|
|
@@ -5403,6 +5403,8 @@
|
|
|
5403
5403
|
this.actionFactoredConditions = {};
|
|
5404
5404
|
this.helperText = '';
|
|
5405
5405
|
this.defaultData = [];
|
|
5406
|
+
/* Column search mode */
|
|
5407
|
+
this.searchMode = 'any';
|
|
5406
5408
|
this.lookup = debounce__default["default"]((lookupColumn) => {
|
|
5407
5409
|
this.loading = true;
|
|
5408
5410
|
const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
|
|
@@ -5433,6 +5435,7 @@
|
|
|
5433
5435
|
this.componentProps = this.getInitValue('componentProps', props.componentProps, this.componentProps);
|
|
5434
5436
|
this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
|
|
5435
5437
|
this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
|
|
5438
|
+
this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
|
|
5436
5439
|
this.helperText = this.getInitValue('', props.helperText, this.helperText);
|
|
5437
5440
|
this.createConditions();
|
|
5438
5441
|
this.createActionConditions();
|
|
@@ -5593,6 +5596,7 @@
|
|
|
5593
5596
|
class IterableController {
|
|
5594
5597
|
constructor(iterable) {
|
|
5595
5598
|
this.searchInValue = undefined;
|
|
5599
|
+
this.searchInParamsValue = undefined;
|
|
5596
5600
|
this.iterable = iterable;
|
|
5597
5601
|
}
|
|
5598
5602
|
get searchIn() {
|
|
@@ -5605,6 +5609,16 @@
|
|
|
5605
5609
|
set searchIn(value) {
|
|
5606
5610
|
this.searchInValue = value;
|
|
5607
5611
|
}
|
|
5612
|
+
get searchInParams() {
|
|
5613
|
+
return this.searchInParamsValue || this.iterable.columns.reduce((result, column) => {
|
|
5614
|
+
if (!!column.searchMode && column.searchMode !== 'any')
|
|
5615
|
+
result[column.name] = column.searchMode;
|
|
5616
|
+
return result;
|
|
5617
|
+
}, {});
|
|
5618
|
+
}
|
|
5619
|
+
set searchInParams(value) {
|
|
5620
|
+
this.searchInParamsValue = value;
|
|
5621
|
+
}
|
|
5608
5622
|
}
|
|
5609
5623
|
|
|
5610
5624
|
/**
|
|
@@ -5653,12 +5667,13 @@
|
|
|
5653
5667
|
this.searchVisibleOnly = this.getInitValue('searchVisibleOnly', props.searchVisibleOnly, this.defaultSearchVisibleOnly);
|
|
5654
5668
|
this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
|
|
5655
5669
|
this.virtualScrollCache = this.getInitValue('virtualScrollCache', props.virtualScrollCache, this.virtualScrollCache);
|
|
5670
|
+
this.searchIn = this.getInitValue('searchIn', props.searchIn, this.searchIn);
|
|
5656
5671
|
}
|
|
5657
5672
|
getDatasourceDefaults() {
|
|
5658
5673
|
return {};
|
|
5659
5674
|
}
|
|
5660
5675
|
initializeDatasource(props) {
|
|
5661
|
-
var _a;
|
|
5676
|
+
var _a, _b;
|
|
5662
5677
|
let datasourceProps = props.datasource;
|
|
5663
5678
|
// if using accessor, get props from the controller
|
|
5664
5679
|
if (typeof props.datasource === 'string' && core.Accessor.isAccessorDefinition(props.datasource)) {
|
|
@@ -5666,7 +5681,7 @@
|
|
|
5666
5681
|
const instance = core.Loader.getInstance(controller);
|
|
5667
5682
|
datasourceProps = instance[accessor];
|
|
5668
5683
|
}
|
|
5669
|
-
this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign(Object.assign({}, datasourceProps), this.getDatasourceDefaults()), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
|
|
5684
|
+
this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign(Object.assign({}, datasourceProps), this.getDatasourceDefaults()), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}`, searchInParams: ((_b = props.datasource) === null || _b === void 0 ? void 0 : _b.searchInParams) || `{{IterableController_${this.name}.searchInParams}}` }));
|
|
5670
5685
|
}
|
|
5671
5686
|
createController() {
|
|
5672
5687
|
const controller = new IterableController(this);
|
|
@@ -5769,7 +5784,7 @@
|
|
|
5769
5784
|
});
|
|
5770
5785
|
}
|
|
5771
5786
|
isColumnSearchable(column) {
|
|
5772
|
-
return !this.searchVisibleOnly || column.isVisible;
|
|
5787
|
+
return (!this.searchVisibleOnly || column.isVisible) && (this.searchIn === undefined || this.searchIn === column.name);
|
|
5773
5788
|
}
|
|
5774
5789
|
}
|
|
5775
5790
|
|
|
@@ -5904,7 +5919,7 @@
|
|
|
5904
5919
|
});
|
|
5905
5920
|
}
|
|
5906
5921
|
}
|
|
5907
|
-
const textColumn =
|
|
5922
|
+
const textColumn = dataTextDiscrete || formatterDataText || dataTextForeign;
|
|
5908
5923
|
if (!textColumn)
|
|
5909
5924
|
return value;
|
|
5910
5925
|
if (typeof textColumn === 'string') {
|
|
@@ -7900,6 +7915,7 @@
|
|
|
7900
7915
|
success: 'mdi-check-circle',
|
|
7901
7916
|
tableConfig: 'mdi-table-cog',
|
|
7902
7917
|
tableColumns: 'mdi-table-headers-eye',
|
|
7918
|
+
tableSearch: 'mdi-table-search',
|
|
7903
7919
|
unfold: 'mdi-unfold-more-horizontal',
|
|
7904
7920
|
warning: 'mdi-exclamation',
|
|
7905
7921
|
zoom: 'mdi-magnify',
|
|
@@ -7958,6 +7974,7 @@
|
|
|
7958
7974
|
success: 'fa fa-check-circle',
|
|
7959
7975
|
tableConfig: 'fa fa-columns',
|
|
7960
7976
|
tableColumns: 'fa fa-columns',
|
|
7977
|
+
tableSearch: 'fa fa-search',
|
|
7961
7978
|
unfold: 'fa fa-sort',
|
|
7962
7979
|
warning: 'fa fa-exclamation',
|
|
7963
7980
|
zoom: 'fa fa-search',
|
|
@@ -9001,6 +9018,16 @@
|
|
|
9001
9018
|
}
|
|
9002
9019
|
}
|
|
9003
9020
|
|
|
9021
|
+
/**
|
|
9022
|
+
* Empty data error
|
|
9023
|
+
*/
|
|
9024
|
+
class EmptyDataError extends Error {
|
|
9025
|
+
constructor() {
|
|
9026
|
+
super('Can\'t get report when datasource is empty');
|
|
9027
|
+
this.name = 'EmptyDataError';
|
|
9028
|
+
}
|
|
9029
|
+
}
|
|
9030
|
+
|
|
9004
9031
|
class Report {
|
|
9005
9032
|
constructor(iterable, title) {
|
|
9006
9033
|
this.endPoint = core.Config.reportsEndPoint;
|
|
@@ -9049,6 +9076,9 @@
|
|
|
9049
9076
|
var _a;
|
|
9050
9077
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9051
9078
|
const data = (_a = this.data) !== null && _a !== void 0 ? _a : yield this.getData();
|
|
9079
|
+
if (!data || data.length === 0) {
|
|
9080
|
+
throw new EmptyDataError();
|
|
9081
|
+
}
|
|
9052
9082
|
const origin = {
|
|
9053
9083
|
containerLabel: this.title,
|
|
9054
9084
|
widgetLabel: this.title,
|
|
@@ -9651,6 +9681,10 @@
|
|
|
9651
9681
|
*/
|
|
9652
9682
|
this.dataValueOutFormName = '';
|
|
9653
9683
|
this.closeOnScroll = true;
|
|
9684
|
+
/* Defines if should open modal with grid to make the selection */
|
|
9685
|
+
this.modalSelection = false;
|
|
9686
|
+
/* Defines fields to show on modal */
|
|
9687
|
+
this.modalSelectionFields = [];
|
|
9654
9688
|
this.dsSearch = {
|
|
9655
9689
|
SEARCH: (value, searchIn) => ({
|
|
9656
9690
|
searchIn: [searchIn],
|
|
@@ -9686,6 +9720,7 @@
|
|
|
9686
9720
|
this.pushedValue = null;
|
|
9687
9721
|
this.loadMoreQtty = 0;
|
|
9688
9722
|
this.debounceSearch = debounce__default["default"](this.doSearch, 500);
|
|
9723
|
+
this.modalSelectionObj = undefined;
|
|
9689
9724
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
9690
9725
|
this.dataText = this.getInitValue('dataText', props.dataText, this.dataText);
|
|
9691
9726
|
this.dataTextDiscrete = this.getInitValue('dataTextDiscrete', props.dataTextDiscrete, this.dataTextDiscrete);
|
|
@@ -9704,6 +9739,8 @@
|
|
|
9704
9739
|
this.dataValueOut = this.getInitValue('dataValueOut', props.dataValueOut, this.dataValueOut);
|
|
9705
9740
|
this.dataValueOutFormName = this.getInitValue('dataValueOutFormName', props.dataValueOutFormName, this.dataValueOutFormName);
|
|
9706
9741
|
this.closeOnScroll = this.getInitValue('closeOnScroll', props.closeOnScroll, this.closeOnScroll);
|
|
9742
|
+
this.modalSelection = this.getInitValue('modalSelection', props.modalSelection, this.modalSelection);
|
|
9743
|
+
this.modalSelectionFields = this.getInitValue('modalSelectionFields', props.modalSelectionFields, this.modalSelectionFields);
|
|
9707
9744
|
if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
|
|
9708
9745
|
this.dataValue = 'value';
|
|
9709
9746
|
this.dataText = this.dataText || this.dataValue;
|
|
@@ -9716,8 +9753,8 @@
|
|
|
9716
9753
|
dataText: this.dataTextDiscrete,
|
|
9717
9754
|
dataTextSeparator: this.dataTextSeparator,
|
|
9718
9755
|
};
|
|
9719
|
-
|
|
9720
|
-
this.datasource = core.DatasourceFactory.factory(defaultDatasource);
|
|
9756
|
+
this.defaultDatasource = this.getDefaultDatasource(props);
|
|
9757
|
+
this.datasource = core.DatasourceFactory.factory(this.defaultDatasource);
|
|
9721
9758
|
this.overrideGet();
|
|
9722
9759
|
let defaultValue = props.value;
|
|
9723
9760
|
if (core.Accessor.isAccessorDefinition(props.value)) {
|
|
@@ -9725,7 +9762,7 @@
|
|
|
9725
9762
|
this.getInitValue('value', props.value, this.value);
|
|
9726
9763
|
}
|
|
9727
9764
|
this.setDefaultValue(defaultValue, (_b = props.datasource) === null || _b === void 0 ? void 0 : _b.lazyLoad);
|
|
9728
|
-
this.preventLoadOnFocus = !defaultDatasource.lazyLoad;
|
|
9765
|
+
this.preventLoadOnFocus = !this.defaultDatasource.lazyLoad;
|
|
9729
9766
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
9730
9767
|
this.loadMoreQtty = this.datasource.limit;
|
|
9731
9768
|
this.itemAfterSlot = props.itemAfterSlot || this.itemAfterSlot;
|
|
@@ -9739,6 +9776,31 @@
|
|
|
9739
9776
|
const instance = core.Loader.getInstance(controller);
|
|
9740
9777
|
return instance[accessor];
|
|
9741
9778
|
}
|
|
9779
|
+
onMounted(element) {
|
|
9780
|
+
super.onMounted(element);
|
|
9781
|
+
if (this.modalSelection && this.modalSelectionFields.length) {
|
|
9782
|
+
core.KeyMap.bind({
|
|
9783
|
+
'shift+enter': {
|
|
9784
|
+
active: true,
|
|
9785
|
+
input: true,
|
|
9786
|
+
stop: true,
|
|
9787
|
+
prevent: true,
|
|
9788
|
+
event: this.openModalSelection.bind(this),
|
|
9789
|
+
},
|
|
9790
|
+
}, this, element);
|
|
9791
|
+
}
|
|
9792
|
+
}
|
|
9793
|
+
onBeforeDestroy() {
|
|
9794
|
+
super.onBeforeDestroy();
|
|
9795
|
+
this.datasource.destroy();
|
|
9796
|
+
if (this.modalSelection && this.modalSelectionFields.length) {
|
|
9797
|
+
core.KeyMap.unbind({
|
|
9798
|
+
'shift+enter': {
|
|
9799
|
+
event: this.openModalSelection.bind(this),
|
|
9800
|
+
},
|
|
9801
|
+
}, this);
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9742
9804
|
/**
|
|
9743
9805
|
* Retrieves datasource structure applying infinity scroll
|
|
9744
9806
|
* @param field Field structure
|
|
@@ -10113,10 +10175,6 @@
|
|
|
10113
10175
|
&& !this.datasource.loadAll
|
|
10114
10176
|
&& this.datasource.data.length - (this.pushedValue ? 1 : 0) < this.datasource.total;
|
|
10115
10177
|
}
|
|
10116
|
-
onBeforeDestroy() {
|
|
10117
|
-
super.onBeforeDestroy();
|
|
10118
|
-
this.datasource.destroy();
|
|
10119
|
-
}
|
|
10120
10178
|
indexOf(search) {
|
|
10121
10179
|
const value = search && typeof search === 'object' ? search[this.dataValue] : search;
|
|
10122
10180
|
return this.datasource.data.findIndex((row) => row[this.dataValue] === value);
|
|
@@ -10124,6 +10182,109 @@
|
|
|
10124
10182
|
isFilledObj(obj) {
|
|
10125
10183
|
return obj && typeof obj === 'object' && !Array.isArray(obj) && Object.keys(obj).length;
|
|
10126
10184
|
}
|
|
10185
|
+
hideModalSelection() {
|
|
10186
|
+
if (this.modalSelectionObj)
|
|
10187
|
+
this.modalSelectionObj.hide();
|
|
10188
|
+
}
|
|
10189
|
+
modalSelectionGridClick({ row }) {
|
|
10190
|
+
this.setValue(row);
|
|
10191
|
+
this.hideModalSelection();
|
|
10192
|
+
setTimeout(() => {
|
|
10193
|
+
if (this.viewCloseMenu)
|
|
10194
|
+
this.viewCloseMenu();
|
|
10195
|
+
}, 200);
|
|
10196
|
+
}
|
|
10197
|
+
openModalSelection() {
|
|
10198
|
+
const modalSelectionDef = {
|
|
10199
|
+
name: `${this.name}-modal-selection`,
|
|
10200
|
+
persistent: true,
|
|
10201
|
+
escKeydownStop: false,
|
|
10202
|
+
children: [
|
|
10203
|
+
{
|
|
10204
|
+
name: `${this.name}-modal-selection-content-container`,
|
|
10205
|
+
component: 'ZdContainer',
|
|
10206
|
+
scrollView: true,
|
|
10207
|
+
cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-content-container',
|
|
10208
|
+
children: [
|
|
10209
|
+
{
|
|
10210
|
+
name: `${this.name}-modal-selection-grid`,
|
|
10211
|
+
component: 'ZdGrid',
|
|
10212
|
+
cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
|
|
10213
|
+
columns: this.modalSelectionFields,
|
|
10214
|
+
datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
|
|
10215
|
+
toolbarSlot: [
|
|
10216
|
+
{
|
|
10217
|
+
name: `${this.name}-modal-selection-title`,
|
|
10218
|
+
component: 'ZdText',
|
|
10219
|
+
cssStyle: `color: ${'var(--v-primary-base);'}`,
|
|
10220
|
+
text: this.label,
|
|
10221
|
+
tag: 'h3',
|
|
10222
|
+
},
|
|
10223
|
+
{
|
|
10224
|
+
name: `${this.name}-modal-selection-spacer`,
|
|
10225
|
+
component: 'VSpacer',
|
|
10226
|
+
},
|
|
10227
|
+
{
|
|
10228
|
+
name: `${this.name}-modal-selection_gridSearch`,
|
|
10229
|
+
component: 'ZdSearch',
|
|
10230
|
+
cssClass: 'zd-grid-search',
|
|
10231
|
+
autofocus: true,
|
|
10232
|
+
},
|
|
10233
|
+
],
|
|
10234
|
+
events: {
|
|
10235
|
+
rowClick: this.modalSelectionGridClick.bind(this),
|
|
10236
|
+
},
|
|
10237
|
+
},
|
|
10238
|
+
],
|
|
10239
|
+
},
|
|
10240
|
+
{
|
|
10241
|
+
name: `${this.name}-modal-selection-footer-container`,
|
|
10242
|
+
component: 'ZdContainer',
|
|
10243
|
+
cssClass: 'zd-pa-0',
|
|
10244
|
+
children: [
|
|
10245
|
+
{
|
|
10246
|
+
name: `${this.name}-modal-selection-footer`,
|
|
10247
|
+
component: 'ZdFooter',
|
|
10248
|
+
color: 'transparent',
|
|
10249
|
+
padless: true,
|
|
10250
|
+
rightSlot: [
|
|
10251
|
+
{
|
|
10252
|
+
name: `${this.name}-modal-selection-cancelButton`,
|
|
10253
|
+
component: 'ZdButton',
|
|
10254
|
+
label: 'CANCEL',
|
|
10255
|
+
keyMap: {
|
|
10256
|
+
esc: {
|
|
10257
|
+
event: this.hideModalSelection.bind(this),
|
|
10258
|
+
focus: true,
|
|
10259
|
+
visible: true,
|
|
10260
|
+
input: true,
|
|
10261
|
+
stop: true,
|
|
10262
|
+
},
|
|
10263
|
+
},
|
|
10264
|
+
outline: true,
|
|
10265
|
+
events: {
|
|
10266
|
+
click: this.hideModalSelection.bind(this),
|
|
10267
|
+
},
|
|
10268
|
+
},
|
|
10269
|
+
],
|
|
10270
|
+
},
|
|
10271
|
+
],
|
|
10272
|
+
},
|
|
10273
|
+
],
|
|
10274
|
+
events: {
|
|
10275
|
+
onShow: () => {
|
|
10276
|
+
const grid = core.Metadata.getInstance(`${this.name}-modal-selection-grid`);
|
|
10277
|
+
grid.datasource.currentRow = {};
|
|
10278
|
+
},
|
|
10279
|
+
},
|
|
10280
|
+
};
|
|
10281
|
+
if (this.modalSelectionObj)
|
|
10282
|
+
this.modalSelectionObj.destroy();
|
|
10283
|
+
core.ViewService.nextTick(() => {
|
|
10284
|
+
this.modalSelectionObj = ModalService.create(modalSelectionDef);
|
|
10285
|
+
this.modalSelectionObj.show();
|
|
10286
|
+
});
|
|
10287
|
+
}
|
|
10127
10288
|
}
|
|
10128
10289
|
core.FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
|
|
10129
10290
|
if (value === null || value === undefined) {
|
|
@@ -10164,7 +10325,24 @@
|
|
|
10164
10325
|
return result;
|
|
10165
10326
|
}, '');
|
|
10166
10327
|
});
|
|
10167
|
-
InputFactory.register('ZdSelect', Select);
|
|
10328
|
+
InputFactory.register('ZdSelect', Select);
|
|
10329
|
+
core.Messages.add({
|
|
10330
|
+
'pt-BR': {
|
|
10331
|
+
translation: {
|
|
10332
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) para abrir modal',
|
|
10333
|
+
},
|
|
10334
|
+
},
|
|
10335
|
+
'en-US': {
|
|
10336
|
+
translation: {
|
|
10337
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) to open modal',
|
|
10338
|
+
},
|
|
10339
|
+
},
|
|
10340
|
+
'es-ES': {
|
|
10341
|
+
translation: {
|
|
10342
|
+
SELECT_MODAL_KEYMAP: '(shift+enter) para abrir el modal',
|
|
10343
|
+
},
|
|
10344
|
+
},
|
|
10345
|
+
});
|
|
10168
10346
|
|
|
10169
10347
|
/**
|
|
10170
10348
|
* Base class for Iterable Page Size component
|
|
@@ -10310,6 +10488,7 @@
|
|
|
10310
10488
|
this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
|
|
10311
10489
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
|
|
10312
10490
|
this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
|
|
10491
|
+
this.debounceSetSearch = this.debounceSetSearch.bind(this);
|
|
10313
10492
|
if (!this.lazyAttach)
|
|
10314
10493
|
this.setIterableComponent();
|
|
10315
10494
|
this.createAccessors();
|
|
@@ -10328,7 +10507,7 @@
|
|
|
10328
10507
|
}
|
|
10329
10508
|
setSearch(search) {
|
|
10330
10509
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10331
|
-
yield this.iterableComponent.setSearch(search);
|
|
10510
|
+
yield this.iterableComponent.setSearch(search.component.internalValue);
|
|
10332
10511
|
});
|
|
10333
10512
|
}
|
|
10334
10513
|
}
|
|
@@ -15371,6 +15550,7 @@
|
|
|
15371
15550
|
exports.DialogService = DialogService;
|
|
15372
15551
|
exports.Divider = Divider;
|
|
15373
15552
|
exports.Dropdown = Dropdown;
|
|
15553
|
+
exports.EmptyDataError = EmptyDataError;
|
|
15374
15554
|
exports.FileInput = FileInput;
|
|
15375
15555
|
exports.Footer = Footer;
|
|
15376
15556
|
exports.Form = Form;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.106.1",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"lodash.times": "4.3.*",
|
|
44
44
|
"mockdate": "3.0.*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "466f25f5bf00183a2c22ef94eecb47d997ac4bab"
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDictionary, Datasource, IEvents } from '@zeedhi/core';
|
|
2
|
-
import { IColumn, ColumnAlign, ColumnType } from './interfaces';
|
|
2
|
+
import { IColumn, ColumnAlign, ColumnType, ColumnSearchMode } from './interfaces';
|
|
3
3
|
import { Component } from '../zd-component/component';
|
|
4
4
|
/**
|
|
5
5
|
* Base class for Column.
|
|
@@ -42,6 +42,7 @@ export declare class Column extends Component implements IColumn {
|
|
|
42
42
|
private viewGetWidth?;
|
|
43
43
|
helperText: string;
|
|
44
44
|
protected defaultData: IDictionary[];
|
|
45
|
+
searchMode: ColumnSearchMode;
|
|
45
46
|
/**
|
|
46
47
|
* Creates a new Column.
|
|
47
48
|
* @param props Column properties
|
|
@@ -8,6 +8,7 @@ export interface IIterableEvents<T = IEventParam<any>> extends IComponentEvents<
|
|
|
8
8
|
}
|
|
9
9
|
export declare type ColumnAlign = 'left' | 'center' | 'right';
|
|
10
10
|
export declare type ColumnType = 'action';
|
|
11
|
+
export declare type ColumnSearchMode = 'beginning' | 'end' | 'any';
|
|
11
12
|
export interface IColumn extends IComponent {
|
|
12
13
|
align?: ColumnAlign;
|
|
13
14
|
label?: string;
|
|
@@ -26,6 +27,7 @@ export interface IColumn extends IComponent {
|
|
|
26
27
|
style?: IDictionary;
|
|
27
28
|
events?: IIterableEvents;
|
|
28
29
|
xlsType?: string;
|
|
30
|
+
searchMode?: ColumnSearchMode;
|
|
29
31
|
}
|
|
30
32
|
export interface IIterable extends IComponentRender {
|
|
31
33
|
columns?: IColumn[];
|
|
@@ -34,6 +36,7 @@ export interface IIterable extends IComponentRender {
|
|
|
34
36
|
virtualScroll?: boolean;
|
|
35
37
|
virtualScrollCache?: number;
|
|
36
38
|
searchVisibleOnly?: boolean;
|
|
39
|
+
searchIn?: string | undefined;
|
|
37
40
|
}
|
|
38
41
|
export interface IIterablePageComponent extends IComponentRender {
|
|
39
42
|
iterableComponentName?: string;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { IDictionary } from '@zeedhi/core';
|
|
1
2
|
import { Iterable } from './iterable';
|
|
2
3
|
export declare class IterableController {
|
|
3
4
|
private iterable;
|
|
4
5
|
private searchInValue?;
|
|
6
|
+
private searchInParamsValue?;
|
|
5
7
|
constructor(iterable: Iterable);
|
|
6
8
|
get searchIn(): string[] | undefined;
|
|
7
9
|
set searchIn(value: string[] | undefined);
|
|
10
|
+
get searchInParams(): IDictionary<any> | undefined;
|
|
11
|
+
set searchInParams(value: IDictionary<any> | undefined);
|
|
8
12
|
}
|
|
@@ -44,6 +44,7 @@ export declare class Iterable extends ComponentRender implements IIterable {
|
|
|
44
44
|
* Defines if searchIn should consider only visible columns or not
|
|
45
45
|
*/
|
|
46
46
|
searchVisibleOnly: boolean;
|
|
47
|
+
searchIn: string | undefined;
|
|
47
48
|
defaultSearchVisibleOnly: boolean;
|
|
48
49
|
/**
|
|
49
50
|
* Creates a new Iterable.
|
|
@@ -20,6 +20,6 @@ export declare class Search extends TextInput implements ISearch {
|
|
|
20
20
|
*/
|
|
21
21
|
constructor(props: ISearch);
|
|
22
22
|
setIterableComponent(name?: string): void;
|
|
23
|
-
protected setSearch(search:
|
|
23
|
+
protected setSearch(search: any): Promise<void>;
|
|
24
24
|
debounceSetSearch: (search: string) => void;
|
|
25
25
|
}
|
|
@@ -2,6 +2,7 @@ import { IDatasource } from '@zeedhi/core';
|
|
|
2
2
|
import { ITextInput } from '../zd-text-input/interfaces';
|
|
3
3
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
4
4
|
import { ISelectDataValueOut } from '../../utils';
|
|
5
|
+
import { IColumn } from '../zd-iterable/interfaces';
|
|
5
6
|
export declare type SearchParam = 'SEARCH' | 'FILTER' | 'FIND' | 'DYNAMIC_FILTER';
|
|
6
7
|
export interface ISelect extends ITextInput, ISelectDataValueOut {
|
|
7
8
|
autocomplete?: boolean;
|
|
@@ -23,4 +24,6 @@ export interface ISelect extends ITextInput, ISelectDataValueOut {
|
|
|
23
24
|
attach?: boolean;
|
|
24
25
|
searchParam?: string;
|
|
25
26
|
closeOnScroll?: boolean;
|
|
27
|
+
modalSelection?: boolean;
|
|
28
|
+
modalSelectionFields?: IColumn[];
|
|
26
29
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
1
|
+
import { Datasource, IDictionary, IDatasource } from '@zeedhi/core';
|
|
2
2
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
3
3
|
import { ISelect, SearchParam } from './interfaces';
|
|
4
4
|
import { TextInput } from '../zd-text-input/text-input';
|
|
5
5
|
import { ISelectDataValueOutItem } from '../../utils';
|
|
6
|
+
import { IColumn } from '../zd-iterable/interfaces';
|
|
6
7
|
/**
|
|
7
8
|
* Base class for Select component.
|
|
8
9
|
*/
|
|
@@ -92,6 +93,8 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
92
93
|
*/
|
|
93
94
|
dataValueOutFormName: string;
|
|
94
95
|
closeOnScroll: boolean;
|
|
96
|
+
modalSelection?: boolean | undefined;
|
|
97
|
+
modalSelectionFields: IColumn[];
|
|
95
98
|
protected dsSearch: {
|
|
96
99
|
SEARCH: (value: any, searchIn: string) => {
|
|
97
100
|
searchIn: string[];
|
|
@@ -128,14 +131,18 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
128
131
|
protected cachedTotal: number;
|
|
129
132
|
protected formatterFn: Function;
|
|
130
133
|
private pushedValue;
|
|
134
|
+
viewCloseMenu?: () => void;
|
|
131
135
|
private discreteProps?;
|
|
132
136
|
protected loadMoreQtty: number;
|
|
137
|
+
protected defaultDatasource: IDatasource;
|
|
133
138
|
/**
|
|
134
139
|
* Create a new Select.
|
|
135
140
|
* @param props Select properties
|
|
136
141
|
*/
|
|
137
142
|
constructor(props: ISelect);
|
|
138
143
|
private getAccessorValue;
|
|
144
|
+
onMounted(element: any): void;
|
|
145
|
+
onBeforeDestroy(): void;
|
|
139
146
|
/**
|
|
140
147
|
* Retrieves datasource structure applying infinity scroll
|
|
141
148
|
* @param field Field structure
|
|
@@ -230,7 +237,10 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
230
237
|
blur(event: Event, element: any): void;
|
|
231
238
|
protected checkValueOnBlur(): void;
|
|
232
239
|
showLoadMore(): boolean;
|
|
233
|
-
onBeforeDestroy(): void;
|
|
234
240
|
indexOf(search: IDictionary | string | number): number;
|
|
235
241
|
protected isFilledObj(obj: any): number | false;
|
|
242
|
+
private modalSelectionObj?;
|
|
243
|
+
private hideModalSelection;
|
|
244
|
+
private modalSelectionGridClick;
|
|
245
|
+
openModalSelection(): void;
|
|
236
246
|
}
|