fast-element-plus 2.0.20 → 2.0.22
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/CHANGELOG.md +20 -0
- package/dist/component.d.ts +15 -15
- package/dist/components/avatar/index.d.ts +3 -3
- package/dist/components/avatar/index.mjs.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +1 -1
- package/dist/components/carNumber/index.d.ts +1 -1
- package/dist/components/carNumber/index.mjs.map +1 -1
- package/dist/components/contextMenu/index.d.ts +1 -1
- package/dist/components/contextMenu/index.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/dialog/index.mjs.map +1 -1
- package/dist/components/dialog/src/dialog.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/index.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +3 -3
- package/dist/components/form/index.d.ts +4 -4
- package/dist/components/form/index.mjs.map +1 -1
- package/dist/components/form/utils/form.d.ts +2 -2
- package/dist/components/form/utils/form.mjs +2 -2
- package/dist/components/form/utils/form.mjs.map +1 -1
- package/dist/components/formItemTip/index.d.ts +2 -2
- package/dist/components/formItemTip/index.mjs.map +1 -1
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon/index.mjs.map +1 -1
- package/dist/components/iconSelector/index.d.ts +1 -1
- package/dist/components/iconSelector/index.mjs.map +1 -1
- package/dist/components/image/index.d.ts +2 -2
- package/dist/components/image/index.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +1 -1
- package/dist/components/inputDialogPage/index.d.ts +3 -3
- package/dist/components/inputDialogPage/index.mjs.map +1 -1
- package/dist/components/layoutGrid/index.d.ts +2 -2
- package/dist/components/layoutGrid/index.mjs.map +1 -1
- package/dist/components/select/index.d.ts +4 -4
- package/dist/components/select/index.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +1 -1
- package/dist/components/select/src/select.type.d.ts +2 -2
- package/dist/components/selectPage/index.d.ts +3 -3
- package/dist/components/selectPage/index.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +1 -1
- package/dist/components/selectV2/index.d.ts +3 -3
- package/dist/components/selectV2/index.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +1 -1
- package/dist/components/table/index.d.ts +4 -4
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/page.type.d.ts +2 -2
- package/dist/components/table/src/table.mjs +20 -20
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.type.d.ts +5 -5
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +2 -2
- package/dist/components/table/src/tableColumn.mjs +34 -28
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/utils/table.d.ts +18 -15
- package/dist/components/table/utils/table.mjs +20 -17
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/index.d.ts +3 -3
- package/dist/components/tree/index.mjs.map +1 -1
- package/dist/components/tree/src/tree.props.d.ts +2 -2
- package/dist/components/tree/src/tree.type.d.ts +2 -2
- package/dist/components/treeSelect/index.d.ts +3 -3
- package/dist/components/treeSelect/index.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +1 -1
- package/dist/components/upload/index.d.ts +3 -3
- package/dist/components/upload/index.mjs.map +1 -1
- package/dist/components/upload/utils/upload.d.ts +15 -10
- package/dist/components/upload/utils/upload.mjs +15 -10
- package/dist/components/upload/utils/upload.mjs.map +1 -1
- package/dist/components/uploadImage/index.d.ts +3 -3
- package/dist/components/uploadImage/index.mjs.map +1 -1
- package/dist/components/uploadImages/index.d.ts +3 -3
- package/dist/components/uploadImages/index.mjs.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/internal/props.d.ts +1 -1
- package/dist/internal/props.mjs.map +1 -1
- package/dist/utils/async/index.d.ts +4 -4
- package/dist/utils/async/index.mjs +9 -9
- package/dist/utils/async/index.mjs.map +1 -1
- package/dist/utils/date/index.d.ts +8 -8
- package/dist/utils/date/index.mjs +16 -16
- package/dist/utils/date/index.mjs.map +1 -1
- package/dist/utils/dom/index.d.ts +1 -1
- package/dist/utils/dom/index.mjs +4 -4
- package/dist/utils/dom/index.mjs.map +1 -1
- package/dist/utils/object/index.d.ts +10 -10
- package/dist/utils/object/index.mjs +6 -6
- package/dist/utils/object/index.mjs.map +1 -1
- package/dist/utils/string/index.d.ts +4 -4
- package/dist/utils/string/index.mjs +14 -40
- package/dist/utils/string/index.mjs.map +1 -1
- package/dist/utils/vue/emits.d.ts +8 -8
- package/dist/utils/vue/emits.mjs +7 -7
- package/dist/utils/vue/emits.mjs.map +1 -1
- package/dist/utils/vue/expose.d.ts +3 -3
- package/dist/utils/vue/expose.mjs +3 -3
- package/dist/utils/vue/expose.mjs.map +1 -1
- package/dist/utils/vue/func.d.ts +2 -2
- package/dist/utils/vue/func.mjs +2 -2
- package/dist/utils/vue/func.mjs.map +1 -1
- package/dist/utils/vue/install.d.ts +9 -9
- package/dist/utils/vue/install.mjs +24 -24
- package/dist/utils/vue/install.mjs.map +1 -1
- package/dist/utils/vue/props.d.ts +4 -4
- package/dist/utils/vue/props.mjs +5 -5
- package/dist/utils/vue/props.mjs.map +1 -1
- package/dist/utils/vue/render.d.ts +1 -1
- package/dist/utils/vue/render.mjs +2 -2
- package/dist/utils/vue/render.mjs.map +1 -1
- package/dist/utils/vue/slots.d.ts +4 -4
- package/dist/utils/vue/slots.mjs.map +1 -1
- package/dist/utils/vue/with.d.ts +1 -1
- package/dist/utils/vue/with.mjs +1 -1
- package/dist/utils/vue/with.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/props.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CSSProperties, Component, PropType } from "vue";
|
|
|
3
3
|
import type { ElSelectorModelValue } from "../components/select/src/select.type";
|
|
4
4
|
import type { DefaultRow } from "../components/table/src/table.state";
|
|
5
5
|
type Layout = "fixed" | "auto";
|
|
6
|
-
/** FaTable
|
|
6
|
+
/** FaTable 树形数据的字段配置 */
|
|
7
7
|
export interface TreeProps {
|
|
8
8
|
hasChildren?: string;
|
|
9
9
|
children?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.mjs","names":[],"sources":["../../src/internal/props.ts"],"sourcesContent":["/** 集中维护复制并适配的 Element Plus 运行时 Props;业务组件在此基础上覆写。 */\nimport { ArrowDown, CircleClose } from \"@element-plus/icons-vue\";\nimport { tagProps, useAriaProps, useEmptyValuesProps, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { definePropType } from \"../utils/vue/props\";\nimport type { SelectV2Props as ElementPlusSelectV2Props, Options, Placement, TableColumnCtx, TableProps } from \"element-plus\";\nimport type { CSSProperties, Component, PropType } from \"vue\";\nimport type { ElSelectorModelValue } from \"../components/select/src/select.type\";\nimport type { DefaultRow } from \"../components/table/src/table.state\";\n\ntype Layout = \"fixed\" | \"auto\";\n\n/** FaTable 树形数据的字段配置。 */\nexport interface TreeProps {\n\thasChildren?: string;\n\tchildren?: string;\n\tcheckStrictly?: boolean;\n}\n\n/** Element Plus Table 的透传 Props 定义。 */\nexport const tableProps = {\n\t/**\n\t * table data\n\t */\n\tdata: {\n\t\ttype: Array as PropType<DefaultRow[]>,\n\t\tdefault: (): DefaultRow[] => [],\n\t},\n\t/**\n\t * size of Table\n\t */\n\tsize: useSizeProp,\n\twidth: [String, Number],\n\t/**\n\t * table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles\n\t */\n\theight: [String, Number],\n\t/**\n\t * table's max-height. The legal value is a number or the height in px\n\t */\n\tmaxHeight: [String, Number],\n\t/**\n\t * whether width of column automatically fits its container\n\t */\n\tfit: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * whether Table is striped\n\t */\n\tstripe: Boolean,\n\t/**\n\t * whether Table has vertical border\n\t */\n\tborder: Boolean,\n\t/**\n\t * key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used\n\t */\n\trowKey: [String, Function] as PropType<TableProps<DefaultRow>[\"rowKey\"]>,\n\t/**\n\t * whether Table header is visible\n\t */\n\tshowHeader: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * whether to display a summary row\n\t */\n\tshowSummary: Boolean,\n\t/**\n\t * displayed text for the first column of summary row\n\t */\n\tsumText: String,\n\t/**\n\t * custom summary method\n\t */\n\tsummaryMethod: Function as PropType<TableProps<DefaultRow>[\"summaryMethod\"]>,\n\t/**\n\t * function that returns custom class names for a row, or a string assigning class names for every row\n\t */\n\trowClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"rowClassName\"]>,\n\t/**\n\t * function that returns custom style for a row, or an object assigning custom style for every row\n\t */\n\trowStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"rowStyle\"]>,\n\t/**\n\t * function that returns custom class names for a cell, or a string assigning class names for every cell\n\t */\n\tcellClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"cellClassName\"]>,\n\t/**\n\t * function that returns custom style for a cell, or an object assigning custom style for every cell\n\t */\n\tcellStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"cellStyle\"]>,\n\t/**\n\t * function that returns custom class names for a row in table header, or a string assigning class names for every row in table header\n\t */\n\theaderRowClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"headerRowClassName\"]>,\n\t/**\n\t * function that returns custom style for a row in table header, or an object assigning custom style for every row in table header\n\t */\n\theaderRowStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"headerRowStyle\"]>,\n\t/**\n\t * function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header\n\t */\n\theaderCellClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"headerCellClassName\"]>,\n\t/**\n\t * function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header\n\t */\n\theaderCellStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"headerCellStyle\"]>,\n\t/**\n\t * whether current row is highlighted\n\t */\n\thighlightCurrentRow: Boolean,\n\t/**\n\t * key of current row, a set only prop\n\t */\n\tcurrentRowKey: [String, Number],\n\t/**\n\t * displayed text when data is empty. You can customize this area with `#empty`\n\t */\n\temptyText: String,\n\t/**\n\t * set expanded rows by this prop, prop's value is the keys of expand rows, you should set row-key before using this prop\n\t */\n\texpandRowKeys: Array as PropType<TableProps<DefaultRow>[\"expandRowKeys\"]>,\n\t/** controls whether a row can be expanded */\n\trowExpandable: Function as PropType<TableProps<DefaultRow>[\"rowExpandable\"]>,\n\t/**\n\t * whether expand all rows by default, works when the table has a column type=\"expand\" or contains tree structure data\n\t */\n\tdefaultExpandAll: Boolean,\n\t/**\n\t * set the default sort column and order. property `prop` is used to set default sort column, property `order` is used to set default sort order\n\t */\n\tdefaultSort: Object as PropType<TableProps<DefaultRow>[\"defaultSort\"]>,\n\t/**\n\t * the `effect` of the overflow tooltip\n\t */\n\ttooltipEffect: String,\n\t/**\n\t * the options for the overflow tooltip, [see the following tooltip component](tooltip.html#attributes)\n\t */\n\ttooltipOptions: Object as PropType<TableProps<DefaultRow>[\"tooltipOptions\"]>,\n\t/**\n\t * method that returns rowspan and colspan\n\t */\n\tspanMethod: Function as PropType<TableProps<DefaultRow>[\"spanMethod\"]>,\n\t/**\n\t * controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected\n\t */\n\tselectOnIndeterminate: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * horizontal indentation of tree data\n\t */\n\tindent: {\n\t\ttype: Number,\n\t\tdefault: 16,\n\t},\n\t/**\n\t * configuration for rendering nested data\n\t */\n\ttreeProps: {\n\t\ttype: Object as PropType<TreeProps>,\n\t\tdefault: (): { hasChildren: string; children: string; checkStrictly: boolean } => ({\n\t\t\thasChildren: \"hasChildren\",\n\t\t\tchildren: \"children\",\n\t\t\tcheckStrictly: false,\n\t\t}),\n\t},\n\t/**\n\t * whether to lazy loading data\n\t */\n\tlazy: Boolean,\n\t/**\n\t * method for loading child row data, only works when `lazy` is true\n\t */\n\tload: Function as PropType<TableProps<DefaultRow>[\"load\"]>,\n\tstyle: {\n\t\ttype: Object as PropType<CSSProperties>,\n\t\tdefault: (): CSSProperties => ({}),\n\t},\n\tclassName: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * sets the algorithm used to lay out table cells, rows, and columns\n\t */\n\ttableLayout: {\n\t\ttype: String as PropType<Layout>,\n\t\tdefault: \"fixed\",\n\t},\n\t/**\n\t * always show scrollbar\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * ensure main axis minimum-size doesn't follow the content\n\t */\n\tflexible: Boolean,\n\t/**\n\t * whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns\n\t */\n\tshowOverflowTooltip: [Boolean, Object] as PropType<TableProps<DefaultRow>[\"showOverflowTooltip\"]>,\n\t/** formats overflow tooltip content */\n\ttooltipFormatter: Function as PropType<TableProps<DefaultRow>[\"tooltipFormatter\"]>,\n\t/** element to which the filter panel is appended */\n\tappendFilterPanelTo: String,\n\tscrollbarTabindex: {\n\t\ttype: [Number, String],\n\t\tdefault: undefined,\n\t},\n\t/** whether the last column can be resized */\n\tallowDragLastColumn: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether collapsed expanded-row content remains mounted */\n\tpreserveExpandedContent: Boolean,\n\t/** whether to use native scrollbars */\n\tnativeScrollbar: Boolean,\n};\n\n/** Element Plus TableColumn 的透传 Props 定义 */\nexport const tableColumnProps = {\n\t/**\n\t * type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n\t */\n\ttype: {\n\t\ttype: String,\n\t\tdefault: \"default\",\n\t},\n\t/**\n\t * column label\n\t */\n\tlabel: String,\n\t/**\n\t * class name of cells in the column\n\t */\n\tclassName: String,\n\t/**\n\t * class name of the label of this column\n\t */\n\tlabelClassName: String,\n\t/**\n\t *\n\t */\n\tproperty: String,\n\t/**\n\t * field name. You can also use its alias: `property`\n\t */\n\tprop: String,\n\t/**\n\t * column width\n\t */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion\n\t */\n\tminWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * render function for table header of this column\n\t */\n\trenderHeader: Function as PropType<TableColumnCtx<DefaultRow>[\"renderHeader\"]>,\n\t/**\n\t * whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table\n\t */\n\tsortable: {\n\t\ttype: [Boolean, String],\n\t\tdefault: false,\n\t},\n\t/**\n\t * sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort\n\t */\n\tsortMethod: Function as PropType<TableColumnCtx<DefaultRow>[\"sortMethod\"]>,\n\t/**\n\t * specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal\n\t */\n\tsortBy: [String, Function, Array] as PropType<TableColumnCtx<DefaultRow>[\"sortBy\"]>,\n\t/**\n\t * whether column width can be resized, works when `border` of `el-table` is `true`\n\t */\n\tresizable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered\n\t */\n\tcolumnKey: String,\n\t/**\n\t * alignment, the value should be 'left' \\/ 'center' \\/ 'right'\n\t */\n\talign: String,\n\t/**\n\t * alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right'\n\t */\n\theaderAlign: String,\n\t/**\n\t * whether to hide extra content and show them in a tooltip when hovering on the cell\n\t */\n\tshowOverflowTooltip: {\n\t\ttype: [Boolean, Object] as PropType<TableColumnCtx<DefaultRow>[\"showOverflowTooltip\"]>,\n\t\tdefault: undefined,\n\t},\n\t/** function that formats cell tooltip content, works when show-overflow-tooltip is enabled */\n\ttooltipFormatter: Function as PropType<TableColumnCtx<DefaultRow>[\"tooltipFormatter\"]>,\n\t/**\n\t * whether column is fixed at left / right. Will be fixed at left if `true`\n\t */\n\tfixed: [Boolean, String],\n\t/**\n\t * function that formats cell content\n\t */\n\tformatter: Function as PropType<TableColumnCtx<DefaultRow>[\"formatter\"]>,\n\t/**\n\t * function that determines if a certain row can be selected, works when `type` is 'selection'\n\t */\n\tselectable: Function as PropType<TableColumnCtx<DefaultRow>[\"selectable\"]>,\n\t/**\n\t * whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work\n\t */\n\treserveSelection: Boolean,\n\t/**\n\t * data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`\n\t */\n\tfilterMethod: Function as PropType<TableColumnCtx<DefaultRow>[\"filterMethod\"]>,\n\t/**\n\t * filter value for selected data, might be useful when table header is rendered with `render-header`\n\t */\n\tfilteredValue: Array as PropType<TableColumnCtx<DefaultRow>[\"filteredValue\"]>,\n\t/**\n\t * an array of data filtering options. For each element in this array, `text` and `value` are required\n\t */\n\tfilters: Array as PropType<TableColumnCtx<DefaultRow>[\"filters\"]>,\n\t/**\n\t * placement for the filter dropdown\n\t */\n\tfilterPlacement: String,\n\t/**\n\t * whether data filtering supports multiple options\n\t */\n\tfilterMultiple: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * className for the filter dropdown\n\t */\n\tfilterClassName: String,\n\t/**\n\t * customize indices for each row, works on columns with `type=index`\n\t */\n\tindex: [Number, Function] as PropType<TableColumnCtx<DefaultRow>[\"index\"]>,\n\t/**\n\t * the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array\n\t */\n\tsortOrders: {\n\t\ttype: Array as PropType<TableColumnCtx<DefaultRow>[\"sortOrders\"]>,\n\t\tdefault: (): (string | null)[] => {\n\t\t\treturn [\"ascending\", \"descending\", null];\n\t\t},\n\t\tvalidator: (val: unknown): boolean => {\n\t\t\treturn Array.isArray(val) && val.every((order: unknown): boolean => order === \"ascending\" || order === \"descending\" || order === null);\n\t\t},\n\t},\n};\n\n/** 传递给底层 Element Plus 虚拟化选择器的扩展 Props。 */\nexport interface Props {\n\tlabel?: string;\n\tvalue?: string;\n\tdisabled?: string;\n\toptions?: string;\n}\n\n/** Element Plus SelectV2 的透传 Props 定义。 */\nexport const SelectV2Props = {\n\t/**\n\t * whether creating new items is allowed. To use this, `filterable` must be true\n\t */\n\tallowCreate: Boolean,\n\t/**\n\t * autocomplete of select input\n\t */\n\tautocomplete: {\n\t\ttype: definePropType<\"none\" | \"both\" | \"list\" | \"inline\">(String),\n\t\tdefault: \"none\",\n\t},\n\t/**\n\t * for non-filterable Select, this prop decides if the option menu pops up when the input is focused\n\t */\n\tautomaticDropdown: Boolean,\n\t/**\n\t * whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * custom clear icon\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * tooltip theme, built-in theme: `dark` / `light`\n\t */\n\teffect: {\n\t\ttype: definePropType<string>(String),\n\t\tdefault: \"light\",\n\t},\n\t/**\n\t * whether to collapse tags to a text when multiple selecting\n\t */\n\tcollapseTags: Boolean,\n\t/**\n\t * whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n\t */\n\tcollapseTagsTooltip: Boolean,\n\t/** collapse-tags tooltip configuration */\n\ttagTooltip: {\n\t\ttype: definePropType<ElementPlusSelectV2Props[\"tagTooltip\"]>(Object),\n\t\tdefault: (): NonNullable<ElementPlusSelectV2Props[\"tagTooltip\"]> => ({}),\n\t},\n\t/**\n\t * The max tags number to be shown. To use this, `collapse-tags` must be true\n\t */\n\tmaxCollapseTags: {\n\t\ttype: Number,\n\t\tdefault: 1,\n\t},\n\t/**\n\t *\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t *\n\t */\n\testimatedOptionHeight: {\n\t\ttype: Number,\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * is filterable\n\t */\n\tfilterable: Boolean,\n\t/**\n\t *\n\t */\n\tfilterMethod: Function as PropType<ElementPlusSelectV2Props[\"filterMethod\"]>,\n\t/**\n\t * The height of the dropdown panel, 34px for each item\n\t */\n\theight: {\n\t\ttype: Number,\n\t\tdefault: 274, // same as select dropdown menu\n\t},\n\t/**\n\t * The height of the dropdown item\n\t */\n\titemHeight: {\n\t\ttype: Number,\n\t\tdefault: 34,\n\t},\n\t/**\n\t *\n\t */\n\tid: String,\n\t/**\n\t * whether Select is loading data from server\n\t */\n\tloading: Boolean,\n\t/**\n\t * displayed text while loading data from server, default is 'Loading'\n\t */\n\tloadingText: String,\n\t/**\n\t * biding value\n\t */\n\tmodelValue: {\n\t\ttype: definePropType<ElSelectorModelValue>([Array, String, Number, Boolean, Object]),\n\t},\n\t/**\n\t * is multiple\n\t */\n\tmultiple: Boolean,\n\t/**\n\t * maximum number of options user can select when multiple is true. No limit when set to 0\n\t */\n\tmultipleLimit: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * displayed text when there is no options, you can also use slot empty, the default is 'No Data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'\n\t */\n\tnoMatchText: String,\n\t/**\n\t * function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true\n\t */\n\tremoteMethod: Function as PropType<ElementPlusSelectV2Props[\"remoteMethod\"]>,\n\t/**\n\t * whether reserve the keyword after select filtered option.\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * data of the options, the key of `value` and `label` can be customize by `props`\n\t */\n\toptions: {\n\t\ttype: definePropType<ElementPlusSelectV2Props[\"options\"]>(Array),\n\t},\n\t/**\n\t * placeholder, the default is 'Please select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * whether select dropdown is teleported to the body\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的运行时默认值与校验规则。\n\tteleported: useTooltipContentProps.teleported,\n\t/**\n\t * when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed\n\t */\n\tpersistent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * custom class name for Select's dropdown\n\t */\n\tpopperClass: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/** custom style for Select's dropdown */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的运行时类型定义。\n\tpopperStyle: useTooltipContentProps.popperStyle,\n\t/**\n\t * [popper.js](https://popper.js.org/docs/v2/) parameters\n\t */\n\tpopperOptions: {\n\t\ttype: definePropType<Partial<Options>>(Object),\n\t\tdefault: (): Partial<Options> => ({}),\n\t},\n\t/**\n\t * whether search data from server\n\t */\n\tremote: Boolean,\n\t/** debounce delay during remote search, in milliseconds */\n\tdebounce: {\n\t\ttype: Number,\n\t\tdefault: 300,\n\t},\n\t/**\n\t * size of component\n\t */\n\tsize: useSizeProp,\n\t/**\n\t * configuration options, see the following table\n\t */\n\tprops: {\n\t\ttype: definePropType<Props>(Object),\n\t\tdefault: (): { label: string; value: string; disabled: string; options: string } => ({\n\t\t\tlabel: \"label\",\n\t\t\tvalue: \"value\",\n\t\t\tdisabled: \"disabled\",\n\t\t\toptions: \"options\",\n\t\t}),\n\t},\n\t/**\n\t * unique identity key name for value, required when value is an object\n\t */\n\tvalueKey: {\n\t\ttype: String,\n\t\tdefault: \"value\",\n\t},\n\t/**\n\t * Controls whether the scrollbar is always displayed\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * offset of the dropdown\n\t */\n\toffset: {\n\t\ttype: Number,\n\t\tdefault: 12,\n\t},\n\t/** whether to show the suffix icon during remote search */\n\tremoteShowSuffix: Boolean,\n\t/**\n\t * Determines whether the arrow is displayed\n\t */\n\tshowArrow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * position of dropdown\n\t */\n\tplacement: {\n\t\ttype: definePropType<Placement>(String),\n\t\tdefault: \"bottom-start\",\n\t},\n\t/**\n\t * list of possible positions for dropdown\n\t */\n\tfallbackPlacements: {\n\t\ttype: definePropType<Placement[]>(Array),\n\t\tdefault: [\"bottom-start\", \"top-start\", \"right\", \"left\"],\n\t},\n\t/**\n\t * tag type\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的 Tag 运行时校验规则。\n\ttagType: { ...tagProps.type, default: \"info\" },\n\t/**\n\t * tag effect\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的 Tag 运行时校验规则。\n\ttagEffect: { ...tagProps.effect, default: \"light\" },\n\t/**\n\t * tabindex for input\n\t */\n\ttabindex: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/**\n\t * which element the select dropdown appends to\n\t */\n\tappendTo: String,\n\t/** whether the dropdown width follows the input width, or a fixed width */\n\tfitInputWidth: {\n\t\ttype: [Boolean, Number],\n\t\tdefault: true,\n\t\tvalidator: (value: boolean | number): boolean => typeof value === \"boolean\" || typeof value === \"number\",\n\t},\n\t/** select suffix icon */\n\tsuffixIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: ArrowDown,\n\t},\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的空值运行时约定。\n\t...useEmptyValuesProps,\n\t...useAriaProps([\"ariaLabel\"]),\n};\n"],"mappings":";;;;;;AAmBA,MAAa,aAAa;;;;CAIzB,MAAM;EACL,MAAM;EACN,eAA6B,CAAC;CAC/B;;;;CAIA,MAAM;CACN,OAAO,CAAC,QAAQ,MAAM;;;;CAItB,QAAQ,CAAC,QAAQ,MAAM;;;;CAIvB,WAAW,CAAC,QAAQ,MAAM;;;;CAI1B,KAAK;EACJ,MAAM;EACN,SAAS;CACV;;;;CAIA,QAAQ;;;;CAIR,QAAQ;;;;CAIR,QAAQ,CAAC,QAAQ,QAAQ;;;;CAIzB,YAAY;EACX,MAAM;EACN,SAAS;CACV;;;;CAIA,aAAa;;;;CAIb,SAAS;;;;CAIT,eAAe;;;;CAIf,cAAc,CAAC,QAAQ,QAAQ;;;;CAI/B,UAAU,CAAC,QAAQ,QAAQ;;;;CAI3B,eAAe,CAAC,QAAQ,QAAQ;;;;CAIhC,WAAW,CAAC,QAAQ,QAAQ;;;;CAI5B,oBAAoB,CAAC,QAAQ,QAAQ;;;;CAIrC,gBAAgB,CAAC,QAAQ,QAAQ;;;;CAIjC,qBAAqB,CAAC,QAAQ,QAAQ;;;;CAItC,iBAAiB,CAAC,QAAQ,QAAQ;;;;CAIlC,qBAAqB;;;;CAIrB,eAAe,CAAC,QAAQ,MAAM;;;;CAI9B,WAAW;;;;CAIX,eAAe;;CAEf,eAAe;;;;CAIf,kBAAkB;;;;CAIlB,aAAa;;;;CAIb,eAAe;;;;CAIf,gBAAgB;;;;CAIhB,YAAY;;;;CAIZ,uBAAuB;EACtB,MAAM;EACN,SAA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A,GAAG;CACH,GAAG,aAAa,CAAC,WAAW,CAAC;AAC9B"}
|
|
1
|
+
{"version":3,"file":"props.mjs","names":[],"sources":["../../src/internal/props.ts"],"sourcesContent":["/** 集中维护复制并适配的 Element Plus 运行时 Props;业务组件在此基础上覆写。 */\nimport { ArrowDown, CircleClose } from \"@element-plus/icons-vue\";\nimport { tagProps, useAriaProps, useEmptyValuesProps, useSizeProp, useTooltipContentProps } from \"element-plus\";\nimport { definePropType } from \"../utils/vue/props\";\nimport type { SelectV2Props as ElementPlusSelectV2Props, Options, Placement, TableColumnCtx, TableProps } from \"element-plus\";\nimport type { CSSProperties, Component, PropType } from \"vue\";\nimport type { ElSelectorModelValue } from \"../components/select/src/select.type\";\nimport type { DefaultRow } from \"../components/table/src/table.state\";\n\ntype Layout = \"fixed\" | \"auto\";\n\n/** FaTable 树形数据的字段配置 */\nexport interface TreeProps {\n\thasChildren?: string;\n\tchildren?: string;\n\tcheckStrictly?: boolean;\n}\n\n/** Element Plus Table 的透传 Props 定义。 */\nexport const tableProps = {\n\t/**\n\t * table data\n\t */\n\tdata: {\n\t\ttype: Array as PropType<DefaultRow[]>,\n\t\tdefault: (): DefaultRow[] => [],\n\t},\n\t/**\n\t * size of Table\n\t */\n\tsize: useSizeProp,\n\twidth: [String, Number],\n\t/**\n\t * table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles\n\t */\n\theight: [String, Number],\n\t/**\n\t * table's max-height. The legal value is a number or the height in px\n\t */\n\tmaxHeight: [String, Number],\n\t/**\n\t * whether width of column automatically fits its container\n\t */\n\tfit: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * whether Table is striped\n\t */\n\tstripe: Boolean,\n\t/**\n\t * whether Table has vertical border\n\t */\n\tborder: Boolean,\n\t/**\n\t * key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used\n\t */\n\trowKey: [String, Function] as PropType<TableProps<DefaultRow>[\"rowKey\"]>,\n\t/**\n\t * whether Table header is visible\n\t */\n\tshowHeader: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * whether to display a summary row\n\t */\n\tshowSummary: Boolean,\n\t/**\n\t * displayed text for the first column of summary row\n\t */\n\tsumText: String,\n\t/**\n\t * custom summary method\n\t */\n\tsummaryMethod: Function as PropType<TableProps<DefaultRow>[\"summaryMethod\"]>,\n\t/**\n\t * function that returns custom class names for a row, or a string assigning class names for every row\n\t */\n\trowClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"rowClassName\"]>,\n\t/**\n\t * function that returns custom style for a row, or an object assigning custom style for every row\n\t */\n\trowStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"rowStyle\"]>,\n\t/**\n\t * function that returns custom class names for a cell, or a string assigning class names for every cell\n\t */\n\tcellClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"cellClassName\"]>,\n\t/**\n\t * function that returns custom style for a cell, or an object assigning custom style for every cell\n\t */\n\tcellStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"cellStyle\"]>,\n\t/**\n\t * function that returns custom class names for a row in table header, or a string assigning class names for every row in table header\n\t */\n\theaderRowClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"headerRowClassName\"]>,\n\t/**\n\t * function that returns custom style for a row in table header, or an object assigning custom style for every row in table header\n\t */\n\theaderRowStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"headerRowStyle\"]>,\n\t/**\n\t * function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header\n\t */\n\theaderCellClassName: [String, Function] as PropType<TableProps<DefaultRow>[\"headerCellClassName\"]>,\n\t/**\n\t * function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header\n\t */\n\theaderCellStyle: [Object, Function] as PropType<TableProps<DefaultRow>[\"headerCellStyle\"]>,\n\t/**\n\t * whether current row is highlighted\n\t */\n\thighlightCurrentRow: Boolean,\n\t/**\n\t * key of current row, a set only prop\n\t */\n\tcurrentRowKey: [String, Number],\n\t/**\n\t * displayed text when data is empty. You can customize this area with `#empty`\n\t */\n\temptyText: String,\n\t/**\n\t * set expanded rows by this prop, prop's value is the keys of expand rows, you should set row-key before using this prop\n\t */\n\texpandRowKeys: Array as PropType<TableProps<DefaultRow>[\"expandRowKeys\"]>,\n\t/** controls whether a row can be expanded */\n\trowExpandable: Function as PropType<TableProps<DefaultRow>[\"rowExpandable\"]>,\n\t/**\n\t * whether expand all rows by default, works when the table has a column type=\"expand\" or contains tree structure data\n\t */\n\tdefaultExpandAll: Boolean,\n\t/**\n\t * set the default sort column and order. property `prop` is used to set default sort column, property `order` is used to set default sort order\n\t */\n\tdefaultSort: Object as PropType<TableProps<DefaultRow>[\"defaultSort\"]>,\n\t/**\n\t * the `effect` of the overflow tooltip\n\t */\n\ttooltipEffect: String,\n\t/**\n\t * the options for the overflow tooltip, [see the following tooltip component](tooltip.html#attributes)\n\t */\n\ttooltipOptions: Object as PropType<TableProps<DefaultRow>[\"tooltipOptions\"]>,\n\t/**\n\t * method that returns rowspan and colspan\n\t */\n\tspanMethod: Function as PropType<TableProps<DefaultRow>[\"spanMethod\"]>,\n\t/**\n\t * controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected\n\t */\n\tselectOnIndeterminate: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * horizontal indentation of tree data\n\t */\n\tindent: {\n\t\ttype: Number,\n\t\tdefault: 16,\n\t},\n\t/**\n\t * configuration for rendering nested data\n\t */\n\ttreeProps: {\n\t\ttype: Object as PropType<TreeProps>,\n\t\tdefault: (): { hasChildren: string; children: string; checkStrictly: boolean } => ({\n\t\t\thasChildren: \"hasChildren\",\n\t\t\tchildren: \"children\",\n\t\t\tcheckStrictly: false,\n\t\t}),\n\t},\n\t/**\n\t * whether to lazy loading data\n\t */\n\tlazy: Boolean,\n\t/**\n\t * method for loading child row data, only works when `lazy` is true\n\t */\n\tload: Function as PropType<TableProps<DefaultRow>[\"load\"]>,\n\tstyle: {\n\t\ttype: Object as PropType<CSSProperties>,\n\t\tdefault: (): CSSProperties => ({}),\n\t},\n\tclassName: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * sets the algorithm used to lay out table cells, rows, and columns\n\t */\n\ttableLayout: {\n\t\ttype: String as PropType<Layout>,\n\t\tdefault: \"fixed\",\n\t},\n\t/**\n\t * always show scrollbar\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * ensure main axis minimum-size doesn't follow the content\n\t */\n\tflexible: Boolean,\n\t/**\n\t * whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns\n\t */\n\tshowOverflowTooltip: [Boolean, Object] as PropType<TableProps<DefaultRow>[\"showOverflowTooltip\"]>,\n\t/** formats overflow tooltip content */\n\ttooltipFormatter: Function as PropType<TableProps<DefaultRow>[\"tooltipFormatter\"]>,\n\t/** element to which the filter panel is appended */\n\tappendFilterPanelTo: String,\n\tscrollbarTabindex: {\n\t\ttype: [Number, String],\n\t\tdefault: undefined,\n\t},\n\t/** whether the last column can be resized */\n\tallowDragLastColumn: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** whether collapsed expanded-row content remains mounted */\n\tpreserveExpandedContent: Boolean,\n\t/** whether to use native scrollbars */\n\tnativeScrollbar: Boolean,\n};\n\n/** Element Plus TableColumn 的透传 Props 定义 */\nexport const tableColumnProps = {\n\t/**\n\t * type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n\t */\n\ttype: {\n\t\ttype: String,\n\t\tdefault: \"default\",\n\t},\n\t/**\n\t * column label\n\t */\n\tlabel: String,\n\t/**\n\t * class name of cells in the column\n\t */\n\tclassName: String,\n\t/**\n\t * class name of the label of this column\n\t */\n\tlabelClassName: String,\n\t/**\n\t *\n\t */\n\tproperty: String,\n\t/**\n\t * field name. You can also use its alias: `property`\n\t */\n\tprop: String,\n\t/**\n\t * column width\n\t */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion\n\t */\n\tminWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"\",\n\t},\n\t/**\n\t * render function for table header of this column\n\t */\n\trenderHeader: Function as PropType<TableColumnCtx<DefaultRow>[\"renderHeader\"]>,\n\t/**\n\t * whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table\n\t */\n\tsortable: {\n\t\ttype: [Boolean, String],\n\t\tdefault: false,\n\t},\n\t/**\n\t * sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort\n\t */\n\tsortMethod: Function as PropType<TableColumnCtx<DefaultRow>[\"sortMethod\"]>,\n\t/**\n\t * specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal\n\t */\n\tsortBy: [String, Function, Array] as PropType<TableColumnCtx<DefaultRow>[\"sortBy\"]>,\n\t/**\n\t * whether column width can be resized, works when `border` of `el-table` is `true`\n\t */\n\tresizable: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered\n\t */\n\tcolumnKey: String,\n\t/**\n\t * alignment, the value should be 'left' \\/ 'center' \\/ 'right'\n\t */\n\talign: String,\n\t/**\n\t * alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right'\n\t */\n\theaderAlign: String,\n\t/**\n\t * whether to hide extra content and show them in a tooltip when hovering on the cell\n\t */\n\tshowOverflowTooltip: {\n\t\ttype: [Boolean, Object] as PropType<TableColumnCtx<DefaultRow>[\"showOverflowTooltip\"]>,\n\t\tdefault: undefined,\n\t},\n\t/** function that formats cell tooltip content, works when show-overflow-tooltip is enabled */\n\ttooltipFormatter: Function as PropType<TableColumnCtx<DefaultRow>[\"tooltipFormatter\"]>,\n\t/**\n\t * whether column is fixed at left / right. Will be fixed at left if `true`\n\t */\n\tfixed: [Boolean, String],\n\t/**\n\t * function that formats cell content\n\t */\n\tformatter: Function as PropType<TableColumnCtx<DefaultRow>[\"formatter\"]>,\n\t/**\n\t * function that determines if a certain row can be selected, works when `type` is 'selection'\n\t */\n\tselectable: Function as PropType<TableColumnCtx<DefaultRow>[\"selectable\"]>,\n\t/**\n\t * whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work\n\t */\n\treserveSelection: Boolean,\n\t/**\n\t * data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`\n\t */\n\tfilterMethod: Function as PropType<TableColumnCtx<DefaultRow>[\"filterMethod\"]>,\n\t/**\n\t * filter value for selected data, might be useful when table header is rendered with `render-header`\n\t */\n\tfilteredValue: Array as PropType<TableColumnCtx<DefaultRow>[\"filteredValue\"]>,\n\t/**\n\t * an array of data filtering options. For each element in this array, `text` and `value` are required\n\t */\n\tfilters: Array as PropType<TableColumnCtx<DefaultRow>[\"filters\"]>,\n\t/**\n\t * placement for the filter dropdown\n\t */\n\tfilterPlacement: String,\n\t/**\n\t * whether data filtering supports multiple options\n\t */\n\tfilterMultiple: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * className for the filter dropdown\n\t */\n\tfilterClassName: String,\n\t/**\n\t * customize indices for each row, works on columns with `type=index`\n\t */\n\tindex: [Number, Function] as PropType<TableColumnCtx<DefaultRow>[\"index\"]>,\n\t/**\n\t * the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array\n\t */\n\tsortOrders: {\n\t\ttype: Array as PropType<TableColumnCtx<DefaultRow>[\"sortOrders\"]>,\n\t\tdefault: (): (string | null)[] => {\n\t\t\treturn [\"ascending\", \"descending\", null];\n\t\t},\n\t\tvalidator: (val: unknown): boolean => {\n\t\t\treturn Array.isArray(val) && val.every((order: unknown): boolean => order === \"ascending\" || order === \"descending\" || order === null);\n\t\t},\n\t},\n};\n\n/** 传递给底层 Element Plus 虚拟化选择器的扩展 Props。 */\nexport interface Props {\n\tlabel?: string;\n\tvalue?: string;\n\tdisabled?: string;\n\toptions?: string;\n}\n\n/** Element Plus SelectV2 的透传 Props 定义。 */\nexport const SelectV2Props = {\n\t/**\n\t * whether creating new items is allowed. To use this, `filterable` must be true\n\t */\n\tallowCreate: Boolean,\n\t/**\n\t * autocomplete of select input\n\t */\n\tautocomplete: {\n\t\ttype: definePropType<\"none\" | \"both\" | \"list\" | \"inline\">(String),\n\t\tdefault: \"none\",\n\t},\n\t/**\n\t * for non-filterable Select, this prop decides if the option menu pops up when the input is focused\n\t */\n\tautomaticDropdown: Boolean,\n\t/**\n\t * whether select can be cleared\n\t */\n\tclearable: Boolean,\n\t/**\n\t * custom clear icon\n\t */\n\tclearIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: CircleClose,\n\t},\n\t/**\n\t * tooltip theme, built-in theme: `dark` / `light`\n\t */\n\teffect: {\n\t\ttype: definePropType<string>(String),\n\t\tdefault: \"light\",\n\t},\n\t/**\n\t * whether to collapse tags to a text when multiple selecting\n\t */\n\tcollapseTags: Boolean,\n\t/**\n\t * whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n\t */\n\tcollapseTagsTooltip: Boolean,\n\t/** collapse-tags tooltip configuration */\n\ttagTooltip: {\n\t\ttype: definePropType<ElementPlusSelectV2Props[\"tagTooltip\"]>(Object),\n\t\tdefault: (): NonNullable<ElementPlusSelectV2Props[\"tagTooltip\"]> => ({}),\n\t},\n\t/**\n\t * The max tags number to be shown. To use this, `collapse-tags` must be true\n\t */\n\tmaxCollapseTags: {\n\t\ttype: Number,\n\t\tdefault: 1,\n\t},\n\t/**\n\t *\n\t */\n\tdefaultFirstOption: Boolean,\n\t/**\n\t * is disabled\n\t */\n\tdisabled: Boolean,\n\t/**\n\t *\n\t */\n\testimatedOptionHeight: {\n\t\ttype: Number,\n\t\tdefault: undefined,\n\t},\n\t/**\n\t * is filterable\n\t */\n\tfilterable: Boolean,\n\t/**\n\t *\n\t */\n\tfilterMethod: Function as PropType<ElementPlusSelectV2Props[\"filterMethod\"]>,\n\t/**\n\t * The height of the dropdown panel, 34px for each item\n\t */\n\theight: {\n\t\ttype: Number,\n\t\tdefault: 274, // same as select dropdown menu\n\t},\n\t/**\n\t * The height of the dropdown item\n\t */\n\titemHeight: {\n\t\ttype: Number,\n\t\tdefault: 34,\n\t},\n\t/**\n\t *\n\t */\n\tid: String,\n\t/**\n\t * whether Select is loading data from server\n\t */\n\tloading: Boolean,\n\t/**\n\t * displayed text while loading data from server, default is 'Loading'\n\t */\n\tloadingText: String,\n\t/**\n\t * biding value\n\t */\n\tmodelValue: {\n\t\ttype: definePropType<ElSelectorModelValue>([Array, String, Number, Boolean, Object]),\n\t},\n\t/**\n\t * is multiple\n\t */\n\tmultiple: Boolean,\n\t/**\n\t * maximum number of options user can select when multiple is true. No limit when set to 0\n\t */\n\tmultipleLimit: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * the name attribute of select input\n\t */\n\tname: String,\n\t/**\n\t * displayed text when there is no options, you can also use slot empty, the default is 'No Data'\n\t */\n\tnoDataText: String,\n\t/**\n\t * displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'\n\t */\n\tnoMatchText: String,\n\t/**\n\t * function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true\n\t */\n\tremoteMethod: Function as PropType<ElementPlusSelectV2Props[\"remoteMethod\"]>,\n\t/**\n\t * whether reserve the keyword after select filtered option.\n\t */\n\treserveKeyword: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * data of the options, the key of `value` and `label` can be customize by `props`\n\t */\n\toptions: {\n\t\ttype: definePropType<ElementPlusSelectV2Props[\"options\"]>(Array),\n\t},\n\t/**\n\t * placeholder, the default is 'Please select'\n\t */\n\tplaceholder: {\n\t\ttype: String,\n\t},\n\t/**\n\t * whether select dropdown is teleported to the body\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的运行时默认值与校验规则。\n\tteleported: useTooltipContentProps.teleported,\n\t/**\n\t * when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed\n\t */\n\tpersistent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * custom class name for Select's dropdown\n\t */\n\tpopperClass: {\n\t\ttype: String,\n\t\tdefault: \"\",\n\t},\n\t/** custom style for Select's dropdown */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的运行时类型定义。\n\tpopperStyle: useTooltipContentProps.popperStyle,\n\t/**\n\t * [popper.js](https://popper.js.org/docs/v2/) parameters\n\t */\n\tpopperOptions: {\n\t\ttype: definePropType<Partial<Options>>(Object),\n\t\tdefault: (): Partial<Options> => ({}),\n\t},\n\t/**\n\t * whether search data from server\n\t */\n\tremote: Boolean,\n\t/** debounce delay during remote search, in milliseconds */\n\tdebounce: {\n\t\ttype: Number,\n\t\tdefault: 300,\n\t},\n\t/**\n\t * size of component\n\t */\n\tsize: useSizeProp,\n\t/**\n\t * configuration options, see the following table\n\t */\n\tprops: {\n\t\ttype: definePropType<Props>(Object),\n\t\tdefault: (): { label: string; value: string; disabled: string; options: string } => ({\n\t\t\tlabel: \"label\",\n\t\t\tvalue: \"value\",\n\t\t\tdisabled: \"disabled\",\n\t\t\toptions: \"options\",\n\t\t}),\n\t},\n\t/**\n\t * unique identity key name for value, required when value is an object\n\t */\n\tvalueKey: {\n\t\ttype: String,\n\t\tdefault: \"value\",\n\t},\n\t/**\n\t * Controls whether the scrollbar is always displayed\n\t */\n\tscrollbarAlwaysOn: Boolean,\n\t/**\n\t * whether to trigger form validation\n\t */\n\tvalidateEvent: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * offset of the dropdown\n\t */\n\toffset: {\n\t\ttype: Number,\n\t\tdefault: 12,\n\t},\n\t/** whether to show the suffix icon during remote search */\n\tremoteShowSuffix: Boolean,\n\t/**\n\t * Determines whether the arrow is displayed\n\t */\n\tshowArrow: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * position of dropdown\n\t */\n\tplacement: {\n\t\ttype: definePropType<Placement>(String),\n\t\tdefault: \"bottom-start\",\n\t},\n\t/**\n\t * list of possible positions for dropdown\n\t */\n\tfallbackPlacements: {\n\t\ttype: definePropType<Placement[]>(Array),\n\t\tdefault: [\"bottom-start\", \"top-start\", \"right\", \"left\"],\n\t},\n\t/**\n\t * tag type\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的 Tag 运行时校验规则。\n\ttagType: { ...tagProps.type, default: \"info\" },\n\t/**\n\t * tag effect\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的 Tag 运行时校验规则。\n\ttagEffect: { ...tagProps.effect, default: \"light\" },\n\t/**\n\t * tabindex for input\n\t */\n\ttabindex: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/**\n\t * which element the select dropdown appends to\n\t */\n\tappendTo: String,\n\t/** whether the dropdown width follows the input width, or a fixed width */\n\tfitInputWidth: {\n\t\ttype: [Boolean, Number],\n\t\tdefault: true,\n\t\tvalidator: (value: boolean | number): boolean => typeof value === \"boolean\" || typeof value === \"number\",\n\t},\n\t/** select suffix icon */\n\tsuffixIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: ArrowDown,\n\t},\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 复用 Element Plus 2.x 的空值运行时约定。\n\t...useEmptyValuesProps,\n\t...useAriaProps([\"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MAAM,eAAiC,MAAM;EAC7C,gBAAkC,CAAC;CACpC;;;;CAIA,QAAQ;;CAER,UAAU;EACT,MAAM;EACN,SAAS;CACV;;;;CAIA,MAAM;;;;CAIN,OAAO;EACN,MAAM,eAAsB,MAAM;EAClC,gBAAqF;GACpF,OAAO;GACP,OAAO;GACP,UAAU;GACV,SAAS;EACV;CACD;;;;CAIA,UAAU;EACT,MAAM;EACN,SAAS;CACV;;;;CAIA,mBAAmB;;;;CAInB,eAAe;EACd,MAAM;EACN,SAAS;CACV;;;;CAIA,QAAQ;EACP,MAAM;EACN,SAAS;CACV;;CAEA,kBAAkB;;;;CAIlB,WAAW;EACV,MAAM;EACN,SAAS;CACV;;;;CAIA,WAAW;EACV,MAAM,eAA0B,MAAM;EACtC,SAAS;CACV;;;;CAIA,oBAAoB;EACnB,MAAM,eAA4B,KAAK;EACvC,SAAS;GAAC;GAAgB;GAAa;GAAS;EAAM;CACvD;;;;CAKA,SAAS;EAAE,GAAG,SAAS;EAAM,SAAS;CAAO;;;;CAK7C,WAAW;EAAE,GAAG,SAAS;EAAQ,SAAS;CAAQ;;;;CAIlD,UAAU;EACT,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;;;CAIA,UAAU;;CAEV,eAAe;EACd,MAAM,CAAC,SAAS,MAAM;EACtB,SAAS;EACT,YAAY,UAAqC,OAAO,UAAU,aAAa,OAAO,UAAU;CACjG;;CAEA,YAAY;EACX,MAAM,eAAmC;GAAC;GAAQ;GAAQ;EAAQ,CAAC;EACnE,SAAS;CACV;CAEA,GAAG;CACH,GAAG,aAAa,CAAC,WAAW,CAAC;AAC9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** 统一同步返回值与 PromiseLike
|
|
1
|
+
/** 统一同步返回值与 PromiseLike 返回值的内部回调签名 */
|
|
2
2
|
type AsyncCallback<Arguments extends unknown[], Result> = (...arguments_: Arguments) => Result | PromiseLike<Result>;
|
|
3
|
-
/** Promise
|
|
3
|
+
/** Promise 感知的防抖函数 */
|
|
4
4
|
export interface DebouncedFunction<Arguments extends unknown[], Result> {
|
|
5
5
|
/**
|
|
6
6
|
* 调度一次调用;同一等待窗口内的调用共享最后一组参数对应的结果。
|
|
@@ -26,9 +26,9 @@ export interface DebouncedFunction<Arguments extends unknown[], Result> {
|
|
|
26
26
|
*
|
|
27
27
|
* @remarks 同一窗口内的所有调用都会等待最后一组参数对应的执行结果;回调错误会原样
|
|
28
28
|
* 拒绝该批次的全部调用,不会留下永久 pending 的 Promise。
|
|
29
|
-
* @param callback -
|
|
29
|
+
* @param callback - 同步或异步回调
|
|
30
30
|
* @param delayMs - 0 至 2,147,483,647 的有限等待时间,默认 300 毫秒。
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns 具有取消、立即执行和状态方法的防抖函数
|
|
32
32
|
* @throws `RangeError` 当延迟不在平台计时器支持范围内。
|
|
33
33
|
*/
|
|
34
34
|
export declare function debounce<Arguments extends unknown[], Result>(callback: AsyncCallback<Arguments, Result>, delayMs?: number): DebouncedFunction<Arguments, Awaited<Result>>;
|
|
@@ -3,13 +3,13 @@ const maximumTimerDelay = 2147483647;
|
|
|
3
3
|
/**
|
|
4
4
|
* 校验宿主计时器可以稳定表示的延迟。
|
|
5
5
|
*
|
|
6
|
-
* @param milliseconds -
|
|
7
|
-
* @param name -
|
|
6
|
+
* @param milliseconds - 待校验的毫秒数
|
|
7
|
+
* @param name - 用于错误消息的参数名称
|
|
8
8
|
* @returns 原始延迟值,便于调用方在校验后直接使用。
|
|
9
9
|
* @throws `RangeError` 当值非有限、为负数或超过 32 位计时器上限。
|
|
10
10
|
*/
|
|
11
11
|
const assertDelay = (milliseconds, name = "milliseconds") => {
|
|
12
|
-
if (!Number.isFinite(milliseconds) || milliseconds < 0 || milliseconds > maximumTimerDelay) throw new RangeError(`\`${name}\`
|
|
12
|
+
if (!Number.isFinite(milliseconds) || milliseconds < 0 || milliseconds > maximumTimerDelay) throw new RangeError(`\`${name}\` must be a finite number between 0 and ${maximumTimerDelay}.`);
|
|
13
13
|
return milliseconds;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
@@ -17,9 +17,9 @@ const assertDelay = (milliseconds, name = "milliseconds") => {
|
|
|
17
17
|
*
|
|
18
18
|
* @remarks 同一窗口内的所有调用都会等待最后一组参数对应的执行结果;回调错误会原样
|
|
19
19
|
* 拒绝该批次的全部调用,不会留下永久 pending 的 Promise。
|
|
20
|
-
* @param callback -
|
|
20
|
+
* @param callback - 同步或异步回调
|
|
21
21
|
* @param delayMs - 0 至 2,147,483,647 的有限等待时间,默认 300 毫秒。
|
|
22
|
-
* @returns
|
|
22
|
+
* @returns 具有取消、立即执行和状态方法的防抖函数
|
|
23
23
|
* @throws `RangeError` 当延迟不在平台计时器支持范围内。
|
|
24
24
|
*/
|
|
25
25
|
function debounce(callback, delayMs = 300) {
|
|
@@ -30,12 +30,12 @@ function debounce(callback, delayMs = 300) {
|
|
|
30
30
|
/**
|
|
31
31
|
* 执行并结算当前防抖批次。
|
|
32
32
|
*
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns 最后一组参数对应的回调结果
|
|
34
34
|
* @throws 没有待处理批次时抛出 `Error`;回调错误会原样传播给批次中的全部调用方。
|
|
35
35
|
*/
|
|
36
36
|
const execute = async () => {
|
|
37
37
|
const arguments_ = latestArguments;
|
|
38
|
-
if (arguments_ === void 0) throw new Error("
|
|
38
|
+
if (arguments_ === void 0) throw new Error("There is no pending debounced invocation.");
|
|
39
39
|
latestArguments = void 0;
|
|
40
40
|
timer = void 0;
|
|
41
41
|
const currentWaiters = waiters;
|
|
@@ -57,7 +57,7 @@ function debounce(callback, delayMs = 300) {
|
|
|
57
57
|
* 更新批次参数并返回当前调用方专属的等待 Promise。
|
|
58
58
|
*
|
|
59
59
|
* @param arguments_ - 本次调用参数;同批次中只有最后一组参数会执行。
|
|
60
|
-
* @returns 与当前批次共享结果、但可独立结算的 Promise
|
|
60
|
+
* @returns 与当前批次共享结果、但可独立结算的 Promise
|
|
61
61
|
*/
|
|
62
62
|
const debounced = (...arguments_) => {
|
|
63
63
|
latestArguments = arguments_;
|
|
@@ -76,7 +76,7 @@ function debounce(callback, delayMs = 300) {
|
|
|
76
76
|
if (timer !== void 0) clearTimeout(timer);
|
|
77
77
|
timer = void 0;
|
|
78
78
|
latestArguments = void 0;
|
|
79
|
-
const error = reason ?? /* @__PURE__ */ new Error("
|
|
79
|
+
const error = reason ?? /* @__PURE__ */ new Error("The debounced invocation was cancelled.");
|
|
80
80
|
waiters.forEach((waiter) => {
|
|
81
81
|
waiter.reject(error);
|
|
82
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/async/index.ts"],"sourcesContent":["/** 统一同步返回值与 PromiseLike
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/async/index.ts"],"sourcesContent":["/** 统一同步返回值与 PromiseLike 返回值的内部回调签名 */\ntype AsyncCallback<Arguments extends unknown[], Result> = (...arguments_: Arguments) => Result | PromiseLike<Result>;\n\n/** 记录同一防抖批次中每个调用方独立的 Promise 结算函数 */\ninterface PromiseWaiter<Result> {\n\t/**\n\t * 使用批次失败原因拒绝当前调用方。\n\t * @param reason - `cancel` 提供的原因或共享回调抛出的原始错误。\n\t */\n\treject: (reason?: unknown) => void;\n\t/**\n\t * 使用共享回调结果完成当前调用方,并采用传入 PromiseLike 的最终状态。\n\t * @param value - 当前防抖批次唯一一次回调执行产生的共享结果。\n\t */\n\tresolve: (value: Result | PromiseLike<Result>) => void;\n}\n\n// 浏览器和 Node.js 的计时器普遍以有符号 32 位整数保存延迟;更大的值可能被\n// 静默截断为约 1 ms,因此公共 API 在进入平台计时器前统一拒绝它。\nconst maximumTimerDelay = 2_147_483_647;\n\n/** Promise 感知的防抖函数 */\nexport interface DebouncedFunction<Arguments extends unknown[], Result> {\n\t/**\n\t * 调度一次调用;同一等待窗口内的调用共享最后一组参数对应的结果。\n\t * @param arguments_ - 传给原始回调的参数;后续调用会覆盖尚未执行批次保存的参数。\n\t * @returns 当前批次的独立 Promise,最终与共享回调结果保持相同状态。\n\t */\n\t(...arguments_: Arguments): Promise<Result>;\n\t/**\n\t * 取消尚未执行的批次,并拒绝该批次的所有 Promise。\n\t * @param reason - 可选拒绝原因;省略时使用内部取消错误。\n\t */\n\tcancel: (reason?: unknown) => void;\n\t/**\n\t * 立即执行待处理批次,不创建第二次回调执行。\n\t * @returns 待处理批次的共享执行 Promise;没有批次时返回 `undefined`。\n\t */\n\tflush: () => Promise<Result> | undefined;\n\t/** @returns 当前存在尚未开始的批次时返回 `true`;正在执行但没有等待批次时返回 `false`。 */\n\tpending: () => boolean;\n}\n\n/**\n * 校验宿主计时器可以稳定表示的延迟。\n *\n * @param milliseconds - 待校验的毫秒数\n * @param name - 用于错误消息的参数名称\n * @returns 原始延迟值,便于调用方在校验后直接使用。\n * @throws `RangeError` 当值非有限、为负数或超过 32 位计时器上限。\n */\nconst assertDelay = (milliseconds: number, name = \"milliseconds\"): number => {\n\tif (!Number.isFinite(milliseconds) || milliseconds < 0 || milliseconds > maximumTimerDelay) {\n\t\tthrow new RangeError(`\\`${name}\\` must be a finite number between 0 and ${maximumTimerDelay}.`);\n\t}\n\treturn milliseconds;\n};\n\n/**\n * 创建 Promise 感知的防抖函数。\n *\n * @remarks 同一窗口内的所有调用都会等待最后一组参数对应的执行结果;回调错误会原样\n * 拒绝该批次的全部调用,不会留下永久 pending 的 Promise。\n * @param callback - 同步或异步回调\n * @param delayMs - 0 至 2,147,483,647 的有限等待时间,默认 300 毫秒。\n * @returns 具有取消、立即执行和状态方法的防抖函数\n * @throws `RangeError` 当延迟不在平台计时器支持范围内。\n */\nexport function debounce<Arguments extends unknown[], Result>(\n\tcallback: AsyncCallback<Arguments, Result>,\n\tdelayMs = 300\n): DebouncedFunction<Arguments, Awaited<Result>> {\n\tconst delay = assertDelay(delayMs, \"delayMs\");\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tlet latestArguments: Arguments | undefined;\n\tlet waiters: PromiseWaiter<Awaited<Result>>[] = [];\n\n\t/**\n\t * 执行并结算当前防抖批次。\n\t *\n\t * @returns 最后一组参数对应的回调结果\n\t * @throws 没有待处理批次时抛出 `Error`;回调错误会原样传播给批次中的全部调用方。\n\t */\n\tconst execute = async (): Promise<Awaited<Result>> => {\n\t\tconst arguments_ = latestArguments;\n\t\tif (arguments_ === undefined) {\n\t\t\tthrow new Error(\"There is no pending debounced invocation.\");\n\t\t}\n\t\tlatestArguments = undefined;\n\t\ttimer = undefined;\n\t\tconst currentWaiters = waiters;\n\t\twaiters = [];\n\t\ttry {\n\t\t\tconst result = await callback(...arguments_);\n\t\t\tcurrentWaiters.forEach((waiter) => {\n\t\t\t\twaiter.resolve(result);\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tcurrentWaiters.forEach((waiter) => {\n\t\t\t\twaiter.reject(error);\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t};\n\n\t/**\n\t * 更新批次参数并返回当前调用方专属的等待 Promise。\n\t *\n\t * @param arguments_ - 本次调用参数;同批次中只有最后一组参数会执行。\n\t * @returns 与当前批次共享结果、但可独立结算的 Promise\n\t */\n\tconst debounced = (...arguments_: Arguments) => {\n\t\tlatestArguments = arguments_;\n\t\tif (timer !== undefined) clearTimeout(timer);\n\t\ttimer = setTimeout(() => {\n\t\t\texecute().catch(() => undefined);\n\t\t}, delay);\n\t\treturn new Promise<Awaited<Result>>((resolve, reject) => {\n\t\t\twaiters.push({ reject, resolve });\n\t\t});\n\t};\n\n\tdebounced.cancel = (reason?: unknown) => {\n\t\tif (timer !== undefined) clearTimeout(timer);\n\t\ttimer = undefined;\n\t\tlatestArguments = undefined;\n\t\tconst error = reason ?? new Error(\"The debounced invocation was cancelled.\");\n\t\twaiters.forEach((waiter) => {\n\t\t\twaiter.reject(error);\n\t\t});\n\t\twaiters = [];\n\t};\n\tdebounced.flush = () => {\n\t\tif (timer === undefined) return und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KAAA;EAClB,MAAM,QAAQ,0BAAU,IAAI,MAAM,yCAAyC;EAC3E,QAAQ,SAAS,WAAW;GAC3B,OAAO,OAAO,KAAK;EACpB,CAAC;EACD,UAAU,CAAC;CACZ;CACA,UAAU,cAAc;EACvB,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;EAChC,aAAa,KAAK;EAClB,OAAO,QAAQ;CAChB;CACA,UAAU,gBAAgB,UAAU,KAAA;CACpC,OAAO;AACR"}
|
|
@@ -4,20 +4,20 @@ export type DateInput = Date | number | string;
|
|
|
4
4
|
* 转换并克隆有效日期。
|
|
5
5
|
*
|
|
6
6
|
* @remarks 数字不进行秒/毫秒猜测;字符串遵循运行时 `Date` 解析规则,跨平台代码应传带显式时区的完整 ISO 8601。
|
|
7
|
-
* @param value - Date、Unix
|
|
8
|
-
* @returns 与输入不共享可变状态的新 Date
|
|
7
|
+
* @param value - Date、Unix 毫秒时间戳或运行时可解析字符串
|
|
8
|
+
* @returns 与输入不共享可变状态的新 Date
|
|
9
9
|
* @throws 输入无效时抛出 `TypeError`。
|
|
10
10
|
*/
|
|
11
11
|
export declare function toDate(value: DateInput): Date;
|
|
12
12
|
/**
|
|
13
13
|
* 返回输入日期所在本地时区日期的 `00:00:00.000`,不修改输入。
|
|
14
14
|
*
|
|
15
|
-
* @param value -
|
|
16
|
-
* @returns
|
|
15
|
+
* @param value - 有效日期输入
|
|
16
|
+
* @returns 新建的本地日开始时间
|
|
17
17
|
* @throws 输入无效时抛出 `TypeError`。
|
|
18
18
|
*/
|
|
19
19
|
export declare function startOfDay(value: DateInput): Date;
|
|
20
|
-
/**
|
|
20
|
+
/** 日期选择器单日期快捷项 */
|
|
21
21
|
export interface DateShortcut {
|
|
22
22
|
/** 面向中文日期选择器的显示文本;调用方可直接用于菜单标签。 */
|
|
23
23
|
text: string;
|
|
@@ -27,7 +27,7 @@ export interface DateShortcut {
|
|
|
27
27
|
*/
|
|
28
28
|
value: () => Date;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
30
|
+
/** 日期选择器范围快捷项 */
|
|
31
31
|
export interface DateRangeShortcut {
|
|
32
32
|
/** 面向中文日期范围选择器的显示文本;调用方可直接用于菜单标签。 */
|
|
33
33
|
text: string;
|
|
@@ -41,7 +41,7 @@ export interface DateRangeShortcut {
|
|
|
41
41
|
* 把日期转换为固定中文相对时间文本。
|
|
42
42
|
*
|
|
43
43
|
* @remarks 10 位以内数字按 Unix 秒处理,其余数字按毫秒处理;月份与年份按本地日历月差计算。
|
|
44
|
-
* @param value - Date
|
|
44
|
+
* @param value - Date、时间戳、可解析字符串或空值
|
|
45
45
|
* @returns 例如“3分钟前”“半年后”;非法或空输入返回空字符串。
|
|
46
46
|
*/
|
|
47
47
|
export declare function formatChineseRelativeTime(value: Date | number | string | null | undefined): string;
|
|
@@ -69,6 +69,6 @@ export declare function createDateShortcuts(towardFuture?: boolean): DateShortcu
|
|
|
69
69
|
/**
|
|
70
70
|
* 返回今天的本地零点。
|
|
71
71
|
*
|
|
72
|
-
* @returns 新建的 `00:00:00.000` Date
|
|
72
|
+
* @returns 新建的 `00:00:00.000` Date
|
|
73
73
|
*/
|
|
74
74
|
export declare function getStartOfToday(): Date;
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* 转换并克隆有效日期。
|
|
4
4
|
*
|
|
5
5
|
* @remarks 数字不进行秒/毫秒猜测;字符串遵循运行时 `Date` 解析规则,跨平台代码应传带显式时区的完整 ISO 8601。
|
|
6
|
-
* @param value - Date、Unix
|
|
7
|
-
* @returns 与输入不共享可变状态的新 Date
|
|
6
|
+
* @param value - Date、Unix 毫秒时间戳或运行时可解析字符串
|
|
7
|
+
* @returns 与输入不共享可变状态的新 Date
|
|
8
8
|
* @throws 输入无效时抛出 `TypeError`。
|
|
9
9
|
*/
|
|
10
10
|
function toDate(value) {
|
|
11
11
|
const date = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
12
|
-
if (!Number.isFinite(date.getTime())) throw new TypeError("
|
|
12
|
+
if (!Number.isFinite(date.getTime())) throw new TypeError("The value is not a valid date.");
|
|
13
13
|
return date;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* 返回输入日期所在本地时区日期的 `00:00:00.000`,不修改输入。
|
|
17
17
|
*
|
|
18
|
-
* @param value -
|
|
19
|
-
* @returns
|
|
18
|
+
* @param value - 有效日期输入
|
|
19
|
+
* @returns 新建的本地日开始时间
|
|
20
20
|
* @throws 输入无效时抛出 `TypeError`。
|
|
21
21
|
*/
|
|
22
22
|
function startOfDay(value) {
|
|
@@ -28,9 +28,9 @@ function startOfDay(value) {
|
|
|
28
28
|
* 移动本地日历字段。
|
|
29
29
|
*
|
|
30
30
|
* @remarks 直接使用 Date Setter,以保留历史快捷项在月底和闰年的溢出语义。
|
|
31
|
-
* @param date -
|
|
32
|
-
* @param amount -
|
|
33
|
-
* @param unit -
|
|
31
|
+
* @param date - 会被原地修改的日期
|
|
32
|
+
* @param amount - 对目标字段增加的整数
|
|
33
|
+
* @param unit - 要移动的日历字段
|
|
34
34
|
*/
|
|
35
35
|
const shiftCalendarFieldInPlace = (date, amount, unit) => {
|
|
36
36
|
switch (unit) {
|
|
@@ -46,9 +46,9 @@ const shiftCalendarFieldInPlace = (date, amount, unit) => {
|
|
|
46
46
|
/**
|
|
47
47
|
* 创建动态单日期快捷项。
|
|
48
48
|
*
|
|
49
|
-
* @param text -
|
|
50
|
-
* @param amount -
|
|
51
|
-
* @param unit -
|
|
49
|
+
* @param text - 日期选择器显示文本
|
|
50
|
+
* @param amount - 相对当前时间的移动量
|
|
51
|
+
* @param unit - 移动使用的日历单位
|
|
52
52
|
* @returns 每次执行 `value` 都重新读取当前时间的快捷项。
|
|
53
53
|
*/
|
|
54
54
|
const createDateShortcut = (text, amount, unit) => ({
|
|
@@ -63,9 +63,9 @@ const createDateShortcut = (text, amount, unit) => ({
|
|
|
63
63
|
/**
|
|
64
64
|
* 创建动态日期范围快捷项。
|
|
65
65
|
*
|
|
66
|
-
* @param text -
|
|
67
|
-
* @param amount -
|
|
68
|
-
* @param unit -
|
|
66
|
+
* @param text - 日期选择器显示文本
|
|
67
|
+
* @param amount - 范围边界相对当前时间的移动量
|
|
68
|
+
* @param unit - 移动使用的日历单位
|
|
69
69
|
* @param towardFuture - `true` 移动结束边界,`false` 移动开始边界。
|
|
70
70
|
* @returns 每次求值都覆盖完整本地日边界的范围快捷项。
|
|
71
71
|
*/
|
|
@@ -84,7 +84,7 @@ const createRangeShortcut = (text, amount, unit, towardFuture) => ({
|
|
|
84
84
|
* 把日期转换为固定中文相对时间文本。
|
|
85
85
|
*
|
|
86
86
|
* @remarks 10 位以内数字按 Unix 秒处理,其余数字按毫秒处理;月份与年份按本地日历月差计算。
|
|
87
|
-
* @param value - Date
|
|
87
|
+
* @param value - Date、时间戳、可解析字符串或空值
|
|
88
88
|
* @returns 例如“3分钟前”“半年后”;非法或空输入返回空字符串。
|
|
89
89
|
*/
|
|
90
90
|
function formatChineseRelativeTime(value) {
|
|
@@ -179,7 +179,7 @@ function createDateShortcuts(towardFuture = false) {
|
|
|
179
179
|
/**
|
|
180
180
|
* 返回今天的本地零点。
|
|
181
181
|
*
|
|
182
|
-
* @returns 新建的 `00:00:00.000` Date
|
|
182
|
+
* @returns 新建的 `00:00:00.000` Date
|
|
183
183
|
*/
|
|
184
184
|
function getStartOfToday() {
|
|
185
185
|
return startOfDay(/* @__PURE__ */ new Date());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/date/index.ts"],"sourcesContent":["/** 可转换为日期的输入;数字始终按 Unix 毫秒时间戳处理。 */\nexport type DateInput = Date | number | string;\n\n/**\n * 转换并克隆有效日期。\n *\n * @remarks 数字不进行秒/毫秒猜测;字符串遵循运行时 `Date` 解析规则,跨平台代码应传带显式时区的完整 ISO 8601。\n * @param value - Date、Unix 毫秒时间戳或运行时可解析字符串。\n * @returns 与输入不共享可变状态的新 Date。\n * @throws 输入无效时抛出 `TypeError`。\n */\nexport function toDate(value: DateInput): Date {\n\tconst date = value instanceof Date ? new Date(value.getTime()) : new Date(value);\n\tif (!Number.isFinite(date.getTime())) {\n\t\tthrow new TypeError(\"该值不是有效日期。\");\n\t}\n\treturn date;\n}\n\n/**\n * 返回输入日期所在本地时区日期的 `00:00:00.000`,不修改输入。\n *\n * @param value - 有效日期输入。\n * @returns 新建的本地日开始时间。\n * @throws 输入无效时抛出 `TypeError`。\n */\nexport function startOfDay(value: DateInput): Date {\n\tconst date = toDate(value);\n\tdate.setHours(0, 0, 0, 0);\n\treturn toDate(date);\n}\n\n/** 日期选择器单日期快捷项。 */\nexport interface DateShortcut {\n\t/** 面向中文日期选择器的显示文本;调用方可直接用于菜单标签。 */\n\ttext: string;\n\t/**\n\t * 计算快捷项对应日期。\n\t * @returns 每次调用时基于当前本地时间创建的新 `Date`,调用方可安全修改。\n\t */\n\tvalue: () => Date;\n}\n\n/** 日期选择器范围快捷项。 */\nexport interface DateRangeShortcut {\n\t/** 面向中文日期范围选择器的显示文本;调用方可直接用于菜单标签。 */\n\ttext: string;\n\t/**\n\t * 计算快捷项对应的本地日期范围。\n\t * @returns 每次调用时创建的新元组;起点为 `00:00:00.000`,终点为 `23:59:59.999`。\n\t */\n\tvalue: () => [start: Date, end: Date];\n}\n\n/** 历史快捷项允许移动的本地日历单位。 */\ntype CalendarUnit = \"day\" | \"month\" | \"year\";\n\n/**\n * 移动本地日历字段。\n *\n * @remarks 直接使用 Date Setter,以保留历史快捷项在月底和闰年的溢出语义。\n * @param date - 会被原地修改的日期。\n * @param amount - 对目标字段增加的整数。\n * @param unit - 要移动的日历字段。\n */\nconst shiftCalendarFieldInPlace = (date: Date, amount: number, unit: CalendarUnit): void => {\n\tswitch (unit) {\n\t\tcase \"day\":\n\t\t\tdate.setDate(date.getDate() + amount);\n\t\t\tbreak;\n\t\tcase \"month\":\n\t\t\tdate.setMonth(date.getMonth() + amount);\n\t\t\tbreak;\n\t\tcase \"year\":\n\t\t\tdate.setFullYear(date.getFullYear() + amount);\n\t\t\tbreak;\n\t}\n};\n\n/**\n * 创建动态单日期快捷项。\n *\n * @param text - 日期选择器显示文本。\n * @param amount - 相对当前时间的移动量。\n * @param unit - 移动使用的日历单位。\n * @returns 每次执行 `value` 都重新读取当前时间的快捷项。\n */\nconst createDateShortcut = (text: string, amount: number, unit: CalendarUnit): DateShortcut => ({\n\ttext,\n\tvalue: () => {\n\t\tconst date = new Date();\n\t\tshiftCalendarFieldInPlace(date, amount, unit);\n\t\tdate.setHours(0, 0, 0, 0);\n\t\treturn date;\n\t},\n});\n\n/**\n * 创建动态日期范围快捷项。\n *\n * @param text - 日期选择器显示文本。\n * @param amount - 范围边界相对当前时间的移动量。\n * @param unit - 移动使用的日历单位。\n * @param towardFuture - `true` 移动结束边界,`false` 移动开始边界。\n * @returns 每次求值都覆盖完整本地日边界的范围快捷项。\n */\nconst createRangeShortcut = (text: string, amount: number, unit: CalendarUnit, towardFuture: boolean): DateRangeShortcut => ({\n\ttext,\n\tvalue: (): [Date, Date] => {\n\t\tconst start = new Date();\n\t\tconst end = new Date();\n\t\tshiftCalendarFieldInPlace(towardFuture ? end : start, towardFuture ? amount : -amount, unit);\n\t\tstart.setHours(0, 0, 0, 0);\n\t\tend.setHours(23, 59, 59, 999);\n\t\treturn [start, end];\n\t},\n});\n\n/**\n * 把日期转换为固定中文相对时间文本。\n *\n * @remarks 10 位以内数字按 Unix 秒处理,其余数字按毫秒处理;月份与年份按本地日历月差计算。\n * @param value - Date、时间戳、可解析字符串或空值。\n * @returns 例如“3分钟前”“半年后”;非法或空输入返回空字符串。\n */\nexport function formatChineseRelativeTime(value: Date | number | string | null | undefined): string {\n\tif (value === null || value === undefined) return \"\";\n\tlet timestamp: number;\n\tif (typeof value === \"string\") timestamp = new Date(value).getTime();\n\telse if (typeof value === \"number\") timestamp = value.toString().length <= 10 ? value * 1000 : value;\n\telse timestamp = value.getTime();\n\tif (!Number.isFinite(timestamp)) return \"\";\n\n\tconst minute = 60_000;\n\tconst hour = minute * 60;\n\tconst day = hour * 24;\n\tconst currentTimestamp = Date.now();\n\tconst difference = currentTimestamp - timestamp;\n\tconst minuteDifference = Math.abs(difference) / minute;\n\tconst hourDifference = Math.abs(difference) / hour;\n\tconst dayDifference = Math.abs(difference) / day;\n\tconst currentDate = new Date(currentTimestamp);\n\tconst targetDate = new Date(timestamp);\n\tconst monthDifference = (currentDate.getFullYear() - targetDate.getFullYear()) * 12 + currentDate.getMonth() - targetDate.getMonth();\n\tconst suffix = difference < 0 ? \"后\" : \"前\";\n\tif (Math.abs(monthDifference) >= 12) return `${Math.floor(Math.abs(monthDifference) / 12)}年${suffix}`;\n\tif (Math.abs(monthDifference) >= 6) return `半年${suffix}`;\n\tif (Math.abs(monthDifference) >= 1) return `${Math.abs(monthDifference)}月${suffix}`;\n\tif (dayDifference >= 15) return `半月${suffix}`;\n\tif (dayDifference >= 7) return `${Math.floor(dayDifference / 7)}周${suffix}`;\n\tif (dayDifference >= 1) return `${Math.floor(dayDifference)}天${suffix}`;\n\tif (hourDifference >= 1) return `${Math.floor(hourDifference)}小时${suffix}`;\n\tif (minuteDifference >= 1) return `${Math.floor(minuteDifference)}分钟${suffix}`;\n\treturn \"刚刚\";\n}\n\n/**\n * 创建从今天到前后一个月日期的完整本地日范围。\n *\n * @param towardFuture - `true` 返回今天至一个月后,默认返回一个月前至今天。\n * @returns 每次调用新建的本地日首尾边界。\n */\nexport function createOneMonthRangeFromToday(towardFuture = false): [start: Date, end: Date] {\n\tconst start = new Date();\n\tconst end = new Date();\n\tshiftCalendarFieldInPlace(towardFuture ? end : start, towardFuture ? 1 : -1, \"month\");\n\tstart.setHours(0, 0, 0, 0);\n\tend.setHours(23, 59, 59, 999);\n\treturn [start, end];\n}\n\n/**\n * 创建面向过去或未来的常用完整日期范围快捷项。\n *\n * @param towardFuture - `true` 创建未来范围,默认创建历史范围。\n * @returns 每次求值都会重新读取当前时间的范围快捷项。\n */\nexport function createDateRangeShortcuts(towardFuture = false): DateRangeShortcut[] {\n\treturn towardFuture\n\t\t? [\n\t\t\t\tcreateRangeShortcut(\"后1天\", 1, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后3天\", 3, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后1周\", 7, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后1月\", 1, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后3月\", 3, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后6月\", 6, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后1年\", 1, \"year\", true),\n\t\t\t]\n\t\t: [\n\t\t\t\tcreateRangeShortcut(\"近1天\", 1, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近3天\", 3, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近1周\", 7, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近1月\", 1, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近3月\", 3, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近6月\", 6, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近1年\", 1, \"year\", false),\n\t\t\t];\n}\n\n/**\n * 创建面向过去或未来的常用单日期快捷项。\n *\n * @param towardFuture - `true` 创建未来日期,默认创建历史日期。\n * @returns 每次求值都会重新读取当前时间的单日期快捷项。\n */\nexport function createDateShortcuts(towardFuture = false): DateShortcut[] {\n\treturn towardFuture\n\t\t? [\n\t\t\t\tcreateDateShortcut(\"今天\", 0, \"day\"),\n\t\t\t\tcreateDateShortcut(\"明天\", 1, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一周后\", 7, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一月后\", 1, \"month\"),\n\t\t\t\tcreateDateShortcut(\"一年后\", 1, \"year\"),\n\t\t\t]\n\t\t: [\n\t\t\t\tcreateDateShortcut(\"今天\", 0, \"day\"),\n\t\t\t\tcreateDateShortcut(\"昨天\", -1, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一周前\", -7, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一月前\", -1, \"month\"),\n\t\t\t\tcreateDateShortcut(\"一年前\", -1, \"year\"),\n\t\t\t];\n}\n\n/**\n * 返回今天的本地零点。\n *\n * @returns 新建的 `00:00:00.000` Date。\n */\nexport function getStartOfToday(): Date {\n\treturn startOfDay(new Date());\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,OAAO,OAAwB;CAC9C,MAAM,OAAO,iBAAiB,OAAO,IAAI,KAAK,MAAM,QAAQ,CAAC,IAAI,IAAI,KAAK,KAAK;CAC/E,IAAI,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,GAClC,MAAM,IAAI,UAAU,WAAW;CAEhC,OAAO;AACR;;;;;;;;AASA,SAAgB,WAAW,OAAwB;CAClD,MAAM,OAAO,OAAO,KAAK;CACzB,KAAK,SAAS,GAAG,GAAG,GAAG,CAAC;CACxB,OAAO,OAAO,IAAI;AACnB;;;;;;;;;AAmCA,MAAM,6BAA6B,MAAY,QAAgB,SAA6B;CAC3F,QAAQ,MAAR;EACC,KAAK;GACJ,KAAK,QAAQ,KAAK,QAAQ,IAAI,MAAM;GACpC;EACD,KAAK;GACJ,KAAK,SAAS,KAAK,SAAS,IAAI,MAAM;GACtC;EACD,KAAK,QACJ,KAAK,YAAY,KAAK,YAAY,IAAI,MAAM;CAE9C;AACD;;;;;;;;;AAUA,MAAM,sBAAsB,MAAc,QAAgB,UAAsC;CAC/F;CACA,aAAa;EACZ,MAAM,uBAAO,IAAI,KAAK;EACtB,0BAA0B,MAAM,QAAQ,IAAI;EAC5C,KAAK,SAAS,GAAG,GAAG,GAAG,CAAC;EACxB,OAAO;CACR;AACD;;;;;;;;;;AAWA,MAAM,uBAAuB,MAAc,QAAgB,MAAoB,kBAA8C;CAC5H;CACA,aAA2B;EAC1B,MAAM,wBAAQ,IAAI,KAAK;EACvB,MAAM,sBAAM,IAAI,KAAK;EACrB,0BAA0B,eAAe,MAAM,OAAO,eAAe,S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;;AAQA,SAAgB,oBAAoB,eAAe,OAAuB;CACzE,OAAO,eACJ;EACA,mBAAmB,MAAM,GAAG,KAAK;EACjC,mBAAmB,MAAM,GAAG,KAAK;EACjC,mBAAmB,OAAO,GAAG,KAAK;EAClC,mBAAmB,OAAO,GAAG,OAAO;EACpC,mBAAmB,OAAO,GAAG,MAAM;CACpC,IACC;EACA,mBAAmB,MAAM,GAAG,KAAK;EACjC,mBAAmB,MAAM,IAAI,KAAK;EAClC,mBAAmB,OAAO,IAAI,KAAK;EACnC,mBAAmB,OAAO,IAAI,OAAO;EACrC,mBAAmB,OAAO,IAAI,MAAM;CACrC;AACH;;;;;;AAOA,SAAgB,kBAAwB;CACvC,OAAO,2BAAW,IAAI,KAAK,CAAC;AAC7B"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/date/index.ts"],"sourcesContent":["/** 可转换为日期的输入;数字始终按 Unix 毫秒时间戳处理。 */\nexport type DateInput = Date | number | string;\n\n/**\n * 转换并克隆有效日期。\n *\n * @remarks 数字不进行秒/毫秒猜测;字符串遵循运行时 `Date` 解析规则,跨平台代码应传带显式时区的完整 ISO 8601。\n * @param value - Date、Unix 毫秒时间戳或运行时可解析字符串\n * @returns 与输入不共享可变状态的新 Date\n * @throws 输入无效时抛出 `TypeError`。\n */\nexport function toDate(value: DateInput): Date {\n\tconst date = value instanceof Date ? new Date(value.getTime()) : new Date(value);\n\tif (!Number.isFinite(date.getTime())) {\n\t\tthrow new TypeError(\"The value is not a valid date.\");\n\t}\n\treturn date;\n}\n\n/**\n * 返回输入日期所在本地时区日期的 `00:00:00.000`,不修改输入。\n *\n * @param value - 有效日期输入\n * @returns 新建的本地日开始时间\n * @throws 输入无效时抛出 `TypeError`。\n */\nexport function startOfDay(value: DateInput): Date {\n\tconst date = toDate(value);\n\tdate.setHours(0, 0, 0, 0);\n\treturn toDate(date);\n}\n\n/** 日期选择器单日期快捷项 */\nexport interface DateShortcut {\n\t/** 面向中文日期选择器的显示文本;调用方可直接用于菜单标签。 */\n\ttext: string;\n\t/**\n\t * 计算快捷项对应日期。\n\t * @returns 每次调用时基于当前本地时间创建的新 `Date`,调用方可安全修改。\n\t */\n\tvalue: () => Date;\n}\n\n/** 日期选择器范围快捷项 */\nexport interface DateRangeShortcut {\n\t/** 面向中文日期范围选择器的显示文本;调用方可直接用于菜单标签。 */\n\ttext: string;\n\t/**\n\t * 计算快捷项对应的本地日期范围。\n\t * @returns 每次调用时创建的新元组;起点为 `00:00:00.000`,终点为 `23:59:59.999`。\n\t */\n\tvalue: () => [start: Date, end: Date];\n}\n\n/** 历史快捷项允许移动的本地日历单位 */\ntype CalendarUnit = \"day\" | \"month\" | \"year\";\n\n/**\n * 移动本地日历字段。\n *\n * @remarks 直接使用 Date Setter,以保留历史快捷项在月底和闰年的溢出语义。\n * @param date - 会被原地修改的日期\n * @param amount - 对目标字段增加的整数\n * @param unit - 要移动的日历字段\n */\nconst shiftCalendarFieldInPlace = (date: Date, amount: number, unit: CalendarUnit): void => {\n\tswitch (unit) {\n\t\tcase \"day\":\n\t\t\tdate.setDate(date.getDate() + amount);\n\t\t\tbreak;\n\t\tcase \"month\":\n\t\t\tdate.setMonth(date.getMonth() + amount);\n\t\t\tbreak;\n\t\tcase \"year\":\n\t\t\tdate.setFullYear(date.getFullYear() + amount);\n\t\t\tbreak;\n\t}\n};\n\n/**\n * 创建动态单日期快捷项。\n *\n * @param text - 日期选择器显示文本\n * @param amount - 相对当前时间的移动量\n * @param unit - 移动使用的日历单位\n * @returns 每次执行 `value` 都重新读取当前时间的快捷项。\n */\nconst createDateShortcut = (text: string, amount: number, unit: CalendarUnit): DateShortcut => ({\n\ttext,\n\tvalue: () => {\n\t\tconst date = new Date();\n\t\tshiftCalendarFieldInPlace(date, amount, unit);\n\t\tdate.setHours(0, 0, 0, 0);\n\t\treturn date;\n\t},\n});\n\n/**\n * 创建动态日期范围快捷项。\n *\n * @param text - 日期选择器显示文本\n * @param amount - 范围边界相对当前时间的移动量\n * @param unit - 移动使用的日历单位\n * @param towardFuture - `true` 移动结束边界,`false` 移动开始边界。\n * @returns 每次求值都覆盖完整本地日边界的范围快捷项。\n */\nconst createRangeShortcut = (text: string, amount: number, unit: CalendarUnit, towardFuture: boolean): DateRangeShortcut => ({\n\ttext,\n\tvalue: (): [Date, Date] => {\n\t\tconst start = new Date();\n\t\tconst end = new Date();\n\t\tshiftCalendarFieldInPlace(towardFuture ? end : start, towardFuture ? amount : -amount, unit);\n\t\tstart.setHours(0, 0, 0, 0);\n\t\tend.setHours(23, 59, 59, 999);\n\t\treturn [start, end];\n\t},\n});\n\n/**\n * 把日期转换为固定中文相对时间文本。\n *\n * @remarks 10 位以内数字按 Unix 秒处理,其余数字按毫秒处理;月份与年份按本地日历月差计算。\n * @param value - Date、时间戳、可解析字符串或空值\n * @returns 例如“3分钟前”“半年后”;非法或空输入返回空字符串。\n */\nexport function formatChineseRelativeTime(value: Date | number | string | null | undefined): string {\n\tif (value === null || value === undefined) return \"\";\n\tlet timestamp: number;\n\tif (typeof value === \"string\") timestamp = new Date(value).getTime();\n\telse if (typeof value === \"number\") timestamp = value.toString().length <= 10 ? value * 1000 : value;\n\telse timestamp = value.getTime();\n\tif (!Number.isFinite(timestamp)) return \"\";\n\n\tconst minute = 60_000;\n\tconst hour = minute * 60;\n\tconst day = hour * 24;\n\tconst currentTimestamp = Date.now();\n\tconst difference = currentTimestamp - timestamp;\n\tconst minuteDifference = Math.abs(difference) / minute;\n\tconst hourDifference = Math.abs(difference) / hour;\n\tconst dayDifference = Math.abs(difference) / day;\n\tconst currentDate = new Date(currentTimestamp);\n\tconst targetDate = new Date(timestamp);\n\tconst monthDifference = (currentDate.getFullYear() - targetDate.getFullYear()) * 12 + currentDate.getMonth() - targetDate.getMonth();\n\tconst suffix = difference < 0 ? \"后\" : \"前\";\n\tif (Math.abs(monthDifference) >= 12) return `${Math.floor(Math.abs(monthDifference) / 12)}年${suffix}`;\n\tif (Math.abs(monthDifference) >= 6) return `半年${suffix}`;\n\tif (Math.abs(monthDifference) >= 1) return `${Math.abs(monthDifference)}月${suffix}`;\n\tif (dayDifference >= 15) return `半月${suffix}`;\n\tif (dayDifference >= 7) return `${Math.floor(dayDifference / 7)}周${suffix}`;\n\tif (dayDifference >= 1) return `${Math.floor(dayDifference)}天${suffix}`;\n\tif (hourDifference >= 1) return `${Math.floor(hourDifference)}小时${suffix}`;\n\tif (minuteDifference >= 1) return `${Math.floor(minuteDifference)}分钟${suffix}`;\n\treturn \"刚刚\";\n}\n\n/**\n * 创建从今天到前后一个月日期的完整本地日范围。\n *\n * @param towardFuture - `true` 返回今天至一个月后,默认返回一个月前至今天。\n * @returns 每次调用新建的本地日首尾边界。\n */\nexport function createOneMonthRangeFromToday(towardFuture = false): [start: Date, end: Date] {\n\tconst start = new Date();\n\tconst end = new Date();\n\tshiftCalendarFieldInPlace(towardFuture ? end : start, towardFuture ? 1 : -1, \"month\");\n\tstart.setHours(0, 0, 0, 0);\n\tend.setHours(23, 59, 59, 999);\n\treturn [start, end];\n}\n\n/**\n * 创建面向过去或未来的常用完整日期范围快捷项。\n *\n * @param towardFuture - `true` 创建未来范围,默认创建历史范围。\n * @returns 每次求值都会重新读取当前时间的范围快捷项。\n */\nexport function createDateRangeShortcuts(towardFuture = false): DateRangeShortcut[] {\n\treturn towardFuture\n\t\t? [\n\t\t\t\tcreateRangeShortcut(\"后1天\", 1, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后3天\", 3, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后1周\", 7, \"day\", true),\n\t\t\t\tcreateRangeShortcut(\"后1月\", 1, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后3月\", 3, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后6月\", 6, \"month\", true),\n\t\t\t\tcreateRangeShortcut(\"后1年\", 1, \"year\", true),\n\t\t\t]\n\t\t: [\n\t\t\t\tcreateRangeShortcut(\"近1天\", 1, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近3天\", 3, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近1周\", 7, \"day\", false),\n\t\t\t\tcreateRangeShortcut(\"近1月\", 1, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近3月\", 3, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近6月\", 6, \"month\", false),\n\t\t\t\tcreateRangeShortcut(\"近1年\", 1, \"year\", false),\n\t\t\t];\n}\n\n/**\n * 创建面向过去或未来的常用单日期快捷项。\n *\n * @param towardFuture - `true` 创建未来日期,默认创建历史日期。\n * @returns 每次求值都会重新读取当前时间的单日期快捷项。\n */\nexport function createDateShortcuts(towardFuture = false): DateShortcut[] {\n\treturn towardFuture\n\t\t? [\n\t\t\t\tcreateDateShortcut(\"今天\", 0, \"day\"),\n\t\t\t\tcreateDateShortcut(\"明天\", 1, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一周后\", 7, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一月后\", 1, \"month\"),\n\t\t\t\tcreateDateShortcut(\"一年后\", 1, \"year\"),\n\t\t\t]\n\t\t: [\n\t\t\t\tcreateDateShortcut(\"今天\", 0, \"day\"),\n\t\t\t\tcreateDateShortcut(\"昨天\", -1, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一周前\", -7, \"day\"),\n\t\t\t\tcreateDateShortcut(\"一月前\", -1, \"month\"),\n\t\t\t\tcreateDateShortcut(\"一年前\", -1, \"year\"),\n\t\t\t];\n}\n\n/**\n * 返回今天的本地零点。\n *\n * @returns 新建的 `00:00:00.000` Date\n */\nexport function getStartOfToday(): Date {\n\treturn startOfDay(new Date());\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,OAAO,OAAwB;CAC9C,MAAM,OAAO,iBAAiB,OAAO,IAAI,KAAK,MAAM,QAAQ,CAAC,IAAI,IAAI,KAAK,KAAK;CAC/E,IAAI,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,GAClC,MAAM,IAAI,UAAU,gCAAgC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,2BAAW,IAAI,KAAK,CAAC;AAC7B"}
|
package/dist/utils/dom/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 判断文本是否可按十进制数值追加 CSS 单位。
|
|
4
4
|
*
|
|
5
|
-
* @param value -
|
|
5
|
+
* @param value - 已去除外围空白的文本
|
|
6
6
|
* @returns 有限十进制数值返回 `true`;二、八、十六进制前缀返回 `false`。
|
|
7
7
|
*/
|
|
8
8
|
const isNumericString = (value) => {
|
|
@@ -14,15 +14,15 @@ const isNumericString = (value) => {
|
|
|
14
14
|
* 为数值或纯数字字符串添加 CSS 单位。
|
|
15
15
|
*
|
|
16
16
|
* @param value - 数字、数字字符串或已有单位的 CSS 值;空值返回空字符串。
|
|
17
|
-
* @param unit - 非零数字使用的单位,默认 `px
|
|
17
|
+
* @param unit - 非零数字使用的单位,默认 `px`
|
|
18
18
|
* @returns 零统一返回 `"0"`;非数字字符串保持原样。
|
|
19
19
|
* @throws `RangeError` 当数字非有限或单位为空。
|
|
20
20
|
*/
|
|
21
21
|
function addCssUnit(value, unit = "px") {
|
|
22
22
|
if (value === null || value === void 0 || value === "") return "";
|
|
23
|
-
if (unit.length === 0) throw new RangeError("`unit`
|
|
23
|
+
if (unit.length === 0) throw new RangeError("`unit` must not be empty.");
|
|
24
24
|
if (typeof value === "number") {
|
|
25
|
-
if (!Number.isFinite(value)) throw new RangeError("`value`
|
|
25
|
+
if (!Number.isFinite(value)) throw new RangeError("`value` must be a finite number.");
|
|
26
26
|
return value === 0 ? "0" : `${value}${unit}`;
|
|
27
27
|
}
|
|
28
28
|
const trimmed = value.trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/dom/index.ts"],"sourcesContent":["/**\n * 判断文本是否可按十进制数值追加 CSS 单位。\n *\n * @param value -
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/dom/index.ts"],"sourcesContent":["/**\n * 判断文本是否可按十进制数值追加 CSS 单位。\n *\n * @param value - 已去除外围空白的文本\n * @returns 有限十进制数值返回 `true`;二、八、十六进制前缀返回 `false`。\n */\nconst isNumericString = (value: string): boolean => {\n\tif (value.length === 0 || !Number.isFinite(Number(value))) return false;\n\tconst unsigned = value.startsWith(\"+\") || value.startsWith(\"-\") ? value.slice(1) : value;\n\treturn !/^0[box]/iu.test(unsigned);\n};\n\n/**\n * 为数值或纯数字字符串添加 CSS 单位。\n *\n * @param value - 数字、数字字符串或已有单位的 CSS 值;空值返回空字符串。\n * @param unit - 非零数字使用的单位,默认 `px`\n * @returns 零统一返回 `\"0\"`;非数字字符串保持原样。\n * @throws `RangeError` 当数字非有限或单位为空。\n */\nexport function addCssUnit(value?: string | number | null, unit = \"px\"): string {\n\tif (value === null || value === undefined || value === \"\") return \"\";\n\tif (unit.length === 0) throw new RangeError(\"`unit` must not be empty.\");\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new RangeError(\"`value` must be a finite number.\");\n\t\treturn value === 0 ? \"0\" : `${value}${unit}`;\n\t}\n\tconst trimmed = value.trim();\n\tif (!isNumericString(trimmed)) return value;\n\treturn Number(trimmed) === 0 ? \"0\" : `${trimmed}${unit}`;\n}\n"],"mappings":";;;;;;;AAMA,MAAM,mBAAmB,UAA2B;CACnD,IAAI,MAAM,WAAW,KAAK,CAAC,OAAO,SAAS,OAAO,KAAK,CAAC,GAAG,OAAO;CAClE,MAAM,WAAW,MAAM,WAAW,GAAG,KAAK,MAAM,WAAW,GAAG,IAAI,MAAM,MAAM,CAAC,IAAI;CACnF,OAAO,CAAC,YAAY,KAAK,QAAQ;AAClC;;;;;;;;;AAUA,SAAgB,WAAW,OAAgC,OAAO,MAAc;CAC/E,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,IAAI,OAAO;CAClE,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,WAAW,2BAA2B;CACvE,IAAI,OAAO,UAAU,UAAU;EAC9B,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,MAAM,IAAI,WAAW,kCAAkC;EACpF,OAAO,UAAU,IAAI,MAAM,GAAG,QAAQ;CACvC;CACA,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,CAAC,gBAAgB,OAAO,GAAG,OAAO;CACtC,OAAO,OAAO,OAAO,MAAM,IAAI,MAAM,GAAG,UAAU;AACnD"}
|
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @remarks 原始值使用 SameValueZero 语义;支持循环引用、数组、对象、ArrayBuffer、DataView、Date、Error、Map、RegExp、Set、Symbol 和 TypedArray。
|
|
5
5
|
* 对象只比较自有可枚举字符串与 Symbol 属性,函数及其他不支持的宿主对象仅在引用相同时相等。
|
|
6
|
-
* @param left -
|
|
7
|
-
* @param right -
|
|
6
|
+
* @param left - 第一待比较值
|
|
7
|
+
* @param right - 第二待比较值
|
|
8
8
|
* @returns 两个值深度等价时返回 `true`。
|
|
9
9
|
*/
|
|
10
10
|
export declare function isEqual(left: unknown, right: unknown): boolean;
|
|
11
11
|
/**
|
|
12
12
|
* 从对象中选择指定自有可枚举属性。
|
|
13
13
|
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* @param source -
|
|
14
|
+
* @remarks 固定键元组保留精确返回类型;动态数组中可能被选择或排除的键在返回类型中保持可选。
|
|
15
|
+
* @param source - 不会被修改的源对象
|
|
16
16
|
* @param keys - 需要保留的键;不存在的键被忽略。
|
|
17
17
|
* @returns 新对象,保持 `keys` 的遍历顺序。
|
|
18
18
|
*/
|
|
19
|
-
export declare function pick<Source extends object, const Keys extends readonly (keyof Source)[]>(source: Source, keys: Keys): Pick<Source, Keys[number]>;
|
|
19
|
+
export declare function pick<Source extends object, const Keys extends readonly (keyof Source)[]>(source: Source, keys: Keys): number extends Keys["length"] ? Partial<Pick<Source, Keys[number]>> : Pick<Source, Keys[number]>;
|
|
20
20
|
export declare function pick<Source extends object>(source: Source, keys: readonly PropertyKey[]): Partial<Source>;
|
|
21
21
|
/**
|
|
22
22
|
* 浅复制对象并删除指定属性。
|
|
23
23
|
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* @param source -
|
|
26
|
-
* @param keys -
|
|
27
|
-
* @returns 包含其余自有可枚举字符串与 Symbol
|
|
24
|
+
* @remarks 固定键元组保留精确返回类型;动态数组中可能被选择或排除的键在返回类型中保持可选。
|
|
25
|
+
* @param source - 不会被修改的源对象
|
|
26
|
+
* @param keys - 需要排除的键
|
|
27
|
+
* @returns 包含其余自有可枚举字符串与 Symbol 属性的新对象
|
|
28
28
|
*/
|
|
29
|
-
export declare function omit<Source extends object, const Keys extends readonly (keyof Source)[]>(source: Source, keys: Keys): Omit<Source, Keys[number]>;
|
|
29
|
+
export declare function omit<Source extends object, const Keys extends readonly (keyof Source)[]>(source: Source, keys: Keys): number extends Keys["length"] ? Omit<Source, Keys[number]> & Partial<Pick<Source, Keys[number]>> : Omit<Source, Keys[number]>;
|
|
30
30
|
export declare function omit<Source extends object>(source: Source, keys: readonly PropertyKey[]): Partial<Source>;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* 安全写入结果对象的自有可枚举属性。
|
|
4
4
|
*
|
|
5
5
|
* @remarks 使用 `defineProperty` 避免 `__proto__` 触发 Setter,并统一创建可写、可配置的自有可枚举数据属性。
|
|
6
|
-
* @param target -
|
|
7
|
-
* @param key -
|
|
8
|
-
* @param value -
|
|
6
|
+
* @param target - 要写入的结果对象
|
|
7
|
+
* @param key - 自有属性键
|
|
8
|
+
* @param value - 属性值
|
|
9
9
|
*/
|
|
10
10
|
const defineEnumerableProperty = (target, key, value) => {
|
|
11
11
|
Object.defineProperty(target, key, {
|
|
@@ -83,7 +83,7 @@ const equalObjects = (left, right, state) => {
|
|
|
83
83
|
const leftKeys = getEnumerableOwnKeys(left);
|
|
84
84
|
const rightKeys = getEnumerableOwnKeys(right);
|
|
85
85
|
if (leftKeys.length !== rightKeys.length) return false;
|
|
86
|
-
for (const key of leftKeys) if (!Object.
|
|
86
|
+
for (const key of leftKeys) if (!Object.prototype.hasOwnProperty.call(right, key)) return false;
|
|
87
87
|
return compareTrackedPair(left, right, state, () => {
|
|
88
88
|
let compareConstructors = true;
|
|
89
89
|
for (const key of leftKeys) {
|
|
@@ -133,8 +133,8 @@ function isEqualValue(left, right, state) {
|
|
|
133
133
|
*
|
|
134
134
|
* @remarks 原始值使用 SameValueZero 语义;支持循环引用、数组、对象、ArrayBuffer、DataView、Date、Error、Map、RegExp、Set、Symbol 和 TypedArray。
|
|
135
135
|
* 对象只比较自有可枚举字符串与 Symbol 属性,函数及其他不支持的宿主对象仅在引用相同时相等。
|
|
136
|
-
* @param left -
|
|
137
|
-
* @param right -
|
|
136
|
+
* @param left - 第一待比较值
|
|
137
|
+
* @param right - 第二待比较值
|
|
138
138
|
* @returns 两个值深度等价时返回 `true`。
|
|
139
139
|
*/
|
|
140
140
|
function isEqual(left, right) {
|