@zeedhi/teknisa-components-common 1.45.0 → 1.48.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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('@zeedhi/common'), require('lodash.get'), require('lodash.debounce'), require('lodash.merge')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', '@zeedhi/common', 'lodash.get', 'lodash.debounce', 'lodash.merge'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/teknisa-components-common"] = {}, global["@zeedhi/core"], global.common, global.lodash.get, global.lodash.debounce, global.lodash.merge));
5
- })(this, (function (exports, core, common, get, debounce, merge) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('@zeedhi/common'), require('lodash.get'), require('lodash.debounce'), require('lodash.merge'), require('@zeedhi/zd-user-info-common')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', '@zeedhi/common', 'lodash.get', 'lodash.debounce', 'lodash.merge', '@zeedhi/zd-user-info-common'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/teknisa-components-common"] = {}, global["@zeedhi/core"], global.common, global.lodash.get, global.lodash.debounce, global.lodash.merge, global["@zeedhi/zd-user-info-common"]));
5
+ })(this, (function (exports, core, common, get, debounce, merge, zdUserInfoCommon) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -1140,9 +1140,11 @@
1140
1140
  columnComponentName = `${this.grid.name}-filter-AND-CONTAINS-${column.name}-${index}`;
1141
1141
  }
1142
1142
  this.filterFormInputs[column.name].push(columnComponentName);
1143
- let newColumnComponent = Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: columnComponentName });
1143
+ const newColumnComponent = Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: columnComponentName });
1144
1144
  if (filterItem.helperOptions) {
1145
- newColumnComponent = this.getHelperValueComponent(newColumnComponent, filterItem.helperOptions, column);
1145
+ if (!newColumnComponent.events)
1146
+ newColumnComponent.events = {};
1147
+ newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
1146
1148
  }
1147
1149
  filterColumns.push(newColumnComponent);
1148
1150
  });
@@ -1150,54 +1152,9 @@
1150
1152
  });
1151
1153
  return filterColumns;
1152
1154
  }
1153
- getHelperValueComponent(component, helperValues, column) {
1154
- return {
1155
- name: `${component.name}_helperspan`,
1156
- component: 'ZdTag',
1157
- tag: 'span',
1158
- cssClass: 'zd-display-flex',
1159
- grid: component.grid,
1160
- children: [
1161
- Object.assign(Object.assign({}, component), { persistentHint: true, events: {
1162
- onMounted: this.registerFilterComponentToForm.bind(this),
1163
- change: this.clearFilterHelperValue.bind(this, column),
1164
- } }),
1165
- {
1166
- name: `${component.name}_helperdropdown`,
1167
- component: 'ZdDropdown',
1168
- offsetY: true,
1169
- activator: {
1170
- name: `${component.name}_helperbutton`,
1171
- component: 'ZdButton',
1172
- iconName: 'magnify',
1173
- icon: true,
1174
- small: true,
1175
- cssClass: `filter-helper-values-button ${component.showLabel !== false ? 'with-label' : ''}`,
1176
- },
1177
- children: this.createHelperValueOptions(component, helperValues, column),
1178
- },
1179
- ],
1180
- };
1181
- }
1182
- createHelperValueOptions(component, helperValues, column) {
1183
- return helperValues.map((value) => ({
1184
- name: `${component.name}_helpervalue_${value}`,
1185
- component: 'ZdText',
1186
- cssClass: 'filter-helper-values-option',
1187
- text: TekFilterHelper.getLabel(value),
1188
- events: {
1189
- click: this.helperValuesOptionClick.bind(this, component, value, column),
1190
- },
1191
- }));
1192
- }
1193
- helperValuesOptionClick(component, helperValue, column) {
1194
- const value = TekFilterHelper.getValue(helperValue, column);
1195
- const componentObject = core.Metadata.getInstance(component.name);
1196
- componentObject.value = value;
1197
- componentObject.hint = TekFilterHelper.getLabel(helperValue);
1198
- this.setFilterPropsHelperValue(column, component.name, helperValue);
1199
- }
1200
- setFilterPropsHelperValue(column, componentName, helperValue) {
1155
+ changeHelperEvent(column, { component }) {
1156
+ const { helperValue } = component;
1157
+ const componentName = component.name;
1201
1158
  if (!Array.isArray(column.filterProps)) {
1202
1159
  column.filterProps.helperValue = helperValue;
1203
1160
  }
@@ -1211,14 +1168,6 @@
1211
1168
  });
