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