zartui 3.1.2 → 3.1.4
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/README.md +25 -0
- package/es/cascader/index.css +1 -1
- package/es/date-time-picker/DateTimePickerWrapper.mjs +6 -4
- package/es/date-time-picker/utils.d.ts +1 -0
- package/es/date-time-picker/utils.mjs +11 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/lazyload/vue-lazyload/index.d.ts +55 -55
- package/es/radio-picker/RadioPicker.d.ts +207 -0
- package/es/radio-picker/RadioPicker.mjs +290 -0
- package/es/radio-picker/RadioPickerColumn.d.ts +70 -0
- package/es/radio-picker/RadioPickerColumn.mjs +237 -0
- package/es/radio-picker/RadioPickerToolbar.d.ts +18 -0
- package/es/radio-picker/RadioPickerToolbar.mjs +54 -0
- package/es/radio-picker/index.css +1 -0
- package/es/radio-picker/index.d.ts +136 -0
- package/es/radio-picker/index.mjs +10 -0
- package/es/radio-picker/style/index.d.ts +1 -0
- package/es/radio-picker/style/index.mjs +16 -0
- package/es/radio-picker/types.d.ts +44 -0
- package/es/radio-picker/types.mjs +0 -0
- package/es/radio-picker/utils.d.ts +13 -0
- package/es/radio-picker/utils.mjs +80 -0
- package/es/utils/debounce.d.ts +46 -0
- package/es/utils/debounce.mjs +65 -0
- package/es/vue-sfc-shim.d.ts +6 -6
- package/es/vue-tsx-shim.d.ts +23 -23
- package/lib/cascader/index.css +1 -1
- package/lib/date-time-picker/DateTimePickerWrapper.js +5 -3
- package/lib/date-time-picker/utils.d.ts +1 -0
- package/lib/date-time-picker/utils.js +10 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
- package/lib/radio-picker/RadioPicker.d.ts +207 -0
- package/lib/radio-picker/RadioPicker.js +319 -0
- package/lib/radio-picker/RadioPickerColumn.d.ts +70 -0
- package/lib/radio-picker/RadioPickerColumn.js +266 -0
- package/lib/radio-picker/RadioPickerToolbar.d.ts +18 -0
- package/lib/radio-picker/RadioPickerToolbar.js +73 -0
- package/lib/radio-picker/index.css +1 -0
- package/lib/radio-picker/index.d.ts +136 -0
- package/lib/radio-picker/index.js +39 -0
- package/lib/radio-picker/style/index.d.ts +1 -0
- package/lib/radio-picker/style/index.js +16 -0
- package/lib/radio-picker/types.d.ts +44 -0
- package/lib/radio-picker/types.js +15 -0
- package/lib/radio-picker/utils.d.ts +13 -0
- package/lib/radio-picker/utils.js +99 -0
- package/lib/utils/debounce.d.ts +46 -0
- package/lib/utils/debounce.js +84 -0
- package/lib/vue-sfc-shim.d.ts +6 -6
- package/lib/vue-tsx-shim.d.ts +23 -23
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +1676 -999
- package/lib/zartui.es.js +1676 -999
- package/lib/zartui.js +1682 -1005
- package/lib/zartui.min.js +1 -1
- package/package.json +67 -67
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var stdin_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { Numeric } from '../utils';
|
|
3
|
+
import type { PickerColumn, PickerFieldNames, RadioPickerOption } from './types';
|
|
4
|
+
declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods, t: (path: string, ...args: unknown[]) => any;
|
|
5
|
+
export { bem, name, t };
|
|
6
|
+
export declare const getFirstEnabledOption: (options: RadioPickerOption[]) => RadioPickerOption | undefined;
|
|
7
|
+
export declare function getColumnsType(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>): "default" | "multiple" | "cascade";
|
|
8
|
+
export declare function findIndexOfEnabledOption(options: RadioPickerOption[], index: number): number;
|
|
9
|
+
export declare const isOptionExist: (options: RadioPickerOption[], value: Numeric | undefined, fields: Required<PickerFieldNames>) => boolean;
|
|
10
|
+
export declare function findOptionByValue(options: RadioPickerOption[], value: Numeric, fields: Required<PickerFieldNames>): RadioPickerOption | undefined;
|
|
11
|
+
export declare function formatCascadeColumns(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>, selectedValues: Ref<Numeric[]>): PickerColumn[];
|
|
12
|
+
export declare function getElementTranslateY(element: Element): number;
|
|
13
|
+
export declare function assignDefaultFields(fields: PickerFieldNames | undefined): Required<PickerFieldNames>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name2 in all)
|
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
assignDefaultFields: () => assignDefaultFields,
|
|
21
|
+
bem: () => bem,
|
|
22
|
+
findIndexOfEnabledOption: () => findIndexOfEnabledOption,
|
|
23
|
+
findOptionByValue: () => findOptionByValue,
|
|
24
|
+
formatCascadeColumns: () => formatCascadeColumns,
|
|
25
|
+
getColumnsType: () => getColumnsType,
|
|
26
|
+
getElementTranslateY: () => getElementTranslateY,
|
|
27
|
+
getFirstEnabledOption: () => getFirstEnabledOption,
|
|
28
|
+
isOptionExist: () => isOptionExist,
|
|
29
|
+
name: () => name,
|
|
30
|
+
t: () => t
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
33
|
+
var import_utils = require("../utils");
|
|
34
|
+
const [name, bem, t] = (0, import_utils.createNamespace)("radio-picker");
|
|
35
|
+
const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
|
|
36
|
+
function getColumnsType(columns, fields) {
|
|
37
|
+
const firstColumn = columns[0];
|
|
38
|
+
if (firstColumn) {
|
|
39
|
+
if (Array.isArray(firstColumn)) {
|
|
40
|
+
return "multiple";
|
|
41
|
+
}
|
|
42
|
+
if (fields.children in firstColumn) {
|
|
43
|
+
return "cascade";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return "default";
|
|
47
|
+
}
|
|
48
|
+
function findIndexOfEnabledOption(options, index) {
|
|
49
|
+
index = (0, import_utils.clamp)(index, 0, options.length);
|
|
50
|
+
for (let i = index; i < options.length; i++) {
|
|
51
|
+
if (!options[i].disabled)
|
|
52
|
+
return i;
|
|
53
|
+
}
|
|
54
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
55
|
+
if (!options[i].disabled)
|
|
56
|
+
return i;
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
|
|
61
|
+
function findOptionByValue(options, value, fields) {
|
|
62
|
+
const index = options.findIndex((option) => option[fields.value] === value);
|
|
63
|
+
const enabledIndex = findIndexOfEnabledOption(options, index);
|
|
64
|
+
return options[enabledIndex];
|
|
65
|
+
}
|
|
66
|
+
function formatCascadeColumns(columns, fields, selectedValues) {
|
|
67
|
+
const formatted = [];
|
|
68
|
+
let cursor = {
|
|
69
|
+
[fields.children]: columns
|
|
70
|
+
};
|
|
71
|
+
let columnIndex = 0;
|
|
72
|
+
while (cursor && cursor[fields.children]) {
|
|
73
|
+
const options = cursor[fields.children];
|
|
74
|
+
const value = selectedValues.value[columnIndex];
|
|
75
|
+
cursor = (0, import_utils.isDef)(value) ? findOptionByValue(options, value, fields) : void 0;
|
|
76
|
+
if (!cursor && options.length) {
|
|
77
|
+
const firstValue = getFirstEnabledOption(options)[fields.value];
|
|
78
|
+
cursor = findOptionByValue(options, firstValue, fields);
|
|
79
|
+
}
|
|
80
|
+
columnIndex++;
|
|
81
|
+
formatted.push(options);
|
|
82
|
+
}
|
|
83
|
+
return formatted;
|
|
84
|
+
}
|
|
85
|
+
function getElementTranslateY(element) {
|
|
86
|
+
const { transform } = window.getComputedStyle(element);
|
|
87
|
+
const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
|
|
88
|
+
return Number(translateY);
|
|
89
|
+
}
|
|
90
|
+
function assignDefaultFields(fields) {
|
|
91
|
+
return (0, import_utils.extend)(
|
|
92
|
+
{
|
|
93
|
+
text: "text",
|
|
94
|
+
value: "value",
|
|
95
|
+
children: "children"
|
|
96
|
+
},
|
|
97
|
+
fields
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
|
|
3
|
+
fn: FunctionArgs<Args, This>;
|
|
4
|
+
args: Args;
|
|
5
|
+
thisArg: This;
|
|
6
|
+
}
|
|
7
|
+
export type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promise<ReturnType<Invoke>>;
|
|
8
|
+
export type AnyFn = (...args: any[]) => any;
|
|
9
|
+
export type MaybeRef<T> = T | Ref<T>;
|
|
10
|
+
export type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
|
|
11
|
+
export type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
12
|
+
export type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
13
|
+
export type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
14
|
+
export interface DebounceFilterOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The maximum time allowed to be delayed before it's invoked.
|
|
17
|
+
* In milliseconds.
|
|
18
|
+
*/
|
|
19
|
+
maxWait?: MaybeRefOrGetter<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to reject the last call if it's been cancel.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
rejectOnCancel?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the value of value/ref/getter.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toValue<T>(r: MaybeRefOrGetter<T>): T;
|
|
31
|
+
/**
|
|
32
|
+
* Create an EventFilter that debounce the events
|
|
33
|
+
*/
|
|
34
|
+
export declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
|
|
35
|
+
export declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
|
|
36
|
+
/**
|
|
37
|
+
* Debounce execution of a function.
|
|
38
|
+
*
|
|
39
|
+
* @see https://vueuse.org/useDebounceFn
|
|
40
|
+
* @param fn A function to be executed after delay milliseconds debounced.
|
|
41
|
+
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
42
|
+
* @param opts options
|
|
43
|
+
*
|
|
44
|
+
* @return A new, debounce, function.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): PromisifyFn<T>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
createFilterWrapper: () => createFilterWrapper,
|
|
21
|
+
debounceFilter: () => debounceFilter,
|
|
22
|
+
toValue: () => toValue,
|
|
23
|
+
useDebounceFn: () => useDebounceFn
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
26
|
+
var import_vue = require("vue");
|
|
27
|
+
var import_utils = require("../utils");
|
|
28
|
+
function toValue(r) {
|
|
29
|
+
return typeof r === "function" ? r() : (0, import_vue.unref)(r);
|
|
30
|
+
}
|
|
31
|
+
function debounceFilter(ms, options = {}) {
|
|
32
|
+
let timer;
|
|
33
|
+
let maxTimer;
|
|
34
|
+
let lastRejector = import_utils.noop;
|
|
35
|
+
const _clearTimeout = (timer2) => {
|
|
36
|
+
clearTimeout(timer2);
|
|
37
|
+
lastRejector();
|
|
38
|
+
lastRejector = import_utils.noop;
|
|
39
|
+
};
|
|
40
|
+
const filter = (invoke) => {
|
|
41
|
+
const duration = toValue(ms);
|
|
42
|
+
const maxDuration = toValue(options.maxWait);
|
|
43
|
+
if (timer)
|
|
44
|
+
_clearTimeout(timer);
|
|
45
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
46
|
+
if (maxTimer) {
|
|
47
|
+
_clearTimeout(maxTimer);
|
|
48
|
+
maxTimer = null;
|
|
49
|
+
}
|
|
50
|
+
return Promise.resolve(invoke());
|
|
51
|
+
}
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
54
|
+
if (maxDuration && !maxTimer) {
|
|
55
|
+
maxTimer = setTimeout(() => {
|
|
56
|
+
if (timer)
|
|
57
|
+
_clearTimeout(timer);
|
|
58
|
+
maxTimer = null;
|
|
59
|
+
resolve(invoke());
|
|
60
|
+
}, maxDuration);
|
|
61
|
+
}
|
|
62
|
+
timer = setTimeout(() => {
|
|
63
|
+
if (maxTimer)
|
|
64
|
+
_clearTimeout(maxTimer);
|
|
65
|
+
maxTimer = null;
|
|
66
|
+
resolve(invoke());
|
|
67
|
+
}, duration);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return filter;
|
|
71
|
+
}
|
|
72
|
+
function createFilterWrapper(filter, fn) {
|
|
73
|
+
function wrapper(...args) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
Promise.resolve(
|
|
76
|
+
filter(() => fn.apply(this, args), { fn, thisArg: this, args })
|
|
77
|
+
).then(resolve).catch(reject);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return wrapper;
|
|
81
|
+
}
|
|
82
|
+
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
83
|
+
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
84
|
+
}
|
package/lib/vue-sfc-shim.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare module '*.vue' {
|
|
2
|
-
// eslint-disable-next-line
|
|
3
|
-
import { DefineComponent } from 'vue';
|
|
4
|
-
const Component: DefineComponent;
|
|
5
|
-
export default Component;
|
|
6
|
-
}
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
// eslint-disable-next-line
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
const Component: DefineComponent;
|
|
5
|
+
export default Component;
|
|
6
|
+
}
|
package/lib/vue-tsx-shim.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import 'vue';
|
|
2
|
-
|
|
3
|
-
type EventHandler = (...args: any[]) => void;
|
|
4
|
-
|
|
5
|
-
declare module 'vue' {
|
|
6
|
-
interface ComponentCustomProps {
|
|
7
|
-
id?: string;
|
|
8
|
-
role?: string;
|
|
9
|
-
tabindex?: number;
|
|
10
|
-
onClick?: EventHandler;
|
|
11
|
-
onTouchend?: EventHandler;
|
|
12
|
-
onTouchmove?: EventHandler;
|
|
13
|
-
onTouchstart?: EventHandler;
|
|
14
|
-
onTouchcancel?: EventHandler;
|
|
15
|
-
onTouchmovePassive?: EventHandler;
|
|
16
|
-
onTouchstartPassive?: EventHandler;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface HTMLAttributes {
|
|
20
|
-
onTouchmovePassive?: EventHandler;
|
|
21
|
-
onTouchstartPassive?: EventHandler;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
import 'vue';
|
|
2
|
+
|
|
3
|
+
type EventHandler = (...args: any[]) => void;
|
|
4
|
+
|
|
5
|
+
declare module 'vue' {
|
|
6
|
+
interface ComponentCustomProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
tabindex?: number;
|
|
10
|
+
onClick?: EventHandler;
|
|
11
|
+
onTouchend?: EventHandler;
|
|
12
|
+
onTouchmove?: EventHandler;
|
|
13
|
+
onTouchstart?: EventHandler;
|
|
14
|
+
onTouchcancel?: EventHandler;
|
|
15
|
+
onTouchmovePassive?: EventHandler;
|
|
16
|
+
onTouchstartPassive?: EventHandler;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface HTMLAttributes {
|
|
20
|
+
onTouchmovePassive?: EventHandler;
|
|
21
|
+
onTouchstartPassive?: EventHandler;
|
|
22
|
+
}
|
|
23
|
+
}
|