@mediusinc/mng-commons 6.0.0-rc.2 → 6.0.0-rc.4
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/helpers/notification.d.ts +17 -1
- package/core/i18n/i18n-error.d.ts +2 -3
- package/core/router/route-builder.d.ts +1 -1
- package/esm2022/core/helpers/notification.mjs +19 -4
- package/esm2022/core/i18n/i18n-error.mjs +10 -8
- package/esm2022/core/router/route-builder.mjs +2 -2
- package/esm2022/form/api/descriptors/action-button.descriptor.mjs +5 -17
- package/esm2022/form/api/descriptors/button-style.builder.mjs +80 -101
- package/esm2022/form/api/index.mjs +2 -1
- package/esm2022/form/api/models/button.model.mjs +2 -0
- package/esm2022/model/helpers/i18n.mjs +14 -9
- package/esm2022/table/components/column-value/column-value.component.mjs +4 -3
- package/esm2022/table/components/table/table.component.mjs +12 -11
- package/esm2022/table/helpers/notification.mjs +19 -13
- package/esm2022/tableview/action/components/action/action.component.mjs +41 -37
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +13 -8
- package/esm2022/tableview/action/helpers/i18n.mjs +50 -30
- package/esm2022/tableview/action/helpers/notification.mjs +73 -12
- package/esm2022/tableview/action/helpers/styles.mjs +2 -2
- package/esm2022/tableview/action/services/action-executor.service.mjs +83 -66
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +34 -21
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +4 -4
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +49 -67
- package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +14 -8
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +2 -2
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +67 -37
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +5 -8
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +29 -18
- package/esm2022/tableview/provide.mjs +44 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +29 -12
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +137 -169
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model.mjs +13 -8
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +32 -24
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +165 -215
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +358 -197
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/api/descriptors/action-button.descriptor.d.ts +11 -13
- package/form/api/descriptors/button-style.builder.d.ts +30 -44
- package/form/api/index.d.ts +1 -0
- package/form/api/models/button.model.d.ts +19 -0
- package/i18n/sl.json +56 -6
- package/model/helpers/i18n.d.ts +8 -3
- package/package.json +1 -1
- package/table/components/column-value/column-value.component.d.ts +1 -0
- package/table/components/table/table.component.d.ts +0 -1
- package/table/helpers/notification.d.ts +10 -1
- package/tableview/action/components/action/action.component.d.ts +8 -11
- package/tableview/action/helpers/i18n.d.ts +36 -11
- package/tableview/action/helpers/notification.d.ts +37 -3
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +18 -8
- package/tableview/api/action/descriptors/action.descriptor.d.ts +22 -31
- package/tableview/api/action/models/action-confirmation.model.d.ts +14 -0
- package/tableview/api/action/models/action-descriptor.types.d.ts +4 -0
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +5 -5
- package/tableview/api/index.d.ts +1 -1
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +1 -1
- package/tableview/provide.d.ts +7 -0
- package/version-info.json +6 -6
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +0 -88
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +0 -37
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataProviderInst,
|
|
1
|
+
import { DataProviderInst, StyleLevelEnum, StyleSizeEnum } from '@mediusinc/mng-commons/core';
|
|
2
2
|
|
|
3
3
|
class LookupDataProviderInst extends DataProviderInst {
|
|
4
4
|
constructor(serviceType) {
|
|
@@ -28,61 +28,101 @@ function lookupDataProvider(opts) {
|
|
|
28
28
|
return new LookupDataProviderInst(opts?.service);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
class
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this
|
|
35
|
-
this._outlineButton = false;
|
|
36
|
-
this._raisedButton = false;
|
|
37
|
-
this._roundedStyle = ButtonStyleRoundedEnum.DEFAULT;
|
|
38
|
-
this._actionLevel = level;
|
|
39
|
-
this._customClass = customClass;
|
|
31
|
+
class ActionButtonDescriptor {
|
|
32
|
+
withLabel(label) {
|
|
33
|
+
this._label = label;
|
|
34
|
+
return this;
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
if (this._textButton) {
|
|
47
|
-
styles.push(`p-button-text`);
|
|
48
|
-
}
|
|
49
|
-
if (this._outlineButton) {
|
|
50
|
-
styles.push(`p-button-outlined`);
|
|
51
|
-
}
|
|
52
|
-
if (this._raisedButton) {
|
|
53
|
-
styles.push(`p-button-raised`);
|
|
54
|
-
}
|
|
55
|
-
if (this._roundedStyle === ButtonStyleRoundedEnum.ROUNDED) {
|
|
56
|
-
styles.push('p-button-rounded');
|
|
57
|
-
}
|
|
58
|
-
return styles.join(' ');
|
|
36
|
+
withIcon(icon, iconPosition) {
|
|
37
|
+
this._icon = icon;
|
|
38
|
+
this._iconPosition = iconPosition;
|
|
39
|
+
return this;
|
|
59
40
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
41
|
+
withStyle(style) {
|
|
42
|
+
this._styleClass = style;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
withBadge(badge) {
|
|
46
|
+
this._badge = badge;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
withTooltip(tooltip, position) {
|
|
50
|
+
this._tooltip = tooltip;
|
|
51
|
+
this._tooltipPosition = position ?? 'top';
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
get label() {
|
|
55
|
+
return this._label;
|
|
56
|
+
}
|
|
57
|
+
get icon() {
|
|
58
|
+
return this._icon;
|
|
59
|
+
}
|
|
60
|
+
get iconPosition() {
|
|
61
|
+
return this._iconPosition;
|
|
62
|
+
}
|
|
63
|
+
get style() {
|
|
64
|
+
return this._styleClass;
|
|
65
|
+
}
|
|
66
|
+
get badge() {
|
|
67
|
+
return this._badge;
|
|
68
|
+
}
|
|
69
|
+
get tooltip() {
|
|
70
|
+
return this._tooltip;
|
|
71
|
+
}
|
|
72
|
+
get tooltipPosition() {
|
|
73
|
+
return this._tooltipPosition;
|
|
74
|
+
}
|
|
75
|
+
copy() {
|
|
76
|
+
const descriptor = new ActionButtonDescriptor();
|
|
77
|
+
descriptor._label = this._label;
|
|
78
|
+
descriptor._icon = this._icon;
|
|
79
|
+
descriptor._iconPosition = this._iconPosition;
|
|
80
|
+
descriptor._styleClass = { ...this._styleClass };
|
|
81
|
+
descriptor._badge = this._badge;
|
|
82
|
+
descriptor._tooltip = this._tooltip;
|
|
78
83
|
return descriptor;
|
|
79
84
|
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
class ButtonStyleBuilder {
|
|
88
|
+
static from(opts) {
|
|
89
|
+
const builder = new ButtonStyleBuilder();
|
|
90
|
+
builder._level = opts?.level;
|
|
91
|
+
builder._size = opts?.size;
|
|
92
|
+
builder._textButton = opts?.textButton;
|
|
93
|
+
builder._outlined = opts?.outlined;
|
|
94
|
+
builder._raised = opts?.raised;
|
|
95
|
+
builder._rounded = opts?.rounded;
|
|
96
|
+
builder._class = opts?.class;
|
|
97
|
+
return builder;
|
|
98
|
+
}
|
|
99
|
+
get level() {
|
|
100
|
+
return this._level;
|
|
101
|
+
}
|
|
102
|
+
get size() {
|
|
103
|
+
return this._size;
|
|
104
|
+
}
|
|
105
|
+
get textButton() {
|
|
106
|
+
return this._textButton;
|
|
107
|
+
}
|
|
108
|
+
get outlined() {
|
|
109
|
+
return this._outlined;
|
|
110
|
+
}
|
|
111
|
+
get raised() {
|
|
112
|
+
return this._raised;
|
|
113
|
+
}
|
|
114
|
+
get rounded() {
|
|
115
|
+
return this._rounded;
|
|
116
|
+
}
|
|
117
|
+
get class() {
|
|
118
|
+
return this._class;
|
|
119
|
+
}
|
|
80
120
|
/**
|
|
81
121
|
* sets custom action level and returns this object
|
|
82
|
-
* @param
|
|
122
|
+
* @param level
|
|
83
123
|
*/
|
|
84
|
-
|
|
85
|
-
this.
|
|
124
|
+
withLevel(level) {
|
|
125
|
+
this._level = level;
|
|
86
126
|
return this;
|
|
87
127
|
}
|
|
88
128
|
/**
|
|
@@ -95,42 +135,73 @@ class ButtonStyleBuilder {
|
|
|
95
135
|
}
|
|
96
136
|
/**
|
|
97
137
|
* sets text button property
|
|
98
|
-
* @param
|
|
138
|
+
* @param text default true
|
|
99
139
|
*/
|
|
100
|
-
withTextButton(
|
|
101
|
-
this._textButton =
|
|
140
|
+
withTextButton(text = true) {
|
|
141
|
+
this._textButton = text;
|
|
102
142
|
return this;
|
|
103
143
|
}
|
|
104
144
|
/**
|
|
105
145
|
* sets outline button property
|
|
106
|
-
* @param
|
|
146
|
+
* @param outlined default true
|
|
107
147
|
*/
|
|
108
|
-
|
|
109
|
-
this.
|
|
148
|
+
withOutlined(outlined = true) {
|
|
149
|
+
this._outlined = outlined;
|
|
110
150
|
return this;
|
|
111
151
|
}
|
|
112
152
|
/**
|
|
113
153
|
* sets raised button property
|
|
114
|
-
* @param
|
|
154
|
+
* @param raised default true
|
|
115
155
|
*/
|
|
116
|
-
|
|
117
|
-
this.
|
|
156
|
+
withRaised(raised = true) {
|
|
157
|
+
this._raised = raised;
|
|
118
158
|
return this;
|
|
119
159
|
}
|
|
120
|
-
|
|
121
|
-
this.
|
|
160
|
+
withRounded(rounded = true) {
|
|
161
|
+
this._rounded = rounded;
|
|
122
162
|
return this;
|
|
123
163
|
}
|
|
124
164
|
/**
|
|
125
165
|
* sets custom style class
|
|
126
166
|
* @param customClass
|
|
127
167
|
*/
|
|
128
|
-
|
|
129
|
-
this.
|
|
168
|
+
withClass(customClass) {
|
|
169
|
+
this._class = customClass;
|
|
130
170
|
return this;
|
|
131
171
|
}
|
|
132
|
-
|
|
133
|
-
|
|
172
|
+
build(hasNoTitle = false) {
|
|
173
|
+
const styles = [this.levelToStyleClass(), this.sizeToStyleClass(), this._class];
|
|
174
|
+
if (hasNoTitle && this._rounded == null) {
|
|
175
|
+
styles.push(`p-button-rounded mng-action-button-icon`);
|
|
176
|
+
}
|
|
177
|
+
if (this._textButton) {
|
|
178
|
+
styles.push(`p-button-text`);
|
|
179
|
+
}
|
|
180
|
+
if (this._outlined) {
|
|
181
|
+
styles.push(`p-button-outlined`);
|
|
182
|
+
}
|
|
183
|
+
if (this._raised) {
|
|
184
|
+
styles.push(`p-button-raised`);
|
|
185
|
+
}
|
|
186
|
+
if (this._rounded) {
|
|
187
|
+
styles.push('p-button-rounded');
|
|
188
|
+
}
|
|
189
|
+
return styles.join(' ');
|
|
190
|
+
}
|
|
191
|
+
copy() {
|
|
192
|
+
const builder = new ButtonStyleBuilder();
|
|
193
|
+
builder._level = this._level;
|
|
194
|
+
builder._size = this._size;
|
|
195
|
+
builder._textButton = this._textButton;
|
|
196
|
+
builder._outlined = this._outlined;
|
|
197
|
+
builder._raised = this._raised;
|
|
198
|
+
builder._rounded = this._rounded;
|
|
199
|
+
builder._class = this._class;
|
|
200
|
+
return builder;
|
|
201
|
+
}
|
|
202
|
+
levelToStyleClass() {
|
|
203
|
+
switch (this._level) {
|
|
204
|
+
case undefined:
|
|
134
205
|
case StyleLevelEnum.Default:
|
|
135
206
|
case StyleLevelEnum.Primary:
|
|
136
207
|
return 'p-button-primary';
|
|
@@ -148,7 +219,7 @@ class ButtonStyleBuilder {
|
|
|
148
219
|
return 'p-button-danger';
|
|
149
220
|
}
|
|
150
221
|
}
|
|
151
|
-
|
|
222
|
+
sizeToStyleClass() {
|
|
152
223
|
switch (this._size) {
|
|
153
224
|
case StyleSizeEnum.ExtraSmall:
|
|
154
225
|
return 'p-button-sm mng-button-xs';
|
|
@@ -163,109 +234,6 @@ class ButtonStyleBuilder {
|
|
|
163
234
|
return '';
|
|
164
235
|
}
|
|
165
236
|
}
|
|
166
|
-
copy() {
|
|
167
|
-
const builder = new ButtonStyleBuilder(this._actionLevel, this._customClass);
|
|
168
|
-
builder._size = this._size;
|
|
169
|
-
builder._textButton = this._textButton;
|
|
170
|
-
builder._outlineButton = this._outlineButton;
|
|
171
|
-
builder._raisedButton = this._raisedButton;
|
|
172
|
-
builder._roundedStyle = this._roundedStyle;
|
|
173
|
-
return builder;
|
|
174
|
-
}
|
|
175
|
-
get actionLevel() {
|
|
176
|
-
return this._actionLevel;
|
|
177
|
-
}
|
|
178
|
-
get size() {
|
|
179
|
-
return this._size;
|
|
180
|
-
}
|
|
181
|
-
get textButton() {
|
|
182
|
-
return this._textButton;
|
|
183
|
-
}
|
|
184
|
-
get outlineButton() {
|
|
185
|
-
return this._outlineButton;
|
|
186
|
-
}
|
|
187
|
-
get raisedButton() {
|
|
188
|
-
return this._raisedButton;
|
|
189
|
-
}
|
|
190
|
-
get roundedStyle() {
|
|
191
|
-
return this._roundedStyle;
|
|
192
|
-
}
|
|
193
|
-
get customClass() {
|
|
194
|
-
return this._customClass;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
var ButtonStyleRoundedEnum;
|
|
198
|
-
(function (ButtonStyleRoundedEnum) {
|
|
199
|
-
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["DEFAULT"] = 0] = "DEFAULT";
|
|
200
|
-
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["ROUNDED"] = 1] = "ROUNDED";
|
|
201
|
-
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["SQUARE"] = 2] = "SQUARE";
|
|
202
|
-
})(ButtonStyleRoundedEnum || (ButtonStyleRoundedEnum = {}));
|
|
203
|
-
|
|
204
|
-
class ActionButtonDescriptor {
|
|
205
|
-
constructor() {
|
|
206
|
-
this._iconPosition = 'left';
|
|
207
|
-
this._styleClass = new ButtonStyleBuilder();
|
|
208
|
-
}
|
|
209
|
-
withLabel(label) {
|
|
210
|
-
this._label = label;
|
|
211
|
-
return this;
|
|
212
|
-
}
|
|
213
|
-
withIcon(icon) {
|
|
214
|
-
this._icon = icon;
|
|
215
|
-
return this;
|
|
216
|
-
}
|
|
217
|
-
withIconPosition(iconPosition) {
|
|
218
|
-
this._iconPosition = iconPosition;
|
|
219
|
-
return this;
|
|
220
|
-
}
|
|
221
|
-
withStyleClass(style) {
|
|
222
|
-
this._styleClass = style;
|
|
223
|
-
return this;
|
|
224
|
-
}
|
|
225
|
-
withBadge(badge) {
|
|
226
|
-
this._badge = badge;
|
|
227
|
-
return this;
|
|
228
|
-
}
|
|
229
|
-
withTooltip(tooltip, position) {
|
|
230
|
-
this._tooltip = tooltip;
|
|
231
|
-
this._tooltipPosition = position ?? 'top';
|
|
232
|
-
return this;
|
|
233
|
-
}
|
|
234
|
-
withTooltipPosition(position) {
|
|
235
|
-
this._tooltipPosition = position;
|
|
236
|
-
return this;
|
|
237
|
-
}
|
|
238
|
-
get label() {
|
|
239
|
-
return this._label;
|
|
240
|
-
}
|
|
241
|
-
get icon() {
|
|
242
|
-
return this._icon;
|
|
243
|
-
}
|
|
244
|
-
get iconPosition() {
|
|
245
|
-
return this._iconPosition;
|
|
246
|
-
}
|
|
247
|
-
get styleClass() {
|
|
248
|
-
return this._styleClass;
|
|
249
|
-
}
|
|
250
|
-
get badge() {
|
|
251
|
-
return this._badge;
|
|
252
|
-
}
|
|
253
|
-
get tooltip() {
|
|
254
|
-
return this._tooltip;
|
|
255
|
-
}
|
|
256
|
-
get tooltipPosition() {
|
|
257
|
-
return this._tooltipPosition;
|
|
258
|
-
}
|
|
259
|
-
copy() {
|
|
260
|
-
const descriptor = new ActionButtonDescriptor();
|
|
261
|
-
descriptor._label = this._label;
|
|
262
|
-
descriptor._icon = this._icon;
|
|
263
|
-
descriptor._iconPosition = this._iconPosition;
|
|
264
|
-
descriptor._styleClass = this._styleClass.copy();
|
|
265
|
-
descriptor._badge = this._badge;
|
|
266
|
-
descriptor._tooltip = this._tooltip;
|
|
267
|
-
return descriptor;
|
|
268
|
-
}
|
|
269
237
|
}
|
|
270
238
|
|
|
271
239
|
// data providers
|
|
@@ -274,5 +242,5 @@ class ActionButtonDescriptor {
|
|
|
274
242
|
* Generated bundle index. Do not edit.
|
|
275
243
|
*/
|
|
276
244
|
|
|
277
|
-
export { ActionButtonDescriptor, ButtonStyleBuilder,
|
|
245
|
+
export { ActionButtonDescriptor, ButtonStyleBuilder, LookupDataProviderInst, lookupDataProvider };
|
|
278
246
|
//# sourceMappingURL=mediusinc-mng-commons-form-api.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediusinc-mng-commons-form-api.mjs","sources":["../../form/api/src/data-providers/lookup.data-provider.ts","../../form/api/src/data-providers/lookup-data-provider.factory.ts","../../form/api/src/descriptors/button-style.builder.ts","../../form/api/src/descriptors/action-button.descriptor.ts","../../form/api/src/index.ts","../../form/api/src/mediusinc-mng-commons-form-api.ts"],"sourcesContent":["import {DataProviderInst, ILookupDataProvider, LookupDataProviderLookupFnType, ServiceClassOptType} from '@mediusinc/mng-commons/core';\n\nexport class LookupDataProviderInst<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassOptType<Service>>\n extends DataProviderInst<Model, Service, ServiceClass>\n implements ILookupDataProvider<Model, Service, Sorts, Filters, ServiceClass>\n{\n protected _lookup: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters> = () => [];\n\n public constructor(serviceType: ServiceClass) {\n super(serviceType);\n }\n\n get lookup() {\n return this._lookup;\n }\n\n withLookup(fn: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters>): this {\n this._lookup = fn;\n return this;\n }\n}\n","import {ServiceClassType} from '@mediusinc/mng-commons/core';\nimport {ModelDescriptor, TypeDescriptor} from '@mediusinc/mng-commons/model';\n\nimport {LookupDataProviderInst} from './lookup.data-provider';\n\n/**\n * Creates and returns an instance of `LookupDataProviderInst` with the specified options for managing lookup data.\n *\n * @param {Object} [opts] - The options object to configure the data provider.\n * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.\n * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.\n * @param {TypeDescriptor<CreateModel> | ModelDescriptor<CreateModel>} [opts.filtersType] - The descriptor defining the filters type.\n * @param {TypeDescriptor<UpdateModel> | ModelDescriptor<UpdateModel>} [opts.sortsType] - The descriptor defining the sorts type.\n * @return {LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>} An instance of `LookupDataProviderInst` configured according to the provided options.\n */\nexport function lookupDataProvider<\n Model,\n Service = any,\n Sorts = keyof Model,\n Filters extends keyof any = keyof Model,\n ServiceClass = Service extends undefined ? undefined : ServiceClassType<Service>\n>(opts?: {\n type?: TypeDescriptor<Model> | ModelDescriptor<Model>;\n service?: ServiceClassType<Service>;\n filtersType?: TypeDescriptor<Filters> | ModelDescriptor<Filters>;\n sortsType?: TypeDescriptor<Sorts> | ModelDescriptor<Sorts>;\n}): LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass> {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>(opts?.service as ServiceClass);\n}\n","import {StyleLevelEnum, StyleSizeEnum} from '@mediusinc/mng-commons/core';\n\nexport class ButtonStyleBuilder {\n private _size: StyleSizeEnum = StyleSizeEnum.Normal;\n private _actionLevel: StyleLevelEnum;\n\n private _textButton = false;\n private _outlineButton = false;\n private _raisedButton = false;\n private _roundedStyle = ButtonStyleRoundedEnum.DEFAULT;\n private _customClass?: string;\n\n constructor(level = StyleLevelEnum.Default, customClass?: string) {\n this._actionLevel = level;\n this._customClass = customClass;\n }\n\n public build(hasNoTitle = false): string {\n const styles = [this.convertActionLevelToStyleClass(), this.convertSizeToStyleClass(), this._customClass];\n\n if (hasNoTitle && this._roundedStyle === ButtonStyleRoundedEnum.DEFAULT) {\n styles.push(`p-button-rounded mng-action-button-icon`);\n }\n\n if (this._textButton) {\n styles.push(`p-button-text`);\n }\n\n if (this._outlineButton) {\n styles.push(`p-button-outlined`);\n }\n\n if (this._raisedButton) {\n styles.push(`p-button-raised`);\n }\n\n if (this._roundedStyle === ButtonStyleRoundedEnum.ROUNDED) {\n styles.push('p-button-rounded');\n }\n\n return styles.join(' ');\n }\n\n /**\n * creates instance of style builder with custom properties\n * @param actionLevel ActionLevelEnum\n * @param size ActionSizeEnum\n * @param textButton if true, text button will be applied\n * @param outlineButton if true, outlined button will be applied\n * @param raisedButton if true, raised button will be applied\n * @param customClass additional custom classes (will be added at generating)\n */\n public static create(\n actionLevel?: StyleLevelEnum,\n size?: StyleSizeEnum,\n textButton?: boolean,\n outlineButton?: boolean,\n raisedButton?: boolean,\n roundedButton?: ButtonStyleRoundedEnum,\n customClass?: string\n ): ButtonStyleBuilder {\n const descriptor = new ButtonStyleBuilder(actionLevel, customClass);\n descriptor._actionLevel = actionLevel ?? descriptor._actionLevel;\n descriptor._size = size ?? descriptor._size;\n descriptor._textButton = textButton ?? descriptor._textButton;\n descriptor._outlineButton = outlineButton ?? descriptor._outlineButton;\n descriptor._raisedButton = raisedButton ?? descriptor._raisedButton;\n descriptor._roundedStyle = roundedButton ?? descriptor._roundedStyle;\n descriptor._customClass = customClass;\n\n return descriptor;\n }\n\n /**\n * sets custom action level and returns this object\n * @param actionLevel\n */\n public withActionLevel(actionLevel: StyleLevelEnum): ButtonStyleBuilder {\n this._actionLevel = actionLevel;\n return this;\n }\n\n /**\n * sets custom size and return this object\n * @param size\n */\n public withSize(size: StyleSizeEnum): ButtonStyleBuilder {\n this._size = size;\n return this;\n }\n\n /**\n * sets text button property\n * @param withText default true\n */\n public withTextButton(withText = true): ButtonStyleBuilder {\n this._textButton = withText;\n return this;\n }\n\n /**\n * sets outline button property\n * @param withOutline default true\n */\n public withOutlineButton(withOutline = true): ButtonStyleBuilder {\n this._outlineButton = withOutline;\n return this;\n }\n\n /**\n * sets raised button property\n * @param withRaised default true\n */\n public withRaisedButton(withRaised = true): ButtonStyleBuilder {\n this._raisedButton = withRaised;\n return this;\n }\n\n public withRoundedButton(roundedStyle = ButtonStyleRoundedEnum.ROUNDED): ButtonStyleBuilder {\n this._roundedStyle = roundedStyle;\n return this;\n }\n\n /**\n * sets custom style class\n * @param customClass\n */\n public withCustomClass(customClass: string): ButtonStyleBuilder {\n this._customClass = customClass;\n return this;\n }\n\n private convertActionLevelToStyleClass(): string {\n switch (this._actionLevel) {\n case StyleLevelEnum.Default:\n case StyleLevelEnum.Primary:\n return 'p-button-primary';\n case StyleLevelEnum.Secondary:\n return 'p-button-secondary';\n case StyleLevelEnum.Info:\n return 'p-button-info';\n case StyleLevelEnum.Help:\n return 'p-button-help';\n case StyleLevelEnum.Success:\n return 'p-button-success';\n case StyleLevelEnum.Warning:\n return 'p-button-warning';\n case StyleLevelEnum.Danger:\n return 'p-button-danger';\n }\n }\n\n private convertSizeToStyleClass(): string {\n switch (this._size) {\n case StyleSizeEnum.ExtraSmall:\n return 'p-button-sm mng-button-xs';\n case StyleSizeEnum.Small:\n return 'p-button-sm mng-button-sm';\n case StyleSizeEnum.Large:\n return 'p-button-lg mng-button-lg';\n case StyleSizeEnum.ExtraLarge:\n return 'p-button-lg mng-button-xl';\n case StyleSizeEnum.Normal:\n default:\n return '';\n }\n }\n\n public copy(): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder(this._actionLevel, this._customClass);\n\n builder._size = this._size;\n builder._textButton = this._textButton;\n builder._outlineButton = this._outlineButton;\n builder._raisedButton = this._raisedButton;\n builder._roundedStyle = this._roundedStyle;\n\n return builder;\n }\n\n public get actionLevel() {\n return this._actionLevel;\n }\n\n public get size() {\n return this._size;\n }\n\n public get textButton() {\n return this._textButton;\n }\n\n public get outlineButton() {\n return this._outlineButton;\n }\n\n public get raisedButton() {\n return this._raisedButton;\n }\n\n public get roundedStyle() {\n return this._roundedStyle;\n }\n\n public get customClass() {\n return this._customClass;\n }\n}\n\nexport enum ButtonStyleRoundedEnum {\n DEFAULT,\n ROUNDED,\n SQUARE\n}\n","import {ButtonStyleBuilder} from './button-style.builder';\n\nexport class ActionButtonDescriptor {\n private _label?: string | null;\n\n private _icon?: string | null;\n private _iconPosition: 'left' | 'right' = 'left';\n\n private _styleClass = new ButtonStyleBuilder();\n\n private _badge?: string;\n private _tooltip?: string;\n private _tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';\n\n public withLabel(label?: string | null): this {\n this._label = label;\n return this;\n }\n\n public withIcon(icon: string | null): this {\n this._icon = icon;\n return this;\n }\n\n public withIconPosition(iconPosition: 'left' | 'right'): this {\n this._iconPosition = iconPosition;\n return this;\n }\n\n public withStyleClass(style: ButtonStyleBuilder): this {\n this._styleClass = style;\n return this;\n }\n\n public withBadge(badge: string): this {\n this._badge = badge;\n return this;\n }\n\n public withTooltip(tooltip: string, position?: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltip = tooltip;\n this._tooltipPosition = position ?? 'top';\n return this;\n }\n\n public withTooltipPosition(position: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltipPosition = position;\n return this;\n }\n\n public get label() {\n return this._label;\n }\n\n public get icon() {\n return this._icon;\n }\n\n public get iconPosition() {\n return this._iconPosition;\n }\n\n public get styleClass() {\n return this._styleClass;\n }\n\n public get badge() {\n return this._badge;\n }\n\n public get tooltip() {\n return this._tooltip;\n }\n\n public get tooltipPosition() {\n return this._tooltipPosition;\n }\n\n public copy(): ActionButtonDescriptor {\n const descriptor = new ActionButtonDescriptor();\n descriptor._label = this._label;\n descriptor._icon = this._icon;\n descriptor._iconPosition = this._iconPosition;\n descriptor._styleClass = this._styleClass.copy();\n descriptor._badge = this._badge;\n descriptor._tooltip = this._tooltip;\n return descriptor;\n }\n}\n","// data providers\nexport * from './data-providers/lookup.data-provider';\nexport * from './data-providers/lookup-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/action-button.descriptor';\nexport * from './descriptors/button-style.builder';\n\n// models\nexport * from './models/trim.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEM,MAAO,sBACT,SAAQ,gBAA8C,CAAA;AAKtD,IAAA,WAAA,CAAmB,WAAyB,EAAA;QACxC,KAAK,CAAC,WAAW,CAAC;AAHZ,QAAA,IAAA,CAAA,OAAO,GAAmE,MAAM,EAAE;;AAM5F,IAAA,IAAI,MAAM,GAAA;QACN,OAAO,IAAI,CAAC,OAAO;;AAGvB,IAAA,UAAU,CAAC,EAAkE,EAAA;AACzE,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE;AACjB,QAAA,OAAO,IAAI;;AAElB;;ACfD;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAMhC,IAKD,EAAA;AACG,IAAA,OAAO,IAAI,sBAAsB,CAA+C,IAAI,EAAE,OAAuB,CAAC;AAClH;;MC1Ba,kBAAkB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;IAGzB,IAAI,GAAA;AACP,QAAA,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE;AAC/C,QAAA,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC/B,QAAA,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK;AAC7B,QAAA,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa;QAC7C,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;AAChD,QAAA,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC/B,QAAA,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ;AACnC,QAAA,OAAO,UAAU;;AAExB;;ACxFD;;ACAA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mediusinc-mng-commons-form-api.mjs","sources":["../../form/api/src/data-providers/lookup.data-provider.ts","../../form/api/src/data-providers/lookup-data-provider.factory.ts","../../form/api/src/descriptors/action-button.descriptor.ts","../../form/api/src/descriptors/button-style.builder.ts","../../form/api/src/index.ts","../../form/api/src/mediusinc-mng-commons-form-api.ts"],"sourcesContent":["import {DataProviderInst, ILookupDataProvider, LookupDataProviderLookupFnType, ServiceClassOptType} from '@mediusinc/mng-commons/core';\n\nexport class LookupDataProviderInst<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassOptType<Service>>\n extends DataProviderInst<Model, Service, ServiceClass>\n implements ILookupDataProvider<Model, Service, Sorts, Filters, ServiceClass>\n{\n protected _lookup: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters> = () => [];\n\n public constructor(serviceType: ServiceClass) {\n super(serviceType);\n }\n\n get lookup() {\n return this._lookup;\n }\n\n withLookup(fn: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters>): this {\n this._lookup = fn;\n return this;\n }\n}\n","import {ServiceClassType} from '@mediusinc/mng-commons/core';\nimport {ModelDescriptor, TypeDescriptor} from '@mediusinc/mng-commons/model';\n\nimport {LookupDataProviderInst} from './lookup.data-provider';\n\n/**\n * Creates and returns an instance of `LookupDataProviderInst` with the specified options for managing lookup data.\n *\n * @param {Object} [opts] - The options object to configure the data provider.\n * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.\n * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.\n * @param {TypeDescriptor<CreateModel> | ModelDescriptor<CreateModel>} [opts.filtersType] - The descriptor defining the filters type.\n * @param {TypeDescriptor<UpdateModel> | ModelDescriptor<UpdateModel>} [opts.sortsType] - The descriptor defining the sorts type.\n * @return {LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>} An instance of `LookupDataProviderInst` configured according to the provided options.\n */\nexport function lookupDataProvider<\n Model,\n Service = any,\n Sorts = keyof Model,\n Filters extends keyof any = keyof Model,\n ServiceClass = Service extends undefined ? undefined : ServiceClassType<Service>\n>(opts?: {\n type?: TypeDescriptor<Model> | ModelDescriptor<Model>;\n service?: ServiceClassType<Service>;\n filtersType?: TypeDescriptor<Filters> | ModelDescriptor<Filters>;\n sortsType?: TypeDescriptor<Sorts> | ModelDescriptor<Sorts>;\n}): LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass> {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>(opts?.service as ServiceClass);\n}\n","import {IActionButtonDescriptor, IButtonStyleDescriptor} from '../models/button.model';\n\nexport class ActionButtonDescriptor implements IActionButtonDescriptor {\n private _label?: string | null;\n\n private _icon?: string | null;\n private _iconPosition?: 'left' | 'right';\n\n private _styleClass?: IButtonStyleDescriptor;\n\n private _badge?: string;\n private _tooltip?: string | null;\n private _tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';\n\n public withLabel(label?: string | null): this {\n this._label = label;\n return this;\n }\n\n public withIcon(icon: string | null, iconPosition?: 'left' | 'right'): this {\n this._icon = icon;\n this._iconPosition = iconPosition;\n return this;\n }\n\n public withStyle(style?: IButtonStyleDescriptor): this {\n this._styleClass = style;\n return this;\n }\n\n public withBadge(badge: string): this {\n this._badge = badge;\n return this;\n }\n\n public withTooltip(tooltip: string | null, position?: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltip = tooltip;\n this._tooltipPosition = position ?? 'top';\n return this;\n }\n\n public get label() {\n return this._label;\n }\n\n public get icon() {\n return this._icon;\n }\n\n public get iconPosition() {\n return this._iconPosition;\n }\n\n public get style() {\n return this._styleClass;\n }\n\n public get badge() {\n return this._badge;\n }\n\n public get tooltip() {\n return this._tooltip;\n }\n\n public get tooltipPosition() {\n return this._tooltipPosition;\n }\n\n public copy(): ActionButtonDescriptor {\n const descriptor = new ActionButtonDescriptor();\n descriptor._label = this._label;\n descriptor._icon = this._icon;\n descriptor._iconPosition = this._iconPosition;\n descriptor._styleClass = {...this._styleClass};\n descriptor._badge = this._badge;\n descriptor._tooltip = this._tooltip;\n return descriptor;\n }\n}\n","import {StyleLevelEnum, StyleSizeEnum} from '@mediusinc/mng-commons/core';\n\nimport {IButtonStyleDescriptor} from '../models/button.model';\n\nexport class ButtonStyleBuilder implements IButtonStyleDescriptor {\n private _level?: StyleLevelEnum;\n private _size?: StyleSizeEnum;\n private _textButton?: boolean;\n private _outlined?: boolean;\n private _raised?: boolean;\n private _rounded?: boolean;\n private _class?: string;\n\n public static from(opts?: IButtonStyleDescriptor): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder();\n builder._level = opts?.level;\n builder._size = opts?.size;\n builder._textButton = opts?.textButton;\n builder._outlined = opts?.outlined;\n builder._raised = opts?.raised;\n builder._rounded = opts?.rounded;\n builder._class = opts?.class;\n return builder;\n }\n\n public get level() {\n return this._level;\n }\n\n public get size() {\n return this._size;\n }\n\n public get textButton() {\n return this._textButton;\n }\n\n public get outlined() {\n return this._outlined;\n }\n\n public get raised() {\n return this._raised;\n }\n\n public get rounded() {\n return this._rounded;\n }\n\n public get class() {\n return this._class;\n }\n\n /**\n * sets custom action level and returns this object\n * @param level\n */\n public withLevel(level: StyleLevelEnum): ButtonStyleBuilder {\n this._level = level;\n return this;\n }\n\n /**\n * sets custom size and return this object\n * @param size\n */\n public withSize(size: StyleSizeEnum): ButtonStyleBuilder {\n this._size = size;\n return this;\n }\n\n /**\n * sets text button property\n * @param text default true\n */\n public withTextButton(text = true): ButtonStyleBuilder {\n this._textButton = text;\n return this;\n }\n\n /**\n * sets outline button property\n * @param outlined default true\n */\n public withOutlined(outlined = true): ButtonStyleBuilder {\n this._outlined = outlined;\n return this;\n }\n\n /**\n * sets raised button property\n * @param raised default true\n */\n public withRaised(raised = true): ButtonStyleBuilder {\n this._raised = raised;\n return this;\n }\n\n public withRounded(rounded = true): ButtonStyleBuilder {\n this._rounded = rounded;\n return this;\n }\n\n /**\n * sets custom style class\n * @param customClass\n */\n public withClass(customClass: string): ButtonStyleBuilder {\n this._class = customClass;\n return this;\n }\n\n public build(hasNoTitle = false): string {\n const styles = [this.levelToStyleClass(), this.sizeToStyleClass(), this._class];\n\n if (hasNoTitle && this._rounded == null) {\n styles.push(`p-button-rounded mng-action-button-icon`);\n }\n\n if (this._textButton) {\n styles.push(`p-button-text`);\n }\n\n if (this._outlined) {\n styles.push(`p-button-outlined`);\n }\n\n if (this._raised) {\n styles.push(`p-button-raised`);\n }\n\n if (this._rounded) {\n styles.push('p-button-rounded');\n }\n\n return styles.join(' ');\n }\n\n public copy(): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder();\n builder._level = this._level;\n builder._size = this._size;\n builder._textButton = this._textButton;\n builder._outlined = this._outlined;\n builder._raised = this._raised;\n builder._rounded = this._rounded;\n builder._class = this._class;\n return builder;\n }\n\n private levelToStyleClass(): string {\n switch (this._level) {\n case undefined:\n case StyleLevelEnum.Default:\n case StyleLevelEnum.Primary:\n return 'p-button-primary';\n case StyleLevelEnum.Secondary:\n return 'p-button-secondary';\n case StyleLevelEnum.Info:\n return 'p-button-info';\n case StyleLevelEnum.Help:\n return 'p-button-help';\n case StyleLevelEnum.Success:\n return 'p-button-success';\n case StyleLevelEnum.Warning:\n return 'p-button-warning';\n case StyleLevelEnum.Danger:\n return 'p-button-danger';\n }\n }\n\n private sizeToStyleClass(): string {\n switch (this._size) {\n case StyleSizeEnum.ExtraSmall:\n return 'p-button-sm mng-button-xs';\n case StyleSizeEnum.Small:\n return 'p-button-sm mng-button-sm';\n case StyleSizeEnum.Large:\n return 'p-button-lg mng-button-lg';\n case StyleSizeEnum.ExtraLarge:\n return 'p-button-lg mng-button-xl';\n case StyleSizeEnum.Normal:\n default:\n return '';\n }\n }\n}\n","// data providers\nexport * from './data-providers/lookup.data-provider';\nexport * from './data-providers/lookup-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/action-button.descriptor';\nexport * from './descriptors/button-style.builder';\n\n// models\nexport * from './models/button.model';\nexport * from './models/trim.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEM,MAAO,sBACT,SAAQ,gBAA8C,CAAA;AAKtD,IAAA,WAAA,CAAmB,WAAyB,EAAA;QACxC,KAAK,CAAC,WAAW,CAAC;AAHZ,QAAA,IAAA,CAAA,OAAO,GAAmE,MAAM,EAAE;;AAM5F,IAAA,IAAI,MAAM,GAAA;QACN,OAAO,IAAI,CAAC,OAAO;;AAGvB,IAAA,UAAU,CAAC,EAAkE,EAAA;AACzE,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE;AACjB,QAAA,OAAO,IAAI;;AAElB;;ACfD;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAMhC,IAKD,EAAA;AACG,IAAA,OAAO,IAAI,sBAAsB,CAA+C,IAAI,EAAE,OAAuB,CAAC;AAClH;;MC1Ba,sBAAsB,CAAA;AAYxB,IAAA,SAAS,CAAC,KAAqB,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,OAAO,IAAI;;IAGR,QAAQ,CAAC,IAAmB,EAAE,YAA+B,EAAA;AAChE,QAAA,IAAI,CAAC,KAAK,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AA;AACpB,QAAA,QAAQ,IAAI,CAAC,KAAK;YACd,KAAK,aAAa,CAAC,UAAU;AACzB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,KAAK;AACpB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,KAAK;AACpB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,UAAU;AACzB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,MAAM;AACzB,YAAA;AACI,gBAAA,OAAO,EAAE;;;AAGxB;;AC1LD;;ACAA;;AAEG;;;;"}
|
|
@@ -99,9 +99,9 @@ function model(typeOrOpts, opts) {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function getI18nForModel(translate, model, keyPath,
|
|
103
|
-
const keys = getKeysByPriority(model, keyPath, customKey, fallbackKey);
|
|
104
|
-
const i18nParams = getI18nModelParams(translate, model, item, params);
|
|
102
|
+
function getI18nForModel(translate, model, keyPath, opts) {
|
|
103
|
+
const keys = getKeysByPriority(model, keyPath, opts?.customKey, opts?.fallbackKey);
|
|
104
|
+
const i18nParams = getI18nModelParams(translate, model, opts?.item, opts?.params);
|
|
105
105
|
return getI18n(translate, i18nParams, ...keys);
|
|
106
106
|
}
|
|
107
107
|
function getI18nModelParams(translate, model, item, params = {}) {
|
|
@@ -131,10 +131,15 @@ function getKeysByPriority(model, keyPath, customKey, fallbackKey) {
|
|
|
131
131
|
if (customKey) {
|
|
132
132
|
keys.push(customKey);
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
else {
|
|
135
|
+
const modelActionKey = getI18nTypeKeyBasePath(model.i18nBaseKey, keyPath);
|
|
136
|
+
keys.push(modelActionKey);
|
|
137
|
+
if (keyPath !== modelActionKey) {
|
|
138
|
+
keys.push(keyPath);
|
|
139
|
+
}
|
|
140
|
+
if (fallbackKey) {
|
|
141
|
+
keys.push(fallbackKey);
|
|
142
|
+
}
|
|
138
143
|
}
|
|
139
144
|
return keys;
|
|
140
145
|
}
|
|
@@ -145,5 +150,5 @@ function getKeysByPriority(model, keyPath, customKey, fallbackKey) {
|
|
|
145
150
|
* Generated bundle index. Do not edit.
|
|
146
151
|
*/
|
|
147
152
|
|
|
148
|
-
export { EnumDescriptor, ModelDescriptor, TypeDescriptor, dataProvider, enumModel, enumModelGeneric, getI18nForModel, getI18nModelParams, getI18nModelParamsAsync, model,
|
|
153
|
+
export { EnumDescriptor, ModelDescriptor, TypeDescriptor, dataProvider, enumModel, enumModelGeneric, getI18nForModel, getI18nModelParams, getI18nModelParamsAsync, model, type };
|
|
149
154
|
//# sourceMappingURL=mediusinc-mng-commons-model.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediusinc-mng-commons-model.mjs","sources":["../../model/src/data-providers/base-from-type-data-provider.factory.ts","../../model/src/descriptors/enum.descriptor.ts","../../model/src/descriptors/type.descriptor.ts","../../model/src/descriptors/model.descriptor.ts","../../model/src/helpers/i18n.ts","../../model/src/index.ts","../../model/src/mediusinc-mng-commons-model.ts"],"sourcesContent":["import {DataProviderInst, ServiceClassType} from '@mediusinc/mng-commons/core';\n\nimport {ModelDescriptor} from '../descriptors/model.descriptor';\nimport {TypeDescriptor} from '../descriptors/type.descriptor';\n\n/**\n * Creates and returns an instance of `DataProviderInst` with the specified options for managing editor data.\n *\n * @param {Object} [opts] - The options object to configure the data provider.\n * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.\n * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.\n * @return {DataProviderInst<Model, Service, ServiceClass>} An instance of `EditorDataProviderInst` configured according to the provided options.\n */\nexport function dataProvider<Model, Service = undefined, ServiceClass = Service extends undefined ? undefined : ServiceClassType<Service>>(opts?: {\n type?: TypeDescriptor<Model> | ModelDescriptor<Model>;\n service?: ServiceClassType<Service>;\n}): DataProviderInst<Model, Service, ServiceClass> {\n return new DataProviderInst<Model, Service, ServiceClass>(opts?.service as ServiceClass);\n}\n","import {EnumType, findReflectEnumName} from '@mediusinc/mng-commons/core';\n\nexport class EnumDescriptor<Enum> {\n private readonly _value: Enum;\n private readonly _type: EnumType;\n private readonly _nameAsValue;\n private readonly _i18nBaseKey: string | null;\n\n public constructor(value: Enum, type: EnumType, i18nBaseKey?: string | null, nameAsValue = false) {\n this._value = value;\n this._type = type;\n this._nameAsValue = nameAsValue;\n\n if (typeof i18nBaseKey === 'undefined') {\n i18nBaseKey = findReflectEnumName(type);\n }\n this._i18nBaseKey = i18nBaseKey;\n }\n\n public get type() {\n return this._type;\n }\n\n public get i18nBaseKey() {\n return this._i18nBaseKey;\n }\n\n public get nameAsValue() {\n return this._nameAsValue;\n }\n}\n\nexport function enumModel<Enum>(value: Enum, type: EnumType, i18nBaseKey: string | undefined | null = null, nameAsValue = false) {\n return new EnumDescriptor<Enum>(value, type, i18nBaseKey, nameAsValue);\n}\n\nexport function enumModelGeneric<Enum = any>(type: EnumType, i18nBaseKey: string | undefined | null = null, nameAsValue = false) {\n return new EnumDescriptor<Enum>(undefined as Enum, type, i18nBaseKey, nameAsValue);\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport class TypeDescriptor<Type> {}\n\nexport function type<Type>(): TypeDescriptor<Type> {\n return new TypeDescriptor<Type>();\n}\n","import {IModelDescriptor} from '@mediusinc/mng-commons/core';\n\nimport {TypeDescriptor} from './type.descriptor';\n\nexport class ModelDescriptor<Model> implements IModelDescriptor<Model> {\n protected _i18nBaseKey: string;\n protected _idProperty?: string;\n protected _titleProperty?: string | ((item: Model) => string);\n\n public constructor(idProperty?: string, titleProperty?: string | ((item: Model) => string), i18nBaseKey?: string) {\n this._idProperty = idProperty;\n this._titleProperty = titleProperty;\n this._i18nBaseKey = i18nBaseKey ?? '';\n }\n\n public get i18nBaseKey() {\n return this._i18nBaseKey;\n }\n\n public get idProperty() {\n return this._idProperty;\n }\n\n public get titleProperty() {\n return this._titleProperty;\n }\n\n public withIdProperty(property: keyof Model): this {\n this._idProperty = property as string;\n return this;\n }\n\n public withIdPropertyUnsafe(property: string): this {\n this._idProperty = property;\n return this;\n }\n\n public withTitleProperty(property: keyof Model): this {\n this._titleProperty = property as string;\n return this;\n }\n\n public withTitlePropertyUnsafe(property: string): this {\n this._titleProperty = property;\n return this;\n }\n\n public withI18nBase(base: string): this {\n this._i18nBaseKey = base;\n return this;\n }\n\n public copy(): ModelDescriptor<Model> {\n return new ModelDescriptor<Model>(this._idProperty, this._titleProperty, this._i18nBaseKey);\n }\n}\n\nexport type ModelDescriptorCreateOpts<Model> = {\n id?: keyof Model;\n title?: keyof Model | ((item: Model) => string);\n i18nBase?: string;\n};\n\nexport function model<Model>(): ModelDescriptor<Model>;\nexport function model<Model>(opts: ModelDescriptorCreateOpts<Model>): ModelDescriptor<Model>;\nexport function model<Model>(type: TypeDescriptor<Model>, opts?: ModelDescriptorCreateOpts<Model>): ModelDescriptor<Model>;\nexport function model<Model>(typeOrOpts?: TypeDescriptor<Model> | ModelDescriptorCreateOpts<Model>, opts?: ModelDescriptorCreateOpts<Model>) {\n if (typeOrOpts == null) {\n return new ModelDescriptor<Model>();\n } else if (typeOrOpts instanceof TypeDescriptor) {\n return new ModelDescriptor<Model>(opts?.id as string, opts?.title as string, opts?.i18nBase);\n } else {\n const modelOpts = typeOrOpts as ModelDescriptorCreateOpts<Model>;\n return new ModelDescriptor<Model>(modelOpts?.id as string, modelOpts?.title as string, modelOpts?.i18nBase);\n }\n}\n","import {TranslateService} from '@ngx-translate/core';\nimport {Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {KeyOfType, getI18n, getI18nTypeKeyBasePath, getI18nTypeParams, getI18nTypeParamsAsync} from '@mediusinc/mng-commons/core';\n\nimport {ModelDescriptor} from '../descriptors/model.descriptor';\n\nexport function getI18nForModel(\n translate: TranslateService,\n model: ModelDescriptor<any>,\n keyPath: string,\n customKey?: string,\n item?: any,\n fallbackKey?: string,\n params?: any\n): string | null {\n const keys = getKeysByPriority(model, keyPath, customKey, fallbackKey);\n const i18nParams = getI18nModelParams(translate, model, item, params);\n return getI18n(translate, i18nParams, ...keys);\n}\n\nexport function getI18nModelParams(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params: any = {}): any {\n const i18nParams = getI18nTypeParams(translate, model?.i18nBaseKey, item, params);\n return populateI18nModelParams(model?.idProperty, model?.titleProperty, item, i18nParams);\n}\n\nexport function getI18nModelParamsAsync(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params: any = {}): Observable<any> {\n return getI18nTypeParamsAsync(translate, model?.i18nBaseKey, item, params).pipe(\n map(i18nParams => populateI18nModelParams(model?.idProperty, model?.titleProperty, item, i18nParams))\n );\n}\n\nexport function populateI18nModelParams(idProperty?: KeyOfType, titleProperty?: KeyOfType | ((item: any) => string), item?: any, params: any = {}): any {\n const paramsRes = {...params, itemId: '', itemTitle: ''};\n if (item) {\n if (idProperty && item[idProperty]) {\n paramsRes.itemId = item[idProperty];\n }\n if (typeof titleProperty === 'function') {\n paramsRes.itemTitle = titleProperty(item);\n } else if (titleProperty && item[titleProperty]) {\n paramsRes.itemTitle = item[titleProperty];\n }\n }\n return paramsRes;\n}\n\nfunction getKeysByPriority(model: ModelDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {\n const keys = [];\n if (customKey) {\n keys.push(customKey);\n }\n const modelActionKey = getI18nTypeKeyBasePath(model.i18nBaseKey, ...keyPath);\n keys.push(modelActionKey);\n if (fallbackKey) {\n keys.push(fallbackKey);\n }\n return keys;\n}\n","// data providers\nexport * from './data-providers/base-from-type-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/enum.descriptor';\nexport * from './descriptors/model.descriptor';\nexport * from './descriptors/type.descriptor';\n\n// helpers\nexport * from './helpers/i18n';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAKA;;;;;;;AAOG;AACG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,EAAE,IAAU,EAAE,MAAA,GAAc,EAAE,EAAA;AAC7I,IAAA,MAAM,SAAS,GAAG,EAAC,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAC;IACxD,IAAI,IAAI,EAAE;AACN,QAAA,IAAI,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;AAChC,YAAA,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;;AAEvC,QAAA,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;AACrC,YAAA,SAAS,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC;;AACtC,aAAA,IAAI,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;AAC7C,YAAA,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;;;AAGjD,IAAA,OAAO,SAAS;AACpB;AAEA,SAAS,iBAAiB,CAAC,KAA2B,EAAE,OAAe,EAAE,SAAkB,EAAE,WAAoB,EAAA;IAC7G,MAAM,IAAI,GAAG,EAAE;IACf,IAAI,SAAS,EAAE;AACX,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;;IAExB,MAAM,cAAc,GAAG,sBAAsB,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC;AAC5E,IAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;IACzB,IAAI,WAAW,EAAE;AACb,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;;AAE1B,IAAA,OAAO,IAAI;AACf;;AC3DA;;ACAA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mediusinc-mng-commons-model.mjs","sources":["../../model/src/data-providers/base-from-type-data-provider.factory.ts","../../model/src/descriptors/enum.descriptor.ts","../../model/src/descriptors/type.descriptor.ts","../../model/src/descriptors/model.descriptor.ts","../../model/src/helpers/i18n.ts","../../model/src/index.ts","../../model/src/mediusinc-mng-commons-model.ts"],"sourcesContent":["import {DataProviderInst, ServiceClassType} from '@mediusinc/mng-commons/core';\n\nimport {ModelDescriptor} from '../descriptors/model.descriptor';\nimport {TypeDescriptor} from '../descriptors/type.descriptor';\n\n/**\n * Creates and returns an instance of `DataProviderInst` with the specified options for managing editor data.\n *\n * @param {Object} [opts] - The options object to configure the data provider.\n * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.\n * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.\n * @return {DataProviderInst<Model, Service, ServiceClass>} An instance of `EditorDataProviderInst` configured according to the provided options.\n */\nexport function dataProvider<Model, Service = undefined, ServiceClass = Service extends undefined ? undefined : ServiceClassType<Service>>(opts?: {\n type?: TypeDescriptor<Model> | ModelDescriptor<Model>;\n service?: ServiceClassType<Service>;\n}): DataProviderInst<Model, Service, ServiceClass> {\n return new DataProviderInst<Model, Service, ServiceClass>(opts?.service as ServiceClass);\n}\n","import {EnumType, findReflectEnumName} from '@mediusinc/mng-commons/core';\n\nexport class EnumDescriptor<Enum> {\n private readonly _value: Enum;\n private readonly _type: EnumType;\n private readonly _nameAsValue;\n private readonly _i18nBaseKey: string | null;\n\n public constructor(value: Enum, type: EnumType, i18nBaseKey?: string | null, nameAsValue = false) {\n this._value = value;\n this._type = type;\n this._nameAsValue = nameAsValue;\n\n if (typeof i18nBaseKey === 'undefined') {\n i18nBaseKey = findReflectEnumName(type);\n }\n this._i18nBaseKey = i18nBaseKey;\n }\n\n public get type() {\n return this._type;\n }\n\n public get i18nBaseKey() {\n return this._i18nBaseKey;\n }\n\n public get nameAsValue() {\n return this._nameAsValue;\n }\n}\n\nexport function enumModel<Enum>(value: Enum, type: EnumType, i18nBaseKey: string | undefined | null = null, nameAsValue = false) {\n return new EnumDescriptor<Enum>(value, type, i18nBaseKey, nameAsValue);\n}\n\nexport function enumModelGeneric<Enum = any>(type: EnumType, i18nBaseKey: string | undefined | null = null, nameAsValue = false) {\n return new EnumDescriptor<Enum>(undefined as Enum, type, i18nBaseKey, nameAsValue);\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport class TypeDescriptor<Type> {}\n\nexport function type<Type>(): TypeDescriptor<Type> {\n return new TypeDescriptor<Type>();\n}\n","import {IModelDescriptor} from '@mediusinc/mng-commons/core';\n\nimport {TypeDescriptor} from './type.descriptor';\n\nexport class ModelDescriptor<Model> implements IModelDescriptor<Model> {\n protected _i18nBaseKey: string;\n protected _idProperty?: string;\n protected _titleProperty?: string | ((item: Model) => string);\n\n public constructor(idProperty?: string, titleProperty?: string | ((item: Model) => string), i18nBaseKey?: string) {\n this._idProperty = idProperty;\n this._titleProperty = titleProperty;\n this._i18nBaseKey = i18nBaseKey ?? '';\n }\n\n public get i18nBaseKey() {\n return this._i18nBaseKey;\n }\n\n public get idProperty() {\n return this._idProperty;\n }\n\n public get titleProperty() {\n return this._titleProperty;\n }\n\n public withIdProperty(property: keyof Model): this {\n this._idProperty = property as string;\n return this;\n }\n\n public withIdPropertyUnsafe(property: string): this {\n this._idProperty = property;\n return this;\n }\n\n public withTitleProperty(property: keyof Model): this {\n this._titleProperty = property as string;\n return this;\n }\n\n public withTitlePropertyUnsafe(property: string): this {\n this._titleProperty = property;\n return this;\n }\n\n public withI18nBase(base: string): this {\n this._i18nBaseKey = base;\n return this;\n }\n\n public copy(): ModelDescriptor<Model> {\n return new ModelDescriptor<Model>(this._idProperty, this._titleProperty, this._i18nBaseKey);\n }\n}\n\nexport type ModelDescriptorCreateOpts<Model> = {\n id?: keyof Model;\n title?: keyof Model | ((item: Model) => string);\n i18nBase?: string;\n};\n\nexport function model<Model>(): ModelDescriptor<Model>;\nexport function model<Model>(opts: ModelDescriptorCreateOpts<Model>): ModelDescriptor<Model>;\nexport function model<Model>(type: TypeDescriptor<Model>, opts?: ModelDescriptorCreateOpts<Model>): ModelDescriptor<Model>;\nexport function model<Model>(typeOrOpts?: TypeDescriptor<Model> | ModelDescriptorCreateOpts<Model>, opts?: ModelDescriptorCreateOpts<Model>) {\n if (typeOrOpts == null) {\n return new ModelDescriptor<Model>();\n } else if (typeOrOpts instanceof TypeDescriptor) {\n return new ModelDescriptor<Model>(opts?.id as string, opts?.title as string, opts?.i18nBase);\n } else {\n const modelOpts = typeOrOpts as ModelDescriptorCreateOpts<Model>;\n return new ModelDescriptor<Model>(modelOpts?.id as string, modelOpts?.title as string, modelOpts?.i18nBase);\n }\n}\n","import {TranslateService} from '@ngx-translate/core';\nimport {Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {KeyOfType, getI18n, getI18nTypeKeyBasePath, getI18nTypeParams, getI18nTypeParamsAsync} from '@mediusinc/mng-commons/core';\n\nimport {ModelDescriptor} from '../descriptors/model.descriptor';\n\ntype ModelI18nOptsType = {\n customKey?: string;\n fallbackKey?: string;\n item?: any;\n params?: any;\n};\n\nexport function getI18nForModel(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, opts?: ModelI18nOptsType): string | null {\n const keys = getKeysByPriority(model, keyPath, opts?.customKey, opts?.fallbackKey);\n const i18nParams = getI18nModelParams(translate, model, opts?.item, opts?.params);\n return getI18n(translate, i18nParams, ...keys);\n}\n\nexport function getI18nModelParams(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params: any = {}): any {\n const i18nParams = getI18nTypeParams(translate, model?.i18nBaseKey, item, params);\n return populateI18nModelParams(model?.idProperty, model?.titleProperty, item, i18nParams);\n}\n\nexport function getI18nModelParamsAsync(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params: any = {}): Observable<any> {\n return getI18nTypeParamsAsync(translate, model?.i18nBaseKey, item, params).pipe(\n map(i18nParams => populateI18nModelParams(model?.idProperty, model?.titleProperty, item, i18nParams))\n );\n}\n\nfunction populateI18nModelParams(idProperty?: KeyOfType, titleProperty?: KeyOfType | ((item: any) => string), item?: any, params: any = {}): any {\n const paramsRes = {...params, itemId: '', itemTitle: ''};\n if (item) {\n if (idProperty && item[idProperty]) {\n paramsRes.itemId = item[idProperty];\n }\n if (typeof titleProperty === 'function') {\n paramsRes.itemTitle = titleProperty(item);\n } else if (titleProperty && item[titleProperty]) {\n paramsRes.itemTitle = item[titleProperty];\n }\n }\n return paramsRes;\n}\n\nfunction getKeysByPriority(model: ModelDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {\n const keys = [];\n if (customKey) {\n keys.push(customKey);\n } else {\n const modelActionKey = getI18nTypeKeyBasePath(model.i18nBaseKey, keyPath);\n keys.push(modelActionKey);\n if (keyPath !== modelActionKey) {\n keys.push(keyPath);\n }\n if (fallbackKey) {\n keys.push(fallbackKey);\n }\n }\n return keys;\n}\n","// data providers\nexport * from './data-providers/base-from-type-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/enum.descriptor';\nexport * from './descriptors/model.descriptor';\nexport * from './descriptors/type.descriptor';\n\n// helpers\nexport * from './helpers/i18n';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAKA;;;;;;;AAOG;AACG,SAAU,YAAY,CAA+G,IAG1I,EAAA;AACG,IAAA,OAAO,IAAI,gBAAgB,CAA+B,IAAI,EAAE,OAAuB,CAAC;AAC5F;;MChBa,cAAc,CAAA;IAMvB,WAAmB,CAAA,KAAW,EAAE,IAAc,EAAE,WAA2B,EAAE,WAAW,GAAG,KAAK,EAAA;AAC5F,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,YAAY,GAAG,WAAW;AAE/B,QAAA,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;AACpC,YAAA,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC;;AAE3C,QAAA,IAAI,CAAC,YAAY,GAAG,WAAW;;AAGnC,IAAA,IAAW,IAAI,GAAA;QACX,OAAO,IAAI,CAAC,KAAK;;AAGrB,IAAA,IAAW,WAAW,GAAA;QAClB,OAAO,IAAI,CAAC,YAAY;;AAG5B,IAAA,IAAW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