@zeedhi/common 1.58.0 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zd-common.esm.js +168 -31
- package/dist/zd-common.umd.js +171 -33
- package/package.json +4 -2
- package/types/components/index.d.ts +2 -0
- package/types/components/zd-dashboard/dashboard.d.ts +2 -2
- package/types/components/zd-dashboard/interfaces.d.ts +2 -2
- package/types/components/zd-form/form.d.ts +4 -0
- package/types/components/zd-iterable-component-render/interfaces.d.ts +14 -0
- package/types/components/zd-iterable-component-render/iterable-component-render.d.ts +60 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Mask, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Config, dayjs, DateHelper, Utils, Router, InstanceNotFoundError,
|
|
1
|
+
import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Mask, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Config, dayjs, DateHelper, Utils, Router, InstanceNotFoundError, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
4
|
import isUndefined from 'lodash.isundefined';
|
|
5
5
|
import set from 'lodash.set';
|
|
6
|
+
import get from 'lodash.get';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Child not found error
|
|
@@ -1474,6 +1475,14 @@ class Form extends ComponentRender {
|
|
|
1474
1475
|
}
|
|
1475
1476
|
});
|
|
1476
1477
|
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Clear all form inputs
|
|
1480
|
+
*/
|
|
1481
|
+
clearForm() {
|
|
1482
|
+
Object.keys(this.value).forEach((item) => {
|
|
1483
|
+
this.value[item] = null;
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1477
1486
|
/**
|
|
1478
1487
|
* Saves input instance and defines property on form value.
|
|
1479
1488
|
* @param component Children component
|
|
@@ -3097,34 +3106,38 @@ class Dashboard extends ComponentRender {
|
|
|
3097
3106
|
};
|
|
3098
3107
|
/* ----- end modal functions ----- */
|
|
3099
3108
|
/* Edit header */
|
|
3100
|
-
this.
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3109
|
+
this.editHeader = {
|
|
3110
|
+
component: 'ZdHeader',
|
|
3111
|
+
name: `edit-header-${this.name}`,
|
|
3112
|
+
leftSlot: [
|
|
3113
|
+
{
|
|
3114
|
+
name: `addDashboard${this.name}`,
|
|
3115
|
+
component: 'ZdButton',
|
|
3116
|
+
label: 'ADD',
|
|
3117
|
+
iconName: 'plus',
|
|
3118
|
+
color: 'white',
|
|
3119
|
+
small: true,
|
|
3120
|
+
cssClass: 'zd-my-2',
|
|
3121
|
+
outline: true,
|
|
3122
|
+
events: {
|
|
3123
|
+
click: this.openModalAddCard.bind(this),
|
|
3124
|
+
},
|
|
3112
3125
|
},
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3126
|
+
{
|
|
3127
|
+
name: `saveDashboard${this.name}`,
|
|
3128
|
+
component: 'ZdButton',
|
|
3129
|
+
label: 'SAVE',
|
|
3130
|
+
iconName: 'complete',
|
|
3131
|
+
color: 'white',
|
|
3132
|
+
small: true,
|
|
3133
|
+
cssClass: 'zd-my-2',
|
|
3134
|
+
outline: true,
|
|
3135
|
+
events: {
|
|
3136
|
+
click: this.onSave.bind(this),
|
|
3137
|
+
},
|
|
3125
3138
|
},
|
|
3126
|
-
|
|
3127
|
-
|
|
3139
|
+
],
|
|
3140
|
+
};
|
|
3128
3141
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
3129
3142
|
this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
|
|
3130
3143
|
this.cards = this.getInitValue('cards', props.cards, this.cards);
|
|
@@ -3133,6 +3146,7 @@ class Dashboard extends ComponentRender {
|
|
|
3133
3146
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
3134
3147
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3135
3148
|
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3149
|
+
this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
|
|
3136
3150
|
this.createAccessors();
|
|
3137
3151
|
}
|
|
3138
3152
|
onMounted(element) {
|
|
@@ -3311,7 +3325,7 @@ class Dashboard extends ComponentRender {
|
|
|
3311
3325
|
}
|
|
3312
3326
|
/* Generate unique ids */
|
|
3313
3327
|
getCardId() {
|
|
3314
|
-
return Math.random().toString(36).
|
|
3328
|
+
return Math.random().toString(36).substring(2, 9);
|
|
3315
3329
|
}
|
|
3316
3330
|
selectCard(cardId) {
|
|
3317
3331
|
this.currentCardId = cardId;
|
|
@@ -5109,7 +5123,7 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
|
|
|
5109
5123
|
return value;
|
|
5110
5124
|
});
|
|
5111
5125
|
FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
|
|
5112
|
-
if (!value || value.length === 0)
|
|
5126
|
+
if (!value || !Array.isArray(value) || value.length === 0)
|
|
5113
5127
|
return '';
|
|
5114
5128
|
const { formatterDataText } = componentProps;
|
|
5115
5129
|
const formatterFn = FormatterParserProvider.getFormatter('column_ZdSelect');
|
|
@@ -7167,6 +7181,119 @@ class Search extends TextInput {
|
|
|
7167
7181
|
}
|
|
7168
7182
|
}
|
|
7169
7183
|
|
|
7184
|
+
/**
|
|
7185
|
+
* Base class for IterableComponentRender component.
|
|
7186
|
+
* This component uses every row returned by Iterable.datasource to render
|
|
7187
|
+
* components defined by componentMetadata property.
|
|
7188
|
+
* If the data inside the datasource is changed you should perform
|
|
7189
|
+
* a datasource.get() to force updating the rendered components.
|
|
7190
|
+
*/
|
|
7191
|
+
class IterableComponentRender extends Iterable {
|
|
7192
|
+
constructor(props) {
|
|
7193
|
+
super(props);
|
|
7194
|
+
/**
|
|
7195
|
+
* Components that will be rendered on toolbar slot
|
|
7196
|
+
*/
|
|
7197
|
+
this.toolbarSlot = [];
|
|
7198
|
+
/**
|
|
7199
|
+
* Components that will be rendered on footer slot
|
|
7200
|
+
*/
|
|
7201
|
+
this.footerSlot = [];
|
|
7202
|
+
/**
|
|
7203
|
+
* Row property name
|
|
7204
|
+
*/
|
|
7205
|
+
this.rowPropName = 'row';
|
|
7206
|
+
/**
|
|
7207
|
+
* Components that will be rendered in no-data case
|
|
7208
|
+
*/
|
|
7209
|
+
this.noDataSlot = [
|
|
7210
|
+
{
|
|
7211
|
+
name: '<<NAME>>_no-data',
|
|
7212
|
+
component: 'ZdText',
|
|
7213
|
+
cssClass: 'no-data',
|
|
7214
|
+
text: 'NO_DATA',
|
|
7215
|
+
},
|
|
7216
|
+
];
|
|
7217
|
+
/**
|
|
7218
|
+
* Components that will be rendered in no-result case
|
|
7219
|
+
*/
|
|
7220
|
+
this.noResultSlot = [
|
|
7221
|
+
{
|
|
7222
|
+
name: '<<NAME>>_no-result',
|
|
7223
|
+
component: 'ZdText',
|
|
7224
|
+
cssClass: 'no-result',
|
|
7225
|
+
text: 'NO_RESULT',
|
|
7226
|
+
},
|
|
7227
|
+
];
|
|
7228
|
+
/**
|
|
7229
|
+
* Sets the height for the component.
|
|
7230
|
+
*/
|
|
7231
|
+
this.height = 'auto';
|
|
7232
|
+
/**
|
|
7233
|
+
* Sets the maximum height for the component.
|
|
7234
|
+
*/
|
|
7235
|
+
this.maxHeight = 'none';
|
|
7236
|
+
/**
|
|
7237
|
+
* Sets the minimum height for the component.
|
|
7238
|
+
*/
|
|
7239
|
+
this.minHeight = 'none';
|
|
7240
|
+
/**
|
|
7241
|
+
* Components that will be rendered in error case
|
|
7242
|
+
*/
|
|
7243
|
+
this.errorSlot = [];
|
|
7244
|
+
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
7245
|
+
this.footerSlot = props.footerSlot || this.footerSlot;
|
|
7246
|
+
this.componentMetadata = this.getInitValue('componentMetadata', props.componentMetadata, this.componentMetadata);
|
|
7247
|
+
this.rowPropName = this.getInitValue('rowPropName', props.rowPropName, this.rowPropName);
|
|
7248
|
+
this.noDataSlot = props.noDataSlot || this.noDataSlot;
|
|
7249
|
+
this.noResultSlot = props.noResultSlot || this.noResultSlot;
|
|
7250
|
+
this.errorSlot = props.errorSlot || this.errorSlot;
|
|
7251
|
+
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
7252
|
+
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
7253
|
+
this.height = this.getInitValue('height', props.height, this.height);
|
|
7254
|
+
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
7255
|
+
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
7256
|
+
this.createAccessors();
|
|
7257
|
+
}
|
|
7258
|
+
addSlashes(value) {
|
|
7259
|
+
if (typeof value === 'string') {
|
|
7260
|
+
return value.replace(/\\/g, '\\\\')
|
|
7261
|
+
.replace(/\t/g, '\\t')
|
|
7262
|
+
.replace(/\n/g, '\\n')
|
|
7263
|
+
.replace(/\f/g, '\\f')
|
|
7264
|
+
.replace(/\r/g, '\\r')
|
|
7265
|
+
.replace(/"/g, '\\"');
|
|
7266
|
+
}
|
|
7267
|
+
return value;
|
|
7268
|
+
}
|
|
7269
|
+
/**
|
|
7270
|
+
* Returns the iterable component metadata based on row data
|
|
7271
|
+
*/
|
|
7272
|
+
getComponentMetadata(row) {
|
|
7273
|
+
const exp = new RegExp(`<<${this.rowPropName}.(.[A-z]+?)>>|"<<${this.rowPropName}.(.[A-z]+?)>>"`, 'g');
|
|
7274
|
+
const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
|
|
7275
|
+
const metadata = JSON.stringify(this.componentMetadata)
|
|
7276
|
+
.replace(rowExp, JSON.stringify(row))
|
|
7277
|
+
.replace(exp, (match) => {
|
|
7278
|
+
const propPath = match.replace(/<<|>>|"/g, '').split('.').splice(1).join('.');
|
|
7279
|
+
const value = this.addSlashes(get(row, propPath));
|
|
7280
|
+
if (typeof value === 'string') {
|
|
7281
|
+
if (match.startsWith('"') && match.endsWith('"'))
|
|
7282
|
+
return `"${value}"`;
|
|
7283
|
+
return value;
|
|
7284
|
+
}
|
|
7285
|
+
return value;
|
|
7286
|
+
});
|
|
7287
|
+
return JSON.parse(metadata);
|
|
7288
|
+
}
|
|
7289
|
+
changeDefaultSlotNames(slot) {
|
|
7290
|
+
slot.forEach((item) => {
|
|
7291
|
+
item.name = item.name.replace('<<NAME>>', this.name);
|
|
7292
|
+
});
|
|
7293
|
+
return slot;
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7296
|
+
|
|
7170
7297
|
/**
|
|
7171
7298
|
* Item not found error
|
|
7172
7299
|
*/
|
|
@@ -8950,7 +9077,17 @@ class SelectMultiple extends Select {
|
|
|
8950
9077
|
}
|
|
8951
9078
|
unSelectAllItems() {
|
|
8952
9079
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8953
|
-
|
|
9080
|
+
if (!this.datasource.search) {
|
|
9081
|
+
this.removeInserts();
|
|
9082
|
+
this.insertSelected();
|
|
9083
|
+
yield this.setValue([]);
|
|
9084
|
+
}
|
|
9085
|
+
else {
|
|
9086
|
+
const newData = this.insertedValues;
|
|
9087
|
+
yield this.setValue(newData);
|
|
9088
|
+
this.removeInserts();
|
|
9089
|
+
this.insertSelected();
|
|
9090
|
+
}
|
|
8954
9091
|
});
|
|
8955
9092
|
}
|
|
8956
9093
|
checkValueOnBlur() { }
|
|
@@ -13050,4 +13187,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
|
13050
13187
|
const packageContent = require('../package.json');
|
|
13051
13188
|
VersionService.addPackageVersion(packageContent.name, packageContent.version);
|
|
13052
13189
|
|
|
13053
|
-
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
|
13190
|
+
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.debounce', 'lodash.isundefined', 'lodash.set'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.debounce, global.isUndefined, global.set));
|
|
5
|
-
})(this, (function (exports, core, merge, debounce, isUndefined, set) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set'), require('lodash.get')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.debounce', 'lodash.isundefined', 'lodash.set', 'lodash.get'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.debounce, global.isUndefined, global.set, global.get));
|
|
5
|
+
})(this, (function (exports, core, merge, debounce, isUndefined, set, get) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
11
11
|
var isUndefined__default = /*#__PURE__*/_interopDefaultLegacy(isUndefined);
|
|
12
12
|
var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
|
|
13
|
+
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Child not found error
|
|
@@ -1481,6 +1482,14 @@
|
|
|
1481
1482
|
}
|
|
1482
1483
|
});
|
|
1483
1484
|
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Clear all form inputs
|
|
1487
|
+
*/
|
|
1488
|
+
clearForm() {
|
|
1489
|
+
Object.keys(this.value).forEach((item) => {
|
|
1490
|
+
this.value[item] = null;
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1484
1493
|
/**
|
|
1485
1494
|
* Saves input instance and defines property on form value.
|
|
1486
1495
|
* @param component Children component
|
|
@@ -3104,34 +3113,38 @@
|
|
|
3104
3113
|
};
|
|
3105
3114
|
/* ----- end modal functions ----- */
|
|
3106
3115
|
/* Edit header */
|
|
3107
|
-
this.
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3116
|
+
this.editHeader = {
|
|
3117
|
+
component: 'ZdHeader',
|
|
3118
|
+
name: `edit-header-${this.name}`,
|
|
3119
|
+
leftSlot: [
|
|
3120
|
+
{
|
|
3121
|
+
name: `addDashboard${this.name}`,
|
|
3122
|
+
component: 'ZdButton',
|
|
3123
|
+
label: 'ADD',
|
|
3124
|
+
iconName: 'plus',
|
|
3125
|
+
color: 'white',
|
|
3126
|
+
small: true,
|
|
3127
|
+
cssClass: 'zd-my-2',
|
|
3128
|
+
outline: true,
|
|
3129
|
+
events: {
|
|
3130
|
+
click: this.openModalAddCard.bind(this),
|
|
3131
|
+
},
|
|
3119
3132
|
},
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3133
|
+
{
|
|
3134
|
+
name: `saveDashboard${this.name}`,
|
|
3135
|
+
component: 'ZdButton',
|
|
3136
|
+
label: 'SAVE',
|
|
3137
|
+
iconName: 'complete',
|
|
3138
|
+
color: 'white',
|
|
3139
|
+
small: true,
|
|
3140
|
+
cssClass: 'zd-my-2',
|
|
3141
|
+
outline: true,
|
|
3142
|
+
events: {
|
|
3143
|
+
click: this.onSave.bind(this),
|
|
3144
|
+
},
|
|
3132
3145
|
},
|
|
3133
|
-
|
|
3134
|
-
|
|
3146
|
+
],
|
|
3147
|
+
};
|
|
3135
3148
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
3136
3149
|
this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
|
|
3137
3150
|
this.cards = this.getInitValue('cards', props.cards, this.cards);
|
|
@@ -3140,6 +3153,7 @@
|
|
|
3140
3153
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
3141
3154
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3142
3155
|
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3156
|
+
this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
|
|
3143
3157
|
this.createAccessors();
|
|
3144
3158
|
}
|
|
3145
3159
|
onMounted(element) {
|
|
@@ -3318,7 +3332,7 @@
|
|
|
3318
3332
|
}
|
|
3319
3333
|
/* Generate unique ids */
|
|
3320
3334
|
getCardId() {
|
|
3321
|
-
return Math.random().toString(36).
|
|
3335
|
+
return Math.random().toString(36).substring(2, 9);
|
|
3322
3336
|
}
|
|
3323
3337
|
selectCard(cardId) {
|
|
3324
3338
|
this.currentCardId = cardId;
|
|
@@ -5116,7 +5130,7 @@
|
|
|
5116
5130
|
return value;
|
|
5117
5131
|
});
|
|
5118
5132
|
core.FormatterParserProvider.registerFormatter('column_ZdSelectMultiple', ({ column, value, row, componentProps, }) => {
|
|
5119
|
-
if (!value || value.length === 0)
|
|
5133
|
+
if (!value || !Array.isArray(value) || value.length === 0)
|
|
5120
5134
|
return '';
|
|
5121
5135
|
const { formatterDataText } = componentProps;
|
|
5122
5136
|
const formatterFn = core.FormatterParserProvider.getFormatter('column_ZdSelect');
|
|
@@ -7174,6 +7188,119 @@
|
|
|
7174
7188
|
}
|
|
7175
7189
|
}
|
|
7176
7190
|
|
|
7191
|
+
/**
|
|
7192
|
+
* Base class for IterableComponentRender component.
|
|
7193
|
+
* This component uses every row returned by Iterable.datasource to render
|
|
7194
|
+
* components defined by componentMetadata property.
|
|
7195
|
+
* If the data inside the datasource is changed you should perform
|
|
7196
|
+
* a datasource.get() to force updating the rendered components.
|
|
7197
|
+
*/
|
|
7198
|
+
class IterableComponentRender extends Iterable {
|
|
7199
|
+
constructor(props) {
|
|
7200
|
+
super(props);
|
|
7201
|
+
/**
|
|
7202
|
+
* Components that will be rendered on toolbar slot
|
|
7203
|
+
*/
|
|
7204
|
+
this.toolbarSlot = [];
|
|
7205
|
+
/**
|
|
7206
|
+
* Components that will be rendered on footer slot
|
|
7207
|
+
*/
|
|
7208
|
+
this.footerSlot = [];
|
|
7209
|
+
/**
|
|
7210
|
+
* Row property name
|
|
7211
|
+
*/
|
|
7212
|
+
this.rowPropName = 'row';
|
|
7213
|
+
/**
|
|
7214
|
+
* Components that will be rendered in no-data case
|
|
7215
|
+
*/
|
|
7216
|
+
this.noDataSlot = [
|
|
7217
|
+
{
|
|
7218
|
+
name: '<<NAME>>_no-data',
|
|
7219
|
+
component: 'ZdText',
|
|
7220
|
+
cssClass: 'no-data',
|
|
7221
|
+
text: 'NO_DATA',
|
|
7222
|
+
},
|
|
7223
|
+
];
|
|
7224
|
+
/**
|
|
7225
|
+
* Components that will be rendered in no-result case
|
|
7226
|
+
*/
|
|
7227
|
+
this.noResultSlot = [
|
|
7228
|
+
{
|
|
7229
|
+
name: '<<NAME>>_no-result',
|
|
7230
|
+
component: 'ZdText',
|
|
7231
|
+
cssClass: 'no-result',
|
|
7232
|
+
text: 'NO_RESULT',
|
|
7233
|
+
},
|
|
7234
|
+
];
|
|
7235
|
+
/**
|
|
7236
|
+
* Sets the height for the component.
|
|
7237
|
+
*/
|
|
7238
|
+
this.height = 'auto';
|
|
7239
|
+
/**
|
|
7240
|
+
* Sets the maximum height for the component.
|
|
7241
|
+
*/
|
|
7242
|
+
this.maxHeight = 'none';
|
|
7243
|
+
/**
|
|
7244
|
+
* Sets the minimum height for the component.
|
|
7245
|
+
*/
|
|
7246
|
+
this.minHeight = 'none';
|
|
7247
|
+
/**
|
|
7248
|
+
* Components that will be rendered in error case
|
|
7249
|
+
*/
|
|
7250
|
+
this.errorSlot = [];
|
|
7251
|
+
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
7252
|
+
this.footerSlot = props.footerSlot || this.footerSlot;
|
|
7253
|
+
this.componentMetadata = this.getInitValue('componentMetadata', props.componentMetadata, this.componentMetadata);
|
|
7254
|
+
this.rowPropName = this.getInitValue('rowPropName', props.rowPropName, this.rowPropName);
|
|
7255
|
+
this.noDataSlot = props.noDataSlot || this.noDataSlot;
|
|
7256
|
+
this.noResultSlot = props.noResultSlot || this.noResultSlot;
|
|
7257
|
+
this.errorSlot = props.errorSlot || this.errorSlot;
|
|
7258
|
+
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
7259
|
+
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
7260
|
+
this.height = this.getInitValue('height', props.height, this.height);
|
|
7261
|
+
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
7262
|
+
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
7263
|
+
this.createAccessors();
|
|
7264
|
+
}
|
|
7265
|
+
addSlashes(value) {
|
|
7266
|
+
if (typeof value === 'string') {
|
|
7267
|
+
return value.replace(/\\/g, '\\\\')
|
|
7268
|
+
.replace(/\t/g, '\\t')
|
|
7269
|
+
.replace(/\n/g, '\\n')
|
|
7270
|
+
.replace(/\f/g, '\\f')
|
|
7271
|
+
.replace(/\r/g, '\\r')
|
|
7272
|
+
.replace(/"/g, '\\"');
|
|
7273
|
+
}
|
|
7274
|
+
return value;
|
|
7275
|
+
}
|
|
7276
|
+
/**
|
|
7277
|
+
* Returns the iterable component metadata based on row data
|
|
7278
|
+
*/
|
|
7279
|
+
getComponentMetadata(row) {
|
|
7280
|
+
const exp = new RegExp(`<<${this.rowPropName}.(.[A-z]+?)>>|"<<${this.rowPropName}.(.[A-z]+?)>>"`, 'g');
|
|
7281
|
+
const rowExp = new RegExp(`"<<${this.rowPropName}>>"`, 'g');
|
|
7282
|
+
const metadata = JSON.stringify(this.componentMetadata)
|
|
7283
|
+
.replace(rowExp, JSON.stringify(row))
|
|
7284
|
+
.replace(exp, (match) => {
|
|
7285
|
+
const propPath = match.replace(/<<|>>|"/g, '').split('.').splice(1).join('.');
|
|
7286
|
+
const value = this.addSlashes(get__default["default"](row, propPath));
|
|
7287
|
+
if (typeof value === 'string') {
|
|
7288
|
+
if (match.startsWith('"') && match.endsWith('"'))
|
|
7289
|
+
return `"${value}"`;
|
|
7290
|
+
return value;
|
|
7291
|
+
}
|
|
7292
|
+
return value;
|
|
7293
|
+
});
|
|
7294
|
+
return JSON.parse(metadata);
|
|
7295
|
+
}
|
|
7296
|
+
changeDefaultSlotNames(slot) {
|
|
7297
|
+
slot.forEach((item) => {
|
|
7298
|
+
item.name = item.name.replace('<<NAME>>', this.name);
|
|
7299
|
+
});
|
|
7300
|
+
return slot;
|
|
7301
|
+
}
|
|
7302
|
+
}
|
|
7303
|
+
|
|
7177
7304
|
/**
|
|
7178
7305
|
* Item not found error
|
|
7179
7306
|
*/
|
|
@@ -8957,7 +9084,17 @@
|
|
|
8957
9084
|
}
|
|
8958
9085
|
unSelectAllItems() {
|
|
8959
9086
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8960
|
-
|
|
9087
|
+
if (!this.datasource.search) {
|
|
9088
|
+
this.removeInserts();
|
|
9089
|
+
this.insertSelected();
|
|
9090
|
+
yield this.setValue([]);
|
|
9091
|
+
}
|
|
9092
|
+
else {
|
|
9093
|
+
const newData = this.insertedValues;
|
|
9094
|
+
yield this.setValue(newData);
|
|
9095
|
+
this.removeInserts();
|
|
9096
|
+
this.insertSelected();
|
|
9097
|
+
}
|
|
8961
9098
|
});
|
|
8962
9099
|
}
|
|
8963
9100
|
checkValueOnBlur() { }
|
|
@@ -13106,6 +13243,7 @@
|
|
|
13106
13243
|
exports.Iterable = Iterable;
|
|
13107
13244
|
exports.IterableColumnsButton = IterableColumnsButton;
|
|
13108
13245
|
exports.IterableColumnsButtonController = IterableColumnsButtonController;
|
|
13246
|
+
exports.IterableComponentRender = IterableComponentRender;
|
|
13109
13247
|
exports.IterablePageComponent = IterablePageComponent;
|
|
13110
13248
|
exports.IterablePageInfo = IterablePageInfo;
|
|
13111
13249
|
exports.IterablePageSize = IterablePageSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@zeedhi/autonumeric": "^4.6.0",
|
|
23
23
|
"lodash.debounce": "^4.0.8",
|
|
24
|
+
"lodash.get": "^4.4.2",
|
|
24
25
|
"lodash.isundefined": "^3.0.1",
|
|
25
26
|
"lodash.merge": "^4.6.2",
|
|
26
27
|
"lodash.set": "^4.3.2"
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/lodash.debounce": "^4.0.6",
|
|
34
|
+
"@types/lodash.get": "^4.4.6",
|
|
33
35
|
"@types/lodash.isundefined": "^3.0.6",
|
|
34
36
|
"@types/lodash.merge": "^4.6.6",
|
|
35
37
|
"@types/lodash.set": "^4.3.6",
|
|
@@ -37,5 +39,5 @@
|
|
|
37
39
|
"lodash.times": "^4.3.2",
|
|
38
40
|
"mockdate": "^3.0.2"
|
|
39
41
|
},
|
|
40
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "70326c57b4ab9d895495ee1a05045060a09cc41a"
|
|
41
43
|
}
|
|
@@ -81,6 +81,8 @@ export * from './zd-iterable/iterable-page-info';
|
|
|
81
81
|
export * from './zd-iterable/iterable-pagination';
|
|
82
82
|
export * from './zd-iterable/search';
|
|
83
83
|
export * from './zd-iterable/interfaces';
|
|
84
|
+
export * from './zd-iterable-component-render/iterable-component-render';
|
|
85
|
+
export * from './zd-iterable-component-render/interfaces';
|
|
84
86
|
export * from './zd-list/list';
|
|
85
87
|
export * from './zd-list/list-item';
|
|
86
88
|
export * from './zd-list/list-group';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IDashboard, IDashboardEvents, IDashboardCard } from './interfaces';
|
|
2
2
|
import { ComponentRender } from '../zd-component/component-render';
|
|
3
|
-
import { IButton } from '../zd-button/interfaces';
|
|
4
3
|
import { Modal } from '../zd-modal/modal';
|
|
5
4
|
import { IModal } from '../zd-modal/interfaces';
|
|
6
5
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
6
|
+
import { IHeader } from '../zd-header/interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* Base class for Dashboard component.
|
|
9
9
|
*/
|
|
@@ -38,7 +38,7 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
|
|
|
38
38
|
openModalAddCard(): void;
|
|
39
39
|
modalCancelClick(): void;
|
|
40
40
|
openModalEditCard(cardId: string): void;
|
|
41
|
-
|
|
41
|
+
editHeader: IHeader;
|
|
42
42
|
onSave(): void;
|
|
43
43
|
getFrameProps(cardId: string): {
|
|
44
44
|
name?: undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IEventParam } from '@zeedhi/core';
|
|
2
2
|
import { Dashboard } from './dashboard';
|
|
3
3
|
import { IComponentRender, IComponentEvents } from '../zd-component/interfaces';
|
|
4
|
-
import { IButton } from '../zd-button/interfaces';
|
|
5
4
|
import { ICard } from '../zd-card/interfaces';
|
|
5
|
+
import { IHeader } from '../zd-header/interfaces';
|
|
6
6
|
export declare type IDashboardEventParam = IEventParam<Dashboard>;
|
|
7
7
|
export declare type IDashboardLoadEvent<T> = (event: T) => Promise<any>;
|
|
8
8
|
export interface IDashboardEvents<T = IEventParam<any>> extends IComponentEvents<T> {
|
|
@@ -14,7 +14,7 @@ export interface IDashboard extends IComponentRender {
|
|
|
14
14
|
cards?: IDashboardCard[];
|
|
15
15
|
editingMode?: boolean;
|
|
16
16
|
moveMode?: boolean;
|
|
17
|
-
|
|
17
|
+
editHeader?: IHeader;
|
|
18
18
|
removePadding?: boolean;
|
|
19
19
|
height?: string | number;
|
|
20
20
|
heightAdjust?: string | number;
|
|
@@ -55,6 +55,10 @@ export declare class Form extends ComponentRender implements IForm {
|
|
|
55
55
|
*/
|
|
56
56
|
get value(): IDictionary;
|
|
57
57
|
set value(value: IDictionary);
|
|
58
|
+
/**
|
|
59
|
+
* Clear all form inputs
|
|
60
|
+
*/
|
|
61
|
+
clearForm(): void;
|
|
58
62
|
/**
|
|
59
63
|
* Saves input instance and defines property on form value.
|
|
60
64
|
* @param component Children component
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IComponentRender } from '../zd-component/interfaces';
|
|
2
|
+
import { IIterable } from '../zd-iterable/interfaces';
|
|
3
|
+
export interface IIterableComponentRender extends IIterable {
|
|
4
|
+
rowPropName?: string;
|
|
5
|
+
componentMetadata?: IComponentRender;
|
|
6
|
+
footerSlot?: IComponentRender[];
|
|
7
|
+
toolbarSlot?: IComponentRender[];
|
|
8
|
+
errorSlot?: IComponentRender[];
|
|
9
|
+
noDataSlot?: IComponentRender[];
|
|
10
|
+
noResultSlot?: IComponentRender[];
|
|
11
|
+
height?: number | string;
|
|
12
|
+
maxHeight?: number | string;
|
|
13
|
+
minHeight?: number | string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { IComponentRender } from '../zd-component/interfaces';
|
|
3
|
+
import { IIterableComponentRender } from './interfaces';
|
|
4
|
+
import { Iterable } from '../zd-iterable/iterable';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for IterableComponentRender component.
|
|
7
|
+
* This component uses every row returned by Iterable.datasource to render
|
|
8
|
+
* components defined by componentMetadata property.
|
|
9
|
+
* If the data inside the datasource is changed you should perform
|
|
10
|
+
* a datasource.get() to force updating the rendered components.
|
|
11
|
+
*/
|
|
12
|
+
export declare class IterableComponentRender extends Iterable implements IIterableComponentRender {
|
|
13
|
+
/**
|
|
14
|
+
* Components that will be rendered on toolbar slot
|
|
15
|
+
*/
|
|
16
|
+
toolbarSlot: IComponentRender[];
|
|
17
|
+
/**
|
|
18
|
+
* Components that will be rendered on footer slot
|
|
19
|
+
*/
|
|
20
|
+
footerSlot: IComponentRender[];
|
|
21
|
+
/**
|
|
22
|
+
* Component item definition
|
|
23
|
+
*/
|
|
24
|
+
componentMetadata: IComponentRender;
|
|
25
|
+
/**
|
|
26
|
+
* Row property name
|
|
27
|
+
*/
|
|
28
|
+
rowPropName: string;
|
|
29
|
+
/**
|
|
30
|
+
* Components that will be rendered in no-data case
|
|
31
|
+
*/
|
|
32
|
+
noDataSlot: IComponentRender[];
|
|
33
|
+
/**
|
|
34
|
+
* Components that will be rendered in no-result case
|
|
35
|
+
*/
|
|
36
|
+
noResultSlot: IComponentRender[];
|
|
37
|
+
/**
|
|
38
|
+
* Sets the height for the component.
|
|
39
|
+
*/
|
|
40
|
+
height: number | string;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the maximum height for the component.
|
|
43
|
+
*/
|
|
44
|
+
maxHeight: number | string;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the minimum height for the component.
|
|
47
|
+
*/
|
|
48
|
+
minHeight: number | string;
|
|
49
|
+
/**
|
|
50
|
+
* Components that will be rendered in error case
|
|
51
|
+
*/
|
|
52
|
+
errorSlot: IComponentRender[];
|
|
53
|
+
constructor(props: IIterableComponentRender);
|
|
54
|
+
private addSlashes;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the iterable component metadata based on row data
|
|
57
|
+
*/
|
|
58
|
+
getComponentMetadata(row: IDictionary<any>): any;
|
|
59
|
+
private changeDefaultSlotNames;
|
|
60
|
+
}
|