1212
1169
  }
1213
1170
  }
1214
- registerFilterComponentToForm({ component }) {
1215
- const form = core.Metadata.getInstance(`${this.grid.name}-filter-form`);
1216
- form.registerInput(component);
1217
- }
1218
- clearFilterHelperValue(column, { component }) {
1219
- this.setFilterPropsHelperValue(column, component.name, '');
1220
- component.hint = '';
1221
- }
1222
1171
  loadFilterValues({ component }) {
1223
1172
  const { datasource } = this.grid;
1224
1173
  if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
@@ -1693,6 +1642,8 @@
1693
1642
  }
1694
1643
  this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
1695
1644
  this.createAccessors();
1645
+ this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
1646
+ this.createObjAccessors(this.searchJoin, 'searchJoin');
1696
1647
  if (!this.lazyLoad) {
1697
1648
  this.get();
1698
1649
  }
@@ -1872,6 +1823,8 @@
1872
1823
  this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1873
1824
  }
1874
1825
  this.createAccessors();
1826
+ this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
1827
+ this.createObjAccessors(this.searchJoin, 'searchJoin');
1875
1828
  this.get();
1876
1829
  }
1877
1830
  updateReservedKeys() {
@@ -2018,61 +1971,70 @@
2018
1971
  }
2019
1972
  getRowByDynamicFilter(row) {
2020
1973
  let filtered;
2021
- Object.keys(this.dynamicFilter).forEach((key) => {
2022
- const filterItems = this.dynamicFilter[key];
2023
- filterItems.forEach((item) => {
2024
- if (filtered === false && item.relation === 'AND')
2025
- return;
2026
- if (filtered === true && item.relation === 'OR')
2027
- return;
2028
- const columnValue = core.Utils.normalize(row[key].toString());
2029
- let value = '';
2030
- if (Array.isArray(item.value)) {
2031
- value = item.value.map((val) => core.Utils.normalize(val.toString()));
2032
- switch (item.operation) {
2033
- case 'IN':
2034
- filtered = value.includes(columnValue);
2035
- break;
2036
- case 'NOT_IN':
2037
- filtered = !value.includes(columnValue);
2038
- break;
2039
- case 'BETWEEN':
2040
- filtered = (Number(columnValue) || columnValue) >= (Number(value[0]) || value[0])
2041
- && (Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
2042
- break;
1974
+ try {
1975
+ Object.keys(this.dynamicFilter).forEach((key) => {
1976
+ const filterItems = this.dynamicFilter[key];
1977
+ filterItems.forEach((item) => {
1978
+ if (filtered === false && item.relation === 'AND')
1979
+ return;
1980
+ if (filtered === true && item.relation === 'OR')
1981
+ return;
1982
+ const columnValue = core.Utils.normalize(row[key].toString());
1983
+ let value = '';
1984
+ if (Array.isArray(item.value)) {
1985
+ value = item.value.map((val) => core.Utils.normalize(val.toString()));
1986
+ switch (item.operation) {
1987
+ case 'IN':
1988
+ filtered = value.includes(columnValue);
1989
+ break;
1990
+ case 'NOT_IN':
1991
+ filtered = !value.includes(columnValue);
1992
+ break;
1993
+ case 'BETWEEN':
1994
+ filtered = (Number(columnValue) || columnValue) >= (Number(value[0]) || value[0])
1995
+ && (Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
1996
+ break;
1997
+ default:
1998
+ break;
1999
+ }
2043
2000
  }
2044
- }
2045
- else {
2046
- value = core.Utils.normalize(item.value.toString());
2047
- switch (item.operation) {
2048
- case 'CONTAINS':
2049
- filtered = columnValue.indexOf(value) !== -1;
2050
- break;
2051
- case 'NOT_CONTAINS':
2052
- filtered = columnValue.indexOf(value) === -1;
2053
- break;
2054
- case 'EQUALS':
2055
- filtered = columnValue === value;
2056
- break;
2057
- case 'NOT_EQUALS':
2058
- filtered = columnValue !== value;
2059
- break;
2060
- case 'GREATER_THAN':
2061
- filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
2062
- break;
2063
- case 'LESS_THAN':
2064
- filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
2065
- break;
2066
- case 'GREATER_THAN_EQUALS':
2067
- filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
2068
- break;
2069
- case 'LESS_THAN_EQUALS':
2070
- filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
2071
- break;
2001
+ else {
2002
+ value = core.Utils.normalize(item.value.toString());
2003
+ switch (item.operation) {
2004
+ case 'CONTAINS':
2005
+ filtered = columnValue.indexOf(value) !== -1;
2006
+ break;
2007
+ case 'NOT_CONTAINS':
2008
+ filtered = columnValue.indexOf(value) === -1;
2009
+ break;
2010
+ case 'EQUALS':
2011
+ filtered = columnValue === value;
2012
+ break;
2013
+ case 'NOT_EQUALS':
2014
+ filtered = columnValue !== value;
2015
+ break;
2016
+ case 'GREATER_THAN':
2017
+ filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
2018
+ break;
2019
+ case 'LESS_THAN':
2020
+ filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
2021
+ break;
2022
+ case 'GREATER_THAN_EQUALS':
2023
+ filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
2024
+ break;
2025
+ case 'LESS_THAN_EQUALS':
2026
+ filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
2027
+ break;
2028
+ default:
2029
+ break;
2030
+ }
2072
2031
  }
2073
- }
2032
+ });
2074
2033
  });
2075
- });
2034
+ }
2035
+ catch (_a) {
2036
+ // do nothing
2037
+ }
2076
2038
  return filtered;
2077
2039
  }
2078
2040
  getRowBySearchJoin(row) {
@@ -3037,88 +2999,19 @@
3037
2999
  }
3038
3000
 
3039
3001
  class TekFilterHelper {
3040
- static formatDate(date, column) {
3041
- if (column.componentProps.dateFormat) {
3042
- return core.dayjs(date).format(column.componentProps.dateFormat);
3043
- }
3044
- return core.dayjs(date).format(core.Config.dateFormat);
3045
- }
3046
3002
  static getLabel(name) {
3047
- return core.I18n.translate(this.values[name].label);
3003
+ return core.DateHelper.getLabel(name);
3048
3004
  }
3049
3005
  static getValue(name, column) {
3050
- if (!this.values[name])
3051
- return '';
3052
- const value = this.values[name].fn();
3053
- if (Array.isArray(value)) {
3054
- return value.map((item) => this.formatDate(item, column));
3055
- }
3056
- return this.formatDate(value, column);
3006
+ return core.DateHelper.getValue(name, column.componentProps.dateFormat);
3057
3007
  }
3058
3008
  static register(name, label, fn) {
3059
- this.values[name] = {
3060
- label,
3061
- fn,
3062
- };
3009
+ core.DateHelper.register(name, label, fn);
3063
3010
  }
3064
3011
  static unregister(name) {
3065
- delete this.values[name];
3012
+ core.DateHelper.unregister(name);
3066
3013
  }
3067
- }
3068
- TekFilterHelper.values = {
3069
- TODAY: {
3070
- label: 'TEKGRID_HELPERVALUE_TODAY',
3071
- fn: () => core.dayjs().toDate(),
3072
- },
3073
- TOMORROW: {
3074
- label: 'TEKGRID_HELPERVALUE_TOMORROW',
3075
- fn: () => core.dayjs().add(1, 'day').toDate(),
3076
- },
3077
- YESTERDAY: {
3078
- label: 'TEKGRID_HELPERVALUE_YESTERDAY',
3079
- fn: () => core.dayjs().subtract(1, 'day').toDate(),
3080
- },
3081
- LAST_7_DAYS: {
3082
- label: 'TEKGRID_HELPERVALUE_LAST_7_DAYS',
3083
- fn: () => {
3084
- const end = core.dayjs().toDate();
3085
- const start = core.dayjs().subtract(7, 'day').toDate();
3086
- return [start, end];
3087
- },
3088
- },
3089
- NEXT_7_DAYS: {
3090
- label: 'TEKGRID_HELPERVALUE_NEXT_7_DAYS',
3091
- fn: () => {
3092
- const start = core.dayjs().toDate();
3093
- const end = core.dayjs().add(7, 'day').toDate();
3094
- return [start, end];
3095
- },
3096
- },
3097
- CURRENT_WEEK: {
3098
- label: 'TEKGRID_HELPERVALUE_CURRENT_WEEK',
3099
- fn: () => {
3100
- const start = core.dayjs().startOf('week').toDate();
3101
- const end = core.dayjs().endOf('week').toDate();
3102
- return [start, end];
3103
- },
3104
- },
3105
- CURRENT_MONTH: {
3106
- label: 'TEKGRID_HELPERVALUE_CURRENT_MONTH',
3107
- fn: () => {
3108
- const start = core.dayjs().startOf('month').toDate();
3109
- const end = core.dayjs().endOf('month').toDate();
3110
- return [start, end];
3111
- },
3112
- },
3113
- CURRENT_YEAR: {
3114
- label: 'TEKGRID_HELPERVALUE_CURRENT_YEAR',
3115
- fn: () => {
3116
- const start = core.dayjs().startOf('year').toDate();
3117
- const end = core.dayjs().endOf('year').toDate();
3118
- return [start, end];
3119
- },
3120
- },
3121
- };
3014
+ }
3122
3015
 
3123
3016
  /* TekTreeGrid Class */
3124
3017
  class TekTreeGrid extends common.TreeGridEditable {
@@ -3284,6 +3177,422 @@
3284
3177
  }
3285
3178
  }
3286
3179
 
3180
+ class TekUserInfoController {
3181
+ constructor(component) {
3182
+ this.component = component;
3183
+ }
3184
+ get versionInfo() {
3185
+ return this.component.versionInfo;
3186
+ }
3187
+ get name() {
3188
+ var _a;
3189
+ return ((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.name) || '';
3190
+ }
3191
+ set name(value) {
3192
+ if (!this.versionInfo)
3193
+ return;
3194
+ this.versionInfo.name = value;
3195
+ }
3196
+ get version() {
3197
+ var _a;
3198
+ return ((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.version) || '';
3199
+ }
3200
+ set version(value) {
3201
+ if (!this.versionInfo)
3202
+ return;
3203
+ this.versionInfo.version = value;
3204
+ }
3205
+ get defaultEmail() {
3206
+ return this.component.defaultEmail;
3207
+ }
3208
+ set defaultEmail(value) {
3209
+ this.component.defaultEmail = value;
3210
+ }
3211
+ get hasDefaultEmail() {
3212
+ return !!this.component.defaultEmail;
3213
+ }
3214
+ get hasAboutImage() {
3215
+ return !!this.component.aboutImage;
3216
+ }
3217
+ mergeText(name, version) {
3218
+ return `${name} - <b>${version}</b>`;
3219
+ }
3220
+ get mainVersion() {
3221
+ var _a;
3222
+ if (!((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.name) || !this.versionInfo.version)
3223
+ return '';
3224
+ return this.mergeText(this.versionInfo.name, this.versionInfo.version);
3225
+ }
3226
+ getItems(tab) {
3227
+ if (!this.versionInfo)
3228
+ return [];
3229
+ const tabInfo = this.versionInfo[tab];
3230
+ return tabInfo.map((item) => this.mergeText(item.name, item.version));
3231
+ }
3232
+ get frontendItems() {
3233
+ return this.getItems('frontend');
3234
+ }
3235
+ get backendItems() {
3236
+ return this.getItems('backend');
3237
+ }
3238
+ get modulesItems() {
3239
+ return this.getItems('modules');
3240
+ }
3241
+ }
3242
+
3243
+ class TekUserInfo extends zdUserInfoCommon.UserInfo {
3244
+ constructor(props) {
3245
+ super(props);
3246
+ /**
3247
+ * Data about the application version
3248
+ */
3249
+ this.versionInfo = null;
3250
+ /**
3251
+ * Default email address to be defined in the Report Bug form
3252
+ */
3253
+ this.defaultEmail = '';
3254
+ /**
3255
+ * Url from which the version info will be retrieved
3256
+ */
3257
+ this.versionUrl = '';
3258
+ /**
3259
+ * Path to the image to be shown on about modal
3260
+ */
3261
+ this.aboutImage = '';
3262
+ this.versionInfo = this.getInitValue('versionInfo', props.versionInfo, this.versionInfo);
3263
+ this.defaultEmail = this.getInitValue('defaultEmail', props.defaultEmail, this.defaultEmail);
3264
+ this.versionUrl = this.getInitValue('versionUrl', props.versionUrl, this.versionUrl);
3265
+ this.aboutImage = this.getInitValue('aboutImage', props.aboutImage, this.aboutImage);
3266
+ this.createAccessors();
3267
+ this.propBottomSlot = props.bottomSlot;
3268
+ }
3269
+ getBottomSlot() {
3270
+ return [
3271
+ {
3272
+ name: `${this.name}_bottom_list`,
3273
+ component: 'TekUserInfoList',
3274
+ parentName: this.name,
3275
+ },
3276
+ ];
3277
+ }
3278
+ onAboutClick() {
3279
+ if (!this.aboutModal) {
3280
+ this.aboutModal = common.ModalService.create({
3281
+ name: `${this.name}_about_modal`,
3282
+ cssClass: 'about-modal',
3283
+ children: [
3284
+ {
3285
+ name: `${this.name}_about_header`,
3286
+ component: 'ZdHeader',
3287
+ color: 'transparent',
3288
+ padless: true,
3289
+ elevation: 0,
3290
+ rightSlot: [
3291
+ {
3292
+ name: `${this.name}_about_close_button`,
3293
+ component: 'ZdModalCloseButton',
3294
+ small: true,
3295
+ modalName: `${this.name}_about_modal`,
3296
+ },
3297
+ ],
3298
+ },
3299
+ {
3300
+ name: `${this.name}_about_row`,
3301
+ component: 'ZdTag',
3302
+ tag: 'div',
3303
+ cssClass: 'zd-justify-center zd-px-6',
3304
+ isVisible: `{{TekUserInfoController_${this.componentId}.hasAboutImage}}`,
3305
+ children: [
3306
+ {
3307
+ name: `${this.name}_about_image`,
3308
+ component: 'ZdImage',
3309
+ width: '100%',
3310
+ src: this.aboutImage,
3311
+ },
3312
+ ],
3313
+ },
3314
+ {
3315
+ name: `${this.name}_version_tabs`,
3316
+ cssClass: 'zd-pt-3',
3317
+ component: 'ZdTabs',
3318
+ tabs: [
3319
+ {
3320
+ name: `${this.name}_version_frontend_tab`,
3321
+ tabTitle: 'Frontend',
3322
+ children: this.getVersionTree('frontend'),
3323
+ },
3324
+ {
3325
+ name: `${this.name}_version_backend_tab`,
3326
+ tabTitle: 'Backend',
3327
+ children: this.getVersionTree('backend'),
3328
+ },
3329
+ {
3330
+ name: `${this.name}_version_modules_tab`,
3331
+ tabTitle: 'Modules',
3332
+ children: this.getVersionTree('modules'),
3333
+ },
3334
+ ],
3335
+ },
3336
+ ],
3337
+ });
3338
+ }
3339
+ this.aboutModal.show();
3340
+ }
3341
+ getVersionTree(tab) {
3342
+ if (!this.versionInfo)
3343
+ return [];
3344
+ const main = {
3345
+ name: `${this.name}_version_${tab}_main`,
3346
+ component: 'ZdText',
3347
+ text: `{{TekUserInfoController_${this.componentId}.mainVersion}}`,
3348
+ };
3349
+ const itemsComponent = {
3350
+ name: `${this.name}_version_${tab}`,
3351
+ component: 'ZdText',
3352
+ cssClass: 'zd-pl-4',
3353
+ text: `{{TekUserInfoController_${this.componentId}.${tab}Items}}`,
3354
+ };
3355
+ return [main, itemsComponent];
3356
+ }
3357
+ onReportClick() {
3358
+ if (!this.reportModal) {
3359
+ this.reportModal = common.ModalService.create({
3360
+ name: `${this.name}_report_modal`,
3361
+ children: [
3362
+ {
3363
+ name: `${this.name}_report_header`,
3364
+ component: 'ZdHeader',
3365
+ color: 'transparent',
3366
+ padless: true,
3367
+ elevation: 0,
3368
+ leftSlot: [
3369
+ {
3370
+ name: `${this.name}_report_title`,
3371
+ component: 'ZdText',
3372
+ text: 'TEKUSERINFO_REPORT_ERROR',
3373
+ cssClass: 'zd-theme-font-title',
3374
+ },
3375
+ ],
3376
+ rightSlot: [
3377
+ {
3378
+ name: `${this.name}_report_close_button`,
3379
+ component: 'ZdModalCloseButton',
3380
+ small: true,
3381
+ modalName: `${this.name}_report_modal`,
3382
+ },
3383
+ ],
3384
+ },
3385
+ {
3386
+ name: `${this.name}_report_form`,
3387
+ component: 'ZdForm',
3388
+ cssClass: 'zd-pt-4',
3389
+ children: [
3390
+ {
3391
+ name: 'report_email',
3392
+ component: 'ZdTextInput',
3393
+ label: 'E-mail',
3394
+ grid: {
3395
+ cols: '12',
3396
+ },
3397
+ value: `{{TekUserInfoController_${this.componentId}.defaultEmail}}`,
3398
+ readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
3399
+ validations: {
3400
+ required: {},
3401
+ email: {},
3402
+ },
3403
+ },
3404
+ {
3405
+ name: 'report_cc',
3406
+ component: 'ZdTextInput',
3407
+ label: 'CC',
3408
+ placeholder: 'TEKUSERINFO_EMAIL_PLACEHOLDER',
3409
+ grid: {
3410
+ cols: '12',
3411
+ },
3412
+ },
3413
+ {
3414
+ name: 'report_type',
3415
+ component: 'ZdSelect',
3416
+ label: 'TEKUSERINFO_TYPE',
3417
+ dataValue: 'value',
3418
+ dataText: 'text',
3419
+ datasource: {
3420
+ uniqueKey: 'value',
3421
+ translate: true,
3422
+ data: [
3423
+ { value: '0', text: 'TEKUSERINFO_ERROR' },
3424
+ { value: '1', text: 'TEKUSERINFO_IMPROVEMENT' },
3425
+ ],
3426
+ },
3427
+ grid: {
3428
+ cols: '12',
3429
+ },
3430
+ validations: {
3431
+ required: {},
3432
+ },
3433
+ },
3434
+ {
3435
+ name: 'report_description',
3436
+ component: 'ZdTextarea',
3437
+ label: 'TEKUSERINFO_DESCRIPTION',
3438
+ grid: {
3439
+ cols: '12',
3440
+ },
3441
+ validations: {
3442
+ required: {},
3443
+ },
3444
+ },
3445
+ ],
3446
+ },
3447
+ {
3448
+ name: `${this.name}_report_footer`,
3449
+ component: 'ZdFooter',
3450
+ color: 'transparent',
3451
+ padless: true,
3452
+ rightSlot: [
3453
+ {
3454
+ name: `${this.name}_report_cancel`,
3455
+ component: 'ZdButton',
3456
+ label: 'TEKUSERINFO_CANCEL',
3457
+ outline: true,
3458
+ events: {
3459
+ click: () => { var _a; (_a = this.reportModal) === null || _a === void 0 ? void 0 : _a.hide(); },
3460
+ },
3461
+ },
3462
+ {
3463
+ name: `${this.name}_report_send`,
3464
+ component: 'ZdButton',
3465
+ label: 'TEKUSERINFO_SEND',
3466
+ events: {
3467
+ click: (args) => this.onSendReport(args),
3468
+ },
3469
+ },
3470
+ ],
3471
+ },
3472
+ ],
3473
+ });
3474
+ }
3475
+ this.reportModal.show();
3476
+ }
3477
+ onSendReport({ event, element }) {
3478
+ if (!this.reportModal)
3479
+ return;
3480
+ const form = core.Metadata.getInstance(`${this.name}_report_form`);
3481
+ if (!form.validate())
3482
+ return;
3483
+ this.callEvent('onSendReport', {
3484
+ event, element, component: this, form,
3485
+ });
3486
+ this.reportModal.hide();
3487
+ }
3488
+ onCreated() {
3489
+ super.onCreated();
3490
+ core.Loader.addController(`TekUserInfoController_${this.componentId}`, new TekUserInfoController(this));
3491
+ this.bottomSlot = this.propBottomSlot ? this.propBottomSlot : this.getBottomSlot();
3492
+ }
3493
+ onMounted(element) {
3494
+ const _super = Object.create(null, {
3495
+ onMounted: { get: () => super.onMounted }
3496
+ });
3497
+ return __awaiter(this, void 0, void 0, function* () {
3498
+ _super.onMounted.call(this, element);
3499
+ if (this.versionUrl) {
3500
+ const res = yield core.Http.get(this.versionUrl);
3501
+ this.versionInfo = res.data.versionInfo;
3502
+ }
3503
+ });
3504
+ }
3505
+ }
3506
+ core.Messages.add({
3507
+ 'pt-BR': {
3508
+ translation: {
3509
+ TEKUSERINFO_ABOUT: 'Sobre',
3510
+ TEKUSERINFO_REPORT_ERROR: 'Reportar Erro',
3511
+ TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separe e-mails usando ";"',
3512
+ TEKUSERINFO_TYPE: 'Tipo',
3513
+ TEKUSERINFO_ERROR: 'Erro',
3514
+ TEKUSERINFO_IMPROVEMENT: 'Melhoria',
3515
+ TEKUSERINFO_DESCRIPTION: 'Descrição',
3516
+ TEKUSERINFO_CANCEL: 'Cancelar',
3517
+ TEKUSERINFO_SEND: 'Enviar',
3518
+ },
3519
+ },
3520
+ 'en-US': {
3521
+ translation: {
3522
+ TEKUSERINFO_ABOUT: 'About',
3523
+ TEKUSERINFO_REPORT_ERROR: 'Report Bug',
3524
+ TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separate e-mails using ";"',
3525
+ TEKUSERINFO_TYPE: 'Type',
3526
+ TEKUSERINFO_ERROR: 'Bug',
3527
+ TEKUSERINFO_IMPROVEMENT: 'Improvement',
3528
+ TEKUSERINFO_DESCRIPTION: 'Description',
3529
+ TEKUSERINFO_CANCEL: 'Cancel',
3530
+ TEKUSERINFO_SEND: 'Send',
3531
+ },
3532
+ },
3533
+ 'es-ES': {
3534
+ translation: {
3535
+ TEKUSERINFO_ABOUT: 'Sobre',
3536
+ TEKUSERINFO_REPORT_ERROR: 'Reportar Error',
3537
+ TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separar e-mails usando ";"',
3538
+ TEKUSERINFO_TYPE: 'Tipo',
3539
+ TEKUSERINFO_ERROR: 'Error',
3540
+ TEKUSERINFO_IMPROVEMENT: 'Mejora',
3541
+ TEKUSERINFO_DESCRIPTION: 'Descripción',
3542
+ TEKUSERINFO_CANCEL: 'Cancelar',
3543
+ TEKUSERINFO_SEND: 'Enviar',
3544
+ },
3545
+ },
3546
+ });
3547
+
3548
+ class TekUserInfoList extends common.List {
3549
+ constructor(props) {
3550
+ super(props);
3551
+ /**
3552
+ * Name of the user info component
3553
+ */
3554
+ this.parentName = '';
3555
+ this.dense = true;
3556
+ this.parentName = props.parentName || '';
3557
+ this.items = this.getItems();
3558
+ }
3559
+ getItems() {
3560
+ const parent = this.parentName ? core.Metadata.getInstance(this.parentName) : this.parent;
3561
+ if (!(parent instanceof TekUserInfo)) {
3562
+ throw Error(`Could not find the TekUserInfo component associated with ${this.name} TekUserInfoList`);
3563
+ }
3564
+ return [
3565
+ {
3566
+ name: `${parent.name}_version`,
3567
+ component: 'ZdListItem',
3568
+ title: `{{TekUserInfoController_${parent.componentId}.name}}`,
3569
+ subtitle: `{{TekUserInfoController_${parent.componentId}.version}}`,
3570
+ cssClass: 'zd-px-2',
3571
+ },
3572
+ {
3573
+ name: `${parent.name}_about`,
3574
+ component: 'ZdListItem',
3575
+ title: 'TEKUSERINFO_ABOUT',
3576
+ prependIcon: 'infoOutline',
3577
+ cssClass: 'zd-px-2',
3578
+ events: {
3579
+ click: () => parent.onAboutClick(),
3580
+ },
3581
+ },
3582
+ {
3583
+ name: `${parent.name}_report`,
3584
+ component: 'ZdListItem',
3585
+ title: 'TEKUSERINFO_REPORT_ERROR',
3586
+ prependIcon: 'mdi-ladybug',
3587
+ cssClass: 'zd-px-2',
3588
+ events: {
3589
+ click: () => parent.onReportClick(),
3590
+ },
3591
+ },
3592
+ ];
3593
+ }
3594
+ }
3595
+
3287
3596
  core.Messages.add({
3288
3597
  'pt-BR': {
3289
3598
  translation: {
@@ -3356,6 +3665,8 @@
3356
3665
  exports.TekMemoryDatasource = TekMemoryDatasource;
3357
3666
  exports.TekRestDatasource = TekRestDatasource;
3358
3667
  exports.TekTreeGrid = TekTreeGrid;
3668
+ exports.TekUserInfo = TekUserInfo;
3669
+ exports.TekUserInfoList = TekUserInfoList;
3359
3670
  exports.columnAggregationValues = columnAggregationValues;
3360
3671
 
3361
3672
  Object.defineProperty(exports, '__esModule', { value: true });