@revolist/revogrid 3.2.12 → 3.2.13

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/custom-element/index.d.ts +98 -15
  2. package/custom-element/index.js +29221 -15
  3. package/package.json +1 -1
  4. package/custom-element/_baseIteratee.js +0 -2070
  5. package/custom-element/columnService.js +0 -743
  6. package/custom-element/consts.js +0 -46
  7. package/custom-element/data.store.js +0 -545
  8. package/custom-element/debounce.js +0 -217
  9. package/custom-element/dimension.helpers.js +0 -340
  10. package/custom-element/each.js +0 -180
  11. package/custom-element/filter.button.js +0 -36
  12. package/custom-element/identity.js +0 -26
  13. package/custom-element/isSymbol.js +0 -220
  14. package/custom-element/keys.js +0 -561
  15. package/custom-element/localScrollService.js +0 -86
  16. package/custom-element/revo-grid.d.ts +0 -11
  17. package/custom-element/revo-grid.js +0 -3661
  18. package/custom-element/revogr-clipboard.d.ts +0 -11
  19. package/custom-element/revogr-clipboard.js +0 -71
  20. package/custom-element/revogr-data.d.ts +0 -11
  21. package/custom-element/revogr-data.js +0 -9
  22. package/custom-element/revogr-data2.js +0 -170
  23. package/custom-element/revogr-edit.d.ts +0 -11
  24. package/custom-element/revogr-edit.js +0 -9
  25. package/custom-element/revogr-edit2.js +0 -401
  26. package/custom-element/revogr-filter-panel.d.ts +0 -11
  27. package/custom-element/revogr-filter-panel.js +0 -307
  28. package/custom-element/revogr-focus.d.ts +0 -11
  29. package/custom-element/revogr-focus.js +0 -9
  30. package/custom-element/revogr-focus2.js +0 -63
  31. package/custom-element/revogr-header.d.ts +0 -11
  32. package/custom-element/revogr-header.js +0 -9
  33. package/custom-element/revogr-header2.js +0 -590
  34. package/custom-element/revogr-order-editor.d.ts +0 -11
  35. package/custom-element/revogr-order-editor.js +0 -9
  36. package/custom-element/revogr-order-editor2.js +0 -189
  37. package/custom-element/revogr-overlay-selection.d.ts +0 -11
  38. package/custom-element/revogr-overlay-selection.js +0 -9
  39. package/custom-element/revogr-overlay-selection2.js +0 -740
  40. package/custom-element/revogr-row-headers.d.ts +0 -11
  41. package/custom-element/revogr-row-headers.js +0 -9
  42. package/custom-element/revogr-row-headers2.js +0 -402
  43. package/custom-element/revogr-scroll-virtual.d.ts +0 -11
  44. package/custom-element/revogr-scroll-virtual.js +0 -9
  45. package/custom-element/revogr-scroll-virtual2.js +0 -134
  46. package/custom-element/revogr-temp-range.d.ts +0 -11
  47. package/custom-element/revogr-temp-range.js +0 -9
  48. package/custom-element/revogr-temp-range2.js +0 -17274
  49. package/custom-element/revogr-viewport-scroll.d.ts +0 -11
  50. package/custom-element/revogr-viewport-scroll.js +0 -9
  51. package/custom-element/revogr-viewport-scroll2.js +0 -366
  52. package/custom-element/selection.utils.js +0 -106
  53. package/custom-element/toInteger.js +0 -107
  54. package/custom-element/toNumber.js +0 -105
  55. package/custom-element/utils.js +0 -69
