@mediusinc/mng-commons 5.2.0-rc.2 → 5.3.0-rc.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/core/descriptors/model.descriptor.d.ts +3 -0
- package/core/helpers/route.d.ts +3 -4
- package/core/models/menu.model.d.ts +14 -2
- package/esm2022/core/data-list/data-list-params-helpers.mjs +7 -4
- package/esm2022/core/descriptors/model.descriptor.mjs +1 -1
- package/esm2022/core/helpers/route.mjs +1 -1
- package/esm2022/core/models/menu.model.mjs +1 -1
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +5 -15
- package/esm2022/model/descriptors/model.descriptor.mjs +10 -5
- package/esm2022/table/api/descriptors/column.descriptor.mjs +1 -1
- package/esm2022/table/api/models/table.model.mjs +2 -3
- package/esm2022/table/components/table/table.component.mjs +9 -37
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +18 -4
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +12 -13
- package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +2 -2
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +16 -24
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +4 -8
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +5 -12
- package/esm2022/tableview/api/editor/descriptors/field-group.descriptor.mjs +13 -19
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +7 -7
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +7 -7
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +8 -4
- package/esm2022/tableview/api/editor/models/field.model.mjs +4 -3
- package/esm2022/tableview/api/editor/models/formly-field.model.mjs +1 -1
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +3 -3
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +3 -3
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +2 -2
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +12 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +6 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +8 -7
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +4 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +13 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-type.abstract.component.mjs +7 -1
- package/esm2022/tableview/editor/components/formly/pipes/formly-field-label.pipe.mjs +19 -0
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +33 -17
- package/esm2022/tableview/editor/helpers/editor-field.mjs +39 -0
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +21 -15
- package/esm2022/tableview/editor/helpers/formly-config.mjs +13 -17
- package/esm2022/tableview/index.mjs +2 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +6 -3
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +4 -14
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model.mjs +9 -4
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +1 -2
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +8 -36
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +72 -92
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +171 -69
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/components/autocomplete/autocomplete.component.d.ts +1 -2
- package/i18n/en.json +13 -0
- package/i18n/sl.json +13 -0
- package/model/descriptors/model.descriptor.d.ts +4 -2
- package/package.json +1 -1
- package/table/api/descriptors/column.descriptor.d.ts +2 -5
- package/table/api/models/table.model.d.ts +1 -2
- package/table/components/table/table.component.d.ts +3 -11
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +2 -0
- package/tableview/api/action/descriptors/action.descriptor.d.ts +3 -4
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +8 -8
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +3 -4
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +11 -13
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +14 -17
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +5 -5
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +4 -4
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +4 -3
- package/tableview/api/editor/models/field.model.d.ts +3 -2
- package/tableview/api/editor/models/formly-field.model.d.ts +2 -0
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +8 -8
- package/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +5 -2
- package/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +5 -1
- package/tableview/editor/components/formly/fields/formly-field-type.abstract.component.d.ts +2 -1
- package/tableview/editor/components/formly/pipes/formly-field-label.pipe.d.ts +8 -0
- package/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +7 -3
- package/tableview/editor/helpers/editor-field.d.ts +2 -0
- package/tableview/editor/helpers/editor-formly.d.ts +4 -4
- package/tableview/index.d.ts +1 -0
- package/version-info.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { of, throwError, isObservable, Subject, tap } from 'rxjs';
|
|
2
|
-
import { StyleLevelEnum, CommonsInternalError,
|
|
2
|
+
import { StyleLevelEnum, CommonsInternalError, DataProviderInst, LoggerService, findReflectTypeName, StyleSizeEnum, ACommonsErrorBase, toObservable, fromEnumValuesAsValueArray, fromEnumConstantsAsValueArray, getEnumConstantName, TypeRegistry, GetterPipe, copyDataListParams } from '@mediusinc/mng-commons/core';
|
|
3
3
|
import { ActionButtonDescriptor, ButtonStyleBuilder, LookupDataProviderInst, ButtonStyleRoundedEnum } from '@mediusinc/mng-commons/form/api';
|
|
4
4
|
import { TypeDescriptor, ModelDescriptor, trySetLookupItemsProperties, enumModelGeneric, model, findClassTitleAttribute } from '@mediusinc/mng-commons/model';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
@@ -140,11 +140,10 @@ class ActionDescriptorInst {
|
|
|
140
140
|
this._subactions = [];
|
|
141
141
|
this._model = cfg?.model;
|
|
142
142
|
this._actionName = actionName;
|
|
143
|
-
if ((cfg?.
|
|
144
|
-
throw new CommonsInternalError(`Provide both the parent
|
|
143
|
+
if ((cfg?.parentModel && !cfg?.parentProperty) || (!cfg?.parentProperty && cfg?.parentProperty)) {
|
|
144
|
+
throw new CommonsInternalError(`Provide both the parent model and parent property or none: ${this._actionName}, ${cfg?.parentModel?.i18nBaseKey}, ${cfg?.parentProperty}.`);
|
|
145
145
|
}
|
|
146
|
-
this.
|
|
147
|
-
this._parentTypeName = cfg?.parentType ? findReflectTypeName(cfg?.parentType) ?? undefined : undefined;
|
|
146
|
+
this._parentModel = cfg?.parentModel;
|
|
148
147
|
this._parentProperty = cfg?.parentProperty;
|
|
149
148
|
this.setI18nModelActionBaseKey();
|
|
150
149
|
if (cfg?.serviceType) {
|
|
@@ -155,17 +154,17 @@ class ActionDescriptorInst {
|
|
|
155
154
|
}
|
|
156
155
|
let displayName = actionName;
|
|
157
156
|
if (this._model)
|
|
158
|
-
displayName =
|
|
159
|
-
if (this.
|
|
160
|
-
displayName = `${this.
|
|
157
|
+
displayName = this._model.i18nBaseKey ? `${this._model.i18nBaseKey}.${displayName}` : displayName;
|
|
158
|
+
if (this._parentModel) {
|
|
159
|
+
displayName = `${this._parentModel.i18nBaseKey}.${this._parentProperty}_${displayName}`;
|
|
161
160
|
}
|
|
162
161
|
this._actionNameLong = displayName;
|
|
163
162
|
}
|
|
164
163
|
get model() {
|
|
165
164
|
return this._model;
|
|
166
165
|
}
|
|
167
|
-
get
|
|
168
|
-
return this.
|
|
166
|
+
get parentModel() {
|
|
167
|
+
return this._parentModel;
|
|
169
168
|
}
|
|
170
169
|
get parentProperty() {
|
|
171
170
|
return this._parentProperty;
|
|
@@ -273,9 +272,9 @@ class ActionDescriptorInst {
|
|
|
273
272
|
return this._subactions;
|
|
274
273
|
}
|
|
275
274
|
setI18nModelActionBaseKey(base) {
|
|
276
|
-
if (this.
|
|
277
|
-
this._i18nModelActionBaseKey = this.
|
|
278
|
-
? `${this.
|
|
275
|
+
if (this._parentModel || this._model) {
|
|
276
|
+
this._i18nModelActionBaseKey = this._parentModel
|
|
277
|
+
? `${this._parentModel.i18nBaseKey}.actions.${this._parentProperty}_${this._actionName}`
|
|
279
278
|
: `${base ?? this._model.i18nBaseKey}.actions.${this._actionName}`;
|
|
280
279
|
}
|
|
281
280
|
}
|
|
@@ -1032,7 +1031,7 @@ function runFnFromDataProviderOrFail(ctx, fn) {
|
|
|
1032
1031
|
if (isObservable(dataProviderExec)) {
|
|
1033
1032
|
return dataProviderExec;
|
|
1034
1033
|
}
|
|
1035
|
-
return throwError(() => new CommonsActionError(`Data provider could not extract function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.
|
|
1034
|
+
return throwError(() => new CommonsActionError(`Data provider could not extract function to execute in action ${ctx.instance.action.actionNameLong} (${ctx.instance.action.model?.i18nBaseKey}) for item id ${ctx.parameters?.itemId}.`, ctx.contextLongName, { actionContext: ctx }));
|
|
1036
1035
|
}
|
|
1037
1036
|
function runGetAllFromDataProvider(ctx) {
|
|
1038
1037
|
if (typeof ctx.dataProvider !== 'undefined' && typeof ctx.dataProvider['getAll'] === 'function') {
|
|
@@ -1251,8 +1250,9 @@ var FieldManyEditorActionEnum;
|
|
|
1251
1250
|
})(FieldManyEditorActionEnum || (FieldManyEditorActionEnum = {}));
|
|
1252
1251
|
var FieldGroupTypeEnum;
|
|
1253
1252
|
(function (FieldGroupTypeEnum) {
|
|
1254
|
-
FieldGroupTypeEnum[FieldGroupTypeEnum["
|
|
1255
|
-
FieldGroupTypeEnum[FieldGroupTypeEnum["
|
|
1253
|
+
FieldGroupTypeEnum[FieldGroupTypeEnum["Tab"] = 0] = "Tab";
|
|
1254
|
+
FieldGroupTypeEnum[FieldGroupTypeEnum["Fieldset"] = 1] = "Fieldset";
|
|
1255
|
+
FieldGroupTypeEnum[FieldGroupTypeEnum["Logical"] = 2] = "Logical";
|
|
1256
1256
|
})(FieldGroupTypeEnum || (FieldGroupTypeEnum = {}));
|
|
1257
1257
|
|
|
1258
1258
|
class FieldValidationDescriptor {
|
|
@@ -1281,12 +1281,9 @@ class FieldValidationDescriptor {
|
|
|
1281
1281
|
}
|
|
1282
1282
|
|
|
1283
1283
|
class AGenericFieldDescriptor {
|
|
1284
|
-
|
|
1284
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1285
|
+
constructor() {
|
|
1285
1286
|
this._config = {};
|
|
1286
|
-
this._editor = editor;
|
|
1287
|
-
}
|
|
1288
|
-
get editor() {
|
|
1289
|
-
return this._editor;
|
|
1290
1287
|
}
|
|
1291
1288
|
get config() {
|
|
1292
1289
|
return this._config;
|
|
@@ -1309,8 +1306,8 @@ class AGenericFieldDescriptor {
|
|
|
1309
1306
|
}
|
|
1310
1307
|
}
|
|
1311
1308
|
class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
1312
|
-
constructor(
|
|
1313
|
-
super(
|
|
1309
|
+
constructor(property) {
|
|
1310
|
+
super();
|
|
1314
1311
|
/** @ignore */ this._required = false;
|
|
1315
1312
|
/** @ignore */ this._requiredHideLabelMarker = false;
|
|
1316
1313
|
/** @ignore */ this._disabled = false;
|
|
@@ -1523,9 +1520,6 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
|
1523
1520
|
* This new table view shows all available translations for specific property and allows editing it.
|
|
1524
1521
|
*/
|
|
1525
1522
|
localized() {
|
|
1526
|
-
if (!this.editor.isLocalized) {
|
|
1527
|
-
throw new CommonsInternalError(`Localization cannot be set for field ${this.property}, localization must be enabled on editor first.`);
|
|
1528
|
-
}
|
|
1529
1523
|
this._isLocalized = true;
|
|
1530
1524
|
return this;
|
|
1531
1525
|
}
|
|
@@ -1572,15 +1566,11 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
|
1572
1566
|
}
|
|
1573
1567
|
|
|
1574
1568
|
class FieldActionDescriptor extends AFieldDescriptor {
|
|
1575
|
-
constructor(
|
|
1576
|
-
super(
|
|
1569
|
+
constructor(property) {
|
|
1570
|
+
super(property);
|
|
1577
1571
|
this._button = new ActionButtonDescriptor();
|
|
1578
1572
|
this._wrappers = ['field'];
|
|
1579
1573
|
this._fieldActionName = property;
|
|
1580
|
-
let displayName = property;
|
|
1581
|
-
if (this._editor.model)
|
|
1582
|
-
displayName = `${this._editor.model.typeName}.${displayName}`;
|
|
1583
|
-
this._fieldActionNameLong = displayName;
|
|
1584
1574
|
}
|
|
1585
1575
|
get button() {
|
|
1586
1576
|
return this._button;
|
|
@@ -1608,7 +1598,7 @@ class FieldActionDescriptor extends AFieldDescriptor {
|
|
|
1608
1598
|
return this;
|
|
1609
1599
|
}
|
|
1610
1600
|
copy() {
|
|
1611
|
-
const field = new FieldActionDescriptor(this.
|
|
1601
|
+
const field = new FieldActionDescriptor(this._property);
|
|
1612
1602
|
this.copyFieldsTo(field);
|
|
1613
1603
|
field._button = this._button.copy();
|
|
1614
1604
|
field._runFunction = this._runFunction?.bind(field);
|
|
@@ -1618,11 +1608,11 @@ class FieldActionDescriptor extends AFieldDescriptor {
|
|
|
1618
1608
|
}
|
|
1619
1609
|
|
|
1620
1610
|
class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
1621
|
-
constructor(
|
|
1622
|
-
super(
|
|
1611
|
+
constructor(name) {
|
|
1612
|
+
super();
|
|
1623
1613
|
this._fields = [];
|
|
1624
1614
|
this._validations = [];
|
|
1625
|
-
this._name =
|
|
1615
|
+
this._name = name;
|
|
1626
1616
|
this._default = name === EDITOR_DEFAULT_GROUP_NAME;
|
|
1627
1617
|
}
|
|
1628
1618
|
removeField(property, filterFunction) {
|
|
@@ -1635,9 +1625,6 @@ class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
|
1635
1625
|
get validations() {
|
|
1636
1626
|
return this._validations;
|
|
1637
1627
|
}
|
|
1638
|
-
get baseName() {
|
|
1639
|
-
return `${this.groupName()}_`;
|
|
1640
|
-
}
|
|
1641
1628
|
get name() {
|
|
1642
1629
|
return this._name;
|
|
1643
1630
|
}
|
|
@@ -1654,22 +1641,22 @@ class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
|
1654
1641
|
}
|
|
1655
1642
|
}
|
|
1656
1643
|
class FieldTabGroupDescriptor extends AFieldGroupDescriptor {
|
|
1657
|
-
constructor(
|
|
1658
|
-
super(
|
|
1644
|
+
constructor(name) {
|
|
1645
|
+
super(name);
|
|
1659
1646
|
this._fields = [];
|
|
1660
1647
|
}
|
|
1648
|
+
get type() {
|
|
1649
|
+
return FieldGroupTypeEnum.Tab;
|
|
1650
|
+
}
|
|
1661
1651
|
get fields() {
|
|
1662
1652
|
return this._fields;
|
|
1663
1653
|
}
|
|
1664
|
-
groupName() {
|
|
1665
|
-
return 'tab';
|
|
1666
|
-
}
|
|
1667
1654
|
addField(field) {
|
|
1668
1655
|
this._fields.push(field);
|
|
1669
1656
|
return this;
|
|
1670
1657
|
}
|
|
1671
1658
|
copy(skipFields = false) {
|
|
1672
|
-
const tab = new FieldTabGroupDescriptor(this.
|
|
1659
|
+
const tab = new FieldTabGroupDescriptor(this.name);
|
|
1673
1660
|
tab._title = this._title;
|
|
1674
1661
|
tab._fields = this.fields.map(f => f.copy(skipFields));
|
|
1675
1662
|
tab._validations = this.validations.map(v => v.copy());
|
|
@@ -1677,8 +1664,8 @@ class FieldTabGroupDescriptor extends AFieldGroupDescriptor {
|
|
|
1677
1664
|
}
|
|
1678
1665
|
}
|
|
1679
1666
|
class FieldGroupDescriptor extends AFieldGroupDescriptor {
|
|
1680
|
-
constructor(
|
|
1681
|
-
super(
|
|
1667
|
+
constructor(name) {
|
|
1668
|
+
super(name);
|
|
1682
1669
|
this._type = FieldGroupTypeEnum.Fieldset;
|
|
1683
1670
|
if (this._default) {
|
|
1684
1671
|
this.asLogical();
|
|
@@ -1690,9 +1677,6 @@ class FieldGroupDescriptor extends AFieldGroupDescriptor {
|
|
|
1690
1677
|
get fields() {
|
|
1691
1678
|
return this._fields;
|
|
1692
1679
|
}
|
|
1693
|
-
groupName() {
|
|
1694
|
-
return 'group';
|
|
1695
|
-
}
|
|
1696
1680
|
addField(field) {
|
|
1697
1681
|
this._fields.push(field);
|
|
1698
1682
|
return this;
|
|
@@ -1702,7 +1686,7 @@ class FieldGroupDescriptor extends AFieldGroupDescriptor {
|
|
|
1702
1686
|
return this;
|
|
1703
1687
|
}
|
|
1704
1688
|
copy(skipFields = false) {
|
|
1705
|
-
const group = new FieldGroupDescriptor(this.
|
|
1689
|
+
const group = new FieldGroupDescriptor(this.name);
|
|
1706
1690
|
group._type = this._type;
|
|
1707
1691
|
group._title = this._title;
|
|
1708
1692
|
if (!skipFields) {
|
|
@@ -1727,8 +1711,8 @@ const fieldLookupGetProviderCfgObj = (serviceOrDataProvider) => {
|
|
|
1727
1711
|
return cfg;
|
|
1728
1712
|
};
|
|
1729
1713
|
class FieldLookupDescriptor extends AFieldDescriptor {
|
|
1730
|
-
constructor(
|
|
1731
|
-
super(
|
|
1714
|
+
constructor(property, cfg) {
|
|
1715
|
+
super(property);
|
|
1732
1716
|
this._lookupType = FieldLookupTypeEnum.Dropdown;
|
|
1733
1717
|
this._optionsLabelTranslate = false;
|
|
1734
1718
|
this._dropdownClassName = 'mng-filter-lookup-dropdown';
|
|
@@ -1845,7 +1829,7 @@ class FieldLookupDescriptor extends AFieldDescriptor {
|
|
|
1845
1829
|
return this;
|
|
1846
1830
|
}
|
|
1847
1831
|
copy() {
|
|
1848
|
-
const field = new FieldLookupDescriptor(this.
|
|
1832
|
+
const field = new FieldLookupDescriptor(this._property, {
|
|
1849
1833
|
dataProvider: this._dataProvider,
|
|
1850
1834
|
optionsValueProperty: this._optionsValueProperty
|
|
1851
1835
|
});
|
|
@@ -1863,8 +1847,8 @@ class FieldLookupDescriptor extends AFieldDescriptor {
|
|
|
1863
1847
|
}
|
|
1864
1848
|
}
|
|
1865
1849
|
class FieldLookupEnumDescriptor extends FieldLookupDescriptor {
|
|
1866
|
-
constructor(
|
|
1867
|
-
super(
|
|
1850
|
+
constructor(property, enumModel, options) {
|
|
1851
|
+
super(property, {
|
|
1868
1852
|
dataProvider: new LookupDataProviderInst(undefined, undefined),
|
|
1869
1853
|
optionsValueProperty: 'value'
|
|
1870
1854
|
});
|
|
@@ -1910,7 +1894,7 @@ class FieldLookupEnumDescriptor extends FieldLookupDescriptor {
|
|
|
1910
1894
|
return this;
|
|
1911
1895
|
}
|
|
1912
1896
|
copy() {
|
|
1913
|
-
const field = new FieldLookupEnumDescriptor(this.
|
|
1897
|
+
const field = new FieldLookupEnumDescriptor(this._property, this._enumModel, []);
|
|
1914
1898
|
this.copyFieldsTo(field);
|
|
1915
1899
|
field._lookupType = this._lookupType;
|
|
1916
1900
|
field._optionsLabelProperty = this._optionsLabelProperty;
|
|
@@ -1934,8 +1918,8 @@ const fieldManyToManyGetProviderCfgObj = (serviceOrDataProvider) => {
|
|
|
1934
1918
|
return cfg;
|
|
1935
1919
|
};
|
|
1936
1920
|
class FieldManyToManyEditorDescriptor extends AFieldDescriptor {
|
|
1937
|
-
constructor(
|
|
1938
|
-
super(
|
|
1921
|
+
constructor(property, mainTableDescriptor, lookupTableDescriptor, cfg) {
|
|
1922
|
+
super(property);
|
|
1939
1923
|
this._fieldType = FieldManyToManyEditorTypeEnum.DialogTableMultiselect;
|
|
1940
1924
|
this._actions = [FieldManyToManyEditorActionEnum.Add, FieldManyToManyEditorActionEnum.Delete];
|
|
1941
1925
|
this._hasLookupExcludeValues = false;
|
|
@@ -2007,7 +1991,7 @@ class FieldManyToManyEditorDescriptor extends AFieldDescriptor {
|
|
|
2007
1991
|
return this;
|
|
2008
1992
|
}
|
|
2009
1993
|
copy() {
|
|
2010
|
-
const field = new FieldManyToManyEditorDescriptor(this.
|
|
1994
|
+
const field = new FieldManyToManyEditorDescriptor(this._property, this._mainTableDescriptor.copy(), this._lookupTableDescriptor.copy(), {
|
|
2011
1995
|
lookupDataProvider: this.lookupTableDataProvider
|
|
2012
1996
|
});
|
|
2013
1997
|
this.copyFieldsTo(field);
|
|
@@ -2020,8 +2004,8 @@ class FieldManyToManyEditorDescriptor extends AFieldDescriptor {
|
|
|
2020
2004
|
}
|
|
2021
2005
|
}
|
|
2022
2006
|
class FieldManyEditorDescriptor extends AFieldDescriptor {
|
|
2023
|
-
constructor(
|
|
2024
|
-
super(
|
|
2007
|
+
constructor(property, tableviewDescriptor) {
|
|
2008
|
+
super(property);
|
|
2025
2009
|
this._fieldType = FieldManyEditorTypeEnum.DialogEditor;
|
|
2026
2010
|
this._fieldActions = [];
|
|
2027
2011
|
this._actions = [];
|
|
@@ -2065,7 +2049,7 @@ class FieldManyEditorDescriptor extends AFieldDescriptor {
|
|
|
2065
2049
|
return this;
|
|
2066
2050
|
}
|
|
2067
2051
|
copy() {
|
|
2068
|
-
const field = new FieldManyEditorDescriptor(this.
|
|
2052
|
+
const field = new FieldManyEditorDescriptor(this._property, this._tableviewDescriptor.copy());
|
|
2069
2053
|
this.copyFieldsTo(field);
|
|
2070
2054
|
field._fieldType = this._fieldType;
|
|
2071
2055
|
field._fieldActions = this._fieldActions.map(a => a);
|
|
@@ -2074,8 +2058,8 @@ class FieldManyEditorDescriptor extends AFieldDescriptor {
|
|
|
2074
2058
|
}
|
|
2075
2059
|
|
|
2076
2060
|
class FieldInputDescriptor extends AFieldDescriptor {
|
|
2077
|
-
constructor(
|
|
2078
|
-
super(
|
|
2061
|
+
constructor(property) {
|
|
2062
|
+
super(property);
|
|
2079
2063
|
this._fieldType = FieldInputTypeEnum.Text;
|
|
2080
2064
|
this._numberUseGrouping = true;
|
|
2081
2065
|
this._currencyDisplay = 'symbol';
|
|
@@ -2359,6 +2343,10 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
2359
2343
|
this._numberUseGrouping = useGrouping;
|
|
2360
2344
|
return this;
|
|
2361
2345
|
}
|
|
2346
|
+
withTextareaRows(rows) {
|
|
2347
|
+
this._rows = rows;
|
|
2348
|
+
return this;
|
|
2349
|
+
}
|
|
2362
2350
|
withTextValidation(opts) {
|
|
2363
2351
|
this._minLength = opts?.minLength;
|
|
2364
2352
|
this._maxLength = opts?.maxLength;
|
|
@@ -2396,7 +2384,7 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
2396
2384
|
return this;
|
|
2397
2385
|
}
|
|
2398
2386
|
copy() {
|
|
2399
|
-
const field = new FieldInputDescriptor(this.
|
|
2387
|
+
const field = new FieldInputDescriptor(this._property);
|
|
2400
2388
|
this.copyFieldsTo(field);
|
|
2401
2389
|
field._fieldType = this._fieldType;
|
|
2402
2390
|
field._rows = this._rows;
|
|
@@ -2506,10 +2494,7 @@ class EditorDescriptorInst {
|
|
|
2506
2494
|
* @param title Title key for the tab.
|
|
2507
2495
|
*/
|
|
2508
2496
|
createTabGroup(name, title) {
|
|
2509
|
-
const tabGroup = new FieldTabGroupDescriptor(
|
|
2510
|
-
if (!title) {
|
|
2511
|
-
title = getI18nTypeTabKey(this.model.i18nBaseKey, name);
|
|
2512
|
-
}
|
|
2497
|
+
const tabGroup = new FieldTabGroupDescriptor(name);
|
|
2513
2498
|
tabGroup.withTitle(title);
|
|
2514
2499
|
this.createTabGroupDescriptor(tabGroup);
|
|
2515
2500
|
return tabGroup;
|
|
@@ -2520,13 +2505,8 @@ class EditorDescriptorInst {
|
|
|
2520
2505
|
* @param title Title key for the group.
|
|
2521
2506
|
*/
|
|
2522
2507
|
createFieldGroup(name, title) {
|
|
2523
|
-
const fieldGroup = new FieldGroupDescriptor(
|
|
2524
|
-
|
|
2525
|
-
if (!title) {
|
|
2526
|
-
title = getI18nTypeGroupKey(this.model.i18nBaseKey, name);
|
|
2527
|
-
}
|
|
2528
|
-
fieldGroup.withTitle(title);
|
|
2529
|
-
}
|
|
2508
|
+
const fieldGroup = new FieldGroupDescriptor(name);
|
|
2509
|
+
fieldGroup.withTitle(title);
|
|
2530
2510
|
this.createFieldGroupDescriptor(fieldGroup);
|
|
2531
2511
|
return fieldGroup;
|
|
2532
2512
|
}
|
|
@@ -2595,7 +2575,7 @@ class EditorDescriptorInst {
|
|
|
2595
2575
|
* @param property Model property name.
|
|
2596
2576
|
*/
|
|
2597
2577
|
addFieldUnsafe(property) {
|
|
2598
|
-
const field = new FieldInputDescriptor(
|
|
2578
|
+
const field = new FieldInputDescriptor(property);
|
|
2599
2579
|
this.addFieldDescriptor(field);
|
|
2600
2580
|
return field;
|
|
2601
2581
|
}
|
|
@@ -2604,7 +2584,7 @@ class EditorDescriptorInst {
|
|
|
2604
2584
|
return this;
|
|
2605
2585
|
}
|
|
2606
2586
|
addFieldAction(actionName) {
|
|
2607
|
-
const field = new FieldActionDescriptor(
|
|
2587
|
+
const field = new FieldActionDescriptor(actionName);
|
|
2608
2588
|
this.addFieldDescriptor(field);
|
|
2609
2589
|
return field;
|
|
2610
2590
|
}
|
|
@@ -2634,7 +2614,7 @@ class EditorDescriptorInst {
|
|
|
2634
2614
|
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, undefined, FieldValue>} - The field lookup descriptor.
|
|
2635
2615
|
*/
|
|
2636
2616
|
addFieldLookupUnsafe(property, type) {
|
|
2637
|
-
const field = new FieldLookupDescriptor(
|
|
2617
|
+
const field = new FieldLookupDescriptor(property, {
|
|
2638
2618
|
type: type?.classType
|
|
2639
2619
|
});
|
|
2640
2620
|
this.addFieldDescriptor(field);
|
|
@@ -2672,7 +2652,7 @@ class EditorDescriptorInst {
|
|
|
2672
2652
|
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, undefined, FieldValue, ParentEditorModel>} - The field lookup descriptor.
|
|
2673
2653
|
*/
|
|
2674
2654
|
addFieldLookupWithOptionsValuePropertyUnsafe(property, type, lookupOptionsValueProperty) {
|
|
2675
|
-
const field = new FieldLookupDescriptor(
|
|
2655
|
+
const field = new FieldLookupDescriptor(property, {
|
|
2676
2656
|
type: type?.classType,
|
|
2677
2657
|
optionsValueProperty: lookupOptionsValueProperty
|
|
2678
2658
|
});
|
|
@@ -2710,7 +2690,7 @@ class EditorDescriptorInst {
|
|
|
2710
2690
|
*/
|
|
2711
2691
|
addFieldLookupWithProviderUnsafe(property, provider, type) {
|
|
2712
2692
|
const cfg = fieldLookupGetProviderCfgObj(provider);
|
|
2713
|
-
const field = new FieldLookupDescriptor(
|
|
2693
|
+
const field = new FieldLookupDescriptor(property, {
|
|
2714
2694
|
type: type?.classType,
|
|
2715
2695
|
...cfg
|
|
2716
2696
|
});
|
|
@@ -2730,7 +2710,7 @@ class EditorDescriptorInst {
|
|
|
2730
2710
|
* @typeparam LookupValueProperty - The property of lookup model type.
|
|
2731
2711
|
* @typeparam FieldValue - The value type of field on editor.
|
|
2732
2712
|
*
|
|
2733
|
-
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue>} - The field lookup descriptor.
|
|
2713
|
+
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue, ParentEditorModel>} - The field lookup descriptor.
|
|
2734
2714
|
*/
|
|
2735
2715
|
addFieldLookupWithProviderAndOptionsValueProperty(property, provider, type, lookupOptionsValueProperty) {
|
|
2736
2716
|
return this.addFieldLookupWithProviderAndOptionsValuePropertyUnsafe(property, provider, type, lookupOptionsValueProperty);
|
|
@@ -2747,11 +2727,11 @@ class EditorDescriptorInst {
|
|
|
2747
2727
|
* @typeparam LookupModel - The field model type, defaults to the non-nullable type of the editor's property.
|
|
2748
2728
|
* @typeparam FieldValue - The value type of field on editor.
|
|
2749
2729
|
*
|
|
2750
|
-
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue>} - The field lookup descriptor.
|
|
2730
|
+
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue, ParentEditorModel>} - The field lookup descriptor.
|
|
2751
2731
|
*/
|
|
2752
2732
|
addFieldLookupWithProviderAndOptionsValuePropertyUnsafe(property, provider, type, lookupOptionsValueProperty) {
|
|
2753
2733
|
const cfg = fieldLookupGetProviderCfgObj(provider);
|
|
2754
|
-
const field = new FieldLookupDescriptor(
|
|
2734
|
+
const field = new FieldLookupDescriptor(property, {
|
|
2755
2735
|
type: type?.classType,
|
|
2756
2736
|
optionsValueProperty: lookupOptionsValueProperty,
|
|
2757
2737
|
...cfg
|
|
@@ -2769,7 +2749,7 @@ class EditorDescriptorInst {
|
|
|
2769
2749
|
* @param options Provides subset of enum's available constants.
|
|
2770
2750
|
*/
|
|
2771
2751
|
addFieldLookupEnumUnsafe(property, enumDesc, options) {
|
|
2772
|
-
const field = new FieldLookupEnumDescriptor(
|
|
2752
|
+
const field = new FieldLookupEnumDescriptor(property, enumDesc, options);
|
|
2773
2753
|
this.addFieldDescriptor(field);
|
|
2774
2754
|
return field;
|
|
2775
2755
|
}
|
|
@@ -2787,7 +2767,7 @@ class EditorDescriptorInst {
|
|
|
2787
2767
|
* @param tableviewDescriptor Tableview descriptor for related model.
|
|
2788
2768
|
*/
|
|
2789
2769
|
addFieldManyEditorUnsafe(property, tableviewDescriptor) {
|
|
2790
|
-
const field = new FieldManyEditorDescriptor(
|
|
2770
|
+
const field = new FieldManyEditorDescriptor(property, tableviewDescriptor);
|
|
2791
2771
|
this.addFieldDescriptor(field);
|
|
2792
2772
|
return field;
|
|
2793
2773
|
}
|
|
@@ -2796,7 +2776,7 @@ class EditorDescriptorInst {
|
|
|
2796
2776
|
}
|
|
2797
2777
|
addFieldManyToManyEditorUnsafe(property, mainTableDescriptor, lookupTableDescriptor, lookupDataProvider) {
|
|
2798
2778
|
const cfg = fieldManyToManyGetProviderCfgObj(lookupDataProvider);
|
|
2799
|
-
const field = new FieldManyToManyEditorDescriptor(
|
|
2779
|
+
const field = new FieldManyToManyEditorDescriptor(property, mainTableDescriptor, lookupTableDescriptor, {
|
|
2800
2780
|
...cfg
|
|
2801
2781
|
});
|
|
2802
2782
|
this.addFieldDescriptor(field);
|
|
@@ -3761,7 +3741,7 @@ class TableviewDescriptorInst {
|
|
|
3761
3741
|
* @typeparam LookupValueProperty - The property of lookup model type.
|
|
3762
3742
|
* @typeparam FieldValue - The value type of field on editor.
|
|
3763
3743
|
*
|
|
3764
|
-
* @returns {FieldLookupDescriptor<LookupModel, TableviewModel, Service, FieldValue>} - The field lookup descriptor.
|
|
3744
|
+
* @returns {FieldLookupDescriptor<LookupModel, TableviewModel, Service, FieldValue, ParentEditorModel>} - The field lookup descriptor.
|
|
3765
3745
|
*/
|
|
3766
3746
|
addFieldLookupWithProviderAndOptionsValueProperty(property, provider, type, lookupOptionsValueProperty) {
|
|
3767
3747
|
const field = this._detailsEditor.addFieldLookupWithProviderAndOptionsValueProperty(property, provider, type, lookupOptionsValueProperty);
|
|
@@ -3780,7 +3760,7 @@ class TableviewDescriptorInst {
|
|
|
3780
3760
|
* @typeparam LookupModel - The field model type, defaults to the non-nullable type of the editor's property.
|
|
3781
3761
|
* @typeparam FieldValue - The value type of field on editor.
|
|
3782
3762
|
*
|
|
3783
|
-
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue>} - The field lookup descriptor.
|
|
3763
|
+
* @returns {FieldLookupDescriptor<LookupModel, EditorModel, Service, FieldValue, ParentEditorModel>} - The field lookup descriptor.
|
|
3784
3764
|
*/
|
|
3785
3765
|
addFieldLookupWithProviderAndOptionsValuePropertyUnsafe(property, provider, type, lookupOptionsValueProperty) {
|
|
3786
3766
|
const field = this._detailsEditor.addFieldLookupWithProviderAndOptionsValuePropertyUnsafe(property, provider, type, lookupOptionsValueProperty);
|
|
@@ -4260,7 +4240,7 @@ function tableviewExportJsonAction(descriptor, injector) {
|
|
|
4260
4240
|
return dataProviderExecutor
|
|
4261
4241
|
? dataProviderExecutor.runGetAllOrFail(ctx).pipe(map(res => {
|
|
4262
4242
|
const blob = new Blob([JSON.stringify(res.data, undefined, 4)], { type: 'application/json;charset=utf-8' });
|
|
4263
|
-
const typeName = ctx.instance.action.model?.
|
|
4243
|
+
const typeName = ctx.instance.action.model?.i18nBaseKey ?? '';
|
|
4264
4244
|
saveFileAs(blob, `${typeName ? typeName + '_' : ''}${ctx.instance.action.actionName}.json`);
|
|
4265
4245
|
return undefined;
|
|
4266
4246
|
}))
|
|
@@ -4287,7 +4267,7 @@ function tableviewExportCsvAction(descriptor, injector) {
|
|
|
4287
4267
|
const blob = new Blob([convertDataToStringWithDelimiter(res.data, ',', descriptor, ctx.injector.get(TranslateService))], {
|
|
4288
4268
|
type: 'text/csv;charset=utf-8'
|
|
4289
4269
|
});
|
|
4290
|
-
const typeName = ctx.instance.action.model?.
|
|
4270
|
+
const typeName = ctx.instance.action.model?.i18nBaseKey ?? '';
|
|
4291
4271
|
saveFileAs(blob, `${typeName ? typeName + '_' : ''}${ctx.instance.action.actionName}.csv`);
|
|
4292
4272
|
return undefined;
|
|
4293
4273
|
}))
|