@hestia-earth/ui-components 0.0.7 → 0.0.10

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 (66) hide show
  1. package/README.md +5 -22
  2. package/bibliographies/bibliographies-search-confirm/bibliographies-search-confirm.component.d.ts +1 -1
  3. package/bundles/hestia-earth-ui-components.umd.js +2339 -806
  4. package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
  5. package/common/blank-node-state/blank-node-state.component.d.ts +2 -2
  6. package/common/common.light.module.d.ts +19 -0
  7. package/common/common.module.d.ts +10 -19
  8. package/common/delta-utils.d.ts +1 -1
  9. package/common/index.d.ts +1 -0
  10. package/common/link-key-value/link-key-value.component.d.ts +1 -1
  11. package/common/maps-utils.d.ts +2 -2
  12. package/common/precision.pipe.d.ts +1 -1
  13. package/common/tags-input.directive.d.ts +1 -1
  14. package/common/utils.d.ts +7 -7
  15. package/cycles/cycles-emissions-chart/cycles-emissions-chart.component.d.ts +2 -2
  16. package/cycles/cycles-suggest-form/cycles-suggest-form.component.d.ts +1 -2
  17. package/cycles/cycles.model.d.ts +1 -1
  18. package/engine/aggregation-engine.service.d.ts +2 -2
  19. package/engine/engine.service.d.ts +5 -4
  20. package/esm2015/common/common.light.module.js +66 -0
  21. package/esm2015/common/common.module.js +11 -47
  22. package/esm2015/common/index.js +2 -1
  23. package/esm2015/common/tags-input.directive.js +3 -3
  24. package/esm2015/common/utils.js +1 -2
  25. package/esm2015/engine/engine.service.js +10 -6
  26. package/esm2015/tags-input/defaultOptions.js +26 -0
  27. package/esm2015/tags-input/index.js +1053 -0
  28. package/esm2015/tags-input/templates/dropdown-item.js +3 -0
  29. package/esm2015/tags-input/templates/tag.js +6 -0
  30. package/esm2015/tags-input/templates/wrapper.js +10 -0
  31. package/esm2015/tags-input/utils/component.js +80 -0
  32. package/esm2015/tags-input/utils/dom.js +98 -0
  33. package/esm2015/tags-input/utils/events.js +147 -0
  34. package/esm2015/tags-input/utils/type.js +41 -0
  35. package/esm2015/tags-input/utils/uuid.js +3 -0
  36. package/fesm2015/hestia-earth-ui-components.js +1977 -499
  37. package/fesm2015/hestia-earth-ui-components.js.map +1 -1
  38. package/files/files-error.model.d.ts +5 -5
  39. package/files/files-form/files-form.component.d.ts +7 -7
  40. package/files/files-form.model.d.ts +10 -10
  41. package/impact-assessments/impact-assessments-indicators-chart/impact-assessments-indicators-chart.component.d.ts +2 -2
  42. package/impact-assessments/impact-assessments-products/impact-assessments-products.component.d.ts +2 -2
  43. package/node/node-icon/node-icon.component.d.ts +1 -1
  44. package/node/node-link/node-link.component.d.ts +1 -1
  45. package/node/node-logs-models/node-logs-models.component.d.ts +1 -1
  46. package/node/node.service.d.ts +2 -2
  47. package/package.json +1 -2
  48. package/schema/schema.service.d.ts +1 -1
  49. package/search/search.model.d.ts +18 -17
  50. package/search/search.service.d.ts +7 -7
  51. package/sites/sites-maps/sites-maps.component.d.ts +1 -1
  52. package/sites/sites-measurements/sites-measurements.component.d.ts +1 -1
  53. package/sites/sites.model.d.ts +1 -1
  54. package/styles.scss +1 -1
  55. package/tags-input/defaultOptions.d.ts +25 -0
  56. package/tags-input/index.d.ts +277 -0
  57. package/tags-input/styles.sass +154 -0
  58. package/tags-input/templates/dropdown-item.d.ts +2 -0
  59. package/tags-input/templates/tag.d.ts +2 -0
  60. package/tags-input/templates/wrapper.d.ts +2 -0
  61. package/tags-input/utils/component.d.ts +22 -0
  62. package/tags-input/utils/dom.d.ts +38 -0
  63. package/tags-input/utils/events.d.ts +72 -0
  64. package/tags-input/utils/type.d.ts +17 -0
  65. package/tags-input/utils/uuid.d.ts +2 -0
  66. package/terms/terms.model.d.ts +1 -1
