bromcom-ui 2.4.18 → 2.4.19

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.
Files changed (55) hide show
  1. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  2. package/dist/bromcom-ui/{p-f03e41b5.entry.js → p-275c06a2.entry.js} +1 -1
  3. package/dist/bromcom-ui/{p-1384753c.entry.js → p-56312eb4.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-c40d45b9.entry.js → p-87eead0c.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-47be36bf.entry.js → p-893b1117.entry.js} +1 -1
  6. package/dist/bromcom-ui/p-8ff169fb.entry.js +1 -0
  7. package/dist/bromcom-ui/{p-495bf63e.js → p-945d9359.js} +1 -1
  8. package/dist/bromcom-ui/p-a0b12489.entry.js +1 -0
  9. package/dist/bromcom-ui/{p-82352b0f.entry.js → p-ac679765.entry.js} +1 -1
  10. package/dist/bromcom-ui/{p-8c472703.entry.js → p-ae53d8d8.entry.js} +1 -1
  11. package/dist/bromcom-ui/{p-3de794f6.entry.js → p-b6c270d0.entry.js} +1 -1
  12. package/dist/bromcom-ui/{p-7fb112d9.js → p-bc30b511.js} +1 -1
  13. package/dist/bromcom-ui/p-d86c018a.entry.js +1 -0
  14. package/dist/bromcom-ui/{p-e4da928b.entry.js → p-ddbaa099.entry.js} +1 -1
  15. package/dist/bromcom-ui/p-fa0c64f5.entry.js +1 -0
  16. package/dist/bromcom-ui/p-fb10cbc4.entry.js +1 -0
  17. package/dist/cjs/{bcm-button_7.cjs.entry.js → bcm-button_3.cjs.entry.js} +5 -1801
  18. package/dist/cjs/{bcm-checkbox.cjs.entry.js → bcm-checkbox_2.cjs.entry.js} +64 -0
  19. package/dist/cjs/bcm-icon-2_2.cjs.entry.js +3 -3
  20. package/dist/cjs/bcm-label_3.cjs.entry.js +1 -1
  21. package/dist/cjs/bcm-list.cjs.entry.js +1423 -0
  22. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +1 -1
  23. package/dist/cjs/bcm-popconfirm.cjs.entry.js +1 -1
  24. package/dist/cjs/bcm-popover-box.cjs.entry.js +1 -1
  25. package/dist/cjs/bcm-popover.cjs.entry.js +1 -1
  26. package/dist/cjs/bcm-search-2.cjs.entry.js +306 -0
  27. package/dist/cjs/bcm-stepper.cjs.entry.js +3 -3
  28. package/dist/cjs/bcm-tag-2.cjs.entry.js +2 -2
  29. package/dist/cjs/bcm-text.cjs.entry.js +33 -0
  30. package/dist/cjs/bromcom-ui.cjs.js +1 -1
  31. package/dist/cjs/{generate-debc2c44.js → generate-f1e88921.js} +1 -1
  32. package/dist/cjs/loader.cjs.js +1 -1
  33. package/dist/cjs/{stepper-states-09ebf594.js → stepper-states-4b65b027.js} +1 -1
  34. package/dist/collection/components/organism/form/form.js +5 -5
  35. package/dist/collection/components/organism/list/list.js +68 -71
  36. package/dist/esm/{bcm-button_7.entry.js → bcm-button_3.entry.js} +8 -1800
  37. package/dist/esm/{bcm-checkbox.entry.js → bcm-checkbox_2.entry.js} +65 -2
  38. package/dist/esm/bcm-icon-2_2.entry.js +3 -3
  39. package/dist/esm/bcm-label_3.entry.js +1 -1
  40. package/dist/esm/bcm-list.entry.js +1419 -0
  41. package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
  42. package/dist/esm/bcm-popconfirm.entry.js +1 -1
  43. package/dist/esm/bcm-popover-box.entry.js +1 -1
  44. package/dist/esm/bcm-popover.entry.js +1 -1
  45. package/dist/esm/bcm-search-2.entry.js +302 -0
  46. package/dist/esm/bcm-stepper.entry.js +3 -3
  47. package/dist/esm/bcm-tag-2.entry.js +2 -2
  48. package/dist/esm/bcm-text.entry.js +29 -0
  49. package/dist/esm/bromcom-ui.js +1 -1
  50. package/dist/esm/{generate-42ba55c9.js → generate-b11810eb.js} +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{stepper-states-706439d0.js → stepper-states-7457f702.js} +1 -1
  53. package/package.json +1 -1
  54. package/dist/bromcom-ui/p-63675bea.entry.js +0 -1
  55. package/dist/bromcom-ui/p-6823d86a.entry.js +0 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-c0971ca7.js');
