@opentiny/vue-search-box 0.1.6 → 2.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/index.css → index.css} +22 -19
- package/index.js +2804 -0
- package/index.js.map +1 -0
- package/package.json +38 -56
- package/README.md +0 -134
- package/README.zh-CN.md +0 -135
- package/dist/es/components/first-level-panel.vue.es.js +0 -4
- package/dist/es/components/first-level-panel.vue.es2.js +0 -177
- package/dist/es/components/second-level-panel.vue.es.js +0 -4
- package/dist/es/components/second-level-panel.vue.es2.js +0 -466
- package/dist/es/composables/use-checkbox.es.js +0 -74
- package/dist/es/composables/use-custom.es.js +0 -49
- package/dist/es/composables/use-datepicker.es.js +0 -86
- package/dist/es/composables/use-dropdown.es.js +0 -216
- package/dist/es/composables/use-edit.es.js +0 -108
- package/dist/es/composables/use-init.es.js +0 -78
- package/dist/es/composables/use-match.es.js +0 -170
- package/dist/es/composables/use-num-range.es.js +0 -77
- package/dist/es/composables/use-placeholder.es.js +0 -41
- package/dist/es/composables/use-tag.es.js +0 -56
- package/dist/es/index-Tlzvfwv-.css +0 -401
- package/dist/es/index.es.js +0 -45
- package/dist/es/index.type.es.js +0 -1
- package/dist/es/index.vue.es.js +0 -4
- package/dist/es/index.vue.es2.js +0 -780
- package/dist/es/smb-theme.es.js +0 -18
- package/dist/es/utils/clone.es.js +0 -29
- package/dist/es/utils/date.es.js +0 -431
- package/dist/es/utils/dropdown.es.js +0 -24
- package/dist/es/utils/en_US.es.js +0 -45
- package/dist/es/utils/index.es.js +0 -13
- package/dist/es/utils/tag.es.js +0 -44
- package/dist/es/utils/type.es.js +0 -4
- package/dist/es/utils/validate.es.js +0 -179
- package/dist/es/utils/zh_CN.es.js +0 -45
- package/dist/lib/components/first-level-panel.vue.cjs.js +0 -4
- package/dist/lib/components/first-level-panel.vue.cjs2.js +0 -177
- package/dist/lib/components/second-level-panel.vue.cjs.js +0 -4
- package/dist/lib/components/second-level-panel.vue.cjs2.js +0 -466
- package/dist/lib/composables/use-checkbox.cjs.js +0 -74
- package/dist/lib/composables/use-custom.cjs.js +0 -49
- package/dist/lib/composables/use-datepicker.cjs.js +0 -86
- package/dist/lib/composables/use-dropdown.cjs.js +0 -216
- package/dist/lib/composables/use-edit.cjs.js +0 -108
- package/dist/lib/composables/use-init.cjs.js +0 -78
- package/dist/lib/composables/use-match.cjs.js +0 -170
- package/dist/lib/composables/use-num-range.cjs.js +0 -77
- package/dist/lib/composables/use-placeholder.cjs.js +0 -41
- package/dist/lib/composables/use-tag.cjs.js +0 -56
- package/dist/lib/index-Tlzvfwv-.css +0 -401
- package/dist/lib/index.cjs.js +0 -45
- package/dist/lib/index.type.cjs.js +0 -1
- package/dist/lib/index.vue.cjs.js +0 -4
- package/dist/lib/index.vue.cjs2.js +0 -780
- package/dist/lib/smb-theme.cjs.js +0 -18
- package/dist/lib/utils/clone.cjs.js +0 -29
- package/dist/lib/utils/date.cjs.js +0 -431
- package/dist/lib/utils/dropdown.cjs.js +0 -24
- package/dist/lib/utils/en_US.cjs.js +0 -45
- package/dist/lib/utils/index.cjs.js +0 -13
- package/dist/lib/utils/tag.cjs.js +0 -44
- package/dist/lib/utils/type.cjs.js +0 -4
- package/dist/lib/utils/validate.cjs.js +0 -179
- package/dist/lib/utils/zh_CN.cjs.js +0 -45
- package/dist/types/composables/use-checkbox.d.ts +0 -8
- package/dist/types/composables/use-custom.d.ts +0 -7
- package/dist/types/composables/use-datepicker.d.ts +0 -11
- package/dist/types/composables/use-dropdown.d.ts +0 -14
- package/dist/types/composables/use-edit.d.ts +0 -13
- package/dist/types/composables/use-init.d.ts +0 -10
- package/dist/types/composables/use-match.d.ts +0 -8
- package/dist/types/composables/use-num-range.d.ts +0 -9
- package/dist/types/composables/use-placeholder.d.ts +0 -8
- package/dist/types/composables/use-tag.d.ts +0 -9
- package/dist/types/smb-theme.d.ts +0 -15
- package/dist/types/utils/clone.d.ts +0 -12
- package/dist/types/utils/date.d.ts +0 -234
- package/dist/types/utils/dropdown.d.ts +0 -12
- package/dist/types/utils/en_US.d.ts +0 -43
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/tag.d.ts +0 -46
- package/dist/types/utils/type.d.ts +0 -6
- package/dist/types/utils/validate.d.ts +0 -31
- package/dist/types/utils/zh_CN.d.ts +0 -43
- /package/{dist/types → types}/index.type.d.ts +0 -0
package/dist/es/smb-theme.es.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const tvpSearchBoxSmbTheme = {
|
|
2
|
-
"tvp-search-box-right-search-icon-display": "none",
|
|
3
|
-
"tvp-search-box-left-icon-display": "inline",
|
|
4
|
-
"tvp-search-box-help-icon-margin-right": "var(--ti-common-space-0)",
|
|
5
|
-
"tvp-search-box-padding-left": "var(--ti-common-space-8x)",
|
|
6
|
-
"tvp-search-box-close-icon-margin-right": "var(--ti-common-space-base)",
|
|
7
|
-
"tvp-search-box-separator-icon-margin-right": "var(--ti-common-space-base)",
|
|
8
|
-
"tvp-search-box-dropdown-btn-group-margin-top": "var(--ti-common-space-2x)",
|
|
9
|
-
"tvp-search-box-dropdown-btn-group-padding-top": "var(--ti-common-space-4x)",
|
|
10
|
-
"tvp-search-box-dropdown-btn-group-padding-bottom": "var(--ti-common-space-2x)",
|
|
11
|
-
"tvp-search-box-dropdown-btn-min-width": "var(--ti-common-size-18x)",
|
|
12
|
-
"tvp-search-box-dropdown-padding-vertical": "var(--ti-common-space-4x)",
|
|
13
|
-
"tvp-search-box-input-padding-left": "var(--ti-common-space-0)",
|
|
14
|
-
"tvp-search-box-dropdown-header-text-color": "var(--ti-common-color-border)"
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
tvpSearchBoxSmbTheme
|
|
18
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const deepClone = (obj) => {
|
|
2
|
-
const objClone = Array.isArray(obj) ? [] : {};
|
|
3
|
-
if (obj && typeof obj === "object") {
|
|
4
|
-
const keys = Object.keys(obj);
|
|
5
|
-
if (keys.length) {
|
|
6
|
-
keys.forEach((key) => {
|
|
7
|
-
if (obj[key] && typeof obj[key] === "object") {
|
|
8
|
-
objClone[key] = deepClone(obj[key]);
|
|
9
|
-
} else {
|
|
10
|
-
objClone[key] = obj[key];
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
return obj;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return objClone;
|
|
18
|
-
};
|
|
19
|
-
const omitObj = (obj, keysToOmit = ["mergeTag", "options", "idMapKey"]) => {
|
|
20
|
-
const result = { ...obj };
|
|
21
|
-
keysToOmit.forEach((key) => {
|
|
22
|
-
delete result[key];
|
|
23
|
-
});
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
deepClone,
|
|
28
|
-
omitObj
|
|
29
|
-
};
|
package/dist/es/utils/date.es.js
DELETED
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
const fillChar = (string, length, append, chr = "0") => {
|
|
2
|
-
if (typeof string === "string" && typeof chr === "string" && isNumber(length)) {
|
|
3
|
-
let len = string.length - length;
|
|
4
|
-
if (len > 0) {
|
|
5
|
-
return append ? string.substr(0, length) : string.substr(len, length);
|
|
6
|
-
} else {
|
|
7
|
-
const appendStr = [];
|
|
8
|
-
len = Math.abs(len) / chr.length;
|
|
9
|
-
for (; len > 0; len--) {
|
|
10
|
-
appendStr.push(chr);
|
|
11
|
-
}
|
|
12
|
-
const s = appendStr.join("");
|
|
13
|
-
return append ? string + s : s + string;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const toString = Object.prototype.toString;
|
|
18
|
-
const hasOwn = Object.prototype.hasOwnProperty;
|
|
19
|
-
const getProto = Object.getPrototypeOf;
|
|
20
|
-
const fnToString = hasOwn.toString;
|
|
21
|
-
const ObjectFunctionString = fnToString.call(Object);
|
|
22
|
-
const class2type = {
|
|
23
|
-
"[object Error]": "error",
|
|
24
|
-
"[object Object]": "object",
|
|
25
|
-
"[object RegExp]": "regExp",
|
|
26
|
-
"[object Date]": "date",
|
|
27
|
-
"[object Array]": "array",
|
|
28
|
-
"[object Function]": "function",
|
|
29
|
-
"[object AsyncFunction]": "asyncFunction",
|
|
30
|
-
"[object String]": "string",
|
|
31
|
-
"[object Number]": "number",
|
|
32
|
-
"[object Boolean]": "boolean"
|
|
33
|
-
};
|
|
34
|
-
const isNull = (x) => x === null || x === void 0;
|
|
35
|
-
const typeOf = (obj) => isNull(obj) ? String(obj) : class2type[toString.call(obj)] || "object";
|
|
36
|
-
const isObject = (obj) => typeOf(obj) === "object";
|
|
37
|
-
const isFunction = (fn) => ["asyncFunction", "function"].includes(typeOf(fn));
|
|
38
|
-
const isPlainObject = (obj) => {
|
|
39
|
-
if (!obj || toString.call(obj) !== "[object Object]") {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const proto = getProto(obj);
|
|
43
|
-
if (!proto) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
const Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
47
|
-
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
|
|
48
|
-
};
|
|
49
|
-
const isEmptyObject = (obj) => {
|
|
50
|
-
const type = typeOf(obj);
|
|
51
|
-
if (type === "object" || type === "array") {
|
|
52
|
-
for (const name in obj) {
|
|
53
|
-
if (hasOwn.call(obj, name)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return true;
|
|
59
|
-
};
|
|
60
|
-
const isNumber = (value) => typeof value === "number" && isFinite(value);
|
|
61
|
-
const isNumeric = (value) => value - parseFloat(value) >= 0;
|
|
62
|
-
const isDate = (value) => typeOf(value) === "date";
|
|
63
|
-
const isSame = (x, y) => x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y);
|
|
64
|
-
const isRegExp = (value) => typeOf(value) === "regExp";
|
|
65
|
-
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
66
|
-
const daysInMonths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
67
|
-
const yyyymmddReg = new RegExp(
|
|
68
|
-
"^(\\d{4})(/|-)(((0)?[1-9])|(1[0-2]))((/|-)(((0)?[1-9])|([1-2][0-9])|(3[0-1])))?( ((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?$"
|
|
69
|
-
);
|
|
70
|
-
const mmddyyyyReg = new RegExp(
|
|
71
|
-
"^(((0)?[1-9])|(1[0-2]))(/|-)(((0)?[1-9])|([1-2][0-9])|(3[0-1]))?(/|-)?(\\d{4})( ((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?$"
|
|
72
|
-
);
|
|
73
|
-
const iso8601Reg = new RegExp(
|
|
74
|
-
"^(\\d{4})-(((0)?[1-9])|(1[0-2]))-(((0)?[1-9])|([1-2][0-9])|(3[0-1]))T(((0)?[0-9]|1[0-9]|20|21|22|23):([0-5]?[0-9])((:([0-5]?[0-9]))?(.([0-9]{1,6}))?)?)?(Z|([+-])((0)?[0-9]|1[0-9]|20|21|22|23):?([0-5]?[0-9]))$"
|
|
75
|
-
);
|
|
76
|
-
const dateFormatRegs = {
|
|
77
|
-
"y{1,4}": /y{1,4}/,
|
|
78
|
-
"M{1,2}": /M{1,2}/,
|
|
79
|
-
"d{1,2}": /d{1,2}/,
|
|
80
|
-
"h{1,2}": /h{1,2}/,
|
|
81
|
-
"H{1,2}": /H{1,2}/,
|
|
82
|
-
"m{1,2}": /m{1,2}/,
|
|
83
|
-
"s{1,2}": /s{1,2}/,
|
|
84
|
-
"S{1,3}": /S{1,3}/,
|
|
85
|
-
"Z{1,1}": /Z{1,1}/
|
|
86
|
-
};
|
|
87
|
-
const maxDateValues = {
|
|
88
|
-
YEAR: 9999,
|
|
89
|
-
MONTH: 11,
|
|
90
|
-
DATE: 31,
|
|
91
|
-
HOUR: 23,
|
|
92
|
-
MINUTE: 59,
|
|
93
|
-
SECOND: 59,
|
|
94
|
-
MILLISECOND: 999
|
|
95
|
-
};
|
|
96
|
-
const timezone1 = "-12:00,-11:00,-10:00,-09:30,-08:00,-07:00,-06:00,-05:00,-04:30,-04:00,-03:30,-02:00,-01:00";
|
|
97
|
-
const timezone2 = "-00:00,+00:00,+01:00,+02:00,+03:00,+03:30,+04:00,+04:30,+05:00,+05:30,+05:45,+06:00";
|
|
98
|
-
const timezone3 = "+06:30,+07:00,+08:00,+09:00,+10:00,+10:30,+11:00,+11:30,+12:00,+12:45,+13:00,+14:00";
|
|
99
|
-
const timezones = [].concat(timezone1.split(","), timezone2.split(","), timezone3.split(","));
|
|
100
|
-
const getTimezone = (date) => {
|
|
101
|
-
const timezoneoffset = 0 - date.getTimezoneOffset() / 60;
|
|
102
|
-
let timezone;
|
|
103
|
-
if (timezoneoffset === 0) {
|
|
104
|
-
timezone = "Z";
|
|
105
|
-
} else if (timezoneoffset > 0) {
|
|
106
|
-
timezone = "+" + (timezoneoffset > 10 ? timezoneoffset : "0" + timezoneoffset) + "00";
|
|
107
|
-
} else {
|
|
108
|
-
timezone = (timezoneoffset < -10 ? timezoneoffset : "-0" + -timezoneoffset) + "00";
|
|
109
|
-
}
|
|
110
|
-
return timezone;
|
|
111
|
-
};
|
|
112
|
-
const isLeapYear = (year) => year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
113
|
-
const getMilliseconds = (milliseconds) => milliseconds > maxDateValues.MILLISECOND ? Number(String(milliseconds).substring(0, 3)) : milliseconds;
|
|
114
|
-
const getDateFromData = ({ year, month, date, hours, minutes, seconds, milliseconds }) => {
|
|
115
|
-
let daysInMonth = daysInMonths[month];
|
|
116
|
-
if (isLeapYear(year) && month === 1) {
|
|
117
|
-
daysInMonth += 1;
|
|
118
|
-
}
|
|
119
|
-
if (date <= daysInMonth) {
|
|
120
|
-
return new Date(year, month, date, hours, minutes, seconds, getMilliseconds(milliseconds));
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const yyyymmddDateParser = (m) => {
|
|
124
|
-
if (m.length === 23) {
|
|
125
|
-
const year = Number(m[1]);
|
|
126
|
-
const month = m[3] - 1;
|
|
127
|
-
const date = Number(m[9] || 1);
|
|
128
|
-
const hours = m[15] || 0;
|
|
129
|
-
const minutes = m[17] || 0;
|
|
130
|
-
const seconds = m[20] || 0;
|
|
131
|
-
const milliseconds = m[22] || 0;
|
|
132
|
-
return getDateFromData({
|
|
133
|
-
date,
|
|
134
|
-
year,
|
|
135
|
-
hours,
|
|
136
|
-
month,
|
|
137
|
-
seconds,
|
|
138
|
-
minutes,
|
|
139
|
-
milliseconds
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
const mmddyyyyDateParser = (m) => {
|
|
144
|
-
if (m.length === 22) {
|
|
145
|
-
const year = Number(m[12]);
|
|
146
|
-
const month = m[1] - 1;
|
|
147
|
-
const date = Number(m[6] || 1);
|
|
148
|
-
const hours = m[14] || 0;
|
|
149
|
-
const minutes = m[16] || 0;
|
|
150
|
-
const seconds = m[19] || 0;
|
|
151
|
-
const milliseconds = m[21] || 0;
|
|
152
|
-
return getDateFromData({
|
|
153
|
-
year,
|
|
154
|
-
month,
|
|
155
|
-
date,
|
|
156
|
-
hours,
|
|
157
|
-
minutes,
|
|
158
|
-
seconds,
|
|
159
|
-
milliseconds
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
const iso8601DateParser = (m) => {
|
|
164
|
-
if (m.length !== 25) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const year = Number(m[1]);
|
|
168
|
-
const month = m[2] - 1;
|
|
169
|
-
const date = Number(m[6]);
|
|
170
|
-
const offset = new Date(year, month, date).getTimezoneOffset();
|
|
171
|
-
const hours = m[12] || 0;
|
|
172
|
-
const minutes = m[14] || 0;
|
|
173
|
-
const seconds = m[17] || 0;
|
|
174
|
-
const milliseconds = m[19] || 0;
|
|
175
|
-
let timeZone = m[20];
|
|
176
|
-
const sign = m[21];
|
|
177
|
-
const offsetHours = m[22] || 0;
|
|
178
|
-
const offsetMinutes = m[24] || 0;
|
|
179
|
-
let daysInMonth = daysInMonths[month];
|
|
180
|
-
let actHours;
|
|
181
|
-
let actMinutes;
|
|
182
|
-
if (isLeapYear(year) && month === 1) {
|
|
183
|
-
daysInMonth += 1;
|
|
184
|
-
}
|
|
185
|
-
if (date <= daysInMonth) {
|
|
186
|
-
if (timeZone === "Z") {
|
|
187
|
-
actHours = hours - offset / 60;
|
|
188
|
-
actMinutes = minutes;
|
|
189
|
-
} else {
|
|
190
|
-
if (!timeZone.includes(":")) {
|
|
191
|
-
timeZone = timeZone.substr(0, 3) + ":" + timeZone.substr(3);
|
|
192
|
-
}
|
|
193
|
-
if (!timezones.includes(timeZone)) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
actHours = sign === "+" ? hours - offsetHours - offset / 60 : Number(hours) + Number(offsetHours) - offset / 60;
|
|
197
|
-
actMinutes = sign === "+" ? minutes - offsetMinutes : Number(minutes) + Number(offsetMinutes);
|
|
198
|
-
}
|
|
199
|
-
return new Date(year, month, date, actHours, actMinutes, seconds, getMilliseconds(milliseconds));
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const dateParsers = [
|
|
203
|
-
[yyyymmddReg, yyyymmddDateParser],
|
|
204
|
-
[mmddyyyyReg, mmddyyyyDateParser],
|
|
205
|
-
[iso8601Reg, iso8601DateParser]
|
|
206
|
-
];
|
|
207
|
-
const parseDate = (str) => {
|
|
208
|
-
for (let i = 0, len = dateParsers.length; i < len; i++) {
|
|
209
|
-
const m = dateParsers[i][0].exec(str);
|
|
210
|
-
if (m && m.length > 0) {
|
|
211
|
-
return dateParsers[i][1](m);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const matchDateArray = (arr, value, text) => {
|
|
216
|
-
if (text) {
|
|
217
|
-
switch (text) {
|
|
218
|
-
case "yyyy":
|
|
219
|
-
case "yy":
|
|
220
|
-
arr[0] = value;
|
|
221
|
-
break;
|
|
222
|
-
case "M":
|
|
223
|
-
case "MM":
|
|
224
|
-
arr[1] = value - 1;
|
|
225
|
-
break;
|
|
226
|
-
case "d":
|
|
227
|
-
case "dd":
|
|
228
|
-
arr[2] = value;
|
|
229
|
-
break;
|
|
230
|
-
case "h":
|
|
231
|
-
case "hh":
|
|
232
|
-
arr[3] = value;
|
|
233
|
-
break;
|
|
234
|
-
case "m":
|
|
235
|
-
case "mm":
|
|
236
|
-
arr[4] = value;
|
|
237
|
-
break;
|
|
238
|
-
case "s":
|
|
239
|
-
case "ss":
|
|
240
|
-
arr[5] = value;
|
|
241
|
-
break;
|
|
242
|
-
case "S":
|
|
243
|
-
case "SS":
|
|
244
|
-
case "SSS":
|
|
245
|
-
arr[6] = value;
|
|
246
|
-
break;
|
|
247
|
-
default:
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
const getDateArray = (str, dateFormat) => {
|
|
253
|
-
const arr = [0, -1, 0, 0, 0, 0];
|
|
254
|
-
if (str.length !== dateFormat.length) {
|
|
255
|
-
return arr;
|
|
256
|
-
}
|
|
257
|
-
let valuePos = 0;
|
|
258
|
-
let textPos = 0;
|
|
259
|
-
for (let i = 0, len = str.length; i < len; i++) {
|
|
260
|
-
const charValue = str.substr(i, 1);
|
|
261
|
-
const notNum = isNaN(Number(charValue)) || charValue.trim() === "";
|
|
262
|
-
if (notNum && charValue === dateFormat.substr(i, 1) || i === len - 1) {
|
|
263
|
-
let value;
|
|
264
|
-
let text;
|
|
265
|
-
if (notNum) {
|
|
266
|
-
value = str.substring(valuePos, i);
|
|
267
|
-
valuePos = i + 1;
|
|
268
|
-
const end = dateFormat.indexOf(charValue, textPos);
|
|
269
|
-
text = dateFormat.substring(textPos, end === -1 ? dateFormat.length : end);
|
|
270
|
-
textPos = end + 1;
|
|
271
|
-
} else {
|
|
272
|
-
value = str.substring(valuePos, len);
|
|
273
|
-
text = dateFormat.substring(textPos, len);
|
|
274
|
-
}
|
|
275
|
-
if (value.length === text.length || value) {
|
|
276
|
-
matchDateArray(arr, value, text);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return arr;
|
|
281
|
-
};
|
|
282
|
-
const invalideTime = (time, min, max) => isNaN(time) || time < min || time > max;
|
|
283
|
-
const invalideValue = ({ year, month, date, hours, minutes, seconds, milliseconds }) => invalideTime(year, 0, maxDateValues.YEAR) || invalideTime(month, 0, maxDateValues.MONTH) || invalideTime(date, 0, maxDateValues.DATE) || invalideTime(hours, 0, maxDateValues.HOUR) || invalideTime(minutes, 0, maxDateValues.MINUTE) || invalideTime(seconds, 0, maxDateValues.SECOND) || invalideTime(milliseconds, 0, maxDateValues.MILLISECOND);
|
|
284
|
-
const innerParse = (value, dateFormat) => {
|
|
285
|
-
if (typeof dateFormat === "string") {
|
|
286
|
-
const arr = getDateArray(value, dateFormat);
|
|
287
|
-
const year = Number(arr[0]);
|
|
288
|
-
const month = Number(arr[1]);
|
|
289
|
-
const date = Number(arr[2] || 1);
|
|
290
|
-
const hours = Number(arr[3] || 0);
|
|
291
|
-
const minutes = Number(arr[4] || 0);
|
|
292
|
-
const seconds = Number(arr[5] || 0);
|
|
293
|
-
const milliseconds = Number(arr[6] || 0);
|
|
294
|
-
if (invalideValue({
|
|
295
|
-
year,
|
|
296
|
-
month,
|
|
297
|
-
date,
|
|
298
|
-
hours,
|
|
299
|
-
minutes,
|
|
300
|
-
seconds,
|
|
301
|
-
milliseconds
|
|
302
|
-
})) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
return getDateFromData({
|
|
306
|
-
year,
|
|
307
|
-
date,
|
|
308
|
-
month,
|
|
309
|
-
minutes,
|
|
310
|
-
hours,
|
|
311
|
-
milliseconds,
|
|
312
|
-
seconds
|
|
313
|
-
});
|
|
314
|
-
} else {
|
|
315
|
-
return parseDate(value);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
const toDate = (value, dateFormat, minDate) => {
|
|
319
|
-
let date;
|
|
320
|
-
if (isNumber(value)) {
|
|
321
|
-
date = new Date(value);
|
|
322
|
-
} else if (typeof value === "string") {
|
|
323
|
-
date = innerParse(value, dateFormat);
|
|
324
|
-
}
|
|
325
|
-
if (minDate) {
|
|
326
|
-
const min = minDate && toDate(minDate) || new Date(1, 1, 1, 0, 0, 0);
|
|
327
|
-
return date && date < min ? min : date;
|
|
328
|
-
}
|
|
329
|
-
return date;
|
|
330
|
-
};
|
|
331
|
-
const format = function(date, dateFormat = "yyyy/MM/dd hh:mm:ss") {
|
|
332
|
-
if (isDate(date)) {
|
|
333
|
-
if (typeof dateFormat === "string") {
|
|
334
|
-
const o = {
|
|
335
|
-
"y{1,4}": date.getFullYear(),
|
|
336
|
-
"M{1,2}": date.getMonth() + 1,
|
|
337
|
-
"d{1,2}": date.getDate(),
|
|
338
|
-
"h{1,2}": date.getHours(),
|
|
339
|
-
"H{1,2}": date.getHours(),
|
|
340
|
-
"m{1,2}": date.getMinutes(),
|
|
341
|
-
"s{1,2}": date.getSeconds(),
|
|
342
|
-
"S{1,3}": date.getMilliseconds(),
|
|
343
|
-
"Z{1,1}": getTimezone(date)
|
|
344
|
-
};
|
|
345
|
-
Object.keys(o).forEach((k) => {
|
|
346
|
-
const m = dateFormat.match(dateFormatRegs[k]);
|
|
347
|
-
if (k && m && m.length) {
|
|
348
|
-
dateFormat = dateFormat.replace(m[0], k === "Z{1,1}" ? o[k] : fillChar(o[k].toString(), m[0].length));
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
return dateFormat;
|
|
352
|
-
}
|
|
353
|
-
} else if (typeof date === "string" && arguments.length >= 2) {
|
|
354
|
-
let afterFormat = dateFormat;
|
|
355
|
-
if (arguments.length === 2) {
|
|
356
|
-
dateFormat = void 0;
|
|
357
|
-
} else {
|
|
358
|
-
afterFormat = arguments[2];
|
|
359
|
-
}
|
|
360
|
-
const dateValue = toDate(date, dateFormat);
|
|
361
|
-
return dateValue ? format(dateValue, afterFormat) : "";
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
const getDateWithNewTimezone = (date, otz, ntz, timezoneOffset = 0) => {
|
|
365
|
-
if (!isDate(date) || !isNumeric(otz) || !isNumeric(ntz) || !isNumeric(timezoneOffset)) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
const otzOffset = -otz * 60;
|
|
369
|
-
const ntzOffset = -ntz * 60;
|
|
370
|
-
const dstOffeset = timezoneOffset * 60;
|
|
371
|
-
const utc = date.getTime() + otzOffset * 6e4;
|
|
372
|
-
return new Date(utc - (ntzOffset - dstOffeset) * 6e4);
|
|
373
|
-
};
|
|
374
|
-
const toDateStr = (date, dateFormat, timezone) => {
|
|
375
|
-
if (date && isNumeric(timezone)) {
|
|
376
|
-
timezone = parseFloat(parseFloat(timezone).toFixed(2));
|
|
377
|
-
date = getDateWithNewTimezone(isDate(date) ? date : new Date(toDate(date)), 0, timezone);
|
|
378
|
-
}
|
|
379
|
-
return format(date, dateFormat);
|
|
380
|
-
};
|
|
381
|
-
const getWeekOfFirstDay = (date, isSunFirst) => {
|
|
382
|
-
typeof date === "boolean" && (isSunFirst = date);
|
|
383
|
-
isDate(date) || (date = /* @__PURE__ */ new Date());
|
|
384
|
-
const day = date.getDay();
|
|
385
|
-
let dayOfMonth = date.getDate();
|
|
386
|
-
if (day === 0) {
|
|
387
|
-
!isSunFirst && (dayOfMonth -= 6);
|
|
388
|
-
} else {
|
|
389
|
-
dayOfMonth = dayOfMonth - day + (!isSunFirst && 1);
|
|
390
|
-
}
|
|
391
|
-
return new Date(date.getFullYear(), date.getMonth(), dayOfMonth);
|
|
392
|
-
};
|
|
393
|
-
const TZRE = /(-|\+)(\d{2}):?(\d{2})$/;
|
|
394
|
-
const getLocalTimezone = () => 0 - (/* @__PURE__ */ new Date()).getTimezoneOffset() / 60;
|
|
395
|
-
const getStrTimezone = (value) => {
|
|
396
|
-
const localTimeZone = getLocalTimezone();
|
|
397
|
-
const match = typeof value === "string" && value.match(TZRE);
|
|
398
|
-
if (match) {
|
|
399
|
-
const minoffset = Number(match[2]) + Number(match[3]) / 60;
|
|
400
|
-
value = minoffset * `${match[1]}1`;
|
|
401
|
-
}
|
|
402
|
-
if (isNumber(value) && value >= -12 && value <= 12) {
|
|
403
|
-
return value;
|
|
404
|
-
}
|
|
405
|
-
return localTimeZone;
|
|
406
|
-
};
|
|
407
|
-
export {
|
|
408
|
-
fillChar,
|
|
409
|
-
format,
|
|
410
|
-
getDateWithNewTimezone,
|
|
411
|
-
getLocalTimezone,
|
|
412
|
-
getStrTimezone,
|
|
413
|
-
getWeekOfFirstDay,
|
|
414
|
-
hasOwn,
|
|
415
|
-
isDate,
|
|
416
|
-
isEmptyObject,
|
|
417
|
-
isFunction,
|
|
418
|
-
isLeapYear,
|
|
419
|
-
isNull,
|
|
420
|
-
isNumber,
|
|
421
|
-
isNumeric,
|
|
422
|
-
isObject,
|
|
423
|
-
isPlainObject,
|
|
424
|
-
isPromise,
|
|
425
|
-
isRegExp,
|
|
426
|
-
isSame,
|
|
427
|
-
toDate,
|
|
428
|
-
toDateStr,
|
|
429
|
-
toString,
|
|
430
|
-
typeOf
|
|
431
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const showDropdown = (state, isShow = true) => {
|
|
2
|
-
if (isShow) {
|
|
3
|
-
state.visibleTimer = setTimeout(() => {
|
|
4
|
-
state.visible = true;
|
|
5
|
-
}, 0);
|
|
6
|
-
} else {
|
|
7
|
-
clearTimeout(state.visibleTimer);
|
|
8
|
-
state.visibleTimer = null;
|
|
9
|
-
state.visible = false;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const showPopover = (state, isShow = true) => {
|
|
13
|
-
state.popoverVisible = isShow;
|
|
14
|
-
const { dropdownRef } = state.instance.refs;
|
|
15
|
-
if (isShow && dropdownRef.state.visible) {
|
|
16
|
-
clearTimeout(Number(dropdownRef.state.timeout));
|
|
17
|
-
dropdownRef.state.timeout = null;
|
|
18
|
-
dropdownRef.state.visible = false;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
showDropdown,
|
|
23
|
-
showPopover
|
|
24
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const enUS = {
|
|
2
|
-
tvp: {
|
|
3
|
-
tvpSearchbox: {
|
|
4
|
-
defaultPlaceholder: "Select attribute filtering or enter keywords",
|
|
5
|
-
addPlaceholder: "Add filtering criteria",
|
|
6
|
-
tagPlaceholder: 'Please select tag key/value search, or enter "key=value" to search',
|
|
7
|
-
dynamicPlaceholder: "Please select {newValue} to search",
|
|
8
|
-
attributeType: "Attribute Type",
|
|
9
|
-
propertyValue: "The value of {0}",
|
|
10
|
-
matched: "Potential matching items",
|
|
11
|
-
allValues: "All values",
|
|
12
|
-
allProperty: "All Properties",
|
|
13
|
-
operator: "Operator",
|
|
14
|
-
clearAll: "Clear",
|
|
15
|
-
emptyValue: "Empty value",
|
|
16
|
-
help: "Click to view help",
|
|
17
|
-
switchText: "Switch to default search terms",
|
|
18
|
-
tagKey: "Key",
|
|
19
|
-
tagValue: "Value",
|
|
20
|
-
minValueText: "Minimum value",
|
|
21
|
-
maxValueText: "Maximum value",
|
|
22
|
-
rangeMinErr: "The input value must be between {0} and {1}",
|
|
23
|
-
rangeMaxErr: "The maximum value must be greater than or equal to the minimum value, or empty",
|
|
24
|
-
rangeNumberTitle: "Please enter at least one value",
|
|
25
|
-
rangeDateTitle: "Please enter at least one date",
|
|
26
|
-
timeLengthTitle: "The optional time span is within {value} days",
|
|
27
|
-
rangeBeginLabel: "Start date",
|
|
28
|
-
rangeEndLabel: "End date",
|
|
29
|
-
rulekeyword1: "Keywords",
|
|
30
|
-
notBeNull: "The value cannot be empty",
|
|
31
|
-
noData: "There is currently no matching data available ..",
|
|
32
|
-
selectAll: "Select All",
|
|
33
|
-
confirm: "Confirm",
|
|
34
|
-
cancel: "Cancel",
|
|
35
|
-
equal: "Equal",
|
|
36
|
-
notEqual: "Not equal",
|
|
37
|
-
contain: "Contain",
|
|
38
|
-
notContain: "Does not contain",
|
|
39
|
-
initUse: "Search"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
enUS as default
|
|
45
|
-
};
|
package/dist/es/utils/tag.es.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { deepClone } from "./clone.es.js";
|
|
2
|
-
import { showPopover } from "./dropdown.es.js";
|
|
3
|
-
const hasTagItem = (state, itemValue, itemLabel = "") => {
|
|
4
|
-
const { valueMap, prevItem } = state;
|
|
5
|
-
const value = (prevItem.label || itemLabel) + itemValue;
|
|
6
|
-
return valueMap.has(value);
|
|
7
|
-
};
|
|
8
|
-
const resetInput = (state) => {
|
|
9
|
-
state.propItem = {};
|
|
10
|
-
state.inputValue = "";
|
|
11
|
-
};
|
|
12
|
-
const emitChangeModelEvent = ({ emits, state, ...args }) => {
|
|
13
|
-
showPopover(state, false);
|
|
14
|
-
const { tagList = null, index = -1, newTag = null, newValue = null, oldValue = null, isEdit } = args;
|
|
15
|
-
if (!isEdit) {
|
|
16
|
-
resetInput(state);
|
|
17
|
-
}
|
|
18
|
-
if (!tagList && index === -1 && !newValue) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const oldVal = oldValue || deepClone(state.innerModelValue);
|
|
22
|
-
if (newValue) {
|
|
23
|
-
state.innerModelValue = newValue;
|
|
24
|
-
} else if (index !== -1) {
|
|
25
|
-
newTag ? state.innerModelValue.splice(index, 1, newTag) : state.innerModelValue.splice(index, 1);
|
|
26
|
-
} else {
|
|
27
|
-
state.innerModelValue.push(...tagList);
|
|
28
|
-
}
|
|
29
|
-
const { innerModelValue } = state;
|
|
30
|
-
emits("update:modelValue", innerModelValue);
|
|
31
|
-
emits("change", deepClone(state.innerModelValue), oldVal);
|
|
32
|
-
};
|
|
33
|
-
const createNewTag = (newTag) => newTag;
|
|
34
|
-
const getTagId = (props, prevItem, item) => {
|
|
35
|
-
const idKey = prevItem.idMapKey || props.idMapKey;
|
|
36
|
-
return item && item[idKey] !== void 0 ? { [idKey]: item[idKey] } : null;
|
|
37
|
-
};
|
|
38
|
-
export {
|
|
39
|
-
createNewTag,
|
|
40
|
-
emitChangeModelEvent,
|
|
41
|
-
getTagId,
|
|
42
|
-
hasTagItem,
|
|
43
|
-
resetInput
|
|
44
|
-
};
|
package/dist/es/utils/type.es.js
DELETED