@fibrae/semi-foundation 0.2.0 → 0.3.1
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/LICENSE +0 -62
- package/README.md +36 -34
- package/README.zh-CN.md +79 -0
- package/dist/anchor/foundation.d.ts +0 -3
- package/dist/anchor/foundation.js +0 -1
- package/dist/audio-player/foundation.d.ts +0 -3
- package/dist/audio-player/foundation.js +0 -1
- package/dist/auto-complete/foundation.d.ts +0 -2
- package/dist/auto-complete/foundation.js +0 -1
- package/dist/avatar/foundation.d.ts +0 -1
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +0 -3
- package/dist/backtop/foundation.js +0 -1
- package/dist/base/auto-close-foundation.d.ts +0 -1
- package/dist/base/foundation.d.ts +0 -1
- package/dist/base/list-store.d.ts +0 -1
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +0 -10
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +1 -5
- package/dist/calendar/month-foundation.d.ts +0 -1
- package/dist/calendar/month-foundation.js +0 -1
- package/dist/carousel/foundation.d.ts +0 -2
- package/dist/cascader/foundation.d.ts +2 -6
- package/dist/cascader/foundation.js +2 -11
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +1 -5
- package/dist/checkbox/checkbox-foundation.js +0 -2
- package/dist/checkbox/checkbox-group-foundation.d.ts +0 -1
- package/dist/code-highlight/index.d.ts +0 -1
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +0 -1
- package/dist/cropper/foundation.js +0 -1
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +3 -22
- package/dist/date-picker/foundation.js +1 -24
- package/dist/date-picker/input-foundation.d.ts +1 -7
- package/dist/date-picker/input-foundation.js +0 -2
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +1 -10
- package/dist/date-picker/months-grid-foundation.js +1 -10
- package/dist/drag-move/foundation.d.ts +0 -1
- package/dist/dropdown/foundation.d.ts +0 -2
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/feedback/foundation.d.ts +0 -1
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.js +0 -15
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +0 -2
- package/dist/hot-keys/foundation.d.ts +0 -1
- package/dist/image/image-foundation.d.ts +0 -2
- package/dist/image/preview-footer-foundation.d.ts +0 -1
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-image-foundation.d.ts +0 -1
- package/dist/image/preview-inner-foundation.d.ts +0 -1
- package/dist/input/foundation.d.ts +0 -1
- package/dist/input/text-entry-foundation.d.ts +0 -2
- package/dist/input/text-entry-foundation.js +0 -1
- package/dist/input/textarea-foundation.d.ts +0 -1
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +0 -5
- package/dist/input-number/foundation.js +0 -5
- package/dist/json-viewer/foundation.d.ts +0 -2
- package/dist/json-viewer/foundation.js +0 -1
- package/dist/locale/interface.d.ts +0 -3
- package/dist/markdown-render/foundation.d.ts +1 -6
- package/dist/markdown-render/foundation.js +1 -5
- package/dist/navigation/foundation.d.ts +0 -7
- package/dist/navigation/foundation.js +0 -6
- package/dist/navigation/sub-nav-foundation.d.ts +0 -1
- package/dist/notification/notification-list-foundation.d.ts +2 -3
- package/dist/notification/notification-list-foundation.js +0 -1
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +0 -2
- package/dist/overflow-list/foundation.js +0 -1
- package/dist/pagination/foundation.d.ts +0 -2
- package/dist/pincode/foundation.d.ts +1 -4
- package/dist/pincode/foundation.js +1 -4
- package/dist/popconfirm/popconfirm-foundation.d.ts +0 -2
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +0 -4
- package/dist/radio/radio-foundation.js +0 -1
- package/dist/radio/radio-group-foundation.d.ts +0 -1
- package/dist/rating/foundation.d.ts +0 -5
- package/dist/rating/foundation.js +0 -3
- package/dist/resizable/group/index.d.ts +0 -4
- package/dist/resizable/group/index.js +0 -4
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +1 -5
- package/dist/resizable/single/index.js +1 -4
- package/dist/scroll-list/item-foundation.d.ts +0 -2
- package/dist/scroll-list/item-foundation.js +0 -1
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +0 -1
- package/dist/select/option-foundation.d.ts +2 -3
- package/dist/select/option-foundation.js +0 -1
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +1 -6
- package/dist/side-sheet/side-sheet-foundation.js +1 -5
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +1 -12
- package/dist/slider/foundation.js +1 -13
- package/dist/slider/variables.scss +1 -5
- package/dist/spin/foundation.d.ts +0 -2
- package/dist/spin/foundation.js +0 -1
- package/dist/spin/variables.scss +1 -3
- package/dist/switch/foundation.d.ts +0 -1
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +12 -21
- package/dist/table/foundation.js +51 -15
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +0 -8
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +0 -9
- package/dist/tabs/foundation.js +0 -4
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +0 -2
- package/dist/tag-input/foundation.js +0 -1
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +0 -10
- package/dist/time-picker/foundation.js +0 -9
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +0 -3
- package/dist/tooltip/foundation.js +0 -2
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +0 -4
- package/dist/transfer/foundation.js +0 -1
- package/dist/tree/foundation.d.ts +0 -2
- package/dist/tree/foundation.js +0 -1
- package/dist/tree/shared.d.ts +1 -3
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +0 -2
- package/dist/tree-select/foundation.js +0 -3
- package/dist/typography/ellipsis.d.ts +1 -3
- package/dist/typography/ellipsis.js +0 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +0 -6
- package/dist/upload/foundation.js +1 -11
- package/dist/upload/utils.d.ts +0 -5
- package/dist/upload/utils.js +0 -5
- package/dist/user-guide/foundation.d.ts +0 -2
- package/dist/utils/a11y.d.ts +1 -5
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +0 -1
- package/dist/utils/focus-handle.js +0 -1
- package/dist/utils/focus-scope.d.ts +0 -1
- package/dist/utils/focus-scope.js +0 -1
- package/dist/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- package/dist/video-player/progress-foundation.d.ts +0 -1
- package/dist/video-player/progress-foundation.js +0 -1
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -73,7 +73,6 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
|
|
|
73
73
|
if (props.value === void 0) return [];
|
|
74
74
|
return CascaderFoundation.#valuePaths(props.value, props).filter(({ key }) => key !== void 0 && !keyEntities[key]).map(({ path }) => path);
|
|
75
75
|
}
|
|
76
|
-
/** The states that select `value` from `state`, and the entities with a placeholder for a value treeData lacks */
|
|
77
76
|
static #selectionFor(props, state, value, keyEntities) {
|
|
78
77
|
const { changeOnSelect, onChangeWithObject, keyMaps, loadData, multiple } = props;
|
|
79
78
|
const { activeKeys, loadingKeys, keyEntities: keyEntityState, selectedKeys: selectedKeysState } = state;
|
|
@@ -202,10 +201,6 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
|
|
|
202
201
|
if (!entity) return;
|
|
203
202
|
return CascaderFoundation.#missingEntities.has(entity) ? entity.path : entity.valuePath;
|
|
204
203
|
}
|
|
205
|
-
/**
|
|
206
|
-
* Filtered keys for the current props: remote mode treats the current treeData nodes as results without
|
|
207
|
-
* matching; local mode matches by filterTreeNode.
|
|
208
|
-
*/
|
|
209
204
|
#calcFilteredKeys(sugInput, keyEntities) {
|
|
210
205
|
if (!sugInput) return [];
|
|
211
206
|
const { treeNodeFilterProp, filterTreeNode, filterLeafOnly, remote, keyMaps } = this.getProps();
|
|
@@ -410,7 +405,6 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
|
|
|
410
405
|
this.adapter.updateStates({ keyboardKey: key });
|
|
411
406
|
this.adapter.scrollToOption(key, index);
|
|
412
407
|
}
|
|
413
|
-
/** The options of the shown columns in display order, with their index in their column */
|
|
414
408
|
#getShownOptions() {
|
|
415
409
|
const { activeKeys } = this.getStates();
|
|
416
410
|
const topLevel = CascaderFoundation.getRenderData(this.getProps(), this.getStates());
|
|
@@ -506,7 +500,6 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
|
|
|
506
500
|
static hasMultipleValue(props, { checkedKeys, keyEntities }) {
|
|
507
501
|
return checkedKeys.size > 0 || CascaderFoundation.#missingValuePaths(props, keyEntities).length > 0;
|
|
508
502
|
}
|
|
509
|
-
/** Checked, half checked and merged keys for a list of checked keys */
|
|
510
503
|
static calcCheckedState(keys, keyEntities, { checkRelation, autoMergeValue, leafOnly }) {
|
|
511
504
|
if (checkRelation !== strings.RELATED) return {
|
|
512
505
|
checkedKeys: new Set(keys),
|
|
@@ -602,19 +595,17 @@ var CascaderFoundation = class CascaderFoundation extends BaseFoundation {
|
|
|
602
595
|
}
|
|
603
596
|
return state;
|
|
604
597
|
}
|
|
605
|
-
/** The flattened search results while searching, otherwise the top level */
|
|
606
598
|
static getRenderData(props, state) {
|
|
607
599
|
const { keyEntities, isSearching } = state;
|
|
608
600
|
if (isSearching && Boolean(props.filterTreeNode)) return CascaderFoundation.#getFilteredData(props, state);
|
|
609
601
|
return Object.values(keyEntities).filter((item) => item.parentKey === null && !CascaderFoundation.#missingEntities.has(item)).sort((a, b) => a.ind - b.ind);
|
|
610
602
|
}
|
|
611
|
-
/** Whether an option opens a column: it has children, or loadData may load some */
|
|
612
603
|
static isBranch(data, loadData) {
|
|
613
604
|
return Boolean(data.children?.length) || Boolean(loadData && !data.isLeaf);
|
|
614
605
|
}
|
|
615
606
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
607
|
+
* An option that is both active and selected shows only as selected, and in multiple mode selection is the
|
|
608
|
+
* checkbox's, so the row is never marked selected.
|
|
618
609
|
*/
|
|
619
610
|
static getTreeItemState(key, sets, multiple, expandable) {
|
|
620
611
|
const active = sets.activeKeys.has(key);
|
package/dist/cascader/util.d.ts
CHANGED
|
@@ -6,11 +6,7 @@ export interface KeyMapProps {
|
|
|
6
6
|
children?: string;
|
|
7
7
|
isLeaf?: string;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* @returns whether option matches sugInput; a function filterTreeNode decides with (sugInput, target, option).
|
|
11
|
-
*/
|
|
12
9
|
export declare function filter(sugInput: string, option: BasicCascaderData, filterTreeNode: any, filteredPath?: string[]): any;
|
|
13
|
-
/** One column per level of the active path: the top level, then the children of each active node that has some */
|
|
14
10
|
export declare function getColumns<T extends {
|
|
15
11
|
key: string;
|
|
16
12
|
data: {
|
|
@@ -21,10 +17,7 @@ export declare function getColumns<T extends {
|
|
|
21
17
|
items: T[];
|
|
22
18
|
level: number;
|
|
23
19
|
}[];
|
|
24
|
-
/**
|
|
25
|
-
* The labels of a search result joined by the separator, split into the runs that match the keyword and the rest. Only
|
|
26
|
-
* a string label is matched, as the default filter does; any other label passes through whole.
|
|
27
|
-
*/
|
|
20
|
+
/** Only a string label is matched, as the default filter does; any other label passes through whole */
|
|
28
21
|
export declare function highlightParts<T>(searchText: T[], keyword: string, separator: string): {
|
|
29
22
|
text: string | T;
|
|
30
23
|
match: boolean;
|
package/dist/cascader/util.js
CHANGED
|
@@ -2,9 +2,6 @@ import { VALUE_SPLIT, strings } from "./constants.js";
|
|
|
2
2
|
import { getPosition } from "../tree/tree-util.js";
|
|
3
3
|
import { get } from "es-toolkit/compat";
|
|
4
4
|
// src/cascader/util.ts
|
|
5
|
-
/**
|
|
6
|
-
* @returns whether option matches sugInput; a function filterTreeNode decides with (sugInput, target, option).
|
|
7
|
-
*/
|
|
8
5
|
function filter(sugInput, option, filterTreeNode, filteredPath) {
|
|
9
6
|
if (!filterTreeNode) return true;
|
|
10
7
|
let filterFn = filterTreeNode;
|
|
@@ -18,7 +15,6 @@ function filter(sugInput, option, filterTreeNode, filteredPath) {
|
|
|
18
15
|
} else target = filteredPath.join();
|
|
19
16
|
return filterFn(sugInput, target, option);
|
|
20
17
|
}
|
|
21
|
-
/** One column per level of the active path: the top level, then the children of each active node that has some */
|
|
22
18
|
function getColumns(topLevel, activeKeys) {
|
|
23
19
|
const columns = [];
|
|
24
20
|
let items = topLevel;
|
|
@@ -31,10 +27,7 @@ function getColumns(topLevel, activeKeys) {
|
|
|
31
27
|
}
|
|
32
28
|
return columns;
|
|
33
29
|
}
|
|
34
|
-
/**
|
|
35
|
-
* The labels of a search result joined by the separator, split into the runs that match the keyword and the rest. Only
|
|
36
|
-
* a string label is matched, as the default filter does; any other label passes through whole.
|
|
37
|
-
*/
|
|
30
|
+
/** Only a string label is matched, as the default filter does; any other label passes through whole */
|
|
38
31
|
function highlightParts(searchText, keyword, separator) {
|
|
39
32
|
const parts = [];
|
|
40
33
|
const lowerKeyword = keyword.toLowerCase();
|
|
@@ -13,7 +13,6 @@ export interface BasicCheckboxEvent {
|
|
|
13
13
|
};
|
|
14
14
|
[x: string]: any;
|
|
15
15
|
}
|
|
16
|
-
/** The click that toggles the checkbox: only what the foundation reads or forwards */
|
|
17
16
|
export interface CheckboxSourceEvent {
|
|
18
17
|
stopPropagation: () => void;
|
|
19
18
|
preventDefault: () => void;
|
|
@@ -36,7 +35,6 @@ export interface CheckboxBaseState {
|
|
|
36
35
|
checked: boolean;
|
|
37
36
|
}
|
|
38
37
|
type AriaInvalid = boolean | 'true' | 'false' | 'grammar' | 'spelling';
|
|
39
|
-
/** What a CheckboxGroup hands to the checkboxes inside it */
|
|
40
38
|
export interface CheckboxGroupView {
|
|
41
39
|
value: CheckboxValue[];
|
|
42
40
|
disabled: boolean;
|
|
@@ -46,7 +44,7 @@ export interface CheckboxGroupView {
|
|
|
46
44
|
ariaInvalid?: AriaInvalid;
|
|
47
45
|
ariaErrormessage?: string;
|
|
48
46
|
}
|
|
49
|
-
/**
|
|
47
|
+
/** `checked` is the controlled value */
|
|
50
48
|
export interface CheckboxViewProps {
|
|
51
49
|
checked?: unknown;
|
|
52
50
|
disabled?: boolean;
|
|
@@ -68,9 +66,7 @@ export interface CheckboxView {
|
|
|
68
66
|
}
|
|
69
67
|
export default class CheckboxFoundation<P extends BaseCheckboxProps = BaseCheckboxProps, S extends CheckboxBaseState = CheckboxBaseState> extends BaseFoundation<CheckboxAdapter<P, S>, P, S> {
|
|
70
68
|
#private;
|
|
71
|
-
/** How the checkbox looks and behaves, from its own props or, with a value inside a group, from the group */
|
|
72
69
|
static deriveView(props: CheckboxViewProps, state: CheckboxBaseState, group?: CheckboxGroupView | null): CheckboxView;
|
|
73
|
-
/** Whether a click landed on an interactive element inside the root other than the checkbox's own input */
|
|
74
70
|
static isInnerInteractiveClick(target: Element, root: Element, input?: Element | null): boolean;
|
|
75
71
|
handleChange: (e: CheckboxSourceEvent) => void;
|
|
76
72
|
setChecked: (checked: boolean) => void;
|
|
@@ -15,7 +15,6 @@ var CheckboxFoundation = class extends BaseFoundation {
|
|
|
15
15
|
this.adapter.notifyChange(event);
|
|
16
16
|
this.adapter.notifyGroupChange(event);
|
|
17
17
|
}
|
|
18
|
-
/** How the checkbox looks and behaves, from its own props or, with a value inside a group, from the group */
|
|
19
18
|
static deriveView(props, state, group) {
|
|
20
19
|
if (group && props.value !== void 0) return {
|
|
21
20
|
inGroup: true,
|
|
@@ -39,7 +38,6 @@ var CheckboxFoundation = class extends BaseFoundation {
|
|
|
39
38
|
ariaErrormessage: props["aria-errormessage"]
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
/** Whether a click landed on an interactive element inside the root other than the checkbox's own input */
|
|
43
41
|
static isInnerInteractiveClick(target, root, input) {
|
|
44
42
|
const interactive = target.closest(INTERACTIVE_SELECTOR);
|
|
45
43
|
return Boolean(interactive && interactive !== input && root.contains(interactive));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
2
|
import { BasicCheckboxEvent } from "./checkbox-foundation.js";
|
|
3
3
|
export type CheckboxValue = string | number | boolean;
|
|
4
|
-
/** The props the foundation reads with getProps */
|
|
5
4
|
export interface CheckboxGroupBaseProps {
|
|
6
5
|
defaultValue?: CheckboxValue[];
|
|
7
6
|
value?: CheckboxValue[];
|
|
@@ -7,7 +7,6 @@ export interface CodeHighlightBaseProps {
|
|
|
7
7
|
lineNumber?: boolean;
|
|
8
8
|
/** Grammars this block needs beyond the registered ones, loaded once into the shared highlighter */
|
|
9
9
|
languages?: LanguageInput[];
|
|
10
|
-
/** Overrides the registered themes for this block */
|
|
11
10
|
themes?: CodeHighlightThemes;
|
|
12
11
|
}
|
|
13
12
|
export interface CodeHighlightBaseState {
|
|
@@ -49,7 +49,6 @@ $module: #{$prefix}-colorPicker;
|
|
|
49
49
|
&-alphaSlider {
|
|
50
50
|
position: relative;
|
|
51
51
|
margin-top: $spacing-colorPicker_slider-marginTop;
|
|
52
|
-
// scrolling the page would cancel the pointer mid-drag
|
|
53
52
|
touch-action: none;
|
|
54
53
|
cursor: pointer;
|
|
55
54
|
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><rect x="8" width="8" height="8"/><rect y="8" width="8" height="8"/></svg>');
|
|
@@ -74,7 +73,6 @@ $module: #{$prefix}-colorPicker;
|
|
|
74
73
|
&-colorSlider {
|
|
75
74
|
position: relative;
|
|
76
75
|
margin-top: $spacing-colorPicker_slider-marginTop;
|
|
77
|
-
// scrolling the page would cancel the pointer mid-drag
|
|
78
76
|
touch-action: none;
|
|
79
77
|
cursor: pointer;
|
|
80
78
|
background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
|
|
@@ -22,7 +22,6 @@ export interface HslColor {
|
|
|
22
22
|
export interface HslaColor extends HslColor {
|
|
23
23
|
a: number;
|
|
24
24
|
}
|
|
25
|
-
/** The text formats of the color input */
|
|
26
25
|
export type ColorFormat = 'hex' | 'rgba' | 'hsva';
|
|
27
26
|
/** The keydown fields the range handlers read; a framework's synthetic event fits */
|
|
28
27
|
export type RangeKeyEvent = Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'preventDefault'>;
|
|
@@ -7,26 +7,10 @@ export interface BreakpointScreens {
|
|
|
7
7
|
xl: boolean;
|
|
8
8
|
xxl: boolean;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Subscribe callback: get all breakpoint matches
|
|
12
|
-
*/
|
|
13
10
|
export type OnBreakpointScreensCallback = (screens: BreakpointScreens) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Subscribe callback: get single breakpoint change
|
|
16
|
-
*/
|
|
17
11
|
export type OnBreakpointChangeCallback = (screen: Breakpoint, match: boolean) => void;
|
|
18
12
|
export interface ResponsiveConfig {
|
|
19
|
-
/**
|
|
20
|
-
* Custom responsive map
|
|
21
|
-
*/
|
|
22
13
|
responsiveMap?: ResponsiveMap;
|
|
23
|
-
/**
|
|
24
|
-
* Subscribe to breakpoint changes. Returns an unsubscribe function.
|
|
25
|
-
*
|
|
26
|
-
* Overloads:
|
|
27
|
-
* - onBreakpoint(callback): callback receives full screens map
|
|
28
|
-
* - onBreakpoint(breakpoints, callback): callback receives (screen, match)
|
|
29
|
-
*/
|
|
30
14
|
onBreakpoint?: {
|
|
31
15
|
(callback: OnBreakpointScreensCallback): () => void;
|
|
32
16
|
(breakpoints: Breakpoint[], callback: OnBreakpointChangeCallback): () => void;
|
|
@@ -383,7 +383,6 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
383
383
|
else if (dir.includes("r")) dir = dir.replace("r", "l");
|
|
384
384
|
this.#resizeDir = dir;
|
|
385
385
|
}
|
|
386
|
-
/** `point` is in container coordinates */
|
|
387
386
|
#resizeCornerFree = (point) => {
|
|
388
387
|
const { cropperBox } = this.getStates();
|
|
389
388
|
const offsetX = clamp(point.x, ...this.#rangeX);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
|
-
/**
|
|
3
|
-
* get left panel picker date and right panel picker date
|
|
4
|
-
*/
|
|
5
2
|
export default function getDefaultPickerDate({ defaultPickerValue, format, dateFnsLocale: Locale }: GetDefaultPickerValueDateOptions): {
|
|
6
3
|
nowDate: Date;
|
|
7
4
|
nextDate: Date;
|
|
@@ -4,9 +4,6 @@ import isTimestamp from "./is-timestamp.js";
|
|
|
4
4
|
import { compatibleParse } from "./parser.js";
|
|
5
5
|
import { addMonths } from "date-fns";
|
|
6
6
|
// src/date-picker/_utils/get-default-picker-date.ts
|
|
7
|
-
/**
|
|
8
|
-
* get left panel picker date and right panel picker date
|
|
9
|
-
*/
|
|
10
7
|
function getDefaultPickerDate({ defaultPickerValue, format, dateFnsLocale }) {
|
|
11
8
|
let nowDate = Array.isArray(defaultPickerValue) ? defaultPickerValue[0] : defaultPickerValue;
|
|
12
9
|
let nextDate = Array.isArray(defaultPickerValue) ? defaultPickerValue[1] : void 0;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getDefaultFormatTokenByType } from "./get-default-format-token.js";
|
|
2
2
|
// src/date-picker/_utils/get-inset-input-format-token.ts
|
|
3
3
|
/**
|
|
4
|
-
* Get the placeholder of the insetInput input
|
|
5
|
-
*
|
|
6
4
|
* If type is time related, we only recognize the format like `dateFormat timeFormat`
|
|
7
5
|
* - 'yyyy-MM-dd HH:mm:ss' // ok
|
|
8
6
|
* - 'yyyy-MM-dd HH:mm:ss' // bad format
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { isValid, parse, parseISO } from "date-fns";
|
|
2
2
|
// src/date-picker/_utils/parser.ts
|
|
3
|
-
/**
|
|
4
|
-
* @file
|
|
5
|
-
* Various date-related analysis methods
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Parsing value to Date object
|
|
9
|
-
*/
|
|
10
3
|
function compatibleParse(value, formatToken, baseDate, locale) {
|
|
11
4
|
let result = null;
|
|
12
5
|
if (value) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Type } from "../input-foundation.js";
|
|
2
|
-
/** dateRange, dateTimeRange and monthRange select a start and an end */
|
|
3
2
|
export declare function isRangeType(type?: Type): boolean;
|
|
4
3
|
/** `multiple` applies to the date type only; the other types ignore it */
|
|
5
4
|
export declare function isMultiple({ type, multiple }: {
|
|
@@ -12,8 +11,7 @@ export declare function needConfirm({ type, needConfirm: confirm }: {
|
|
|
12
11
|
type?: Type;
|
|
13
12
|
needConfirm?: boolean;
|
|
14
13
|
}): boolean;
|
|
15
|
-
|
|
16
|
-
export declare function isYearOrMonthType(type?: Type): type is "month" | "year" | "monthRange";
|
|
14
|
+
export declare function isYearOrMonthType(type?: Type): type is "year" | "month" | "monthRange";
|
|
17
15
|
/** monthRange shows its range in one trigger input; the other range types split it into a start and an end input */
|
|
18
16
|
export declare function isSplitRangeInputs(type?: Type): boolean;
|
|
19
17
|
/** An empty range (cleared) or one with two valid dates; a half-picked range is neither committed nor confirmed */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import isValidDate from "./is-valid-date.js";
|
|
2
2
|
// src/date-picker/_utils/picker-type.ts
|
|
3
|
-
/** dateRange, dateTimeRange and monthRange select a start and an end */
|
|
4
3
|
function isRangeType(type) {
|
|
5
4
|
return typeof type === "string" && type.endsWith("Range");
|
|
6
5
|
}
|
|
@@ -15,7 +14,6 @@ function isDateTimeType(type) {
|
|
|
15
14
|
function needConfirm({ type, needConfirm: confirm }) {
|
|
16
15
|
return isDateTimeType(type) && confirm === true;
|
|
17
16
|
}
|
|
18
|
-
/** These types pick in the year and month panel instead of the day grid */
|
|
19
17
|
function isYearOrMonthType(type) {
|
|
20
18
|
return type === "year" || type === "month" || type === "monthRange";
|
|
21
19
|
}
|
|
@@ -5,7 +5,6 @@ import { Type } from "../input-foundation.js";
|
|
|
5
5
|
* zonedTimeToUtc(a, "+09:00") turns it into 21:00 (+8), i.e. 22:00 in +9.
|
|
6
6
|
*/
|
|
7
7
|
export declare function toCallbackDates(value: Date | Date[], timeZone?: string | number): Date[];
|
|
8
|
-
/** Builds the date and string arguments of the callbacks, with the dates converted by `toCallbackDates` */
|
|
9
8
|
export default function toCallbackArgs(value: Date | Date[], options: {
|
|
10
9
|
type?: Type;
|
|
11
10
|
format?: string;
|
|
@@ -13,7 +13,6 @@ function toCallbackDates(value, timeZone) {
|
|
|
13
13
|
const dates = Array.isArray(value) ? value : value && [value] || [];
|
|
14
14
|
return isValidTimeZone(timeZone) ? dates.map((date) => zonedTimeToUtc(date, timeZone)) : dates;
|
|
15
15
|
}
|
|
16
|
-
/** Builds the date and string arguments of the callbacks, with the dates converted by `toCallbackDates` */
|
|
17
16
|
function toCallbackArgs(value, options) {
|
|
18
17
|
const { type, format: format$1, timeZone, dateFnsLocale } = options;
|
|
19
18
|
const dates = toCallbackDates(value, timeZone);
|
|
@@ -94,7 +94,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// With a left or right preset panel and no inset input, the month panel gets a fixed height
|
|
98
97
|
&[x-preset-position='left'][x-insetinput='false'],
|
|
99
98
|
&[x-preset-position='right'][x-insetinput='false'] {
|
|
100
99
|
.#{$module}-month {
|
|
@@ -1229,7 +1228,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
1229
1228
|
}
|
|
1230
1229
|
}
|
|
1231
1230
|
|
|
1232
|
-
// Keeps the year/month ScrollList from scrolling when the number of weeks changes the height
|
|
1233
1231
|
&[x-panel-yearandmonth-open-type='left'],
|
|
1234
1232
|
&[x-panel-yearandmonth-open-type='right'] {
|
|
1235
1233
|
.#{$module}-weeks {
|
|
@@ -1604,7 +1602,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
1604
1602
|
|
|
1605
1603
|
&-dateTimeRange {
|
|
1606
1604
|
width: max-content;
|
|
1607
|
-
// Capped at the viewport limit so min-width never exceeds max-width (forced overflow)
|
|
1608
1605
|
min-width: min(#{$width-datepicker_panel_compact * 2}, #{$compact-max-width});
|
|
1609
1606
|
max-width: $compact-max-width;
|
|
1610
1607
|
|
|
@@ -25,9 +25,6 @@ export type DayStatusType = {
|
|
|
25
25
|
export type DisabledDateOptions = {
|
|
26
26
|
rangeStart?: string;
|
|
27
27
|
rangeEnd?: string;
|
|
28
|
-
/**
|
|
29
|
-
* current select of range type
|
|
30
|
-
*/
|
|
31
28
|
rangeInputFocus?: 'rangeStart' | 'rangeEnd' | false;
|
|
32
29
|
};
|
|
33
30
|
/** `null` start and end make a preset that clears the value */
|
|
@@ -135,10 +132,7 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
|
|
|
135
132
|
/** filled by the framework from the LocaleProvider, not a component prop */
|
|
136
133
|
dateFnsLocale?: any;
|
|
137
134
|
rangeSeparator?: string;
|
|
138
|
-
/**
|
|
139
|
-
* Only for UI render. Keep `semi-foundation` framework-agnostic (no React types).
|
|
140
|
-
* `semi-ui-react` layer should declare this as `React.ReactNode`.
|
|
141
|
-
*/
|
|
135
|
+
/** `any` keeps the foundation framework-agnostic; each framework package declares its own node type */
|
|
142
136
|
rangeSeparatorNode?: any;
|
|
143
137
|
insetInput?: DateInputFoundationProps['insetInput'];
|
|
144
138
|
preventScroll?: boolean;
|
|
@@ -146,7 +140,7 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
|
|
|
146
140
|
export interface DatePickerFoundationState {
|
|
147
141
|
panelShow: boolean;
|
|
148
142
|
isRange: boolean;
|
|
149
|
-
/**
|
|
143
|
+
/** `null` while the input shows the formatted value */
|
|
150
144
|
inputValue: string | null;
|
|
151
145
|
value: Date[];
|
|
152
146
|
cachedSelectedValue: (Date | null)[];
|
|
@@ -154,7 +148,6 @@ export interface DatePickerFoundationState {
|
|
|
154
148
|
/** `undefined` until a range input is focused or the value is set */
|
|
155
149
|
rangeInputFocus?: RangeInput | false;
|
|
156
150
|
autofocus: boolean;
|
|
157
|
-
/** value of inset input */
|
|
158
151
|
insetInputValue: InsetInputValue | null;
|
|
159
152
|
triggerDisabled: boolean | null;
|
|
160
153
|
/** which range inputs have been focused since the panel opened; a range closes once both have */
|
|
@@ -189,10 +182,6 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
|
|
|
189
182
|
setTriggerFocus: () => void;
|
|
190
183
|
blurFocusedElement: () => void;
|
|
191
184
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Keeps the date value and the input text in sync: a selected date updates the input text, and a valid input text
|
|
194
|
-
* updates the date value; both notify the change.
|
|
195
|
-
*/
|
|
196
185
|
export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapter, DatePickerFoundationProps, DatePickerFoundationState> {
|
|
197
186
|
#private;
|
|
198
187
|
/**
|
|
@@ -230,10 +219,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
230
219
|
static disposeDateFn<R>(timeZone: string | number | undefined, fn: (date: any, ...rest: any) => R, date: Date | Date[], ...rest: any[]): R;
|
|
231
220
|
/** A controlled `open` is not copied into state; a disabled picker shows no panel */
|
|
232
221
|
static isPanelShown(props: Pick<DatePickerFoundationProps, 'open' | 'disabled'>, state: Pick<DatePickerFoundationState, 'panelShow'>): boolean;
|
|
233
|
-
/**
|
|
234
|
-
* The props derived from others. The rtl default of `position` stays with the
|
|
235
|
-
* frameworks, which read the direction from their config.
|
|
236
|
-
*/
|
|
222
|
+
/** The rtl default of `position` stays with the frameworks, which read the direction from their config. */
|
|
237
223
|
static normalizeProps<P extends string = Position>({ type, format, rangeSeparator, insetInput, position, spacing }: Pick<DatePickerFoundationProps, 'type' | 'format' | 'rangeSeparator' | 'insetInput' | 'spacing'> & {
|
|
238
224
|
position?: P;
|
|
239
225
|
}): {
|
|
@@ -248,7 +234,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
248
234
|
* than `getProp` and `getProps`.
|
|
249
235
|
*
|
|
250
236
|
* @param props the props with the defaults applied and `timeZone` resolved from the ConfigProvider
|
|
251
|
-
* @returns `value`, `cachedSelectedValue`, `rangeInputFocus`, `inputValue` and `prevTimeZone`
|
|
252
237
|
*/
|
|
253
238
|
static getInitialState(props: DatePickerFoundationProps): Pick<DatePickerFoundationState, 'value' | 'cachedSelectedValue' | 'rangeInputFocus' | 'inputValue' | 'prevTimeZone'>;
|
|
254
239
|
init(): void;
|
|
@@ -274,9 +259,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
274
259
|
/** Whether the range input other than `currentRangeInput` has been focused since the panel opened */
|
|
275
260
|
hasOtherRangeInputBeenFocused: (currentRangeInput: RangeInput) => boolean;
|
|
276
261
|
handleInputChange: (input: string, e: unknown) => void;
|
|
277
|
-
/**
|
|
278
|
-
* Always updates insetInputValue; inputValue and value are updated only when the text parses to a valid date.
|
|
279
|
-
*/
|
|
280
262
|
handleInsetInputChange: ({ insetInputStr, format, insetInputValue }: {
|
|
281
263
|
insetInputStr: string;
|
|
282
264
|
format: string;
|
|
@@ -313,7 +295,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
313
295
|
disabledDisposeDate: (date: Date, ...rest: any[]) => boolean;
|
|
314
296
|
disabledDisposeTime: (date: Date | Date[], ...rest: any[]) => ReturnType<DisabledTimeType>;
|
|
315
297
|
/**
|
|
316
|
-
* Opens the panel on trigger click and, for range types, focuses rangeStart when no range input is focused.
|
|
317
298
|
* Non-range triggers are native inputs that already handle focus. isEventTarget tells a click on the input
|
|
318
299
|
* wrapper itself from one bubbled up from a child, which already handled focus.
|
|
319
300
|
*/
|
|
@@ -17,10 +17,6 @@ import toCallbackArgs, { toCallbackDates } from "./_utils/to-callback-args.js";
|
|
|
17
17
|
import { isEqual } from "es-toolkit";
|
|
18
18
|
import { format, isDate, isEqual as isEqual$1, isSameSecond, isValid, startOfDay } from "date-fns";
|
|
19
19
|
// src/date-picker/foundation.ts
|
|
20
|
-
/**
|
|
21
|
-
* Keeps the date value and the input text in sync: a selected date updates the input text, and a valid input text
|
|
22
|
-
* updates the date value; both notify the change.
|
|
23
|
-
*/
|
|
24
20
|
var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
25
21
|
#focusRecordTimers = /* @__PURE__ */ new Set();
|
|
26
22
|
#initialized = false;
|
|
@@ -189,17 +185,6 @@ var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
|
189
185
|
this.adapter.updateInputValue(null);
|
|
190
186
|
this.adapter.updateInsetInputValue(null);
|
|
191
187
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Parses a multiple input part by part with `parse`; an empty or unparsable part, or more than `max` dates,
|
|
194
|
-
* gives `[]`. `parseInputLoose` as `parse` keeps `null` for a half typed date.
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```javascript
|
|
198
|
-
* this.#parseMultipleInput('2021-01-01,2021-10-15', parseInputLoose); // [Date, Date];
|
|
199
|
-
* this.#parseMultipleInput('2021-01-01,2021-10-', parseInputLoose); // [Date, null];
|
|
200
|
-
* this.#parseMultipleInput('', parseInputLoose); // [];
|
|
201
|
-
* ```
|
|
202
|
-
*/
|
|
203
188
|
#parseMultipleInput(input, parse, { needDedupe = false } = {}) {
|
|
204
189
|
const max = this.getProp("max");
|
|
205
190
|
const result = [];
|
|
@@ -367,10 +352,7 @@ var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
|
367
352
|
static isPanelShown(props, state) {
|
|
368
353
|
return (props.open !== void 0 ? Boolean(props.open) : Boolean(state.panelShow)) && !props.disabled;
|
|
369
354
|
}
|
|
370
|
-
/**
|
|
371
|
-
* The props derived from others. The rtl default of `position` stays with the
|
|
372
|
-
* frameworks, which read the direction from their config.
|
|
373
|
-
*/
|
|
355
|
+
/** The rtl default of `position` stays with the frameworks, which read the direction from their config. */
|
|
374
356
|
static normalizeProps({ type, format, rangeSeparator, insetInput, position, spacing }) {
|
|
375
357
|
const hasNoTime = typeof format === "string" && format && !/[Hhms]+/.test(format);
|
|
376
358
|
const normalizedType = hasNoTime && type === "dateTime" ? "date" : hasNoTime && type === "dateTimeRange" ? "dateRange" : type;
|
|
@@ -388,7 +370,6 @@ var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
|
388
370
|
* than `getProp` and `getProps`.
|
|
389
371
|
*
|
|
390
372
|
* @param props the props with the defaults applied and `timeZone` resolved from the ConfigProvider
|
|
391
|
-
* @returns `value`, `cachedSelectedValue`, `rangeInputFocus`, `inputValue` and `prevTimeZone`
|
|
392
373
|
*/
|
|
393
374
|
static getInitialState(props) {
|
|
394
375
|
const reader = new DatePickerFoundation({
|
|
@@ -515,9 +496,6 @@ var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
|
515
496
|
}
|
|
516
497
|
} else this.adapter.updateInputValue(input);
|
|
517
498
|
};
|
|
518
|
-
/**
|
|
519
|
-
* Always updates insetInputValue; inputValue and value are updated only when the text parses to a valid date.
|
|
520
|
-
*/
|
|
521
499
|
handleInsetInputChange = ({ insetInputStr, format, insetInputValue }) => {
|
|
522
500
|
const _isMultiple = this.#isMultiple();
|
|
523
501
|
const result = _isMultiple ? this.#parseMultipleInput(insetInputStr, (part) => this.parseInput(part, format)) : this.parseInput(insetInputStr, format);
|
|
@@ -686,7 +664,6 @@ var DatePickerFoundation = class DatePickerFoundation extends BaseFoundation {
|
|
|
686
664
|
return DatePickerFoundation.disposeDateFn(this.getProp("timeZone"), this.getProp("disabledTime"), date, ...rest);
|
|
687
665
|
};
|
|
688
666
|
/**
|
|
689
|
-
* Opens the panel on trigger click and, for range types, focuses rangeStart when no range input is focused.
|
|
690
667
|
* Non-range triggers are native inputs that already handle focus. isEventTarget tells a click on the input
|
|
691
668
|
* wrapper itself from one bubbled up from a child, which already handled focus.
|
|
692
669
|
*/
|
|
@@ -3,7 +3,6 @@ import { Locale } from "../locale/interface.js";
|
|
|
3
3
|
import { strings } from "./constants.js";
|
|
4
4
|
import { BaseValueType, ValidateStatus, ValueType } from "./foundation.js";
|
|
5
5
|
export type Type = 'date' | 'dateRange' | 'year' | 'month' | 'dateTime' | 'dateTimeRange' | 'monthRange';
|
|
6
|
-
/** The range input, start or end, that a focus or a value belongs to */
|
|
7
6
|
export type RangeInput = 'rangeStart' | 'rangeEnd';
|
|
8
7
|
export type PanelType = 'left' | 'right';
|
|
9
8
|
export interface DateInputEventHandlerProps {
|
|
@@ -42,10 +41,7 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
|
|
|
42
41
|
validateStatus?: ValidateStatus;
|
|
43
42
|
prefixCls?: string;
|
|
44
43
|
rangeSeparator?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Only for UI render. Keep `semi-foundation` framework-agnostic (no React types).
|
|
47
|
-
* `semi-ui-react` layer should declare this as `React.ReactNode`.
|
|
48
|
-
*/
|
|
44
|
+
/** `any` keeps the foundation framework-agnostic; each framework package declares its own node type */
|
|
49
45
|
rangeSeparatorNode?: any;
|
|
50
46
|
panelType?: PanelType;
|
|
51
47
|
insetInput?: boolean | InsetInputProps;
|
|
@@ -88,9 +84,7 @@ export interface DateInputAdapter extends DefaultAdapter<DateInputFoundationProp
|
|
|
88
84
|
type InputProps = Pick<DateInputFoundationProps, 'type' | 'format' | 'rangeSeparator' | 'dateFnsLocale'>;
|
|
89
85
|
export default class InputFoundation extends BaseFoundation<DateInputAdapter, DateInputFoundationProps, Record<string, never>> {
|
|
90
86
|
#private;
|
|
91
|
-
/** The text the trigger input shows for `value` */
|
|
92
87
|
static formatShowText({ type, dateFnsLocale, format, rangeSeparator }: InputProps, value: BaseValueType[], customFormat?: string): string;
|
|
93
|
-
/** The trigger text: the text being typed, else `value` formatted */
|
|
94
88
|
static getShowText(props: InputProps & {
|
|
95
89
|
inputValue?: string | null;
|
|
96
90
|
value?: BaseValueType[];
|
|
@@ -42,7 +42,6 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
/** The text the trigger input shows for `value` */
|
|
46
45
|
static formatShowText({ type, dateFnsLocale, format, rangeSeparator }, value, customFormat) {
|
|
47
46
|
const formatToken = customFormat || format || getDefaultFormatTokenByType(type);
|
|
48
47
|
switch (type) {
|
|
@@ -59,7 +58,6 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
59
58
|
default: return "";
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
/** The trigger text: the text being typed, else `value` formatted */
|
|
63
61
|
static getShowText(props) {
|
|
64
62
|
if (props.inputValue != null) return props.inputValue;
|
|
65
63
|
return props.value?.length ? InputFoundation.formatShowText(props, props.value) : "";
|
|
@@ -26,7 +26,6 @@ export interface MonthFoundationProps {
|
|
|
26
26
|
renderFullDate: RenderFullDateType;
|
|
27
27
|
hoverDay: string;
|
|
28
28
|
rangeInputFocus: string | boolean;
|
|
29
|
-
/** which range inputs have been focused since the panel opened */
|
|
30
29
|
focusRecords: FocusRecords;
|
|
31
30
|
locale: any;
|
|
32
31
|
multiple: boolean;
|
|
@@ -48,10 +47,8 @@ export interface MonthTable {
|
|
|
48
47
|
export type DayStatusOptions = Pick<MonthFoundationProps, 'selected' | 'rangeStart' | 'rangeEnd' | 'offsetRangeStart' | 'offsetRangeEnd' | 'disabledDate' | 'hoverDay' | 'rangeInputFocus' | 'focusRecords'> & {
|
|
49
48
|
todayText: string;
|
|
50
49
|
};
|
|
51
|
-
/** The pure computations behind one month grid of the DatePicker panel */
|
|
52
50
|
export default class CalendarMonthFoundation {
|
|
53
51
|
#private;
|
|
54
|
-
/** The weekday keys of a row, starting from `weekStartsOn` */
|
|
55
52
|
static getWeekdays(weekStartsOn: WeekStartNumber): string[];
|
|
56
53
|
static getMonthTable(month: Date, weekStartsOn: WeekStartNumber): MonthTable;
|
|
57
54
|
/**
|
|
@@ -13,7 +13,6 @@ const MONTH_SWITCHES = {
|
|
|
13
13
|
1: "nextMonth",
|
|
14
14
|
12: "nextYear"
|
|
15
15
|
};
|
|
16
|
-
/** The pure computations behind one month grid of the DatePicker panel */
|
|
17
16
|
var CalendarMonthFoundation = class CalendarMonthFoundation {
|
|
18
17
|
static #getSingleDayStatus(fullDate, { todayText, selected, disabledDate, rangeStart, rangeEnd, rangeInputFocus, focusRecords }) {
|
|
19
18
|
const disabledOptions = {
|
|
@@ -110,7 +109,6 @@ var CalendarMonthFoundation = class CalendarMonthFoundation {
|
|
|
110
109
|
isInOffsetRange
|
|
111
110
|
};
|
|
112
111
|
}
|
|
113
|
-
/** The weekday keys of a row, starting from `weekStartsOn` */
|
|
114
112
|
static getWeekdays(weekStartsOn) {
|
|
115
113
|
return getDayofWeek({ weekStartsOn });
|
|
116
114
|
}
|