@@ -0,0 +1,277 @@
1
+ import Component from './utils/component';
2
+ export default class BulmaTagsInput extends Component {
3
+ private _items;
4
+ private _selected;
5
+ private _isSelect;
6
+ private _isMultiple;
7
+ private _objectItems;
8
+ private _input;
9
+ private _manualInputAllowed;
10
+ private _filterInputAllowed;
11
+ private source;
12
+ private container;
13
+ private dropdown;
14
+ private dropdownEmptyOption;
15
+ constructor(element: any, options?: {});
16
+ /**
17
+ * Initiate all DOM element corresponding to selector
18
+ *
19
+ * @method
20
+ * @return Array of all Plugin instances
21
+ */
22
+ static attach(selector?: string, options?: {}, container?: any): any[];
23
+ /**
24
+ * Initiate plugin
25
+ *
26
+ * @method init
27
+ * @return
28
+ */
29
+ _init(): void;
30
+ /**
31
+ * Build TagsInput DOM elements
32
+ */
33
+ _build(): void;
34
+ /**
35
+ * Bind all events listener
36
+ */
37
+ _bindEvents(): void;
38
+ /**
39
+ * Check if caret is at the beginning of the input value
40
+ */
41
+ _caretAtStart(): boolean;
42
+ /**
43
+ * Check value length constraint if option activated
44
+ *
45
+ * @param item
46
+ */
47
+ _checkLength(item: any): boolean;
48
+ /**
49
+ * Close dropdown
50
+ */
51
+ _closeDropdown(): void;
52
+ /**
53
+ * Create a new dropdown item based on given item data
54
+ *
55
+ * @param item
56
+ */
57
+ _createDropdownItem(item: any): void;
58
+ /**
59
+ * Create a new tag and add it to the DOM
60
+ *
61
+ * @param string value
62
+ */
63
+ _createTag(item: any): void;
64
+ /**
65
+ * Remove all dropdown items except the empty title
66
+ */
67
+ _emptyDropdown(): void;
68
+ /**
69
+ * Find needle into a string and wrap it with <mark> HTML tag
70
+ *
71
+ * @param string
72
+ * @param needle
73
+ */
74
+ _highlightMatchesInString(string: any, needle: any): any;
75
+ /**
76
+ * Open dropdown
77
+ */
78
+ _openDropdown(): void;
79
+ /**
80
+ * Propagate internal input changes to the original input
81
+ */
82
+ _propagateChange(): void;
83
+ /**
84
+ * Trim value if option activated
85
+ *
86
+ * @param item
87
+ */
88
+ _trim(item: any): any;
89
+ /**
90
+ * Filter Dropdown items to be compliant with already selected items and current input value
91
+ * Filtering is made on Text by default (can be changed with option)
92
+ */
93
+ _filterDropdownItems(value?: any): boolean;
94
+ /**
95
+ * Update original select option based on given item
96
+ *
97
+ * @param item
98
+ */
99
+ _updateSelectOptions(item: any): void;
100
+ /**
101
+ * Add given item
102
+ * item = 'john'
103
+ * item = 'john,jane'
104
+ * item = ['john', 'jane']
105
+ * item = [{
106
+ * "value": "1",
107
+ * "text": "John"
108
+ * }, {
109
+ * "value": "2",
110
+ * "text": "Jane"
111
+ * }]
112
+ *
113
+ * @param item
114
+ * @param silently Should the change be propagated to the original element
115
+ */
116
+ add(items: any, silently?: boolean): this;
117
+ /**
118
+ * Unselect the selected item
119
+ */
120
+ clearSelection(): this;
121
+ /**
122
+ * Shortcut to removeAll method
123
+ */
124
+ flush(): this;
125
+ /**
126
+ * Sets focus on the input
127
+ */
128
+ focus(): this;
129
+ /**
130
+ * Check if given item is present
131
+ *
132
+ * @param item
133
+ */
134
+ has(item: any): boolean;
135
+ /**
136
+ * Check if given text is present
137
+ *
138
+ * @param value
139
+ */
140
+ hasText(value: any): boolean;
141
+ /**
142
+ * Check if given value is present
143
+ *
144
+ * @param value
145
+ */
146
+ hasValue(value: any): boolean;
147
+ /**
148
+ * Get index of given item
149
+ *
150
+ * @param item
151
+ */
152
+ indexOf(item: any): number;
153
+ /**
154
+ * Returns the internal input element
155
+ */
156
+ input(): any;
157
+ /**
158
+ * Get items
159
+ */
160
+ items(): any[];
161
+ /**
162
+ * Remove given item
163
+ * item = 'john'
164
+ * item = 'john,jane'
165
+ *
166
+ * @param String item
167
+ */
168
+ remove(items: any): this;
169
+ /**
170
+ * Remove all tags at once
171
+ */
172
+ removeAll(): this;
173
+ /**
174
+ * Remove item at given index
175
+ *
176
+ * @param Integer index
177
+ */
178
+ removeAtIndex(index: any, clearSelection?: boolean): this;
179
+ /**
180
+ * Select given item
181
+ *
182
+ * @param item
183
+ */
184
+ select(items: any): this;
185
+ /**
186
+ * Select tag at given index
187
+ *
188
+ * @param Integer index
189
+ */
190
+ selectAtIndex(index: any): this;
191
+ /**
192
+ * Get selected item
193
+ */
194
+ get selected(): any;
195
+ /**
196
+ * Get selected item index
197
+ */
198
+ get selectedIndex(): any;
199
+ /**
200
+ * Get value
201
+ */
202
+ get value(): string | any[];
203
+ /**
204
+ * Set value
205
+ */
206
+ set value(string: string | any[]);
207
+ /**
208
+ * Document click event handler
209
+ *
210
+ * @param e
211
+ */
212
+ _onDocumentClick(e: any): void;
213
+ /**
214
+ * Input focus lost event handler
215
+ *
216
+ * @param e
217
+ */
218
+ _onDropdownItemClick(e: any): void;
219
+ /**
220
+ * Input change event handler
221
+ *
222
+ * @param e
223
+ */
224
+ _onInputChange(e: any): void;
225
+ /**
226
+ * Input click event handler
227
+ *
228
+ * @param e
229
+ */
230
+ _onInputClick(e: any): void;
231
+ /**
232
+ * Input focus event handler
233
+ *
234
+ * @param e
235
+ */
236
+ _onInputFocusIn(e: any): boolean;
237
+ /**
238
+ * Input focus lost event handler
239
+ *
240
+ * @param e
241
+ */
242
+ _onInputFocusOut(e: any): void;
243
+ /**
244
+ * Input Keydown event handler
245
+ *
246
+ * @param e
247
+ */
248
+ _onInputKeyDown(e: any): void;
249
+ /**
250
+ * Input Keypress event handler
251
+ *
252
+ * @param e
253
+ */
254
+ _onInputKeyPress(e: any): boolean;
255
+ /**
256
+ * Original input change event handler
257
+ * CAUTION: because original input is now hidden the change event must be triggered manually on change
258
+ * Example how to trigger change event manually
259
+ * var changeEvent = new Event('change');
260
+ * input.dispatchEvent(changeEvent);
261
+ *
262
+ * @param e
263
+ */
264
+ _onOriginalInputChange(e: any): void;
265
+ /**
266
+ * Tag click event handler
267
+ *
268
+ * @param e
269
+ */
270
+ _onTagClick(e: any): boolean;
271
+ /**
272
+ * Delete tag button click event handler
273
+ *
274
+ * @param e
275
+ */
276
+ _onTagDeleteClick(e: any): boolean;
277
+ }
@@ -0,0 +1,154 @@
1
+ @charset "utf-8"
2
+
3
+ $tagsinput-selected-background-color: $primary !default
4
+ $tagsinput-duplicate-animation: blinker .75s linear infinite !default
5
+
6
+ .tags-input
7
+ @extend %input
8
+ align-content: flex-start
9
+ display: flex
10
+ flex-wrap: wrap
11
+ height: auto
12
+ min-height: auto
13
+ padding: 0
14
+ position: relative
15
+
16
+ .tag
17
+ font-size: $size-normal
18
+ margin: .1rem
19
+ &:hover
20
+ cursor: pointer
21
+ &.is-selected
22
+ background-color: $tagsinput-selected-background-color
23
+ color: findColorInvert($tagsinput-selected-background-color)
24
+
25
+ &.is-duplicate
26
+ animation: $tagsinput-duplicate-animation
27
+
28
+ .input
29
+ border-color: transparent
30
+ border: 0
31
+ box-shadow: none
32
+ display: inline-block
33
+ flex: 1 0 auto
34
+ height: initial
35
+ margin: initial
36
+ width: auto
37
+
38
+ &.is-filter
39
+ input
40
+ color: $input-placeholder-color
41
+
42
+ +placeholder
43
+ color: $input-placeholder-color
44
+ &.no-input
45
+ input
46
+ color: transparent
47
+ text-shadow: 0 0 0 $input-placeholder-color
48
+
49
+ +placeholder
50
+ color: $input-placeholder-color
51
+ text-shadow: none
52
+
53
+ .dropdown-menu
54
+ width: 100%
55
+
56
+ .dropdown-content
57
+ max-height: 250px
58
+ overflow: hidden
59
+ overflow-y: auto
60
+
61
+ &.is-loading
62
+ &::after
63
+ @extend %loader
64
+ left: 50%
65
+ position: absolute !important
66
+ top: 50%
67
+ transform: translate(-50%, -50%)
68
+ z-index: 4
69
+ &::before
70
+ background-color: rgba($background, .5)
71
+ content: ""
72
+ height: 100%
73
+ left: 0
74
+ position: absolute
75
+ top: 0
76
+ width: 100%
77
+ z-index: 3
78
+
79
+ .dropdown-item
80
+ &:not(.empty-title)
81
+ &:hover
82
+ cursor: pointer
83
+
84
+ &.empty-title
85
+ color: $input-disabled-color
86
+ text-align: center
87
+
88
+ &:hover
89
+ background: inherit
90
+ color: $input-disabled-color
91
+
92
+ mark
93
+ &.is-highlighted
94
+ background-color: $warning
95
+
96
+ &.is-small
97
+ .tag
98
+ font-size: $size-small
99
+ .input
100
+ +control-small
101
+ &.is-medium
102
+ .tag
103
+ font-size: $size-medium
104
+ .input
105
+ +control-medium
106
+ &.is-large
107
+ .tag
108
+ font-size: $size-large
109
+ .input
110
+ +control-large
111
+
112
+ &.is-disabled,
113
+ &[disabled]
114
+ background-color: $input-disabled-background-color
115
+ border-color: $input-disabled-border-color
116
+ box-shadow: none
117
+ color: $input-disabled-color
118
+ cursor: not-allowed
119
+
120
+ .tag
121
+ background-color: ligthen($input-disabled-background-color, 5%)
122
+ color: $input-disabled-color
123
+ cursor: not-allowed
124
+ .delete
125
+ background-color: darken($input-disabled-background-color, 5%)
126
+ border-color: darken($input-disabled-border-color, 5%)
127
+ box-shadow: none
128
+ color: $input-disabled-color
129
+ cursor: not-allowed
130
+
131
+ .input
132
+ background-color: $input-disabled-background-color
133
+ border-color: $input-disabled-border-color
134
+ box-shadow: none
135
+ color: $input-disabled-color
136
+
137
+ +placeholder
138
+ color: $input-disabled-placeholder-color
139
+
140
+ &[readonly]
141
+ .input
142
+ box-shadow: none
143
+
144
+ &.is-active
145
+ .dropdown-menu
146
+ display: block
147
+
148
+ @keyframes blinker
149
+ 0%
150
+ opacity: 1.0
151
+ 50%
152
+ opacity: 0.0
153
+ 100%
154
+ opacity: 1.0
@@ -0,0 +1,2 @@
1
+ declare const _default: (data: any) => string;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (data: any) => string;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (data: any) => string;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import EventEmitter from './events';
2
+ export default class Component extends EventEmitter {
3
+ protected element: any;
4
+ protected id: string;
5
+ protected options: any;
6
+ constructor(element: any, options?: {}, defaultOptions?: {});
7
+ /**
8
+ * Initiate all DOM element corresponding to selector
9
+ *
10
+ * @method
11
+ * @return Array of all Plugin instances
12
+ */
13
+ static attach(selector?: any, options?: {}, node?: any): any[];
14
+ /**
15
+ * Observe DOM mutations to automatically initialize plugin on new elements when added to the DOM
16
+ *
17
+ * @param selector
18
+ * @param options
19
+ */
20
+ static observeDom(selector: any, options: any): void;
21
+ static _interface(name?: any, options?: {}): any;
22
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * querySelector under steroid
3
+ * Can use as selector:
4
+ * - function
5
+ * - DOM Node
6
+ * - String
7
+ *
8
+ * @param selector
9
+ * @param node
10
+ */
11
+ export declare const querySelector: (selector: any, node: any) => any;
12
+ /**
13
+ * querySelectorAll under steroid
14
+ * Can use as selector:
15
+ * - function
16
+ * - DOM Node
17
+ * - String
18
+ *
19
+ * @param selector
20
+ * @param node
21
+ */
22
+ export declare const querySelectorAll: (selector: any, node: any) => any;
23
+ export declare const optionsFromDataset: (node: any, defaultOptions?: {}) => {};
24
+ /**
25
+ * Copy HTML attributes from a source element to a target element
26
+ *
27
+ * @param target
28
+ * @param source
29
+ * @param except list of attributes to skip (separated by space)
30
+ */
31
+ export declare const cloneAttributes: (target: any, source: any, except?: any) => void;
32
+ /**
33
+ * Escapes string for insertion into HTML, replacing special characters with HTML
34
+ * entities.
35
+ *
36
+ * @param string
37
+ */
38
+ export declare const escape: (string: any) => any;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @class EventEmitter
3
+ *
4
+ * @property {Array} _listeners
5
+ */
6
+ export default class EventEmitter {
7
+ private _listeners;
8
+ /**
9
+ * Construct EventEmitter
10
+ *
11
+ * @param listeners
12
+ */
13
+ constructor(listeners?: any[]);
14
+ /**
15
+ * Destroys EventEmitter
16
+ */
17
+ destroy(): void;
18
+ /**
19
+ * Count listeners registered for the provided eventName
20
+ *
21
+ * @param eventName
22
+ */
23
+ listenerCount(eventName: any): any;
24
+ /**
25
+ * Subscribes on event eventName specified function
26
+ *
27
+ * @param eventName
28
+ * @param listener
29
+ */
30
+ on(eventName: any, listener: any): void;
31
+ /**
32
+ * Subscribes on event name specified function to fire only once
33
+ *
34
+ * @param eventName
35
+ * @param listener
36
+ */
37
+ once(eventName: any, listener: any): void;
38
+ /**
39
+ * Removes event with specified eventName.
40
+ *
41
+ * @param eventName
42
+ */
43
+ off(eventName: any): void;
44
+ /**
45
+ * Emits event with specified name and params.
46
+ *
47
+ * @param eventName
48
+ * @param eventArgs
49
+ */
50
+ emit(eventName: any, ...eventArgs: any[]): any;
51
+ /**
52
+ * Register a new listener
53
+ *
54
+ * @param eventName
55
+ * @param listener
56
+ * @param once
57
+ */
58
+ _addListener(eventName: any, listener: any, once?: boolean): void;
59
+ /**
60
+ *
61
+ * @param eventName
62
+ */
63
+ _removeListeners(eventName?: any): void;
64
+ /**
65
+ * Applies arguments to specified event
66
+ *
67
+ * @param eventName
68
+ * @param eventArguments
69
+ * @protected
70
+ */
71
+ _applyEvents(eventName: any, eventArguments: any): any;
72
+ }
@@ -0,0 +1,17 @@
1
+ export declare const isFunction: (unknown: any) => boolean;
2
+ export declare const isString: (unknown: any) => boolean;
3
+ export declare const isObject: (unknown: any) => boolean;
4
+ export declare const isPromise: (value: any) => boolean;
5
+ export declare const isNode: (unknown: any) => boolean;
6
+ /**
7
+ * Convert String (false,False,True,true,no,yes,0,1) to real Boolean
8
+ *
9
+ * @param val
10
+ */
11
+ export declare const BooleanParse: (val: any) => boolean;
12
+ /**
13
+ * Check if given query selector is valid
14
+ *
15
+ * @param selector
16
+ */
17
+ export declare const isSelectorValid: (selector: any) => boolean;
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefix?: string) => string;
2
+ export default _default;
@@ -1,6 +1,6 @@
1
1
  import { Term, ITermJSONLD, TermTermType } from '@hestia-earth/schema';
2
2
  export declare const termProperties: (term: Term | ITermJSONLD) => string[];
3
- export declare const findPropertyById: ({ defaultProperties }: Term | ITermJSONLD, key: keyof ITermJSONLD) => import("@hestia-earth/schema").Property | undefined;
3
+ export declare const findPropertyById: ({ defaultProperties }: Term | ITermJSONLD, key: keyof ITermJSONLD) => import("@hestia-earth/schema").Property;
4
4
  export declare const termLocationName: ({ gadmFullName }: Term | ITermJSONLD) => {
5
5
  name: string;
6
6
  };