@tarojs/shared 3.7.0-alpha.1 → 3.7.0-alpha.3
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/index.d.ts +13 -23
- package/dist/index.js +61 -20
- package/dist/index.js.map +1 -1
- package/dist/shared.esm.d.ts +13 -23
- package/dist/shared.esm.js +61 -20
- package/dist/shared.esm.js.map +1 -1
- package/dist/template.js +46 -20
- package/dist/template.js.map +1 -1
- package/package.json +1 -1
package/dist/template.js
CHANGED
|
@@ -79,7 +79,7 @@ const Input = {
|
|
|
79
79
|
focus: DEFAULT_FALSE,
|
|
80
80
|
'confirm-type': singleQuote('done'),
|
|
81
81
|
'confirm-hold': DEFAULT_FALSE,
|
|
82
|
-
cursor: '
|
|
82
|
+
cursor: '-1',
|
|
83
83
|
'selection-start': '-1',
|
|
84
84
|
'selection-end': '-1',
|
|
85
85
|
bindInput: NO_DEFAULT_VALUE,
|
|
@@ -377,16 +377,21 @@ class Events {
|
|
|
377
377
|
this.callbacks = (_a = opts === null || opts === void 0 ? void 0 : opts.callbacks) !== null && _a !== void 0 ? _a : {};
|
|
378
378
|
}
|
|
379
379
|
on(eventName, callback, context) {
|
|
380
|
-
let event,
|
|
380
|
+
let event, tail, _eventName;
|
|
381
381
|
if (!callback) {
|
|
382
382
|
return this;
|
|
383
383
|
}
|
|
384
|
-
eventName
|
|
384
|
+
if (typeof eventName === 'symbol') {
|
|
385
|
+
_eventName = [eventName];
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
_eventName = eventName.split(Events.eventSplitter);
|
|
389
|
+
}
|
|
385
390
|
this.callbacks || (this.callbacks = {});
|
|
386
391
|
const calls = this.callbacks;
|
|
387
|
-
while ((event =
|
|
388
|
-
list = calls[event];
|
|
389
|
-
node = list ? list.tail : {};
|
|
392
|
+
while ((event = _eventName.shift())) {
|
|
393
|
+
const list = calls[event];
|
|
394
|
+
const node = list ? list.tail : {};
|
|
390
395
|
node.next = tail = {};
|
|
391
396
|
node.context = context;
|
|
392
397
|
node.callback = callback;
|
|
@@ -406,7 +411,7 @@ class Events {
|
|
|
406
411
|
return this;
|
|
407
412
|
}
|
|
408
413
|
off(events, callback, context) {
|
|
409
|
-
let event, calls,
|
|
414
|
+
let event, calls, _events;
|
|
410
415
|
if (!(calls = this.callbacks)) {
|
|
411
416
|
return this;
|
|
412
417
|
}
|
|
@@ -414,17 +419,22 @@ class Events {
|
|
|
414
419
|
delete this.callbacks;
|
|
415
420
|
return this;
|
|
416
421
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
422
|
+
if (typeof events === 'symbol') {
|
|
423
|
+
_events = [events];
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
_events = events ? events.split(Events.eventSplitter) : Object.keys(calls);
|
|
427
|
+
}
|
|
428
|
+
while ((event = _events.shift())) {
|
|
429
|
+
let node = calls[event];
|
|
420
430
|
delete calls[event];
|
|
421
431
|
if (!node || !(callback || context)) {
|
|
422
432
|
continue;
|
|
423
433
|
}
|
|
424
|
-
tail = node.tail;
|
|
434
|
+
const tail = node.tail;
|
|
425
435
|
while ((node = node.next) !== tail) {
|
|
426
|
-
cb = node.callback;
|
|
427
|
-
ctx = node.context;
|
|
436
|
+
const cb = node.callback;
|
|
437
|
+
const ctx = node.context;
|
|
428
438
|
if ((callback && cb !== callback) || (context && ctx !== context)) {
|
|
429
439
|
this.on(event, cb, ctx);
|
|
430
440
|
}
|
|
@@ -432,18 +442,22 @@ class Events {
|
|
|
432
442
|
}
|
|
433
443
|
return this;
|
|
434
444
|
}
|
|
435
|
-
trigger(events) {
|
|
436
|
-
let event, node, calls,
|
|
445
|
+
trigger(events, ...args) {
|
|
446
|
+
let event, node, calls, _events;
|
|
437
447
|
if (!(calls = this.callbacks)) {
|
|
438
448
|
return this;
|
|
439
449
|
}
|
|
440
|
-
events
|
|
441
|
-
|
|
442
|
-
|
|
450
|
+
if (typeof events === 'symbol') {
|
|
451
|
+
_events = [events];
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
_events = events.split(Events.eventSplitter);
|
|
455
|
+
}
|
|
456
|
+
while ((event = _events.shift())) {
|
|
443
457
|
if ((node = calls[event])) {
|
|
444
|
-
tail = node.tail;
|
|
458
|
+
const tail = node.tail;
|
|
445
459
|
while ((node = node.next) !== tail) {
|
|
446
|
-
node.callback.apply(node.context || this,
|
|
460
|
+
node.callback.apply(node.context || this, args);
|
|
447
461
|
}
|
|
448
462
|
}
|
|
449
463
|
}
|
|
@@ -596,6 +610,9 @@ new TaroHooks({
|
|
|
596
610
|
modifySetAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
597
611
|
modifyRmAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
598
612
|
onAddEvent: TaroHook(HOOK_TYPE.SINGLE),
|
|
613
|
+
proxyToRaw: TaroHook(HOOK_TYPE.SINGLE, function (proxyObj) {
|
|
614
|
+
return proxyObj;
|
|
615
|
+
}),
|
|
599
616
|
modifyMpEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
600
617
|
modifyMpEventImpl: TaroHook(HOOK_TYPE.SINGLE, function (e) {
|
|
601
618
|
try {
|
|
@@ -606,7 +623,12 @@ new TaroHooks({
|
|
|
606
623
|
console.warn('[Taro modifyMpEvent hook Error]: ' + (error === null || error === void 0 ? void 0 : error.message));
|
|
607
624
|
}
|
|
608
625
|
}),
|
|
626
|
+
injectNewStyleProperties: TaroHook(HOOK_TYPE.SINGLE),
|
|
609
627
|
modifyTaroEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
628
|
+
dispatchTaroEvent: TaroHook(HOOK_TYPE.SINGLE, (e, node) => {
|
|
629
|
+
node.dispatchEvent(e);
|
|
630
|
+
}),
|
|
631
|
+
dispatchTaroEventFinish: TaroHook(HOOK_TYPE.MULTI),
|
|
610
632
|
modifyDispatchEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
611
633
|
initNativeApi: TaroHook(HOOK_TYPE.MULTI),
|
|
612
634
|
patchElement: TaroHook(HOOK_TYPE.MULTI)
|
|
@@ -810,6 +832,10 @@ class BaseTemplate {
|
|
|
810
832
|
else if (isBooleanStringLiteral(propValue) || isNumber(+propValue)) {
|
|
811
833
|
const propInCamelCase = toCamelCase(prop);
|
|
812
834
|
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
835
|
+
// cursor 默认取最后输入框最后一位 fix #13809
|
|
836
|
+
if (prop === 'cursor') {
|
|
837
|
+
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
838
|
+
}
|
|
813
839
|
propValue = this.supportXS
|
|
814
840
|
? `xs.b(i.${propAlias},${propValue})`
|
|
815
841
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|