[scss] migrate @import to @use.
[grid] isExpandable. [popup] showInput, options.
This commit is contained in:
1 parent
409333993b
commit
6de354ad47
27 files changed
+113
-5083
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
@import "../../ui/css/functions/func.scss";
|
@use "../../ui/css/functions/func.scss";
|
||||||
|
|
||||||
.ui-popup-mask {
|
.ui-popup-mask {
|
||||||
.wrapper-edit-method {
|
.wrapper-edit-method {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
transition: background-color .2s;
|
transition: background-color .2s;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--dark-fore-opacity-color);
|
background-color: var(--dark-fore-opacity-color);
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
margin: 3px 5px;
|
margin: 3px 5px;
|
||||||
background: #f0f0f0;
|
background: #f0f0f0;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
}
|
}
|
||||||
|
|
||||||
> .customer-reply {
|
> .customer-reply {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "../ui/css/functions/func.scss";
|
@use "../ui/css/functions/func.scss";
|
||||||
|
|
||||||
.schedule-item-container {
|
.schedule-item-container {
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@
|
|||||||
height: 26px;
|
height: 26px;
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
|
|
||||||
@include outborder();
|
@include func.outborder();
|
||||||
|
|
||||||
&:invalid {
|
&:invalid {
|
||||||
color: rgba(0, 0, 0, .3);
|
color: rgba(0, 0, 0, .3);
|
||||||
|
|||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* 创建一个 html 元素
|
|
||||||
* @param tagName 标签名
|
|
||||||
* @param init 样式类名,或者为有一个 html 元素作为参数的函数
|
|
||||||
* @param children 子元素
|
|
||||||
*/
|
|
||||||
export function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, init?: string | ((element: HTMLElementTagNameMap[K]) => void), ...children: (Node | string)[]): HTMLElementTagNameMap[K];
|
|
||||||
Vendored
-54
@@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* 复选框选项
|
|
||||||
*/
|
|
||||||
interface CheckboxOptions {
|
|
||||||
/** 样式类名 */
|
|
||||||
className?: string;
|
|
||||||
/** 是否可用 */
|
|
||||||
enabled?: boolean;
|
|
||||||
/** html 名称 */
|
|
||||||
name?: string;
|
|
||||||
/** 焦点索引 */
|
|
||||||
tabIndex?: Number;
|
|
||||||
/** 是否为 switch 样式 */
|
|
||||||
switch?: boolean;
|
|
||||||
/** 样式分类,可以是 ['`fa-light`', '`fa-regular`', '`fa-solid`'] 其中之一 */
|
|
||||||
type?: string;
|
|
||||||
/** 标签 */
|
|
||||||
label?: string | HTMLElement;
|
|
||||||
/** 标签提示文本 */
|
|
||||||
title?: string;
|
|
||||||
/** 是否已选中 */
|
|
||||||
checked?: boolean;
|
|
||||||
/** 图片高度 */
|
|
||||||
imageHeight?: Number;
|
|
||||||
/** 选中时显示的元素 */
|
|
||||||
checkedNode?: HTMLElement;
|
|
||||||
/** 未选中时显示的元素 */
|
|
||||||
uncheckedNode?: HTMLElement;
|
|
||||||
/** 自定义 html 属性 */
|
|
||||||
customAttributes?: { [key: string]: string };
|
|
||||||
/**
|
|
||||||
* 复选框选择状态改变时触发
|
|
||||||
* @param this 当前复选框对应的 HtmlInput 元素
|
|
||||||
* @param ev 选择事件对象
|
|
||||||
*/
|
|
||||||
onchange?: (this: HTMLInputElement, ev: Event) => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建一个单选框
|
|
||||||
* @param opts 单选框参数
|
|
||||||
*/
|
|
||||||
export function createRadiobox(opts?: CheckboxOptions): HTMLElement
|
|
||||||
/**
|
|
||||||
* 创建一个复选框
|
|
||||||
* @param opts 复选框参数
|
|
||||||
*/
|
|
||||||
export function createCheckbox(opts?: CheckboxOptions): HTMLElement
|
|
||||||
/**
|
|
||||||
* 解析容器元素内符合条件的子元素为复选框元素
|
|
||||||
* @param container 容器元素
|
|
||||||
* @param legacy 是否使用传统模式
|
|
||||||
*/
|
|
||||||
export function resolveCheckbox(container?: HTMLElement, legacy?: boolean): HTMLElement
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
.ui-check-image-wrapper {
|
.ui-check-image-wrapper {
|
||||||
>input[type="checkbox"] {
|
>input[type="checkbox"] {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
@include ui-check();
|
@include func.ui-check();
|
||||||
|
|
||||||
.ui-check-inner {
|
.ui-check-inner {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
.ui-text,
|
.ui-text,
|
||||||
.ui-input[type] {
|
.ui-input[type] {
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
font-family: var(--font-family);
|
font-family: var(--font-family);
|
||||||
|
|
||||||
@include outborder();
|
@include func.outborder();
|
||||||
|
|
||||||
&.validation-error,
|
&.validation-error,
|
||||||
&:invalid {
|
&:invalid {
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
.ui-loading {
|
.ui-loading {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include inset(0, 0, 0, 0);
|
@include func.inset(0, 0, 0, 0);
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: visibility 0s linear .12s, opacity .12s ease;
|
transition: visibility 0s linear .12s, opacity .12s ease;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
$headerHeight: 26px;
|
$headerHeight: 26px;
|
||||||
$caretWidth: 26px;
|
$caretWidth: 26px;
|
||||||
@@ -24,11 +24,12 @@ $listMaxHeight: 210px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
height: $headerHeight;
|
height: $headerHeight;
|
||||||
|
|
||||||
@include outborder();
|
@include func.outborder();
|
||||||
|
|
||||||
> .ui-drop-text {
|
> .ui-drop-text {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-family: var(--font-family);
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
line-height: $headerHeight;
|
line-height: $headerHeight;
|
||||||
min-height: $headerHeight;
|
min-height: $headerHeight;
|
||||||
@@ -38,7 +39,7 @@ $listMaxHeight: 210px;
|
|||||||
border: none;
|
border: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
}
|
}
|
||||||
|
|
||||||
> .ui-drop-text::before {
|
> .ui-drop-text::before {
|
||||||
@@ -137,7 +138,7 @@ $listMaxHeight: 210px;
|
|||||||
padding: 0 6px 0 22px;
|
padding: 0 6px 0 22px;
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
|
|
||||||
@include outborder();
|
@include func.outborder();
|
||||||
// &:focus {
|
// &:focus {
|
||||||
// box-shadow: 0 0 3px 1px rgba(0, 0, 0, .2);
|
// box-shadow: 0 0 3px 1px rgba(0, 0, 0, .2);
|
||||||
// }
|
// }
|
||||||
@@ -161,7 +162,7 @@ $listMaxHeight: 210px;
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
@include scrollbar();
|
@include func.scrollbar();
|
||||||
|
|
||||||
&.filtered > .drop-content > .li:first-child {
|
&.filtered > .drop-content > .li:first-child {
|
||||||
background-color: var(--hover-bg-color);
|
background-color: var(--hover-bg-color);
|
||||||
|
|||||||
+10
-10
@@ -1,4 +1,4 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
.ui-grid-container {
|
.ui-grid-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
--filter-item-padding: 0 4px;
|
--filter-item-padding: 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
@include scrollbar();
|
@include func.scrollbar();
|
||||||
|
|
||||||
&,
|
&,
|
||||||
input[type="text"],
|
input[type="text"],
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
&.wrap {
|
&.wrap {
|
||||||
@include wrap();
|
@include func.wrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@
|
|||||||
white-space: pre;
|
white-space: pre;
|
||||||
|
|
||||||
&.wrap {
|
&.wrap {
|
||||||
@include wrap();
|
@include func.wrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
max-height: none !important;
|
max-height: none !important;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
color: var(--text-disabled-color);
|
color: var(--text-disabled-color);
|
||||||
@@ -411,7 +411,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
padding: var(--spacing-cell);
|
padding: var(--spacing-cell);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@include scrollbar();
|
@include func.scrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-check-wrapper,
|
.ui-check-wrapper,
|
||||||
@@ -450,7 +450,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.wrap>span {
|
&.wrap>span {
|
||||||
@include wrap();
|
@include func.wrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@include scrollbar();
|
@include func.scrollbar();
|
||||||
|
|
||||||
>.filter-content {
|
>.filter-content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -688,7 +688,7 @@
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
transition: background-color .12s ease;
|
transition: background-color .12s ease;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--hover-bg-color);
|
background-color: var(--hover-bg-color);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
$headerLineHeight: 24px;
|
$headerLineHeight: 24px;
|
||||||
$buttonHeight: 28px;
|
$buttonHeight: 28px;
|
||||||
|
|
||||||
.ui-popup-mask {
|
.ui-popup-mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@include inset(0, 0, 0, 0);
|
@include func.inset(0, 0, 0, 0);
|
||||||
background-color: rgba(0 0 0 /20%);
|
background-color: rgba(0 0 0 /20%);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -41,7 +41,7 @@ $buttonHeight: 28px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
|
|
||||||
.ui-popup-header {
|
.ui-popup-header {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
@@ -114,7 +114,7 @@ $buttonHeight: 28px;
|
|||||||
|
|
||||||
>.ui-popup-loading {
|
>.ui-popup-loading {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include inset(0, 0, -46px, 0);
|
@include func.inset(0, 0, -46px, 0);
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: visibility 0s linear .12s, opacity .12s ease;
|
transition: visibility 0s linear .12s, opacity .12s ease;
|
||||||
@@ -242,7 +242,7 @@ $buttonHeight: 28px;
|
|||||||
opacity: .8;
|
opacity: .8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
opacity: .4;
|
opacity: .4;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@import "./functions/func.scss";
|
@use "functions/func.scss";
|
||||||
|
|
||||||
.ui-tooltip-color {
|
.ui-tooltip-color {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #323130;
|
color: #323130;
|
||||||
border-color: rgba(204, 204, 204, .8);
|
border-color: rgba(204, 204, 204, .8);
|
||||||
|
|
||||||
@include outline();
|
@include func.outline();
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-tooltip-wrapper {
|
.ui-tooltip-wrapper {
|
||||||
|
|||||||
Vendored
-138
@@ -1,138 +0,0 @@
|
|||||||
/**
|
|
||||||
* 创建或转换日期选择框
|
|
||||||
* @param min 最小可选日期
|
|
||||||
* @param max 最大可选日期
|
|
||||||
* @param element 转换该元素为日期选择框
|
|
||||||
* @returns 返回创建或转换的日期选择框
|
|
||||||
*/
|
|
||||||
export function createDateInput(min?: string, max?: string, element?: HTMLInputElement): HTMLInputElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将日期转换成 yyyy-MM-dd 格式的字符串
|
|
||||||
* @param dt 日期值
|
|
||||||
* @param local 是否视日期为本地时间
|
|
||||||
*/
|
|
||||||
export function toDateValue(dt: Date, local?: boolean): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化日期字符串
|
|
||||||
* @param date 要格式化的日期值<br/><br/>
|
|
||||||
* 支持以下几种数据类型<br/><br/>
|
|
||||||
* `"2024-01-26"`<br/>
|
|
||||||
* `"1/26/2024"`<br/>
|
|
||||||
* `"638418240000000000"`<br/>
|
|
||||||
* `new Date('2024-01-26')`<br/>
|
|
||||||
* @returns 格式化为 M/d/yyyy 的日期字符串
|
|
||||||
*/
|
|
||||||
export function formatDate(date: Date | number | string, formatter?: string): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置显示日期
|
|
||||||
* @param element 要设置显示日期的元素
|
|
||||||
* @param val 日期值,支持格式参见 {@linkcode formatDate}
|
|
||||||
* @param formatter 日期格式化字符串(仅设置显示元素时调用)
|
|
||||||
*/
|
|
||||||
export function setDateValue(element: HTMLElement, val: Date | number | string, formatter?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从日期选择框获取日期值
|
|
||||||
* @param element 要获取的日期选择框
|
|
||||||
* @param formatter 自定义格式化函数,传入参数为 `Date` 类型
|
|
||||||
* @returns 默认返回日期 `ticks` 的字符串
|
|
||||||
*/
|
|
||||||
export function getDateValue(element: HTMLInputElement, formatter?: string | ((date: Date) => string)): string;
|
|
||||||
|
|
||||||
/** 日期选择框类 */
|
|
||||||
export class DateSelector {
|
|
||||||
/**
|
|
||||||
* 把父容器下所有匹配 `input[data-type="date"]` 的元素修改为统一的日期选择框<br/><br/>
|
|
||||||
* 解析的属性为 `id`, `class`, `data-min`, `data-max`, `disabled`
|
|
||||||
* @param dom 父元素
|
|
||||||
* @param trigger 日期设置事件触发函数(上下文为触发设置日期的 `DateSelector` 实例)
|
|
||||||
* @example
|
|
||||||
* HTML:
|
|
||||||
* ```html
|
|
||||||
* <input id="dateFrom" data-type="date" data-min="1980-01-01"/>
|
|
||||||
* ```
|
|
||||||
* js:
|
|
||||||
* ```js
|
|
||||||
* const libUI = window['lib-ui'];
|
|
||||||
* const DateSelector = libUI.DateSelector;
|
|
||||||
* const formatDate = libUI.formatDate;
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* // 解析 document.body 下所有符合条件的元素,转换为日期选择框,第二个参数可选
|
|
||||||
* DateSelector.resolve(document.body, function (date) {
|
|
||||||
* console.log(`element(#${this.element.id}), date changed to: ${formatDate(date)}`);
|
|
||||||
* // 当日期选择改变时,控制台将会输出:element(#dateFrom), date changed to: 1/30/2024
|
|
||||||
* });
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* // 在其他地方调用时
|
|
||||||
* const value = document.querySelector('#dateFrom').value;
|
|
||||||
* console.log(`dateFrom.value = '${value}', formatted: '${formatDate(value)}'`);
|
|
||||||
* // 控制台会输出:dateFrom.value = '2024-01-30', formatted: '1/30/2024'
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
static resolve(dom?: HTMLElement, trigger?: (this: DateSelector, date: Date) => void): HTMLElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期选择框构造函数
|
|
||||||
* @param opts 日期选项参数
|
|
||||||
*/
|
|
||||||
constructor(opts: {
|
|
||||||
/** 最小可选择日期 */
|
|
||||||
minDate?: string,
|
|
||||||
/** 最大可选择日期 */
|
|
||||||
maxDate?: string,
|
|
||||||
/** 是否启用 */
|
|
||||||
enabled?: boolean,
|
|
||||||
/** 焦点索引 */
|
|
||||||
tabIndex?: number,
|
|
||||||
/** 类名 */
|
|
||||||
className?: string,
|
|
||||||
/**
|
|
||||||
* 自定义格式化函数,用于获取日期值时调用
|
|
||||||
* @param date 日期值
|
|
||||||
* @returns 返回格式化的值
|
|
||||||
*/
|
|
||||||
valueFormatter?: (date: Date) => any
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建或转换日期选择框元素
|
|
||||||
* @param element 转换该元素为日期选择框
|
|
||||||
* @returns 返回创建或转换的日期选择元素
|
|
||||||
*/
|
|
||||||
create(element?: HTMLInputElement): HTMLInputElement;
|
|
||||||
|
|
||||||
/** 获取日期选择框元素 */
|
|
||||||
get element(): HTMLInputElement;
|
|
||||||
|
|
||||||
/** 获取日期选择框是否启用 */
|
|
||||||
get enabled(): boolean;
|
|
||||||
/** 设置日期选择框启用状态 */
|
|
||||||
set enabled(flag: boolean);
|
|
||||||
|
|
||||||
/** 获取设置的日期值,或经过格式化函数返回的值 */
|
|
||||||
get value(): Date | any;
|
|
||||||
/** 设置日期值,支持的格式参见 {@linkcode formatDate} */
|
|
||||||
set value(val: Date | number | string);
|
|
||||||
|
|
||||||
/** 获取最小可选择日期 */
|
|
||||||
get minDate(): string;
|
|
||||||
/** 设置最小可选择日期 */
|
|
||||||
set minDate(date: string);
|
|
||||||
|
|
||||||
/** 获取最大可选择日期 */
|
|
||||||
get maxDate(): string;
|
|
||||||
/** 设置最大可选择日期 */
|
|
||||||
set maxDate(date: string);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期发生变化时触发的事件
|
|
||||||
* @param date 日期值,或者经自定义参数中格式化函数格式后的值
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onDateChanged?: (this: DateSelector, date: Date | any) => void;
|
|
||||||
}
|
|
||||||
Vendored
-132
@@ -1,132 +0,0 @@
|
|||||||
/** 下拉项接口 */
|
|
||||||
export interface DropdownItem {
|
|
||||||
/** 值 */
|
|
||||||
value: string;
|
|
||||||
/** 显示文本 */
|
|
||||||
text: string;
|
|
||||||
/** 源码显示内容 */
|
|
||||||
html?: HTMLElement | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 下拉框选项接口 */
|
|
||||||
export interface DropdownOptions {
|
|
||||||
/** 文本关键字,默认值 `text` */
|
|
||||||
textKey?: string;
|
|
||||||
/** 值关键字,默认值 `value` */
|
|
||||||
valueKey?: string;
|
|
||||||
/** 源码显示的关键字,默认值 `html` */
|
|
||||||
htmlKey?: string;
|
|
||||||
/** 源码显示的模板函数 */
|
|
||||||
htmlTemplate?: (item: DropdownItem) => HTMLElement;
|
|
||||||
/** 最大输入长度,默认值 `500` */
|
|
||||||
maxLength?: number;
|
|
||||||
/** 是否允许多选 */
|
|
||||||
multiSelect?: boolean;
|
|
||||||
/** 选中值 */
|
|
||||||
selected?: string;
|
|
||||||
/** 选中的数组 */
|
|
||||||
selectedList?: Array<string>;
|
|
||||||
/** 是否禁用 */
|
|
||||||
disabled?: boolean;
|
|
||||||
/** 是否支持输入 */
|
|
||||||
input?: boolean;
|
|
||||||
/** 是否支持搜索 */
|
|
||||||
search?: boolean;
|
|
||||||
/** 搜索的关键字数组 */
|
|
||||||
searchKeys?: Array<string>;
|
|
||||||
/** 搜索提示文本,默认值取语言资源 `searchHolder` "Search..." */
|
|
||||||
searchPlaceholder?: string;
|
|
||||||
/** 焦点索引 */
|
|
||||||
tabIndex?: number;
|
|
||||||
/** 输入框的提示文本 */
|
|
||||||
placeholder?: string;
|
|
||||||
/** 是否固定为向下展开 */
|
|
||||||
slideFixed?: boolean;
|
|
||||||
/** 父元素,默认添加到头元素之后 */
|
|
||||||
wrapper?: HTMLElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 下拉框类 */
|
|
||||||
export class Dropdown {
|
|
||||||
/**
|
|
||||||
* 把父元素下的所有 `select` 元素修改为统一下拉框组件<br/><br/>
|
|
||||||
* 解析的属性为 `value`, `disabled`, `tabIndex`
|
|
||||||
* @param dom 父元素
|
|
||||||
* @param trigger 选中事件触发函数(上下文为触发选中的 `Dropdown` 实例)
|
|
||||||
* @returns 返回该父元素
|
|
||||||
*/
|
|
||||||
static resolve(dom?: HTMLElement, trigger?: (item: DropdownItem) => void): HTMLElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下拉框的构造函数
|
|
||||||
* @param options 下拉框选项
|
|
||||||
*/
|
|
||||||
constructor(options?: DropdownOptions);
|
|
||||||
|
|
||||||
/** 根据该函数返回数据源 */
|
|
||||||
sourceFilter: () => Array<DropdownItem>;
|
|
||||||
/**
|
|
||||||
* 选中时触发
|
|
||||||
* @param item 选中的条目
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onSelected: (item: DropdownItem) => void;
|
|
||||||
/**
|
|
||||||
* 选中多个时触发
|
|
||||||
* @param list 选中的条目数组
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onSelectedList: (list: Array<DropdownItem>) => void;
|
|
||||||
/**
|
|
||||||
* 下拉框展开时触发
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onExpanded: () => void;
|
|
||||||
/**
|
|
||||||
* 下拉框收缩时触发
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onCollapsed: () => void;
|
|
||||||
|
|
||||||
/** 获取下拉框是否禁用 */
|
|
||||||
get disabled(): boolean;
|
|
||||||
/**
|
|
||||||
* 设置下拉框禁用状态
|
|
||||||
* @param flag 禁用状态
|
|
||||||
*/
|
|
||||||
set disabled(flag: boolean);
|
|
||||||
/** 获取数据源 */
|
|
||||||
get source(): Array<DropdownItem>;
|
|
||||||
/**
|
|
||||||
* 设置数据源
|
|
||||||
* @param list 数据源
|
|
||||||
*/
|
|
||||||
set source(list: Array<DropdownItem>);
|
|
||||||
|
|
||||||
/** 获取是否允许多选 */
|
|
||||||
get multiSelect(): boolean;
|
|
||||||
/** 获取选中的条目 */
|
|
||||||
get selected(): DropdownItem;
|
|
||||||
/** 获取选中的条目列表 */
|
|
||||||
get selectedList(): Array<DropdownItem>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建下拉框元素
|
|
||||||
* @returns 返回创建的下拉框元素
|
|
||||||
*/
|
|
||||||
create(): HTMLElement;
|
|
||||||
/**
|
|
||||||
* 选中某个条目
|
|
||||||
* @param selected 选中的值
|
|
||||||
* @param silence 是否静默选中,即不触发 {@linkcode onSelected} 事件
|
|
||||||
* @param ignoreCase 是否不区分大小写
|
|
||||||
* @returns 是否选中
|
|
||||||
*/
|
|
||||||
select(selected: string, silence?: boolean, ignoreCase?: boolean): boolean | undefined;
|
|
||||||
/**
|
|
||||||
* 选中条目列表
|
|
||||||
* @param selectedlist 选中的值的列表
|
|
||||||
* @param silence 是否静默选中,即不触发 {@linkcode onSelected} 事件
|
|
||||||
*/
|
|
||||||
selectlist(selectedlist: Array<string>, silence?: boolean): void;
|
|
||||||
}
|
|
||||||
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export function validation(element: HTMLElement, regex: RegExp): HTMLElement
|
|
||||||
export function convertCssStyle(style: Object): string
|
|
||||||
Vendored
-391
@@ -1,391 +0,0 @@
|
|||||||
import { Grid, GridItem, GridItemWrapper, GridSourceItem } from "./grid";
|
|
||||||
import { Dropdown, DropdownOptions } from "../dropdown";
|
|
||||||
|
|
||||||
/** 列类型枚举 */
|
|
||||||
declare enum GridColumnType {
|
|
||||||
/** 通用列 */
|
|
||||||
Common = 0,
|
|
||||||
/** 单行文本框列 */
|
|
||||||
Input = 1,
|
|
||||||
/** 下拉选择列 */
|
|
||||||
Dropdown = 2,
|
|
||||||
/** 复选框列 */
|
|
||||||
Checkbox = 3,
|
|
||||||
/** 图标列 */
|
|
||||||
Icon = 4,
|
|
||||||
/** 多行文本列 */
|
|
||||||
Text = 5,
|
|
||||||
/** 日期选择列 */
|
|
||||||
Date = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列定义接口 */
|
|
||||||
export interface GridColumnDefinition {
|
|
||||||
/** 列关键字,默认以该关键字从行数据中提取单元格值,行数据的关键字属性值里包含 DisplayValue 则优先显示此值 */
|
|
||||||
key?: string;
|
|
||||||
/** 列的类型,可以为 {@linkcode GridColumn} 的子类,或者内置类型 {@linkcode GridColumnType} */
|
|
||||||
type?: GridColumnType | typeof GridColumn;
|
|
||||||
/** 列标题文本 */
|
|
||||||
caption?: string;
|
|
||||||
/** 列标题的元素样式 */
|
|
||||||
captionStyle?: { [key: string]: string };
|
|
||||||
/** 大于 0 则设置为该宽度,否则根据列内容自动调整列宽 */
|
|
||||||
width?: number;
|
|
||||||
/** 列对齐方式 */
|
|
||||||
align?: "left" | "center" | "right";
|
|
||||||
/**
|
|
||||||
* 列是否可用(可编辑),允许以下类型<br/><br/>
|
|
||||||
* `boolean` 则直接使用该值<br/><br/>
|
|
||||||
* `string` 则以该值为关键字从行数据中取值作为判断条件<br/><br/>
|
|
||||||
* `(item: GridItem) => boolean` 则调用该函数(上下文为列定义对象),以返回值作为判断条件<br/><br/>
|
|
||||||
*/
|
|
||||||
enabled?: boolean | string | ((item: GridItem) => boolean);
|
|
||||||
/**
|
|
||||||
* 单元格取值采用该方法返回的值
|
|
||||||
* @param item 行数据对象
|
|
||||||
* @param editing 是否处于编辑状态
|
|
||||||
* @param body Grid 控件的 `<tbody>` 部分
|
|
||||||
*/
|
|
||||||
filter?: (item: GridItem, editing: boolean, body?: HTMLElement) => any;
|
|
||||||
/** 单元格以该值填充内容,忽略filter与关键字属性 */
|
|
||||||
text?: string;
|
|
||||||
/** 列是否可见 */
|
|
||||||
visible?: boolean;
|
|
||||||
/** 列是否允许调整宽度 */
|
|
||||||
resizable?: boolean;
|
|
||||||
/** 列是否允许排序 */
|
|
||||||
sortable?: boolean;
|
|
||||||
/** 列是否允许重排顺序 */
|
|
||||||
orderable?: boolean;
|
|
||||||
/** 列为复选框类型时是否在列头增加全选复选框 */
|
|
||||||
allcheck?: boolean;
|
|
||||||
/** 单元格css样式对象(仅在重建行元素时读取) */
|
|
||||||
css?: { [key: string]: string };
|
|
||||||
/** 根据返回值填充单元格样式(填充行列数据时读取) */
|
|
||||||
styleFilter?: (item: GridItem) => { [key: string]: string };
|
|
||||||
/** 根据返回值设置单元格背景色 */
|
|
||||||
bgFilter?: (item: GridItem) => string;
|
|
||||||
/** 给单元格元素附加事件(事件函数上下文为数据行对象) */
|
|
||||||
events?: { [event: string]: Function };
|
|
||||||
/** 根据返回值设置单元格元素的附加属性,允许直接设置对象也支持函数返回对象 */
|
|
||||||
attrs?: { [key: string]: string } | ((item: GridItem) => { [key: string]: string });
|
|
||||||
/** 是否允许进行列头过滤 */
|
|
||||||
allowFilter?: boolean;
|
|
||||||
/** 自定义列过滤器的数据源(函数上下文为Grid) */
|
|
||||||
filterSource?: Array<GridItem> | ((col: GridColumnDefinition) => Array<GridItem>);
|
|
||||||
/** 自定义列排序函数 */
|
|
||||||
sortFilter?: (a: GridItem, b: GridItem) => -1 | 0 | 1;
|
|
||||||
/** 列为下拉列表类型时以该值设置下拉框的参数 */
|
|
||||||
dropOptions?: DropdownOptions;
|
|
||||||
/** 列为下拉列表类型时以该值设置下拉列表数据源,支持函数返回,也支持返回异步对象 */
|
|
||||||
source?: Array<GridSourceItem> | ((item: GridItem) => Array<GridSourceItem> | Promise<Array<GridSourceItem>>);
|
|
||||||
/** 下拉列表数据源是否缓存结果(即行数据未发生变化时仅从source属性获取一次值) */
|
|
||||||
sourceCache?: boolean;
|
|
||||||
/** 列为图标类型时以该值设置图标样式(函数上下文为列定义对象),默认值 `fa-light` */
|
|
||||||
iconType?: "fa-light" | "fa-regular" | "fa-solid";
|
|
||||||
/** 列为图标类型时以该值作为单元格元素的额外样式类型(函数上下文为列定义对象) */
|
|
||||||
iconClassName?: string | ((item: GridItem) => string);
|
|
||||||
/** 列为日期类型时以该值作为最小可选日期值 */
|
|
||||||
dateMin?: string;
|
|
||||||
/** 列为日期类型时以该值作为最大可选日期值 */
|
|
||||||
dateMax?: string;
|
|
||||||
/** 列为日期类型时自定义日期转字符串函数 */
|
|
||||||
dateValueFormatter?: string | ((date: Date) => string);
|
|
||||||
/** 以返回值额外设置单元格的tooltip(函数上下文为列定义对象) */
|
|
||||||
tooltip?: string | ((item: GridItem) => string);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列头复选框改变时触发
|
|
||||||
* @param this 上下文为 Grid 对象
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @param flag 是否选中
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onAllChecked?: (this: Grid, col: GridColumnDefinition, flag: boolean) => void;
|
|
||||||
/**
|
|
||||||
* 单元格发生变化时触发
|
|
||||||
* @param this 上下文为 Grid 对象
|
|
||||||
* @param item 数据行对象
|
|
||||||
* @param value 修改后的值
|
|
||||||
* @param oldValue 修改前的值
|
|
||||||
* @param e 列修改事件传递过来的任意对象
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onChanged?: (this: Grid, item: GridItem, value: boolean | string | number, oldValue: boolean | string | number, e?: any) => void;
|
|
||||||
/**
|
|
||||||
* 文本单元格在输入完成时触发的事件
|
|
||||||
* @param this 上下文为 Grid 对象
|
|
||||||
* @param item 数据行对象
|
|
||||||
* @param value 修改后的文本框值
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onInputEnded?: (this: Grid, item: GridItem, value: string) => void;
|
|
||||||
/**
|
|
||||||
* 列过滤点击OK时触发的事件
|
|
||||||
* @param this 上下文为 Grid 对象
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @param selected 选中的过滤项
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onFilterOk?: (this: Grid, col: GridColumnDefinition, selected: Array<GridItem>) => void;
|
|
||||||
/**
|
|
||||||
* 列过滤后触发的事件
|
|
||||||
* @param this 上下文为 Grid 对象
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onFiltered?: (this: Grid, col: GridColumnDefinition) => void;
|
|
||||||
/**
|
|
||||||
* 列为下拉框类型时在下拉列表展开时触发的事件
|
|
||||||
* @param this 上下文为列定义对象
|
|
||||||
* @param item 数据行对象
|
|
||||||
* @param drop 下拉框对象
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onDropExpanded?: (this: GridColumnDefinition, item: GridItem, drop: Dropdown) => void;
|
|
||||||
/**
|
|
||||||
* 列为下拉框类型时在下拉列表关闭时触发的事件
|
|
||||||
* @param this 上下文为列定义对象
|
|
||||||
* @param item 数据行对象
|
|
||||||
* @param drop 下拉框对象
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onDropCollapsed?: (this: GridColumnDefinition, item: GridItem, drop: Dropdown) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列定义基类 */
|
|
||||||
export class GridColumn {
|
|
||||||
/** @ignore */
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* 标记该类型是否支持列头批量操作
|
|
||||||
*/
|
|
||||||
static get headerEditing(): boolean;
|
|
||||||
/**
|
|
||||||
* 创建显示单元格时调用的方法
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @returns 返回创建的单元格元素
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static create(col: GridColumnDefinition): HTMLElement;
|
|
||||||
/**
|
|
||||||
* 创建编辑单元格时调用的方法<br/><br/>
|
|
||||||
* 元素修改后设置行包装对象的 `__editing` 后,支持在离开编辑状态时及时触发 {@linkcode leaveEdit} 方法<br/>
|
|
||||||
* 更多例子参考代码中 {@linkcode GridDropdownColumn} 的实现。
|
|
||||||
* @param trigger 编辑事件回调函数,e 参数会传递给 {@linkcode getValue} 方法
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @param container 父容器元素
|
|
||||||
* @param vals 行包装对象,其 `values` 属性为行数据对象
|
|
||||||
* @returns 返回创建的编辑状态的单元格元素
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void, col: GridColumnDefinition, container: HTMLElement, vals: GridItemWrapper): HTMLElement;
|
|
||||||
/**
|
|
||||||
* 创建列头时调用的方法
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @returns 返回创建的列头元素
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static createCaption?(col: GridColumnDefinition): HTMLElement;
|
|
||||||
/**
|
|
||||||
* 设置单元格值时调用的方法
|
|
||||||
* @param element 单元格元素
|
|
||||||
* @param val 待设置的单元格值
|
|
||||||
* @param vals 行包装对象
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @param grid {@linkcode Grid} 对象
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string | boolean | number, vals: GridItemWrapper, col: GridColumnDefinition, grid: Grid): void;
|
|
||||||
/**
|
|
||||||
* 获取编辑状态单元格值时调用的方法
|
|
||||||
* @param e 由 {@linkcode createEdit} 方法中 `trigger` 函数传递来的对象
|
|
||||||
* @param col 列定义对象
|
|
||||||
* @returns 返回单元格的值
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static getValue(e: any, col: GridColumnDefinition): string | boolean | number;
|
|
||||||
/**
|
|
||||||
* 设置单元格样式时调用的方法
|
|
||||||
* @param element 单元格元素
|
|
||||||
* @param style 样式对象
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static setStyle(element: HTMLElement, style: { [key: string]: string }): void;
|
|
||||||
/**
|
|
||||||
* 设置单元格可用性时调用的方法
|
|
||||||
* @param element 单元格元素
|
|
||||||
* @param enabled 启用值,为false时代表禁用
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 单元格离开编辑元素时触发,需要由行包装对象的 `__editing` 来确定是否触发。
|
|
||||||
* @param element 单元格元素
|
|
||||||
* @param container 父容器元素
|
|
||||||
* @virtual
|
|
||||||
*/
|
|
||||||
static leaveEdit?(element: HTMLElement, container: HTMLElement): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 单行文本列 */
|
|
||||||
export class GridInputColumn extends GridColumn {
|
|
||||||
/**
|
|
||||||
* 设置该类型是否支持触发 {@linkcode GridColumnDefinition.onInputEnded} 方法<br/>
|
|
||||||
* 该属性返回 `true` 后,在任意事件中修改行包装对象的 `__editing` 值,则会在行列元素变动时及时触发 {@linkcode GridColumnDefinition.onInputEnded} 方法,避免例如文本框还未触发 `onchange` 事件就被移除元素而导致的问题<br/>
|
|
||||||
* 更多例子参考代码中 {@linkcode GridInputColumn} 的实现
|
|
||||||
*/
|
|
||||||
static get editing(): boolean;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void, col: GridColumnDefinition, container: HTMLElement, vals: GridItemWrapper): HTMLElement;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string, vals: GridItemWrapper, col: GridColumnDefinition, grid: Grid): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.getValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static getValue(e: any): string;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setEnabled
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 多行文本列 */
|
|
||||||
export class GridTextColumn extends GridInputColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridInputColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void, col: GridColumnDefinition, container: HTMLElement, vals: GridItemWrapper): HTMLElement;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridInputColumn.setValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string, vals: GridItemWrapper, col: GridColumnDefinition, grid: Grid): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 下拉选择列 */
|
|
||||||
export class GridDropdownColumn extends GridColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void, col: GridColumnDefinition, container: HTMLElement, vals: GridItemWrapper): HTMLElement;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string, vals: GridItemWrapper, col: GridColumnDefinition): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.getValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static getValue(e: any, col: GridColumnDefinition): string;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setEnabled
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.leaveEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static leaveEdit?(element: HTMLElement, container: HTMLElement): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 复选框列 */
|
|
||||||
export class GridCheckboxColumn extends GridColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void): HTMLElement;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: boolean): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.getValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static getValue(e: any): boolean;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setEnabled
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 单选框列 */
|
|
||||||
export class GridRadioboxColumn extends GridCheckboxColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridCheckboxColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void): HTMLElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 图标列 */
|
|
||||||
export class GridIconColumn extends GridColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.create
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static create(): HTMLElement;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string, vals: GridItemWrapper, col: GridColumnDefinition): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setEnabled
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 日期选择列 */
|
|
||||||
export class GridDateColumn extends GridColumn {
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.createEdit
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static createEdit(trigger: (e: any) => void, col: GridColumnDefinition, container: HTMLElement, vals: GridItemWrapper): HTMLElement;
|
|
||||||
/**
|
|
||||||
* 设置单元格值时调用的方法<br/><br/>
|
|
||||||
* 支持以下几种数据类型<br/><br/>
|
|
||||||
* `"2024-01-26"`<br/>
|
|
||||||
* `"1/26/2024"`<br/>
|
|
||||||
* `"638418240000000000"`<br/>
|
|
||||||
* `new Date('2024-01-26')`<br/>
|
|
||||||
* @param element 单元格元素
|
|
||||||
* @param val 待设置的单元格值
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setValue(element: HTMLElement, val: string | number): void;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.getValue
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static getValue(e: any): string | number;
|
|
||||||
/**
|
|
||||||
* @inheritdoc GridColumn.setEnabled
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
static setEnabled(element: HTMLElement, enabled?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 格式化日期对象为 M/d/yyyy 格式的字符串
|
|
||||||
* @param date 日期对象
|
|
||||||
* @returns 返回格式化后的字符串
|
|
||||||
*/
|
|
||||||
static formatDate(date: Date): string;
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ import { Dropdown } from "../dropdown";
|
|||||||
import { convertCssStyle } from "../extension";
|
import { convertCssStyle } from "../extension";
|
||||||
import { createDateInput, formatDate, setDateValue, getDateValue } from "../date";
|
import { createDateInput, formatDate, setDateValue, getDateValue } from "../date";
|
||||||
// definition
|
// definition
|
||||||
import { GridRowItem, DropdownOptions, GridColumnDefinition, GridSourceItem, GridItemWrapper, Grid } from "./grid";
|
/** @import { GridRowItem, DropdownOptions, GridColumnDefinition, GridSourceItem, GridItemWrapper, Grid } from "./grid" */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
|
|||||||
Vendored
-325
@@ -1,325 +0,0 @@
|
|||||||
import { GridColumnDefinition } from "./column"
|
|
||||||
/**
|
|
||||||
* 单元格点击回调函数
|
|
||||||
*
|
|
||||||
* @param {number} index - 点击的行索引
|
|
||||||
* @param {number} colIndex - 点击的列索引
|
|
||||||
* @returns {boolean} 返回 `false` 则取消事件冒泡
|
|
||||||
*/
|
|
||||||
declare function cellClickedCallback(index: number, colIndex: number): boolean;
|
|
||||||
|
|
||||||
/** 列数据接口 */
|
|
||||||
interface GridItem {
|
|
||||||
/** 值 */
|
|
||||||
Value: any;
|
|
||||||
/** 显示值 */
|
|
||||||
DisplayValue: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列数据行包装接口 */
|
|
||||||
interface GridItemWrapper {
|
|
||||||
/** 真实数据对象 */
|
|
||||||
values: { [key: string]: GridItem | any };
|
|
||||||
/** 下拉数据源缓存对象 */
|
|
||||||
source: { [key: string]: Array<GridSourceItem> };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 下拉框列数据源接口 */
|
|
||||||
interface GridSourceItem {
|
|
||||||
/** 值 */
|
|
||||||
value: string;
|
|
||||||
/** 显示文本 */
|
|
||||||
text: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Grid 语言资源接口 */
|
|
||||||
interface GridLanguages {
|
|
||||||
/**
|
|
||||||
* “所有”文本,默认值 `( All )` */
|
|
||||||
all: string;
|
|
||||||
/** “确定”文本,默认值 `OK` */
|
|
||||||
ok: string;
|
|
||||||
/** “重置”文本,默认值 `Reset` */
|
|
||||||
reset: string;
|
|
||||||
cancel: string;
|
|
||||||
/** “空”文本,默认值 `( Null )` */
|
|
||||||
null: string;
|
|
||||||
addLevel: string;
|
|
||||||
deleteLevel: string;
|
|
||||||
copyLevel: string;
|
|
||||||
asc: string;
|
|
||||||
desc: string;
|
|
||||||
column: string;
|
|
||||||
order: string;
|
|
||||||
sort: string;
|
|
||||||
requirePrompt: string;
|
|
||||||
duplicatePrompt: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Grid 列排序定义接口 */
|
|
||||||
interface GridColumnSortDefinition {
|
|
||||||
/** 排序列的关键字 */
|
|
||||||
column: string;
|
|
||||||
/** 升序或降序 */
|
|
||||||
order: "asc" | "desc";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列排序枚举 */
|
|
||||||
declare enum GridColumnDirection {
|
|
||||||
/** 倒序 */
|
|
||||||
Descending = -1,
|
|
||||||
/** 升序 */
|
|
||||||
Ascending = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 列事件枚举 */
|
|
||||||
declare enum GridColumnEvent {
|
|
||||||
/** 重排事件 */
|
|
||||||
Reorder = "reorder",
|
|
||||||
/** 宽调整事件 */
|
|
||||||
Resize = "resize",
|
|
||||||
/** 排序事件 */
|
|
||||||
Sort = "sort"
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Grid 控件基础类 */
|
|
||||||
export class Grid {
|
|
||||||
/** 列类型枚举 */
|
|
||||||
static ColumnTypes: {
|
|
||||||
/** 通用列(只读) */
|
|
||||||
Common: 0,
|
|
||||||
/** 单行文本列 */
|
|
||||||
Input: 1,
|
|
||||||
/** 下拉选择列 */
|
|
||||||
Dropdown: 2,
|
|
||||||
/** 复选框列 */
|
|
||||||
Checkbox: 3,
|
|
||||||
/** 图标列 */
|
|
||||||
Icon: 4,
|
|
||||||
/** 多行文本列 */
|
|
||||||
Text: 5,
|
|
||||||
/** 日期选择列 */
|
|
||||||
Date: 6,
|
|
||||||
/**
|
|
||||||
* 判断列是否为复选框列
|
|
||||||
* @param type 列类型
|
|
||||||
*/
|
|
||||||
isCheckbox(type: number): boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 列定义的数组 */
|
|
||||||
columns: Array<GridColumnDefinition>;
|
|
||||||
/** 多语言资源对象 */
|
|
||||||
langs?: GridLanguages;
|
|
||||||
/** 行数大于等于该值则启用虚模式,默认值 `100` */
|
|
||||||
virtualCount?: number;
|
|
||||||
/** 表格行高,默认值 `36` */
|
|
||||||
rowHeight?: number;
|
|
||||||
/** 文本行高,默认值 `24` */
|
|
||||||
lineHeight?: number;
|
|
||||||
/** 列表底部留出额外行的空白,默认值 `0` */
|
|
||||||
extraRows?: number;
|
|
||||||
/** 过滤条件列表的行高,默认值 `30` */
|
|
||||||
filterRowHeight?: number;
|
|
||||||
/** 列表高度值,为 0 时列表始终显示全部内容(自增高),为非数字或者小于 0 则根据容器高度来确定虚模式的渲染行数,默认值 `null` */
|
|
||||||
height?: number;
|
|
||||||
/** 是否允许多选,默认值 `false` */
|
|
||||||
multiSelect?: boolean;
|
|
||||||
/** 为 false 时只有点击在单元格内才会选中行,默认值 `true` */
|
|
||||||
fullrowClick?: boolean;
|
|
||||||
/** 单元格 tooltip 是否禁用,默认值 `false` */
|
|
||||||
tooltipDisabled?: boolean;
|
|
||||||
/** 列头是否显示,默认值 `true` */
|
|
||||||
headerVisible?: boolean;
|
|
||||||
/** 监听事件的窗口载体,默认值 `window` */
|
|
||||||
window?: Window
|
|
||||||
/** 排序列的索引,默认值 `-1` */
|
|
||||||
sortIndex?: number;
|
|
||||||
/** 排序方式,正数升序,负数倒序,默认值 `1` */
|
|
||||||
sortDirection?: GridColumnDirection;
|
|
||||||
/** 排序列 */
|
|
||||||
sortArray?: Array<GridColumnSortDefinition>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grid 控件构造函数
|
|
||||||
* @param container Grid 控件所在的父容器,可以是 string 表示选择器,也可以是 HTMLElement 对象<br/><br/>
|
|
||||||
* <i>构造时可以不进行赋值,但是调用 init 函数时则必须进行赋值</i>
|
|
||||||
* @param getText (可选参数)获取多语言文本的函数代理
|
|
||||||
*/
|
|
||||||
constructor(container: string | HTMLElement, getText?: (id: string, def?: string) => string);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 即将选中行时触发,返回 false、null、undefined、0 等则取消选中动作
|
|
||||||
* @param index 即将选中的行索引
|
|
||||||
* @param colIndex 即将选中的列索引
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
willSelect?: (index: number, colIndex: number) => boolean;
|
|
||||||
/**
|
|
||||||
* 单元格单击时触发,colIndex 为 -1 则表示点击的是行的空白处,返回 false 则取消事件冒泡
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
cellClicked?: typeof cellClickedCallback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 选中行发生变化时触发的事件
|
|
||||||
* @param index 选中的行索引
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onSelectedRowChanged?: (index?: number) => void;
|
|
||||||
/**
|
|
||||||
* 单元格双击时触发的事件,colIndex 为 -1 则表示点击的是行的空白处
|
|
||||||
* @param index 双击的行索引
|
|
||||||
* @param colIndex 双击的列索引
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onCellDblClicked?: (index: number, colIndex: number) => void;
|
|
||||||
/**
|
|
||||||
* 行双击时触发的事件
|
|
||||||
* @param index 双击的行索引
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onRowDblClicked?: (index: number) => void;
|
|
||||||
/**
|
|
||||||
* 列发生变化时触发的事件
|
|
||||||
* @param type 事件类型<br/><br/>
|
|
||||||
* "reorder" 为发生列重排事件,此时 value 为目标列索引<br/>
|
|
||||||
* "resize" 为发生列宽调整事件,此时 value 为列宽度值<br/>
|
|
||||||
* "sort" 为发生列排序事件,此时 value 为 1(升序)或 -1(倒序)
|
|
||||||
* @param colIndex 发生变化事件的列索引
|
|
||||||
* @param value 变化的值
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onColumnChanged?: (type: GridColumnEvent, colIndex: number, value: number | GridColumnDirection) => void;
|
|
||||||
/**
|
|
||||||
* 列滚动时触发的事件
|
|
||||||
* @param e 滚动事件对象
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onBodyScrolled?: (e: Event) => void;
|
|
||||||
/**
|
|
||||||
* 多列排序后触发的事件
|
|
||||||
* @param array 排序列定义数组
|
|
||||||
* @eventProperty
|
|
||||||
*/
|
|
||||||
onSorted?: (array?: Array<GridColumnSortDefinition>) => void;
|
|
||||||
|
|
||||||
/** 返回所有数据的数据(未过滤) */
|
|
||||||
get allSource(): Array<GridItem>;
|
|
||||||
/** 获取数据数组(已过滤) */
|
|
||||||
get source(): Array<GridItem>;
|
|
||||||
/** 设置数据,并刷新列表 */
|
|
||||||
set source(list: Array<GridItem>);
|
|
||||||
/** 获取列表是否为只读,默认值 `false` */
|
|
||||||
get readonly(): boolean;
|
|
||||||
/** 设置列表是否为只读 */
|
|
||||||
set readonly(flag: boolean);
|
|
||||||
/** 获取当前选中的行索引的数组 */
|
|
||||||
get selectedIndexes(): Array<number>;
|
|
||||||
/** 设置当前选中的行索引的数组,并刷新列表 */
|
|
||||||
set selectedIndexes(indexes: Array<number>);
|
|
||||||
/** 获取 Grid 当前是否处于加载状态 */
|
|
||||||
get loading(): boolean;
|
|
||||||
/** 使 Grid 进入加载状态 */
|
|
||||||
set loading(flag: boolean);
|
|
||||||
/** 获取 Grid 当前滚动的偏移量 */
|
|
||||||
get scrollTop(): number;
|
|
||||||
/** 设置 Grid 滚动偏移量 */
|
|
||||||
set scrollTop(top: number);
|
|
||||||
|
|
||||||
/** 获取 Grid 的页面元素 */
|
|
||||||
get element(): HTMLElement;
|
|
||||||
/** 获取当前 Grid 是否已发生改变 */
|
|
||||||
get changed(): boolean;
|
|
||||||
/** 获取当前是否为虚模式状态 */
|
|
||||||
get virtual(): boolean;
|
|
||||||
/** 获取当前排序的列关键字,为 null 则当前无排序列 */
|
|
||||||
get sortKey(): string | undefined;
|
|
||||||
/** 获取当前选中行的索引,为 -1 则当前没有选中行 */
|
|
||||||
get selectedIndex(): number | -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化Grid控件
|
|
||||||
* @param container 父容器元素,若未传值则采用构造方法中传入的父容器元素
|
|
||||||
*/
|
|
||||||
init(container?: HTMLElement): void;
|
|
||||||
/**
|
|
||||||
* 设置数据列表,该方法为 set source 属性的语法糖
|
|
||||||
* @param source 待设置的数据列表
|
|
||||||
*/
|
|
||||||
setData(source: Array<GridItem>): void;
|
|
||||||
/**
|
|
||||||
* 设置单行数据
|
|
||||||
* @param index 行索引
|
|
||||||
* @param item 待设置的行数据值
|
|
||||||
*/
|
|
||||||
setItem(index: number, item: GridItem): void;
|
|
||||||
/**
|
|
||||||
* 添加行数据
|
|
||||||
* @param item 待添加的行数据值
|
|
||||||
* @param index 待添加的行索引
|
|
||||||
* @returns 返回已添加的行数据
|
|
||||||
*/
|
|
||||||
addItem(item: GridItem, index?: number): GridItem;
|
|
||||||
/**
|
|
||||||
* 批量添加行数据
|
|
||||||
* @param array 待添加的行数据数组
|
|
||||||
* @param index 待添加的行索引
|
|
||||||
* @returns 返回已添加的行数据数组
|
|
||||||
*/
|
|
||||||
addItems(array: Array<GridItem>, index?: number): Array<GridItem>
|
|
||||||
/**
|
|
||||||
* 删除行数据
|
|
||||||
* @param index 待删除的行索引
|
|
||||||
* @returns 返回已删除的行数据
|
|
||||||
*/
|
|
||||||
removeItem(index: number): GridItem;
|
|
||||||
/**
|
|
||||||
* 批量删除行数据
|
|
||||||
* @param indexes 待删除的行索引数组,未传值时删除所有行
|
|
||||||
* @returns 返回已删除的行数据数组
|
|
||||||
*/
|
|
||||||
removeItems(indexes?: Array<number>): Array<GridItem>;
|
|
||||||
/**
|
|
||||||
* 滚动到指定行的位置
|
|
||||||
* @param index 待滚动至的行索引
|
|
||||||
*/
|
|
||||||
scrollToIndex(index: number): void;
|
|
||||||
/**
|
|
||||||
* 调整 Grid 元素的大小,一般需要在宽度变化时(如页面大小发生变化时)调用
|
|
||||||
* @param force 是否强制 {@linkcode reload},默认只有待渲染的行数发生变化时才会调用
|
|
||||||
* @param keep 是否保持当前滚动位置
|
|
||||||
*/
|
|
||||||
resize(force?: boolean, keep?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 重新计算需要渲染的行,并载入元素,一般需要在高度变化时调用
|
|
||||||
* @param keep 是否保持当前滚动位置
|
|
||||||
*/
|
|
||||||
reload(keep?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 重新填充Grid单元格数据
|
|
||||||
*/
|
|
||||||
refresh(): void;
|
|
||||||
/**
|
|
||||||
* 把所有行重置为未修改的状态
|
|
||||||
*/
|
|
||||||
resetChange(): void;
|
|
||||||
/**
|
|
||||||
* 根据当前排序字段进行列排序
|
|
||||||
* @param reload 为 true 则在列排序后调用 {@linkcode Grid.reload} 方法
|
|
||||||
*/
|
|
||||||
sortColumn(reload?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 根据当前排序列数组进行多列排序
|
|
||||||
* @param reload 为 true 则在多列排序后调用 {@linkcode Grid.reload} 方法
|
|
||||||
*/
|
|
||||||
sort(reload?: boolean): void;
|
|
||||||
/**
|
|
||||||
* 清除列头复选框的选中状态
|
|
||||||
*/
|
|
||||||
clearHeaderCheckbox(): void;
|
|
||||||
/**
|
|
||||||
* 显示多列排序设置面板
|
|
||||||
*/
|
|
||||||
showSortPanel(): void;
|
|
||||||
}
|
|
||||||
+50
-25
@@ -72,13 +72,13 @@ let r = lang;
|
|||||||
/**
|
/**
|
||||||
* 键值字典
|
* 键值字典
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {{[key: string]: T}} KeyMap
|
* @typedef {Object.<string, T>} KeyMap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 索引字典
|
* 索引字典
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {{[index: number]: T}} IndexMap
|
* @typedef {Object.<number, T>} IndexMap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1018,8 +1018,8 @@ export class Grid {
|
|||||||
*/
|
*/
|
||||||
sortArray = null;
|
sortArray = null;
|
||||||
/**
|
/**
|
||||||
* 是否支持点击扩展
|
* 是否支持点击扩展,或行数据中支持点击扩展的字段
|
||||||
* @type {boolean}
|
* @type {boolean | string}
|
||||||
* @default false
|
* @default false
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
@@ -1167,7 +1167,7 @@ export class Grid {
|
|||||||
* @property {number} [sortIndex=-1] - 排序列的索引
|
* @property {number} [sortIndex=-1] - 排序列的索引
|
||||||
* @property {GridColumnDirection} [sortDirection=GridColumnDirection.Ascending] - 排序方式,正数升序,负数倒序
|
* @property {GridColumnDirection} [sortDirection=GridColumnDirection.Ascending] - 排序方式,正数升序,负数倒序
|
||||||
* @property {GridColumnSortDefinition[]} [sortArray] - 排序列数组
|
* @property {GridColumnSortDefinition[]} [sortArray] - 排序列数组
|
||||||
* @property {boolean} [expandable=false] - 是否支持点击扩展
|
* @property {boolean | string} [expandable=false] - 是否支持点击扩展,或行数据中支持点击扩展的字段
|
||||||
* @property {GridExpandableObjectCallback} [expandableGenerator] - 扩展行生成器
|
* @property {GridExpandableObjectCallback} [expandableGenerator] - 扩展行生成器
|
||||||
*/
|
*/
|
||||||
constructor(container, getText) {
|
constructor(container, getText) {
|
||||||
@@ -1177,6 +1177,19 @@ export class Grid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全局是否可支持点击扩展
|
||||||
|
* @readonly
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
get isExpandable() {
|
||||||
|
const flag = this.expandable;
|
||||||
|
if (typeof flag === 'string') {
|
||||||
|
return flag != null;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 Grid 的页面元素
|
* 获取 Grid 的页面元素
|
||||||
* @readonly
|
* @readonly
|
||||||
@@ -1514,7 +1527,7 @@ export class Grid {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rowIndex = parent.classList.contains('ui-grid-total-row') ? -1 : this._tableRows.indexOf(parent);
|
const rowIndex = parent.classList.contains('ui-grid-total-row') ? -1 : this._tableRows.indexOf(parent);
|
||||||
let colIndex = indexOfParent(target) - (this.expandable ? 1 : 0);
|
let colIndex = indexOfParent(target) - (this.isExpandable ? 1 : 0);
|
||||||
if (colIndex >= this.columns.length) {
|
if (colIndex >= this.columns.length) {
|
||||||
colIndex = -1;
|
colIndex = -1;
|
||||||
}
|
}
|
||||||
@@ -2680,9 +2693,10 @@ export class Grid {
|
|||||||
const header = createElement('tr');
|
const header = createElement('tr');
|
||||||
thead.appendChild(header);
|
thead.appendChild(header);
|
||||||
const sizer = this._var.refs.sizer;
|
const sizer = this._var.refs.sizer;
|
||||||
let left = this.expandable ? ExpandableWidth : 0;
|
const expandable = this.isExpandable;
|
||||||
|
let left = expandable ? ExpandableWidth : 0;
|
||||||
const readonly = this.readonly;
|
const readonly = this.readonly;
|
||||||
if (this.expandable) {
|
if (expandable) {
|
||||||
header.appendChild(createElement('th', th => {
|
header.appendChild(createElement('th', th => {
|
||||||
th.className = 'ui-expandable sticky';
|
th.className = 'ui-expandable sticky';
|
||||||
const w = `${ExpandableWidth}px`;
|
const w = `${ExpandableWidth}px`;
|
||||||
@@ -2866,7 +2880,7 @@ export class Grid {
|
|||||||
width += col.width + 1;
|
width += col.width + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.expandable) {
|
if (this.isExpandable) {
|
||||||
width += ExpandableWidth;
|
width += ExpandableWidth;
|
||||||
}
|
}
|
||||||
table.style.width = `${width}px`;
|
table.style.width = `${width}px`;
|
||||||
@@ -2891,8 +2905,9 @@ export class Grid {
|
|||||||
tfoot.addEventListener('dblclick', e => this._onRowDblClicked(e));
|
tfoot.addEventListener('dblclick', e => this._onRowDblClicked(e));
|
||||||
const footer = createElement('tr', 'ui-grid-row ui-grid-total-row');
|
const footer = createElement('tr', 'ui-grid-row ui-grid-total-row');
|
||||||
tfoot.appendChild(footer);
|
tfoot.appendChild(footer);
|
||||||
let left = this.expandable ? ExpandableWidth : 0;
|
const expandable = this.isExpandable;
|
||||||
if (this.expandable) {
|
let left = expandable ? ExpandableWidth : 0;
|
||||||
|
if (expandable) {
|
||||||
footer.appendChild(createElement('td', td => {
|
footer.appendChild(createElement('td', td => {
|
||||||
td.className = 'ui-expandable sticky';
|
td.className = 'ui-expandable sticky';
|
||||||
const w = `${ExpandableWidth}px`;
|
const w = `${ExpandableWidth}px`;
|
||||||
@@ -2955,6 +2970,7 @@ export class Grid {
|
|||||||
count -= exists;
|
count -= exists;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
const readonly = this.readonly;
|
const readonly = this.readonly;
|
||||||
|
const expandable = this.isExpandable;
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
const row = createElement('tr', 'ui-grid-row');
|
const row = createElement('tr', 'ui-grid-row');
|
||||||
if (this.rowDraggable) {
|
if (this.rowDraggable) {
|
||||||
@@ -2990,8 +3006,8 @@ export class Grid {
|
|||||||
}
|
}
|
||||||
const virtualRow = { cells: {} };
|
const virtualRow = { cells: {} };
|
||||||
this._var.virtualRows[exists + i] = virtualRow;
|
this._var.virtualRows[exists + i] = virtualRow;
|
||||||
let left = this.expandable ? ExpandableWidth : 0;
|
let left = expandable ? ExpandableWidth : 0;
|
||||||
if (this.expandable) {
|
if (expandable) {
|
||||||
const icon = createIcon('fa-solid', 'caret-right');
|
const icon = createIcon('fa-solid', 'caret-right');
|
||||||
icon.dataset.expanded = '0';
|
icon.dataset.expanded = '0';
|
||||||
row.appendChild(createElement('td', td => {
|
row.appendChild(createElement('td', td => {
|
||||||
@@ -3082,7 +3098,9 @@ export class Grid {
|
|||||||
_fillRows(rows, cols, widths) {
|
_fillRows(rows, cols, widths) {
|
||||||
const startIndex = this._var.startIndex;
|
const startIndex = this._var.startIndex;
|
||||||
const selectedIndexes = this._var.selectedIndexes;
|
const selectedIndexes = this._var.selectedIndexes;
|
||||||
const offset = this.expandable ? 1 : 0;
|
const expandable = this.isExpandable;
|
||||||
|
const expandableKey = typeof this.expandable === 'string' ? this.expandable : null;
|
||||||
|
const offset = expandable ? 1 : 0;
|
||||||
const readonly = this.readonly;
|
const readonly = this.readonly;
|
||||||
rows.forEach((row, i) => {
|
rows.forEach((row, i) => {
|
||||||
const vals = this._var.currentSource[startIndex + i];
|
const vals = this._var.currentSource[startIndex + i];
|
||||||
@@ -3109,8 +3127,11 @@ export class Grid {
|
|||||||
const stateChanged = virtualRow.editing !== selected;
|
const stateChanged = virtualRow.editing !== selected;
|
||||||
virtualRow.editing = selected;
|
virtualRow.editing = selected;
|
||||||
// data
|
// data
|
||||||
if (this.expandable) {
|
if (expandable) {
|
||||||
const expanded = vals.__expanded;
|
const iconCell = row.children[0];
|
||||||
|
const t = typeof expandableKey === 'string' ? item[expandableKey] : true;
|
||||||
|
iconCell.children[0].style.display = t ? '' : 'none';
|
||||||
|
const expanded = t && vals.__expanded;
|
||||||
let rowExpanded = row.nextElementSibling;
|
let rowExpanded = row.nextElementSibling;
|
||||||
if (rowExpanded?.className !== 'ui-grid-row-expanded') {
|
if (rowExpanded?.className !== 'ui-grid-row-expanded') {
|
||||||
rowExpanded = null;
|
rowExpanded = null;
|
||||||
@@ -3141,8 +3162,7 @@ export class Grid {
|
|||||||
rowExpanded.style.display = 'none';
|
rowExpanded.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const iconCell = row.children[0];
|
if (t && iconCell.children[0].dataset.expanded !== (expanded ? '1' : '0')) {
|
||||||
if (iconCell.children[0].dataset.expanded !== (expanded ? '1' : '0')) {
|
|
||||||
const icon = createIcon('fa-solid', expanded ? 'caret-down' : 'caret-right');
|
const icon = createIcon('fa-solid', expanded ? 'caret-down' : 'caret-right');
|
||||||
icon.dataset.expanded = expanded ? '1' : '0';
|
icon.dataset.expanded = expanded ? '1' : '0';
|
||||||
iconCell.replaceChildren(icon);
|
iconCell.replaceChildren(icon);
|
||||||
@@ -3410,7 +3430,8 @@ export class Grid {
|
|||||||
element.style.maxWidth = w;
|
element.style.maxWidth = w;
|
||||||
element.style.minWidth = w;
|
element.style.minWidth = w;
|
||||||
// element.style.cssText += `width: ${w}; max-width: ${w}; min-width: ${w}`;
|
// element.style.cssText += `width: ${w}; max-width: ${w}; min-width: ${w}`;
|
||||||
let left = this.expandable ? ExpandableWidth : 0;
|
const expandable = this.isExpandable;
|
||||||
|
let left = expandable ? ExpandableWidth : 0;
|
||||||
if (col.isfixed) {
|
if (col.isfixed) {
|
||||||
left = element.offsetLeft + width;
|
left = element.offsetLeft + width;
|
||||||
let l = left;
|
let l = left;
|
||||||
@@ -3423,7 +3444,7 @@ export class Grid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const offset = this.expandable ? 1 : 0;
|
const offset = expandable ? 1 : 0;
|
||||||
for (let row of this._tableRows) {
|
for (let row of this._tableRows) {
|
||||||
element = row.children[index + offset];
|
element = row.children[index + offset];
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
@@ -3571,7 +3592,7 @@ export class Grid {
|
|||||||
const children = this._headerCells;
|
const children = this._headerCells;
|
||||||
const rows = this._tableRows;
|
const rows = this._tableRows;
|
||||||
const columns = this.columns;
|
const columns = this.columns;
|
||||||
const offset = this.expandable ? 1 : 0;
|
const offset = this.isExpandable ? 1 : 0;
|
||||||
if (targetIndex > 1) {
|
if (targetIndex > 1) {
|
||||||
targetIndex = orderIndex - 1;
|
targetIndex = orderIndex - 1;
|
||||||
// const current = columns[index];
|
// const current = columns[index];
|
||||||
@@ -4194,7 +4215,7 @@ export class Grid {
|
|||||||
if (e.currentTarget.classList.contains('sticky')) {
|
if (e.currentTarget.classList.contains('sticky')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const index = indexOfParent(e.currentTarget) - (this.expandable ? 1 : 0);
|
const index = indexOfParent(e.currentTarget) - (this.isExpandable ? 1 : 0);
|
||||||
const cx = getClientX(e);
|
const cx = getClientX(e);
|
||||||
const window = this.window ?? global;
|
const window = this.window ?? global;
|
||||||
const clearEvents = attr => {
|
const clearEvents = attr => {
|
||||||
@@ -4260,7 +4281,7 @@ export class Grid {
|
|||||||
_onResizeStart(e, col) {
|
_onResizeStart(e, col) {
|
||||||
const cx = getClientX(e);
|
const cx = getClientX(e);
|
||||||
const width = col.width;
|
const width = col.width;
|
||||||
const index = indexOfParent(e.currentTarget.parentElement) - (this.expandable ? 1 : 0);
|
const index = indexOfParent(e.currentTarget.parentElement) - (this.isExpandable ? 1 : 0);
|
||||||
const window = this.window ?? global;
|
const window = this.window ?? global;
|
||||||
const clearEvents = attr => {
|
const clearEvents = attr => {
|
||||||
for (let event of ['mousemove', 'mouseup']) {
|
for (let event of ['mousemove', 'mouseup']) {
|
||||||
@@ -4277,7 +4298,11 @@ export class Grid {
|
|||||||
clearEvents(attr);
|
clearEvents(attr);
|
||||||
}
|
}
|
||||||
attr.resizing = width;
|
attr.resizing = width;
|
||||||
|
attr.sizing = true;
|
||||||
const resizemove = e => {
|
const resizemove = e => {
|
||||||
|
if (!attr.sizing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const cx2 = getClientX(e);
|
const cx2 = getClientX(e);
|
||||||
const val = width + (cx2 - cx);
|
const val = width + (cx2 - cx);
|
||||||
if (val < MiniColumnWidth) {
|
if (val < MiniColumnWidth) {
|
||||||
@@ -4316,7 +4341,7 @@ export class Grid {
|
|||||||
_onAutoResize(e, col) {
|
_onAutoResize(e, col) {
|
||||||
const th = e.currentTarget.parentElement;
|
const th = e.currentTarget.parentElement;
|
||||||
const index = indexOfParent(th);
|
const index = indexOfParent(th);
|
||||||
const offset = this.expandable ? 1 : 0;
|
const offset = this.isExpandable ? 1 : 0;
|
||||||
let width = th.querySelector('div:first-child').scrollWidth;
|
let width = th.querySelector('div:first-child').scrollWidth;
|
||||||
for (let row of this._tableRows) {
|
for (let row of this._tableRows) {
|
||||||
const element = row.children[index + offset].children[0];
|
const element = row.children[index + offset].children[0];
|
||||||
@@ -4677,7 +4702,7 @@ export class Grid {
|
|||||||
}
|
}
|
||||||
// 调整其他列的可用性
|
// 调整其他列的可用性
|
||||||
const row = this._tableRows[index];
|
const row = this._tableRows[index];
|
||||||
const offset = this.expandable ? 1 : 0;
|
const offset = this.isExpandable ? 1 : 0;
|
||||||
this.columns.forEach((c, j) => {
|
this.columns.forEach((c, j) => {
|
||||||
const cache = this._var.enabledDict[c.key];
|
const cache = this._var.enabledDict[c.key];
|
||||||
if (cache !== true && cache !== col.key) {
|
if (cache !== true && cache !== col.key) {
|
||||||
|
|||||||
Vendored
-26
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* 创建矢量图标元素
|
|
||||||
* @param type 样式分类,可以是 ['`fa-light`', '`fa-regular`', '`fa-solid`'] 其中之一
|
|
||||||
* @param id 图标 id
|
|
||||||
* @param style 样式表对象
|
|
||||||
* @param action 点击回调事件
|
|
||||||
*/
|
|
||||||
export function createIcon(type: string, id: string, style?: { [key: string]: string } | ((icon: SVGSVGElement) => { [key: string]: string }), action?: (this: SVGSVGElement, ev: MouseEvent) => any): SVGSVGElement
|
|
||||||
/**
|
|
||||||
* 修改矢量图标
|
|
||||||
* @param svg 矢量图标元素
|
|
||||||
* @param type 样式分类,见 { @link createIcon } 第一个参数
|
|
||||||
* @param id 图标 id,见 { @link createIcon } 第二个参数
|
|
||||||
*/
|
|
||||||
export function changeIcon(svg: SVGSVGElement, type: string, id: string): SVGSVGElement
|
|
||||||
/**
|
|
||||||
* 解析容器元素内符合条件的子元素为矢量图标元素
|
|
||||||
* @param container 容器元素
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* <svg data-id="user" data-type="fa-solid"></svg>
|
|
||||||
* ```
|
|
||||||
* - `data-id`: 见 { @link createIcon } 第二个参数
|
|
||||||
* - `data-type`: 见 { @link createIcon } 第一个参数
|
|
||||||
*/
|
|
||||||
export function resolveIcon(container: HTMLElement): HTMLElement
|
|
||||||
Vendored
-32
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
* 创建媒体图片元素
|
|
||||||
* @param url 图片链接地址
|
|
||||||
* @returns 返回一个 A 标签元素
|
|
||||||
*/
|
|
||||||
export function createPicture(url: string): HTMLAnchorElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建一个音频播放元素
|
|
||||||
* @param mime 音频类型,如 `audio/amr`、`audio/ogg`
|
|
||||||
* @param url 音频 url
|
|
||||||
*/
|
|
||||||
export function createAudio(mime: string, url: string): HTMLAudioElement | HTMLDivElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建一个视频播放元素
|
|
||||||
* @param url 视频 url
|
|
||||||
*/
|
|
||||||
export function createVideo(url: string): HTMLVideoElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建一个文件元素
|
|
||||||
* @param url 文件 url
|
|
||||||
* @param icon 图标,默认为 `file-alt`
|
|
||||||
*/
|
|
||||||
export function createFile(url: string, icon?: string): HTMLDivElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建联动视频元素
|
|
||||||
* @param urls 视频 url 数组
|
|
||||||
*/
|
|
||||||
export function createVideoList(urls: string[]): HTMLDivElement
|
|
||||||
Vendored
-116
@@ -1,116 +0,0 @@
|
|||||||
/**
|
|
||||||
* 弹出框选项
|
|
||||||
*/
|
|
||||||
interface PopupOptions {
|
|
||||||
/** 弹出框内容,可以是文本或者 html 元素 */
|
|
||||||
content: string | HTMLElement;
|
|
||||||
/** 弹出框标题,可以是文本或者 html 元素 */
|
|
||||||
title: string | HTMLElement;
|
|
||||||
|
|
||||||
/** 是否持久化显示 */
|
|
||||||
persistent?: boolean;
|
|
||||||
/** 是否包含遮罩层,默认为 `true` */
|
|
||||||
mask?: boolean;
|
|
||||||
/** 遮罩层 z-index */
|
|
||||||
zIndex?: number;
|
|
||||||
/** 是否在获取焦点时修改 z-index */
|
|
||||||
changeZIndex?: boolean;
|
|
||||||
/** 是否允许关闭 */
|
|
||||||
closable?: boolean;
|
|
||||||
/** 是否允许移动 */
|
|
||||||
movable?: boolean;
|
|
||||||
/** 是否允许修改大小 */
|
|
||||||
resizable?: boolean;
|
|
||||||
/** 最小宽度,默认 200 */
|
|
||||||
minWidth?: number;
|
|
||||||
/** 最小高度,默认 200 */
|
|
||||||
minHeight?: number;
|
|
||||||
/** 是否允许弹出框收折 */
|
|
||||||
collapsable?: boolean;
|
|
||||||
/** 弹出框的按钮定义集合 */
|
|
||||||
buttons?: PopupButton[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 遮罩层显示或者隐藏时的回调函数
|
|
||||||
* @param this 当前 popup 对象
|
|
||||||
* @param masking 显示或隐藏遮罩层
|
|
||||||
*/
|
|
||||||
onMasking?: (this: Popup, masking: boolean) => void;
|
|
||||||
/**
|
|
||||||
* 移动结束时的回调函数
|
|
||||||
* @param this 当前 popup 对象
|
|
||||||
*/
|
|
||||||
onMoveEnded?: (this: Popup) => void;
|
|
||||||
/**
|
|
||||||
* 修改大小开始时的回调函数
|
|
||||||
* @param this 当前 popup 对象
|
|
||||||
*/
|
|
||||||
onResizeStarted?: (this: Popup) => void;
|
|
||||||
/**
|
|
||||||
* 修改大小中的回调函数
|
|
||||||
* @param this 当前 popup 对象
|
|
||||||
* @param x 坐标 x
|
|
||||||
* @param y 坐标 y
|
|
||||||
* @param width 当前宽度
|
|
||||||
* @param height 当前高度
|
|
||||||
*/
|
|
||||||
onResizing?: (this: Popup, x: number, y: number, width: number, height: number) => void;
|
|
||||||
/**
|
|
||||||
* 修改大小结束时的回调函数
|
|
||||||
* @param this 当前 popup 对象
|
|
||||||
*/
|
|
||||||
onResizeEnded?: (this: Popup) => void;
|
|
||||||
/**
|
|
||||||
* 弹出框关闭时的回调函数
|
|
||||||
*/
|
|
||||||
resolve?: (this: Popup, result: { result: any, popup: Popup }) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Popup {
|
|
||||||
constructor(opts?: PopupOptions);
|
|
||||||
|
|
||||||
get container(): HTMLElement;
|
|
||||||
|
|
||||||
get title(): string;
|
|
||||||
set title(title: string);
|
|
||||||
|
|
||||||
get loading(): boolean;
|
|
||||||
set loading(flag: boolean);
|
|
||||||
|
|
||||||
get rect(): { collapsed: boolean, left: number, top: number, width: number, height: number };
|
|
||||||
set rect(r: { collapsed?: boolean, left?: number, top?: number, width?: number, height?: number });
|
|
||||||
|
|
||||||
close(result?: any, animation?: boolean): void;
|
|
||||||
create(): HTMLDivElement;
|
|
||||||
show(parent?: HTMLElement, hidden?: boolean): Promise<HTMLElement> | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PopupButton {
|
|
||||||
className?: string;
|
|
||||||
tabIndex?: number;
|
|
||||||
key: string;
|
|
||||||
text: string;
|
|
||||||
trigger: (this: Popup) => boolean | Promise<boolean>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PopupIconTypes {
|
|
||||||
'info': 'info-circle';
|
|
||||||
'information': 'info-circle';
|
|
||||||
'warn': 'exclamation-triangle';
|
|
||||||
'warning': 'exclamation-triangle';
|
|
||||||
'question': 'question-circle';
|
|
||||||
'error': 'times-circle';
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PopupButtonResult {
|
|
||||||
result: string;
|
|
||||||
popup: Popup;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createPopup(title: string | HTMLElement, content: string | HTMLElement, ...buttons: PopupButton[]): Popup
|
|
||||||
|
|
||||||
export function resolvePopup(wrapper: string | HTMLElement, callback?: Function, removable?: boolean, zIndex?: number): Popup
|
|
||||||
|
|
||||||
export function showAlert(title: string | HTMLElement, message: string, iconType?: keyof PopupIconTypes, parent?: HTMLElement): Promise<void>
|
|
||||||
|
|
||||||
export function showConfirm(title: string | HTMLElement, content: string | HTMLElement, buttons: PopupButton[], iconType?: keyof PopupIconTypes, parent?: HTMLElement): Promise<PopupButtonResult>
|
|
||||||
+29
-10
@@ -610,13 +610,10 @@ export function showAlert(title, message, iconType = 'info', parent = document.b
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showInput(title, multiline, message, def, placeholder, buttons, parent = document.body) {
|
export function showInput(title, multiline, message, options, buttons, parent = document.body) {
|
||||||
const r = typeof GetTextByKey === 'function' ? GetTextByKey : lang;
|
const r = typeof GetTextByKey === 'function' ? GetTextByKey : lang;
|
||||||
|
options ??= {};
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));
|
|
||||||
if (tabIndex < 0) {
|
|
||||||
tabIndex = 0;
|
|
||||||
}
|
|
||||||
const input = multiline ?
|
const input = multiline ?
|
||||||
createElement('textarea', text => {
|
createElement('textarea', text => {
|
||||||
text.className = 'ui-text';
|
text.className = 'ui-text';
|
||||||
@@ -625,12 +622,34 @@ export function showInput(title, multiline, message, def, placeholder, buttons,
|
|||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
input.className = 'ui-input';
|
input.className = 'ui-input';
|
||||||
});
|
});
|
||||||
input.tabIndex = tabIndex + 4;
|
for (let key of Object.keys(options)) {
|
||||||
if (!nullOrEmpty(placeholder)) {
|
switch (key) {
|
||||||
input.placeholder = placeholder;
|
case 'tabIndex':
|
||||||
|
if (!isNaN(options.tabIndex)) {
|
||||||
|
input.tabIndex = options.tabIndex;
|
||||||
}
|
}
|
||||||
if (!nullOrEmpty(def)) {
|
break;
|
||||||
input.value = def;
|
case 'default':
|
||||||
|
if (!nullOrEmpty(options.default)) {
|
||||||
|
input.value = options.default;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'placeholder':
|
||||||
|
if (!nullOrEmpty(options.placeholder)) {
|
||||||
|
input.placeholder = options.placeholder;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
input[key] = options[key];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNaN(options.tabIndex)) {
|
||||||
|
let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));
|
||||||
|
if (tabIndex < 0) {
|
||||||
|
tabIndex = 0;
|
||||||
|
}
|
||||||
|
input.tabIndex = tabIndex + 4;
|
||||||
}
|
}
|
||||||
const popup = new Popup({
|
const popup = new Popup({
|
||||||
title,
|
title,
|
||||||
|
|||||||
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* 为元素设置一个 tooltip
|
|
||||||
* @param container 要设置 tooltip 的容器元素
|
|
||||||
* @param content 提示内容,可以是字符串也可以是 html 元素
|
|
||||||
* @param [flag=true] 是否仅在元素内容没有呈现完全时显示 tooltip
|
|
||||||
* @param [parent=null] 呈现在哪个父元素上,默认添加在 `container` 末端
|
|
||||||
*/
|
|
||||||
export function setTooltip(container: HTMLElement, content: string | HTMLElement, flag?: boolean, parent?: HTMLElement): HTMLElement
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析容器元素内符合条件的子元素,为其添加 tooltip
|
|
||||||
* @param container 容器元素
|
|
||||||
* @example
|
|
||||||
* ```
|
|
||||||
* <span title="tooltip text"></span>
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export function resolveTooltip(container?: HTMLElement): HTMLElement
|
|
||||||
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
export function getCookie(name: string): string
|
|
||||||
export function setCookie(name: string, value: string, expireDays?: Number, host?: string, encode?: boolean): void
|
|
||||||
export function deleteCookie(name: string): void
|
|
||||||
Vendored
-16
@@ -1,16 +0,0 @@
|
|||||||
interface LgresOptions {
|
|
||||||
template?: string,
|
|
||||||
callback?: (result: any) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageResource {
|
|
||||||
r(key: string, defaultValue?: any): any
|
|
||||||
}
|
|
||||||
|
|
||||||
export function init(dom?: HTMLElement, options?: LgresOptions): Promise<LanguageResource>
|
|
||||||
export function r(key: string, defaultValue?: any): any
|
|
||||||
export const lang: {
|
|
||||||
get current(): string,
|
|
||||||
get unknownError(): string,
|
|
||||||
get savedSuccessfully(): string
|
|
||||||
}
|
|
||||||
Vendored
-13
@@ -1,13 +0,0 @@
|
|||||||
interface RequestOptions {
|
|
||||||
method?: string;
|
|
||||||
accept?: string;
|
|
||||||
contentType?: string;
|
|
||||||
customHeaders?: { [key: string]: string };
|
|
||||||
mode?: RequestMode | undefined;
|
|
||||||
signal?: AbortSignal | null;
|
|
||||||
progress?: (this: XMLHttpRequestUpload, ev: ProgressEvent<XMLHttpRequestEventTarget>) => any
|
|
||||||
}
|
|
||||||
|
|
||||||
export function get(url: string, options?: RequestOptions): Promise<Response>
|
|
||||||
export function post(url: string, data?: BodyInit | null, options?: RequestOptions): Promise<Response>
|
|
||||||
export function upload(url: string, data: FormData, options?: RequestOptions): Promise<XMLHttpRequest>
|
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
export function nullOrEmpty(s?: string | any | null): boolean
|
|
||||||
export function contains(s: string, key: string | any, ignoreCase?: boolean): boolean
|
|
||||||
export function endsWith(s: string, suffix: string): boolean
|
|
||||||
export function padStart(s: string, num: Number, char: string): boolean
|
|
||||||
export function formatUrl(msg: string): string
|
|
||||||
export function escapeHtml(text: string): string
|
|
||||||
export function escapeEmoji(text: string): string
|
|
||||||
Generated
-3735
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user