bkui-vue 2.1.0-dev-beta.10 → 2.1.0-dev-beta.12

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.
@@ -1725,7 +1725,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
1725
1725
  // 只展开,不需要重复触发
1726
1726
  var expandNode = function expandNode(node) {
1727
1727
  var _node$children;
1728
- if (!node || node !== null && node !== void 0 && node.isDisabled) return;
1728
+ if (!node || node !== null && node !== void 0 && node.isDisabled) {
1729
+ return;
1730
+ }
1729
1731
  var level = node.level;
1730
1732
  // 确保面板只更新到当前节点层级
1731
1733
  menus.list = menus.list.slice(0, level);
@@ -1773,7 +1775,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
1773
1775
  /** node点击展开回调 */
1774
1776
  var nodeExpandHandler = function nodeExpandHandler(node) {
1775
1777
  var _node$children2;
1776
- if (!node || node !== null && node !== void 0 && node.isDisabled) return;
1778
+ if (!node || node !== null && node !== void 0 && node.isDisabled) {
1779
+ return;
1780
+ }
1777
1781
  menus.list = menus.list.slice(0, node.level);
1778
1782
  activePath.value = activePath.value.slice(0, node.level - 1);
1779
1783
  /** 如果所点击的node具有children元素,则直接展开
@@ -1953,6 +1957,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
1953
1957
  "class": [_this.resolveClassName('cascader-panel'), _this.resolveClassName('scroll-y')]
1954
1958
  }, [_this.suggestions.map(function (node) {
1955
1959
  return (0,external_vue_.createVNode)("li", (0,external_vue_.mergeProps)({
1960
+ "key": node.id,
1956
1961
  "class": [_this.resolveClassName('cascader-node'), {
1957
1962
  'is-selected': _this.isNodeInPath(node)
1958
1963
  }, {
@@ -1971,8 +1976,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
1971
1976
  return (0,external_vue_.createVNode)("div", {
1972
1977
  "class": this.resolveClassName('cascader-panel-wrapper')
1973
1978
  }, [this.isFiltering ? searchPanelRender() : this.menus.list.map(function (menu, index) {
1974
- var _this$$slots$panel, _this$$slots;
1979
+ var _this$activePath$id, _this$activePath, _this$$slots$panel, _this$$slots;
1975
1980
  return (0,external_vue_.createVNode)("ul", {
1981
+ "key": index === 0 ? '__root__' : (_this$activePath$id = (_this$activePath = _this.activePath[index - 1]) === null || _this$activePath === void 0 ? void 0 : _this$activePath.id) !== null && _this$activePath$id !== void 0 ? _this$activePath$id : "__level_".concat(index, "__"),
1976
1982
  "style": {
1977
1983
  height: _this.panelHeight,
1978
1984
  width: _this.panelWidth
@@ -1985,6 +1991,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
1985
1991
  }), menu.length ? menu.map(function (node) {
1986
1992
  var _this$$slots$default, _this$$slots2;
1987
1993
  return (0,external_vue_.createVNode)("li", (0,external_vue_.mergeProps)({
1994
+ "key": node.id,
1988
1995
  "class": [_this.resolveClassName('cascader-node'), {
1989
1996
  'is-selected': _this.isNodeInPath(node)
1990
1997
  }, {
@@ -2506,7 +2513,7 @@ var Store = /*#__PURE__*/function () {
2506
2513
  var isFocus = (0,external_vue_.ref)(false);
2507
2514
  // 定义isShowPanel变量,用于标致面板显示
2508
2515
  var isShowPanel = (0,external_vue_.ref)(false);
2509
- // 用computed定义checkedValue变量,用于监听modelValue的变化
2516
+ // 定义checkedValue变量,用于监听modelValue的变化
2510
2517
  var checkedValue = (0,external_vue_.computed)({
2511
2518
  get: function get() {
2512
2519
  return modelValue.value;
@@ -2658,7 +2665,6 @@ var Store = /*#__PURE__*/function () {
2658
2665
  }
2659
2666
  // 开始过滤
2660
2667
  isFiltering.value = true;
2661
- isFiltering.value = true;
2662
2668
  // 筛选方法,如果props中存在filterMethod,则使用props中的方法,否则使用默认方法
2663
2669
  var filterMethod = props.filterMethod ? props.filterMethod : function (node) {
2664
2670
  if (props.checkAnyLevel) {
@@ -3282,7 +3282,46 @@ function hasOnlyWinLineEndings(string) {
3282
3282
  function hasOnlyUnixLineEndings(string) {
3283
3283
  return !string.includes('\r\n') && string.includes('\n');
3284
3284
  }
3285
- function trailingWs(string) {
3285
+ /**
3286
+ * Split a string into segments using a word segmenter, merging consecutive
3287
+ * segments if they are both whitespace segments. Whitespace segments can
3288
+ * appear adjacent to one another for two reasons:
3289
+ * - newlines always get their own segment
3290
+ * - where a diacritic is attached to a whitespace character in the text, the
3291
+ * segment ends after the diacritic, so e.g. " \u0300 " becomes two segments.
3292
+ * This function therefore runs the segmenter's .segment() method and then
3293
+ * merges consecutive segments of whitespace into a single part.
3294
+ */
3295
+ function segment(string, segmenter) {
3296
+ const parts = [];
3297
+ for (const segmentObj of Array.from(segmenter.segment(string))) {
3298
+ const segment = segmentObj.segment;
3299
+ if (parts.length && (/\s/).test(parts[parts.length - 1]) && (/\s/).test(segment)) {
3300
+ parts[parts.length - 1] += segment;
3301
+ }
3302
+ else {
3303
+ parts.push(segment);
3304
+ }
3305
+ }
3306
+ return parts;
3307
+ }
3308
+ // The functions below take a `segmenter` argument so that, when called from
3309
+ // diffWords when it is using a segmenter, they can use a notion of what
3310
+ // constitutes "whitespace" that is consistent with the segmenter.
3311
+ //
3312
+ // USUALLY this will be identical to the result of the non-segmenter-based
3313
+ // logic, but it differs in at least one case: when whitespace characters are
3314
+ // modified by diacritics. A word segmenter considers these diacritics to be
3315
+ // part of the whitespace, whereas our non-segmenter-based logic does not.
3316
+ //
3317
+ // Because the segmenter-based approach necessarily requires segmenting the
3318
+ // entire string, we offer a leadingAndTrailingWs function to allow getting the
3319
+ // whitespace prefix AND whitespace suffix with a single call to the segmenter,
3320
+ // for efficiency's sake.
3321
+ function trailingWs(string, segmenter) {
3322
+ if (segmenter) {
3323
+ return leadingAndTrailingWs(string, segmenter)[1];
3324
+ }
3286
3325
  // Yes, this looks overcomplicated and dumb - why not replace the whole function with
3287
3326
  // return string.match(/\s*$/)[0]
3288
3327
  // you ask? Because:
@@ -3302,11 +3341,28 @@ function trailingWs(string) {
3302
3341
  }
3303
3342
  return string.substring(i + 1);
3304
3343
  }
3305
- function leadingWs(string) {
3344
+ function leadingWs(string, segmenter) {
3345
+ if (segmenter) {
3346
+ return leadingAndTrailingWs(string, segmenter)[0];
3347
+ }
3306
3348
  // Thankfully the annoying considerations described in trailingWs don't apply here:
3307
3349
  const match = string.match(/^\s*/);
3308
3350
  return match ? match[0] : '';
3309
3351
  }
3352
+ function leadingAndTrailingWs(string, segmenter) {
3353
+ if (!segmenter) {
3354
+ return [leadingWs(string), trailingWs(string)];
3355
+ }
3356
+ if (segmenter.resolvedOptions().granularity != 'word') {
3357
+ throw new Error('The segmenter passed must have a granularity of "word"');
3358
+ }
3359
+ const segments = segment(string, segmenter);
3360
+ const firstSeg = segments[0];
3361
+ const lastSeg = segments[segments.length - 1];
3362
+ const head = (/\s/).test(firstSeg) ? firstSeg : '';
3363
+ const tail = (/\s/).test(lastSeg) ? lastSeg : '';
3364
+ return [head, tail];
3365
+ }
3310
3366
 
3311
3367
  ;// CONCATENATED MODULE: ../../node_modules/diff2html/node_modules/diff/libesm/diff/word.js
3312
3368
 
@@ -3375,22 +3431,9 @@ class WordDiff extends base_Diff {
3375
3431
  // We want `parts` to be an array whose elements alternate between being
3376
3432
  // pure whitespace and being pure non-whitespace. This is ALMOST what the
3377
3433
  // segments returned by a word-based Intl.Segmenter already look like,
3378
- // and therefore we can ALMOST get what we want by simply doing...
3379
- // parts = Array.from(segmenter.segment(value), segment => segment.segment);
3380
- // ... but not QUITE, because there's of one annoying special case: every
3381
- // newline character gets its own segment, instead of sharing a segment
3382
- // with other surrounding whitespace. We therefore need to manually merge
3383
- // consecutive segments of whitespace into a single part:
3384
- parts = [];
3385
- for (const segmentObj of Array.from(segmenter.segment(value))) {
3386
- const segment = segmentObj.segment;
3387
- if (parts.length && (/\s/).test(parts[parts.length - 1]) && (/\s/).test(segment)) {
3388
- parts[parts.length - 1] += segment;
3389
- }
3390
- else {
3391
- parts.push(segment);
3392
- }
3393
- }
3434
+ // but not quite - see explanation in the docs of our custom segment()
3435
+ // function.
3436
+ parts = segment(value, segmenter);
3394
3437
  }
3395
3438
  else {
3396
3439
  parts = value.match(tokenizeIncludingWhitespace) || [];
@@ -3454,7 +3497,7 @@ class WordDiff extends base_Diff {
3454
3497
  }
3455
3498
  else {
3456
3499
  if (insertion || deletion) { // May be false at start of text
3457
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
3500
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options.intlSegmenter);
3458
3501
  }
3459
3502
  lastKeep = change;
3460
3503
  insertion = null;
@@ -3462,7 +3505,7 @@ class WordDiff extends base_Diff {
3462
3505
  }
3463
3506
  });
3464
3507
  if (insertion || deletion) {
3465
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
3508
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options.intlSegmenter);
3466
3509
  }
3467
3510
  return changes;
3468
3511
  }
@@ -3478,7 +3521,7 @@ function word_diffWords(oldStr, newStr, options) {
3478
3521
  }
3479
3522
  return word_wordDiff.diff(oldStr, newStr, options);
3480
3523
  }
3481
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
3524
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter) {
3482
3525
  // Before returning, we tidy up the leading and trailing whitespace of the
3483
3526
  // change objects to eliminate cases where trailing whitespace in one object
3484
3527
  // is repeated as leading whitespace in the next.
@@ -3521,10 +3564,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
3521
3564
  // * Just a "delete"
3522
3565
  // We handle the three cases separately.
3523
3566
  if (deletion && insertion) {
3524
- const oldWsPrefix = leadingWs(deletion.value);
3525
- const oldWsSuffix = trailingWs(deletion.value);
3526
- const newWsPrefix = leadingWs(insertion.value);
3527
- const newWsSuffix = trailingWs(insertion.value);
3567
+ const [oldWsPrefix, oldWsSuffix] = leadingAndTrailingWs(deletion.value, segmenter);
3568
+ const [newWsPrefix, newWsSuffix] = leadingAndTrailingWs(insertion.value, segmenter);
3528
3569
  if (startKeep) {
3529
3570
  const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
3530
3571
  startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
@@ -3546,17 +3587,17 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
3546
3587
  // whitespace and deleting duplicate leading whitespace where
3547
3588
  // present.
3548
3589
  if (startKeep) {
3549
- const ws = leadingWs(insertion.value);
3590
+ const ws = leadingWs(insertion.value, segmenter);
3550
3591
  insertion.value = insertion.value.substring(ws.length);
3551
3592
  }
3552
3593
  if (endKeep) {
3553
- const ws = leadingWs(endKeep.value);
3594
+ const ws = leadingWs(endKeep.value, segmenter);
3554
3595
  endKeep.value = endKeep.value.substring(ws.length);
3555
3596
  }
3556
3597
  // otherwise we've got a deletion and no insertion
3557
3598
  }
3558
3599
  else if (startKeep && endKeep) {
3559
- const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
3600
+ const newWsFull = leadingWs(endKeep.value, segmenter), [delWsStart, delWsEnd] = leadingAndTrailingWs(deletion.value, segmenter);
3560
3601
  // Any whitespace that comes straight after startKeep in both the old and
3561
3602
  // new texts, assign to startKeep and remove from the deletion.
3562
3603
  const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
@@ -3575,8 +3616,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
3575
3616
  // We are at the start of the text. Preserve all the whitespace on
3576
3617
  // endKeep, and just remove whitespace from the end of deletion to the
3577
3618
  // extent that it overlaps with the start of endKeep.
3578
- const endKeepWsPrefix = leadingWs(endKeep.value);
3579
- const deletionWsSuffix = trailingWs(deletion.value);
3619
+ const endKeepWsPrefix = leadingWs(endKeep.value, segmenter);
3620
+ const deletionWsSuffix = trailingWs(deletion.value, segmenter);
3580
3621
  const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
3581
3622
  deletion.value = removeSuffix(deletion.value, overlap);
3582
3623
  }
@@ -3584,8 +3625,8 @@ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep
3584
3625
  // We are at the END of the text. Preserve all the whitespace on
3585
3626
  // startKeep, and just remove whitespace from the start of deletion to
3586
3627
  // the extent that it overlaps with the end of startKeep.
3587
- const startKeepWsSuffix = trailingWs(startKeep.value);
3588
- const deletionWsPrefix = leadingWs(deletion.value);
3628
+ const startKeepWsSuffix = trailingWs(startKeep.value, segmenter);
3629
+ const deletionWsPrefix = leadingWs(deletion.value, segmenter);
3589
3630
  const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
3590
3631
  deletion.value = removePrefix(deletion.value, overlap);
3591
3632
  }
package/lib/index.js CHANGED
@@ -3,5 +3,5 @@ export * from './hooks';
3
3
  export { default } from './preset';
4
4
  export * from './config-provider';
5
5
  export * from './directives';
6
- export const version = "2.1.0-dev-beta.10";
6
+ export const version = "2.1.0-dev-beta.12";
7
7
  window.__bkui_vue_version__ = version;
@@ -33,12 +33,18 @@ declare const BkInput: {
33
33
  };
34
34
  step: import("vue-types").VueTypeValidableDef<number> & {
35
35
  default: number;
36
+ } & {
37
+ default: number;
36
38
  };
37
39
  max: import("vue-types").VueTypeValidableDef<number> & {
38
40
  default: number;
41
+ } & {
42
+ default: number;
39
43
  };
40
44
  min: import("vue-types").VueTypeValidableDef<number> & {
41
45
  default: number;
46
+ } & {
47
+ default: number;
42
48
  };
43
49
  maxlength: import("vue-types").VueTypeValidableDef<number> & {
44
50
  default: number;
@@ -111,13 +117,15 @@ declare const BkInput: {
111
117
  } & {
112
118
  default: boolean;
113
119
  };
120
+ allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
121
+ default: boolean;
122
+ } & {
123
+ default: boolean;
124
+ };
114
125
  }>> & Readonly<{
115
126
  onBlur?: (evt: FocusEvent) => any;
116
127
  onChange?: (_value: any, _evt: KeyboardEvent) => any;
117
128
  onClear?: () => any;
118
- onCompositionend?: (evt: CompositionEvent) => any;
119
- onCompositionstart?: (evt: CompositionEvent) => any;
120
- onCompositionupdate?: (evt: CompositionEvent) => any;
121
129
  onEnter?: (_value: any, _evt: KeyboardEvent) => any;
122
130
  onFocus?: (evt: FocusEvent) => any;
123
131
  onInput?: (_value: any, _evt: KeyboardEvent) => any;
@@ -139,9 +147,6 @@ declare const BkInput: {
139
147
  keyup: (_value: any, _evt: KeyboardEvent) => any;
140
148
  enter: (_value: any, _evt: KeyboardEvent) => any;
141
149
  paste: (_value: any, _e: ClipboardEvent) => boolean;
142
- compositionstart: (evt: CompositionEvent) => CompositionEvent;
143
- compositionupdate: (evt: CompositionEvent) => CompositionEvent;
144
- compositionend: (evt: CompositionEvent) => CompositionEvent;
145
150
  search: (evt: Event) => Event;
146
151
  }, import("vue").PublicProps, {
147
152
  type: string;
@@ -172,6 +177,7 @@ declare const BkInput: {
172
177
  showOverflowTooltips: boolean;
173
178
  tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
174
179
  autosize: boolean | import("./input").InputAutoSize;
180
+ allowEmptyValue: boolean;
175
181
  }, true, {}, {}, import("vue").GlobalComponents, {
176
182
  bkTooltips: import("vue").ObjectDirective<any, any, string, any>;
177
183
  } & import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
@@ -215,12 +221,18 @@ declare const BkInput: {
215
221
  };
216
222
  step: import("vue-types").VueTypeValidableDef<number> & {
217
223
  default: number;
224
+ } & {
225
+ default: number;
218
226
  };
219
227
  max: import("vue-types").VueTypeValidableDef<number> & {
220
228
  default: number;
229
+ } & {
230
+ default: number;
221
231
  };
222
232
  min: import("vue-types").VueTypeValidableDef<number> & {
223
233
  default: number;
234
+ } & {
235
+ default: number;
224
236
  };
225
237
  maxlength: import("vue-types").VueTypeValidableDef<number> & {
226
238
  default: number;
@@ -293,13 +305,15 @@ declare const BkInput: {
293
305
  } & {
294
306
  default: boolean;
295
307
  };
308
+ allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
309
+ default: boolean;
310
+ } & {
311
+ default: boolean;
312
+ };
296
313
  }>> & Readonly<{
297
314
  onBlur?: (evt: FocusEvent) => any;
298
315
  onChange?: (_value: any, _evt: KeyboardEvent) => any;
299
316
  onClear?: () => any;
300
- onCompositionend?: (evt: CompositionEvent) => any;
301
- onCompositionstart?: (evt: CompositionEvent) => any;
302
- onCompositionupdate?: (evt: CompositionEvent) => any;
303
317
  onEnter?: (_value: any, _evt: KeyboardEvent) => any;
304
318
  onFocus?: (evt: FocusEvent) => any;
305
319
  onInput?: (_value: any, _evt: KeyboardEvent) => any;
@@ -338,6 +352,7 @@ declare const BkInput: {
338
352
  showOverflowTooltips: boolean;
339
353
  tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
340
354
  autosize: boolean | import("./input").InputAutoSize;
355
+ allowEmptyValue: boolean;
341
356
  }>;
342
357
  __isFragment?: never;
343
358
  __isTeleport?: never;
@@ -376,12 +391,18 @@ declare const BkInput: {
376
391
  };
377
392
  step: import("vue-types").VueTypeValidableDef<number> & {
378
393
  default: number;
394
+ } & {
395
+ default: number;
379
396
  };
380
397
  max: import("vue-types").VueTypeValidableDef<number> & {
381
398
  default: number;
399
+ } & {
400
+ default: number;
382
401
  };
383
402
  min: import("vue-types").VueTypeValidableDef<number> & {
384
403
  default: number;
404
+ } & {
405
+ default: number;
385
406
  };
386
407
  maxlength: import("vue-types").VueTypeValidableDef<number> & {
387
408
  default: number;
@@ -454,13 +475,15 @@ declare const BkInput: {
454
475
  } & {
455
476
  default: boolean;
456
477
  };
478
+ allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
479
+ default: boolean;
480
+ } & {
481
+ default: boolean;
482
+ };
457
483
  }>> & Readonly<{
458
484
  onBlur?: (evt: FocusEvent) => any;
459
485
  onChange?: (_value: any, _evt: KeyboardEvent) => any;
460
486
  onClear?: () => any;
461
- onCompositionend?: (evt: CompositionEvent) => any;
462
- onCompositionstart?: (evt: CompositionEvent) => any;
463
- onCompositionupdate?: (evt: CompositionEvent) => any;
464
487
  onEnter?: (_value: any, _evt: KeyboardEvent) => any;
465
488
  onFocus?: (evt: FocusEvent) => any;
466
489
  onInput?: (_value: any, _evt: KeyboardEvent) => any;
@@ -482,9 +505,6 @@ declare const BkInput: {
482
505
  keyup: (_value: any, _evt: KeyboardEvent) => any;
483
506
  enter: (_value: any, _evt: KeyboardEvent) => any;
484
507
  paste: (_value: any, _e: ClipboardEvent) => boolean;
485
- compositionstart: (evt: CompositionEvent) => CompositionEvent;
486
- compositionupdate: (evt: CompositionEvent) => CompositionEvent;
487
- compositionend: (evt: CompositionEvent) => CompositionEvent;
488
508
  search: (evt: Event) => Event;
489
509
  }, string, {
490
510
  type: string;
@@ -515,6 +535,7 @@ declare const BkInput: {
515
535
  showOverflowTooltips: boolean;
516
536
  tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
517
537
  autosize: boolean | import("./input").InputAutoSize;
538
+ allowEmptyValue: boolean;
518
539
  }, {}, string, {}, import("vue").GlobalComponents, {
519
540
  bkTooltips: import("vue").ObjectDirective<any, any, string, any>;
520
541
  } & import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin<any[], any[]>;