@sankhyalabs/ezui 4.0.4 → 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 +331 -72
- 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.css +52 -7
- package/dist/collection/components/ez-grid/ez-grid.js +226 -57
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +23 -0
- 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 +409 -111
- 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 +333 -74
- 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-dc15b6d1.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 +32 -11
- package/dist/types/components/ez-grid/subcomponents/selection-counter.d.ts +13 -0
- 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;
|
|
@@ -123793,7 +123897,37 @@ class AgGridController {
|
|
|
123793
123897
|
}
|
|
123794
123898
|
}
|
|
123795
123899
|
|
|
123796
|
-
const
|
|
123900
|
+
const SelectionCounter = (props) => {
|
|
123901
|
+
const { selectionCount, selectionPageCount, total, recordsLength, onSelectAll, onSelectPage, onClearAll, onClose } = props;
|
|
123902
|
+
const pageSelectedRecords = selectionPageCount === recordsLength;
|
|
123903
|
+
const allSelectedRecords = selectionCount === total;
|
|
123904
|
+
return (h("div", Object.assign({ class: "ez-box ez-box--shadow-small" }, getElementID("ezGridSelectionCounter")),
|
|
123905
|
+
h("div", { class: "ez-flex ez-flex--align-items-center ez-size-width--full ez-padding-horizontal--medium" },
|
|
123906
|
+
h("div", { class: "ez-flex ez-flex--wrap ez-flex--align-items-baseline ez-flex--justify-center" },
|
|
123907
|
+
h("label", Object.assign({ innerHTML: getText(selectionCount, allSelectedRecords), class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium ez-margin-top--medium" }, getElementID("ezGridSelectionCounter_label"))),
|
|
123908
|
+
h("div", { class: "ez-flex ez-margin-right--medium" },
|
|
123909
|
+
(pageSelectedRecords || allSelectedRecords) &&
|
|
123910
|
+
h("ez-button", Object.assign({ class: "ez-margin-right--medium", label: `Selecionar ${allSelectedRecords ? "apenas a página atual" : `todos os ${total} registros`}`, mode: "link", onClick: allSelectedRecords ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allSelectedRecords ? "Page" : "All"}`))),
|
|
123911
|
+
h("ez-button", Object.assign({ class: "grid__btn-clear", label: "Limpar", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))),
|
|
123912
|
+
h("button", Object.assign({ class: "grid__btn-close", title: "Fechar", onClick: onClose }, getElementID("ezGridSelectionCounter_close")),
|
|
123913
|
+
h("ez-icon", { iconName: "close" })))));
|
|
123914
|
+
};
|
|
123915
|
+
function getText(selectionCount, allSelectedRecords) {
|
|
123916
|
+
if (allSelectedRecords) {
|
|
123917
|
+
return `Todos os <strong>${selectionCount} registros</strong> da grade estão selecionados.`;
|
|
123918
|
+
}
|
|
123919
|
+
else {
|
|
123920
|
+
const pluralChar = selectionCount > 1 ? "s" : "";
|
|
123921
|
+
return `Há <strong>${selectionCount} registro${pluralChar}</strong> selecionado${pluralChar}.`;
|
|
123922
|
+
}
|
|
123923
|
+
}
|
|
123924
|
+
function getElementID(sufix) {
|
|
123925
|
+
return {
|
|
123926
|
+
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
|
123927
|
+
};
|
|
123928
|
+
}
|
|
123929
|
+
|
|
123930
|
+
const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--more-visible, 2);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ez-grid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s;z-index:var(--ez-grid__selection-counter--z-index)}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}";
|
|
123797
123931
|
|
|
123798
123932
|
const EzGrid$1 = class extends HTMLElement$1 {
|
|
123799
123933
|
constructor() {
|
|
@@ -123804,8 +123938,13 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123804
123938
|
this.ezDoubleClick = createEvent(this, "ezDoubleClick", 7);
|
|
123805
123939
|
this.configChange = createEvent(this, "configChange", 7);
|
|
123806
123940
|
this._gridController = new AgGridController(false);
|
|
123941
|
+
this._debounceTimer = 500;
|
|
123942
|
+
this._selectionAll = false;
|
|
123807
123943
|
this._paginationInfo = undefined;
|
|
123808
123944
|
this._paginationChangedByKeyboard = true;
|
|
123945
|
+
this._showSelectionCounter = false;
|
|
123946
|
+
this._selectionCount = 0;
|
|
123947
|
+
this._selectionPageCount = 0;
|
|
123809
123948
|
this.multipleSelection = undefined;
|
|
123810
123949
|
this.config = undefined;
|
|
123811
123950
|
this.serverUrl = undefined;
|
|
@@ -123860,11 +123999,186 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123860
123999
|
async quickFilter(term) {
|
|
123861
124000
|
this._gridController.quickFilter(term);
|
|
123862
124001
|
}
|
|
124002
|
+
observeConfig(config) {
|
|
124003
|
+
this._gridController.setColumnsState(config.columns);
|
|
124004
|
+
}
|
|
123863
124005
|
onSelectionChange(evt) {
|
|
123864
|
-
|
|
123865
|
-
|
|
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 : []);
|
|
124060
|
+
}
|
|
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
|
+
}
|
|
124069
|
+
if (!this.multipleSelection || !this.isPaginationActived()) {
|
|
124070
|
+
this._showSelectionCounter = false;
|
|
124071
|
+
setTimeout(this.setSelectionCount.bind(this), this._debounceTimer);
|
|
124072
|
+
return;
|
|
124073
|
+
}
|
|
124074
|
+
if (counter > 1) {
|
|
124075
|
+
setTimeout(() => {
|
|
124076
|
+
this.setSelectionCount(counter);
|
|
124077
|
+
this._showSelectionCounter = true;
|
|
124078
|
+
}, this._debounceTimer);
|
|
124079
|
+
}
|
|
124080
|
+
else {
|
|
124081
|
+
this._showSelectionCounter = false;
|
|
124082
|
+
setTimeout(this.setSelectionCount.bind(this, counter), this._debounceTimer);
|
|
124083
|
+
}
|
|
124084
|
+
}
|
|
124085
|
+
setSelectionCount(value = 0) {
|
|
124086
|
+
var _a, _b;
|
|
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;
|
|
124090
|
+
}
|
|
124091
|
+
isPaginationActived() {
|
|
124092
|
+
var _a;
|
|
124093
|
+
const { total, lastRecord, firstRecord } = (_a = this._paginationInfo) !== null && _a !== void 0 ? _a : {};
|
|
124094
|
+
if (total == undefined || lastRecord == undefined || firstRecord == undefined) {
|
|
124095
|
+
return false;
|
|
124096
|
+
}
|
|
124097
|
+
return Math.ceil(total / (lastRecord - firstRecord + 1)) > 1;
|
|
124098
|
+
}
|
|
124099
|
+
onSelectAllRecords() {
|
|
124100
|
+
const allRecord = {
|
|
124101
|
+
__record__id__: ALL_RECORD,
|
|
124102
|
+
filter: this.dataUnit.getFilters(),
|
|
124103
|
+
sort: this.dataUnit.getSort()
|
|
124104
|
+
};
|
|
124105
|
+
this.setSelection([allRecord]);
|
|
124106
|
+
}
|
|
124107
|
+
onSelectPageRecords() {
|
|
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
|
+
});
|
|
124113
|
+
}
|
|
124114
|
+
onClearSelectedRecords() {
|
|
124115
|
+
var _a;
|
|
124116
|
+
(_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
|
|
124117
|
+
}
|
|
124118
|
+
createConfigFromState(state) {
|
|
124119
|
+
let newConfig = { columns: [] };
|
|
124120
|
+
state.forEach(columnState => {
|
|
124121
|
+
if (!columnState.hidden) {
|
|
124122
|
+
let newConfigColumn = { name: columnState.name };
|
|
124123
|
+
if (columnState.width) {
|
|
124124
|
+
newConfigColumn['width'] = columnState.width;
|
|
124125
|
+
}
|
|
124126
|
+
if (columnState.sort) {
|
|
124127
|
+
newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === 'ASC');
|
|
124128
|
+
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
124129
|
+
}
|
|
124130
|
+
else {
|
|
124131
|
+
newConfigColumn['orderIndex'] = 0;
|
|
124132
|
+
}
|
|
124133
|
+
if (newConfigColumn) {
|
|
124134
|
+
newConfig.columns.push(newConfigColumn);
|
|
124135
|
+
}
|
|
124136
|
+
}
|
|
124137
|
+
});
|
|
124138
|
+
return newConfig;
|
|
124139
|
+
}
|
|
124140
|
+
positionSelectionCounter() {
|
|
124141
|
+
var _a;
|
|
124142
|
+
if (this._gridSelectionCounter == undefined) {
|
|
124143
|
+
return;
|
|
124144
|
+
}
|
|
124145
|
+
if (this._showSelectionCounter) {
|
|
124146
|
+
const boundingContainer = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
124147
|
+
if (boundingContainer == undefined) {
|
|
124148
|
+
return;
|
|
124149
|
+
}
|
|
124150
|
+
const limitBottom = boundingContainer.bottom - 30;
|
|
124151
|
+
this._gridSelectionCounter.style.bottom = (document.body.clientHeight - limitBottom) + 'px';
|
|
124152
|
+
}
|
|
124153
|
+
else {
|
|
124154
|
+
this._gridSelectionCounter.style.bottom = "";
|
|
123866
124155
|
}
|
|
123867
124156
|
}
|
|
124157
|
+
setEvents() {
|
|
124158
|
+
window.removeEventListener("scroll", this.positionSelectionCounter.bind(this));
|
|
124159
|
+
window.addEventListener("scroll", this.positionSelectionCounter.bind(this));
|
|
124160
|
+
}
|
|
124161
|
+
resizeSelectionCounter() {
|
|
124162
|
+
if (this._gridSelectionCounter == undefined) {
|
|
124163
|
+
return;
|
|
124164
|
+
}
|
|
124165
|
+
this._gridSelectionCounter.style.width = "";
|
|
124166
|
+
if (this._gridSelectionCounter.clientHeight > 42) {
|
|
124167
|
+
this._gridSelectionCounter.style.width = "min-content";
|
|
124168
|
+
}
|
|
124169
|
+
this.positionSelectionCounter();
|
|
124170
|
+
}
|
|
124171
|
+
configSelectionCounter() {
|
|
124172
|
+
if (this._element == undefined) {
|
|
124173
|
+
return;
|
|
124174
|
+
}
|
|
124175
|
+
if (this._resizeObserver != undefined) {
|
|
124176
|
+
this._resizeObserver.unobserve(this._element);
|
|
124177
|
+
}
|
|
124178
|
+
this._resizeObserver = new ResizeObserver(JSUtils.debounce(this.resizeSelectionCounter.bind(this), 200));
|
|
124179
|
+
this._resizeObserver.observe(this._element);
|
|
124180
|
+
this.resizeSelectionCounter();
|
|
124181
|
+
}
|
|
123868
124182
|
onColumnStateChange(type, state, info) {
|
|
123869
124183
|
var _a;
|
|
123870
124184
|
this.ezColumnStateChange.emit({ type, state, isUserChange: info.isUserChange });
|
|
@@ -123906,56 +124220,6 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123906
124220
|
}
|
|
123907
124221
|
}
|
|
123908
124222
|
}
|
|
123909
|
-
createConfigFromState(state) {
|
|
123910
|
-
let newConfig = { columns: [] };
|
|
123911
|
-
state.forEach(columnState => {
|
|
123912
|
-
if (!columnState.hidden) {
|
|
123913
|
-
let newConfigColumn = { name: columnState.name };
|
|
123914
|
-
if (columnState.width) {
|
|
123915
|
-
newConfigColumn['width'] = columnState.width;
|
|
123916
|
-
}
|
|
123917
|
-
if (columnState.sort) {
|
|
123918
|
-
newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === 'ASC');
|
|
123919
|
-
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
123920
|
-
}
|
|
123921
|
-
else {
|
|
123922
|
-
newConfigColumn['orderIndex'] = 0;
|
|
123923
|
-
}
|
|
123924
|
-
if (newConfigColumn) {
|
|
123925
|
-
newConfig.columns.push(newConfigColumn);
|
|
123926
|
-
}
|
|
123927
|
-
}
|
|
123928
|
-
});
|
|
123929
|
-
return newConfig;
|
|
123930
|
-
}
|
|
123931
|
-
componentDidLoad() {
|
|
123932
|
-
this._gridController.initDatagrid(this._container, {
|
|
123933
|
-
onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
|
|
123934
|
-
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
123935
|
-
onPaginationChange: (paginationInfo) => {
|
|
123936
|
-
var _a;
|
|
123937
|
-
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
123938
|
-
this._gridController.setFocusLastRow();
|
|
123939
|
-
}
|
|
123940
|
-
else {
|
|
123941
|
-
this._gridController.setFocusFirstRow();
|
|
123942
|
-
this._paginationChangedByKeyboard = true;
|
|
123943
|
-
}
|
|
123944
|
-
this._paginationInfo = paginationInfo;
|
|
123945
|
-
},
|
|
123946
|
-
onDoubleClick: (row) => {
|
|
123947
|
-
this.ezDoubleClick.emit(row);
|
|
123948
|
-
},
|
|
123949
|
-
allowMultipleSelection: this.multipleSelection,
|
|
123950
|
-
serverURL: this.serverUrl,
|
|
123951
|
-
dataUnit: this.dataUnit,
|
|
123952
|
-
statusResolver: this.statusResolver
|
|
123953
|
-
});
|
|
123954
|
-
if (this.config) {
|
|
123955
|
-
this.observeConfig(this.config);
|
|
123956
|
-
}
|
|
123957
|
-
this.buildDataElementId();
|
|
123958
|
-
}
|
|
123959
124223
|
buildDataElementId() {
|
|
123960
124224
|
const dataInfo = { dataUnit: this.dataUnit };
|
|
123961
124225
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
@@ -123985,11 +124249,45 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123985
124249
|
}
|
|
123986
124250
|
return null;
|
|
123987
124251
|
}
|
|
123988
|
-
|
|
123989
|
-
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();
|
|
124282
|
+
}
|
|
124283
|
+
componentWillRender() {
|
|
124284
|
+
this.configSelectionCounter();
|
|
123990
124285
|
}
|
|
123991
124286
|
render() {
|
|
123992
|
-
|
|
124287
|
+
var _a, _b, _c;
|
|
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
|
|
124289
|
+
${this._showSelectionCounter ? "grid__selection-counter--opened" : ""}
|
|
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" })));
|
|
123993
124291
|
}
|
|
123994
124292
|
static get assetsDirs() { return ["../assets"]; }
|
|
123995
124293
|
get _element() { return this; }
|
|
@@ -127438,7 +127736,7 @@ const EzBreadcrumb = /*@__PURE__*/proxyCustomElement(EzBreadcrumb$1, [1,"ez-brea
|
|
|
127438
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"]]]);
|
|
127439
127737
|
const EzCalendar = /*@__PURE__*/proxyCustomElement(EzCalendar$1, [1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"]}]);
|
|
127440
127738
|
const EzCardItem = /*@__PURE__*/proxyCustomElement(EzCardItem$1, [1,"ez-card-item",{"item":[16]}]);
|
|
127441
|
-
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]}]);
|
|
127442
127740
|
const EzChip = /*@__PURE__*/proxyCustomElement(EzChip$1, [1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540]}]);
|
|
127443
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]}]);
|
|
127444
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]}]);
|
|
@@ -127450,7 +127748,7 @@ const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-ite
|
|
|
127450
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"]}]);
|
|
127451
127749
|
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16]}]);
|
|
127452
127750
|
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
|
|
127453
|
-
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]},[[0,"ezSelectionChange","onSelectionChange"]]]);
|
|
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"]]]);
|
|
127454
127752
|
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
127455
127753
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
127456
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]}]);
|