@zeedhi/common 1.111.1 → 1.113.0
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 +128 -76
- package/dist/zd-common.umd.js +128 -76
- package/package.json +2 -2
- package/types/components/zd-grid/grid-editable.d.ts +5 -5
- package/types/components/zd-increment/increment.d.ts +2 -2
- package/types/components/zd-input/input.d.ts +1 -1
- package/types/components/zd-iterable/column.d.ts +2 -0
- package/types/components/zd-iterable/interfaces.d.ts +3 -0
- package/types/components/zd-iterable/search.d.ts +4 -0
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +4 -4
- package/types/formatters/column-zdtextinput.d.ts +1 -0
- package/types/formatters/index.d.ts +1 -0
- package/types/utils/report/report-type/base-report.d.ts +6 -2
- package/types/utils/report/report-type/csv-report.d.ts +2 -1
- package/types/utils/report/report-type/interfaces.d.ts +6 -2
- package/types/utils/report/report-type/pdf-report.d.ts +3 -1
- package/types/utils/report/report-type/xls-report.d.ts +2 -1
- package/types/utils/report/report-type/xls2-report.d.ts +2 -2
- package/types/utils/report/report-type/xls3-report.d.ts +2 -2
- package/types/utils/report/report.d.ts +0 -1
- package/types/services/zd-json-cache/json-cache-service.d.ts +0 -12
package/dist/zd-common.esm.js
CHANGED
|
@@ -2831,7 +2831,7 @@ class TextInput extends Input {
|
|
|
2831
2831
|
return mask;
|
|
2832
2832
|
}
|
|
2833
2833
|
}
|
|
2834
|
-
FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
|
|
2834
|
+
FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, eagerMask, } = {}) => {
|
|
2835
2835
|
let formatted = value;
|
|
2836
2836
|
if (formatted) {
|
|
2837
2837
|
formatted = valueWithPrefix ? formatted.substring(prefix.length) : formatted;
|
|
@@ -2842,7 +2842,10 @@ FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPref
|
|
|
2842
2842
|
maskDef = Loader.getInstance(controller)[accessor];
|
|
2843
2843
|
}
|
|
2844
2844
|
const maskValue = typeof (maskDef) === 'function' ? maskDef(Mask.getValueWithoutMask(formatted)) : maskDef;
|
|
2845
|
-
|
|
2845
|
+
if (maskValue) {
|
|
2846
|
+
const valueWithoutMask = Mask.getValueWithoutMask(formatted);
|
|
2847
|
+
formatted = Mask.getValueWithMask(valueWithoutMask, maskValue, false, eagerMask);
|
|
2848
|
+
}
|
|
2846
2849
|
}
|
|
2847
2850
|
return formatted;
|
|
2848
2851
|
});
|
|
@@ -3138,8 +3141,10 @@ class AlertService {
|
|
|
3138
3141
|
* Hides alert by index. Default index is 0
|
|
3139
3142
|
*/
|
|
3140
3143
|
static hide(index = 0) {
|
|
3141
|
-
this.alertsManager.visibleInstances[index]
|
|
3142
|
-
|
|
3144
|
+
if (this.alertsManager.visibleInstances[index]) {
|
|
3145
|
+
this.alertsManager.visibleInstances[index].hide();
|
|
3146
|
+
this.remove(index);
|
|
3147
|
+
}
|
|
3143
3148
|
}
|
|
3144
3149
|
/**
|
|
3145
3150
|
* Hides alert by alert id (returned by the `show` method)
|
|
@@ -5447,6 +5452,8 @@ class Column extends Component {
|
|
|
5447
5452
|
this.defaultData = [];
|
|
5448
5453
|
/* Column search mode */
|
|
5449
5454
|
this.searchMode = 'any';
|
|
5455
|
+
/* Column can be used to search */
|
|
5456
|
+
this.searchable = true;
|
|
5450
5457
|
this.lookup = debounce((lookupColumn) => {
|
|
5451
5458
|
this.loading = true;
|
|
5452
5459
|
const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
|
|
@@ -5478,7 +5485,9 @@ class Column extends Component {
|
|
|
5478
5485
|
this.xlsType = this.getInitValue('xlsType', props.xlsType, this.xlsType);
|
|
5479
5486
|
this.conditions = this.getInitValue('conditions', props.conditions, this.conditions);
|
|
5480
5487
|
this.searchMode = this.getInitValue('searchMode', props.searchMode, this.searchMode);
|
|
5488
|
+
this.searchable = this.getInitValue('searchable', props.searchable, this.searchable);
|
|
5481
5489
|
this.helperText = this.getInitValue('', props.helperText, this.helperText);
|
|
5490
|
+
this.valueIn = this.getInitValue('valueIn', props.valueIn, this.name);
|
|
5482
5491
|
this.createConditions();
|
|
5483
5492
|
this.createActionConditions();
|
|
5484
5493
|
if (this.componentProps.datasource) {
|
|
@@ -5510,7 +5519,7 @@ class Column extends Component {
|
|
|
5510
5519
|
throw new MethodNotAssignedError('viewGetWidth');
|
|
5511
5520
|
}
|
|
5512
5521
|
formatterByRow(row, cellProps) {
|
|
5513
|
-
const value = row[this.
|
|
5522
|
+
const value = row[this.valueIn];
|
|
5514
5523
|
const formatterFn = FormatterParserProvider.getFormatter(`column_${this.componentProps.component}`);
|
|
5515
5524
|
if (formatterFn) {
|
|
5516
5525
|
return formatterFn({
|
|
@@ -5845,7 +5854,9 @@ class Iterable extends ComponentRender {
|
|
|
5845
5854
|
});
|
|
5846
5855
|
}
|
|
5847
5856
|
isColumnSearchable(column) {
|
|
5848
|
-
return
|
|
5857
|
+
return column.searchable
|
|
5858
|
+
&& (!this.searchVisibleOnly || column.isVisible)
|
|
5859
|
+
&& (this.searchIn === undefined || this.searchIn === column.name);
|
|
5849
5860
|
}
|
|
5850
5861
|
}
|
|
5851
5862
|
|
|
@@ -7048,10 +7059,10 @@ class GridEditable extends Grid {
|
|
|
7048
7059
|
}
|
|
7049
7060
|
getVisibleValue(row, column) {
|
|
7050
7061
|
const key = row[this.datasource.uniqueKey];
|
|
7051
|
-
if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.
|
|
7052
|
-
return this.editedRows[key][column.
|
|
7062
|
+
if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
|
|
7063
|
+
return this.editedRows[key][column.valueIn];
|
|
7053
7064
|
}
|
|
7054
|
-
return row[column.
|
|
7065
|
+
return row[column.valueIn];
|
|
7055
7066
|
}
|
|
7056
7067
|
/**
|
|
7057
7068
|
* Returns editable component properties based on the column definition
|
|
@@ -7110,13 +7121,13 @@ class GridEditable extends Grid {
|
|
|
7110
7121
|
* If the row[column.name] has a selected value, pushes it
|
|
7111
7122
|
*/
|
|
7112
7123
|
checkLookupData(column, row, componentProps) {
|
|
7113
|
-
if (!row[column.
|
|
7124
|
+
if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
|
|
7114
7125
|
return;
|
|
7115
7126
|
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
7116
7127
|
// prevent pushing lookup values when using accessor in data
|
|
7117
7128
|
if (!Array.isArray(componentProps.datasource.data))
|
|
7118
7129
|
return;
|
|
7119
|
-
const colValue = row[column.
|
|
7130
|
+
const colValue = row[column.valueIn];
|
|
7120
7131
|
if (Array.isArray(colValue)) {
|
|
7121
7132
|
colValue.forEach((item) => {
|
|
7122
7133
|
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
@@ -7153,7 +7164,7 @@ class GridEditable extends Grid {
|
|
|
7153
7164
|
*/
|
|
7154
7165
|
changeEditableComponent(column, row, value, component) {
|
|
7155
7166
|
const key = row[this.datasource.uniqueKey];
|
|
7156
|
-
const columnName = column.
|
|
7167
|
+
const columnName = column.valueIn;
|
|
7157
7168
|
if (!Utils.isEqual(value, row[columnName])) {
|
|
7158
7169
|
const newRow = {};
|
|
7159
7170
|
newRow[key] = Object.assign({}, this.editedRows[key]);
|
|
@@ -7200,7 +7211,7 @@ class GridEditable extends Grid {
|
|
|
7200
7211
|
isEdited(column, row) {
|
|
7201
7212
|
const key = row[this.datasource.uniqueKey];
|
|
7202
7213
|
return this.editedRows[key]
|
|
7203
|
-
&& this.editedRows[key][column.
|
|
7214
|
+
&& this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
|
|
7204
7215
|
}
|
|
7205
7216
|
/**
|
|
7206
7217
|
* Checks if row is an added row
|
|
@@ -7384,7 +7395,7 @@ class GridEditable extends Grid {
|
|
|
7384
7395
|
const key = row[this.datasource.uniqueKey];
|
|
7385
7396
|
editableColumns.forEach((column) => {
|
|
7386
7397
|
const instance = componentInstances[column.name];
|
|
7387
|
-
if (!instance.isValid(row[column.
|
|
7398
|
+
if (!instance.isValid(row[column.valueIn])) {
|
|
7388
7399
|
invalidCompNames.push(this.getCompName(key, column.name));
|
|
7389
7400
|
}
|
|
7390
7401
|
});
|
|
@@ -7477,7 +7488,7 @@ class GridEditable extends Grid {
|
|
|
7477
7488
|
throw new RowNotFoundError(newRow[uniqueKey], this.name);
|
|
7478
7489
|
}
|
|
7479
7490
|
this.columns.forEach((column) => {
|
|
7480
|
-
const columnName = column.
|
|
7491
|
+
const columnName = column.valueIn;
|
|
7481
7492
|
this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
|
|
7482
7493
|
});
|
|
7483
7494
|
}
|
|
@@ -7894,27 +7905,45 @@ class Increment extends Number$1 {
|
|
|
7894
7905
|
super.change(event, element);
|
|
7895
7906
|
}
|
|
7896
7907
|
/**
|
|
7897
|
-
*
|
|
7908
|
+
* Increases the component's value by the step amount.
|
|
7898
7909
|
*/
|
|
7899
7910
|
increment() {
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7911
|
+
const currentValue = Number(this.value);
|
|
7912
|
+
const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
|
|
7913
|
+
// First, handle the case where the input is empty or not a number.
|
|
7914
|
+
if (isValueInvalid) {
|
|
7915
|
+
// Determine the starting value. Default to `minValue` if it's positive, otherwise start from `step`.
|
|
7916
|
+
const startValue = (this.minValue !== undefined && this.minValue > 0) ? this.minValue : this.step;
|
|
7917
|
+
// Set the value, but clamp it to the maximum limit if one exists.
|
|
7918
|
+
this.value = (this.maxValue !== undefined) ? Math.min(startValue, this.maxValue) : startValue;
|
|
7919
|
+
return;
|
|
7903
7920
|
}
|
|
7904
|
-
|
|
7905
|
-
|
|
7921
|
+
// If the input is a valid number, calculate the next value.
|
|
7922
|
+
const nextValue = currentValue + this.step;
|
|
7923
|
+
// Only update if the new value does not exceed the maximum boundary.
|
|
7924
|
+
if (this.maxValue === undefined || nextValue <= this.maxValue) {
|
|
7925
|
+
this.value = nextValue;
|
|
7906
7926
|
}
|
|
7907
7927
|
}
|
|
7908
7928
|
/**
|
|
7909
|
-
*
|
|
7929
|
+
* Decreases the component's value by the step amount.
|
|
7910
7930
|
*/
|
|
7911
7931
|
decrement() {
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7932
|
+
const currentValue = Number(this.value);
|
|
7933
|
+
const isValueInvalid = this.value === null || this.value === '' || Number.isNaN(currentValue);
|
|
7934
|
+
// First, handle the case where the input is empty or not a number.
|
|
7935
|
+
if (isValueInvalid) {
|
|
7936
|
+
// Determine the starting value. Handles the edge case where the max value is negative.
|
|
7937
|
+
const startValue = (this.maxValue !== undefined && this.maxValue < 0) ? this.maxValue : -this.step;
|
|
7938
|
+
// Set the value, but clamp it to the minimum limit if one exists.
|
|
7939
|
+
this.value = (this.minValue !== undefined) ? Math.max(startValue, this.minValue) : startValue;
|
|
7940
|
+
return;
|
|
7915
7941
|
}
|
|
7916
|
-
|
|
7917
|
-
|
|
7942
|
+
// If the input is a valid number, calculate the next value.
|
|
7943
|
+
const nextValue = currentValue - this.step;
|
|
7944
|
+
// Only update if the new value does not go below the minimum boundary.
|
|
7945
|
+
if (this.minValue === undefined || nextValue >= this.minValue) {
|
|
7946
|
+
this.value = nextValue;
|
|
7918
7947
|
}
|
|
7919
7948
|
}
|
|
7920
7949
|
}
|
|
@@ -8503,18 +8532,26 @@ class BaseReport {
|
|
|
8503
8532
|
SUM: 'SUM',
|
|
8504
8533
|
};
|
|
8505
8534
|
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
8535
|
+
this.labelFormatter = labelFormatter;
|
|
8506
8536
|
this.reportColumnTransformer = this.getReportColumnTransformer(labelFormatter);
|
|
8507
8537
|
}
|
|
8508
8538
|
getReportColumnTransformer(labelFormatter) {
|
|
8509
8539
|
return new ReportColumnTransformer({ labelFormatter, fileType: this.getFileType() });
|
|
8510
8540
|
}
|
|
8541
|
+
getColumnLabel(key, column) {
|
|
8542
|
+
if (!column)
|
|
8543
|
+
return key;
|
|
8544
|
+
if (!this.labelFormatter)
|
|
8545
|
+
return column.label || key;
|
|
8546
|
+
return this.labelFormatter({ column, fileType: this.getFileType() });
|
|
8547
|
+
}
|
|
8511
8548
|
buildFilter(filter, columns) {
|
|
8512
8549
|
return Object.keys(filter).map((key) => {
|
|
8513
|
-
|
|
8514
|
-
return
|
|
8515
|
-
label:
|
|
8550
|
+
const column = columns.find((col) => col.name === key);
|
|
8551
|
+
return {
|
|
8552
|
+
label: this.getColumnLabel(key, column),
|
|
8516
8553
|
value: I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
8517
|
-
}
|
|
8554
|
+
};
|
|
8518
8555
|
});
|
|
8519
8556
|
}
|
|
8520
8557
|
formatLangCode(lang) {
|
|
@@ -8523,6 +8560,12 @@ class BaseReport {
|
|
|
8523
8560
|
}
|
|
8524
8561
|
return lang.toLowerCase().replace('-', '_');
|
|
8525
8562
|
}
|
|
8563
|
+
filterColumns(columns) {
|
|
8564
|
+
return columns.filter((item) => (item.type !== 'action' && item.isVisible !== false));
|
|
8565
|
+
}
|
|
8566
|
+
buildCols(columns) {
|
|
8567
|
+
return this.reportColumnTransformer.transform(this.filterColumns(columns));
|
|
8568
|
+
}
|
|
8526
8569
|
}
|
|
8527
8570
|
|
|
8528
8571
|
class CSVReport extends BaseReport {
|
|
@@ -8533,8 +8576,9 @@ class CSVReport extends BaseReport {
|
|
|
8533
8576
|
getFileType() {
|
|
8534
8577
|
return 'csv';
|
|
8535
8578
|
}
|
|
8536
|
-
buildDataset(data, columns) {
|
|
8537
|
-
const
|
|
8579
|
+
buildDataset({ data, columns }) {
|
|
8580
|
+
const filteredColumns = this.filterColumns(columns);
|
|
8581
|
+
const columnNames = filteredColumns.map((col) => col.name);
|
|
8538
8582
|
const result = data.reduce((reduced, row) => {
|
|
8539
8583
|
const values = columnNames.map((col) => row[col] || '');
|
|
8540
8584
|
return [...reduced, values];
|
|
@@ -8542,7 +8586,7 @@ class CSVReport extends BaseReport {
|
|
|
8542
8586
|
return JSON.stringify(result);
|
|
8543
8587
|
}
|
|
8544
8588
|
buildMetadata(name, title, columns, filter) {
|
|
8545
|
-
const builtCols = this.
|
|
8589
|
+
const builtCols = this.buildCols(columns);
|
|
8546
8590
|
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
8547
8591
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
8548
8592
|
const clientLogo = '';
|
|
@@ -8586,7 +8630,7 @@ class PDFReport extends BaseReport {
|
|
|
8586
8630
|
const fileType = this.getFileType();
|
|
8587
8631
|
return new ReportColumnTransformer({ getFormatFn, labelFormatter, fileType });
|
|
8588
8632
|
}
|
|
8589
|
-
buildDataset(data) {
|
|
8633
|
+
buildDataset({ data }) {
|
|
8590
8634
|
return JSON.stringify(data);
|
|
8591
8635
|
}
|
|
8592
8636
|
getFormatOfColumn(column) {
|
|
@@ -8636,7 +8680,7 @@ class PDFReport extends BaseReport {
|
|
|
8636
8680
|
}
|
|
8637
8681
|
buildMetadata(name, title, columns, filter, portrait = true) {
|
|
8638
8682
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8639
|
-
const builtCols = this.
|
|
8683
|
+
const builtCols = this.buildCols(columns);
|
|
8640
8684
|
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
8641
8685
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
8642
8686
|
let clientLogo = '';
|
|
@@ -8724,8 +8768,8 @@ class XLSReport extends BaseReport {
|
|
|
8724
8768
|
getFileType() {
|
|
8725
8769
|
return 'xls';
|
|
8726
8770
|
}
|
|
8727
|
-
buildDataset(data, columns) {
|
|
8728
|
-
const result = this.formatRawDataSet(data, columns);
|
|
8771
|
+
buildDataset({ data, columns }) {
|
|
8772
|
+
const result = this.formatRawDataSet(data, this.filterColumns(columns));
|
|
8729
8773
|
return JSON.stringify(result);
|
|
8730
8774
|
}
|
|
8731
8775
|
// formata o dataset para o formato "cru" xls
|
|
@@ -8738,7 +8782,7 @@ class XLSReport extends BaseReport {
|
|
|
8738
8782
|
return result;
|
|
8739
8783
|
}
|
|
8740
8784
|
buildMetadata(name, title, columns, filter) {
|
|
8741
|
-
const builtCols = this.
|
|
8785
|
+
const builtCols = this.buildCols(columns);
|
|
8742
8786
|
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
8743
8787
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
8744
8788
|
const clientLogo = '';
|
|
@@ -8781,12 +8825,12 @@ class XLS2Report extends BaseReport {
|
|
|
8781
8825
|
getFileType() {
|
|
8782
8826
|
return 'xls';
|
|
8783
8827
|
}
|
|
8784
|
-
buildDataset(data, metadata) {
|
|
8828
|
+
buildDataset({ data, metadata }) {
|
|
8785
8829
|
const result = this.formatDataSet(metadata, data);
|
|
8786
8830
|
return JSON.stringify(result);
|
|
8787
8831
|
}
|
|
8788
8832
|
buildMetadata(name, title, columns, filter) {
|
|
8789
|
-
const builtCols = this.
|
|
8833
|
+
const builtCols = this.buildCols(columns);
|
|
8790
8834
|
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
8791
8835
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
8792
8836
|
const clientLogo = '';
|
|
@@ -8981,12 +9025,12 @@ class XLS3Report extends BaseReport {
|
|
|
8981
9025
|
getFileType() {
|
|
8982
9026
|
return 'xls';
|
|
8983
9027
|
}
|
|
8984
|
-
buildDataset(data, metadata) {
|
|
9028
|
+
buildDataset({ data, metadata }) {
|
|
8985
9029
|
const result = this.formatDataSet(metadata, data);
|
|
8986
9030
|
return JSON.stringify(result);
|
|
8987
9031
|
}
|
|
8988
9032
|
buildMetadata(name, title, columns, filter) {
|
|
8989
|
-
const builtCols = this.
|
|
9033
|
+
const builtCols = this.buildCols(columns);
|
|
8990
9034
|
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
8991
9035
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
8992
9036
|
const clientLogo = '';
|
|
@@ -9306,21 +9350,20 @@ class Report {
|
|
|
9306
9350
|
const { route } = reportType;
|
|
9307
9351
|
const { name, columns, datasource } = this.iterable;
|
|
9308
9352
|
const { groupedData } = Object.assign({}, this.iterable);
|
|
9309
|
-
const
|
|
9310
|
-
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
9353
|
+
const metadataObj = yield reportType.buildMetadata(name, this.title, columns, datasource.filter, portrait);
|
|
9311
9354
|
let dataset;
|
|
9312
9355
|
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
9313
9356
|
const rowMetadata = rowObj.metaData;
|
|
9314
9357
|
const metadataObjClone = merge(rowMetadata, JSON.parse(metadataObj));
|
|
9315
|
-
dataset = reportType.buildDataset(groupedData, metadataObjClone);
|
|
9358
|
+
dataset = reportType.buildDataset({ data: groupedData, metadata: metadataObjClone });
|
|
9316
9359
|
}
|
|
9317
9360
|
else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
|
|
9318
9361
|
const formatter = new GroupedPDFFormatter();
|
|
9319
9362
|
const pdfGroupedData = formatter.format(groupedData);
|
|
9320
|
-
dataset = reportType.buildDataset(pdfGroupedData);
|
|
9363
|
+
dataset = reportType.buildDataset({ data: pdfGroupedData });
|
|
9321
9364
|
}
|
|
9322
9365
|
else {
|
|
9323
|
-
dataset = reportType.buildDataset(data,
|
|
9366
|
+
dataset = reportType.buildDataset({ data, metadata: metadataObj, columns });
|
|
9324
9367
|
}
|
|
9325
9368
|
const filter = '[]';
|
|
9326
9369
|
let row = {
|
|
@@ -9349,9 +9392,6 @@ class Report {
|
|
|
9349
9392
|
return new URL(reportFile, this.fileEndPoint).href;
|
|
9350
9393
|
});
|
|
9351
9394
|
}
|
|
9352
|
-
filterColumns(columns) {
|
|
9353
|
-
return columns.filter((item) => (item.type !== 'action' && item.isVisible));
|
|
9354
|
-
}
|
|
9355
9395
|
}
|
|
9356
9396
|
|
|
9357
9397
|
class TreeDataStructure {
|
|
@@ -10432,7 +10472,7 @@ class Select extends TextInput {
|
|
|
10432
10472
|
component: 'ZdGrid',
|
|
10433
10473
|
cssClass: 'zd-my-2 zd-pa-0 zd-select-modal-selection-grid',
|
|
10434
10474
|
columns: this.modalSelectionColumns,
|
|
10435
|
-
datasource: Object.assign(Object.assign({}, this.datasource.clone()), { lazyLoad: false, searchIn: undefined }),
|
|
10475
|
+
datasource: Object.assign(Object.assign({}, this.datasource.clone()), { limit: this.defaultDatasource.limit, lazyLoad: false, searchIn: undefined }),
|
|
10436
10476
|
toolbarSlot: [
|
|
10437
10477
|
{
|
|
10438
10478
|
name: `${this.name}-modal-selection-title`,
|
|
@@ -10511,7 +10551,7 @@ class Select extends TextInput {
|
|
|
10511
10551
|
});
|
|
10512
10552
|
}
|
|
10513
10553
|
}
|
|
10514
|
-
FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', }) => {
|
|
10554
|
+
FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTextSeparator = ' | ', eagerMask, }) => {
|
|
10515
10555
|
if (value === null || value === undefined) {
|
|
10516
10556
|
return null;
|
|
10517
10557
|
}
|
|
@@ -10543,7 +10583,7 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
|
|
|
10543
10583
|
let masked = value[column];
|
|
10544
10584
|
if (masks[index]) {
|
|
10545
10585
|
const maskValue = typeof masks[index] === 'function' ? masks[index](value[column]) : masks[index];
|
|
10546
|
-
masked = Mask.getValueWithMask(value[column], maskValue);
|
|
10586
|
+
masked = Mask.getValueWithMask(value[column], maskValue, false, eagerMask);
|
|
10547
10587
|
}
|
|
10548
10588
|
return result + separator + masked;
|
|
10549
10589
|
}
|
|
@@ -10705,6 +10745,10 @@ class Search extends TextInput {
|
|
|
10705
10745
|
constructor(props) {
|
|
10706
10746
|
super(props);
|
|
10707
10747
|
this.lazyAttach = false;
|
|
10748
|
+
/**
|
|
10749
|
+
* * hide the option to select search field
|
|
10750
|
+
*/
|
|
10751
|
+
this.hideSearchField = false;
|
|
10708
10752
|
this.debounceSetSearch = debounce(this.setSearch, 500);
|
|
10709
10753
|
this.iterableComponentName = this.getInitValue('iterableComponentName', props.iterableComponentName, this.iterableComponent);
|
|
10710
10754
|
this.showHelper = this.getInitValue('showHelper', props.showHelper, false);
|
|
@@ -10713,6 +10757,7 @@ class Search extends TextInput {
|
|
|
10713
10757
|
this.placeholder = this.getInitValue('placeholder', props.placeholder, 'SEARCH');
|
|
10714
10758
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, 'zd-float-right');
|
|
10715
10759
|
this.lazyAttach = this.getInitValue('lazyAttach', props.lazyAttach, this.lazyAttach);
|
|
10760
|
+
this.hideSearchField = this.getInitValue('hideSearchField', props.hideSearchField, this.hideSearchField);
|
|
10716
10761
|
this.debounceSetSearch = this.debounceSetSearch.bind(this);
|
|
10717
10762
|
if (!this.lazyAttach)
|
|
10718
10763
|
this.setIterableComponent();
|
|
@@ -12149,7 +12194,8 @@ FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = Config.
|
|
|
12149
12194
|
}
|
|
12150
12195
|
}
|
|
12151
12196
|
return value;
|
|
12152
|
-
});
|
|
12197
|
+
});
|
|
12198
|
+
InputFactory.register('ZdMonth', Month);
|
|
12153
12199
|
|
|
12154
12200
|
/**
|
|
12155
12201
|
* Base class for Password component.
|
|
@@ -12939,7 +12985,8 @@ FormatterParserProvider.registerFormatter('ZdSelectMultiple', (value, props) =>
|
|
|
12939
12985
|
return formattedRow;
|
|
12940
12986
|
});
|
|
12941
12987
|
return formattedValue;
|
|
12942
|
-
});
|
|
12988
|
+
});
|
|
12989
|
+
InputFactory.register('ZdSelectMultiple', SelectMultiple);
|
|
12943
12990
|
|
|
12944
12991
|
/**
|
|
12945
12992
|
* Base class for Select Tree component.
|
|
@@ -13533,7 +13580,8 @@ class SelectTreeMultiple extends SelectTree {
|
|
|
13533
13580
|
}
|
|
13534
13581
|
}
|
|
13535
13582
|
const selectFormatterFn = FormatterParserProvider.getFormatter('ZdSelectMultiple');
|
|
13536
|
-
FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
|
|
13583
|
+
FormatterParserProvider.registerFormatter('ZdSelectTreeMultiple', selectFormatterFn);
|
|
13584
|
+
InputFactory.register('ZdSelectTreeMultiple', SelectTreeMultiple);
|
|
13537
13585
|
|
|
13538
13586
|
/**
|
|
13539
13587
|
* Base class for SelectableList component.
|
|
@@ -15560,10 +15608,10 @@ class TreeGridEditable extends TreeGrid {
|
|
|
15560
15608
|
}
|
|
15561
15609
|
getVisibleValue(row, column) {
|
|
15562
15610
|
const key = row[this.datasource.uniqueKey];
|
|
15563
|
-
if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.
|
|
15564
|
-
return this.editedRows[key][column.
|
|
15611
|
+
if (this.editedRows[key] && Object.prototype.hasOwnProperty.call(this.editedRows[key], column.valueIn)) {
|
|
15612
|
+
return this.editedRows[key][column.valueIn];
|
|
15565
15613
|
}
|
|
15566
|
-
return row[column.
|
|
15614
|
+
return row[column.valueIn];
|
|
15567
15615
|
}
|
|
15568
15616
|
/**
|
|
15569
15617
|
* Returns editable component properties based on the column definition
|
|
@@ -15617,13 +15665,13 @@ class TreeGridEditable extends TreeGrid {
|
|
|
15617
15665
|
* If the row[column.name] has a selected value, pushes it
|
|
15618
15666
|
*/
|
|
15619
15667
|
checkLookupData(column, row, componentProps) {
|
|
15620
|
-
if (!row[column.
|
|
15668
|
+
if (!row[column.valueIn] || !column.lookupData || !componentProps.datasource)
|
|
15621
15669
|
return;
|
|
15622
15670
|
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
15623
15671
|
// prevent pushing lookup values when using accessor in data
|
|
15624
15672
|
if (!Array.isArray(componentProps.datasource.data))
|
|
15625
15673
|
return;
|
|
15626
|
-
const colValue = row[column.
|
|
15674
|
+
const colValue = row[column.valueIn];
|
|
15627
15675
|
if (Array.isArray(colValue)) {
|
|
15628
15676
|
colValue.forEach((item) => {
|
|
15629
15677
|
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
@@ -15660,7 +15708,7 @@ class TreeGridEditable extends TreeGrid {
|
|
|
15660
15708
|
*/
|
|
15661
15709
|
changeEditableComponent(column, row, value, component) {
|
|
15662
15710
|
const key = row[this.datasource.uniqueKey];
|
|
15663
|
-
const columnName = column.
|
|
15711
|
+
const columnName = column.valueIn;
|
|
15664
15712
|
if (!Utils.isEqual(value, row[columnName])) {
|
|
15665
15713
|
const newRow = {};
|
|
15666
15714
|
newRow[key] = Object.assign({}, this.editedRows[key]);
|
|
@@ -15695,7 +15743,7 @@ class TreeGridEditable extends TreeGrid {
|
|
|
15695
15743
|
isEdited(column, row) {
|
|
15696
15744
|
const key = row[this.datasource.uniqueKey];
|
|
15697
15745
|
return this.editedRows[key]
|
|
15698
|
-
&& this.editedRows[key][column.
|
|
15746
|
+
&& this.editedRows[key][column.valueIn] !== this.editedRows[key][`${column.valueIn}_original`];
|
|
15699
15747
|
}
|
|
15700
15748
|
/**
|
|
15701
15749
|
* Checks if column is valid
|
|
@@ -15832,7 +15880,7 @@ class TreeGridEditable extends TreeGrid {
|
|
|
15832
15880
|
throw new RowNotFoundError(newRow[uniqueKey], this.name);
|
|
15833
15881
|
}
|
|
15834
15882
|
this.columns.forEach((column) => {
|
|
15835
|
-
const columnName = column.
|
|
15883
|
+
const columnName = column.valueIn;
|
|
15836
15884
|
this.changeCell(newRow[uniqueKey], rowIdx, column, newRow[columnName]);
|
|
15837
15885
|
});
|
|
15838
15886
|
}
|
|
@@ -15917,7 +15965,7 @@ const getForeignLookupRow = (column, row, dataValue, dataTextColumns, foreignCol
|
|
|
15917
15965
|
const dataTextName = typeof item === 'string' ? item : item.name;
|
|
15918
15966
|
lookupRow[dataTextName] = row[foreignColumns[dataTextName] || dataTextName];
|
|
15919
15967
|
});
|
|
15920
|
-
lookupRow[dataValue] = row[column.
|
|
15968
|
+
lookupRow[dataValue] = row[column.valueIn];
|
|
15921
15969
|
return lookupRow;
|
|
15922
15970
|
};
|
|
15923
15971
|
const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns, dataTextColumns) => {
|
|
@@ -15928,7 +15976,7 @@ const getFormatterLookupRow = (column, row, dataValue, formatterDataTextColumns,
|
|
|
15928
15976
|
const formatterDataTextColumn = typeof item === 'string' ? item : item.name;
|
|
15929
15977
|
lookupRow[dataTextName] = row[formatterDataTextColumn];
|
|
15930
15978
|
});
|
|
15931
|
-
lookupRow[dataValue] = row[column.
|
|
15979
|
+
lookupRow[dataValue] = row[column.valueIn];
|
|
15932
15980
|
return lookupRow;
|
|
15933
15981
|
};
|
|
15934
15982
|
/**
|
|
@@ -15942,7 +15990,7 @@ const storeOrRetrieveLookup = (column, row, value, dataValue, componentProps) =>
|
|
|
15942
15990
|
const dataTextColumns = asArray(dataText);
|
|
15943
15991
|
// when using foreignColumns, should store foreign keys information in lookupData
|
|
15944
15992
|
if (foreignColumns) {
|
|
15945
|
-
column.lookupData[row[column.
|
|
15993
|
+
column.lookupData[row[column.valueIn]] = getForeignLookupRow(column, row, dataValue, dataTextColumns, foreignColumns);
|
|
15946
15994
|
return row;
|
|
15947
15995
|
}
|
|
15948
15996
|
// when not using formatterDataText, should fetch data from datasource to be able to format this cell
|
|
@@ -15952,13 +16000,13 @@ const storeOrRetrieveLookup = (column, row, value, dataValue, componentProps) =>
|
|
|
15952
16000
|
const formatterDataTextColumns = asArray(formatterDataText);
|
|
15953
16001
|
// when using formatterDataText, should store dataText information in lookupData
|
|
15954
16002
|
if (formatterDataTextColumns.length === dataTextColumns.length) {
|
|
15955
|
-
const rowColumn = row[column.
|
|
16003
|
+
const rowColumn = row[column.valueIn];
|
|
15956
16004
|
column.lookupData[rowColumn] = getFormatterLookupRow(column, row, dataValue, formatterDataTextColumns, dataTextColumns);
|
|
15957
16005
|
return row;
|
|
15958
16006
|
}
|
|
15959
16007
|
return row;
|
|
15960
16008
|
};
|
|
15961
|
-
const formatter$
|
|
16009
|
+
const formatter$2 = ({ column, value, row, componentProps, }) => {
|
|
15962
16010
|
if (value === null || value === undefined)
|
|
15963
16011
|
return '';
|
|
15964
16012
|
const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, foreignColumns, } = componentProps;
|
|
@@ -15989,12 +16037,12 @@ const formatter$1 = ({ column, value, row, componentProps, }) => {
|
|
|
15989
16037
|
return currentRow[textColumn] || value;
|
|
15990
16038
|
}
|
|
15991
16039
|
const formatterFn = FormatterParserProvider.getFormatter('ZdSelect');
|
|
15992
|
-
return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator });
|
|
16040
|
+
return formatterFn(currentRow, { dataText: textColumn, dataTextSeparator, eagerMask: false });
|
|
15993
16041
|
};
|
|
15994
|
-
FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$
|
|
15995
|
-
FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$
|
|
16042
|
+
FormatterParserProvider.registerFormatter('column_ZdSelect', formatter$2);
|
|
16043
|
+
FormatterParserProvider.registerFormatter('column_ZdSelectTree', formatter$2);
|
|
15996
16044
|
|
|
15997
|
-
const formatter = ({ column, value, row, componentProps, }) => {
|
|
16045
|
+
const formatter$1 = ({ column, value, row, componentProps, }) => {
|
|
15998
16046
|
if (!value || !Array.isArray(value) || value.length === 0)
|
|
15999
16047
|
return '';
|
|
16000
16048
|
const { formatterDataText, foreignColumns, dataText } = componentProps;
|
|
@@ -16032,8 +16080,12 @@ const formatter = ({ column, value, row, componentProps, }) => {
|
|
|
16032
16080
|
});
|
|
16033
16081
|
return result.join(', ');
|
|
16034
16082
|
};
|
|
16035
|
-
FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter);
|
|
16036
|
-
FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter);
|
|
16083
|
+
FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', formatter$1);
|
|
16084
|
+
FormatterParserProvider.registerFormatter('column_ZdSelectTreeMultiple', formatter$1);
|
|
16085
|
+
|
|
16086
|
+
const defaultFormatter = FormatterParserProvider.getFormatter('ZdTextInput');
|
|
16087
|
+
const formatter = ({ value, componentProps, }) => defaultFormatter(value, Object.assign(Object.assign({}, componentProps), { eagerMask: false }));
|
|
16088
|
+
FormatterParserProvider.registerFormatter('column_ZdTextInput', formatter);
|
|
16037
16089
|
|
|
16038
16090
|
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
16039
16091
|
const packageContent = require('../package.json');
|