@sankhyalabs/ezui 4.1.0 → 4.2.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/cjs/{constants-5a75e2f3.js → constants-5d588e38.js} +2 -0
- package/dist/cjs/ez-check.cjs.entry.js +12 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +64 -36
- package/dist/cjs/ez-grid.cjs.entry.js +243 -111
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-check/ez-check.js +14 -1
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +16 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +72 -15
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +9 -1
- package/dist/collection/components/ez-grid/ez-grid.js +163 -94
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +2 -2
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +47 -30
- package/dist/collection/utils/form/FormMetadata.js +17 -6
- package/dist/custom-elements/index.js +321 -150
- package/dist/esm/constants-76d2e931.js +4 -0
- package/dist/esm/ez-check.entry.js +12 -1
- package/dist/esm/ez-combo-box.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +64 -36
- package/dist/esm/ez-grid.entry.js +243 -111
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1f841f3c.entry.js +1 -0
- package/dist/ezui/{p-468799e1.entry.js → p-8105c967.entry.js} +2 -2
- package/dist/ezui/{p-50883460.entry.js → p-878646a0.entry.js} +1 -1
- package/dist/ezui/p-a3ce3710.entry.js +1 -0
- package/dist/ezui/p-b01e3085.js +1 -0
- package/dist/ezui/{p-e748b5d3.entry.js → p-b7ea9791.entry.js} +1 -1
- package/dist/types/components/ez-check/ez-check.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -2
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -2
- package/dist/types/components/ez-grid/ez-grid.d.ts +20 -15
- package/dist/types/components/ez-grid/subcomponents/selection-counter.d.ts +2 -1
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -2
- package/package.json +1 -1
- package/dist/esm/constants-ca136201.js +0 -3
- package/dist/ezui/p-08f4a048.entry.js +0 -1
- package/dist/ezui/p-3f4ae3a3.js +0 -1
- package/dist/ezui/p-a323b415.entry.js +0 -1
|
@@ -261,12 +261,23 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
261
261
|
}
|
|
262
262
|
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
263
263
|
if (defaultValue) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
const { type, value } = defaultValue;
|
|
265
|
+
if (type) {
|
|
266
|
+
if (type === "V") {
|
|
267
|
+
defaultValue = value;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
try {
|
|
271
|
+
const parsed = JSON.parse(value);
|
|
272
|
+
if (parsed && "value" in parsed) {
|
|
273
|
+
defaultValue = parsed;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
defaultValue = value;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (_d) { }
|
|
280
|
+
}
|
|
270
281
|
}
|
|
271
282
|
defaultValues[field.name] = defaultValue;
|
|
272
283
|
}
|
|
@@ -335,9 +346,8 @@ const buildDetailSheet = (child) => {
|
|
|
335
346
|
|
|
336
347
|
class DataBinder {
|
|
337
348
|
constructor(dataUnit) {
|
|
338
|
-
this._invalidFields = new Map();
|
|
339
349
|
this.onDataUnitEvent = (action) => {
|
|
340
|
-
var _a;
|
|
350
|
+
var _a, _b;
|
|
341
351
|
switch (action.type) {
|
|
342
352
|
case Action.DATA_LOADED:
|
|
343
353
|
case Action.DATA_SAVED:
|
|
@@ -346,6 +356,7 @@ class DataBinder {
|
|
|
346
356
|
case Action.RECORDS_COPIED:
|
|
347
357
|
case Action.EDITION_CANCELED:
|
|
348
358
|
case Action.SELECTION_CHANGED:
|
|
359
|
+
case Action.SELECTION_REMOVED:
|
|
349
360
|
case Action.NEXT_SELECTED:
|
|
350
361
|
case Action.PREVIOUS_SELECTED:
|
|
351
362
|
this.clearInvalid();
|
|
@@ -357,13 +368,30 @@ class DataBinder {
|
|
|
357
368
|
this.updateValue(field.fieldName, field.field);
|
|
358
369
|
});
|
|
359
370
|
break;
|
|
371
|
+
case Action.FIELD_INVALIDATED:
|
|
372
|
+
(_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
373
|
+
this.updateErrorMessage(field.fieldName, field.field);
|
|
374
|
+
});
|
|
375
|
+
break;
|
|
360
376
|
}
|
|
361
377
|
};
|
|
362
378
|
this._fields = new Map();
|
|
363
379
|
this._dataUnit = dataUnit;
|
|
380
|
+
this.applyDefaultValues();
|
|
364
381
|
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
365
382
|
this._dataUnit.addInterceptor(this);
|
|
366
383
|
}
|
|
384
|
+
applyDefaultValues() {
|
|
385
|
+
const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
|
|
386
|
+
if (recordIds.length > 0) {
|
|
387
|
+
const defaultValues = this.getDefaultValues();
|
|
388
|
+
if (defaultValues) {
|
|
389
|
+
Object.keys(defaultValues).forEach(field => {
|
|
390
|
+
this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
367
395
|
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
368
396
|
fields.forEach(fieldElement => {
|
|
369
397
|
const { fieldName, contextName } = fieldElement.dataset;
|
|
@@ -378,17 +406,19 @@ class DataBinder {
|
|
|
378
406
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
379
407
|
this._dataUnit.removeInterceptor(this);
|
|
380
408
|
}
|
|
409
|
+
getCurrentRecordId() {
|
|
410
|
+
const record = this._dataUnit.getSelectedRecord();
|
|
411
|
+
return record === null || record === void 0 ? void 0 : record.__record__id__;
|
|
412
|
+
}
|
|
381
413
|
markInvalid(field) {
|
|
382
|
-
this.
|
|
414
|
+
this._dataUnit.setInvalidField(field.name, field.message, this.getCurrentRecordId());
|
|
383
415
|
if (this._fields.has(field.name)) {
|
|
384
416
|
const fieldElement = this._fields.get(field.name).field;
|
|
385
|
-
|
|
386
|
-
this.updateErrorMessage(field.name, fieldElement);
|
|
387
|
-
}
|
|
417
|
+
this.updateErrorMessage(field.name, fieldElement, field.message);
|
|
388
418
|
}
|
|
389
419
|
}
|
|
390
|
-
clearInvalid() {
|
|
391
|
-
this.
|
|
420
|
+
clearInvalid(recordId) {
|
|
421
|
+
this._dataUnit.clearInvalid(recordId);
|
|
392
422
|
this._fields.forEach(fieldBinder => {
|
|
393
423
|
const fieldElement = fieldBinder.field;
|
|
394
424
|
fieldElement["errorMessage"] = "";
|
|
@@ -470,16 +500,18 @@ class DataBinder {
|
|
|
470
500
|
}
|
|
471
501
|
});
|
|
472
502
|
}
|
|
473
|
-
updateErrorMessage(fieldName, field) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
503
|
+
updateErrorMessage(fieldName, field, message) {
|
|
504
|
+
if (message == undefined) {
|
|
505
|
+
message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
|
|
506
|
+
}
|
|
507
|
+
if (!field["errorMessage"]) {
|
|
508
|
+
field["errorMessage"] = message;
|
|
477
509
|
}
|
|
478
510
|
}
|
|
479
511
|
getErrorMessage(fieldName) {
|
|
480
512
|
if (this._fields.has(fieldName)) {
|
|
481
513
|
const fieldElement = this._fields.get(fieldName).field;
|
|
482
|
-
return fieldElement["errorMessage"]
|
|
514
|
+
return fieldElement["errorMessage"];
|
|
483
515
|
}
|
|
484
516
|
return undefined;
|
|
485
517
|
}
|
|
@@ -530,7 +562,7 @@ class DataBinder {
|
|
|
530
562
|
if (this._dataUnit.records.length === 0) {
|
|
531
563
|
this._dataUnit.addRecord();
|
|
532
564
|
}
|
|
533
|
-
this.
|
|
565
|
+
this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
|
|
534
566
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
535
567
|
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
536
568
|
const bind = this._fields.get(fieldName);
|
|
@@ -563,7 +595,6 @@ class DataBinder {
|
|
|
563
595
|
}
|
|
564
596
|
}
|
|
565
597
|
interceptAction(action) {
|
|
566
|
-
var _a;
|
|
567
598
|
if (action.type === Action.RECORDS_COPIED) {
|
|
568
599
|
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
569
600
|
if (cleanFields) {
|
|
@@ -583,30 +614,27 @@ class DataBinder {
|
|
|
583
614
|
});
|
|
584
615
|
}
|
|
585
616
|
if (action.type === Action.RECORDS_ADDED) {
|
|
586
|
-
const defaultValues =
|
|
617
|
+
const defaultValues = this.getDefaultValues();
|
|
587
618
|
if (defaultValues) {
|
|
588
619
|
const records = action.payload;
|
|
589
620
|
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
590
|
-
|
|
591
|
-
for (const field in defaultValues) {
|
|
592
|
-
const defaultValue = this.getFormattedValue(defaultValues[field]);
|
|
593
|
-
const recordValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
594
|
-
newRecord[field] = this._dataUnit.valueFromString(field, recordValue);
|
|
595
|
-
}
|
|
596
|
-
return newRecord;
|
|
621
|
+
return Object.assign(Object.assign({}, record), defaultValues);
|
|
597
622
|
}));
|
|
598
623
|
}
|
|
599
624
|
}
|
|
600
625
|
return action;
|
|
601
626
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
627
|
+
getDefaultValues() {
|
|
628
|
+
var _a;
|
|
629
|
+
const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
630
|
+
if (rawDefaultValues) {
|
|
631
|
+
const defaultValues = {};
|
|
632
|
+
for (const field in rawDefaultValues) {
|
|
633
|
+
defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
|
|
634
|
+
}
|
|
635
|
+
return defaultValues;
|
|
608
636
|
}
|
|
609
|
-
return
|
|
637
|
+
return undefined;
|
|
610
638
|
}
|
|
611
639
|
}
|
|
612
640
|
class Bind {
|
|
@@ -1538,6 +1566,16 @@ const EzCheck$1 = class extends HTMLElement$1 {
|
|
|
1538
1566
|
if (newValue != oldValue) {
|
|
1539
1567
|
this._inputElem.checked = newValue;
|
|
1540
1568
|
}
|
|
1569
|
+
if (this._inputElem.indeterminate != this.indeterminate) {
|
|
1570
|
+
this._inputElem.indeterminate = this.indeterminate;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
observeIndeterminate(newValue, oldValue) {
|
|
1574
|
+
if (!this._inputElem)
|
|
1575
|
+
return;
|
|
1576
|
+
if (newValue != oldValue) {
|
|
1577
|
+
this._inputElem.indeterminate = newValue;
|
|
1578
|
+
}
|
|
1541
1579
|
}
|
|
1542
1580
|
//---------------------------------------------
|
|
1543
1581
|
// Public methods
|
|
@@ -1582,7 +1620,8 @@ const EzCheck$1 = class extends HTMLElement$1 {
|
|
|
1582
1620
|
}
|
|
1583
1621
|
get _element() { return this; }
|
|
1584
1622
|
static get watchers() { return {
|
|
1585
|
-
"value": ["observeValue"]
|
|
1623
|
+
"value": ["observeValue"],
|
|
1624
|
+
"indeterminate": ["observeIndeterminate"]
|
|
1586
1625
|
}; }
|
|
1587
1626
|
static get style() { return ezCheckCss; }
|
|
1588
1627
|
};
|
|
@@ -1817,6 +1856,7 @@ const EzCollapsibleBox$1 = class extends HTMLElement$1 {
|
|
|
1817
1856
|
};
|
|
1818
1857
|
|
|
1819
1858
|
const REQUIRED_INFO = " (obrigatório) *";
|
|
1859
|
+
const ALL_RECORD = "ALL_RECORD";
|
|
1820
1860
|
|
|
1821
1861
|
const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
|
|
1822
1862
|
|
|
@@ -123110,6 +123150,7 @@ class DataSource {
|
|
|
123110
123150
|
this._controller.refresh();
|
|
123111
123151
|
break;
|
|
123112
123152
|
case Action.SELECTION_CHANGED:
|
|
123153
|
+
case Action.SELECTION_REMOVED:
|
|
123113
123154
|
case Action.NEXT_SELECTED:
|
|
123114
123155
|
case Action.PREVIOUS_SELECTED:
|
|
123115
123156
|
this.updateSelection();
|
|
@@ -123123,7 +123164,14 @@ class DataSource {
|
|
|
123123
123164
|
this._dataUnit.subscribe(this.duObserver);
|
|
123124
123165
|
}
|
|
123125
123166
|
updateSelection() {
|
|
123126
|
-
|
|
123167
|
+
var _a;
|
|
123168
|
+
const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAllSelection();
|
|
123169
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) > 0) {
|
|
123170
|
+
this._controller.selectRows(selection);
|
|
123171
|
+
}
|
|
123172
|
+
else {
|
|
123173
|
+
this._controller.deselectAll();
|
|
123174
|
+
}
|
|
123127
123175
|
}
|
|
123128
123176
|
getRows(params) {
|
|
123129
123177
|
if (this.needReload(params)) {
|
|
@@ -123325,7 +123373,7 @@ class AgGridController {
|
|
|
123325
123373
|
else {
|
|
123326
123374
|
this._grid = new Grid(container, this._gridOptions);
|
|
123327
123375
|
}
|
|
123328
|
-
const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.
|
|
123376
|
+
const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAllSelection();
|
|
123329
123377
|
if (selection) {
|
|
123330
123378
|
this.selectRows(selection);
|
|
123331
123379
|
}
|
|
@@ -123399,30 +123447,72 @@ class AgGridController {
|
|
|
123399
123447
|
opt.suppressDragLeaveHidesColumns = true;
|
|
123400
123448
|
opt.suppressMenuHide = true;
|
|
123401
123449
|
}
|
|
123450
|
+
isAllRecordSetted(allSelection) {
|
|
123451
|
+
return allSelection === null || allSelection === void 0 ? void 0 : allSelection.some((selectedRecord) => {
|
|
123452
|
+
return selectedRecord.__record__id__ === ALL_RECORD;
|
|
123453
|
+
});
|
|
123454
|
+
}
|
|
123402
123455
|
getSelectionHeaderStatus() {
|
|
123403
123456
|
const records = this._dataUnit.records;
|
|
123404
123457
|
if (records && records.length === 0) {
|
|
123405
123458
|
return false;
|
|
123406
123459
|
}
|
|
123407
|
-
const
|
|
123408
|
-
if (
|
|
123460
|
+
const allSelection = this._dataUnit.getAllSelection();
|
|
123461
|
+
if (allSelection == undefined || allSelection.length === 0) {
|
|
123409
123462
|
return false;
|
|
123410
123463
|
}
|
|
123411
|
-
if (
|
|
123464
|
+
if (this.isAllRecordSetted(allSelection)) {
|
|
123465
|
+
return true;
|
|
123466
|
+
}
|
|
123467
|
+
if (allSelection.length != records.length) {
|
|
123468
|
+
return undefined;
|
|
123469
|
+
}
|
|
123470
|
+
const selectedRecords = this._dataUnit.getSelectedRecords();
|
|
123471
|
+
if (selectedRecords.length < allSelection.length) {
|
|
123412
123472
|
return undefined;
|
|
123413
123473
|
}
|
|
123414
123474
|
let status = undefined;
|
|
123415
123475
|
for (let i = 0; i < records.length; i++) {
|
|
123416
|
-
const current =
|
|
123476
|
+
const current = allSelection.some((selectedRecord) => {
|
|
123477
|
+
return selectedRecord.__record__id__ === records[i].__record__id__;
|
|
123478
|
+
});
|
|
123417
123479
|
if (status != undefined && current !== status) {
|
|
123418
|
-
return
|
|
123480
|
+
return;
|
|
123419
123481
|
}
|
|
123420
123482
|
status = current;
|
|
123421
123483
|
}
|
|
123422
123484
|
return status;
|
|
123423
123485
|
}
|
|
123424
|
-
updateSelectionForAll(selectAll) {
|
|
123425
|
-
|
|
123486
|
+
async updateSelectionForAll(selectAll) {
|
|
123487
|
+
if (this._dataUnit == undefined) {
|
|
123488
|
+
return;
|
|
123489
|
+
}
|
|
123490
|
+
let allSelection = this._dataUnit.getAllSelection();
|
|
123491
|
+
if (allSelection === null || allSelection === void 0 ? void 0 : allSelection.some((sel) => sel.__record__id__ === ALL_RECORD)) {
|
|
123492
|
+
await this._dataUnit.clearSelection();
|
|
123493
|
+
}
|
|
123494
|
+
let updateSelection = [];
|
|
123495
|
+
const records = this._dataUnit.records;
|
|
123496
|
+
const selectedRecords = this._dataUnit.getSelectedRecords();
|
|
123497
|
+
allSelection = this._dataUnit.getAllSelection();
|
|
123498
|
+
if (selectAll && selectedRecords.length < records.length) {
|
|
123499
|
+
updateSelection = records;
|
|
123500
|
+
allSelection.forEach((selectedRecord) => {
|
|
123501
|
+
const recordIds = updateSelection.map((record) => record.__record__id__);
|
|
123502
|
+
if (!recordIds.includes(selectedRecord.__record__id__)) {
|
|
123503
|
+
updateSelection.push(selectedRecord);
|
|
123504
|
+
}
|
|
123505
|
+
});
|
|
123506
|
+
}
|
|
123507
|
+
else {
|
|
123508
|
+
updateSelection = allSelection.filter((selectedRecord) => {
|
|
123509
|
+
return !(records || [])
|
|
123510
|
+
.some((record) => {
|
|
123511
|
+
return record.__record__id__ === selectedRecord.__record__id__;
|
|
123512
|
+
});
|
|
123513
|
+
});
|
|
123514
|
+
}
|
|
123515
|
+
this._dataUnit.setSelection(updateSelection);
|
|
123426
123516
|
}
|
|
123427
123517
|
setData(data) {
|
|
123428
123518
|
if (this._grid === undefined) {
|
|
@@ -123446,7 +123536,7 @@ class AgGridController {
|
|
|
123446
123536
|
}
|
|
123447
123537
|
this._gridOptions.api.forEachNode(node => {
|
|
123448
123538
|
var _a;
|
|
123449
|
-
if (rowIds && rowIds.
|
|
123539
|
+
if (rowIds && rowIds.find(row => row.__record__id__ === node.id)) {
|
|
123450
123540
|
node.setSelected(true);
|
|
123451
123541
|
(_a = this._gridOptions.api) === null || _a === void 0 ? void 0 : _a.ensureNodeVisible(node);
|
|
123452
123542
|
}
|
|
@@ -123454,10 +123544,7 @@ class AgGridController {
|
|
|
123454
123544
|
node.setSelected(false);
|
|
123455
123545
|
}
|
|
123456
123546
|
});
|
|
123457
|
-
|
|
123458
|
-
if (selectionHeader) {
|
|
123459
|
-
selectionHeader.updateCheckbox();
|
|
123460
|
-
}
|
|
123547
|
+
this.updateCheckbox();
|
|
123461
123548
|
}
|
|
123462
123549
|
removeRows() {
|
|
123463
123550
|
if (this._grid === undefined) {
|
|
@@ -123552,7 +123639,7 @@ class AgGridController {
|
|
|
123552
123639
|
if (this._grid === undefined) {
|
|
123553
123640
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
123554
123641
|
}
|
|
123555
|
-
const colDef = this._gridOptions.columnApi.
|
|
123642
|
+
const colDef = this._gridOptions.columnApi.getColumns();
|
|
123556
123643
|
return colDef.filter(c => ![this.CHECK_BOX_COL_ID, this.STATUS_COL_ID].includes(c.getColId())).map(c => {
|
|
123557
123644
|
const def = c.getColDef();
|
|
123558
123645
|
const colDef = { name: def.field, label: def.headerName };
|
|
@@ -123570,12 +123657,16 @@ class AgGridController {
|
|
|
123570
123657
|
if (this._grid === undefined) {
|
|
123571
123658
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
123572
123659
|
}
|
|
123660
|
+
const colDef = this._gridOptions.columnApi.getColumns();
|
|
123573
123661
|
let columns = this.getColumnsDef();
|
|
123574
123662
|
let visibleColumns = [];
|
|
123663
|
+
//Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
|
|
123664
|
+
//Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
|
|
123665
|
+
const columnsOffset = colDef.length - columns.length;
|
|
123575
123666
|
let sort = [];
|
|
123576
123667
|
state.forEach((cfgColumn, index) => {
|
|
123577
123668
|
const colWidth = this.getColumnWidth(cfgColumn);
|
|
123578
|
-
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index +
|
|
123669
|
+
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
|
|
123579
123670
|
this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
|
|
123580
123671
|
visibleColumns.push(cfgColumn.name);
|
|
123581
123672
|
if (cfgColumn.ascending !== undefined) {
|
|
@@ -123636,6 +123727,19 @@ class AgGridController {
|
|
|
123636
123727
|
var _a;
|
|
123637
123728
|
(_a = this._gridOptions.api.getDisplayedRowAtIndex(index)) === null || _a === void 0 ? void 0 : _a.setSelected(true);
|
|
123638
123729
|
}
|
|
123730
|
+
deselectAll() {
|
|
123731
|
+
var _a, _b;
|
|
123732
|
+
(_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.deselectAll();
|
|
123733
|
+
this.updateCheckbox();
|
|
123734
|
+
}
|
|
123735
|
+
updateCheckbox() {
|
|
123736
|
+
var _a, _b;
|
|
123737
|
+
const selectionHeader = (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.selectionHeader;
|
|
123738
|
+
if (selectionHeader == undefined) {
|
|
123739
|
+
return;
|
|
123740
|
+
}
|
|
123741
|
+
selectionHeader.updateCheckbox();
|
|
123742
|
+
}
|
|
123639
123743
|
buildColDef(source) {
|
|
123640
123744
|
var _a, _b, _c;
|
|
123641
123745
|
let tooltip = undefined;
|
|
@@ -123794,8 +123898,8 @@ class AgGridController {
|
|
|
123794
123898
|
}
|
|
123795
123899
|
|
|
123796
123900
|
const SelectionCounter = (props) => {
|
|
123797
|
-
const { selectionCount, total,
|
|
123798
|
-
const pageSelectedRecords =
|
|
123901
|
+
const { selectionCount, selectionPageCount, total, recordsLength, onSelectAll, onSelectPage, onClearAll, onClose } = props;
|
|
123902
|
+
const pageSelectedRecords = selectionPageCount === recordsLength;
|
|
123799
123903
|
const allSelectedRecords = selectionCount === total;
|
|
123800
123904
|
return (h("div", Object.assign({ class: "ez-box ez-box--shadow-small" }, getElementID("ezGridSelectionCounter")),
|
|
123801
123905
|
h("div", { class: "ez-flex ez-flex--align-items-center ez-size-width--full ez-padding-horizontal--medium" },
|
|
@@ -123835,10 +123939,12 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123835
123939
|
this.configChange = createEvent(this, "configChange", 7);
|
|
123836
123940
|
this._gridController = new AgGridController(false);
|
|
123837
123941
|
this._debounceTimer = 500;
|
|
123942
|
+
this._selectionAll = false;
|
|
123838
123943
|
this._paginationInfo = undefined;
|
|
123839
123944
|
this._paginationChangedByKeyboard = true;
|
|
123840
|
-
this._selectionCount = 0;
|
|
123841
123945
|
this._showSelectionCounter = false;
|
|
123946
|
+
this._selectionCount = 0;
|
|
123947
|
+
this._selectionPageCount = 0;
|
|
123842
123948
|
this.multipleSelection = undefined;
|
|
123843
123949
|
this.config = undefined;
|
|
123844
123950
|
this.serverUrl = undefined;
|
|
@@ -123893,32 +123999,94 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123893
123999
|
async quickFilter(term) {
|
|
123894
124000
|
this._gridController.quickFilter(term);
|
|
123895
124001
|
}
|
|
124002
|
+
observeConfig(config) {
|
|
124003
|
+
this._gridController.setColumnsState(config.columns);
|
|
124004
|
+
}
|
|
123896
124005
|
onSelectionChange(evt) {
|
|
123897
|
-
|
|
123898
|
-
|
|
123899
|
-
|
|
124006
|
+
const { selection } = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
124007
|
+
if (selection == undefined || this.dataUnit == undefined) {
|
|
124008
|
+
return;
|
|
124009
|
+
}
|
|
124010
|
+
if (this.isAllRecordSetted()) {
|
|
124011
|
+
this.updateSelectionPage(selection);
|
|
124012
|
+
return;
|
|
124013
|
+
}
|
|
124014
|
+
this.setSelection(selection);
|
|
124015
|
+
}
|
|
124016
|
+
updateSelectionPage(selection) {
|
|
124017
|
+
if (this._selectionAll) {
|
|
124018
|
+
this._selectionAll = false;
|
|
124019
|
+
}
|
|
124020
|
+
else {
|
|
124021
|
+
this.dataUnit.clearSelection()
|
|
124022
|
+
.then(() => {
|
|
124023
|
+
const records = this.dataUnit.records;
|
|
124024
|
+
const selectionPage = selection.filter((selectedRecord) => {
|
|
124025
|
+
return records.some((record) => {
|
|
124026
|
+
return record.__record__id__ === selectedRecord.__record__id__;
|
|
124027
|
+
});
|
|
124028
|
+
});
|
|
124029
|
+
this._gridController.selectRows(selectionPage);
|
|
124030
|
+
});
|
|
124031
|
+
}
|
|
124032
|
+
}
|
|
124033
|
+
isAllRecordSetted() {
|
|
124034
|
+
var _a;
|
|
124035
|
+
const allSelection = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAllSelection();
|
|
124036
|
+
return allSelection === null || allSelection === void 0 ? void 0 : allSelection.some((selectedRecord) => {
|
|
124037
|
+
return selectedRecord.__record__id__ === ALL_RECORD;
|
|
124038
|
+
});
|
|
124039
|
+
}
|
|
124040
|
+
setSelection(selection) {
|
|
124041
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.length) > 0) {
|
|
124042
|
+
this.dataUnit.setSelection(selection)
|
|
124043
|
+
.then(this.controlSelectionCounter.bind(this));
|
|
124044
|
+
}
|
|
124045
|
+
else {
|
|
124046
|
+
this.dataUnit.clearSelection()
|
|
124047
|
+
.then(this.controlSelectionCounter.bind(this));
|
|
124048
|
+
}
|
|
124049
|
+
}
|
|
124050
|
+
setAutoSelectAll() {
|
|
124051
|
+
var _a, _b, _c, _d;
|
|
124052
|
+
const { total } = (_a = this._paginationInfo) !== null && _a !== void 0 ? _a : {};
|
|
124053
|
+
if (total == undefined) {
|
|
124054
|
+
return;
|
|
124055
|
+
}
|
|
124056
|
+
this._selectionCount = total;
|
|
124057
|
+
this._selectionAll = true;
|
|
124058
|
+
this._showSelectionCounter = true;
|
|
124059
|
+
(_b = this._gridController) === null || _b === void 0 ? void 0 : _b.selectRows((_d = (_c = this.dataUnit) === null || _c === void 0 ? void 0 : _c.records) !== null && _d !== void 0 ? _d : []);
|
|
123900
124060
|
}
|
|
123901
|
-
|
|
124061
|
+
controlSelectionCounter() {
|
|
124062
|
+
var _a, _b;
|
|
124063
|
+
const allSelection = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAllSelection();
|
|
124064
|
+
const counter = (_b = allSelection === null || allSelection === void 0 ? void 0 : allSelection.length) !== null && _b !== void 0 ? _b : 0;
|
|
124065
|
+
if (this.isAllRecordSetted()) {
|
|
124066
|
+
this.setAutoSelectAll();
|
|
124067
|
+
return;
|
|
124068
|
+
}
|
|
123902
124069
|
if (!this.multipleSelection || !this.isPaginationActived()) {
|
|
123903
124070
|
this._showSelectionCounter = false;
|
|
123904
124071
|
setTimeout(this.setSelectionCount.bind(this), this._debounceTimer);
|
|
123905
124072
|
return;
|
|
123906
124073
|
}
|
|
123907
|
-
|
|
123908
|
-
|
|
123909
|
-
var _a;
|
|
123910
|
-
const counter = (_a = records === null || records === void 0 ? void 0 : records.length) !== null && _a !== void 0 ? _a : 0;
|
|
123911
|
-
this._showSelectionCounter = counter > 1;
|
|
123912
|
-
if (this._showSelectionCounter) {
|
|
124074
|
+
if (counter > 1) {
|
|
124075
|
+
setTimeout(() => {
|
|
123913
124076
|
this.setSelectionCount(counter);
|
|
123914
|
-
|
|
123915
|
-
|
|
123916
|
-
|
|
123917
|
-
|
|
123918
|
-
|
|
124077
|
+
this._showSelectionCounter = true;
|
|
124078
|
+
}, this._debounceTimer);
|
|
124079
|
+
}
|
|
124080
|
+
else {
|
|
124081
|
+
this._showSelectionCounter = false;
|
|
124082
|
+
setTimeout(this.setSelectionCount.bind(this, counter), this._debounceTimer);
|
|
124083
|
+
}
|
|
123919
124084
|
}
|
|
123920
124085
|
setSelectionCount(value = 0) {
|
|
124086
|
+
var _a, _b;
|
|
123921
124087
|
this._selectionCount = value;
|
|
124088
|
+
const selectPageRecords = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecords();
|
|
124089
|
+
this._selectionPageCount = (_b = selectPageRecords === null || selectPageRecords === void 0 ? void 0 : selectPageRecords.length) !== null && _b !== void 0 ? _b : 0;
|
|
123922
124090
|
}
|
|
123923
124091
|
isPaginationActived() {
|
|
123924
124092
|
var _a;
|
|
@@ -123929,60 +124097,23 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123929
124097
|
return Math.ceil(total / (lastRecord - firstRecord + 1)) > 1;
|
|
123930
124098
|
}
|
|
123931
124099
|
onSelectAllRecords() {
|
|
123932
|
-
|
|
123933
|
-
|
|
123934
|
-
|
|
123935
|
-
|
|
123936
|
-
}
|
|
123937
|
-
this.
|
|
124100
|
+
const allRecord = {
|
|
124101
|
+
__record__id__: ALL_RECORD,
|
|
124102
|
+
filter: this.dataUnit.getFilters(),
|
|
124103
|
+
sort: this.dataUnit.getSort()
|
|
124104
|
+
};
|
|
124105
|
+
this.setSelection([allRecord]);
|
|
123938
124106
|
}
|
|
123939
124107
|
onSelectPageRecords() {
|
|
123940
|
-
|
|
124108
|
+
var _a;
|
|
124109
|
+
(_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection().then(() => {
|
|
124110
|
+
var _a, _b, _c;
|
|
124111
|
+
(_a = this._gridController) === null || _a === void 0 ? void 0 : _a.selectRows((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) !== null && _c !== void 0 ? _c : []);
|
|
124112
|
+
});
|
|
123941
124113
|
}
|
|
123942
124114
|
onClearSelectedRecords() {
|
|
123943
124115
|
var _a;
|
|
123944
|
-
(_a = this.
|
|
123945
|
-
}
|
|
123946
|
-
onColumnStateChange(type, state, info) {
|
|
123947
|
-
var _a;
|
|
123948
|
-
this.ezColumnStateChange.emit({ type, state, isUserChange: info.isUserChange });
|
|
123949
|
-
if (info.isUserChange) {
|
|
123950
|
-
if (type === 'columnMovedEnd' && !info.isElementResize) {
|
|
123951
|
-
let newConfig;
|
|
123952
|
-
if (this.config) {
|
|
123953
|
-
newConfig = { columns: [] };
|
|
123954
|
-
state.forEach(columnState => {
|
|
123955
|
-
let newConfigColumn = this.config.columns.find(column => column.name === columnState.name);
|
|
123956
|
-
if (newConfigColumn) {
|
|
123957
|
-
newConfigColumn.width = columnState.width;
|
|
123958
|
-
newConfig.columns.push(newConfigColumn);
|
|
123959
|
-
}
|
|
123960
|
-
});
|
|
123961
|
-
}
|
|
123962
|
-
else {
|
|
123963
|
-
newConfig = this.createConfigFromState(state);
|
|
123964
|
-
}
|
|
123965
|
-
if (newConfig.columns.length > 0) {
|
|
123966
|
-
this.configChange.emit(newConfig);
|
|
123967
|
-
}
|
|
123968
|
-
}
|
|
123969
|
-
else if (type === 'columnResize') {
|
|
123970
|
-
if ((_a = info.column) === null || _a === void 0 ? void 0 : _a.colId) {
|
|
123971
|
-
let newConfig;
|
|
123972
|
-
if (this.config) {
|
|
123973
|
-
newConfig = Object.assign({}, this.config);
|
|
123974
|
-
}
|
|
123975
|
-
else {
|
|
123976
|
-
newConfig = this.createConfigFromState(state);
|
|
123977
|
-
}
|
|
123978
|
-
let newColumn = newConfig.columns.find(column => column.name === info.column.colId);
|
|
123979
|
-
if (newColumn) {
|
|
123980
|
-
newColumn.customWidth = info.column.actualWidth;
|
|
123981
|
-
this.configChange.emit(newConfig);
|
|
123982
|
-
}
|
|
123983
|
-
}
|
|
123984
|
-
}
|
|
123985
|
-
}
|
|
124116
|
+
(_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
|
|
123986
124117
|
}
|
|
123987
124118
|
createConfigFromState(state) {
|
|
123988
124119
|
let newConfig = { columns: [] };
|
|
@@ -124048,34 +124179,46 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
124048
124179
|
this._resizeObserver.observe(this._element);
|
|
124049
124180
|
this.resizeSelectionCounter();
|
|
124050
124181
|
}
|
|
124051
|
-
|
|
124052
|
-
|
|
124053
|
-
|
|
124054
|
-
|
|
124055
|
-
|
|
124056
|
-
|
|
124057
|
-
if (
|
|
124058
|
-
|
|
124182
|
+
onColumnStateChange(type, state, info) {
|
|
124183
|
+
var _a;
|
|
124184
|
+
this.ezColumnStateChange.emit({ type, state, isUserChange: info.isUserChange });
|
|
124185
|
+
if (info.isUserChange) {
|
|
124186
|
+
if (type === 'columnMovedEnd' && !info.isElementResize) {
|
|
124187
|
+
let newConfig;
|
|
124188
|
+
if (this.config) {
|
|
124189
|
+
newConfig = { columns: [] };
|
|
124190
|
+
state.forEach(columnState => {
|
|
124191
|
+
let newConfigColumn = this.config.columns.find(column => column.name === columnState.name);
|
|
124192
|
+
if (newConfigColumn) {
|
|
124193
|
+
newConfigColumn.width = columnState.width;
|
|
124194
|
+
newConfig.columns.push(newConfigColumn);
|
|
124195
|
+
}
|
|
124196
|
+
});
|
|
124059
124197
|
}
|
|
124060
124198
|
else {
|
|
124061
|
-
this.
|
|
124062
|
-
this._paginationChangedByKeyboard = true;
|
|
124199
|
+
newConfig = this.createConfigFromState(state);
|
|
124063
124200
|
}
|
|
124064
|
-
|
|
124065
|
-
|
|
124066
|
-
|
|
124067
|
-
|
|
124068
|
-
|
|
124069
|
-
|
|
124070
|
-
|
|
124071
|
-
|
|
124072
|
-
|
|
124073
|
-
|
|
124074
|
-
|
|
124075
|
-
|
|
124201
|
+
if (newConfig.columns.length > 0) {
|
|
124202
|
+
this.configChange.emit(newConfig);
|
|
124203
|
+
}
|
|
124204
|
+
}
|
|
124205
|
+
else if (type === 'columnResize') {
|
|
124206
|
+
if ((_a = info.column) === null || _a === void 0 ? void 0 : _a.colId) {
|
|
124207
|
+
let newConfig;
|
|
124208
|
+
if (this.config) {
|
|
124209
|
+
newConfig = Object.assign({}, this.config);
|
|
124210
|
+
}
|
|
124211
|
+
else {
|
|
124212
|
+
newConfig = this.createConfigFromState(state);
|
|
124213
|
+
}
|
|
124214
|
+
let newColumn = newConfig.columns.find(column => column.name === info.column.colId);
|
|
124215
|
+
if (newColumn) {
|
|
124216
|
+
newColumn.customWidth = info.column.actualWidth;
|
|
124217
|
+
this.configChange.emit(newConfig);
|
|
124218
|
+
}
|
|
124219
|
+
}
|
|
124220
|
+
}
|
|
124076
124221
|
}
|
|
124077
|
-
this.buildDataElementId();
|
|
124078
|
-
this.setEvents();
|
|
124079
124222
|
}
|
|
124080
124223
|
buildDataElementId() {
|
|
124081
124224
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
@@ -124106,17 +124249,45 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
124106
124249
|
}
|
|
124107
124250
|
return null;
|
|
124108
124251
|
}
|
|
124109
|
-
|
|
124110
|
-
this._gridController.
|
|
124252
|
+
componentDidLoad() {
|
|
124253
|
+
this._gridController.initDatagrid(this._container, {
|
|
124254
|
+
onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
|
|
124255
|
+
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
124256
|
+
onPaginationChange: (paginationInfo) => {
|
|
124257
|
+
var _a;
|
|
124258
|
+
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
124259
|
+
this._gridController.setFocusLastRow();
|
|
124260
|
+
}
|
|
124261
|
+
else {
|
|
124262
|
+
this._gridController.setFocusFirstRow();
|
|
124263
|
+
this._paginationChangedByKeyboard = true;
|
|
124264
|
+
}
|
|
124265
|
+
this._paginationInfo = paginationInfo;
|
|
124266
|
+
this._gridController.updateCheckbox();
|
|
124267
|
+
this.controlSelectionCounter();
|
|
124268
|
+
},
|
|
124269
|
+
onDoubleClick: (row) => {
|
|
124270
|
+
this.ezDoubleClick.emit(row);
|
|
124271
|
+
},
|
|
124272
|
+
allowMultipleSelection: this.multipleSelection,
|
|
124273
|
+
serverURL: this.serverUrl,
|
|
124274
|
+
dataUnit: this.dataUnit,
|
|
124275
|
+
statusResolver: this.statusResolver
|
|
124276
|
+
});
|
|
124277
|
+
if (this.config) {
|
|
124278
|
+
this.observeConfig(this.config);
|
|
124279
|
+
}
|
|
124280
|
+
this.buildDataElementId();
|
|
124281
|
+
this.setEvents();
|
|
124111
124282
|
}
|
|
124112
124283
|
componentWillRender() {
|
|
124113
124284
|
this.configSelectionCounter();
|
|
124114
124285
|
}
|
|
124115
124286
|
render() {
|
|
124116
|
-
var _a, _b;
|
|
124287
|
+
var _a, _b, _c;
|
|
124117
124288
|
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => this._refPaginationControl = ref }, this.getPaginationControl())), h("div", { ref: (ref) => this._gridSelectionCounter = ref, class: `grid__selection-counter
|
|
124118
124289
|
${this._showSelectionCounter ? "grid__selection-counter--opened" : ""}
|
|
124119
|
-
` }, h(SelectionCounter, { selectionCount: this._selectionCount, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total,
|
|
124290
|
+
` }, h(SelectionCounter, { selectionCount: this._selectionCount, selectionPageCount: this._selectionPageCount, total: (_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.total, recordsLength: (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length, onSelectAll: this.onSelectAllRecords.bind(this), onSelectPage: this.onSelectPageRecords.bind(this), onClearAll: this.onClearSelectedRecords.bind(this), onClose: () => this._showSelectionCounter = false })), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" })));
|
|
124120
124291
|
}
|
|
124121
124292
|
static get assetsDirs() { return ["../assets"]; }
|
|
124122
124293
|
get _element() { return this; }
|
|
@@ -127565,7 +127736,7 @@ const EzBreadcrumb = /*@__PURE__*/proxyCustomElement(EzBreadcrumb$1, [1,"ez-brea
|
|
|
127565
127736
|
const EzButton = /*@__PURE__*/proxyCustomElement(EzButton$1, [1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513]},[[2,"click","clickListener"]]]);
|
|
127566
127737
|
const EzCalendar = /*@__PURE__*/proxyCustomElement(EzCalendar$1, [1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"]}]);
|
|
127567
127738
|
const EzCardItem = /*@__PURE__*/proxyCustomElement(EzCardItem$1, [1,"ez-card-item",{"item":[16]}]);
|
|
127568
|
-
const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[
|
|
127739
|
+
const EzCheck = /*@__PURE__*/proxyCustomElement(EzCheck$1, [1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[1540],"mode":[513]}]);
|
|
127569
127740
|
const EzChip = /*@__PURE__*/proxyCustomElement(EzChip$1, [1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540]}]);
|
|
127570
127741
|
const EzCollapsibleBox = /*@__PURE__*/proxyCustomElement(EzCollapsibleBox$1, [1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"headerAlign":[513,"header-align"],"removable":[516],"editable":[516],"conditionalSave":[16],"_activeEditText":[32]}]);
|
|
127571
127742
|
const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32]}]);
|
|
@@ -127577,7 +127748,7 @@ const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-ite
|
|
|
127577
127748
|
const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"]}]);
|
|
127578
127749
|
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16]}]);
|
|
127579
127750
|
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
|
|
127580
|
-
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_selectionCount":[32],"
|
|
127751
|
+
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_selectionCount":[32],"_selectionPageCount":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
|
|
127581
127752
|
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
127582
127753
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
127583
127754
|
const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32]}]);
|