@zeedhi/common 1.63.4-beta.0 → 1.64.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
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { default as AutoNumeric } from '@zeedhi/autonumeric';
|
|
3
|
-
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 } from '@zeedhi/core';
|
|
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';
|
|
4
2
|
import merge from 'lodash.merge';
|
|
5
3
|
import debounce from 'lodash.debounce';
|
|
6
4
|
import isUndefined from 'lodash.isundefined';
|
|
@@ -2488,6 +2486,17 @@ class TextInput extends Input {
|
|
|
2488
2486
|
prependOuterIconClick(event, element) {
|
|
2489
2487
|
this.callEvent('prependOuterIconClick', { event, element, component: this });
|
|
2490
2488
|
}
|
|
2489
|
+
getMaskValue() {
|
|
2490
|
+
let mask = '';
|
|
2491
|
+
if (typeof this.mask === 'function') {
|
|
2492
|
+
mask = this.mask(Mask.getValueWithoutMask(this.value || ''));
|
|
2493
|
+
}
|
|
2494
|
+
else if (typeof this.mask === 'string' || Array.isArray(this.mask)) {
|
|
2495
|
+
mask = this.mask || '';
|
|
2496
|
+
}
|
|
2497
|
+
mask = Mask.getMaskArray(mask);
|
|
2498
|
+
return mask;
|
|
2499
|
+
}
|
|
2491
2500
|
}
|
|
2492
2501
|
FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
|
|
2493
2502
|
let formatted = value;
|
|
@@ -2544,7 +2553,7 @@ class Number$1 extends TextInput {
|
|
|
2544
2553
|
this.validateMask();
|
|
2545
2554
|
}
|
|
2546
2555
|
validateMask() {
|
|
2547
|
-
AutoNumeric.validate(this.mask);
|
|
2556
|
+
AutoNumeric.validate(this.mask, true);
|
|
2548
2557
|
this.maskValid = true;
|
|
2549
2558
|
this.value = this.localValue; // force atualization after validate mask
|
|
2550
2559
|
}
|
|
@@ -4045,6 +4054,23 @@ class DateRange extends TextInput {
|
|
|
4045
4054
|
this.hint = this.previousHint;
|
|
4046
4055
|
this.persistentHint = this.previousPersistentHint;
|
|
4047
4056
|
}
|
|
4057
|
+
getMaskValue() {
|
|
4058
|
+
let mask = '';
|
|
4059
|
+
if (typeof this.mask === 'function') {
|
|
4060
|
+
mask = this.mask(Mask.getValueWithoutMask((this.value && this.value[0]) || ''));
|
|
4061
|
+
}
|
|
4062
|
+
else if (typeof this.mask === 'string') {
|
|
4063
|
+
mask = this.mask.split(this.splitter)[0] || '';
|
|
4064
|
+
mask = Mask.getMaskArray(mask);
|
|
4065
|
+
if (Array.isArray(mask) && mask.length > 0) {
|
|
4066
|
+
mask = mask.concat(this.splitter.split('')).concat(mask);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
else if (Array.isArray(this.mask)) {
|
|
4070
|
+
mask = this.mask;
|
|
4071
|
+
}
|
|
4072
|
+
return mask;
|
|
4073
|
+
}
|
|
4048
4074
|
}
|
|
4049
4075
|
FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = Config.dateFormat, displayFormat = Config.displayFormat, inputFormat = Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
|
|
4050
4076
|
if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
|
|
@@ -5575,7 +5601,9 @@ class Grid extends Iterable {
|
|
|
5575
5601
|
newComponent.children = newChildren;
|
|
5576
5602
|
newComponent.events = newEvents;
|
|
5577
5603
|
try {
|
|
5578
|
-
|
|
5604
|
+
const updatedComponent = Object.assign({}, newComponent);
|
|
5605
|
+
delete updatedComponent.datasource;
|
|
5606
|
+
Metadata.updateInstance(instanceName, updatedComponent);
|
|
5579
5607
|
}
|
|
5580
5608
|
catch (e) {
|
|
5581
5609
|
// do nothing
|
|
@@ -13261,4 +13289,8 @@ class Report {
|
|
|
13261
13289
|
}
|
|
13262
13290
|
}
|
|
13263
13291
|
|
|
13264
|
-
|
|
13292
|
+
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
13293
|
+
const packageContent = require('../package.json');
|
|
13294
|
+
VersionService.addPackageVersion(packageContent.name, packageContent.version);
|
|
13295
|
+
|
|
13296
|
+
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,12 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.
|
|
5
|
-
})(this, (function (exports,
|
|
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
|
|
|
9
|
-
var AutoNumeric__default = /*#__PURE__*/_interopDefaultLegacy(AutoNumeric);
|
|
10
9
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
11
10
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
12
11
|
var isUndefined__default = /*#__PURE__*/_interopDefaultLegacy(isUndefined);
|
|
@@ -2494,6 +2493,17 @@
|
|
|
2494
2493
|
prependOuterIconClick(event, element) {
|
|
2495
2494
|
this.callEvent('prependOuterIconClick', { event, element, component: this });
|
|
2496
2495
|
}
|
|
2496
|
+
getMaskValue() {
|
|
2497
|
+
let mask = '';
|
|
2498
|
+
if (typeof this.mask === 'function') {
|
|
2499
|
+
mask = this.mask(core.Mask.getValueWithoutMask(this.value || ''));
|
|
2500
|
+
}
|
|
2501
|
+
else if (typeof this.mask === 'string' || Array.isArray(this.mask)) {
|
|
2502
|
+
mask = this.mask || '';
|
|
2503
|
+
}
|
|
2504
|
+
mask = core.Mask.getMaskArray(mask);
|
|
2505
|
+
return mask;
|
|
2506
|
+
}
|
|
2497
2507
|
}
|
|
2498
2508
|
core.FormatterParserProvider.registerFormatter('ZdTextInput', (value, { valueWithPrefix = textInputDefaults.valueWithPrefix, prefix = textInputDefaults.prefix, valueWithSuffix = textInputDefaults.valueWithSuffix, suffix = textInputDefaults.suffix, mask = textInputDefaults.mask, } = {}) => {
|
|
2499
2509
|
let formatted = value;
|
|
@@ -2550,7 +2560,7 @@
|
|
|
2550
2560
|
this.validateMask();
|
|
2551
2561
|
}
|
|
2552
2562
|
validateMask() {
|
|
2553
|
-
|
|
2563
|
+
AutoNumeric.validate(this.mask, true);
|
|
2554
2564
|
this.maskValid = true;
|
|
2555
2565
|
this.value = this.localValue; // force atualization after validate mask
|
|
2556
2566
|
}
|
|
@@ -2562,7 +2572,7 @@
|
|
|
2562
2572
|
return;
|
|
2563
2573
|
this.localValue = value;
|
|
2564
2574
|
if (this.maskValid && this.localValue !== undefined && this.localValue !== null) {
|
|
2565
|
-
this.formattedValue =
|
|
2575
|
+
this.formattedValue = AutoNumeric.format(this.localValue, this.mask);
|
|
2566
2576
|
if (this.autoNumericObj) {
|
|
2567
2577
|
this.autoNumericObj.setValue(value);
|
|
2568
2578
|
}
|
|
@@ -2614,8 +2624,8 @@
|
|
|
2614
2624
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2615
2625
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2616
2626
|
}
|
|
2617
|
-
const maskValue = typeof (maskDef) === 'function' ? maskDef(
|
|
2618
|
-
return value === null ? '' :
|
|
2627
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2628
|
+
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2619
2629
|
});
|
|
2620
2630
|
core.FormatterParserProvider.registerParser('ZdNumber', (value, { mask = core.Config.masks.numberMask, } = {}) => {
|
|
2621
2631
|
let maskDef = mask;
|
|
@@ -2623,8 +2633,8 @@
|
|
|
2623
2633
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2624
2634
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2625
2635
|
}
|
|
2626
|
-
const maskValue = typeof (maskDef) === 'function' ? maskDef(
|
|
2627
|
-
return value === '' ? null :
|
|
2636
|
+
const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2637
|
+
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2628
2638
|
});
|
|
2629
2639
|
|
|
2630
2640
|
/**
|
|
@@ -2641,8 +2651,8 @@
|
|
|
2641
2651
|
this.validateMask();
|
|
2642
2652
|
}
|
|
2643
2653
|
}
|
|
2644
|
-
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = core.Config.masks.currencyMask, } = {}) => (value === null ? '' :
|
|
2645
|
-
core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = core.Config.masks.currencyMask, } = {}) => (value === '' ? null :
|
|
2654
|
+
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = core.Config.masks.currencyMask, } = {}) => (value === null ? '' : AutoNumeric.format(value, mask)));
|
|
2655
|
+
core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = core.Config.masks.currencyMask, } = {}) => (value === '' ? null : AutoNumeric.unformat(value, mask)));
|
|
2646
2656
|
|
|
2647
2657
|
/**
|
|
2648
2658
|
* Alert Service Class
|
|
@@ -4051,6 +4061,23 @@
|
|
|
4051
4061
|
this.hint = this.previousHint;
|
|
4052
4062
|
this.persistentHint = this.previousPersistentHint;
|
|
4053
4063
|
}
|
|
4064
|
+
getMaskValue() {
|
|
4065
|
+
let mask = '';
|
|
4066
|
+
if (typeof this.mask === 'function') {
|
|
4067
|
+
mask = this.mask(core.Mask.getValueWithoutMask((this.value && this.value[0]) || ''));
|
|
4068
|
+
}
|
|
4069
|
+
else if (typeof this.mask === 'string') {
|
|
4070
|
+
mask = this.mask.split(this.splitter)[0] || '';
|
|
4071
|
+
mask = core.Mask.getMaskArray(mask);
|
|
4072
|
+
if (Array.isArray(mask) && mask.length > 0) {
|
|
4073
|
+
mask = mask.concat(this.splitter.split('')).concat(mask);
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
else if (Array.isArray(this.mask)) {
|
|
4077
|
+
mask = this.mask;
|
|
4078
|
+
}
|
|
4079
|
+
return mask;
|
|
4080
|
+
}
|
|
4054
4081
|
}
|
|
4055
4082
|
core.FormatterParserProvider.registerFormatter('ZdDateRange', (value, { dateFormat = core.Config.dateFormat, displayFormat = core.Config.displayFormat, inputFormat = core.Config.dateInputFormat, initialMask, splitter = ' ~ ', unitMask = '', mask = '', isSimpleDisplay = false, } = {}) => {
|
|
4056
4083
|
if (!value || value.length === 0 || (value.length === 1 && !value[0])) {
|
|
@@ -5581,7 +5608,9 @@
|
|
|
5581
5608
|
newComponent.children = newChildren;
|
|
5582
5609
|
newComponent.events = newEvents;
|
|
5583
5610
|
try {
|
|
5584
|
-
|
|
5611
|
+
const updatedComponent = Object.assign({}, newComponent);
|
|
5612
|
+
delete updatedComponent.datasource;
|
|
5613
|
+
core.Metadata.updateInstance(instanceName, updatedComponent);
|
|
5585
5614
|
}
|
|
5586
5615
|
catch (e) {
|
|
5587
5616
|
// do nothing
|
|
@@ -13267,13 +13296,14 @@
|
|
|
13267
13296
|
}
|
|
13268
13297
|
}
|
|
13269
13298
|
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13299
|
+
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
13300
|
+
const packageContent = require('../package.json');
|
|
13301
|
+
core.VersionService.addPackageVersion(packageContent.name, packageContent.version);
|
|
13302
|
+
|
|
13274
13303
|
exports.Alert = Alert;
|
|
13275
13304
|
exports.AlertService = AlertService;
|
|
13276
13305
|
exports.ApexChart = ApexChart;
|
|
13306
|
+
exports.AutoNumeric = AutoNumeric;
|
|
13277
13307
|
exports.Badge = Badge;
|
|
13278
13308
|
exports.Breadcrumbs = Breadcrumbs;
|
|
13279
13309
|
exports.Button = Button;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.64.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"watch": "npm run build -- -w"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@zeedhi/autonumeric": "
|
|
22
|
+
"@zeedhi/autonumeric": "^4.6.0",
|
|
23
23
|
"lodash.debounce": "^4.0.8",
|
|
24
24
|
"lodash.get": "^4.4.2",
|
|
25
25
|
"lodash.isundefined": "^3.0.1",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"lodash.times": "^4.3.2",
|
|
40
40
|
"mockdate": "^3.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "b6b5f30c0cad72871a9dfb193046d7523f34e302"
|
|
43
43
|
}
|
package/types/index.d.ts
CHANGED