@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
|
@@ -20,6 +20,16 @@ const EzCheck = class {
|
|
|
20
20
|
if (newValue != oldValue) {
|
|
21
21
|
this._inputElem.checked = newValue;
|
|
22
22
|
}
|
|
23
|
+
if (this._inputElem.indeterminate != this.indeterminate) {
|
|
24
|
+
this._inputElem.indeterminate = this.indeterminate;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
observeIndeterminate(newValue, oldValue) {
|
|
28
|
+
if (!this._inputElem)
|
|
29
|
+
return;
|
|
30
|
+
if (newValue != oldValue) {
|
|
31
|
+
this._inputElem.indeterminate = newValue;
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
34
|
//---------------------------------------------
|
|
25
35
|
// Public methods
|
|
@@ -64,7 +74,8 @@ const EzCheck = class {
|
|
|
64
74
|
}
|
|
65
75
|
get _element() { return getElement(this); }
|
|
66
76
|
static get watchers() { return {
|
|
67
|
-
"value": ["observeValue"]
|
|
77
|
+
"value": ["observeValue"],
|
|
78
|
+
"indeterminate": ["observeIndeterminate"]
|
|
68
79
|
}; }
|
|
69
80
|
};
|
|
70
81
|
EzCheck.style = ezCheckCss;
|
|
@@ -4,7 +4,7 @@ import { A as ApplicationUtils } from './ApplicationUtils-79bf1d95.js';
|
|
|
4
4
|
import { C as CSSVarsUtils } from './CSSVarsUtils-00f67f32.js';
|
|
5
5
|
import './DialogType-54a62731.js';
|
|
6
6
|
import './CheckMode-bdb2ec19.js';
|
|
7
|
-
import { R as REQUIRED_INFO } from './constants-
|
|
7
|
+
import { R as REQUIRED_INFO } from './constants-76d2e931.js';
|
|
8
8
|
|
|
9
9
|
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)}}";
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-de655f48.js';
|
|
2
2
|
import { UserInterface, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { R as REQUIRED_INFO } from './constants-
|
|
3
|
+
import { R as REQUIRED_INFO } from './constants-76d2e931.js';
|
|
4
4
|
import { C as CheckMode } from './CheckMode-bdb2ec19.js';
|
|
5
5
|
|
|
6
6
|
const buildSwitch = (field) => {
|
|
@@ -115,12 +115,23 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
115
115
|
}
|
|
116
116
|
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
117
117
|
if (defaultValue) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
const { type, value } = defaultValue;
|
|
119
|
+
if (type) {
|
|
120
|
+
if (type === "V") {
|
|
121
|
+
defaultValue = value;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
try {
|
|
125
|
+
const parsed = JSON.parse(value);
|
|
126
|
+
if (parsed && "value" in parsed) {
|
|
127
|
+
defaultValue = parsed;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
defaultValue = value;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (_d) { }
|
|
134
|
+
}
|
|
124
135
|
}
|
|
125
136
|
defaultValues[field.name] = defaultValue;
|
|
126
137
|
}
|
|
@@ -189,9 +200,8 @@ const buildDetailSheet = (child) => {
|
|
|
189
200
|
|
|
190
201
|
class DataBinder {
|
|
191
202
|
constructor(dataUnit) {
|
|
192
|
-
this._invalidFields = new Map();
|
|
193
203
|
this.onDataUnitEvent = (action) => {
|
|
194
|
-
var _a;
|
|
204
|
+
var _a, _b;
|
|
195
205
|
switch (action.type) {
|
|
196
206
|
case Action.DATA_LOADED:
|
|
197
207
|
case Action.DATA_SAVED:
|
|
@@ -200,6 +210,7 @@ class DataBinder {
|
|
|
200
210
|
case Action.RECORDS_COPIED:
|
|
201
211
|
case Action.EDITION_CANCELED:
|
|
202
212
|
case Action.SELECTION_CHANGED:
|
|
213
|
+
case Action.SELECTION_REMOVED:
|
|
203
214
|
case Action.NEXT_SELECTED:
|
|
204
215
|
case Action.PREVIOUS_SELECTED:
|
|
205
216
|
this.clearInvalid();
|
|
@@ -211,13 +222,30 @@ class DataBinder {
|
|
|
211
222
|
this.updateValue(field.fieldName, field.field);
|
|
212
223
|
});
|
|
213
224
|
break;
|
|
225
|
+
case Action.FIELD_INVALIDATED:
|
|
226
|
+
(_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
227
|
+
this.updateErrorMessage(field.fieldName, field.field);
|
|
228
|
+
});
|
|
229
|
+
break;
|
|
214
230
|
}
|
|
215
231
|
};
|
|
216
232
|
this._fields = new Map();
|
|
217
233
|
this._dataUnit = dataUnit;
|
|
234
|
+
this.applyDefaultValues();
|
|
218
235
|
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
219
236
|
this._dataUnit.addInterceptor(this);
|
|
220
237
|
}
|
|
238
|
+
applyDefaultValues() {
|
|
239
|
+
const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
|
|
240
|
+
if (recordIds.length > 0) {
|
|
241
|
+
const defaultValues = this.getDefaultValues();
|
|
242
|
+
if (defaultValues) {
|
|
243
|
+
Object.keys(defaultValues).forEach(field => {
|
|
244
|
+
this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
221
249
|
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
222
250
|
fields.forEach(fieldElement => {
|
|
223
251
|
const { fieldName, contextName } = fieldElement.dataset;
|
|
@@ -232,17 +260,19 @@ class DataBinder {
|
|
|
232
260
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
233
261
|
this._dataUnit.removeInterceptor(this);
|
|
234
262
|
}
|
|
263
|
+
getCurrentRecordId() {
|
|
264
|
+
const record = this._dataUnit.getSelectedRecord();
|
|
265
|
+
return record === null || record === void 0 ? void 0 : record.__record__id__;
|
|
266
|
+
}
|
|
235
267
|
markInvalid(field) {
|
|
236
|
-
this.
|
|
268
|
+
this._dataUnit.setInvalidField(field.name, field.message, this.getCurrentRecordId());
|
|
237
269
|
if (this._fields.has(field.name)) {
|
|
238
270
|
const fieldElement = this._fields.get(field.name).field;
|
|
239
|
-
|
|
240
|
-
this.updateErrorMessage(field.name, fieldElement);
|
|
241
|
-
}
|
|
271
|
+
this.updateErrorMessage(field.name, fieldElement, field.message);
|
|
242
272
|
}
|
|
243
273
|
}
|
|
244
|
-
clearInvalid() {
|
|
245
|
-
this.
|
|
274
|
+
clearInvalid(recordId) {
|
|
275
|
+
this._dataUnit.clearInvalid(recordId);
|
|
246
276
|
this._fields.forEach(fieldBinder => {
|
|
247
277
|
const fieldElement = fieldBinder.field;
|
|
248
278
|
fieldElement["errorMessage"] = "";
|
|
@@ -324,16 +354,18 @@ class DataBinder {
|
|
|
324
354
|
}
|
|
325
355
|
});
|
|
326
356
|
}
|
|
327
|
-
updateErrorMessage(fieldName, field) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
357
|
+
updateErrorMessage(fieldName, field, message) {
|
|
358
|
+
if (message == undefined) {
|
|
359
|
+
message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
|
|
360
|
+
}
|
|
361
|
+
if (!field["errorMessage"]) {
|
|
362
|
+
field["errorMessage"] = message;
|
|
331
363
|
}
|
|
332
364
|
}
|
|
333
365
|
getErrorMessage(fieldName) {
|
|
334
366
|
if (this._fields.has(fieldName)) {
|
|
335
367
|
const fieldElement = this._fields.get(fieldName).field;
|
|
336
|
-
return fieldElement["errorMessage"]
|
|
368
|
+
return fieldElement["errorMessage"];
|
|
337
369
|
}
|
|
338
370
|
return undefined;
|
|
339
371
|
}
|
|
@@ -384,7 +416,7 @@ class DataBinder {
|
|
|
384
416
|
if (this._dataUnit.records.length === 0) {
|
|
385
417
|
this._dataUnit.addRecord();
|
|
386
418
|
}
|
|
387
|
-
this.
|
|
419
|
+
this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
|
|
388
420
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
389
421
|
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
390
422
|
const bind = this._fields.get(fieldName);
|
|
@@ -417,7 +449,6 @@ class DataBinder {
|
|
|
417
449
|
}
|
|
418
450
|
}
|
|
419
451
|
interceptAction(action) {
|
|
420
|
-
var _a;
|
|
421
452
|
if (action.type === Action.RECORDS_COPIED) {
|
|
422
453
|
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
423
454
|
if (cleanFields) {
|
|
@@ -437,30 +468,27 @@ class DataBinder {
|
|
|
437
468
|
});
|
|
438
469
|
}
|
|
439
470
|
if (action.type === Action.RECORDS_ADDED) {
|
|
440
|
-
const defaultValues =
|
|
471
|
+
const defaultValues = this.getDefaultValues();
|
|
441
472
|
if (defaultValues) {
|
|
442
473
|
const records = action.payload;
|
|
443
474
|
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
444
|
-
|
|
445
|
-
for (const field in defaultValues) {
|
|
446
|
-
const defaultValue = this.getFormattedValue(defaultValues[field]);
|
|
447
|
-
const recordValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
448
|
-
newRecord[field] = this._dataUnit.valueFromString(field, recordValue);
|
|
449
|
-
}
|
|
450
|
-
return newRecord;
|
|
475
|
+
return Object.assign(Object.assign({}, record), defaultValues);
|
|
451
476
|
}));
|
|
452
477
|
}
|
|
453
478
|
}
|
|
454
479
|
return action;
|
|
455
480
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
481
|
+
getDefaultValues() {
|
|
482
|
+
var _a;
|
|
483
|
+
const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
484
|
+
if (rawDefaultValues) {
|
|
485
|
+
const defaultValues = {};
|
|
486
|
+
for (const field in rawDefaultValues) {
|
|
487
|
+
defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
|
|
488
|
+
}
|
|
489
|
+
return defaultValues;
|
|
462
490
|
}
|
|
463
|
-
return
|
|
491
|
+
return undefined;
|
|
464
492
|
}
|
|
465
493
|
}
|
|
466
494
|
class Bind {
|