@leankylin-sheet/core 1.2.11 → 1.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.
- package/dist/events/paste.d.ts +2 -0
- package/dist/index.esm.js +428 -2
- package/dist/index.js +428 -0
- package/package.json +2 -2
package/dist/events/paste.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Context } from "../context";
|
|
2
2
|
export declare function handlePaste(ctx: Context, e: ClipboardEvent): void;
|
|
3
|
+
export declare function getClipboardContent(): Promise<string>;
|
|
4
|
+
export declare function handlePasteByLeanklin(ctx: Context, clipboard: string): Promise<void>;
|
|
3
5
|
export declare function handlePasteByClick(ctx: Context, triggerType?: string): void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _, { isPlainObject } from 'lodash';
|
|
1
|
+
import _, { isPlainObject, pick } from 'lodash';
|
|
2
2
|
import numeral from 'numeral';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import { Parser, ERROR_REF } from '@leankylin-sheet/formula-parser';
|
|
@@ -52,6 +52,307 @@ function _objectSpread2(e) {
|
|
|
52
52
|
}
|
|
53
53
|
return e;
|
|
54
54
|
}
|
|
55
|
+
function _regeneratorRuntime() {
|
|
56
|
+
_regeneratorRuntime = function () {
|
|
57
|
+
return e;
|
|
58
|
+
};
|
|
59
|
+
var t,
|
|
60
|
+
e = {},
|
|
61
|
+
r = Object.prototype,
|
|
62
|
+
n = r.hasOwnProperty,
|
|
63
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
64
|
+
t[e] = r.value;
|
|
65
|
+
},
|
|
66
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
67
|
+
a = i.iterator || "@@iterator",
|
|
68
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
69
|
+
u = i.toStringTag || "@@toStringTag";
|
|
70
|
+
function define(t, e, r) {
|
|
71
|
+
return Object.defineProperty(t, e, {
|
|
72
|
+
value: r,
|
|
73
|
+
enumerable: !0,
|
|
74
|
+
configurable: !0,
|
|
75
|
+
writable: !0
|
|
76
|
+
}), t[e];
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
define({}, "");
|
|
80
|
+
} catch (t) {
|
|
81
|
+
define = function (t, e, r) {
|
|
82
|
+
return t[e] = r;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function wrap(t, e, r, n) {
|
|
86
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
87
|
+
a = Object.create(i.prototype),
|
|
88
|
+
c = new Context(n || []);
|
|
89
|
+
return o(a, "_invoke", {
|
|
90
|
+
value: makeInvokeMethod(t, r, c)
|
|
91
|
+
}), a;
|
|
92
|
+
}
|
|
93
|
+
function tryCatch(t, e, r) {
|
|
94
|
+
try {
|
|
95
|
+
return {
|
|
96
|
+
type: "normal",
|
|
97
|
+
arg: t.call(e, r)
|
|
98
|
+
};
|
|
99
|
+
} catch (t) {
|
|
100
|
+
return {
|
|
101
|
+
type: "throw",
|
|
102
|
+
arg: t
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
e.wrap = wrap;
|
|
107
|
+
var h = "suspendedStart",
|
|
108
|
+
l = "suspendedYield",
|
|
109
|
+
f = "executing",
|
|
110
|
+
s = "completed",
|
|
111
|
+
y = {};
|
|
112
|
+
function Generator() {}
|
|
113
|
+
function GeneratorFunction() {}
|
|
114
|
+
function GeneratorFunctionPrototype() {}
|
|
115
|
+
var p = {};
|
|
116
|
+
define(p, a, function () {
|
|
117
|
+
return this;
|
|
118
|
+
});
|
|
119
|
+
var d = Object.getPrototypeOf,
|
|
120
|
+
v = d && d(d(values([])));
|
|
121
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
122
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
123
|
+
function defineIteratorMethods(t) {
|
|
124
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
125
|
+
define(t, e, function (t) {
|
|
126
|
+
return this._invoke(e, t);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function AsyncIterator(t, e) {
|
|
131
|
+
function invoke(r, o, i, a) {
|
|
132
|
+
var c = tryCatch(t[r], t, o);
|
|
133
|
+
if ("throw" !== c.type) {
|
|
134
|
+
var u = c.arg,
|
|
135
|
+
h = u.value;
|
|
136
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
137
|
+
invoke("next", t, i, a);
|
|
138
|
+
}, function (t) {
|
|
139
|
+
invoke("throw", t, i, a);
|
|
140
|
+
}) : e.resolve(h).then(function (t) {
|
|
141
|
+
u.value = t, i(u);
|
|
142
|
+
}, function (t) {
|
|
143
|
+
return invoke("throw", t, i, a);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
a(c.arg);
|
|
147
|
+
}
|
|
148
|
+
var r;
|
|
149
|
+
o(this, "_invoke", {
|
|
150
|
+
value: function (t, n) {
|
|
151
|
+
function callInvokeWithMethodAndArg() {
|
|
152
|
+
return new e(function (e, r) {
|
|
153
|
+
invoke(t, n, e, r);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function makeInvokeMethod(e, r, n) {
|
|
161
|
+
var o = h;
|
|
162
|
+
return function (i, a) {
|
|
163
|
+
if (o === f) throw Error("Generator is already running");
|
|
164
|
+
if (o === s) {
|
|
165
|
+
if ("throw" === i) throw a;
|
|
166
|
+
return {
|
|
167
|
+
value: t,
|
|
168
|
+
done: !0
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
for (n.method = i, n.arg = a;;) {
|
|
172
|
+
var c = n.delegate;
|
|
173
|
+
if (c) {
|
|
174
|
+
var u = maybeInvokeDelegate(c, n);
|
|
175
|
+
if (u) {
|
|
176
|
+
if (u === y) continue;
|
|
177
|
+
return u;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
181
|
+
if (o === h) throw o = s, n.arg;
|
|
182
|
+
n.dispatchException(n.arg);
|
|
183
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
184
|
+
o = f;
|
|
185
|
+
var p = tryCatch(e, r, n);
|
|
186
|
+
if ("normal" === p.type) {
|
|
187
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
188
|
+
return {
|
|
189
|
+
value: p.arg,
|
|
190
|
+
done: n.done
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function maybeInvokeDelegate(e, r) {
|
|
198
|
+
var n = r.method,
|
|
199
|
+
o = e.iterator[n];
|
|
200
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
201
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
202
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
203
|
+
var a = i.arg;
|
|
204
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
205
|
+
}
|
|
206
|
+
function pushTryEntry(t) {
|
|
207
|
+
var e = {
|
|
208
|
+
tryLoc: t[0]
|
|
209
|
+
};
|
|
210
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
211
|
+
}
|
|
212
|
+
function resetTryEntry(t) {
|
|
213
|
+
var e = t.completion || {};
|
|
214
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
215
|
+
}
|
|
216
|
+
function Context(t) {
|
|
217
|
+
this.tryEntries = [{
|
|
218
|
+
tryLoc: "root"
|
|
219
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
220
|
+
}
|
|
221
|
+
function values(e) {
|
|
222
|
+
if (e || "" === e) {
|
|
223
|
+
var r = e[a];
|
|
224
|
+
if (r) return r.call(e);
|
|
225
|
+
if ("function" == typeof e.next) return e;
|
|
226
|
+
if (!isNaN(e.length)) {
|
|
227
|
+
var o = -1,
|
|
228
|
+
i = function next() {
|
|
229
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
230
|
+
return next.value = t, next.done = !0, next;
|
|
231
|
+
};
|
|
232
|
+
return i.next = i;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
236
|
+
}
|
|
237
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
238
|
+
value: GeneratorFunctionPrototype,
|
|
239
|
+
configurable: !0
|
|
240
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
241
|
+
value: GeneratorFunction,
|
|
242
|
+
configurable: !0
|
|
243
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
244
|
+
var e = "function" == typeof t && t.constructor;
|
|
245
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
246
|
+
}, e.mark = function (t) {
|
|
247
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
248
|
+
}, e.awrap = function (t) {
|
|
249
|
+
return {
|
|
250
|
+
__await: t
|
|
251
|
+
};
|
|
252
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
253
|
+
return this;
|
|
254
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
255
|
+
void 0 === i && (i = Promise);
|
|
256
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
257
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
258
|
+
return t.done ? t.value : a.next();
|
|
259
|
+
});
|
|
260
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
261
|
+
return this;
|
|
262
|
+
}), define(g, "toString", function () {
|
|
263
|
+
return "[object Generator]";
|
|
264
|
+
}), e.keys = function (t) {
|
|
265
|
+
var e = Object(t),
|
|
266
|
+
r = [];
|
|
267
|
+
for (var n in e) r.push(n);
|
|
268
|
+
return r.reverse(), function next() {
|
|
269
|
+
for (; r.length;) {
|
|
270
|
+
var t = r.pop();
|
|
271
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
272
|
+
}
|
|
273
|
+
return next.done = !0, next;
|
|
274
|
+
};
|
|
275
|
+
}, e.values = values, Context.prototype = {
|
|
276
|
+
constructor: Context,
|
|
277
|
+
reset: function (e) {
|
|
278
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
279
|
+
},
|
|
280
|
+
stop: function () {
|
|
281
|
+
this.done = !0;
|
|
282
|
+
var t = this.tryEntries[0].completion;
|
|
283
|
+
if ("throw" === t.type) throw t.arg;
|
|
284
|
+
return this.rval;
|
|
285
|
+
},
|
|
286
|
+
dispatchException: function (e) {
|
|
287
|
+
if (this.done) throw e;
|
|
288
|
+
var r = this;
|
|
289
|
+
function handle(n, o) {
|
|
290
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
291
|
+
}
|
|
292
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
293
|
+
var i = this.tryEntries[o],
|
|
294
|
+
a = i.completion;
|
|
295
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
296
|
+
if (i.tryLoc <= this.prev) {
|
|
297
|
+
var c = n.call(i, "catchLoc"),
|
|
298
|
+
u = n.call(i, "finallyLoc");
|
|
299
|
+
if (c && u) {
|
|
300
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
301
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
302
|
+
} else if (c) {
|
|
303
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
304
|
+
} else {
|
|
305
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
306
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
abrupt: function (t, e) {
|
|
312
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
313
|
+
var o = this.tryEntries[r];
|
|
314
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
315
|
+
var i = o;
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
320
|
+
var a = i ? i.completion : {};
|
|
321
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
322
|
+
},
|
|
323
|
+
complete: function (t, e) {
|
|
324
|
+
if ("throw" === t.type) throw t.arg;
|
|
325
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
326
|
+
},
|
|
327
|
+
finish: function (t) {
|
|
328
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
329
|
+
var r = this.tryEntries[e];
|
|
330
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
catch: function (t) {
|
|
334
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
335
|
+
var r = this.tryEntries[e];
|
|
336
|
+
if (r.tryLoc === t) {
|
|
337
|
+
var n = r.completion;
|
|
338
|
+
if ("throw" === n.type) {
|
|
339
|
+
var o = n.arg;
|
|
340
|
+
resetTryEntry(r);
|
|
341
|
+
}
|
|
342
|
+
return o;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
throw Error("illegal catch attempt");
|
|
346
|
+
},
|
|
347
|
+
delegateYield: function (e, r, n) {
|
|
348
|
+
return this.delegate = {
|
|
349
|
+
iterator: values(e),
|
|
350
|
+
resultName: r,
|
|
351
|
+
nextLoc: n
|
|
352
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
353
|
+
}
|
|
354
|
+
}, e;
|
|
355
|
+
}
|
|
55
356
|
function _toPrimitive(t, r) {
|
|
56
357
|
if ("object" != typeof t || !t) return t;
|
|
57
358
|
var e = t[Symbol.toPrimitive];
|
|
@@ -75,6 +376,36 @@ function _typeof(o) {
|
|
|
75
376
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
76
377
|
}, _typeof(o);
|
|
77
378
|
}
|
|
379
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
380
|
+
try {
|
|
381
|
+
var info = gen[key](arg);
|
|
382
|
+
var value = info.value;
|
|
383
|
+
} catch (error) {
|
|
384
|
+
reject(error);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (info.done) {
|
|
388
|
+
resolve(value);
|
|
389
|
+
} else {
|
|
390
|
+
Promise.resolve(value).then(_next, _throw);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function _asyncToGenerator(fn) {
|
|
394
|
+
return function () {
|
|
395
|
+
var self = this,
|
|
396
|
+
args = arguments;
|
|
397
|
+
return new Promise(function (resolve, reject) {
|
|
398
|
+
var gen = fn.apply(self, args);
|
|
399
|
+
function _next(value) {
|
|
400
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
401
|
+
}
|
|
402
|
+
function _throw(err) {
|
|
403
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
404
|
+
}
|
|
405
|
+
_next(undefined);
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
}
|
|
78
409
|
function _classCallCheck(instance, Constructor) {
|
|
79
410
|
if (!(instance instanceof Constructor)) {
|
|
80
411
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -68418,6 +68749,16 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
|
|
|
68418
68749
|
postPasteCut(ctx, source, target, copyRowlChange);
|
|
68419
68750
|
}
|
|
68420
68751
|
}
|
|
68752
|
+
function transofrmCellDataOfCopy(ctx, cellData, r, c) {
|
|
68753
|
+
var _currentData$data$r$c, _currentData$data, _currentData$data$r;
|
|
68754
|
+
var currentSheetId = ctx.currentSheetId,
|
|
68755
|
+
luckysheetfile = ctx.luckysheetfile;
|
|
68756
|
+
var currentData = luckysheetfile === null || luckysheetfile === void 0 ? void 0 : luckysheetfile.find(function (item) {
|
|
68757
|
+
return item.id === currentSheetId;
|
|
68758
|
+
});
|
|
68759
|
+
var originCell = (_currentData$data$r$c = (_currentData$data = currentData.data) === null || _currentData$data === void 0 ? void 0 : (_currentData$data$r = _currentData$data[r]) === null || _currentData$data$r === void 0 ? void 0 : _currentData$data$r[c]) !== null && _currentData$data$r$c !== void 0 ? _currentData$data$r$c : {};
|
|
68760
|
+
return _objectSpread2(_objectSpread2({}, originCell), pick(cellData, "v", "m"));
|
|
68761
|
+
}
|
|
68421
68762
|
function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
68422
68763
|
var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7, _ctx$luckysheet_copy_5;
|
|
68423
68764
|
var allowEdit = isAllowEdit(ctx);
|
|
@@ -68597,6 +68938,7 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
|
68597
68938
|
var value = null;
|
|
68598
68939
|
if ((_copyData = copyData[h - mth]) === null || _copyData === void 0 ? void 0 : _copyData[c - mtc]) {
|
|
68599
68940
|
value = _.cloneDeep(copyData[h - mth][c - mtc]);
|
|
68941
|
+
value = transofrmCellDataOfCopy(ctx, value, h, c);
|
|
68600
68942
|
}
|
|
68601
68943
|
if (!_.isNil(value) && !_.isNil(value.f)) {
|
|
68602
68944
|
var func = value.f;
|
|
@@ -68925,6 +69267,7 @@ function handlePaste(ctx, e) {
|
|
|
68925
69267
|
while (c < colLen && !_.isNil(data[_r2][c])) {
|
|
68926
69268
|
c += 1;
|
|
68927
69269
|
}
|
|
69270
|
+
cell = transofrmCellDataOfCopy(ctx, cell, _r2, c);
|
|
68928
69271
|
if (c === colLen) {
|
|
68929
69272
|
return true;
|
|
68930
69273
|
}
|
|
@@ -69056,6 +69399,89 @@ function handlePaste(ctx, e) {
|
|
|
69056
69399
|
}
|
|
69057
69400
|
}
|
|
69058
69401
|
}
|
|
69402
|
+
function getClipboardContent() {
|
|
69403
|
+
return _getClipboardContent.apply(this, arguments);
|
|
69404
|
+
}
|
|
69405
|
+
function _getClipboardContent() {
|
|
69406
|
+
_getClipboardContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
69407
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
69408
|
+
while (1) switch (_context.prev = _context.next) {
|
|
69409
|
+
case 0:
|
|
69410
|
+
return _context.abrupt("return", new Promise(function (res) {
|
|
69411
|
+
if (navigator.clipboard) {
|
|
69412
|
+
navigator.clipboard.readText().then(function (text) {
|
|
69413
|
+
res(text);
|
|
69414
|
+
}).catch(function () {
|
|
69415
|
+
res("");
|
|
69416
|
+
});
|
|
69417
|
+
} else {
|
|
69418
|
+
res("");
|
|
69419
|
+
}
|
|
69420
|
+
}));
|
|
69421
|
+
case 1:
|
|
69422
|
+
case "end":
|
|
69423
|
+
return _context.stop();
|
|
69424
|
+
}
|
|
69425
|
+
}, _callee);
|
|
69426
|
+
}));
|
|
69427
|
+
return _getClipboardContent.apply(this, arguments);
|
|
69428
|
+
}
|
|
69429
|
+
function handlePasteByLeanklin(_x2, _x3) {
|
|
69430
|
+
return _handlePasteByLeanklin.apply(this, arguments);
|
|
69431
|
+
}
|
|
69432
|
+
function _handlePasteByLeanklin() {
|
|
69433
|
+
_handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, clipboard) {
|
|
69434
|
+
var _ctx$luckysheet_selec8;
|
|
69435
|
+
var allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
|
|
69436
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
69437
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
69438
|
+
case 0:
|
|
69439
|
+
allowEdit = isAllowEdit(ctx);
|
|
69440
|
+
if (allowEdit) {
|
|
69441
|
+
_context2.next = 3;
|
|
69442
|
+
break;
|
|
69443
|
+
}
|
|
69444
|
+
return _context2.abrupt("return");
|
|
69445
|
+
case 3:
|
|
69446
|
+
selectRange = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[0];
|
|
69447
|
+
if (selectRange) {
|
|
69448
|
+
_context2.next = 6;
|
|
69449
|
+
break;
|
|
69450
|
+
}
|
|
69451
|
+
return _context2.abrupt("return");
|
|
69452
|
+
case 6:
|
|
69453
|
+
rows = selectRange.row;
|
|
69454
|
+
columns = selectRange.column;
|
|
69455
|
+
data = clipboard.split("\n").map(function (item) {
|
|
69456
|
+
return item.split("\t");
|
|
69457
|
+
});
|
|
69458
|
+
copyOne = data.length === 1 && data[0].length === 1;
|
|
69459
|
+
newData = copyOne ? [] : data;
|
|
69460
|
+
if (copyOne) {
|
|
69461
|
+
for (r = rows[0]; r <= rows[1]; r += 1) {
|
|
69462
|
+
rIndex = r - rows[0];
|
|
69463
|
+
newData[rIndex] = [];
|
|
69464
|
+
for (c = columns[0]; c <= columns[1]; c += 1) {
|
|
69465
|
+
newData[rIndex].push(data[0][0]);
|
|
69466
|
+
}
|
|
69467
|
+
}
|
|
69468
|
+
}
|
|
69469
|
+
row = [rows[0], rows[0] + newData.length - 1];
|
|
69470
|
+
column = [columns[0], columns[0] + newData[0].length - 1];
|
|
69471
|
+
range = {
|
|
69472
|
+
row: row,
|
|
69473
|
+
column: column
|
|
69474
|
+
};
|
|
69475
|
+
setCellValuesByRange(ctx, newData, range, null);
|
|
69476
|
+
ctx.luckysheet_select_save = [range];
|
|
69477
|
+
case 17:
|
|
69478
|
+
case "end":
|
|
69479
|
+
return _context2.stop();
|
|
69480
|
+
}
|
|
69481
|
+
}, _callee2);
|
|
69482
|
+
}));
|
|
69483
|
+
return _handlePasteByLeanklin.apply(this, arguments);
|
|
69484
|
+
}
|
|
69059
69485
|
function handlePasteByClick(ctx, triggerType) {
|
|
69060
69486
|
var _ctx$luckysheet_copy_11;
|
|
69061
69487
|
var allowEdit = isAllowEdit(ctx);
|
|
@@ -69073,4 +69499,4 @@ function handlePasteByClick(ctx, triggerType) {
|
|
|
69073
69499
|
} else if (data.indexOf("leankylin-copy-action-image") > -1) ; else ;
|
|
69074
69500
|
}
|
|
69075
69501
|
|
|
69076
|
-
export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
|
|
69502
|
+
export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getClipboardContent, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePasteByLeanklin, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, saveFilter, saveHyperlink, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropcownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,307 @@ function _objectSpread2(e) {
|
|
|
62
62
|
}
|
|
63
63
|
return e;
|
|
64
64
|
}
|
|
65
|
+
function _regeneratorRuntime() {
|
|
66
|
+
_regeneratorRuntime = function () {
|
|
67
|
+
return e;
|
|
68
|
+
};
|
|
69
|
+
var t,
|
|
70
|
+
e = {},
|
|
71
|
+
r = Object.prototype,
|
|
72
|
+
n = r.hasOwnProperty,
|
|
73
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
74
|
+
t[e] = r.value;
|
|
75
|
+
},
|
|
76
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
77
|
+
a = i.iterator || "@@iterator",
|
|
78
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
79
|
+
u = i.toStringTag || "@@toStringTag";
|
|
80
|
+
function define(t, e, r) {
|
|
81
|
+
return Object.defineProperty(t, e, {
|
|
82
|
+
value: r,
|
|
83
|
+
enumerable: !0,
|
|
84
|
+
configurable: !0,
|
|
85
|
+
writable: !0
|
|
86
|
+
}), t[e];
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
define({}, "");
|
|
90
|
+
} catch (t) {
|
|
91
|
+
define = function (t, e, r) {
|
|
92
|
+
return t[e] = r;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function wrap(t, e, r, n) {
|
|
96
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
97
|
+
a = Object.create(i.prototype),
|
|
98
|
+
c = new Context(n || []);
|
|
99
|
+
return o(a, "_invoke", {
|
|
100
|
+
value: makeInvokeMethod(t, r, c)
|
|
101
|
+
}), a;
|
|
102
|
+
}
|
|
103
|
+
function tryCatch(t, e, r) {
|
|
104
|
+
try {
|
|
105
|
+
return {
|
|
106
|
+
type: "normal",
|
|
107
|
+
arg: t.call(e, r)
|
|
108
|
+
};
|
|
109
|
+
} catch (t) {
|
|
110
|
+
return {
|
|
111
|
+
type: "throw",
|
|
112
|
+
arg: t
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
e.wrap = wrap;
|
|
117
|
+
var h = "suspendedStart",
|
|
118
|
+
l = "suspendedYield",
|
|
119
|
+
f = "executing",
|
|
120
|
+
s = "completed",
|
|
121
|
+
y = {};
|
|
122
|
+
function Generator() {}
|
|
123
|
+
function GeneratorFunction() {}
|
|
124
|
+
function GeneratorFunctionPrototype() {}
|
|
125
|
+
var p = {};
|
|
126
|
+
define(p, a, function () {
|
|
127
|
+
return this;
|
|
128
|
+
});
|
|
129
|
+
var d = Object.getPrototypeOf,
|
|
130
|
+
v = d && d(d(values([])));
|
|
131
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
132
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
133
|
+
function defineIteratorMethods(t) {
|
|
134
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
135
|
+
define(t, e, function (t) {
|
|
136
|
+
return this._invoke(e, t);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function AsyncIterator(t, e) {
|
|
141
|
+
function invoke(r, o, i, a) {
|
|
142
|
+
var c = tryCatch(t[r], t, o);
|
|
143
|
+
if ("throw" !== c.type) {
|
|
144
|
+
var u = c.arg,
|
|
145
|
+
h = u.value;
|
|
146
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
147
|
+
invoke("next", t, i, a);
|
|
148
|
+
}, function (t) {
|
|
149
|
+
invoke("throw", t, i, a);
|
|
150
|
+
}) : e.resolve(h).then(function (t) {
|
|
151
|
+
u.value = t, i(u);
|
|
152
|
+
}, function (t) {
|
|
153
|
+
return invoke("throw", t, i, a);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
a(c.arg);
|
|
157
|
+
}
|
|
158
|
+
var r;
|
|
159
|
+
o(this, "_invoke", {
|
|
160
|
+
value: function (t, n) {
|
|
161
|
+
function callInvokeWithMethodAndArg() {
|
|
162
|
+
return new e(function (e, r) {
|
|
163
|
+
invoke(t, n, e, r);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function makeInvokeMethod(e, r, n) {
|
|
171
|
+
var o = h;
|
|
172
|
+
return function (i, a) {
|
|
173
|
+
if (o === f) throw Error("Generator is already running");
|
|
174
|
+
if (o === s) {
|
|
175
|
+
if ("throw" === i) throw a;
|
|
176
|
+
return {
|
|
177
|
+
value: t,
|
|
178
|
+
done: !0
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
for (n.method = i, n.arg = a;;) {
|
|
182
|
+
var c = n.delegate;
|
|
183
|
+
if (c) {
|
|
184
|
+
var u = maybeInvokeDelegate(c, n);
|
|
185
|
+
if (u) {
|
|
186
|
+
if (u === y) continue;
|
|
187
|
+
return u;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
191
|
+
if (o === h) throw o = s, n.arg;
|
|
192
|
+
n.dispatchException(n.arg);
|
|
193
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
194
|
+
o = f;
|
|
195
|
+
var p = tryCatch(e, r, n);
|
|
196
|
+
if ("normal" === p.type) {
|
|
197
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
198
|
+
return {
|
|
199
|
+
value: p.arg,
|
|
200
|
+
done: n.done
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function maybeInvokeDelegate(e, r) {
|
|
208
|
+
var n = r.method,
|
|
209
|
+
o = e.iterator[n];
|
|
210
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
211
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
212
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
213
|
+
var a = i.arg;
|
|
214
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
215
|
+
}
|
|
216
|
+
function pushTryEntry(t) {
|
|
217
|
+
var e = {
|
|
218
|
+
tryLoc: t[0]
|
|
219
|
+
};
|
|
220
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
221
|
+
}
|
|
222
|
+
function resetTryEntry(t) {
|
|
223
|
+
var e = t.completion || {};
|
|
224
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
225
|
+
}
|
|
226
|
+
function Context(t) {
|
|
227
|
+
this.tryEntries = [{
|
|
228
|
+
tryLoc: "root"
|
|
229
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
230
|
+
}
|
|
231
|
+
function values(e) {
|
|
232
|
+
if (e || "" === e) {
|
|
233
|
+
var r = e[a];
|
|
234
|
+
if (r) return r.call(e);
|
|
235
|
+
if ("function" == typeof e.next) return e;
|
|
236
|
+
if (!isNaN(e.length)) {
|
|
237
|
+
var o = -1,
|
|
238
|
+
i = function next() {
|
|
239
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
240
|
+
return next.value = t, next.done = !0, next;
|
|
241
|
+
};
|
|
242
|
+
return i.next = i;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
246
|
+
}
|
|
247
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
248
|
+
value: GeneratorFunctionPrototype,
|
|
249
|
+
configurable: !0
|
|
250
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
251
|
+
value: GeneratorFunction,
|
|
252
|
+
configurable: !0
|
|
253
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
254
|
+
var e = "function" == typeof t && t.constructor;
|
|
255
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
256
|
+
}, e.mark = function (t) {
|
|
257
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
258
|
+
}, e.awrap = function (t) {
|
|
259
|
+
return {
|
|
260
|
+
__await: t
|
|
261
|
+
};
|
|
262
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
263
|
+
return this;
|
|
264
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
265
|
+
void 0 === i && (i = Promise);
|
|
266
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
267
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
268
|
+
return t.done ? t.value : a.next();
|
|
269
|
+
});
|
|
270
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
271
|
+
return this;
|
|
272
|
+
}), define(g, "toString", function () {
|
|
273
|
+
return "[object Generator]";
|
|
274
|
+
}), e.keys = function (t) {
|
|
275
|
+
var e = Object(t),
|
|
276
|
+
r = [];
|
|
277
|
+
for (var n in e) r.push(n);
|
|
278
|
+
return r.reverse(), function next() {
|
|
279
|
+
for (; r.length;) {
|
|
280
|
+
var t = r.pop();
|
|
281
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
282
|
+
}
|
|
283
|
+
return next.done = !0, next;
|
|
284
|
+
};
|
|
285
|
+
}, e.values = values, Context.prototype = {
|
|
286
|
+
constructor: Context,
|
|
287
|
+
reset: function (e) {
|
|
288
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
289
|
+
},
|
|
290
|
+
stop: function () {
|
|
291
|
+
this.done = !0;
|
|
292
|
+
var t = this.tryEntries[0].completion;
|
|
293
|
+
if ("throw" === t.type) throw t.arg;
|
|
294
|
+
return this.rval;
|
|
295
|
+
},
|
|
296
|
+
dispatchException: function (e) {
|
|
297
|
+
if (this.done) throw e;
|
|
298
|
+
var r = this;
|
|
299
|
+
function handle(n, o) {
|
|
300
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
301
|
+
}
|
|
302
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
303
|
+
var i = this.tryEntries[o],
|
|
304
|
+
a = i.completion;
|
|
305
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
306
|
+
if (i.tryLoc <= this.prev) {
|
|
307
|
+
var c = n.call(i, "catchLoc"),
|
|
308
|
+
u = n.call(i, "finallyLoc");
|
|
309
|
+
if (c && u) {
|
|
310
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
311
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
312
|
+
} else if (c) {
|
|
313
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
314
|
+
} else {
|
|
315
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
316
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
abrupt: function (t, e) {
|
|
322
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
323
|
+
var o = this.tryEntries[r];
|
|
324
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
325
|
+
var i = o;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
330
|
+
var a = i ? i.completion : {};
|
|
331
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
332
|
+
},
|
|
333
|
+
complete: function (t, e) {
|
|
334
|
+
if ("throw" === t.type) throw t.arg;
|
|
335
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
336
|
+
},
|
|
337
|
+
finish: function (t) {
|
|
338
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
339
|
+
var r = this.tryEntries[e];
|
|
340
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
catch: function (t) {
|
|
344
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
345
|
+
var r = this.tryEntries[e];
|
|
346
|
+
if (r.tryLoc === t) {
|
|
347
|
+
var n = r.completion;
|
|
348
|
+
if ("throw" === n.type) {
|
|
349
|
+
var o = n.arg;
|
|
350
|
+
resetTryEntry(r);
|
|
351
|
+
}
|
|
352
|
+
return o;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
throw Error("illegal catch attempt");
|
|
356
|
+
},
|
|
357
|
+
delegateYield: function (e, r, n) {
|
|
358
|
+
return this.delegate = {
|
|
359
|
+
iterator: values(e),
|
|
360
|
+
resultName: r,
|
|
361
|
+
nextLoc: n
|
|
362
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
363
|
+
}
|
|
364
|
+
}, e;
|
|
365
|
+
}
|
|
65
366
|
function _toPrimitive(t, r) {
|
|
66
367
|
if ("object" != typeof t || !t) return t;
|
|
67
368
|
var e = t[Symbol.toPrimitive];
|
|
@@ -85,6 +386,36 @@ function _typeof(o) {
|
|
|
85
386
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
86
387
|
}, _typeof(o);
|
|
87
388
|
}
|
|
389
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
390
|
+
try {
|
|
391
|
+
var info = gen[key](arg);
|
|
392
|
+
var value = info.value;
|
|
393
|
+
} catch (error) {
|
|
394
|
+
reject(error);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (info.done) {
|
|
398
|
+
resolve(value);
|
|
399
|
+
} else {
|
|
400
|
+
Promise.resolve(value).then(_next, _throw);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function _asyncToGenerator(fn) {
|
|
404
|
+
return function () {
|
|
405
|
+
var self = this,
|
|
406
|
+
args = arguments;
|
|
407
|
+
return new Promise(function (resolve, reject) {
|
|
408
|
+
var gen = fn.apply(self, args);
|
|
409
|
+
function _next(value) {
|
|
410
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
411
|
+
}
|
|
412
|
+
function _throw(err) {
|
|
413
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
414
|
+
}
|
|
415
|
+
_next(undefined);
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
}
|
|
88
419
|
function _classCallCheck(instance, Constructor) {
|
|
89
420
|
if (!(instance instanceof Constructor)) {
|
|
90
421
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -68428,6 +68759,16 @@ function pasteHandlerOfCutPaste(ctx, copyRange) {
|
|
|
68428
68759
|
postPasteCut(ctx, source, target, copyRowlChange);
|
|
68429
68760
|
}
|
|
68430
68761
|
}
|
|
68762
|
+
function transofrmCellDataOfCopy(ctx, cellData, r, c) {
|
|
68763
|
+
var _currentData$data$r$c, _currentData$data, _currentData$data$r;
|
|
68764
|
+
var currentSheetId = ctx.currentSheetId,
|
|
68765
|
+
luckysheetfile = ctx.luckysheetfile;
|
|
68766
|
+
var currentData = luckysheetfile === null || luckysheetfile === void 0 ? void 0 : luckysheetfile.find(function (item) {
|
|
68767
|
+
return item.id === currentSheetId;
|
|
68768
|
+
});
|
|
68769
|
+
var originCell = (_currentData$data$r$c = (_currentData$data = currentData.data) === null || _currentData$data === void 0 ? void 0 : (_currentData$data$r = _currentData$data[r]) === null || _currentData$data$r === void 0 ? void 0 : _currentData$data$r[c]) !== null && _currentData$data$r$c !== void 0 ? _currentData$data$r$c : {};
|
|
68770
|
+
return _objectSpread2(_objectSpread2({}, originCell), _.pick(cellData, "v", "m"));
|
|
68771
|
+
}
|
|
68431
68772
|
function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
68432
68773
|
var _ctx$luckysheet_selec6, _ctx$luckysheet_selec7, _ctx$luckysheet_copy_5;
|
|
68433
68774
|
var allowEdit = isAllowEdit(ctx);
|
|
@@ -68607,6 +68948,7 @@ function pasteHandlerOfCopyPaste(ctx, copyRange) {
|
|
|
68607
68948
|
var value = null;
|
|
68608
68949
|
if ((_copyData = copyData[h - mth]) === null || _copyData === void 0 ? void 0 : _copyData[c - mtc]) {
|
|
68609
68950
|
value = ___default['default'].cloneDeep(copyData[h - mth][c - mtc]);
|
|
68951
|
+
value = transofrmCellDataOfCopy(ctx, value, h, c);
|
|
68610
68952
|
}
|
|
68611
68953
|
if (!___default['default'].isNil(value) && !___default['default'].isNil(value.f)) {
|
|
68612
68954
|
var func = value.f;
|
|
@@ -68935,6 +69277,7 @@ function handlePaste(ctx, e) {
|
|
|
68935
69277
|
while (c < colLen && !___default['default'].isNil(data[_r2][c])) {
|
|
68936
69278
|
c += 1;
|
|
68937
69279
|
}
|
|
69280
|
+
cell = transofrmCellDataOfCopy(ctx, cell, _r2, c);
|
|
68938
69281
|
if (c === colLen) {
|
|
68939
69282
|
return true;
|
|
68940
69283
|
}
|
|
@@ -69066,6 +69409,89 @@ function handlePaste(ctx, e) {
|
|
|
69066
69409
|
}
|
|
69067
69410
|
}
|
|
69068
69411
|
}
|
|
69412
|
+
function getClipboardContent() {
|
|
69413
|
+
return _getClipboardContent.apply(this, arguments);
|
|
69414
|
+
}
|
|
69415
|
+
function _getClipboardContent() {
|
|
69416
|
+
_getClipboardContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
69417
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
69418
|
+
while (1) switch (_context.prev = _context.next) {
|
|
69419
|
+
case 0:
|
|
69420
|
+
return _context.abrupt("return", new Promise(function (res) {
|
|
69421
|
+
if (navigator.clipboard) {
|
|
69422
|
+
navigator.clipboard.readText().then(function (text) {
|
|
69423
|
+
res(text);
|
|
69424
|
+
}).catch(function () {
|
|
69425
|
+
res("");
|
|
69426
|
+
});
|
|
69427
|
+
} else {
|
|
69428
|
+
res("");
|
|
69429
|
+
}
|
|
69430
|
+
}));
|
|
69431
|
+
case 1:
|
|
69432
|
+
case "end":
|
|
69433
|
+
return _context.stop();
|
|
69434
|
+
}
|
|
69435
|
+
}, _callee);
|
|
69436
|
+
}));
|
|
69437
|
+
return _getClipboardContent.apply(this, arguments);
|
|
69438
|
+
}
|
|
69439
|
+
function handlePasteByLeanklin(_x2, _x3) {
|
|
69440
|
+
return _handlePasteByLeanklin.apply(this, arguments);
|
|
69441
|
+
}
|
|
69442
|
+
function _handlePasteByLeanklin() {
|
|
69443
|
+
_handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, clipboard) {
|
|
69444
|
+
var _ctx$luckysheet_selec8;
|
|
69445
|
+
var allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
|
|
69446
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
69447
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
69448
|
+
case 0:
|
|
69449
|
+
allowEdit = isAllowEdit(ctx);
|
|
69450
|
+
if (allowEdit) {
|
|
69451
|
+
_context2.next = 3;
|
|
69452
|
+
break;
|
|
69453
|
+
}
|
|
69454
|
+
return _context2.abrupt("return");
|
|
69455
|
+
case 3:
|
|
69456
|
+
selectRange = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[0];
|
|
69457
|
+
if (selectRange) {
|
|
69458
|
+
_context2.next = 6;
|
|
69459
|
+
break;
|
|
69460
|
+
}
|
|
69461
|
+
return _context2.abrupt("return");
|
|
69462
|
+
case 6:
|
|
69463
|
+
rows = selectRange.row;
|
|
69464
|
+
columns = selectRange.column;
|
|
69465
|
+
data = clipboard.split("\n").map(function (item) {
|
|
69466
|
+
return item.split("\t");
|
|
69467
|
+
});
|
|
69468
|
+
copyOne = data.length === 1 && data[0].length === 1;
|
|
69469
|
+
newData = copyOne ? [] : data;
|
|
69470
|
+
if (copyOne) {
|
|
69471
|
+
for (r = rows[0]; r <= rows[1]; r += 1) {
|
|
69472
|
+
rIndex = r - rows[0];
|
|
69473
|
+
newData[rIndex] = [];
|
|
69474
|
+
for (c = columns[0]; c <= columns[1]; c += 1) {
|
|
69475
|
+
newData[rIndex].push(data[0][0]);
|
|
69476
|
+
}
|
|
69477
|
+
}
|
|
69478
|
+
}
|
|
69479
|
+
row = [rows[0], rows[0] + newData.length - 1];
|
|
69480
|
+
column = [columns[0], columns[0] + newData[0].length - 1];
|
|
69481
|
+
range = {
|
|
69482
|
+
row: row,
|
|
69483
|
+
column: column
|
|
69484
|
+
};
|
|
69485
|
+
setCellValuesByRange(ctx, newData, range, null);
|
|
69486
|
+
ctx.luckysheet_select_save = [range];
|
|
69487
|
+
case 17:
|
|
69488
|
+
case "end":
|
|
69489
|
+
return _context2.stop();
|
|
69490
|
+
}
|
|
69491
|
+
}, _callee2);
|
|
69492
|
+
}));
|
|
69493
|
+
return _handlePasteByLeanklin.apply(this, arguments);
|
|
69494
|
+
}
|
|
69069
69495
|
function handlePasteByClick(ctx, triggerType) {
|
|
69070
69496
|
var _ctx$luckysheet_copy_11;
|
|
69071
69497
|
var allowEdit = isAllowEdit(ctx);
|
|
@@ -69172,6 +69598,7 @@ exports.getCellRowColumn = getCellRowColumn;
|
|
|
69172
69598
|
exports.getCellTextInfo = getCellTextInfo;
|
|
69173
69599
|
exports.getCellTopRightPostion = getCellTopRightPostion;
|
|
69174
69600
|
exports.getCellValue = getCellValue;
|
|
69601
|
+
exports.getClipboardContent = getClipboardContent;
|
|
69175
69602
|
exports.getColMerge = getColMerge;
|
|
69176
69603
|
exports.getColorGradation = getColorGradation;
|
|
69177
69604
|
exports.getCommentBoxByRC = getCommentBoxByRC;
|
|
@@ -69252,6 +69679,7 @@ exports.handleOverlayTouchMove = handleOverlayTouchMove;
|
|
|
69252
69679
|
exports.handleOverlayTouchStart = handleOverlayTouchStart;
|
|
69253
69680
|
exports.handlePaste = handlePaste;
|
|
69254
69681
|
exports.handlePasteByClick = handlePasteByClick;
|
|
69682
|
+
exports.handlePasteByLeanklin = handlePasteByLeanklin;
|
|
69255
69683
|
exports.handlePercentageFormat = handlePercentageFormat;
|
|
69256
69684
|
exports.handleRowFreezeHandleMouseDown = handleRowFreezeHandleMouseDown;
|
|
69257
69685
|
exports.handleRowHeaderMouseDown = handleRowHeaderMouseDown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leankylin-sheet/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"repository": "http://114.55.85.79:19999/leankylin-front/leankylin-sheet",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@leankylin-sheet/formula-parser": "^1.2.
|
|
13
|
+
"@leankylin-sheet/formula-parser": "^1.2.13",
|
|
14
14
|
"dayjs": "^1.11.0",
|
|
15
15
|
"immer": "^9.0.12",
|
|
16
16
|
"lodash": "^4.17.21",
|