@fibrae/semi-foundation 0.1.0 → 0.2.0
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/anchor/foundation.d.ts +1 -1
- package/dist/anchor/foundation.js +21 -21
- package/dist/audio-player/foundation.d.ts +10 -10
- package/dist/audio-player/foundation.js +19 -19
- package/dist/auto-complete/foundation.d.ts +12 -12
- package/dist/auto-complete/foundation.js +51 -51
- package/dist/avatar/foundation.d.ts +5 -5
- package/dist/avatar/foundation.js +16 -16
- package/dist/backtop/foundation.d.ts +2 -2
- package/dist/backtop/foundation.js +7 -7
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -8
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -3
- package/dist/base/foundation.js +12 -11
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.js +1 -1
- package/dist/calendar/foundation.js +4 -4
- package/dist/calendar/month-foundation.d.ts +2 -2
- package/dist/calendar/month-foundation.js +6 -6
- package/dist/carousel/foundation.d.ts +17 -17
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +34 -26
- package/dist/cascader/foundation.js +143 -121
- package/dist/checkbox/checkbox-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-foundation.js +15 -15
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -1
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/cropper/foundation.d.ts +15 -15
- package/dist/cropper/foundation.js +26 -23
- package/dist/date-picker/_utils/picker-type.d.ts +1 -1
- package/dist/date-picker/foundation.d.ts +36 -36
- package/dist/date-picker/foundation.js +125 -129
- package/dist/date-picker/input-foundation.d.ts +9 -9
- package/dist/date-picker/input-foundation.js +28 -28
- package/dist/date-picker/months-grid-foundation.d.ts +17 -17
- package/dist/date-picker/months-grid-foundation.js +64 -65
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -2
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -5
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -1
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -9
- package/dist/feedback/foundation.js +33 -33
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -61
- package/dist/highlight/foundation.js +1 -1
- package/dist/hot-keys/foundation.d.ts +2 -2
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -4
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -3
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -8
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -9
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -10
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -3
- package/dist/input/text-entry-foundation.js +14 -14
- package/dist/input/textarea-foundation.d.ts +7 -7
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/foundation.d.ts +16 -14
- package/dist/input-number/foundation.js +54 -53
- package/dist/json-viewer/foundation.d.ts +8 -8
- package/dist/json-viewer/foundation.js +23 -23
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +1 -1
- package/dist/markdown-render/foundation.js +4 -4
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -1
- package/dist/navigation/foundation.js +14 -14
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -3
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -7
- package/dist/notification/notification-list-foundation.js +12 -12
- package/dist/overflow-list/foundation.d.ts +4 -4
- package/dist/overflow-list/foundation.js +18 -18
- package/dist/pagination/foundation.d.ts +8 -8
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +5 -5
- package/dist/pincode/foundation.js +22 -22
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/radio/radio-foundation.d.ts +5 -5
- package/dist/radio/radio-foundation.js +15 -15
- package/dist/radio/radio-group-foundation.d.ts +2 -2
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -10
- package/dist/rating/foundation.js +35 -35
- package/dist/resizable/group/index.d.ts +6 -6
- package/dist/resizable/group/index.js +40 -40
- package/dist/resizable/single/index.d.ts +2 -2
- package/dist/resizable/single/index.js +9 -9
- package/dist/scroll-list/item-foundation.d.ts +7 -7
- package/dist/scroll-list/item-foundation.js +35 -35
- package/dist/select/foundation.d.ts +42 -56
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -27
- package/dist/select/option-foundation.js +10 -18
- package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
- package/dist/side-sheet/side-sheet-foundation.js +22 -22
- package/dist/slider/foundation.d.ts +16 -16
- package/dist/slider/foundation.js +46 -46
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -2
- package/dist/spin/foundation.js +6 -6
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -2
- package/dist/switch/foundation.js +7 -7
- package/dist/table/foundation.d.ts +14 -14
- package/dist/table/foundation.js +93 -93
- package/dist/table/utils.d.ts +2 -2
- package/dist/tabs/foundation.d.ts +5 -5
- package/dist/tabs/foundation.js +17 -17
- package/dist/tag-input/foundation.d.ts +11 -11
- package/dist/tag-input/foundation.js +52 -52
- package/dist/time-picker/foundation.d.ts +13 -13
- package/dist/time-picker/foundation.js +39 -39
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/foundation.d.ts +9 -9
- package/dist/tooltip/foundation.js +67 -61
- package/dist/transfer/foundation.d.ts +22 -9
- package/dist/transfer/foundation.js +38 -23
- package/dist/tree/foundation.d.ts +14 -14
- package/dist/tree/foundation.js +61 -61
- package/dist/tree/shared.d.ts +1 -1
- package/dist/tree-select/foundation.d.ts +26 -20
- package/dist/tree-select/foundation.js +91 -83
- package/dist/typography/ellipsis.d.ts +4 -4
- package/dist/typography/ellipsis.js +8 -8
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -17
- package/dist/upload/foundation.js +92 -92
- package/dist/upload/utils.d.ts +3 -3
- package/dist/upload/utils.js +6 -6
- package/dist/user-guide/foundation.d.ts +3 -3
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +1 -1
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/focus-handle.d.ts +1 -1
- package/dist/utils/focus-handle.js +1 -2
- package/dist/utils/focus-scope.d.ts +5 -5
- package/dist/utils/focus-scope.js +10 -10
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -2
- package/dist/video-player/progress-foundation.js +12 -12
- package/package.json +2 -2
|
@@ -20,14 +20,14 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
20
20
|
#lastChangeWasStep = false;
|
|
21
21
|
#caretTail;
|
|
22
22
|
#recordCaret() {
|
|
23
|
-
this.#caretTail = recordCaretTail(this.
|
|
23
|
+
this.#caretTail = recordCaretTail(this.adapter.getInput());
|
|
24
24
|
}
|
|
25
25
|
/** Puts the caret back in front of the text that followed it before the last change */
|
|
26
26
|
#restoreCaret() {
|
|
27
|
-
restoreCaretTail(this.
|
|
27
|
+
restoreCaretTail(this.adapter.getInput(), this.#caretTail);
|
|
28
28
|
}
|
|
29
29
|
#focusInput() {
|
|
30
|
-
const input = this.
|
|
30
|
+
const input = this.adapter.getInput();
|
|
31
31
|
if (input && FocusTrapHandle.getActiveElement(input) !== input) input.focus({ preventScroll: this.getProp("preventScroll") });
|
|
32
32
|
}
|
|
33
33
|
#getFinalCurrency() {
|
|
@@ -40,10 +40,10 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
40
40
|
const isValidNumber = !isNaN(parsed);
|
|
41
41
|
if (!(isValidNumber && parsed === this.getState("number"))) this.#notifyChange(isValidNumber ? parsed : v, event);
|
|
42
42
|
if (!this.isControlled()) {
|
|
43
|
-
if (isValidNumber) this.
|
|
44
|
-
this.
|
|
43
|
+
if (isValidNumber) this.adapter.setNumber(parsed);
|
|
44
|
+
this.adapter.setValue(v, updateCb);
|
|
45
45
|
}
|
|
46
|
-
if (this.getProp("keepFocus")) this.
|
|
46
|
+
if (this.getProp("keepFocus")) this.adapter.setFocusing(true, () => {
|
|
47
47
|
if (this.#lastChangeWasStep && this.getState("focusing")) this.#focusInput();
|
|
48
48
|
this.#lastChangeWasStep = true;
|
|
49
49
|
});
|
|
@@ -182,17 +182,18 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
182
182
|
#step(direction, event) {
|
|
183
183
|
const value = direction > 0 ? this.add(null, event) : this.minus(null, event);
|
|
184
184
|
this.#commitStep(value, event);
|
|
185
|
-
if (direction > 0) this.
|
|
186
|
-
else this.
|
|
185
|
+
if (direction > 0) this.adapter.notifyUpClick(value, event);
|
|
186
|
+
else this.adapter.notifyDownClick(value, event);
|
|
187
187
|
}
|
|
188
188
|
#canStep(direction) {
|
|
189
189
|
const { readonly, disabled, min, max } = this.getProps();
|
|
190
190
|
return !readonly && !disabled && !reachesBound(this.getState("number"), direction > 0 ? max : min, direction);
|
|
191
191
|
}
|
|
192
192
|
#press(direction, event) {
|
|
193
|
-
|
|
193
|
+
const { currentTarget } = event;
|
|
194
|
+
if (!(currentTarget instanceof Element) || isSecondaryPress(event) || !this.#canStep(direction)) return;
|
|
194
195
|
this.#lastChangeWasStep = true;
|
|
195
|
-
|
|
196
|
+
currentTarget.setPointerCapture(event.pointerId);
|
|
196
197
|
event.stopPropagation();
|
|
197
198
|
this.#step(direction, event);
|
|
198
199
|
this.#registerTimer(() => {
|
|
@@ -206,21 +207,21 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
#notifyChange(value, e) {
|
|
209
|
-
if (value == null || value === "") this.
|
|
210
|
+
if (value == null || value === "") this.adapter.notifyChange("", e);
|
|
210
211
|
else {
|
|
211
212
|
const parsedNum = this.toNumber(value, true);
|
|
212
213
|
if (typeof parsedNum === "number" && !isNaN(parsedNum)) {
|
|
213
|
-
this.
|
|
214
|
+
this.adapter.notifyChange(parsedNum, e);
|
|
214
215
|
this.#notifyNumberChange(parsedNum, e);
|
|
215
|
-
} else this.
|
|
216
|
+
} else this.adapter.notifyChange(this.afterParser(value), e);
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
#notifyNumberChange(value, e) {
|
|
219
220
|
const { number } = this.getStates();
|
|
220
|
-
if (this.isValidNumber(value) && value !== number) this.
|
|
221
|
+
if (this.isValidNumber(value) && value !== number) this.adapter.notifyNumberChange(value, e);
|
|
221
222
|
}
|
|
222
223
|
isControlled() {
|
|
223
|
-
return this.
|
|
224
|
+
return this.isControlledComponent("value");
|
|
224
225
|
}
|
|
225
226
|
isCurrency() {
|
|
226
227
|
const { currency } = this.getProps();
|
|
@@ -367,7 +368,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
367
368
|
this.#unregisterInterval();
|
|
368
369
|
this.#unregisterTimer();
|
|
369
370
|
}
|
|
370
|
-
handleInputFocus(e) {
|
|
371
|
+
handleInputFocus = (e) => {
|
|
371
372
|
const value = this.getState("value");
|
|
372
373
|
if (value !== "") {
|
|
373
374
|
if (this.#isScientificNotation() && !this.isCurrency()) {
|
|
@@ -377,17 +378,17 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
377
378
|
const parsedNum = typeof number === "number" ? number : this.doParse(strVal, false, false, false);
|
|
378
379
|
if (!Number.isNaN(parsedNum)) {
|
|
379
380
|
const fullNumberStr = this.doFormat(parsedNum, true, false);
|
|
380
|
-
this.
|
|
381
|
+
this.adapter.setValue(fullNumberStr);
|
|
381
382
|
}
|
|
382
383
|
}
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
386
|
this.#recordCaret();
|
|
386
|
-
this.
|
|
387
|
+
this.adapter.setFocusing(true);
|
|
387
388
|
this.#lastChangeWasStep = false;
|
|
388
|
-
this.
|
|
389
|
-
}
|
|
390
|
-
handleInputChange(value, event) {
|
|
389
|
+
this.adapter.notifyFocus(e);
|
|
390
|
+
};
|
|
391
|
+
handleInputChange = (value, event) => {
|
|
391
392
|
this.#lastChangeWasStep = false;
|
|
392
393
|
const parsedNum = this.doParse(value, true, true, true);
|
|
393
394
|
const toNum = this.doParse(value, false, false, false);
|
|
@@ -416,14 +417,14 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
416
417
|
notifyVal = this.isControlled() ? formattedNum : valueAfterParser;
|
|
417
418
|
}
|
|
418
419
|
this.#notifyChange(notifyVal, event);
|
|
419
|
-
if (!this.isControlled() && (num === null || typeof num === "number" && !isNaN(num))) this.
|
|
420
|
-
this.
|
|
420
|
+
if (!this.isControlled() && (num === null || typeof num === "number" && !isNaN(num))) this.adapter.setNumber(num);
|
|
421
|
+
this.adapter.setValue(this.isControlled() && !this.isCurrency() ? formattedNum : this.doFormat(valueAfterParser, false), () => {
|
|
421
422
|
this.#restoreCaret();
|
|
422
423
|
});
|
|
423
|
-
}
|
|
424
|
-
handleInputKeyDown(event) {
|
|
424
|
+
};
|
|
425
|
+
handleInputKeyDown = (event) => {
|
|
425
426
|
if (this.getProp("readonly")) {
|
|
426
|
-
this.
|
|
427
|
+
this.adapter.notifyKeyDown(event);
|
|
427
428
|
return;
|
|
428
429
|
}
|
|
429
430
|
const key = isComposing(event) || event.altKey || event.ctrlKey || event.metaKey ? "" : event.key;
|
|
@@ -439,9 +440,9 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
439
440
|
});
|
|
440
441
|
event.preventDefault();
|
|
441
442
|
}
|
|
442
|
-
this.
|
|
443
|
-
}
|
|
444
|
-
handleInputBlur(e) {
|
|
443
|
+
this.adapter.notifyKeyDown(event);
|
|
444
|
+
};
|
|
445
|
+
handleInputBlur = (e) => {
|
|
445
446
|
const currentValue = toString(this.getState("value"));
|
|
446
447
|
let currentNumber = this.getState("number");
|
|
447
448
|
if (currentNumber != null || currentValue != null && currentValue !== "") {
|
|
@@ -480,41 +481,41 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
480
481
|
if (strHasChanged || numHasChanged) {
|
|
481
482
|
const reported = willSetVal != null ? this.#reportedText(willSetVal, currentNumber) : willSetNum;
|
|
482
483
|
if (numHasChanged || reported !== currentValue) this.#notifyChange(reported, e);
|
|
483
|
-
if (willSetVal != null) this.
|
|
484
|
-
if (willSetNum != null && !this.isControlled()) this.
|
|
484
|
+
if (willSetVal != null) this.adapter.setValue(willSetVal);
|
|
485
|
+
if (willSetNum != null && !this.isControlled()) this.adapter.setNumber(willSetNum);
|
|
485
486
|
}
|
|
486
487
|
}
|
|
487
|
-
this.
|
|
488
|
-
this.
|
|
489
|
-
}
|
|
490
|
-
handleInputMouseEnter() {
|
|
491
|
-
this.
|
|
492
|
-
}
|
|
493
|
-
handleInputMouseLeave() {
|
|
494
|
-
this.
|
|
495
|
-
}
|
|
496
|
-
handleInputMouseMove() {
|
|
497
|
-
if (!this.getState("hovering")) this.
|
|
498
|
-
}
|
|
488
|
+
this.adapter.setFocusing(false);
|
|
489
|
+
this.adapter.notifyBlur(e);
|
|
490
|
+
};
|
|
491
|
+
handleInputMouseEnter = () => {
|
|
492
|
+
this.adapter.setHovering(true);
|
|
493
|
+
};
|
|
494
|
+
handleInputMouseLeave = () => {
|
|
495
|
+
this.adapter.setHovering(false);
|
|
496
|
+
};
|
|
497
|
+
handleInputMouseMove = () => {
|
|
498
|
+
if (!this.getState("hovering")) this.adapter.setHovering(true);
|
|
499
|
+
};
|
|
499
500
|
/** Ends the repeat of a held button; follows pointerup and pointercancel */
|
|
500
|
-
handlePressEnd() {
|
|
501
|
+
handlePressEnd = () => {
|
|
501
502
|
this.#unregisterInterval();
|
|
502
503
|
this.#unregisterTimer();
|
|
503
|
-
}
|
|
504
|
+
};
|
|
504
505
|
/**
|
|
505
506
|
* Under keepFocus or innerButtons a press on a step button never blurs the input, even when it steps nothing. This
|
|
506
507
|
* belongs on mousedown: cancelling pointerdown would also suppress the mousedown that outside-click listeners of
|
|
507
508
|
* other open popups wait for.
|
|
508
509
|
*/
|
|
509
|
-
handleStepMouseDown(event) {
|
|
510
|
+
handleStepMouseDown = (event) => {
|
|
510
511
|
if (this.getProp("keepFocus") || this.getProp("innerButtons")) event.preventDefault();
|
|
511
|
-
}
|
|
512
|
-
handleUpPress(event) {
|
|
512
|
+
};
|
|
513
|
+
handleUpPress = (event) => {
|
|
513
514
|
this.#press(1, event);
|
|
514
|
-
}
|
|
515
|
-
handleDownPress(event) {
|
|
515
|
+
};
|
|
516
|
+
handleDownPress = (event) => {
|
|
516
517
|
this.#press(-1, event);
|
|
517
|
-
}
|
|
518
|
+
};
|
|
518
519
|
/**
|
|
519
520
|
* A changed controlled `value`, after the commit that received it. It never notifies: the parent already holds
|
|
520
521
|
* this value, and an out-of-range one is shown as given until the user interacts.
|
|
@@ -523,7 +524,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
523
524
|
* be on blur (and the text right after a step), an unparsable value replaces the text. Otherwise the value is
|
|
524
525
|
* formatted like on blur, except that it is not clamped, and an unparsable one empties it.
|
|
525
526
|
*/
|
|
526
|
-
handleValueChange(value) {
|
|
527
|
+
handleValueChange = (value) => {
|
|
527
528
|
let states;
|
|
528
529
|
let callback;
|
|
529
530
|
if (value == null || value === "") states = {
|
|
@@ -552,6 +553,6 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
552
553
|
};
|
|
553
554
|
}
|
|
554
555
|
this.setState(states, callback);
|
|
555
|
-
}
|
|
556
|
+
};
|
|
556
557
|
};
|
|
557
558
|
export { InputNumberFoundation as default, reachesBound };
|
|
@@ -28,15 +28,15 @@ export default class JsonViewerFoundation<P extends JsonViewerBaseProps = JsonVi
|
|
|
28
28
|
jsonViewer: JsonViewer | null;
|
|
29
29
|
init(): void;
|
|
30
30
|
destroy(): void;
|
|
31
|
-
search(searchText: string, caseSensitive?: boolean, wholeWord?: boolean, regex?: boolean)
|
|
32
|
-
prevSearch(step?: number)
|
|
33
|
-
nextSearch(step?: number)
|
|
34
|
-
replace(replaceText: string)
|
|
35
|
-
replaceAll(replaceText: string)
|
|
31
|
+
search: (searchText: string, caseSensitive?: boolean, wholeWord?: boolean, regex?: boolean) => void;
|
|
32
|
+
prevSearch: (step?: number) => void;
|
|
33
|
+
nextSearch: (step?: number) => void;
|
|
34
|
+
replace: (replaceText: string) => void;
|
|
35
|
+
replaceAll: (replaceText: string) => void;
|
|
36
36
|
/** Toggles one search option, then searches again with the input text and the new options */
|
|
37
|
-
toggleSearchOption(key: keyof SearchOptions)
|
|
38
|
-
toggleSearchBar()
|
|
37
|
+
toggleSearchOption: (key: keyof SearchOptions) => void;
|
|
38
|
+
toggleSearchBar: () => void;
|
|
39
39
|
/** `null` when nothing was searched (or the bar was closed), `undefined` while there is no editor */
|
|
40
|
-
getSearchResults()
|
|
40
|
+
getSearchResults: () => SearchResults | null | undefined;
|
|
41
41
|
}
|
|
42
42
|
export type { CustomRenderRule, JsonViewerOptions, TokenRenderType };
|
|
@@ -13,7 +13,7 @@ var JsonViewerFoundation = class extends BaseFoundation {
|
|
|
13
13
|
#lastSearch = null;
|
|
14
14
|
jsonViewer = null;
|
|
15
15
|
#observeResize() {
|
|
16
|
-
const el = this.
|
|
16
|
+
const el = this.adapter.getEditorRef();
|
|
17
17
|
if (!el) return;
|
|
18
18
|
const rect = el.getBoundingClientRect();
|
|
19
19
|
this.#lastObservedSize = {
|
|
@@ -48,18 +48,18 @@ var JsonViewerFoundation = class extends BaseFoundation {
|
|
|
48
48
|
}
|
|
49
49
|
init() {
|
|
50
50
|
const props = this.getProps();
|
|
51
|
-
const editorRef = this.
|
|
51
|
+
const editorRef = this.adapter.getEditorRef();
|
|
52
52
|
this.jsonViewer = new JsonViewer(editorRef, props.value, {
|
|
53
53
|
prefixCls: cssClasses.PREFIX,
|
|
54
54
|
...props.options
|
|
55
55
|
});
|
|
56
56
|
this.jsonViewer.emitter.on("customRender", (e) => {
|
|
57
|
-
this.
|
|
57
|
+
this.adapter.setCustomRenderMap(e.customRenderMap);
|
|
58
58
|
});
|
|
59
59
|
this.jsonViewer.layout();
|
|
60
60
|
this.#searchAgain();
|
|
61
61
|
this.jsonViewer.emitter.on("contentChanged", () => {
|
|
62
|
-
this.
|
|
62
|
+
this.adapter.notifyChange(this.jsonViewer?.getModel().getValue());
|
|
63
63
|
this.#searchAgain();
|
|
64
64
|
});
|
|
65
65
|
this.#observeResize();
|
|
@@ -74,9 +74,9 @@ var JsonViewerFoundation = class extends BaseFoundation {
|
|
|
74
74
|
this.#resetMeasuredHeights = false;
|
|
75
75
|
this.jsonViewer?.dispose();
|
|
76
76
|
this.jsonViewer = null;
|
|
77
|
-
this.
|
|
77
|
+
this.adapter.setCustomRenderMap(/* @__PURE__ */ new Map());
|
|
78
78
|
}
|
|
79
|
-
search(searchText, caseSensitive, wholeWord, regex) {
|
|
79
|
+
search = (searchText, caseSensitive, wholeWord, regex) => {
|
|
80
80
|
let options;
|
|
81
81
|
if (caseSensitive !== void 0 || wholeWord !== void 0 || regex !== void 0) options = {
|
|
82
82
|
caseSensitive: caseSensitive ?? false,
|
|
@@ -89,36 +89,36 @@ var JsonViewerFoundation = class extends BaseFoundation {
|
|
|
89
89
|
...options
|
|
90
90
|
};
|
|
91
91
|
this.jsonViewer?.getSearchWidget().search(searchText, options.caseSensitive, options.wholeWord, options.regex);
|
|
92
|
-
}
|
|
93
|
-
prevSearch(step) {
|
|
92
|
+
};
|
|
93
|
+
prevSearch = (step) => {
|
|
94
94
|
if (step === void 0) this.jsonViewer?.getSearchWidget().navigateResults(-1);
|
|
95
95
|
else this.jsonViewer?.getSearchWidget().navigateResults(-step);
|
|
96
|
-
}
|
|
97
|
-
nextSearch(step) {
|
|
96
|
+
};
|
|
97
|
+
nextSearch = (step) => {
|
|
98
98
|
if (step === void 0) this.jsonViewer?.getSearchWidget().navigateResults(1);
|
|
99
99
|
else this.jsonViewer?.getSearchWidget().navigateResults(step);
|
|
100
|
-
}
|
|
101
|
-
replace(replaceText) {
|
|
100
|
+
};
|
|
101
|
+
replace = (replaceText) => {
|
|
102
102
|
if (this.getProps().options?.readOnly) return;
|
|
103
103
|
this.jsonViewer?.getSearchWidget().replace(replaceText);
|
|
104
|
-
}
|
|
105
|
-
replaceAll(replaceText) {
|
|
104
|
+
};
|
|
105
|
+
replaceAll = (replaceText) => {
|
|
106
106
|
if (this.getProps().options?.readOnly) return;
|
|
107
107
|
this.jsonViewer?.getSearchWidget().replaceAll(replaceText);
|
|
108
|
-
}
|
|
108
|
+
};
|
|
109
109
|
/** Toggles one search option, then searches again with the input text and the new options */
|
|
110
|
-
toggleSearchOption(key) {
|
|
111
|
-
this.
|
|
110
|
+
toggleSearchOption = (key) => {
|
|
111
|
+
this.adapter.toggleSearchOption(key);
|
|
112
112
|
this.search(this.#lastSearch?.text ?? "");
|
|
113
|
-
}
|
|
114
|
-
toggleSearchBar() {
|
|
113
|
+
};
|
|
114
|
+
toggleSearchBar = () => {
|
|
115
115
|
this.#lastSearch = null;
|
|
116
116
|
this.jsonViewer?.getSearchWidget().clear();
|
|
117
|
-
this.
|
|
118
|
-
}
|
|
117
|
+
this.adapter.toggleSearchBar();
|
|
118
|
+
};
|
|
119
119
|
/** `null` when nothing was searched (or the bar was closed), `undefined` while there is no editor */
|
|
120
|
-
getSearchResults() {
|
|
120
|
+
getSearchResults = () => {
|
|
121
121
|
return this.jsonViewer?.getSearchWidget().searchResults;
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
};
|
|
124
124
|
export { JsonViewerFoundation as default };
|
|
@@ -18,7 +18,7 @@ export default class LottieFoundation<P extends LottieBaseProps = LottieBaseProp
|
|
|
18
18
|
#private;
|
|
19
19
|
static getLottie: () => Promise<import("lottie-web").LottiePlayer>;
|
|
20
20
|
init(): void;
|
|
21
|
-
handleParamsUpdate()
|
|
21
|
+
handleParamsUpdate: () => void;
|
|
22
22
|
destroy(): void;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -9,7 +9,7 @@ var LottieFoundation = class LottieFoundation extends BaseFoundation {
|
|
|
9
9
|
#getLoadParams() {
|
|
10
10
|
const params = this.getProp("params");
|
|
11
11
|
return {
|
|
12
|
-
container: params.container ?? this.
|
|
12
|
+
container: params.container ?? this.adapter.getContainer(),
|
|
13
13
|
renderer: "svg",
|
|
14
14
|
loop: true,
|
|
15
15
|
autoplay: !this.#reducedMotion?.matches,
|
|
@@ -33,7 +33,7 @@ var LottieFoundation = class LottieFoundation extends BaseFoundation {
|
|
|
33
33
|
this.getProp("getLottie")?.(lottie);
|
|
34
34
|
}
|
|
35
35
|
} catch (error) {
|
|
36
|
-
this.
|
|
36
|
+
this.adapter.notifyLoadError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
static getLottie = () => LottieFoundation.#pending ??= import("lottie-web").then((module) => module.default).catch((error) => {
|
|
@@ -47,11 +47,11 @@ var LottieFoundation = class LottieFoundation extends BaseFoundation {
|
|
|
47
47
|
this.#reducedMotion.addEventListener("change", this.#handleMotionChange, { signal: this.signal });
|
|
48
48
|
this.#load();
|
|
49
49
|
}
|
|
50
|
-
handleParamsUpdate() {
|
|
50
|
+
handleParamsUpdate = () => {
|
|
51
51
|
this.#animation?.destroy();
|
|
52
52
|
this.#animation = null;
|
|
53
53
|
this.#load();
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
destroy() {
|
|
56
56
|
super.destroy();
|
|
57
57
|
this.#generation++;
|
|
@@ -46,5 +46,5 @@ export default class MarkdownRenderFoundation<P extends MarkdownRenderBaseProps
|
|
|
46
46
|
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
47
47
|
* content and goes to `notifyCompileError`.
|
|
48
48
|
*/
|
|
49
|
-
updateContent()
|
|
49
|
+
updateContent: () => Promise<void>;
|
|
50
50
|
}
|
|
@@ -33,7 +33,7 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
33
33
|
rehypePlugins: this.getProp("rehypePlugins"),
|
|
34
34
|
remarkGfm: this.getProp("remarkGfm")
|
|
35
35
|
};
|
|
36
|
-
const runtime = this.
|
|
36
|
+
const runtime = this.adapter.getRuntime();
|
|
37
37
|
if (props.format === "md") {
|
|
38
38
|
const processor = MarkdownRenderFoundation.#createMdProcessor(props);
|
|
39
39
|
const tree = await processor.run(processor.parse(raw), raw);
|
|
@@ -88,14 +88,14 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
88
88
|
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
89
89
|
* content and goes to `notifyCompileError`.
|
|
90
90
|
*/
|
|
91
|
-
async
|
|
91
|
+
updateContent = async () => {
|
|
92
92
|
const requestId = ++this.#requestId;
|
|
93
93
|
try {
|
|
94
94
|
const renderContent = await this.evaluate(this.getProp("raw"));
|
|
95
95
|
if (requestId === this.#requestId) this.setState({ renderContent });
|
|
96
96
|
} catch (error) {
|
|
97
|
-
if (requestId === this.#requestId) this.
|
|
97
|
+
if (requestId === this.#requestId) this.adapter.notifyCompileError(error);
|
|
98
98
|
}
|
|
99
|
-
}
|
|
99
|
+
};
|
|
100
100
|
};
|
|
101
101
|
export { MarkdownRenderFoundation as default };
|
|
@@ -26,15 +26,15 @@ export interface ModalContentAdapter<P extends ModalContentProps = ModalContentP
|
|
|
26
26
|
export default class ModalContentFoundation<P extends ModalContentProps = ModalContentProps, E extends Pick<Event, 'target' | 'currentTarget'> = Pick<Event, 'target' | 'currentTarget'>> extends BaseFoundation<ModalContentAdapter<P, E>, P> {
|
|
27
27
|
#private;
|
|
28
28
|
/** Called when the dialog is shown: joins the overlay stack and moves focus into the dialog */
|
|
29
|
-
show()
|
|
29
|
+
show: () => void;
|
|
30
30
|
/**
|
|
31
31
|
* The reverse of `show`. The layer goes first: it releases the page's inert, and an inert element cannot take
|
|
32
32
|
* the focus back.
|
|
33
33
|
*/
|
|
34
|
-
hide()
|
|
35
|
-
handleDialogMouseDown()
|
|
36
|
-
handleMaskMouseUp()
|
|
37
|
-
handleMaskClick(e: E)
|
|
38
|
-
close(e: E | KeyboardEvent)
|
|
39
|
-
restoreFocus()
|
|
34
|
+
hide: () => void;
|
|
35
|
+
handleDialogMouseDown: () => void;
|
|
36
|
+
handleMaskMouseUp: () => void;
|
|
37
|
+
handleMaskClick: (e: E) => void;
|
|
38
|
+
close: (e: E | KeyboardEvent) => void;
|
|
39
|
+
restoreFocus: () => void;
|
|
40
40
|
}
|
|
@@ -12,37 +12,37 @@ var ModalContentFoundation = class extends BaseFoundation {
|
|
|
12
12
|
return true;
|
|
13
13
|
};
|
|
14
14
|
/** Called when the dialog is shown: joins the overlay stack and moves focus into the dialog */
|
|
15
|
-
show() {
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
}
|
|
15
|
+
show = () => {
|
|
16
|
+
this.adapter.openLayer(this.#handleEscape);
|
|
17
|
+
this.adapter.trapFocus();
|
|
18
|
+
};
|
|
19
19
|
/**
|
|
20
20
|
* The reverse of `show`. The layer goes first: it releases the page's inert, and an inert element cannot take
|
|
21
21
|
* the focus back.
|
|
22
22
|
*/
|
|
23
|
-
hide() {
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
23
|
+
hide = () => {
|
|
24
|
+
this.adapter.closeLayer();
|
|
25
|
+
this.adapter.releaseFocus();
|
|
26
26
|
clearTimeout(this.#mouseUpTimer);
|
|
27
27
|
this.#dialogMouseDown = false;
|
|
28
28
|
this.restoreFocus();
|
|
29
|
-
}
|
|
30
|
-
handleDialogMouseDown() {
|
|
29
|
+
};
|
|
30
|
+
handleDialogMouseDown = () => {
|
|
31
31
|
this.#dialogMouseDown = true;
|
|
32
|
-
}
|
|
33
|
-
handleMaskMouseUp() {
|
|
32
|
+
};
|
|
33
|
+
handleMaskMouseUp = () => {
|
|
34
34
|
if (this.#dialogMouseDown) this.#mouseUpTimer = setTimeout(() => {
|
|
35
35
|
this.#dialogMouseDown = false;
|
|
36
36
|
}, 0);
|
|
37
|
-
}
|
|
38
|
-
handleMaskClick(e) {
|
|
37
|
+
};
|
|
38
|
+
handleMaskClick = (e) => {
|
|
39
39
|
if (e.target === e.currentTarget && !this.#dialogMouseDown) this.close(e);
|
|
40
|
-
}
|
|
41
|
-
close(e) {
|
|
42
|
-
this.
|
|
43
|
-
}
|
|
44
|
-
restoreFocus() {
|
|
45
|
-
this.
|
|
46
|
-
}
|
|
40
|
+
};
|
|
41
|
+
close = (e) => {
|
|
42
|
+
this.adapter.notifyClose(e);
|
|
43
|
+
};
|
|
44
|
+
restoreFocus = () => {
|
|
45
|
+
this.adapter.restoreFocus();
|
|
46
|
+
};
|
|
47
47
|
};
|
|
48
48
|
export { ModalContentFoundation as default, isModal };
|
|
@@ -76,10 +76,10 @@ export default class ModalFoundation<P extends ModalProps = ModalProps, S extend
|
|
|
76
76
|
};
|
|
77
77
|
}): 'ok' | 'cancel' | undefined;
|
|
78
78
|
destroy(): void;
|
|
79
|
-
handleCancel(e: CE)
|
|
80
|
-
handleOk(e: OE)
|
|
81
|
-
beforeShow()
|
|
82
|
-
afterHide()
|
|
83
|
-
afterClose()
|
|
84
|
-
toggleDisplayNone(displayNone: boolean)
|
|
79
|
+
handleCancel: (e: CE) => void;
|
|
80
|
+
handleOk: (e: OE) => void;
|
|
81
|
+
beforeShow: () => void;
|
|
82
|
+
afterHide: () => void;
|
|
83
|
+
afterClose: () => void;
|
|
84
|
+
toggleDisplayNone: (displayNone: boolean) => void;
|
|
85
85
|
}
|
|
@@ -12,25 +12,25 @@ var ModalFoundation = class extends BaseFoundation {
|
|
|
12
12
|
this.#invokeCancel(e);
|
|
13
13
|
}, 100, { edges: ["leading"] });
|
|
14
14
|
#invokeCancel(e) {
|
|
15
|
-
const result = this.
|
|
15
|
+
const result = this.adapter.notifyCancel(e);
|
|
16
16
|
if (isPromise(result)) {
|
|
17
|
-
this.
|
|
17
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "pending" });
|
|
18
18
|
result?.then(() => {
|
|
19
|
-
this.
|
|
19
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "fulfilled" });
|
|
20
20
|
})?.catch((e) => {
|
|
21
|
-
this.
|
|
21
|
+
this.adapter.setState({ onCancelReturnPromiseStatus: "rejected" });
|
|
22
22
|
throw e;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
#invokeOk(e) {
|
|
27
|
-
const result = this.
|
|
27
|
+
const result = this.adapter.notifyOk(e);
|
|
28
28
|
if (isPromise(result)) {
|
|
29
|
-
this.
|
|
29
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "pending" });
|
|
30
30
|
result?.then(() => {
|
|
31
|
-
this.
|
|
31
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "fulfilled" });
|
|
32
32
|
})?.catch((e) => {
|
|
33
|
-
this.
|
|
33
|
+
this.adapter.setState({ onOKReturnPromiseStatus: "rejected" });
|
|
34
34
|
throw e;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -45,30 +45,30 @@ var ModalFoundation = class extends BaseFoundation {
|
|
|
45
45
|
this.#debouncedOk.cancel();
|
|
46
46
|
this.#debouncedCancel.cancel();
|
|
47
47
|
}
|
|
48
|
-
handleCancel(e) {
|
|
48
|
+
handleCancel = (e) => {
|
|
49
49
|
if (!this.getProp("visible")) return;
|
|
50
50
|
const target = e?.currentTarget ?? e?.target ?? null;
|
|
51
51
|
if (target !== this.#lastCancelTarget) this.#debouncedCancel.cancel();
|
|
52
52
|
this.#lastCancelTarget = target;
|
|
53
53
|
this.#debouncedCancel(e);
|
|
54
|
-
}
|
|
55
|
-
handleOk(e) {
|
|
54
|
+
};
|
|
55
|
+
handleOk = (e) => {
|
|
56
56
|
const target = e?.currentTarget ?? e?.target ?? null;
|
|
57
57
|
if (target !== this.#lastOkTarget) this.#debouncedOk.cancel();
|
|
58
58
|
this.#lastOkTarget = target;
|
|
59
59
|
this.#debouncedOk(e);
|
|
60
|
-
}
|
|
61
|
-
beforeShow() {
|
|
62
|
-
this.
|
|
63
|
-
}
|
|
64
|
-
afterHide() {
|
|
65
|
-
this.
|
|
66
|
-
}
|
|
67
|
-
afterClose() {
|
|
68
|
-
this.
|
|
69
|
-
}
|
|
70
|
-
toggleDisplayNone(displayNone) {
|
|
71
|
-
this.
|
|
72
|
-
}
|
|
60
|
+
};
|
|
61
|
+
beforeShow = () => {
|
|
62
|
+
this.adapter.disabledBodyScroll();
|
|
63
|
+
};
|
|
64
|
+
afterHide = () => {
|
|
65
|
+
this.adapter.enabledBodyScroll();
|
|
66
|
+
};
|
|
67
|
+
afterClose = () => {
|
|
68
|
+
this.adapter.notifyClose();
|
|
69
|
+
};
|
|
70
|
+
toggleDisplayNone = (displayNone) => {
|
|
71
|
+
this.adapter.toggleDisplayNone(displayNone);
|
|
72
|
+
};
|
|
73
73
|
};
|
|
74
74
|
export { ModalFoundation as default };
|
|
@@ -64,7 +64,7 @@ export default class NavigationFoundation<P extends NavigationBaseProps = Naviga
|
|
|
64
64
|
* New items or children rebuild the menu from the props, otherwise a changed (deep compared) selectedKeys or
|
|
65
65
|
* openKeys is copied into state
|
|
66
66
|
*/
|
|
67
|
-
handlePropsUpdate(prevProps: NavigationBaseProps)
|
|
67
|
+
handlePropsUpdate: (prevProps: NavigationBaseProps) => void;
|
|
68
68
|
/**
|
|
69
69
|
* Selects keys together with their top level parents
|
|
70
70
|
*/
|