@@ -1,46 +0,0 @@
1
- /*!
2
- * Built by Revolist
3
- */
4
- /**
5
- * A specialized version of `_.map` for arrays without support for iteratee
6
- * shorthands.
7
- *
8
- * @private
9
- * @param {Array} [array] The array to iterate over.
10
- * @param {Function} iteratee The function invoked per iteration.
11
- * @returns {Array} Returns the new mapped array.
12
- */
13
- function arrayMap(array, iteratee) {
14
- var index = -1,
15
- length = array == null ? 0 : array.length,
16
- result = Array(length);
17
-
18
- while (++index < length) {
19
- result[index] = iteratee(array[index], index, array);
20
- }
21
- return result;
22
- }
23
-
24
- var _arrayMap = arrayMap;
25
-
26
- const MIN_COL_SIZE = 30;
27
- const DATA_COL = 'data-rgCol';
28
- const DATA_ROW = 'data-rgRow';
29
- const UUID = 'grid-uuid';
30
- const DISABLED_CLASS = 'disabled';
31
- const CELL_CLASS = 'rgCell';
32
- const HEADER_CLASS = 'rgHeaderCell';
33
- const HEADER_SORTABLE_CLASS = 'sortable';
34
- const HEADER_ROW_CLASS = 'header-rgRow';
35
- const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
36
- const DRAG_ICON_CLASS = 'revo-drag-icon';
37
- const DRAGGABLE_CLASS = 'revo-draggable';
38
- const FOCUS_CLASS = 'focused-cell';
39
- const SELECTION_BORDER_CLASS = 'selection-border-range';
40
- const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
41
- const CELL_HANDLER_CLASS = 'autofill-handle';
42
- const EDIT_INPUT_WR = 'edit-input-wrapper';
43
- const DRAGG_TEXT = 'Draggable item';
44
- const GRID_INTERNALS = '__rvgr';
45
-
46
- export { CELL_HANDLER_CLASS as C, DRAGGABLE_CLASS as D, EDIT_INPUT_WR as E, FOCUS_CLASS as F, GRID_INTERNALS as G, HEADER_CLASS as H, MIN_COL_SIZE as M, SELECTION_BORDER_CLASS as S, TMP_SELECTION_BG_CLASS as T, UUID as U, _arrayMap as _, DRAG_ICON_CLASS as a, DATA_COL as b, DATA_ROW as c, HEADER_SORTABLE_CLASS as d, HEADER_ROW_CLASS as e, HEADER_ACTUAL_ROW_CLASS as f, DRAGG_TEXT as g, CELL_CLASS as h, DISABLED_CLASS as i };
@@ -1,545 +0,0 @@
1
- /*!
2
- * Built by Revolist
3
- */
4
- import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
5
- import { t as toInteger_1, _ as _baseFindIndex, a as toFinite_1 } from './toInteger.js';
6
- import { _ as _baseIteratee, e as eq_1 } from './_baseIteratee.js';
7
- import { i as isArrayLike_1, b as _isIndex } from './keys.js';
8
- import { b as isObject_1 } from './isSymbol.js';
9
-
10
- /* Built-in method references for those with the same name as other `lodash` methods. */
11
- var nativeMax$1 = Math.max;
12
-
13
- /**
14
- * This method is like `_.find` except that it returns the index of the first
15
- * element `predicate` returns truthy for instead of the element itself.
16
- *
17
- * @static
18
- * @memberOf _
19
- * @since 1.1.0
20
- * @category Array
21
- * @param {Array} array The array to inspect.
22
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
23
- * @param {number} [fromIndex=0] The index to search from.
24
- * @returns {number} Returns the index of the found element, else `-1`.
25
- * @example
26
- *
27
- * var users = [
28
- * { 'user': 'barney', 'active': false },
29
- * { 'user': 'fred', 'active': false },
30
- * { 'user': 'pebbles', 'active': true }
31
- * ];
32
- *
33
- * _.findIndex(users, function(o) { return o.user == 'barney'; });
34
- * // => 0
35
- *
36
- * // The `_.matches` iteratee shorthand.
37
- * _.findIndex(users, { 'user': 'fred', 'active': false });
38
- * // => 1
39
- *
40
- * // The `_.matchesProperty` iteratee shorthand.
41
- * _.findIndex(users, ['active', false]);
42
- * // => 0
43
- *
44
- * // The `_.property` iteratee shorthand.
45
- * _.findIndex(users, 'active');
46
- * // => 2
47
- */
48
- function findIndex(array, predicate, fromIndex) {
49
- var length = array == null ? 0 : array.length;
50
- if (!length) {
51
- return -1;
52
- }
53
- var index = fromIndex == null ? 0 : toInteger_1(fromIndex);
54
- if (index < 0) {
55
- index = nativeMax$1(length + index, 0);
56
- }
57
- return _baseFindIndex(array, _baseIteratee(predicate), index);
58
- }
59
-
60
- var findIndex_1 = findIndex;
61
-
62
- const appendToMap = (map, propName, value) => {
63
- const items = map.get(propName);
64
- if (!items) {
65
- map.set(propName, [value]);
66
- }
67
- else if (!items.includes(value)) {
68
- items.push(value);
69
- }
70
- };
71
- const debounce = (fn, ms) => {
72
- let timeoutId;
73
- return (...args) => {
74
- if (timeoutId) {
75
- clearTimeout(timeoutId);
76
- }
77
- timeoutId = setTimeout(() => {
78
- timeoutId = 0;
79
- fn(...args);
80
- }, ms);
81
- };
82
- };
83
-
84
- /**
85
- * Check if a possible element isConnected.
86
- * The property might not be there, so we check for it.
87
- *
88
- * We want it to return true if isConnected is not a property,
89
- * otherwise we would remove these elements and would not update.
90
- *
91
- * Better leak in Edge than to be useless.
92
- */
93
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
94
- const cleanupElements = debounce((map) => {
95
- for (let key of map.keys()) {
96
- map.set(key, map.get(key).filter(isConnected));
97
- }
98
- }, 2000);
99
- const stencilSubscription = ({ on }) => {
100
- const elmsToUpdate = new Map();
101
- if (typeof getRenderingRef === 'function') {
102
- // If we are not in a stencil project, we do nothing.
103
- // This function is not really exported by @stencil/core.
104
- on('dispose', () => {
105
- elmsToUpdate.clear();
106
- });
107
- on('get', (propName) => {
108
- const elm = getRenderingRef();
109
- if (elm) {
110
- appendToMap(elmsToUpdate, propName, elm);
111
- }
112
- });
113
- on('set', (propName) => {
114
- const elements = elmsToUpdate.get(propName);
115
- if (elements) {
116
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
117
- }
118
- cleanupElements(elmsToUpdate);
119
- });
120
- on('reset', () => {
121
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
122
- cleanupElements(elmsToUpdate);
123
- });
124
- }
125
- };
126
-
127
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
128
- let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
129
- const handlers = {
130
- dispose: [],
131
- get: [],
132
- set: [],
133
- reset: [],
134
- };
135
- const reset = () => {
136
- states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
137
- handlers.reset.forEach((cb) => cb());
138
- };
139
- const dispose = () => {
140
- // Call first dispose as resetting the state would
141
- // cause less updates ;)
142
- handlers.dispose.forEach((cb) => cb());
143
- reset();
144
- };
145
- const get = (propName) => {
146
- handlers.get.forEach((cb) => cb(propName));
147
- return states.get(propName);
148
- };
149
- const set = (propName, value) => {
150
- const oldValue = states.get(propName);
151
- if (shouldUpdate(value, oldValue, propName)) {
152
- states.set(propName, value);
153
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
154
- }
155
- };
156
- const state = (typeof Proxy === 'undefined'
157
- ? {}
158
- : new Proxy(defaultState, {
159
- get(_, propName) {
160
- return get(propName);
161
- },
162
- ownKeys(_) {
163
- return Array.from(states.keys());
164
- },
165
- getOwnPropertyDescriptor() {
166
- return {
167
- enumerable: true,
168
- configurable: true,
169
- };
170
- },
171
- has(_, propName) {
172
- return states.has(propName);
173
- },
174
- set(_, propName, value) {
175
- set(propName, value);
176
- return true;
177
- },
178
- }));
179
- const on = (eventName, callback) => {
180
- handlers[eventName].push(callback);
181
- return () => {
182
- removeFromArray(handlers[eventName], callback);
183
- };
184
- };
185
- const onChange = (propName, cb) => {
186
- const unSet = on('set', (key, newValue) => {
187
- if (key === propName) {
188
- cb(newValue);
189
- }
190
- });
191
- const unReset = on('reset', () => cb(defaultState[propName]));
192
- return () => {
193
- unSet();
194
- unReset();
195
- };
196
- };
197
- const use = (...subscriptions) => subscriptions.forEach((subscription) => {
198
- if (subscription.set) {
199
- on('set', subscription.set);
200
- }
201
- if (subscription.get) {
202
- on('get', subscription.get);
203
- }
204
- if (subscription.reset) {
205
- on('reset', subscription.reset);
206
- }
207
- });
208
- return {
209
- state,
210
- get,
211
- set,
212
- on,
213
- onChange,
214
- use,
215
- dispose,
216
- reset,
217
- };
218
- };
219
- const removeFromArray = (array, item) => {
220
- const index = array.indexOf(item);
221
- if (index >= 0) {
222
- array[index] = array[array.length - 1];
223
- array.length--;
224
- }
225
- };
226
-
227
- const createStore = (defaultState, shouldUpdate) => {
228
- const map = createObservableMap(defaultState, shouldUpdate);
229
- stencilSubscription(map);
230
- return map;
231
- };
232
-
233
- /* Built-in method references for those with the same name as other `lodash` methods. */
234
- var nativeCeil = Math.ceil,
235
- nativeMax = Math.max;
236
-
237
- /**
238
- * The base implementation of `_.range` and `_.rangeRight` which doesn't
239
- * coerce arguments.
240
- *
241
- * @private
242
- * @param {number} start The start of the range.
243
- * @param {number} end The end of the range.
244
- * @param {number} step The value to increment or decrement by.
245
- * @param {boolean} [fromRight] Specify iterating from right to left.
246
- * @returns {Array} Returns the range of numbers.
247
- */
248
- function baseRange(start, end, step, fromRight) {
249
- var index = -1,
250
- length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
251
- result = Array(length);
252
-
253
- while (length--) {
254
- result[fromRight ? length : ++index] = start;
255
- start += step;
256
- }
257
- return result;
258
- }
259
-
260
- var _baseRange = baseRange;
261
-
262
- /**
263
- * Checks if the given arguments are from an iteratee call.
264
- *
265
- * @private
266
- * @param {*} value The potential iteratee value argument.
267
- * @param {*} index The potential iteratee index or key argument.
268
- * @param {*} object The potential iteratee object argument.
269
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
270
- * else `false`.
271
- */
272
- function isIterateeCall(value, index, object) {
273
- if (!isObject_1(object)) {
274
- return false;
275
- }
276
- var type = typeof index;
277
- if (type == 'number'
278
- ? (isArrayLike_1(object) && _isIndex(index, object.length))
279
- : (type == 'string' && index in object)
280
- ) {
281
- return eq_1(object[index], value);
282
- }
283
- return false;
284
- }
285
-
286
- var _isIterateeCall = isIterateeCall;
287
-
288
- /**
289
- * Creates a `_.range` or `_.rangeRight` function.
290
- *
291
- * @private
292
- * @param {boolean} [fromRight] Specify iterating from right to left.
293
- * @returns {Function} Returns the new range function.
294
- */
295
- function createRange(fromRight) {
296
- return function(start, end, step) {
297
- if (step && typeof step != 'number' && _isIterateeCall(start, end, step)) {
298
- end = step = undefined;
299
- }
300
- // Ensure the sign of `-0` is preserved.
301
- start = toFinite_1(start);
302
- if (end === undefined) {
303
- end = start;
304
- start = 0;
305
- } else {
306
- end = toFinite_1(end);
307
- }
308
- step = step === undefined ? (start < end ? 1 : -1) : toFinite_1(step);
309
- return _baseRange(start, end, step, fromRight);
310
- };
311
- }
312
-
313
- var _createRange = createRange;
314
-
315
- /**
316
- * Creates an array of numbers (positive and/or negative) progressing from
317
- * `start` up to, but not including, `end`. A step of `-1` is used if a negative
318
- * `start` is specified without an `end` or `step`. If `end` is not specified,
319
- * it's set to `start` with `start` then set to `0`.
320
- *
321
- * **Note:** JavaScript follows the IEEE-754 standard for resolving
322
- * floating-point values which can produce unexpected results.
323
- *
324
- * @static
325
- * @since 0.1.0
326
- * @memberOf _
327
- * @category Util
328
- * @param {number} [start=0] The start of the range.
329
- * @param {number} end The end of the range.
330
- * @param {number} [step=1] The value to increment or decrement by.
331
- * @returns {Array} Returns the range of numbers.
332
- * @see _.inRange, _.rangeRight
333
- * @example
334
- *
335
- * _.range(4);
336
- * // => [0, 1, 2, 3]
337
- *
338
- * _.range(-4);
339
- * // => [0, -1, -2, -3]
340
- *
341
- * _.range(1, 5);
342
- * // => [1, 2, 3, 4]
343
- *
344
- * _.range(0, 20, 5);
345
- * // => [0, 5, 10, 15]
346
- *
347
- * _.range(0, -4, -1);
348
- * // => [0, -1, -2, -3]
349
- *
350
- * _.range(1, 4, 0);
351
- * // => [1, 1, 1]
352
- *
353
- * _.range(0);
354
- * // => []
355
- */
356
- var range = _createRange();
357
-
358
- var range_1 = range;
359
-
360
- /**
361
- * Hide items from main collection
362
- * But keep them in store
363
- */
364
- const trimmedPlugin = (store) => ({
365
- set(k, newVal) {
366
- switch (k) {
367
- case 'trimmed':
368
- const proxy = store.get('proxyItems');
369
- const trimmed = gatherTrimmedItems(newVal);
370
- const newItems = proxy.reduce((result, v) => {
371
- // check if present in new trimmed remove from items (filter)
372
- if (!trimmed[v]) {
373
- result.push(v);
374
- }
375
- return result;
376
- }, []);
377
- store.set('items', newItems);
378
- break;
379
- }
380
- },
381
- });
382
- function gatherTrimmedItems(trimmedItems) {
383
- const trimmed = {};
384
- for (let trimmedKey in trimmedItems) {
385
- // trimmed overweight not trimmed
386
- for (let t in trimmedItems[trimmedKey]) {
387
- trimmed[t] = trimmed[t] || trimmedItems[trimmedKey][t];
388
- }
389
- }
390
- return trimmed;
391
- }
392
-
393
- /** Set stores data */
394
- function setStore(store, data) {
395
- for (let key in data) {
396
- store.set(key, data[key]);
397
- }
398
- }
399
-
400
- /**
401
- * All items
402
- * Used as proxy for sorting
403
- * Keep order but do not modify final source
404
- */
405
- const proxyPlugin = (store) => ({
406
- set(k, newVal) {
407
- if (!isProxy(k)) {
408
- return;
409
- }
410
- /**
411
- * Getting existing collection of items
412
- * Mark indexes as visible
413
- */
414
- const oldItems = store.get('items').reduce((r, v) => {
415
- r[v] = true;
416
- return r;
417
- }, {});
418
- /**
419
- * Check if new values where present in items
420
- * Filter item collection according presense
421
- */
422
- const newItems = newVal.reduce((r, i) => {
423
- if (oldItems[i]) {
424
- r.push(i);
425
- }
426
- return r;
427
- }, []);
428
- store.set('items', newItems);
429
- },
430
- });
431
- function isProxy(k) {
432
- return k === 'proxyItems';
433
- }
434
-
435
- class DataStore {
436
- constructor(type) {
437
- const store = (this.dataStore = createStore({
438
- items: [],
439
- proxyItems: [],
440
- source: [],
441
- groupingDepth: 0,
442
- groups: {},
443
- type,
444
- trimmed: {},
445
- }));
446
- store.use(proxyPlugin(store));
447
- store.use(trimmedPlugin(store));
448
- }
449
- get store() {
450
- return this.dataStore;
451
- }
452
- /**
453
- * full data source update
454
- * @param source - data column/rgRow source
455
- * @param grouping - grouping information if present
456
- */
457
- updateData(source, grouping, silent = false) {
458
- // during full update we do drop trim
459
- if (!silent) {
460
- this.store.set('trimmed', {});
461
- }
462
- // clear items
463
- this.store.set('items', []);
464
- const items = range_1(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
465
- // set proxy first
466
- setStore(this.store, {
467
- source,
468
- proxyItems: [...items],
469
- });
470
- // update data items
471
- this.store.set('items', items);
472
- // apply grooping if present
473
- if (grouping) {
474
- setStore(this.store, {
475
- groupingDepth: grouping.depth,
476
- groups: grouping.groups,
477
- });
478
- }
479
- }
480
- addTrimmed(some) {
481
- let trimmed = this.store.get('trimmed');
482
- trimmed = Object.assign(Object.assign({}, trimmed), some);
483
- setStore(this.store, { trimmed });
484
- }
485
- // local data update
486
- setData(input) {
487
- const data = Object.assign({}, input);
488
- setStore(this.store, data);
489
- }
490
- refresh() {
491
- const source = this.store.get('source');
492
- this.store.set('source', [...source]);
493
- }
494
- }
495
- /**
496
- * get physical index by virtual
497
- * @param store - store to process
498
- */
499
- function getPhysical(store, virtualIndex) {
500
- const items = store.get('items');
501
- return items[virtualIndex];
502
- }
503
- /**
504
- * get all visible items
505
- * @param store - store to process
506
- */
507
- function getVisibleSourceItem(store) {
508
- const source = store.get('source');
509
- return store.get('items').map(v => source[v]);
510
- }
511
- /**
512
- * get mapped item from source
513
- * @param store - store to process
514
- * @param virtualIndex - virtual index to process
515
- */
516
- function getSourceItem(store, virtualIndex) {
517
- const items = store.get('items');
518
- const source = store.get('source');
519
- return source[items[virtualIndex]];
520
- }
521
- /**
522
- * set item to source
523
- * @param store - store to process
524
- * @param modelByIndex - collection of rows with virtual indexes to setup
525
- */
526
- function setSourceByVirtualIndex(store, modelByIndex) {
527
- const items = store.get('items');
528
- const source = store.get('source');
529
- for (let virtualIndex in modelByIndex) {
530
- const realIndex = items[virtualIndex];
531
- source[realIndex] = modelByIndex[virtualIndex];
532
- }
533
- store.set('source', [...source]);
534
- }
535
- function setItems(store, items) {
536
- store.set('items', items);
537
- }
538
- function getSourceItemVirtualIndexByProp(store, prop) {
539
- const items = store.get('items');
540
- const source = store.get('source');
541
- const physicalIndex = findIndex_1(source, { prop });
542
- return items.indexOf(physicalIndex);
543
- }
544
-
545
- export { DataStore as D, _isIterateeCall as _, getSourceItemVirtualIndexByProp as a, getVisibleSourceItem as b, createStore as c, setStore as d, getPhysical as e, findIndex_1 as f, getSourceItem as g, setItems as h, setSourceByVirtualIndex as s };