@acorex/components 7.4.8 → 7.5.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/button/lib/button.module.d.ts +2 -1
- package/common/lib/classes/datalist.class.d.ts +3 -3
- package/common/lib/components/selection-base.component.class.d.ts +3 -9
- package/datetime-box/lib/datetime-box.component.d.ts +2 -1
- package/dialog/lib/dialog.class.d.ts +4 -2
- package/dialog/lib/dialog.service.d.ts +3 -2
- package/dropdown/lib/dropdown-box.component.d.ts +1 -0
- package/esm2022/action-sheet/lib/action-sheet.component.mjs +2 -2
- package/esm2022/alert/lib/alert.component.mjs +6 -7
- package/esm2022/avatar/lib/avatar.component.mjs +2 -2
- package/esm2022/button/lib/button.component.mjs +2 -2
- package/esm2022/button/lib/button.module.mjs +4 -3
- package/esm2022/common/lib/classes/datalist.class.mjs +52 -1
- package/esm2022/common/lib/components/selection-base.component.class.mjs +13 -36
- package/esm2022/common/lib/components/value-component.class.mjs +3 -3
- package/esm2022/datetime-box/lib/datetime-box.component.mjs +7 -4
- package/esm2022/dialog/lib/dialog.class.mjs +1 -1
- package/esm2022/dialog/lib/dialog.component.mjs +3 -17
- package/esm2022/dialog/lib/dialog.service.mjs +47 -24
- package/esm2022/dropdown/lib/dropdown-box.component.mjs +8 -5
- package/esm2022/dropdown/lib/dropdown-panel.component.mjs +3 -3
- package/esm2022/form/lib/form-field.component.mjs +2 -2
- package/esm2022/label/lib/label.component.mjs +2 -2
- package/esm2022/list/acorex-components-list.mjs +5 -0
- package/esm2022/list/index.mjs +3 -0
- package/esm2022/list/lib/list.component.mjs +221 -0
- package/esm2022/list/lib/list.module.mjs +22 -0
- package/esm2022/loading/lib/loading.module.mjs +22 -8
- package/esm2022/loading/lib/loading.service.mjs +9 -13
- package/esm2022/menu/index.mjs +4 -1
- package/esm2022/menu/lib/class/root-menu.class.mjs +3 -0
- package/esm2022/menu/lib/menu-item/menu-item.component.mjs +96 -0
- package/esm2022/menu/lib/menu.component.mjs +4 -4
- package/esm2022/menu/lib/menu.module.mjs +11 -16
- package/esm2022/menu/lib/menu2.component.mjs +45 -0
- package/esm2022/mixin/lib/datalist.class.mjs +46 -2
- package/esm2022/notification/lib/notification.component.mjs +7 -7
- package/esm2022/popover/lib/popover.component.mjs +8 -5
- package/esm2022/popup/lib/popup.component.mjs +1 -2
- package/esm2022/popup/lib/popup.service.mjs +1 -2
- package/esm2022/progress-bar/lib/progress-bar.component.mjs +2 -2
- package/esm2022/result/lib/result.component.mjs +2 -2
- package/esm2022/select-box/index.mjs +2 -1
- package/esm2022/select-box/lib/select-box.component.mjs +3 -3
- package/esm2022/select-box/lib/select-box.module.mjs +15 -6
- package/esm2022/select-box/lib/select-box2.component.mjs +97 -0
- package/esm2022/selection-list/lib/selection-list.component.mjs +22 -7
- package/esm2022/tabs/lib/tabs.component.mjs +2 -2
- package/esm2022/text-area/lib/text-area.component.mjs +14 -6
- package/esm2022/toast/lib/toast.component.mjs +5 -5
- package/fesm2022/acorex-components-action-sheet.mjs +2 -2
- package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
- package/fesm2022/acorex-components-alert.mjs +5 -6
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-avatar.mjs +2 -2
- package/fesm2022/acorex-components-button.mjs +5 -4
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-common.mjs +65 -37
- package/fesm2022/acorex-components-common.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-box.mjs +6 -3
- package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
- package/fesm2022/acorex-components-dialog.mjs +47 -38
- package/fesm2022/acorex-components-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown.mjs +9 -7
- package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
- package/fesm2022/acorex-components-form.mjs +2 -2
- package/fesm2022/acorex-components-form.mjs.map +1 -1
- package/fesm2022/acorex-components-label.mjs +2 -2
- package/fesm2022/acorex-components-label.mjs.map +1 -1
- package/fesm2022/acorex-components-list.mjs +246 -0
- package/fesm2022/acorex-components-list.mjs.map +1 -0
- package/fesm2022/acorex-components-loading.mjs +23 -15
- package/fesm2022/acorex-components-loading.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +148 -21
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-mixin.mjs +46 -1
- package/fesm2022/acorex-components-mixin.mjs.map +1 -1
- package/fesm2022/acorex-components-notification.mjs +7 -7
- package/fesm2022/acorex-components-notification.mjs.map +1 -1
- package/fesm2022/acorex-components-popover.mjs +7 -4
- package/fesm2022/acorex-components-popover.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +0 -2
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-progress-bar.mjs +2 -2
- package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
- package/fesm2022/acorex-components-result.mjs +2 -2
- package/fesm2022/acorex-components-select-box.mjs +116 -18
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list.mjs +21 -6
- package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2022/acorex-components-tabs.mjs +2 -2
- package/fesm2022/acorex-components-tabs.mjs.map +1 -1
- package/fesm2022/acorex-components-text-area.mjs +13 -5
- package/fesm2022/acorex-components-text-area.mjs.map +1 -1
- package/fesm2022/acorex-components-toast.mjs +3 -3
- package/fesm2022/acorex-components-toast.mjs.map +1 -1
- package/list/README.md +3 -0
- package/list/index.d.ts +2 -0
- package/list/lib/list.component.d.ts +59 -0
- package/list/lib/list.module.d.ts +9 -0
- package/loading/lib/loading.module.d.ts +3 -2
- package/menu/index.d.ts +3 -0
- package/menu/lib/class/root-menu.class.d.ts +4 -0
- package/menu/lib/menu-item/menu-item.component.d.ts +22 -0
- package/menu/lib/menu.component.d.ts +3 -3
- package/menu/lib/menu.module.d.ts +10 -7
- package/menu/lib/menu2.component.d.ts +12 -0
- package/mixin/lib/base-components.class.d.ts +2 -2
- package/mixin/lib/base-menu-mixin.class.d.ts +5 -5
- package/mixin/lib/button-mixin.class.d.ts +2 -2
- package/mixin/lib/clickable-mixin.class.d.ts +2 -2
- package/mixin/lib/color-look-mixing.class.d.ts +2 -2
- package/mixin/lib/datalist-component.class.d.ts +10 -10
- package/mixin/lib/datalist.class.d.ts +38 -0
- package/mixin/lib/dropdown-mixin.class.d.ts +2 -2
- package/mixin/lib/interactive-mixin.class.d.ts +4 -4
- package/mixin/lib/mixin.class.d.ts +61 -61
- package/mixin/lib/page-component.class.d.ts +2 -2
- package/mixin/lib/selection-component.class.d.ts +2 -2
- package/mixin/lib/sizable-mixin.class.d.ts +2 -2
- package/mixin/lib/textbox-mixin.class.d.ts +2 -2
- package/mixin/lib/value-mixin.class.d.ts +8 -8
- package/notification/lib/notification.component.d.ts +3 -3
- package/package.json +7 -1
- package/popover/lib/popover.component.d.ts +2 -1
- package/select-box/index.d.ts +1 -0
- package/select-box/lib/select-box.module.d.ts +15 -12
- package/select-box/lib/select-box2.component.d.ts +25 -0
- package/selection-list/lib/selection-list.component.d.ts +5 -1
- package/text-area/lib/text-area.component.d.ts +10 -3
- package/toast/lib/toast.component.d.ts +3 -3
@@ -9,6 +9,7 @@ import { map, pairwise, filter, startWith, exhaustMap } from 'rxjs/operators';
|
|
9
9
|
import { classes } from 'polytype';
|
10
10
|
import { AXHtmlUtil } from '@acorex/core/utils';
|
11
11
|
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
12
|
+
import isEqual from 'lodash-es/isEqual';
|
12
13
|
import * as i1$1 from '@angular/forms';
|
13
14
|
|
14
15
|
const defaultOffset = 3;
|
@@ -327,6 +328,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.9", ngImpor
|
|
327
328
|
}] });
|
328
329
|
|
329
330
|
;
|
331
|
+
// export interface AXDataSourceQuery {
|
332
|
+
// take?: number;
|
333
|
+
// skip?: number;
|
334
|
+
// searchQuery?: string;
|
335
|
+
// }
|
336
|
+
// export interface AXDataSourceCallbackResult<T> {
|
337
|
+
// items: Array<T>;
|
338
|
+
// total: number;
|
339
|
+
// };
|
340
|
+
// export type AXDataSourceLoadCallback<T> = (e: AXDataSourceQuery) => Promise<AXDataSourceCallbackResult<T>>;
|
341
|
+
// export type AXDataSourceByKeyCallback<T> = (key: T) => Promise<T>;
|
342
|
+
// export interface AXDateSourceRecord<T = unknown> {
|
343
|
+
// id: T;
|
344
|
+
// text: string;
|
345
|
+
// disabled: boolean,
|
346
|
+
// selected: boolean,
|
347
|
+
// [key: string]: unknown;
|
348
|
+
// }
|
349
|
+
// export interface AXDateSourceConfig<T> {
|
350
|
+
// load: AXDataSourceLoadCallback<T>;
|
351
|
+
// byKey: AXDataSourceByKeyCallback<T>
|
352
|
+
// }
|
353
|
+
// export class AXDateSource {
|
354
|
+
// constructor(public config: AXDateSourceConfig<unknown>) {
|
355
|
+
// }
|
356
|
+
// private _displayItems: AXDateSourceRecord[];
|
357
|
+
// public get displayItems(): AXDateSourceRecord[] {
|
358
|
+
// return this._displayItems;
|
359
|
+
// }
|
360
|
+
// public set displayItems(v: AXDateSourceRecord[]) {
|
361
|
+
// this._displayItems = this.normalizeItemsList(v);
|
362
|
+
// }
|
363
|
+
// private normalizeItem(item: unknown): AXDateSourceRecord {
|
364
|
+
// const obj: Partial<AXDateSourceRecord> = {};
|
365
|
+
// if (typeof item == 'object') {
|
366
|
+
// Object.assign(obj, item);
|
367
|
+
// } else if (typeof item != 'function') {
|
368
|
+
// const existsItem = this.displayItems.find((c) => c.id == item);
|
369
|
+
// if (existsItem) Object.assign(obj, existsItem);
|
370
|
+
// else {
|
371
|
+
// obj.id = item;
|
372
|
+
// obj.text = item?.toString();
|
373
|
+
// }
|
374
|
+
// }
|
375
|
+
// return obj as AXDateSourceRecord;
|
376
|
+
// }
|
377
|
+
// private normalizeItemsList(items: unknown[]): AXDateSourceRecord[] {
|
378
|
+
// if (items == null) return [];
|
379
|
+
// return items.filter((c) => c != null).map((i) => this.normalizeItem(i));
|
380
|
+
// }
|
381
|
+
// }
|
330
382
|
|
331
383
|
const AX_STYLE_COLOR_TYPES = [
|
332
384
|
'primary',
|
@@ -1066,8 +1118,7 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
1066
1118
|
set value(v) {
|
1067
1119
|
v = this.internalSetValue(v);
|
1068
1120
|
const old = clone(this.value);
|
1069
|
-
|
1070
|
-
if (v != old) {
|
1121
|
+
if (!isEqual(old, v)) {
|
1071
1122
|
this._value = v;
|
1072
1123
|
this.emitOnValueChangedEvent(old, this.value);
|
1073
1124
|
if (v == null || v == undefined || v == '' || (Array.isArray(v) && v.length == 0)) {
|
@@ -1282,15 +1333,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.9", ngImpor
|
|
1282
1333
|
class MXSelectionValueComponent extends MXValueComponent {
|
1283
1334
|
constructor() {
|
1284
1335
|
super(...arguments);
|
1285
|
-
this.selectionMode = 'value';
|
1286
1336
|
this._valueField = 'id';
|
1287
1337
|
this._textField = 'text';
|
1288
1338
|
this._hintField = 'hint';
|
1289
1339
|
this._disabledField = 'disabled';
|
1290
|
-
this._readonlyField = 'readonly';
|
1291
1340
|
this._multiple = false;
|
1292
|
-
this._items = [];
|
1293
|
-
this.displayItems = [];
|
1294
1341
|
this._selectedItems = [];
|
1295
1342
|
}
|
1296
1343
|
get valueField() {
|
@@ -1329,15 +1376,6 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1329
1376
|
value: v,
|
1330
1377
|
});
|
1331
1378
|
}
|
1332
|
-
get readonlyField() {
|
1333
|
-
return this._readonlyField;
|
1334
|
-
}
|
1335
|
-
set readonlyField(v) {
|
1336
|
-
this.setOption({
|
1337
|
-
name: 'readonlyField',
|
1338
|
-
value: v,
|
1339
|
-
});
|
1340
|
-
}
|
1341
1379
|
get multiple() {
|
1342
1380
|
return this._multiple;
|
1343
1381
|
}
|
@@ -1347,26 +1385,14 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1347
1385
|
value: v,
|
1348
1386
|
});
|
1349
1387
|
}
|
1350
|
-
get items() {
|
1351
|
-
return this._items;
|
1352
|
-
}
|
1353
|
-
set items(v) {
|
1354
|
-
this.setOption({
|
1355
|
-
name: 'items',
|
1356
|
-
value: v,
|
1357
|
-
afterCallback: (oldValue, newValue) => {
|
1358
|
-
this.displayItems = this.normalizeItemsList(newValue);
|
1359
|
-
},
|
1360
|
-
});
|
1361
|
-
}
|
1362
1388
|
get selectedItems() {
|
1363
1389
|
return this._selectedItems || [];
|
1364
1390
|
}
|
1365
1391
|
internalSetValue(value) {
|
1366
|
-
|
1392
|
+
debugger;
|
1393
|
+
const normalizedItems = Array.isArray(value)
|
1367
1394
|
? this.normalizeItemsList(value)
|
1368
1395
|
: this.normalizeItemsList([value]);
|
1369
|
-
normalizedItems = normalizedItems.filter((c) => this.displayItems.some((d) => d[this.valueField] == c[this.valueField]));
|
1370
1396
|
return this.multiple ? normalizedItems : normalizedItems[0];
|
1371
1397
|
}
|
1372
1398
|
emitOnValueChangedEvent(oldValue, newValue) {
|
@@ -1384,7 +1410,7 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1384
1410
|
Object.assign(obj, item);
|
1385
1411
|
}
|
1386
1412
|
else if (typeof item != 'function') {
|
1387
|
-
const existsItem = this.
|
1413
|
+
const existsItem = this.getItemByKey(item);
|
1388
1414
|
if (existsItem)
|
1389
1415
|
Object.assign(obj, existsItem);
|
1390
1416
|
else {
|
@@ -1395,8 +1421,8 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1395
1421
|
return obj;
|
1396
1422
|
}
|
1397
1423
|
_normalizeSelectedItems() {
|
1398
|
-
const values = Array.isArray(this.value) ? this.value : [this.value];
|
1399
|
-
this._selectedItems =
|
1424
|
+
const values = Array.isArray(this.value) ? this.value : (this.value ? [this.value] : []);
|
1425
|
+
this._selectedItems = values.map(v => this.normalizeItem(v));
|
1400
1426
|
}
|
1401
1427
|
unselectItems(...items) {
|
1402
1428
|
if (!items || items.length === 0) {
|
@@ -1423,9 +1449,6 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1423
1449
|
}
|
1424
1450
|
this.commitValue(newSelectedItems, true);
|
1425
1451
|
}
|
1426
|
-
else {
|
1427
|
-
this.commitValue(this.displayItems, true);
|
1428
|
-
}
|
1429
1452
|
}
|
1430
1453
|
toggleSelect(...items) {
|
1431
1454
|
items?.forEach((item) => {
|
@@ -1438,12 +1461,17 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
1438
1461
|
});
|
1439
1462
|
}
|
1440
1463
|
isItemSelected(item) {
|
1441
|
-
return this.selectedItems.some((c) => c[this.valueField] === item[this.valueField]);
|
1464
|
+
return this.selectedItems.some((c) => c[this.valueField] === this.normalizeItem(item)[this.valueField]);
|
1442
1465
|
}
|
1443
1466
|
isItemDisabled(item) {
|
1444
|
-
return (
|
1467
|
+
return (this.disabled ||
|
1468
|
+
coerceBooleanProperty(item[this.disabledField]) === true ||
|
1445
1469
|
(this.disabledCallback ? this.disabledCallback({ item, index: -1 }) : false));
|
1446
1470
|
}
|
1471
|
+
getDisplayText(item) {
|
1472
|
+
const normalizeItem = this.normalizeItem(item);
|
1473
|
+
return normalizeItem[this.textField];
|
1474
|
+
}
|
1447
1475
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.9", ngImport: i0, type: MXSelectionValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
1448
1476
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.9", ngImport: i0, type: MXSelectionValueComponent }); }
|
1449
1477
|
}
|