6
6
  const index$1 = require('./index-e5510943.js');
7
7
  require('./types-37c8ced6.js');
8
- const generate = require('./generate-debc2c44.js');
8
+ const generate = require('./generate-f1e88921.js');
9
9
  require('./bcm-5dcc129b.js');
10
10
  const stringHelper = require('./string-helper-991c7e7d.js');
11
11
  const popoverPlacement = require('./popover-placement-dacc8fc9.js');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-c0971ca7.js');
6
6
  const index$1 = require('./index-e5510943.js');
7
7
  require('./types-37c8ced6.js');
8
- const generate = require('./generate-debc2c44.js');
8
+ const generate = require('./generate-f1e88921.js');
9
9
  const bcm = require('./bcm-5dcc129b.js');
10
10
  const propertyDecorators = require('./property-decorators-476df1c5.js');
11
11
 
@@ -0,0 +1,306 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index$1 = require('./index-c0971ca7.js');
6
+ const index = require('./index-e5510943.js');
7
+ require('./types-37c8ced6.js');
8
+ const snq_es5 = require('./snq.es5-1a8f9645.js');
9
+ const jsonParseDecarator = require('./json-parse-decarator-89653e78.js');
10
+ const generate = require('./generate-f1e88921.js');
11
+ const bcm = require('./bcm-5dcc129b.js');
12
+ const stringHelper = require('./string-helper-991c7e7d.js');
13
+ const index$2 = require('./index-c74bd3c1.js');
14
+
15
+ var defaultIcons;
16
+ (function (defaultIcons) {
17
+ defaultIcons["search"] = "search";
18
+ defaultIcons["email"] = "mail";
19
+ defaultIcons["tel"] = "phone";
20
+ defaultIcons["url"] = "link";
21
+ })(defaultIcons || (defaultIcons = {}));
22
+ var iconSizes;
23
+ (function (iconSizes) {
24
+ iconSizes[iconSizes["small"] = 14] = "small";
25
+ iconSizes[iconSizes["medium"] = 16] = "medium";
26
+ iconSizes[iconSizes["large"] = 18] = "large";
27
+ })(iconSizes || (iconSizes = {}));
28
+
29
+ const InputTemplate = ({ elementType,
30
+ //textarea
31
+ rows,
32
+ //props
33
+ id, internalId, type, placeholder, value, size,
34
+ //,
35
+ unit, unitPrefix, maxLength,
36
+ //boolean
37
+ disabled, clearable, focused, readonly, isPasswordVisible, passwordToggle, noDefaultIcon, inValid, captionType, resize,
38
+ // custom functions
39
+ changePasswordVisibility, handleClear, steps,
40
+ //event functions
41
+ ref, handleBlur, handleFocus, handleInput, handleChange }) => {
42
+ const ElementTagType = bcm.Bcm.HtmlElementType[elementType] || bcm.Bcm.HtmlElementType.input;
43
+ type = (type === 'password' && isPasswordVisible) ? 'text' : type;
44
+ value = value || '';
45
+ value = !focused ? value + (value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 ? ' ' + unit : '') : value;
46
+ const templateHandleFocus = (e) => {
47
+ e.target.parentElement.classList.add('focused');
48
+ handleFocus(e);
49
+ };
50
+ const templateHandleBlur = (e) => {
51
+ e.target.parentElement.classList.remove('focused');
52
+ handleBlur(e);
53
+ };
54
+ var containerClass = index.classnames('bcm-input__container', ElementTagType === bcm.Bcm.HtmlElementType.textarea && index.classnames('bcm-input__textarea', 'textarea-size-' + bcm.Bcm.Size[size], 'resize-' + resize, 'textarea-' + size), ElementTagType === bcm.Bcm.HtmlElementType.input && index.classnames('input-size-' + bcm.Bcm.Size[size]), {
55
+ 'focused': focused,
56
+ 'clearable': clearable,
57
+ disabled,
58
+ readonly,
59
+ 'invalid': inValid,
60
+ 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0,
61
+ // 'empty': value?.length < 1,
62
+ 'error': captionType === 'error'
63
+ });
64
+ const caretContainer = index.classnames('caret-container', {
65
+ 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0,
66
+ 'disabled': disabled || readonly || inValid
67
+ });
68
+ const inputClass = size === 'large' ? 'size-3' : 'size-2';
69
+ const unitClass = index.classnames(inputClass, 'unit-prefix');
70
+ return (index$1.h("div", { class: containerClass },
71
+ index$1.h("span", { hidden: true },
72
+ index$1.h("slot", null)),
73
+ index$1.h("span", { class: "input-prefix" },
74
+ index$1.h("slot", { name: "prefix" }),
75
+ unitPrefix && index$1.h("span", { class: unitClass }, unitPrefix)),
76
+ index$1.h(ElementTagType, Object.assign({ tabindex: "1", id: id, "bcm-internal-id": internalId, class: 'bcm-input-element ' + inputClass }, ((ElementTagType === bcm.Bcm.HtmlElementType.input && { type: type })), ((ElementTagType === bcm.Bcm.HtmlElementType.textarea && { rows: rows })), { value: value, maxLength: maxLength, placeholder: placeholder, disabled: disabled, readOnly: readonly, ref: (el) => ref(el), onBlur: (e) => templateHandleBlur(e), onFocus: (e) => templateHandleFocus(e), onInput: (e) => handleInput(e), onChange: (e) => handleChange(e) })),
77
+ (clearable && !disabled) &&
78
+ index$1.h("span", { class: "input-suffix input-suffix-button input-clear-button", onClick: (e) => handleClear(e) },
79
+ index$1.h("bcm-icon", { icon: "close-circle", type: "fill", size: iconSizes[size], color: "grey-7" })),
80
+ (type === 'password' && passwordToggle) && (index$1.h("span", { class: "input-suffix input-suffix-button", onClick: () => changePasswordVisibility() },
81
+ index$1.h("bcm-icon", { icon: isPasswordVisible ? "eye-invisible" : "eye", type: "outlined", size: iconSizes[size], color: "grey-7" }))),
82
+ (Object.keys(defaultIcons).includes(type) && !noDefaultIcon) && (index$1.h("span", { class: "input-suffix" },
83
+ index$1.h("bcm-icon", { icon: defaultIcons[type], type: "outlined", size: iconSizes[size], color: "grey-7" }))),
84
+ type === 'number' && (index$1.h("div", { class: caretContainer },
85
+ index$1.h("span", { class: "caret", onClick: () => steps('up') },
86
+ index$1.h("bcm-icon", { icon: "caret-up", type: "outlined", color: "grey-7", size: 8 })),
87
+ index$1.h("span", { class: "caret", onClick: () => steps('down') },
88
+ index$1.h("bcm-icon", { icon: "caret-down", type: "outlined", color: "grey-7", size: 8 })))),
89
+ type !== 'number' && (index$1.h("span", { class: "input-suffix" },
90
+ index$1.h("slot", { name: "suffix" })))));
91
+ };
92
+
93
+ const { state } = index$2.createStore({
94
+ value: new Map(),
95
+ });
96
+ const setValue = (val) => {
97
+ const { id, dataSource } = val;
98
+ const data = {
99
+ id: snq_es5.snq(() => id, generate.Generate.UID),
100
+ dataSource: recursive(dataSource)
101
+ };
102
+ state.value.set(data.id, data);
103
+ };
104
+ const recursive = (data, parentId) => {
105
+ const recData = data.map((item) => (Object.assign(Object.assign(Object.assign({}, item), { parentId: parentId || null }), (item.items && { items: snq_es5.snq(() => recursive(item.items, item.id), []) }))));
106
+ return recData;
107
+ };
108
+ const removeValue = (_id) => {
109
+ state.value.delete(_id);
110
+ };
111
+ const getValue = (id) => snq_es5.snq(() => state.value.get(id), {});
112
+ const getDataPagination = (id, limit = 3) => {
113
+ let data = [];
114
+ const value = getValue(id);
115
+ if (value) {
116
+ const { dataSource } = value;
117
+ data = dataSource.slice(0, limit);
118
+ }
119
+ return data;
120
+ };
121
+ // //search treeview data by text
122
+ // const searchData = (id, search, items?) => {
123
+ // let dataSource
124
+ // if (items && items.length > 0) {
125
+ // dataSource = items
126
+ // } else {
127
+ // const value = getValue(id);
128
+ // dataSource = value.dataSource;
129
+ // }
130
+ // let result = []
131
+ // if (dataSource) {
132
+ // dataSource.forEach(child => {
133
+ // if (child.text.toLowerCase().includes(search.toLowerCase())) {
134
+ // result.push(child)
135
+ // }
136
+ // result = result.concat(searchData(id, search, child.items))
137
+ // })
138
+ // };
139
+ // return result
140
+ // };
141
+ //nested search
142
+ const searchData = (id, searchText, items) => {
143
+ let dataSource;
144
+ if (items && items.length > 0) {
145
+ dataSource = items;
146
+ }
147
+ else {
148
+ const value = getValue(id);
149
+ dataSource = value.dataSource;
150
+ }
151
+ let results = [];
152
+ if (dataSource) {
153
+ results.push(nestedSearch(dataSource, searchText));
154
+ //return with their parents
155
+ // dataSource.forEach(child => {
156
+ // if (child.text.toLowerCase().includes(searchText.toLowerCase())) {
157
+ // results.push(child)
158
+ // } else if (child.items && child.items.length > 0) {
159
+ // child.items = nestedSearch(child.items, searchText)
160
+ // if (child.items.length > 0) {
161
+ // results.push(child)
162
+ // }
163
+ // }
164
+ // })
165
+ }
166
+ return { result: generate.Generate.flatArray(results[0].result), matching: results[0].matching, parentIndex: results[0].parentIndex, nestedResult: results[0].nestedResult };
167
+ };
168
+ const nestedSearch = (items, searchText) => {
169
+ let matching = [];
170
+ let parentIndex = [];
171
+ let result = [];
172
+ let nestedResult = [];
173
+ if (items && items.length > 0) {
174
+ items.forEach(child => {
175
+ if (stringHelper.StringHelper.slugify(child.text).indexOf(stringHelper.StringHelper.slugify(searchText)) > -1) {
176
+ result.push(child.id);
177
+ matching.push(child.id);
178
+ parentIndex.push(child.id);
179
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId });
180
+ // if (child.items && child.items.length > 0) {
181
+ // child.items.forEach(chi => {
182
+ // result.push(chi.id)
183
+ // })
184
+ // }
185
+ }
186
+ else if (child.items && child.items.length > 0) {
187
+ const found = nestedSearch(child.items, searchText);
188
+ if (found.result.length > 0) {
189
+ found.result.forEach(chi => {
190
+ result.push(chi);
191
+ });
192
+ result.push(child.id);
193
+ parentIndex.push(child.id);
194
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId, items: found.nestedResult });
195
+ }
196
+ if (found.matching.length > 0) {
197
+ matching.push(...found.matching);
198
+ }
199
+ }
200
+ });
201
+ }
202
+ return { result, matching, parentIndex, nestedResult };
203
+ };
204
+ const searchState = {
205
+ setValue,
206
+ removeValue,
207
+ getValue,
208
+ getDataPagination,
209
+ searchData
210
+ };
211
+
212
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
213
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
214
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
215
+ r = Reflect.decorate(decorators, target, key, desc);
216
+ else
217
+ for (var i = decorators.length - 1; i >= 0; i--)
218
+ if (d = decorators[i])
219
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
220
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
221
+ };
222
+ const BcmSearch2 = class {
223
+ constructor(hostRef) {
224
+ index$1.registerInstance(this, hostRef);
225
+ this.bcmOnSearch = index$1.createEvent(this, "bcm-on-search", 7);
226
+ this.bcmOnSearchClear = index$1.createEvent(this, "bcm-on-search-clear", 7);
227
+ this._id = generate.Generate.UID();
228
+ this.placeholder = "Search";
229
+ this.disabled = false;
230
+ this.readonly = false;
231
+ this.clearable = true;
232
+ this.limit = 10;
233
+ this.data = [];
234
+ this.tick = {};
235
+ this.isActiveClearable = false;
236
+ this.debounceHandler = generate.Generate.debounceInput((event) => this.onSearchValue(event, this), 300, false, () => {
237
+ var _a, _b;
238
+ this.isActiveClearable = ((_b = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length) > 0 && this.clearable;
239
+ });
240
+ }
241
+ async componentDidLoad() {
242
+ await this.initState();
243
+ }
244
+ async dataChanged(newValue, oldValue) {
245
+ // console.log('data changed', newValue, oldValue)
246
+ if (newValue !== oldValue) {
247
+ await this.initState();
248
+ }
249
+ }
250
+ async initState() {
251
+ await searchState.setValue({
252
+ id: this._id,
253
+ dataSource: this.data,
254
+ });
255
+ await this.markForCheck();
256
+ }
257
+ markForCheck() {
258
+ this.tick = generate.Generate.UID();
259
+ }
260
+ handleInput() {
261
+ // console.log("aheyya")
262
+ }
263
+ async onBcmFocus() {
264
+ this.inputElement.focus();
265
+ }
266
+ async onBcmBlur() {
267
+ this.inputElement.blur();
268
+ }
269
+ async onBcmSelect() {
270
+ this.inputElement.select();
271
+ }
272
+ async setValue(newValue) {
273
+ this.inputElement.value = newValue;
274
+ }
275
+ handleFocus() { }
276
+ handleBlur() { }
277
+ handleChange() { }
278
+ async handleClear(eventEmit = true) {
279
+ this.inputElement.value = '';
280
+ const { value, id } = this.inputElement;
281
+ searchState.searchData(id, value);
282
+ this.isActiveClearable = false;
283
+ this.bcmOnSearch.emit({ result: null, value: null, matching: null, parentIndex: null });
284
+ this.bcmOnSearchClear.emit(eventEmit);
285
+ return Promise.resolve();
286
+ }
287
+ onSearchValue(event, instance) {
288
+ const { value, id } = event.target;
289
+ const searchResult = (value === null || value === void 0 ? void 0 : value.length) >= 2 ? searchState.searchData(id, value) : null;
290
+ const { bcmOnSearch, inputElement } = instance;
291
+ bcmOnSearch.emit({ result: searchResult === null || searchResult === void 0 ? void 0 : searchResult.result, value: inputElement === null || inputElement === void 0 ? void 0 : inputElement.value, matching: searchResult === null || searchResult === void 0 ? void 0 : searchResult.matching, parentIndex: searchResult === null || searchResult === void 0 ? void 0 : searchResult.parentIndex, nestedResult: searchResult === null || searchResult === void 0 ? void 0 : searchResult.nestedResult });
292
+ }
293
+ render() {
294
+ const { _id, placeholder, disabled, readonly } = this;
295
+ return index$1.h(index$1.Host, { onClick: () => { this.onBcmFocus(); this.onBcmSelect(); } }, index$1.h(InputTemplate, { size: "medium", id: _id, type: "text", placeholder: placeholder, disabled: disabled, "full-width": true, readonly: readonly, clearable: this.isActiveClearable, handleFocus: () => this.handleFocus(), handleBlur: () => this.handleBlur(), handleChange: () => this.handleChange(), handleClear: () => this.handleClear(), handleInput: this.debounceHandler, ref: (el) => this.inputElement = el }));
296
+ }
297
+ get el() { return index$1.getElement(this); }
298
+ static get watchers() { return {
299
+ "data": ["dataChanged"]
300
+ }; }
301
+ };
302
+ __decorate([
303
+ jsonParseDecarator.JsonParse('data')
304
+ ], BcmSearch2.prototype, "data", void 0);
305
+
306
+ exports.bcm_search_2 = BcmSearch2;
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index$1 = require('./index-c0971ca7.js');
6
6
  const index = require('./index-e5510943.js');
7
7
  const utils = require('./utils-cc4b560e.js');
8
+ require('./types-37c8ced6.js');
8
9
  const snq_es5 = require('./snq.es5-1a8f9645.js');
9
10
  const jsonParseDecarator = require('./json-parse-decarator-89653e78.js');
10
- require('./types-37c8ced6.js');
11
- const generate = require('./generate-debc2c44.js');
11
+ const generate = require('./generate-f1e88921.js');
12
12
  const bcm = require('./bcm-5dcc129b.js');
13
13
  require('./index-c74bd3c1.js');
14
- const stepperStates = require('./stepper-states-09ebf594.js');
14
+ const stepperStates = require('./stepper-states-4b65b027.js');
15
15
 
16
16
  const StepperHeaderTemplate = ({ title, description, status, valid, index: index$2, loading, active, stepChange, statusIcon, icon, disabled }) => {
17
17
  const classes = index.classnames('bcm-stepper__header-item', `bcm-stepper__header-item--${status}`, {
@@ -6,9 +6,9 @@ const index = require('./index-c0971ca7.js');
6
6
  const index$1 = require('./index-e5510943.js');
7
7
  const colors = require('./colors-7fb8d76f.js');
8
8
  const utils = require('./utils-cc4b560e.js');
9
- const snq_es5 = require('./snq.es5-1a8f9645.js');
10
9
  require('./types-37c8ced6.js');
11
- const generate = require('./generate-debc2c44.js');
10
+ const snq_es5 = require('./snq.es5-1a8f9645.js');
11
+ const generate = require('./generate-f1e88921.js');
12
12
  const bcm = require('./bcm-5dcc129b.js');
13
13
 
14
14
  class NumberHelper {