dtable-ui-component 0.1.75-beta → 0.1.75-beta1

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 (115) hide show
  1. package/lib/app.css +20 -0
  2. package/lib/app.js +96 -0
  3. package/lib/assets/images/avatar/default_avatar.png +0 -0
  4. package/lib/assets/images/file/192/excel.png +0 -0
  5. package/lib/assets/images/file/192/file.png +0 -0
  6. package/lib/assets/images/file/192/music.png +0 -0
  7. package/lib/assets/images/file/192/pdf.png +0 -0
  8. package/lib/assets/images/file/192/pic.png +0 -0
  9. package/lib/assets/images/file/192/ppt.png +0 -0
  10. package/lib/assets/images/file/192/txt.png +0 -0
  11. package/lib/assets/images/file/192/video.png +0 -0
  12. package/lib/assets/images/file/192/word.png +0 -0
  13. package/lib/assets/images/file/24/excel.png +0 -0
  14. package/lib/assets/images/file/24/file.png +0 -0
  15. package/lib/assets/images/file/24/music.png +0 -0
  16. package/lib/assets/images/file/24/pdf.png +0 -0
  17. package/lib/assets/images/file/24/pic.png +0 -0
  18. package/lib/assets/images/file/24/ppt.png +0 -0
  19. package/lib/assets/images/file/24/txt.png +0 -0
  20. package/lib/assets/images/file/24/video.png +0 -0
  21. package/lib/assets/images/file/24/word.png +0 -0
  22. package/lib/assets/images/folder/folder-192.png +0 -0
  23. package/lib/assets/images/folder/folder-24.png +0 -0
  24. package/lib/components/cell-editor/checkbox-editor.js +111 -0
  25. package/lib/components/cell-editor/collaborator-editor.js +249 -0
  26. package/lib/components/cell-editor/date-editor.js +171 -0
  27. package/lib/components/cell-editor/index.js +40 -0
  28. package/lib/components/cell-editor/link-editor.js +321 -0
  29. package/lib/components/cell-editor/multiple-select-editor.js +250 -0
  30. package/lib/components/cell-editor/number-editor.js +162 -0
  31. package/lib/components/cell-editor/single-select-editor.js +216 -0
  32. package/lib/components/cell-editor/text-editor.js +129 -0
  33. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +66 -0
  34. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
  35. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
  36. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
  37. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
  38. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +183 -0
  39. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +262 -0
  40. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +176 -0
  41. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +243 -0
  42. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +124 -0
  43. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +156 -0
  44. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +128 -0
  45. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +157 -0
  46. package/lib/components/cell-factory/cell-formatter-factory.js +28 -0
  47. package/lib/components/cell-formatter/auto-number-formatter.js +45 -0
  48. package/lib/components/cell-formatter/button-formatter.js +66 -0
  49. package/lib/components/cell-formatter/checkbox-formatter.js +56 -0
  50. package/lib/components/cell-formatter/collaborator-formatter.js +111 -0
  51. package/lib/components/cell-formatter/creator-formatter.js +105 -0
  52. package/lib/components/cell-formatter/ctime-formatter.js +70 -0
  53. package/lib/components/cell-formatter/date-formatter.js +73 -0
  54. package/lib/components/cell-formatter/duration-formatter.js +49 -0
  55. package/lib/components/cell-formatter/email-formatter.js +45 -0
  56. package/lib/components/cell-formatter/file-formatter.js +77 -0
  57. package/lib/components/cell-formatter/formatter-config.js +66 -0
  58. package/lib/components/cell-formatter/formula-formatter.js +189 -0
  59. package/lib/components/cell-formatter/geolocation-formatter.js +66 -0
  60. package/lib/components/cell-formatter/image-formatter.js +171 -0
  61. package/lib/components/cell-formatter/index.js +112 -0
  62. package/lib/components/cell-formatter/last-modifier-formatter.js +105 -0
  63. package/lib/components/cell-formatter/link-formatter.js +165 -0
  64. package/lib/components/cell-formatter/long-text-formatter.js +46 -0
  65. package/lib/components/cell-formatter/mtime-formatter.js +70 -0
  66. package/lib/components/cell-formatter/multiple-select-formatter.js +84 -0
  67. package/lib/components/cell-formatter/number-formatter.js +60 -0
  68. package/lib/components/cell-formatter/rate-formatter.js +93 -0
  69. package/lib/components/cell-formatter/single-select-formatter.js +84 -0
  70. package/lib/components/cell-formatter/text-formatter.js +67 -0
  71. package/lib/components/cell-formatter/url-formatter.js +45 -0
  72. package/lib/components/cell-formatter/widgets/file-item-formatter.js +63 -0
  73. package/lib/components/cell-formatter/widgets/image-previewer-lightbox.js +152 -0
  74. package/lib/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js +107 -0
  75. package/lib/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js +110 -0
  76. package/lib/components/common/collaborator-item.js +79 -0
  77. package/lib/components/common/edit-editor-button.js +67 -0
  78. package/lib/components/common/images-lazy-load.js +158 -0
  79. package/lib/components/common/link-editor-option.js +121 -0
  80. package/lib/components/common/mobile/mb-editor-header.js +61 -0
  81. package/lib/components/common/modal-portal.js +51 -0
  82. package/lib/components/common/select-editor-option.js +122 -0
  83. package/lib/components/common/select-item.js +73 -0
  84. package/lib/components/file-uploader/index.js +63 -0
  85. package/lib/components/loading.js +16 -0
  86. package/lib/components/toast/alert.js +164 -0
  87. package/lib/components/toast/index.js +12 -0
  88. package/lib/components/toast/toast.js +223 -0
  89. package/lib/components/toast/toastManager.js +189 -0
  90. package/lib/components/toast/toaster.js +92 -0
  91. package/lib/constants/cell-types.js +54 -0
  92. package/lib/constants/index.js +70 -0
  93. package/lib/css/cell-editor.css +614 -0
  94. package/lib/css/cell-formatter.css +247 -0
  95. package/lib/css/custom-rc-calendar.css +118 -0
  96. package/lib/css/image-previewer-ligntbox.css +87 -0
  97. package/lib/css/loading.css +54 -0
  98. package/lib/index.js +64 -0
  99. package/lib/lang/index.js +66 -0
  100. package/lib/locals/de.js +7 -0
  101. package/lib/locals/en.js +22 -0
  102. package/lib/locals/fr.js +7 -0
  103. package/lib/locals/zh-CN.js +22 -0
  104. package/lib/utils/cell-value-validator.js +41 -0
  105. package/lib/utils/column-utils.js +15 -0
  106. package/lib/utils/editor-utils.js +81 -0
  107. package/lib/utils/markdown2html.js +68 -0
  108. package/lib/utils/normalize-long-text-value.js +74 -0
  109. package/lib/utils/number-precision.js +181 -0
  110. package/lib/utils/unified/index.js +470 -0
  111. package/lib/utils/utils.js +141 -0
  112. package/lib/utils/value-format-utils.js +545 -0
  113. package/lib/utils/vfile/core.js +172 -0
  114. package/lib/utils/vfile/index.js +48 -0
  115. package/package.json +3 -3
