@revolist/revogrid 4.9.9 → 4.9.11
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/cjs/column.drag.plugin-e636b5af.js +1686 -0
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +1 -0
- package/dist/cjs/{column.service-bfaba0e0.js → column.service-15c8352d.js} +443 -56
- package/dist/cjs/column.service-15c8352d.js.map +1 -0
- package/dist/cjs/{toNumber-838e6ff5.js → debounce-cb5f4e35.js} +229 -12
- package/dist/cjs/debounce-cb5f4e35.js.map +1 -0
- package/dist/cjs/{edit.utils-983f1a82.js → edit.utils-1172677c.js} +2 -2
- package/dist/cjs/{edit.utils-983f1a82.js.map → edit.utils-1172677c.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-53e4fd75.js → header-cell-renderer-375a879f.js} +42 -4
- package/dist/cjs/header-cell-renderer-375a879f.js.map +1 -0
- package/dist/cjs/{index-464d1aaf.js → index-28b6fdfb.js} +31 -31
- package/dist/cjs/{index-464d1aaf.js.map → index-28b6fdfb.js.map} +1 -1
- package/dist/cjs/index.cjs.js +39 -28
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-12715159.js → key.utils-c62ab1e1.js} +2 -12
- package/dist/cjs/key.utils-c62ab1e1.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +704 -2034
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +17 -18
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +6 -77
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +117 -123
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -2
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-e71dc7bf.js → row-header-utils-22ffee54.js} +2 -2
- package/dist/cjs/{row-header-utils-e71dc7bf.js.map → row-header-utils-22ffee54.js.map} +1 -1
- package/dist/cjs/sorting.sign-8bf92449.js +19 -0
- package/dist/cjs/sorting.sign-8bf92449.js.map +1 -0
- package/dist/cjs/text-editor-91a9f5b5.js +82 -0
- package/dist/cjs/text-editor-91a9f5b5.js.map +1 -0
- package/dist/cjs/{throttle-c893457e.js → throttle-5da5df51.js} +4 -5
- package/dist/cjs/throttle-5da5df51.js.map +1 -0
- package/dist/cjs/viewport.helpers-e59a544e.js +58 -0
- package/dist/cjs/viewport.helpers-e59a544e.js.map +1 -0
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +2 -2
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +6 -0
- package/dist/collection/index.js +2 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/plugins/index.js +16 -0
- package/dist/collection/plugins/index.js.map +1 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/utils/key.utils.js +0 -9
- package/dist/collection/utils/key.utils.js.map +1 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js +1665 -0
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/esm/{column.service-6f1faf2d.js → column.service-414e9cba.js} +435 -51
- package/dist/esm/column.service-414e9cba.js.map +1 -0
- package/dist/esm/{toNumber-8de324a7.js → debounce-e8e9464a.js} +229 -13
- package/dist/esm/debounce-e8e9464a.js.map +1 -0
- package/dist/esm/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/esm/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-66d01daa.js → header-cell-renderer-ca570fcf.js} +40 -4
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/esm/{index-c428acf6.js → index-74b9801b.js} +3 -3
- package/dist/esm/{index-c428acf6.js.map → index-74b9801b.js.map} +1 -1
- package/dist/esm/index.js +10 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{key.utils-b1f93f7e.js → key.utils-d3df5db8.js} +3 -12
- package/dist/esm/key.utils-d3df5db8.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +675 -2005
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +9 -10
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +5 -76
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +50 -56
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +1 -2
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/esm/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +1 -1
- package/dist/esm/sorting.sign-1afddea1.js +15 -0
- package/dist/esm/sorting.sign-1afddea1.js.map +1 -0
- package/dist/esm/text-editor-96d69516.js +80 -0
- package/dist/esm/text-editor-96d69516.js.map +1 -0
- package/dist/esm/{throttle-f9cda5b0.js → throttle-262c3ed2.js} +3 -4
- package/dist/esm/throttle-262c3ed2.js.map +1 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js +52 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +5 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/revo-grid/column.service-414e9cba.js +5 -0
- package/dist/revo-grid/column.service-414e9cba.js.map +1 -0
- package/dist/revo-grid/debounce-e8e9464a.js +5 -0
- package/dist/revo-grid/debounce-e8e9464a.js.map +1 -0
- package/dist/revo-grid/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js +5 -0
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/revo-grid/{index-c428acf6.js → index-74b9801b.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/key.utils-d3df5db8.js +5 -0
- package/dist/revo-grid/key.utils-d3df5db8.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/revo-grid/sorting.sign-1afddea1.js +5 -0
- package/dist/revo-grid/sorting.sign-1afddea1.js.map +1 -0
- package/dist/revo-grid/text-editor-96d69516.js +5 -0
- package/dist/revo-grid/text-editor-96d69516.js.map +1 -0
- package/dist/revo-grid/throttle-262c3ed2.js +5 -0
- package/dist/revo-grid/{throttle-f9cda5b0.js.map → throttle-262c3ed2.js.map} +1 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js +5 -0
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/types/components/editors/text-editor.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/index.d.ts +12 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +1 -13
- package/dist/types/types/selection.d.ts +1 -1
- package/dist/types/utils/key.utils.d.ts +0 -1
- package/hydrate/index.js +2 -11
- package/hydrate/index.mjs +2 -11
- package/package.json +1 -1
- package/standalone/_stringToPath.js +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +2 -2
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +7 -5
- package/standalone/index.js.map +1 -1
- package/standalone/isObjectLike.js +1 -1
- package/standalone/revo-grid.js +1948 -1948
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-edit.js +1 -1
- package/standalone/revogr-edit2.js +1 -10
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-header.js +1 -1
- package/standalone/revogr-header2.js +54 -52
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +2 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/column.service-bfaba0e0.js.map +0 -1
- package/dist/cjs/column.utils-4a450d27.js +0 -345
- package/dist/cjs/column.utils-4a450d27.js.map +0 -1
- package/dist/cjs/debounce-e2b7c6fb.js +0 -226
- package/dist/cjs/debounce-e2b7c6fb.js.map +0 -1
- package/dist/cjs/dispatcher-998aa470.js +0 -46
- package/dist/cjs/dispatcher-998aa470.js.map +0 -1
- package/dist/cjs/header-cell-renderer-53e4fd75.js.map +0 -1
- package/dist/cjs/key.utils-12715159.js.map +0 -1
- package/dist/cjs/selection.helpers-2c90d546.js +0 -450
- package/dist/cjs/selection.helpers-2c90d546.js.map +0 -1
- package/dist/cjs/throttle-c893457e.js.map +0 -1
- package/dist/cjs/toNumber-838e6ff5.js.map +0 -1
- package/dist/esm/column.service-6f1faf2d.js.map +0 -1
- package/dist/esm/column.utils-1a402ff9.js +0 -333
- package/dist/esm/column.utils-1a402ff9.js.map +0 -1
- package/dist/esm/debounce-7781346d.js +0 -224
- package/dist/esm/debounce-7781346d.js.map +0 -1
- package/dist/esm/dispatcher-ea08404f.js +0 -43
- package/dist/esm/dispatcher-ea08404f.js.map +0 -1
- package/dist/esm/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/esm/key.utils-b1f93f7e.js.map +0 -1
- package/dist/esm/selection.helpers-ac4368b0.js +0 -441
- package/dist/esm/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/esm/throttle-f9cda5b0.js.map +0 -1
- package/dist/esm/toNumber-8de324a7.js.map +0 -1
- package/dist/revo-grid/column.service-6f1faf2d.js +0 -5
- package/dist/revo-grid/column.service-6f1faf2d.js.map +0 -1
- package/dist/revo-grid/column.utils-1a402ff9.js +0 -5
- package/dist/revo-grid/column.utils-1a402ff9.js.map +0 -1
- package/dist/revo-grid/debounce-7781346d.js +0 -5
- package/dist/revo-grid/debounce-7781346d.js.map +0 -1
- package/dist/revo-grid/dispatcher-ea08404f.js +0 -5
- package/dist/revo-grid/dispatcher-ea08404f.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-66d01daa.js +0 -5
- package/dist/revo-grid/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/revo-grid/key.utils-b1f93f7e.js +0 -5
- package/dist/revo-grid/key.utils-b1f93f7e.js.map +0 -1
- package/dist/revo-grid/selection.helpers-ac4368b0.js +0 -5
- package/dist/revo-grid/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/revo-grid/throttle-f9cda5b0.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +0 -0
- /package/dist/revo-grid/{index-c428acf6.js.map → index-74b9801b.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +0 -0
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
const index = require('./index-464d1aaf.js');
|
|
7
|
-
require('./toNumber-838e6ff5.js');
|
|
8
|
-
const index$1 = require('./index-10d10c55.js');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Storing pre-calculated
|
|
12
|
-
* Dimension information and sizes
|
|
13
|
-
*/
|
|
14
|
-
const trimmedPlugin = (store) => {
|
|
15
|
-
let trimmedSize = {};
|
|
16
|
-
const setTrimmed = (sizes, trimmed) => {
|
|
17
|
-
const newSize = Object.assign({}, sizes);
|
|
18
|
-
trimmedSize = {};
|
|
19
|
-
for (const [index, v] of Object.entries(trimmed)) {
|
|
20
|
-
const i = index;
|
|
21
|
-
if (v && newSize[i]) {
|
|
22
|
-
trimmedSize[i] = newSize[i];
|
|
23
|
-
delete newSize[i];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
store.setDimensionSize(newSize);
|
|
27
|
-
};
|
|
28
|
-
return {
|
|
29
|
-
set(key, val) {
|
|
30
|
-
switch (key) {
|
|
31
|
-
case 'trimmed':
|
|
32
|
-
const trim = val;
|
|
33
|
-
const sizes = store.store.get('sizes');
|
|
34
|
-
// recover trimmed, apply new trim
|
|
35
|
-
setTrimmed(Object.assign(Object.assign({}, sizes), trimmedSize), trim);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const realSizePlugin = (store) => {
|
|
42
|
-
return {
|
|
43
|
-
set(k) {
|
|
44
|
-
switch (k) {
|
|
45
|
-
case 'count':
|
|
46
|
-
case 'sizes':
|
|
47
|
-
case 'originItemSize':
|
|
48
|
-
let realSize = 0;
|
|
49
|
-
const count = store.store.get('count');
|
|
50
|
-
for (let i = 0; i < count; i++) {
|
|
51
|
-
realSize +=
|
|
52
|
-
store.store.get('sizes')[i] || store.store.get('originItemSize');
|
|
53
|
-
}
|
|
54
|
-
store.setStore({ realSize });
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
function initialBase() {
|
|
60
|
-
return {
|
|
61
|
-
indexes: [],
|
|
62
|
-
count: 0,
|
|
63
|
-
// plugin support
|
|
64
|
-
trimmed: {},
|
|
65
|
-
// size operations, this provider stores only changed sizes, not all of them
|
|
66
|
-
// same as indexes but for sizes and positions
|
|
67
|
-
// item index to size
|
|
68
|
-
sizes: {},
|
|
69
|
-
// order in indexes[] to coordinate
|
|
70
|
-
positionIndexToItem: {},
|
|
71
|
-
// initial element to coordinate ^
|
|
72
|
-
indexToItem: {},
|
|
73
|
-
positionIndexes: [],
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function initialState() {
|
|
77
|
-
return Object.assign(Object.assign({}, initialBase()), {
|
|
78
|
-
// size which all items can take
|
|
79
|
-
realSize: 0,
|
|
80
|
-
// initial item size if it wasn't changed
|
|
81
|
-
originItemSize: 0 });
|
|
82
|
-
}
|
|
83
|
-
class DimensionStore {
|
|
84
|
-
constructor() {
|
|
85
|
-
this.store = index.createStore(initialState());
|
|
86
|
-
this.store.use(trimmedPlugin(this));
|
|
87
|
-
this.store.use(realSizePlugin(this));
|
|
88
|
-
}
|
|
89
|
-
getCurrentState() {
|
|
90
|
-
const state = initialState();
|
|
91
|
-
const keys = Object.keys(state);
|
|
92
|
-
return index.reduce_1(keys, (r, k) => {
|
|
93
|
-
const data = this.store.get(k);
|
|
94
|
-
r[k] = data;
|
|
95
|
-
return r;
|
|
96
|
-
}, state);
|
|
97
|
-
}
|
|
98
|
-
dispose() {
|
|
99
|
-
index.setStore(this.store, initialState());
|
|
100
|
-
}
|
|
101
|
-
setStore(data) {
|
|
102
|
-
index.setStore(this.store, data);
|
|
103
|
-
}
|
|
104
|
-
drop() {
|
|
105
|
-
index.setStore(this.store, initialBase());
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Set custom dimension sizes and overwrite old
|
|
109
|
-
* Generates new indexes based on sizes
|
|
110
|
-
* @param sizes - sizes to set
|
|
111
|
-
*/
|
|
112
|
-
setDimensionSize(sizes) {
|
|
113
|
-
const dimensionData = index.calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
114
|
-
index.setStore(this.store, dimensionData);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const rowTypes = ['rowPinStart', 'rgRow', 'rowPinEnd'];
|
|
119
|
-
const columnTypes = [
|
|
120
|
-
'colPinStart',
|
|
121
|
-
'rgCol',
|
|
122
|
-
'colPinEnd',
|
|
123
|
-
];
|
|
124
|
-
function isRowType(type) {
|
|
125
|
-
return rowTypes.indexOf(type) > -1;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Base layer for plugins
|
|
130
|
-
* Provide minimal starting core for plugins to work
|
|
131
|
-
* Extend this class to create plugin
|
|
132
|
-
*/
|
|
133
|
-
class BasePlugin {
|
|
134
|
-
constructor(revogrid, providers) {
|
|
135
|
-
this.revogrid = revogrid;
|
|
136
|
-
this.providers = providers;
|
|
137
|
-
this.h = index$1.h;
|
|
138
|
-
this.subscriptions = {};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param eventName - event name to subscribe to in revo-grid component (e.g. 'beforeheaderclick')
|
|
143
|
-
* @param callback - callback function for event
|
|
144
|
-
*/
|
|
145
|
-
addEventListener(eventName, callback) {
|
|
146
|
-
this.revogrid.addEventListener(eventName, callback);
|
|
147
|
-
this.subscriptions[eventName] = callback;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Subscribe to property change in revo-grid component
|
|
151
|
-
* You can return false in callback to prevent default value set
|
|
152
|
-
*
|
|
153
|
-
* @param prop - property name
|
|
154
|
-
* @param callback - callback function
|
|
155
|
-
* @param immediate - trigger callback immediately with current value
|
|
156
|
-
*/
|
|
157
|
-
watch(prop, callback, { immediate } = { immediate: false }) {
|
|
158
|
-
const nativeValueDesc = Object.getOwnPropertyDescriptor(this.revogrid, prop) ||
|
|
159
|
-
Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);
|
|
160
|
-
// Overwrite property descriptor for this instance
|
|
161
|
-
Object.defineProperty(this.revogrid, prop, {
|
|
162
|
-
set(val) {
|
|
163
|
-
var _a;
|
|
164
|
-
const keepDefault = callback(val);
|
|
165
|
-
if (keepDefault === false) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
// Continue with native behavior
|
|
169
|
-
return (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.set) === null || _a === void 0 ? void 0 : _a.call(this, val);
|
|
170
|
-
},
|
|
171
|
-
get() {
|
|
172
|
-
var _a;
|
|
173
|
-
// Continue with native behavior
|
|
174
|
-
return (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.get) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
if (immediate) {
|
|
178
|
-
callback(nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.value);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Remove event listener
|
|
183
|
-
* @param eventName
|
|
184
|
-
*/
|
|
185
|
-
removeEventListener(eventName) {
|
|
186
|
-
this.revogrid.removeEventListener(eventName, this.subscriptions[eventName]);
|
|
187
|
-
delete this.subscriptions[eventName];
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Emit event from revo-grid component
|
|
191
|
-
* Event can be cancelled by calling event.preventDefault() in callback
|
|
192
|
-
*/
|
|
193
|
-
emit(eventName, detail) {
|
|
194
|
-
const event = new CustomEvent(eventName, { detail, cancelable: true });
|
|
195
|
-
this.revogrid.dispatchEvent(event);
|
|
196
|
-
return event;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Clear all subscriptions
|
|
200
|
-
*/
|
|
201
|
-
clearSubscriptions() {
|
|
202
|
-
for (let type in this.subscriptions) {
|
|
203
|
-
this.removeEventListener(type);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Destroy plugin and clear all subscriptions
|
|
208
|
-
*/
|
|
209
|
-
destroy() {
|
|
210
|
-
this.clearSubscriptions();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function getColumnType(rgCol) {
|
|
215
|
-
if (rgCol.pin) {
|
|
216
|
-
return rgCol.pin;
|
|
217
|
-
}
|
|
218
|
-
return 'rgCol';
|
|
219
|
-
}
|
|
220
|
-
function getColumnSizes(cols) {
|
|
221
|
-
const res = {};
|
|
222
|
-
for (const [i, c] of cols.entries()) {
|
|
223
|
-
if (c.size) {
|
|
224
|
-
res[i] = c.size;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return res;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Check if column is grouping column
|
|
231
|
-
*/
|
|
232
|
-
function isColGrouping(colData) {
|
|
233
|
-
return !!colData.children;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* This function is used to create a collection of columns.
|
|
237
|
-
*/
|
|
238
|
-
function getColumns(columns, level = 0, types) {
|
|
239
|
-
const collection = {
|
|
240
|
-
// columns as they are in stores per type
|
|
241
|
-
columns: {
|
|
242
|
-
rgCol: [],
|
|
243
|
-
colPinStart: [],
|
|
244
|
-
colPinEnd: [],
|
|
245
|
-
},
|
|
246
|
-
// columns indexed by prop for quick access
|
|
247
|
-
columnByProp: {},
|
|
248
|
-
// column grouping
|
|
249
|
-
columnGrouping: {
|
|
250
|
-
rgCol: [],
|
|
251
|
-
colPinStart: [],
|
|
252
|
-
colPinEnd: [],
|
|
253
|
-
},
|
|
254
|
-
// max depth level for column grouping
|
|
255
|
-
maxLevel: level,
|
|
256
|
-
// sorting
|
|
257
|
-
sort: {},
|
|
258
|
-
};
|
|
259
|
-
return index.reduce_1(columns, (res, colData) => {
|
|
260
|
-
// Grouped column
|
|
261
|
-
if (isColGrouping(colData)) {
|
|
262
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
263
|
-
}
|
|
264
|
-
// Regular column
|
|
265
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
266
|
-
// Regular column, no Pin
|
|
267
|
-
if (!regularColumn.pin) {
|
|
268
|
-
res.columns.rgCol.push(regularColumn);
|
|
269
|
-
// Pin
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
273
|
-
}
|
|
274
|
-
if (regularColumn.order) {
|
|
275
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
276
|
-
}
|
|
277
|
-
// it's possible that some columns have same prop, but better to avoid it
|
|
278
|
-
if (!res.columnByProp[regularColumn.prop]) {
|
|
279
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
280
|
-
}
|
|
281
|
-
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
282
|
-
// trigger setup hook if present
|
|
283
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
284
|
-
return res;
|
|
285
|
-
}, collection);
|
|
286
|
-
}
|
|
287
|
-
function gatherGroup(res, colData, collection, level = 0) {
|
|
288
|
-
// group template
|
|
289
|
-
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
290
|
-
// check columns for update
|
|
291
|
-
for (let k in collection.columns) {
|
|
292
|
-
const key = k;
|
|
293
|
-
const resultItem = res.columns[key];
|
|
294
|
-
const collectionItem = collection.columns[key];
|
|
295
|
-
// if column data
|
|
296
|
-
if (index.isArray_1(resultItem) && index.isArray_1(collectionItem)) {
|
|
297
|
-
// fill columns
|
|
298
|
-
resultItem.push(...collectionItem);
|
|
299
|
-
// fill grouping
|
|
300
|
-
if (collectionItem.length) {
|
|
301
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
// merge column groupings
|
|
306
|
-
for (let k in collection.columnGrouping) {
|
|
307
|
-
const key = k;
|
|
308
|
-
const collectionItem = collection.columnGrouping[key];
|
|
309
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
310
|
-
}
|
|
311
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
312
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
313
|
-
return res;
|
|
314
|
-
}
|
|
315
|
-
function findColumn(columns, prop) {
|
|
316
|
-
for (const c of columns) {
|
|
317
|
-
if (isColGrouping(c)) {
|
|
318
|
-
const found = findColumn(c.children, prop);
|
|
319
|
-
if (found) {
|
|
320
|
-
return found;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
else if (c.prop === prop) {
|
|
324
|
-
return c;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return undefined;
|
|
328
|
-
}
|
|
329
|
-
function getColumnByProp(columns, prop) {
|
|
330
|
-
return findColumn(columns, prop);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
exports.BasePlugin = BasePlugin;
|
|
334
|
-
exports.DimensionStore = DimensionStore;
|
|
335
|
-
exports.columnTypes = columnTypes;
|
|
336
|
-
exports.gatherGroup = gatherGroup;
|
|
337
|
-
exports.getColumnByProp = getColumnByProp;
|
|
338
|
-
exports.getColumnSizes = getColumnSizes;
|
|
339
|
-
exports.getColumnType = getColumnType;
|
|
340
|
-
exports.getColumns = getColumns;
|
|
341
|
-
exports.isColGrouping = isColGrouping;
|
|
342
|
-
exports.isRowType = isRowType;
|
|
343
|
-
exports.rowTypes = rowTypes;
|
|
344
|
-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,CAAC;aACd;SACF;aAAM,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;YAC1B,OAAO,CAAC,CAAC;SACV;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;SAEe,eAAe,CAC7B,OAAmB,EACnB,IAAgB;IAEhB,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACnC;;;;;;;;;;;;;;","names":["createStore","reduce","setStore","calculateDimensionData","h","isArray"],"sources":["src/store/dimension/dimension.store.ts","src/store/index.ts","src/plugins/base.plugin.ts","src/utils/column.utils.ts"],"sourcesContent":["/**\n * Storing pre-calculated\n * Dimension information and sizes\n */\nimport reduce from 'lodash/reduce';\nimport { createStore } from '@stencil/store';\n\nimport { setStore, Observable, PluginSubscribe } from '../../utils/store.utils';\nimport { calculateDimensionData } from './dimension.helpers';\nimport {\n DimensionCalc,\n DimensionSettingsState,\n ViewSettingSizeProp,\n MultiDimensionType,\n} from '@type';\n\nexport type DimensionStoreCollection = {\n [T in MultiDimensionType]: DimensionStore;\n};\n\ntype Item = keyof DimensionSettingsState;\n\nconst trimmedPlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n let trimmedSize: DimensionSettingsState['sizes'] = {};\n\n const setTrimmed = (\n sizes: DimensionSettingsState['sizes'],\n trimmed: DimensionSettingsState['trimmed'],\n ) => {\n const newSize: DimensionSettingsState['sizes'] = { ...sizes };\n trimmedSize = {};\n for (const [index, v] of Object.entries(trimmed)) {\n const i = index as keyof DimensionSettingsState['sizes'];\n if (v && newSize[i]) {\n trimmedSize[i] = newSize[i];\n delete newSize[i];\n }\n }\n store.setDimensionSize(newSize);\n };\n return {\n set(key, val) {\n switch (key) {\n case 'trimmed':\n const trim = val as DimensionSettingsState['trimmed'];\n const sizes = store.store.get('sizes');\n // recover trimmed, apply new trim\n setTrimmed({ ...sizes, ...trimmedSize }, trim);\n break;\n }\n },\n };\n};\n\nconst realSizePlugin = (\n store: DimensionStore,\n): PluginSubscribe<DimensionSettingsState> => {\n return {\n set(k) {\n switch (k) {\n case 'count':\n case 'sizes':\n case 'originItemSize':\n let realSize = 0;\n const count = store.store.get('count');\n for (let i = 0; i < count; i++) {\n realSize +=\n store.store.get('sizes')[i] || store.store.get('originItemSize');\n }\n store.setStore({ realSize });\n }\n },\n };\n};\n\nfunction initialBase(): DimensionCalc {\n return {\n indexes: [],\n count: 0,\n\n // plugin support\n trimmed: {},\n\n // size operations, this provider stores only changed sizes, not all of them\n // same as indexes but for sizes and positions\n // item index to size\n sizes: {},\n // order in indexes[] to coordinate\n positionIndexToItem: {},\n // initial element to coordinate ^\n indexToItem: {},\n positionIndexes: [],\n };\n}\n\nfunction initialState(): DimensionSettingsState {\n return {\n ...initialBase(),\n // size which all items can take\n realSize: 0,\n\n // initial item size if it wasn't changed\n originItemSize: 0,\n };\n}\n\nexport class DimensionStore {\n readonly store: Observable<DimensionSettingsState>;\n constructor() {\n this.store = createStore(initialState());\n this.store.use(trimmedPlugin(this));\n this.store.use(realSizePlugin(this));\n }\n\n getCurrentState(): DimensionSettingsState {\n const state = initialState();\n const keys = Object.keys(state);\n return reduce(\n keys,\n (r: DimensionSettingsState, k: Item) => {\n const data = this.store.get(k);\n r[k] = data as never;\n return r;\n },\n state,\n );\n }\n\n dispose() {\n setStore(this.store, initialState());\n }\n\n setStore<T extends Record<string, any>>(data: Partial<T>) {\n setStore(this.store, data);\n }\n\n drop() {\n setStore(this.store, initialBase());\n }\n\n /**\n * Set custom dimension sizes and overwrite old\n * Generates new indexes based on sizes\n * @param sizes - sizes to set\n */\n setDimensionSize(sizes: ViewSettingSizeProp) {\n const dimensionData = calculateDimensionData(\n this.store.get('originItemSize'),\n sizes,\n );\n setStore(this.store, dimensionData);\n }\n}\n","import type { DimensionCols, DimensionRows } from '@type';\n\nexport * from './dataSource';\nexport * from './dimension';\nexport * from './selection';\nexport * from './vp';\n\nexport const rowTypes: DimensionRows[] = ['rowPinStart', 'rgRow', 'rowPinEnd'];\nexport const columnTypes: DimensionCols[] = [\n 'colPinStart',\n 'rgCol',\n 'colPinEnd',\n];\n\nexport function isRowType(type: DimensionRows | any): type is DimensionRows {\n return rowTypes.indexOf(type) > -1;\n}\n","import { h } from '@stencil/core';\nimport { PluginProviders, PluginBaseComponent } from '..';\n\ntype WatchConfig = { immediate: boolean };\n\n/**\n * Base layer for plugins\n * Provide minimal starting core for plugins to work\n * Extend this class to create plugin\n */\nexport class BasePlugin implements PluginBaseComponent {\n readonly h = h;\n readonly subscriptions: Record<string, (...args: any[]) => void> = {};\n constructor(public revogrid: HTMLRevoGridElement, public providers: PluginProviders) {}\n /**\n *\n * @param eventName - event name to subscribe to in revo-grid component (e.g. 'beforeheaderclick')\n * @param callback - callback function for event\n */\n addEventListener<T = any>(\n eventName: string,\n callback: (e: CustomEvent<T>) => void,\n ) {\n this.revogrid.addEventListener(eventName, callback);\n this.subscriptions[eventName] = callback;\n }\n\n /**\n * Subscribe to property change in revo-grid component\n * You can return false in callback to prevent default value set\n *\n * @param prop - property name\n * @param callback - callback function\n * @param immediate - trigger callback immediately with current value\n */\n watch<T extends any>(\n prop: string,\n callback: (arg: T) => boolean | void,\n { immediate }: Partial<WatchConfig> = { immediate: false },\n ) {\n const nativeValueDesc =\n Object.getOwnPropertyDescriptor(this.revogrid, prop) ||\n Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);\n\n // Overwrite property descriptor for this instance\n Object.defineProperty(this.revogrid, prop, {\n set(val: T) {\n const keepDefault = callback(val);\n if (keepDefault === false) {\n return;\n }\n // Continue with native behavior\n return nativeValueDesc?.set?.call(this, val);\n },\n get() {\n // Continue with native behavior\n return nativeValueDesc?.get?.call(this);\n },\n });\n if (immediate) {\n callback(nativeValueDesc?.value);\n }\n }\n\n /**\n * Remove event listener\n * @param eventName\n */\n removeEventListener(eventName: string) {\n this.revogrid.removeEventListener(eventName, this.subscriptions[eventName]);\n delete this.subscriptions[eventName];\n }\n\n /**\n * Emit event from revo-grid component\n * Event can be cancelled by calling event.preventDefault() in callback\n */\n emit<T = any>(eventName: string, detail?: T) {\n const event = new CustomEvent<T>(eventName, { detail, cancelable: true });\n this.revogrid.dispatchEvent(event);\n return event;\n }\n\n /**\n * Clear all subscriptions\n */\n clearSubscriptions() {\n for (let type in this.subscriptions) {\n this.removeEventListener(type);\n }\n }\n\n /**\n * Destroy plugin and clear all subscriptions\n */\n destroy() {\n this.clearSubscriptions();\n }\n}\n\nexport type GridPlugin = (typeof BasePlugin);\n","import isArray from 'lodash/isArray';\nimport reduce from 'lodash/reduce';\n\nimport {\n ColumnData,\n ColumnGrouping,\n ColumnProp,\n ColumnRegular,\n ColumnTypes,\n DimensionCols,\n ViewSettingSizeProp,\n} from '@type';\nimport { Group as StoreGroup } from '@store';\n\nexport type ColumnItems = Record<DimensionCols, ColumnRegular[]>;\nexport interface ColumnGroup extends StoreGroup {\n level: number;\n}\nexport type ColumnGroupingCollection = Record<DimensionCols, ColumnGroup[]>;\n\n/**\n * Column collection definition.\n * Used to access indexed data for columns.\n * Can be accessed via different events.\n */\nexport type ColumnCollection = {\n /**\n * Columns as they are in stores\n */\n columns: Record<DimensionCols, ColumnRegular[]>;\n /**\n * Columns indexed by prop for quick access, it's possible to have multiple columns with same prop but not recommended\n */\n columnByProp: Record<ColumnProp, ColumnRegular[]>;\n /**\n * Grouped columns\n */\n columnGrouping: ColumnGroupingCollection;\n /**\n * Max level of grouping\n */\n maxLevel: number;\n /**\n * Sorting\n */\n sort: Record<ColumnProp, ColumnRegular>;\n};\n\nexport function getColumnType(rgCol: ColumnRegular): DimensionCols {\n if (rgCol.pin) {\n return rgCol.pin;\n }\n return 'rgCol';\n}\n\nexport function getColumnSizes(cols: ColumnRegular[]): ViewSettingSizeProp {\n const res: ViewSettingSizeProp = {};\n for (const [i, c] of cols.entries()) {\n if (c.size) {\n res[i] = c.size;\n }\n }\n return res;\n}\n\n\n/**\n * Check if column is grouping column\n */\nexport function isColGrouping(\n colData: ColumnGrouping | ColumnRegular,\n): colData is ColumnGrouping {\n return !!(colData as ColumnGrouping).children;\n}\n\n/**\n * This function is used to create a collection of columns.\n */\nexport function getColumns(\n columns: ColumnData,\n level = 0,\n types?: ColumnTypes,\n): ColumnCollection {\n const collection: ColumnCollection = {\n // columns as they are in stores per type\n columns: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // columns indexed by prop for quick access\n columnByProp: {},\n // column grouping\n columnGrouping: {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n // max depth level for column grouping\n maxLevel: level,\n // sorting\n sort: {},\n };\n\n return reduce(\n columns,\n (res: ColumnCollection, colData: ColumnGrouping | ColumnRegular) => {\n // Grouped column\n if (isColGrouping(colData)) {\n return gatherGroup(\n res,\n colData,\n getColumns(colData.children, level + 1, types),\n level,\n );\n }\n // Regular column\n const regularColumn = {\n ...(colData.columnType && types && types[colData.columnType]),\n ...colData,\n };\n // Regular column, no Pin\n if (!regularColumn.pin) {\n res.columns.rgCol.push(regularColumn);\n // Pin\n } else {\n res.columns[regularColumn.pin].push(regularColumn);\n }\n if (regularColumn.order) {\n res.sort[regularColumn.prop] = regularColumn;\n }\n // it's possible that some columns have same prop, but better to avoid it\n if (!res.columnByProp[regularColumn.prop]) {\n res.columnByProp[regularColumn.prop] = [];\n }\n res.columnByProp[regularColumn.prop].push(regularColumn);\n\n // trigger setup hook if present\n regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);\n return res;\n },\n collection,\n );\n}\n\nexport function gatherGroup<T extends ColumnCollection>(\n res: T,\n colData: ColumnGrouping,\n collection: T,\n level = 0,\n): T {\n // group template\n const group: ColumnGroup = {\n ...colData,\n level,\n ids: [],\n };\n\n // check columns for update\n for (let k in collection.columns) {\n const key = k as keyof ColumnCollection['columns'];\n const resultItem = res.columns[key];\n const collectionItem = collection.columns[key];\n\n // if column data\n if (isArray(resultItem) && isArray(collectionItem)) {\n // fill columns\n resultItem.push(...collectionItem);\n\n // fill grouping\n if (collectionItem.length) {\n res.columnGrouping[key].push({\n ...group,\n ids: collectionItem.map(item => item.prop),\n });\n }\n }\n }\n // merge column groupings\n for (let k in collection.columnGrouping) {\n const key = k as DimensionCols;\n const collectionItem = collection.columnGrouping[key];\n res.columnGrouping[key].push(...collectionItem);\n }\n res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);\n res.sort = { ...res.sort, ...collection.sort };\n return res;\n}\n\nfunction findColumn(\n columns: ColumnData,\n prop: ColumnProp,\n): ColumnRegular | undefined {\n for (const c of columns) {\n if (isColGrouping(c)) {\n const found = findColumn(c.children, prop);\n if (found) {\n return found;\n }\n } else if (c.prop === prop) {\n return c;\n }\n }\n return undefined;\n}\n\nexport function getColumnByProp(\n columns: ColumnData,\n prop: ColumnProp,\n): ColumnRegular | undefined {\n return findColumn(columns, prop);\n}\n"],"version":3}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
const toNumber$1 = require('./toNumber-838e6ff5.js');
|
|
7
|
-
|
|
8
|
-
var root = toNumber$1._root;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
12
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
13
|
-
*
|
|
14
|
-
* @static
|
|
15
|
-
* @memberOf _
|
|
16
|
-
* @since 2.4.0
|
|
17
|
-
* @category Date
|
|
18
|
-
* @returns {number} Returns the timestamp.
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* _.defer(function(stamp) {
|
|
22
|
-
* console.log(_.now() - stamp);
|
|
23
|
-
* }, _.now());
|
|
24
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
25
|
-
*/
|
|
26
|
-
var now$1 = function() {
|
|
27
|
-
return root.Date.now();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var now_1 = now$1;
|
|
31
|
-
|
|
32
|
-
var isObject = toNumber$1.isObject_1,
|
|
33
|
-
now = now_1,
|
|
34
|
-
toNumber = toNumber$1.toNumber_1;
|
|
35
|
-
|
|
36
|
-
/** Error message constants. */
|
|
37
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
38
|
-
|
|
39
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
40
|
-
var nativeMax = Math.max,
|
|
41
|
-
nativeMin = Math.min;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
45
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
46
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
47
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
48
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
49
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
50
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
51
|
-
* calls to the debounced function return the result of the last `func`
|
|
52
|
-
* invocation.
|
|
53
|
-
*
|
|
54
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
55
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
56
|
-
* is invoked more than once during the `wait` timeout.
|
|
57
|
-
*
|
|
58
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
59
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
60
|
-
*
|
|
61
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
62
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
63
|
-
*
|
|
64
|
-
* @static
|
|
65
|
-
* @memberOf _
|
|
66
|
-
* @since 0.1.0
|
|
67
|
-
* @category Function
|
|
68
|
-
* @param {Function} func The function to debounce.
|
|
69
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
70
|
-
* @param {Object} [options={}] The options object.
|
|
71
|
-
* @param {boolean} [options.leading=false]
|
|
72
|
-
* Specify invoking on the leading edge of the timeout.
|
|
73
|
-
* @param {number} [options.maxWait]
|
|
74
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
75
|
-
* @param {boolean} [options.trailing=true]
|
|
76
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
77
|
-
* @returns {Function} Returns the new debounced function.
|
|
78
|
-
* @example
|
|
79
|
-
*
|
|
80
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
81
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
82
|
-
*
|
|
83
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
84
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
85
|
-
* 'leading': true,
|
|
86
|
-
* 'trailing': false
|
|
87
|
-
* }));
|
|
88
|
-
*
|
|
89
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
90
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
91
|
-
* var source = new EventSource('/stream');
|
|
92
|
-
* jQuery(source).on('message', debounced);
|
|
93
|
-
*
|
|
94
|
-
* // Cancel the trailing debounced invocation.
|
|
95
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
96
|
-
*/
|
|
97
|
-
function debounce(func, wait, options) {
|
|
98
|
-
var lastArgs,
|
|
99
|
-
lastThis,
|
|
100
|
-
maxWait,
|
|
101
|
-
result,
|
|
102
|
-
timerId,
|
|
103
|
-
lastCallTime,
|
|
104
|
-
lastInvokeTime = 0,
|
|
105
|
-
leading = false,
|
|
106
|
-
maxing = false,
|
|
107
|
-
trailing = true;
|
|
108
|
-
|
|
109
|
-
if (typeof func != 'function') {
|
|
110
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
111
|
-
}
|
|
112
|
-
wait = toNumber(wait) || 0;
|
|
113
|
-
if (isObject(options)) {
|
|
114
|
-
leading = !!options.leading;
|
|
115
|
-
maxing = 'maxWait' in options;
|
|
116
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
117
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function invokeFunc(time) {
|
|
121
|
-
var args = lastArgs,
|
|
122
|
-
thisArg = lastThis;
|
|
123
|
-
|
|
124
|
-
lastArgs = lastThis = undefined;
|
|
125
|
-
lastInvokeTime = time;
|
|
126
|
-
result = func.apply(thisArg, args);
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function leadingEdge(time) {
|
|
131
|
-
// Reset any `maxWait` timer.
|
|
132
|
-
lastInvokeTime = time;
|
|
133
|
-
// Start the timer for the trailing edge.
|
|
134
|
-
timerId = setTimeout(timerExpired, wait);
|
|
135
|
-
// Invoke the leading edge.
|
|
136
|
-
return leading ? invokeFunc(time) : result;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function remainingWait(time) {
|
|
140
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
141
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
142
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
143
|
-
|
|
144
|
-
return maxing
|
|
145
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
146
|
-
: timeWaiting;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function shouldInvoke(time) {
|
|
150
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
151
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
152
|
-
|
|
153
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
154
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
155
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
156
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
157
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function timerExpired() {
|
|
161
|
-
var time = now();
|
|
162
|
-
if (shouldInvoke(time)) {
|
|
163
|
-
return trailingEdge(time);
|
|
164
|
-
}
|
|
165
|
-
// Restart the timer.
|
|
166
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function trailingEdge(time) {
|
|
170
|
-
timerId = undefined;
|
|
171
|
-
|
|
172
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
173
|
-
// debounced at least once.
|
|
174
|
-
if (trailing && lastArgs) {
|
|
175
|
-
return invokeFunc(time);
|
|
176
|
-
}
|
|
177
|
-
lastArgs = lastThis = undefined;
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function cancel() {
|
|
182
|
-
if (timerId !== undefined) {
|
|
183
|
-
clearTimeout(timerId);
|
|
184
|
-
}
|
|
185
|
-
lastInvokeTime = 0;
|
|
186
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function flush() {
|
|
190
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function debounced() {
|
|
194
|
-
var time = now(),
|
|
195
|
-
isInvoking = shouldInvoke(time);
|
|
196
|
-
|
|
197
|
-
lastArgs = arguments;
|
|
198
|
-
lastThis = this;
|
|
199
|
-
lastCallTime = time;
|
|
200
|
-
|
|
201
|
-
if (isInvoking) {
|
|
202
|
-
if (timerId === undefined) {
|
|
203
|
-
return leadingEdge(lastCallTime);
|
|
204
|
-
}
|
|
205
|
-
if (maxing) {
|
|
206
|
-
// Handle invocations in a tight loop.
|
|
207
|
-
clearTimeout(timerId);
|
|
208
|
-
timerId = setTimeout(timerExpired, wait);
|
|
209
|
-
return invokeFunc(lastCallTime);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (timerId === undefined) {
|
|
213
|
-
timerId = setTimeout(timerExpired, wait);
|
|
214
|
-
}
|
|
215
|
-
return result;
|
|
216
|
-
}
|
|
217
|
-
debounced.cancel = cancel;
|
|
218
|
-
debounced.flush = flush;
|
|
219
|
-
return debounced;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
var debounce_1 = debounce;
|
|
223
|
-
|
|
224
|
-
exports.debounce_1 = debounce_1;
|
|
225
|
-
|
|
226
|
-
//# sourceMappingURL=debounce-e2b7c6fb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"debounce-e2b7c6fb.js","mappings":";;;;;;;AAAA,IAAI,IAAI,GAAGA,gBAAkB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,KAAG,GAAG,WAAW;AACrB,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACzB,CAAC,CAAC;AACF;IACA,KAAc,GAAGA,KAAG;;ACtBpB,IAAI,QAAQ,GAAGD,qBAAqB;AACpC,IAAI,GAAG,GAAGE,KAAgB;AAC1B,IAAI,QAAQ,GAAGC,qBAAqB,CAAC;AACrC;AACA;AACA,IAAI,eAAe,GAAG,qBAAqB,CAAC;AAC5C;AACA;AACA,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG;AACxB,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE;AACvC,EAA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EAAE;AAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC/C,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,GAAG;AACH,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;AAC5B,EAAE,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;AAC1B,EAAE,OAAO,SAAS,CAAC;AACnB,CAAC;AACD;IACA,UAAc,GAAG;;;;","names":["require$$0","now","require$$1","require$$2"],"sources":["node_modules/lodash/now.js","node_modules/lodash/debounce.js"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n"],"version":3}
|