bromcom-ui 2.4.6 → 2.4.7
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/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/{p-3cbd2cb0.js → p-110fe24c.js} +1 -1
- package/dist/bromcom-ui/{p-5f44988e.entry.js → p-589aabf8.entry.js} +1 -1
- package/dist/bromcom-ui/{p-89aab923.js → p-91dce411.js} +1 -1
- package/dist/bromcom-ui/p-ad47dbab.js +1 -0
- package/dist/bromcom-ui/p-cf0b6a7f.entry.js +1 -0
- package/dist/bromcom-ui/{p-2a56298e.entry.js → p-d7666a3a.entry.js} +1 -1
- package/dist/bromcom-ui/{p-5046315c.entry.js → p-e1cf84bc.entry.js} +1 -1
- package/dist/bromcom-ui/{p-3d463d45.entry.js → p-ec6e5258.entry.js} +1 -1
- package/dist/cjs/bcm-button_7.cjs.entry.js +3 -3
- package/dist/cjs/bcm-label_3.cjs.entry.js +3 -3
- package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +2 -2
- package/dist/cjs/bcm-popover-box.cjs.entry.js +2 -2
- package/dist/cjs/bcm-select.cjs.entry.js +25 -23
- package/dist/cjs/{label-template-317aee92.js → label-template-fbe3f0b1.js} +1 -1
- package/dist/cjs/{popover-placement-e5e2f665.js → popover-placement-7d67ab31.js} +1 -1
- package/dist/cjs/{string-helper-acab31b6.js → string-helper-5c2a2cdf.js} +31 -29
- package/dist/collection/components/molecules/select/select.js +24 -22
- package/dist/collection/helper/string-helper.js +31 -29
- package/dist/esm/bcm-button_7.entry.js +3 -3
- package/dist/esm/bcm-label_3.entry.js +3 -3
- package/dist/esm/bcm-popconfirm-box.entry.js +2 -2
- package/dist/esm/bcm-popover-box.entry.js +2 -2
- package/dist/esm/bcm-select.entry.js +25 -23
- package/dist/esm/{label-template-dcde83fb.js → label-template-26a0569f.js} +1 -1
- package/dist/esm/{popover-placement-0b415c4e.js → popover-placement-b624b72d.js} +1 -1
- package/dist/esm/{string-helper-acc53dad.js → string-helper-a325ba4c.js} +31 -29
- package/package.json +1 -1
- package/dist/bromcom-ui/p-dd76fa74.js +0 -1
- package/dist/bromcom-ui/p-e769ff5d.entry.js +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const index = require('./index-c0971ca7.js');
|
|
4
4
|
const index$1 = require('./index-e5510943.js');
|
|
5
5
|
const bcm = require('./bcm-6463472f.js');
|
|
6
|
-
const stringHelper = require('./string-helper-
|
|
6
|
+
const stringHelper = require('./string-helper-5c2a2cdf.js');
|
|
7
7
|
|
|
8
8
|
const SlotTemplate = ({ value, className, name }) => {
|
|
9
9
|
return stringHelper.StringHelper.isNullOrEmpty(value) ? index.h("span", { class: className },
|
|
@@ -69,44 +69,46 @@ var slugify = index.createCommonjsModule(function (module, exports) {
|
|
|
69
69
|
|
|
70
70
|
class StringHelper {
|
|
71
71
|
}
|
|
72
|
-
StringHelper.lowercase = (str) => str.toLowerCase();
|
|
73
|
-
StringHelper.uppercase = (str) => str.toUpperCase();
|
|
74
|
-
StringHelper.capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
75
|
-
StringHelper.camelCase = (str) => str.replace(/\s(.)/g, function ($1) { return $1.toUpperCase(); }).replace(/\s/g, '');
|
|
76
|
-
StringHelper.kebabCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
77
|
-
StringHelper.snakeCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
78
|
-
StringHelper.titleCase = (str) => str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
|
|
79
|
-
StringHelper.trim = (str) => str.trim();
|
|
80
|
-
StringHelper.trimLeft = (str) => str.trimLeft();
|
|
81
|
-
StringHelper.trimRight = (str) => str.trimRight();
|
|
82
|
-
StringHelper.trimAll = (str) => str.trim().replace(/\s+/g, ' ');
|
|
83
|
-
StringHelper.replace = (str, search, replace) => str.replace(search, replace);
|
|
84
|
-
StringHelper.remove = (str, search) => str.replace(search, '');
|
|
72
|
+
StringHelper.lowercase = (str) => str && (str.toLowerCase());
|
|
73
|
+
StringHelper.uppercase = (str) => str && (str.toUpperCase());
|
|
74
|
+
StringHelper.capitalize = (str) => str && (str.charAt(0).toUpperCase() + str.slice(1));
|
|
75
|
+
StringHelper.camelCase = (str) => str && (str.replace(/\s(.)/g, function ($1) { return $1.toUpperCase(); }).replace(/\s/g, ''));
|
|
76
|
+
StringHelper.kebabCase = (str) => str && (str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase());
|
|
77
|
+
StringHelper.snakeCase = (str) => str && (str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase());
|
|
78
|
+
StringHelper.titleCase = (str) => str && (str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }));
|
|
79
|
+
StringHelper.trim = (str) => str && (str.trim());
|
|
80
|
+
StringHelper.trimLeft = (str) => str && (str.trimLeft());
|
|
81
|
+
StringHelper.trimRight = (str) => str && (str.trimRight());
|
|
82
|
+
StringHelper.trimAll = (str) => str && (str.trim().replace(/\s+/g, ' '));
|
|
83
|
+
StringHelper.replace = (str, search, replace) => (str && search && replace) && (str.replace(search, replace));
|
|
84
|
+
StringHelper.remove = (str, search) => (str && search) && (str.replace(search, ''));
|
|
85
85
|
StringHelper.isNullOrEmpty = (str) => str === null || str === undefined || str === '';
|
|
86
|
-
StringHelper.localizationMessage = (str, args) => str.replace(/{(\d+)}/g, (match, number) => typeof args[number] != 'undefined' ? args[number] : match);
|
|
87
|
-
StringHelper.getMessage = (type, args) => StringHelper.localizationMessage(bcm.Bcm.FormErrorMessages[type], args);
|
|
88
|
-
StringHelper.split = (str, separator) => str.split(separator);
|
|
89
|
-
StringHelper.textContains = (str, search) => str.indexOf(search) !== -1;
|
|
90
|
-
StringHelper.textLimitter = (str, limit) => (str && str.length > limit) ? str.substring(0, limit) + '...' : str;
|
|
91
|
-
StringHelper.slugify = (str) => slugify(str, {
|
|
86
|
+
StringHelper.localizationMessage = (str, args) => (str && args) && (str.replace(/{(\d+)}/g, (match, number) => typeof args[number] != 'undefined' ? args[number] : match));
|
|
87
|
+
StringHelper.getMessage = (type, args) => (type && args) && (StringHelper.localizationMessage(bcm.Bcm.FormErrorMessages[type], args));
|
|
88
|
+
StringHelper.split = (str, separator) => (str && separator) && (str.split(separator));
|
|
89
|
+
StringHelper.textContains = (str, search) => (str && search) && (str.indexOf(search) !== -1);
|
|
90
|
+
StringHelper.textLimitter = (str, limit) => (str && limit) && ((str && str.length > limit) ? str.substring(0, limit) + '...' : str);
|
|
91
|
+
StringHelper.slugify = (str) => str && (slugify(str, {
|
|
92
92
|
replacement: ' ',
|
|
93
93
|
remove: undefined,
|
|
94
94
|
lower: true,
|
|
95
95
|
strict: false,
|
|
96
96
|
locale: 'vi',
|
|
97
97
|
trim: false // trim leading and trailing replacement chars, defaults to `true`
|
|
98
|
-
});
|
|
98
|
+
}));
|
|
99
99
|
StringHelper.highlight = (str, search) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
if (str && search) {
|
|
101
|
+
const slug = StringHelper.slugify(str);
|
|
102
|
+
const searchSlug = StringHelper.slugify(search);
|
|
103
|
+
const index = slug.indexOf(searchSlug);
|
|
104
|
+
if (index !== -1) {
|
|
105
|
+
const start = index;
|
|
106
|
+
const end = index + searchSlug.length;
|
|
107
|
+
return `${str.substring(0, start)}<mark>${str.substring(start, end)}</mark>${str.substring(end)}`;
|
|
108
|
+
}
|
|
109
|
+
return str;
|
|
107
110
|
}
|
|
108
|
-
return str;
|
|
109
111
|
};
|
|
110
|
-
StringHelper.templateParser = (str, data) => str.replace(/\{{(\w+)\}}/g, (match, key) => data[key] || match);
|
|
112
|
+
StringHelper.templateParser = (str, data) => (str && data) && (str.replace(/\{{(\w+)\}}/g, (match, key) => data[key] || match));
|
|
111
113
|
|
|
112
114
|
exports.StringHelper = StringHelper;
|
|
@@ -841,7 +841,7 @@ export class BcmSelect {
|
|
|
841
841
|
this.value2 = null;
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
|
-
|
|
844
|
+
this.calculateContainer();
|
|
845
845
|
}
|
|
846
846
|
async calculateContainer() {
|
|
847
847
|
// await delay(10)
|
|
@@ -856,21 +856,25 @@ export class BcmSelect {
|
|
|
856
856
|
this.itemsWidthArray = [];
|
|
857
857
|
const bcmtags = container.querySelectorAll("bcm-tag");
|
|
858
858
|
await delay(50);
|
|
859
|
-
bcmtags.
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
859
|
+
if (bcmtags && bcmtags.length > 0) {
|
|
860
|
+
bcmtags.forEach((item) => {
|
|
861
|
+
const itemClientWidth = item.clientWidth && item.clientWidth > 40 ? item.clientWidth : 40;
|
|
862
|
+
this.itemsWidthArray.push({ "id": String(item.id), "clientWidth": itemClientWidth });
|
|
863
|
+
this.itemsWidth += itemClientWidth + 4;
|
|
864
|
+
if (this.itemsWidth > this.areaWidth) {
|
|
865
|
+
const tagitem = this.visibleTags[this.visibleTags.findIndex(x => String(x[this.objectMapping['id']]) === String(item.id))];
|
|
866
|
+
if (item && tagitem) {
|
|
867
|
+
if (item.id && tagitem[this.objectMapping['id']]) {
|
|
868
|
+
if (StringHelper.lowercase(item.id) == StringHelper.lowercase(tagitem[this.objectMapping['id']])) {
|
|
869
|
+
// if (String(item.id) == String(tagitem[this.objectMapping['id']])) {
|
|
870
|
+
this.visibleTags.splice(this.visibleTags.findIndex(x => String(x[this.objectMapping['id']]) === String(item.id)), 1);
|
|
871
|
+
this.hiddenTags.push(tagitem);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
870
874
|
}
|
|
871
875
|
}
|
|
872
|
-
}
|
|
873
|
-
}
|
|
876
|
+
});
|
|
877
|
+
}
|
|
874
878
|
this.visibleTags = [...new Set(this.visibleTags)];
|
|
875
879
|
this.hiddenTags = [...new Set(this.hiddenTags)];
|
|
876
880
|
if (this.hiddenTags.length > 0) {
|
|
@@ -885,14 +889,12 @@ export class BcmSelect {
|
|
|
885
889
|
bcmtags2.forEach((item) => {
|
|
886
890
|
if (item.id != "other-tag") {
|
|
887
891
|
var tagitem = this.visibleTags[this.visibleTags.findIndex(x => String(x[this.objectMapping['id']]) === String(item.id))];
|
|
888
|
-
if (tagitem) {
|
|
889
|
-
if (
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
this.hiddenTags.push(tagitem);
|
|
895
|
-
}
|
|
892
|
+
if (tagitem && tagitem[this.objectMapping['id']]) {
|
|
893
|
+
if (StringHelper.lowercase(item.id) == StringHelper.lowercase(tagitem[this.objectMapping['id']])) {
|
|
894
|
+
this.itemsWidth += (item.clientWidth + 4);
|
|
895
|
+
if (this.itemsWidth + this.otherTagsWidth > this.areaWidth) {
|
|
896
|
+
this.visibleTags.splice(this.visibleTags.findIndex(x => String(x[this.objectMapping['id']]) === String(item.id)), 1);
|
|
897
|
+
this.hiddenTags.push(tagitem);
|
|
896
898
|
}
|
|
897
899
|
}
|
|
898
900
|
}
|
|
@@ -2,42 +2,44 @@ import Bcm from "../models/bcm";
|
|
|
2
2
|
import slugify from "slugify";
|
|
3
3
|
export class StringHelper {
|
|
4
4
|
}
|
|
5
|
-
StringHelper.lowercase = (str) => str.toLowerCase();
|
|
6
|
-
StringHelper.uppercase = (str) => str.toUpperCase();
|
|
7
|
-
StringHelper.capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
|
-
StringHelper.camelCase = (str) => str.replace(/\s(.)/g, function ($1) { return $1.toUpperCase(); }).replace(/\s/g, '');
|
|
9
|
-
StringHelper.kebabCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
10
|
-
StringHelper.snakeCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
11
|
-
StringHelper.titleCase = (str) => str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
|
|
12
|
-
StringHelper.trim = (str) => str.trim();
|
|
13
|
-
StringHelper.trimLeft = (str) => str.trimLeft();
|
|
14
|
-
StringHelper.trimRight = (str) => str.trimRight();
|
|
15
|
-
StringHelper.trimAll = (str) => str.trim().replace(/\s+/g, ' ');
|
|
16
|
-
StringHelper.replace = (str, search, replace) => str.replace(search, replace);
|
|
17
|
-
StringHelper.remove = (str, search) => str.replace(search, '');
|
|
5
|
+
StringHelper.lowercase = (str) => str && (str.toLowerCase());
|
|
6
|
+
StringHelper.uppercase = (str) => str && (str.toUpperCase());
|
|
7
|
+
StringHelper.capitalize = (str) => str && (str.charAt(0).toUpperCase() + str.slice(1));
|
|
8
|
+
StringHelper.camelCase = (str) => str && (str.replace(/\s(.)/g, function ($1) { return $1.toUpperCase(); }).replace(/\s/g, ''));
|
|
9
|
+
StringHelper.kebabCase = (str) => str && (str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase());
|
|
10
|
+
StringHelper.snakeCase = (str) => str && (str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase());
|
|
11
|
+
StringHelper.titleCase = (str) => str && (str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }));
|
|
12
|
+
StringHelper.trim = (str) => str && (str.trim());
|
|
13
|
+
StringHelper.trimLeft = (str) => str && (str.trimLeft());
|
|
14
|
+
StringHelper.trimRight = (str) => str && (str.trimRight());
|
|
15
|
+
StringHelper.trimAll = (str) => str && (str.trim().replace(/\s+/g, ' '));
|
|
16
|
+
StringHelper.replace = (str, search, replace) => (str && search && replace) && (str.replace(search, replace));
|
|
17
|
+
StringHelper.remove = (str, search) => (str && search) && (str.replace(search, ''));
|
|
18
18
|
StringHelper.isNullOrEmpty = (str) => str === null || str === undefined || str === '';
|
|
19
|
-
StringHelper.localizationMessage = (str, args) => str.replace(/{(\d+)}/g, (match, number) => typeof args[number] != 'undefined' ? args[number] : match);
|
|
20
|
-
StringHelper.getMessage = (type, args) => StringHelper.localizationMessage(Bcm.FormErrorMessages[type], args);
|
|
21
|
-
StringHelper.split = (str, separator) => str.split(separator);
|
|
22
|
-
StringHelper.textContains = (str, search) => str.indexOf(search) !== -1;
|
|
23
|
-
StringHelper.textLimitter = (str, limit) => (str && str.length > limit) ? str.substring(0, limit) + '...' : str;
|
|
24
|
-
StringHelper.slugify = (str) => slugify(str, {
|
|
19
|
+
StringHelper.localizationMessage = (str, args) => (str && args) && (str.replace(/{(\d+)}/g, (match, number) => typeof args[number] != 'undefined' ? args[number] : match));
|
|
20
|
+
StringHelper.getMessage = (type, args) => (type && args) && (StringHelper.localizationMessage(Bcm.FormErrorMessages[type], args));
|
|
21
|
+
StringHelper.split = (str, separator) => (str && separator) && (str.split(separator));
|
|
22
|
+
StringHelper.textContains = (str, search) => (str && search) && (str.indexOf(search) !== -1);
|
|
23
|
+
StringHelper.textLimitter = (str, limit) => (str && limit) && ((str && str.length > limit) ? str.substring(0, limit) + '...' : str);
|
|
24
|
+
StringHelper.slugify = (str) => str && (slugify(str, {
|
|
25
25
|
replacement: ' ',
|
|
26
26
|
remove: undefined,
|
|
27
27
|
lower: true,
|
|
28
28
|
strict: false,
|
|
29
29
|
locale: 'vi',
|
|
30
30
|
trim: false // trim leading and trailing replacement chars, defaults to `true`
|
|
31
|
-
});
|
|
31
|
+
}));
|
|
32
32
|
StringHelper.highlight = (str, search) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
if (str && search) {
|
|
34
|
+
const slug = StringHelper.slugify(str);
|
|
35
|
+
const searchSlug = StringHelper.slugify(search);
|
|
36
|
+
const index = slug.indexOf(searchSlug);
|
|
37
|
+
if (index !== -1) {
|
|
38
|
+
const start = index;
|
|
39
|
+
const end = index + searchSlug.length;
|
|
40
|
+
return `${str.substring(0, start)}<mark>${str.substring(start, end)}</mark>${str.substring(end)}`;
|
|
41
|
+
}
|
|
42
|
+
return str;
|
|
40
43
|
}
|
|
41
|
-
return str;
|
|
42
44
|
};
|
|
43
|
-
StringHelper.templateParser = (str, data) => str.replace(/\{{(\w+)\}}/g, (match, key) => data[key] || match);
|
|
45
|
+
StringHelper.templateParser = (str, data) => (str && data) && (str.replace(/\{{(\w+)\}}/g, (match, key) => data[key] || match));
|
|
@@ -8,9 +8,9 @@ import { J as JsonParse } from './json-parse-decarator-8563927a.js';
|
|
|
8
8
|
import './types-911a8837.js';
|
|
9
9
|
import { G as Generate } from './generate-2ee52515.js';
|
|
10
10
|
import { B as Bcm } from './bcm-0d5f0281.js';
|
|
11
|
-
import { S as StringHelper } from './string-helper-
|
|
12
|
-
import { L as LabelTemplate } from './label-template-
|
|
13
|
-
import { g as getPlacement, s as setPosition } from './popover-placement-
|
|
11
|
+
import { S as StringHelper } from './string-helper-a325ba4c.js';
|
|
12
|
+
import { L as LabelTemplate } from './label-template-26a0569f.js';
|
|
13
|
+
import { g as getPlacement, s as setPosition } from './popover-placement-b624b72d.js';
|
|
14
14
|
import { c as createStore } from './index-3c5b7898.js';
|
|
15
15
|
|
|
16
16
|
/**
|