@@ -0,0 +1,470 @@
1
+ 'use strict';
2
+ /* Dependencies. */
3
+
4
+ var extend = require('extend');
5
+
6
+ var bail = require('bail');
7
+
8
+ var vfile = require('../vfile');
9
+
10
+ var trough = require('trough');
11
+
12
+ var string = require('x-is-string');
13
+
14
+ var plain = require('is-plain-obj');
15
+ /* Expose a frozen processor. */
16
+
17
+
18
+ module.exports = unified().freeze();
19
+ var slice = [].slice;
20
+ var own = {}.hasOwnProperty;
21
+ /* Process pipeline. */
22
+
23
+ var pipeline = trough().use(pipelineParse).use(pipelineRun).use(pipelineStringify);
24
+
25
+ function pipelineParse(p, ctx) {
26
+ ctx.tree = p.parse(ctx.file);
27
+ }
28
+
29
+ function pipelineRun(p, ctx, next) {
30
+ p.run(ctx.tree, ctx.file, done);
31
+
32
+ function done(err, tree, file) {
33
+ if (err) {
34
+ next(err);
35
+ } else {
36
+ ctx.tree = tree;
37
+ ctx.file = file;
38
+ next();
39
+ }
40
+ }
41
+ }
42
+
43
+ function pipelineStringify(p, ctx) {
44
+ ctx.file.contents = p.stringify(ctx.tree, ctx.file);
45
+ }
46
+ /* Function to create the first processor. */
47
+
48
+
49
+ function unified() {
50
+ var attachers = [];
51
+ var transformers = trough();
52
+ var namespace = {};
53
+ var frozen = false;
54
+ var freezeIndex = -1;
55
+ /* Data management. */
56
+
57
+ processor.data = data;
58
+ /* Lock. */
59
+
60
+ processor.freeze = freeze;
61
+ /* Plug-ins. */
62
+
63
+ processor.attachers = attachers;
64
+ processor.use = use;
65
+ /* API. */
66
+
67
+ processor.parse = parse;
68
+ processor.stringify = stringify;
69
+ processor.run = run;
70
+ processor.runSync = runSync;
71
+ processor.process = process;
72
+ processor.processSync = processSync;
73
+ /* Expose. */
74
+
75
+ return processor;
76
+ /* Create a new processor based on the processor
77
+ * in the current scope. */
78
+
79
+ function processor() {
80
+ var destination = unified();
81
+ var length = attachers.length;
82
+ var index = -1;
83
+
84
+ while (++index < length) {
85
+ destination.use.apply(null, attachers[index]);
86
+ }
87
+
88
+ destination.data(extend(true, {}, namespace));
89
+ return destination;
90
+ }
91
+ /* Freeze: used to signal a processor that has finished
92
+ * configuration.
93
+ *
94
+ * For example, take unified itself. It’s frozen.
95
+ * Plug-ins should not be added to it. Rather, it should
96
+ * be extended, by invoking it, before modifying it.
97
+ *
98
+ * In essence, always invoke this when exporting a
99
+ * processor. */
100
+
101
+
102
+ function freeze() {
103
+ var values;
104
+ var plugin;
105
+ var options;
106
+ var transformer;
107
+
108
+ if (frozen) {
109
+ return processor;
110
+ }
111
+
112
+ while (++freezeIndex < attachers.length) {
113
+ values = attachers[freezeIndex];
114
+ plugin = values[0];
115
+ options = values[1];
116
+ transformer = null;
117
+
118
+ if (options === false) {
119
+ continue;
120
+ }
121
+
122
+ if (options === true) {
123
+ values[1] = undefined;
124
+ }
125
+
126
+ transformer = plugin.apply(processor, values.slice(1));
127
+
128
+ if (typeof transformer === 'function') {
129
+ transformers.use(transformer);
130
+ }
131
+ }
132
+
133
+ frozen = true;
134
+ freezeIndex = Infinity;
135
+ return processor;
136
+ }
137
+ /* Data management.
138
+ * Getter / setter for processor-specific informtion. */
139
+
140
+
141
+ function data(key, value) {
142
+ if (string(key)) {
143
+ /* Set `key`. */
144
+ if (arguments.length === 2) {
145
+ assertUnfrozen('data', frozen);
146
+ namespace[key] = value;
147
+ return processor;
148
+ }
149
+ /* Get `key`. */
150
+
151
+
152
+ return own.call(namespace, key) && namespace[key] || null;
153
+ }
154
+ /* Set space. */
155
+
156
+
157
+ if (key) {
158
+ assertUnfrozen('data', frozen);
159
+ namespace = key;
160
+ return processor;
161
+ }
162
+ /* Get space. */
163
+
164
+
165
+ return namespace;
166
+ }
167
+ /* Plug-in management.
168
+ *
169
+ * Pass it:
170
+ * * an attacher and options,
171
+ * * a preset,
172
+ * * a list of presets, attachers, and arguments (list
173
+ * of attachers and options). */
174
+
175
+
176
+ function use(value) {
177
+ var settings;
178
+ assertUnfrozen('use', frozen);
179
+
180
+ if (value === null || value === undefined) {
181
+ /* Empty */
182
+ } else if (typeof value === 'function') {
183
+ addPlugin.apply(null, arguments);
184
+ } else if (typeof value === 'object') {
185
+ if ('length' in value) {
186
+ addList(value);
187
+ } else {
188
+ addPreset(value);
189
+ }
190
+ } else {
191
+ throw new Error('Expected usable value, not `' + value + '`');
192
+ }
193
+
194
+ if (settings) {
195
+ namespace.settings = extend(namespace.settings || {}, settings);
196
+ }
197
+
198
+ return processor;
199
+
200
+ function addPreset(result) {
201
+ addList(result.plugins);
202
+
203
+ if (result.settings) {
204
+ settings = extend(settings || {}, result.settings);
205
+ }
206
+ }
207
+
208
+ function add(value) {
209
+ if (typeof value === 'function') {
210
+ addPlugin(value);
211
+ } else if (typeof value === 'object') {
212
+ if ('length' in value) {
213
+ addPlugin.apply(null, value);
214
+ } else {
215
+ addPreset(value);
216
+ }
217
+ } else {
218
+ throw new Error('Expected usable value, not `' + value + '`');
219
+ }
220
+ }
221
+
222
+ function addList(plugins) {
223
+ var length;
224
+ var index;
225
+
226
+ if (plugins === null || plugins === undefined) {
227
+ /* Empty */
228
+ } else if (typeof plugins === 'object' && 'length' in plugins) {
229
+ length = plugins.length;
230
+ index = -1;
231
+
232
+ while (++index < length) {
233
+ add(plugins[index]);
234
+ }
235
+ } else {
236
+ throw new Error('Expected a list of plugins, not `' + plugins + '`');
237
+ }
238
+ }
239
+
240
+ function addPlugin(plugin, value) {
241
+ var entry = find(plugin);
242
+
243
+ if (entry) {
244
+ if (plain(entry[1]) && plain(value)) {
245
+ value = extend(entry[1], value);
246
+ }
247
+
248
+ entry[1] = value;
249
+ } else {
250
+ attachers.push(slice.call(arguments));
251
+ }
252
+ }
253
+ }
254
+
255
+ function find(plugin) {
256
+ var length = attachers.length;
257
+ var index = -1;
258
+ var entry;
259
+
260
+ while (++index < length) {
261
+ entry = attachers[index];
262
+
263
+ if (entry[0] === plugin) {
264
+ return entry;
265
+ }
266
+ }
267
+ }
268
+ /* Parse a file (in string or VFile representation)
269
+ * into a Unist node using the `Parser` on the
270
+ * processor. */
271
+
272
+
273
+ function parse(doc) {
274
+ var file = vfile(doc);
275
+ var Parser;
276
+ freeze();
277
+ Parser = processor.Parser;
278
+ assertParser('parse', Parser);
279
+
280
+ if (newable(Parser)) {
281
+ return new Parser(String(file), file).parse();
282
+ }
283
+
284
+ return Parser(String(file), file); // eslint-disable-line new-cap
285
+ }
286
+ /* Run transforms on a Unist node representation of a file
287
+ * (in string or VFile representation), async. */
288
+
289
+
290
+ function run(node, file, cb) {
291
+ assertNode(node);
292
+ freeze();
293
+
294
+ if (!cb && typeof file === 'function') {
295
+ cb = file;
296
+ file = null;
297
+ }
298
+
299
+ if (!cb) {
300
+ return new Promise(executor);
301
+ }
302
+
303
+ executor(null, cb);
304
+
305
+ function executor(resolve, reject) {
306
+ transformers.run(node, vfile(file), done);
307
+
308
+ function done(err, tree, file) {
309
+ tree = tree || node;
310
+
311
+ if (err) {
312
+ reject(err);
313
+ } else if (resolve) {
314
+ resolve(tree);
315
+ } else {
316
+ cb(null, tree, file);
317
+ }
318
+ }
319
+ }
320
+ }
321
+ /* Run transforms on a Unist node representation of a file
322
+ * (in string or VFile representation), sync. */
323
+
324
+
325
+ function runSync(node, file) {
326
+ var complete = false;
327
+ var result;
328
+ run(node, file, done);
329
+ assertDone('runSync', 'run', complete);
330
+ return result;
331
+
332
+ function done(err, tree) {
333
+ complete = true;
334
+ bail(err);
335
+ result = tree;
336
+ }
337
+ }
338
+ /* Stringify a Unist node representation of a file
339
+ * (in string or VFile representation) into a string
340
+ * using the `Compiler` on the processor. */
341
+
342
+
343
+ function stringify(node, doc) {
344
+ var file = vfile(doc);
345
+ var Compiler;
346
+ freeze();
347
+ Compiler = processor.Compiler;
348
+ assertCompiler('stringify', Compiler);
349
+ assertNode(node);
350
+
351
+ if (newable(Compiler)) {
352
+ return new Compiler(node, file).compile();
353
+ }
354
+
355
+ return Compiler(node, file); // eslint-disable-line new-cap
356
+ }
357
+ /* Parse a file (in string or VFile representation)
358
+ * into a Unist node using the `Parser` on the processor,
359
+ * then run transforms on that node, and compile the
360
+ * resulting node using the `Compiler` on the processor,
361
+ * and store that result on the VFile. */
362
+
363
+
364
+ function process(doc, cb) {
365
+ freeze();
366
+ assertParser('process', processor.Parser);
367
+ assertCompiler('process', processor.Compiler);
368
+
369
+ if (!cb) {
370
+ return new Promise(executor);
371
+ }
372
+
373
+ executor(null, cb);
374
+
375
+ function executor(resolve, reject) {
376
+ var file = vfile(doc);
377
+ pipeline.run(processor, {
378
+ file: file
379
+ }, done);
380
+
381
+ function done(err) {
382
+ if (err) {
383
+ reject(err);
384
+ } else if (resolve) {
385
+ resolve(file);
386
+ } else {
387
+ cb(null, file);
388
+ }
389
+ }
390
+ }
391
+ }
392
+ /* Process the given document (in string or VFile
393
+ * representation), sync. */
394
+
395
+
396
+ function processSync(doc) {
397
+ var complete = false;
398
+ var file;
399
+ freeze();
400
+ assertParser('processSync', processor.Parser);
401
+ assertCompiler('processSync', processor.Compiler);
402
+ file = vfile(doc);
403
+ process(file, done);
404
+ assertDone('processSync', 'process', complete);
405
+ return file;
406
+
407
+ function done(err) {
408
+ complete = true;
409
+ bail(err);
410
+ }
411
+ }
412
+ }
413
+ /* Check if `func` is a constructor. */
414
+
415
+
416
+ function newable(value) {
417
+ return typeof value === 'function' && keys(value.prototype);
418
+ }
419
+ /* Check if `value` is an object with keys. */
420
+
421
+
422
+ function keys(value) {
423
+ var key;
424
+
425
+ for (key in value) {
426
+ return true;
427
+ }
428
+
429
+ return false;
430
+ }
431
+ /* Assert a parser is available. */
432
+
433
+
434
+ function assertParser(name, Parser) {
435
+ if (typeof Parser !== 'function') {
436
+ throw new Error('Cannot `' + name + '` without `Parser`');
437
+ }
438
+ }
439
+ /* Assert a compiler is available. */
440
+
441
+
442
+ function assertCompiler(name, Compiler) {
443
+ if (typeof Compiler !== 'function') {
444
+ throw new Error('Cannot `' + name + '` without `Compiler`');
445
+ }
446
+ }
447
+ /* Assert the processor is not frozen. */
448
+
449
+
450
+ function assertUnfrozen(name, frozen) {
451
+ if (frozen) {
452
+ throw new Error(['Cannot invoke `' + name + '` on a frozen processor.\nCreate a new ', 'processor first, by invoking it: use `processor()` instead of ', '`processor`.'].join(''));
453
+ }
454
+ }
455
+ /* Assert `node` is a Unist node. */
456
+
457
+
458
+ function assertNode(node) {
459
+ if (!node || !string(node.type)) {
460
+ throw new Error('Expected node, got `' + node + '`');
461
+ }
462
+ }
463
+ /* Assert that `complete` is `true`. */
464
+
465
+
466
+ function assertDone(name, asyncName, complete) {
467
+ if (!complete) {
468
+ throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead');
469
+ }
470
+ }
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.throttle = exports.isInternalImg = exports.isFunction = exports.getImageThumbnailUrl = exports.getFileIconUrl = exports.debounce = exports.checkSVGImage = void 0;
5
+ var FILEEXT_ICON_MAP = {
6
+ // text file
7
+ md: "txt.png",
8
+ txt: "txt.png",
9
+ // pdf file
10
+ pdf: "pdf.png",
11
+ // document file
12
+ doc: "word.png",
13
+ docx: "word.png",
14
+ odt: "word.png",
15
+ fodt: "word.png",
16
+ ppt: "ppt.png",
17
+ pptx: "ppt.png",
18
+ odp: "ppt.png",
19
+ fodp: "ppt.png",
20
+ xls: "excel.png",
21
+ xlsx: "excel.png",
22
+ ods: "excel.png",
23
+ fods: "excel.png",
24
+ // video
25
+ mp4: "video.png",
26
+ ogv: "video.png",
27
+ webm: "video.png",
28
+ mov: "video.png",
29
+ flv: "video.png",
30
+ wmv: "video.png",
31
+ rmvb: "video.png",
32
+ // music file
33
+ mp3: "music.png",
34
+ oga: "music.png",
35
+ ogg: "music.png",
36
+ flac: "music.png",
37
+ aac: "music.png",
38
+ ac3: "music.png",
39
+ wma: "music.png",
40
+ // image file
41
+ jpg: "pic.png",
42
+ jpeg: "pic.png",
43
+ png: "pic.png",
44
+ svg: "pic.png",
45
+ gif: "pic.png",
46
+ bmp: "pic.png",
47
+ ico: "pic.png",
48
+ // folder dir
49
+ folder: "folder-192.png",
50
+ // default
51
+ default: "file.png"
52
+ };
53
+
54
+ var getFileIconUrl = function getFileIconUrl(filename, direntType) {
55
+ if (direntType === "dir") {
56
+ var _iconUrl = "assets/images/folder/" + FILEEXT_ICON_MAP["folder"];
57
+
58
+ return _iconUrl;
59
+ }
60
+
61
+ var iconUrl = "";
62
+
63
+ if (filename.lastIndexOf(".") === -1) {
64
+ iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP["default"];
65
+ return iconUrl;
66
+ }
67
+
68
+ var file_ext = filename.substr(filename.lastIndexOf(".") + 1).toLowerCase();
69
+
70
+ if (FILEEXT_ICON_MAP[file_ext]) {
71
+ iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP[file_ext];
72
+ } else {
73
+ iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP["default"];
74
+ }
75
+
76
+ return iconUrl;
77
+ };
78
+
79
+ exports.getFileIconUrl = getFileIconUrl;
80
+
81
+ var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
82
+ if (server && url.indexOf(server) > -1) {
83
+ return url.replace("/workspace", "/thumbnail/workspace") + "?size=256";
84
+ }
85
+
86
+ return url;
87
+ };
88
+
89
+ exports.getImageThumbnailUrl = getImageThumbnailUrl;
90
+
91
+ var debounce = function debounce(fn, wait) {
92
+ var timeout = null;
93
+ return function () {
94
+ if (timeout !== null) clearTimeout(timeout);
95
+ timeout = setTimeout(fn, wait);
96
+ };
97
+ };
98
+
99
+ exports.debounce = debounce;
100
+
101
+ var throttle = function throttle(func, delay) {
102
+ var timer = null;
103
+ var startTime = Date.now();
104
+ return function () {
105
+ var curTime = Date.now();
106
+ var remaining = delay - (curTime - startTime);
107
+ var context = this;
108
+ var args = arguments;
109
+ clearTimeout(timer);
110
+
111
+ if (remaining <= 0) {
112
+ func.apply(context, args);
113
+ startTime = Date.now();
114
+ } else {
115
+ timer = setTimeout(func, remaining);
116
+ }
117
+ };
118
+ };
119
+
120
+ exports.throttle = throttle;
121
+
122
+ var isFunction = function isFunction(functionToCheck) {
123
+ var getType = {};
124
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
125
+ };
126
+
127
+ exports.isFunction = isFunction;
128
+
129
+ var isInternalImg = function isInternalImg(url) {
130
+ if (!url) return;
131
+ return url.indexOf(window.dtable.server) > -1;
132
+ };
133
+
134
+ exports.isInternalImg = isInternalImg;
135
+
136
+ var checkSVGImage = function checkSVGImage(url) {
137
+ if (!url) return false;
138
+ return url.substr(-4).toLowerCase() === '.svg';
139
+ };
140
+
141
+ exports.checkSVGImage = checkSVGImage;