@opentiny/vue-search-box 0.0.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.
Files changed (74) hide show
  1. package/README.md +111 -0
  2. package/es/composables/use-checkbox.es.js +87 -0
  3. package/es/composables/use-custom.es.js +48 -0
  4. package/es/composables/use-datepicker.es.js +86 -0
  5. package/es/composables/use-dropdown.es.js +207 -0
  6. package/es/composables/use-edit.es.js +106 -0
  7. package/es/composables/use-init.es.js +64 -0
  8. package/es/composables/use-match.es.js +170 -0
  9. package/es/composables/use-num-range.es.js +77 -0
  10. package/es/composables/use-placeholder.es.js +41 -0
  11. package/es/composables/use-tag.es.js +51 -0
  12. package/es/index-DCPOFFNd.css +337 -0
  13. package/es/index.es.js +10 -0
  14. package/es/index.type.es.js +1 -0
  15. package/es/index.vue.es.js +4 -0
  16. package/es/index.vue.es2.js +1287 -0
  17. package/es/smb-theme.es.js +18 -0
  18. package/es/utils/clone.es.js +29 -0
  19. package/es/utils/date.es.js +431 -0
  20. package/es/utils/dropdown.es.js +20 -0
  21. package/es/utils/en_US.es.js +44 -0
  22. package/es/utils/index.es.js +13 -0
  23. package/es/utils/tag.es.js +46 -0
  24. package/es/utils/type.es.js +4 -0
  25. package/es/utils/validate.es.js +179 -0
  26. package/es/utils/zh_CN.es.js +44 -0
  27. package/index.css +337 -0
  28. package/lib/composables/use-checkbox.cjs.js +87 -0
  29. package/lib/composables/use-custom.cjs.js +48 -0
  30. package/lib/composables/use-datepicker.cjs.js +86 -0
  31. package/lib/composables/use-dropdown.cjs.js +207 -0
  32. package/lib/composables/use-edit.cjs.js +106 -0
  33. package/lib/composables/use-init.cjs.js +64 -0
  34. package/lib/composables/use-match.cjs.js +170 -0
  35. package/lib/composables/use-num-range.cjs.js +77 -0
  36. package/lib/composables/use-placeholder.cjs.js +41 -0
  37. package/lib/composables/use-tag.cjs.js +51 -0
  38. package/lib/index-DCPOFFNd.css +337 -0
  39. package/lib/index.cjs.js +10 -0
  40. package/lib/index.type.cjs.js +1 -0
  41. package/lib/index.vue.cjs.js +4 -0
  42. package/lib/index.vue.cjs2.js +1287 -0
  43. package/lib/smb-theme.cjs.js +18 -0
  44. package/lib/utils/clone.cjs.js +29 -0
  45. package/lib/utils/date.cjs.js +431 -0
  46. package/lib/utils/dropdown.cjs.js +20 -0
  47. package/lib/utils/en_US.cjs.js +44 -0
  48. package/lib/utils/index.cjs.js +13 -0
  49. package/lib/utils/tag.cjs.js +46 -0
  50. package/lib/utils/type.cjs.js +4 -0
  51. package/lib/utils/validate.cjs.js +179 -0
  52. package/lib/utils/zh_CN.cjs.js +44 -0
  53. package/package.json +65 -0
  54. package/types/composables/use-checkbox.d.ts +10 -0
  55. package/types/composables/use-custom.d.ts +7 -0
  56. package/types/composables/use-datepicker.d.ts +11 -0
  57. package/types/composables/use-dropdown.d.ts +13 -0
  58. package/types/composables/use-edit.d.ts +13 -0
  59. package/types/composables/use-init.d.ts +10 -0
  60. package/types/composables/use-match.d.ts +8 -0
  61. package/types/composables/use-num-range.d.ts +9 -0
  62. package/types/composables/use-placeholder.d.ts +8 -0
  63. package/types/composables/use-tag.d.ts +9 -0
  64. package/types/index.type.d.ts +189 -0
  65. package/types/smb-theme.d.ts +15 -0
  66. package/types/utils/clone.d.ts +12 -0
  67. package/types/utils/date.d.ts +234 -0
  68. package/types/utils/dropdown.d.ts +12 -0
  69. package/types/utils/en_US.d.ts +41 -0
  70. package/types/utils/index.d.ts +1 -0
  71. package/types/utils/tag.d.ts +46 -0
  72. package/types/utils/type.d.ts +6 -0
  73. package/types/utils/validate.d.ts +31 -0
  74. package/types/utils/zh_CN.d.ts +41 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const tvpSearchBoxSmbTheme = {
4
+ "tvp-search-box-right-search-icon-display": "none",
5
+ "tvp-search-box-left-icon-display": "inline",
6
+ "tvp-search-box-help-icon-margin-right": "var(--ti-common-space-0)",
7
+ "tvp-search-box-padding-left": "var(--ti-common-space-8x)",
8
+ "tvp-search-box-close-icon-margin-right": "var(--ti-common-space-base)",
9
+ "tvp-search-box-separator-icon-margin-right": "var(--ti-common-space-base)",
10
+ "tvp-search-box-dropdown-btn-group-margin-top": "var(--ti-common-space-2x)",
11
+ "tvp-search-box-dropdown-btn-group-padding-top": "var(--ti-common-space-4x)",
12
+ "tvp-search-box-dropdown-btn-group-padding-bottom": "var(--ti-common-space-2x)",
13
+ "tvp-search-box-dropdown-btn-min-width": "var(--ti-common-size-18x)",
14
+ "tvp-search-box-dropdown-padding-vertical": "var(--ti-common-space-4x)",
15
+ "tvp-search-box-input-padding-left": "var(--ti-common-space-0)",
16
+ "tvp-search-box-dropdown-header-text-color": "var(--ti-common-color-border)"
17
+ };
18
+ exports.tvpSearchBoxSmbTheme = tvpSearchBoxSmbTheme;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const deepClone = (obj) => {
4
+ const objClone = Array.isArray(obj) ? [] : {};
5
+ if (obj && typeof obj === "object") {
6
+ const keys = Object.keys(obj);
7
+ if (keys.length) {
8
+ keys.forEach((key) => {
9
+ if (obj[key] && typeof obj[key] === "object") {
10
+ objClone[key] = deepClone(obj[key]);
11
+ } else {
12
+ objClone[key] = obj[key];
13
+ }
14
+ });
15
+ } else {
16
+ return obj;
17
+ }
18
+ }
19
+ return objClone;
20
+ };
21
+ const omitObj = (obj, keysToOmit = ["mergeTag", "options", "idMapKey"]) => {
22
+ const result = { ...obj };
23
+ keysToOmit.forEach((key) => {
24
+ delete result[key];
25
+ });
26
+ return result;
27
+ };
28
+ exports.deepClone = deepClone;
29
+ exports.omitObj = omitObj;
@@ -0,0 +1,431 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fillChar = (string, length, append, chr = "0") => {
4
+ if (typeof string === "string" && typeof chr === "string" && isNumber(length)) {
5
+ let len = string.length - length;
6
+ if (len > 0) {
7
+ return append ? string.substr(0, length) : string.substr(len, length);
8
+ } else {
9
+ const appendStr = [];
10
+ len = Math.abs(len) / chr.length;
11
+ for (; len > 0; len--) {
12
+ appendStr.push(chr);
13
+ }
14
+ const s = appendStr.join("");
15
+ return append ? string + s : s + string;
16
+ }
17
+ }
18
+ };
19
+ const toString = Object.prototype.toString;
20
+ const hasOwn = Object.prototype.hasOwnProperty;
21
+ const getProto = Object.getPrototypeOf;
22
+ const fnToString = hasOwn.toString;
23
+ const ObjectFunctionString = fnToString.call(Object);
24
+ const class2type = {
25
+ "[object Error]": "error",
26
+ "[object Object]": "object",
27
+ "[object RegExp]": "regExp",
28
+ "[object Date]": "date",
29
+ "[object Array]": "array",
30
+ "[object Function]": "function",
31
+ "[object AsyncFunction]": "asyncFunction",
32
+ "[object String]": "string",
33
+ "[object Number]": "number",
34
+ "[object Boolean]": "boolean"
35
+ };
36
+ const isNull = (x) => x === null || x === void 0;
37
+ const typeOf = (obj) => isNull(obj) ? String(obj) : class2type[toString.call(obj)] || "object";
38
+ const isObject = (obj) => typeOf(obj) === "object";
39
+ const isFunction = (fn) => ["asyncFunction", "function"].includes(typeOf(fn));
40
+ const isPlainObject = (obj) => {
41
+ if (!obj || toString.call(obj) !== "[object Object]") {
42
+ return false;
43
+ }
44
+ const proto = getProto(obj);
45
+ if (!proto) {
46
+ return true;
47
+ }
48
+ const Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
49
+ return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
50
+ };
51
+ const isEmptyObject = (obj) => {
52
+ const type = typeOf(obj);
53
+ if (type === "object" || type === "array") {
54
+ for (const name in obj) {
55
+ if (hasOwn.call(obj, name)) {
56
+ return false;
57
+ }
58
+ }
59
+ }
60
+ return true;
61
+ };
62
+ const isNumber = (value) => typeof value === "number" && isFinite(value);
63
+ const isNumeric = (value) => value - parseFloat(value) >= 0;
64
+ const isDate = (value) => typeOf(value) === "date";
65
+ const isSame = (x, y) => x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y);
66
+ const isRegExp = (value) => typeOf(value) === "regExp";
67
+ const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
68
+ const daysInMonths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
69
+ const yyyymmddReg = new RegExp(
70
+ "^(\\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}))?)?)?$"
71
+ );
72
+ const mmddyyyyReg = new RegExp(
73
+ "^(((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}))?)?)?$"
74
+ );
75
+ const iso8601Reg = new RegExp(
76
+ "^(\\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]))$"
77
+ );
78
+ const dateFormatRegs = {
79
+ "y{1,4}": /y{1,4}/,
80
+ "M{1,2}": /M{1,2}/,
81
+ "d{1,2}": /d{1,2}/,
82
+ "h{1,2}": /h{1,2}/,
83
+ "H{1,2}": /H{1,2}/,
84
+ "m{1,2}": /m{1,2}/,
85
+ "s{1,2}": /s{1,2}/,
86
+ "S{1,3}": /S{1,3}/,
87
+ "Z{1,1}": /Z{1,1}/
88
+ };
89
+ const maxDateValues = {
90
+ YEAR: 9999,
91
+ MONTH: 11,
92
+ DATE: 31,
93
+ HOUR: 23,
94
+ MINUTE: 59,
95
+ SECOND: 59,
96
+ MILLISECOND: 999
97
+ };
98
+ 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";
99
+ 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";
100
+ 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";
101
+ const timezones = [].concat(timezone1.split(","), timezone2.split(","), timezone3.split(","));
102
+ const getTimezone = (date) => {
103
+ const timezoneoffset = 0 - date.getTimezoneOffset() / 60;
104
+ let timezone;
105
+ if (timezoneoffset === 0) {
106
+ timezone = "Z";
107
+ } else if (timezoneoffset > 0) {
108
+ timezone = "+" + (timezoneoffset > 10 ? timezoneoffset : "0" + timezoneoffset) + "00";
109
+ } else {
110
+ timezone = (timezoneoffset < -10 ? timezoneoffset : "-0" + -timezoneoffset) + "00";
111
+ }
112
+ return timezone;
113
+ };
114
+ const isLeapYear = (year) => year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
115
+ const getMilliseconds = (milliseconds) => milliseconds > maxDateValues.MILLISECOND ? Number(String(milliseconds).substring(0, 3)) : milliseconds;
116
+ const getDateFromData = ({ year, month, date, hours, minutes, seconds, milliseconds }) => {
117
+ let daysInMonth = daysInMonths[month];
118
+ if (isLeapYear(year) && month === 1) {
119
+ daysInMonth += 1;
120
+ }
121
+ if (date <= daysInMonth) {
122
+ return new Date(year, month, date, hours, minutes, seconds, getMilliseconds(milliseconds));
123
+ }
124
+ };
125
+ const yyyymmddDateParser = (m) => {
126
+ if (m.length === 23) {
127
+ const year = Number(m[1]);
128
+ const month = m[3] - 1;
129
+ const date = Number(m[9] || 1);
130
+ const hours = m[15] || 0;
131
+ const minutes = m[17] || 0;
132
+ const seconds = m[20] || 0;
133
+ const milliseconds = m[22] || 0;
134
+ return getDateFromData({
135
+ date,
136
+ year,
137
+ hours,
138
+ month,
139
+ seconds,
140
+ minutes,
141
+ milliseconds
142
+ });
143
+ }
144
+ };
145
+ const mmddyyyyDateParser = (m) => {
146
+ if (m.length === 22) {
147
+ const year = Number(m[12]);
148
+ const month = m[1] - 1;
149
+ const date = Number(m[6] || 1);
150
+ const hours = m[14] || 0;
151
+ const minutes = m[16] || 0;
152
+ const seconds = m[19] || 0;
153
+ const milliseconds = m[21] || 0;
154
+ return getDateFromData({
155
+ year,
156
+ month,
157
+ date,
158
+ hours,
159
+ minutes,
160
+ seconds,
161
+ milliseconds
162
+ });
163
+ }
164
+ };
165
+ const iso8601DateParser = (m) => {
166
+ if (m.length !== 25) {
167
+ return;
168
+ }
169
+ const year = Number(m[1]);
170
+ const month = m[2] - 1;
171
+ const date = Number(m[6]);
172
+ const offset = new Date(year, month, date).getTimezoneOffset();
173
+ const hours = m[12] || 0;
174
+ const minutes = m[14] || 0;
175
+ const seconds = m[17] || 0;
176
+ const milliseconds = m[19] || 0;
177
+ let timeZone = m[20];
178
+ const sign = m[21];
179
+ const offsetHours = m[22] || 0;
180
+ const offsetMinutes = m[24] || 0;
181
+ let daysInMonth = daysInMonths[month];
182
+ let actHours;
183
+ let actMinutes;
184
+ if (isLeapYear(year) && month === 1) {
185
+ daysInMonth += 1;
186
+ }
187
+ if (date <= daysInMonth) {
188
+ if (timeZone === "Z") {
189
+ actHours = hours - offset / 60;
190
+ actMinutes = minutes;
191
+ } else {
192
+ if (!timeZone.includes(":")) {
193
+ timeZone = timeZone.substr(0, 3) + ":" + timeZone.substr(3);
194
+ }
195
+ if (!timezones.includes(timeZone)) {
196
+ return;
197
+ }
198
+ actHours = sign === "+" ? hours - offsetHours - offset / 60 : Number(hours) + Number(offsetHours) - offset / 60;
199
+ actMinutes = sign === "+" ? minutes - offsetMinutes : Number(minutes) + Number(offsetMinutes);
200
+ }
201
+ return new Date(year, month, date, actHours, actMinutes, seconds, getMilliseconds(milliseconds));
202
+ }
203
+ };
204
+ const dateParsers = [
205
+ [yyyymmddReg, yyyymmddDateParser],
206
+ [mmddyyyyReg, mmddyyyyDateParser],
207
+ [iso8601Reg, iso8601DateParser]
208
+ ];
209
+ const parseDate = (str) => {
210
+ for (let i = 0, len = dateParsers.length; i < len; i++) {
211
+ const m = dateParsers[i][0].exec(str);
212
+ if (m && m.length > 0) {
213
+ return dateParsers[i][1](m);
214
+ }
215
+ }
216
+ };
217
+ const matchDateArray = (arr, value, text) => {
218
+ if (text) {
219
+ switch (text) {
220
+ case "yyyy":
221
+ case "yy":
222
+ arr[0] = value;
223
+ break;
224
+ case "M":
225
+ case "MM":
226
+ arr[1] = value - 1;
227
+ break;
228
+ case "d":
229
+ case "dd":
230
+ arr[2] = value;
231
+ break;
232
+ case "h":
233
+ case "hh":
234
+ arr[3] = value;
235
+ break;
236
+ case "m":
237
+ case "mm":
238
+ arr[4] = value;
239
+ break;
240
+ case "s":
241
+ case "ss":
242
+ arr[5] = value;
243
+ break;
244
+ case "S":
245
+ case "SS":
246
+ case "SSS":
247
+ arr[6] = value;
248
+ break;
249
+ default:
250
+ break;
251
+ }
252
+ }
253
+ };
254
+ const getDateArray = (str, dateFormat) => {
255
+ const arr = [0, -1, 0, 0, 0, 0];
256
+ if (str.length !== dateFormat.length) {
257
+ return arr;
258
+ }
259
+ let valuePos = 0;
260
+ let textPos = 0;
261
+ for (let i = 0, len = str.length; i < len; i++) {
262
+ const charValue = str.substr(i, 1);
263
+ const notNum = isNaN(Number(charValue)) || charValue.trim() === "";
264
+ if (notNum && charValue === dateFormat.substr(i, 1) || i === len - 1) {
265
+ let value;
266
+ let text;
267
+ if (notNum) {
268
+ value = str.substring(valuePos, i);
269
+ valuePos = i + 1;
270
+ const end = dateFormat.indexOf(charValue, textPos);
271
+ text = dateFormat.substring(textPos, end === -1 ? dateFormat.length : end);
272
+ textPos = end + 1;
273
+ } else {
274
+ value = str.substring(valuePos, len);
275
+ text = dateFormat.substring(textPos, len);
276
+ }
277
+ if (value.length === text.length || value) {
278
+ matchDateArray(arr, value, text);
279
+ }
280
+ }
281
+ }
282
+ return arr;
283
+ };
284
+ const invalideTime = (time, min, max) => isNaN(time) || time < min || time > max;
285
+ 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);
286
+ const innerParse = (value, dateFormat) => {
287
+ if (typeof dateFormat === "string") {
288
+ const arr = getDateArray(value, dateFormat);
289
+ const year = Number(arr[0]);
290
+ const month = Number(arr[1]);
291
+ const date = Number(arr[2] || 1);
292
+ const hours = Number(arr[3] || 0);
293
+ const minutes = Number(arr[4] || 0);
294
+ const seconds = Number(arr[5] || 0);
295
+ const milliseconds = Number(arr[6] || 0);
296
+ if (invalideValue({
297
+ year,
298
+ month,
299
+ date,
300
+ hours,
301
+ minutes,
302
+ seconds,
303
+ milliseconds
304
+ })) {
305
+ return;
306
+ }
307
+ return getDateFromData({
308
+ year,
309
+ date,
310
+ month,
311
+ minutes,
312
+ hours,
313
+ milliseconds,
314
+ seconds
315
+ });
316
+ } else {
317
+ return parseDate(value);
318
+ }
319
+ };
320
+ const toDate = (value, dateFormat, minDate) => {
321
+ let date;
322
+ if (isNumber(value)) {
323
+ date = new Date(value);
324
+ } else if (typeof value === "string") {
325
+ date = innerParse(value, dateFormat);
326
+ }
327
+ if (minDate) {
328
+ const min = minDate && toDate(minDate) || new Date(1, 1, 1, 0, 0, 0);
329
+ return date && date < min ? min : date;
330
+ }
331
+ return date;
332
+ };
333
+ const format = function(date, dateFormat = "yyyy/MM/dd hh:mm:ss") {
334
+ if (isDate(date)) {
335
+ if (typeof dateFormat === "string") {
336
+ const o = {
337
+ "y{1,4}": date.getFullYear(),
338
+ "M{1,2}": date.getMonth() + 1,
339
+ "d{1,2}": date.getDate(),
340
+ "h{1,2}": date.getHours(),
341
+ "H{1,2}": date.getHours(),
342
+ "m{1,2}": date.getMinutes(),
343
+ "s{1,2}": date.getSeconds(),
344
+ "S{1,3}": date.getMilliseconds(),
345
+ "Z{1,1}": getTimezone(date)
346
+ };
347
+ Object.keys(o).forEach((k) => {
348
+ const m = dateFormat.match(dateFormatRegs[k]);
349
+ if (k && m && m.length) {
350
+ dateFormat = dateFormat.replace(m[0], k === "Z{1,1}" ? o[k] : fillChar(o[k].toString(), m[0].length));
351
+ }
352
+ });
353
+ return dateFormat;
354
+ }
355
+ } else if (typeof date === "string" && arguments.length >= 2) {
356
+ let afterFormat = dateFormat;
357
+ if (arguments.length === 2) {
358
+ dateFormat = void 0;
359
+ } else {
360
+ afterFormat = arguments[2];
361
+ }
362
+ const dateValue = toDate(date, dateFormat);
363
+ return dateValue ? format(dateValue, afterFormat) : "";
364
+ }
365
+ };
366
+ const getDateWithNewTimezone = (date, otz, ntz, timezoneOffset = 0) => {
367
+ if (!isDate(date) || !isNumeric(otz) || !isNumeric(ntz) || !isNumeric(timezoneOffset)) {
368
+ return;
369
+ }
370
+ const otzOffset = -otz * 60;
371
+ const ntzOffset = -ntz * 60;
372
+ const dstOffeset = timezoneOffset * 60;
373
+ const utc = date.getTime() + otzOffset * 6e4;
374
+ return new Date(utc - (ntzOffset - dstOffeset) * 6e4);
375
+ };
376
+ const toDateStr = (date, dateFormat, timezone) => {
377
+ if (date && isNumeric(timezone)) {
378
+ timezone = parseFloat(parseFloat(timezone).toFixed(2));
379
+ date = getDateWithNewTimezone(isDate(date) ? date : new Date(toDate(date)), 0, timezone);
380
+ }
381
+ return format(date, dateFormat);
382
+ };
383
+ const getWeekOfFirstDay = (date, isSunFirst) => {
384
+ typeof date === "boolean" && (isSunFirst = date);
385
+ isDate(date) || (date = /* @__PURE__ */ new Date());
386
+ const day = date.getDay();
387
+ let dayOfMonth = date.getDate();
388
+ if (day === 0) {
389
+ !isSunFirst && (dayOfMonth -= 6);
390
+ } else {
391
+ dayOfMonth = dayOfMonth - day + (!isSunFirst && 1);
392
+ }
393
+ return new Date(date.getFullYear(), date.getMonth(), dayOfMonth);
394
+ };
395
+ const TZRE = /(-|\+)(\d{2}):?(\d{2})$/;
396
+ const getLocalTimezone = () => 0 - (/* @__PURE__ */ new Date()).getTimezoneOffset() / 60;
397
+ const getStrTimezone = (value) => {
398
+ const localTimeZone = getLocalTimezone();
399
+ const match = typeof value === "string" && value.match(TZRE);
400
+ if (match) {
401
+ const minoffset = Number(match[2]) + Number(match[3]) / 60;
402
+ value = minoffset * `${match[1]}1`;
403
+ }
404
+ if (isNumber(value) && value >= -12 && value <= 12) {
405
+ return value;
406
+ }
407
+ return localTimeZone;
408
+ };
409
+ exports.fillChar = fillChar;
410
+ exports.format = format;
411
+ exports.getDateWithNewTimezone = getDateWithNewTimezone;
412
+ exports.getLocalTimezone = getLocalTimezone;
413
+ exports.getStrTimezone = getStrTimezone;
414
+ exports.getWeekOfFirstDay = getWeekOfFirstDay;
415
+ exports.hasOwn = hasOwn;
416
+ exports.isDate = isDate;
417
+ exports.isEmptyObject = isEmptyObject;
418
+ exports.isFunction = isFunction;
419
+ exports.isLeapYear = isLeapYear;
420
+ exports.isNull = isNull;
421
+ exports.isNumber = isNumber;
422
+ exports.isNumeric = isNumeric;
423
+ exports.isObject = isObject;
424
+ exports.isPlainObject = isPlainObject;
425
+ exports.isPromise = isPromise;
426
+ exports.isRegExp = isRegExp;
427
+ exports.isSame = isSame;
428
+ exports.toDate = toDate;
429
+ exports.toDateStr = toDateStr;
430
+ exports.toString = toString;
431
+ exports.typeOf = typeOf;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const showDropdown = (state, isShow = true) => {
4
+ const { dropdownRef } = state.instance.refs;
5
+ clearTimeout(Number(dropdownRef.state.timeout));
6
+ dropdownRef.state.timeout = null;
7
+ dropdownRef.state.visible = isShow;
8
+ isShow && (state.popoverVisible = false);
9
+ };
10
+ const showPopover = (state, isShow = true) => {
11
+ state.popoverVisible = isShow;
12
+ const { dropdownRef } = state.instance.refs;
13
+ if (isShow && dropdownRef.state.visible) {
14
+ clearTimeout(Number(dropdownRef.state.timeout));
15
+ dropdownRef.state.timeout = null;
16
+ dropdownRef.state.visible = false;
17
+ }
18
+ };
19
+ exports.showDropdown = showDropdown;
20
+ exports.showPopover = showPopover;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const enUS = {
4
+ tvp: {
5
+ tvpSearchbox: {
6
+ defaultPlaceholder: "请选择属性筛选,或输入关键字",
7
+ addPlaceholder: "添加筛选条件",
8
+ tagPlaceholder: "请选择标签键/值搜索,或输入“键=值”搜索",
9
+ dynamicPlaceholder: "请选择{newValue}搜索",
10
+ attributeType: "属性类型",
11
+ propertyValue: "{0}的值",
12
+ matched: "潜在匹配项",
13
+ allValues: "所有值",
14
+ allProperty: "全部属性",
15
+ operator: "运算符",
16
+ clearAll: "清空",
17
+ emptyValue: "空 值",
18
+ help: "点击查看帮助",
19
+ switchText: "切换到默认搜索项",
20
+ tagKey: "键",
21
+ tagValue: "值",
22
+ minValueText: "最小值",
23
+ maxValueText: "最大值",
24
+ rangeMinArr: "输入值必须在{0}~{1}之间",
25
+ rangeMaxArr: "最大值必须大于等于最小值,或者为空",
26
+ rangeNumberTitle: "请至少输入一个值",
27
+ rangeDateTitle: "请至少输入一个日期",
28
+ timeLengthTitle: "可选时间跨度为{value}天内",
29
+ rangeBeginLabel: "开始日期",
30
+ rangeEndLabel: "结束日期",
31
+ rulekeyword1: "关键字",
32
+ notBeNull: "值不能为空",
33
+ noData: "暂无匹配数据...",
34
+ selectAll: "全选",
35
+ confirm: "确定",
36
+ cancel: "取消",
37
+ equal: "等于",
38
+ notEqual: "不等于",
39
+ contain: "包含",
40
+ notContain: "不包含"
41
+ }
42
+ }
43
+ };
44
+ exports.enUS = enUS;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const debounce = (func, delay = 200) => {
4
+ let timer = null;
5
+ return function(...args) {
6
+ if (timer) clearTimeout(timer);
7
+ timer = setTimeout(() => {
8
+ func.apply(this, args);
9
+ timer = null;
10
+ }, delay);
11
+ };
12
+ };
13
+ exports.debounce = debounce;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const clone = require("./clone.cjs.js");
4
+ const dropdown = require("./dropdown.cjs.js");
5
+ const hasTagItem = (state, itemValue, itemLabel = "") => {
6
+ const { valueMap, prevItem } = state;
7
+ const value = (prevItem.label || itemLabel) + itemValue;
8
+ return valueMap.has(value);
9
+ };
10
+ const resetInput = (state) => {
11
+ state.isResetFlag = false;
12
+ state.propItem = {};
13
+ state.inputValue = "";
14
+ };
15
+ const emitChangeModelEvent = ({ emits, state, ...args }) => {
16
+ const { tagList = null, index = -1, newTag = null, newValue = null, oldValue = null, isEdit } = args;
17
+ if (!isEdit) {
18
+ resetInput(state);
19
+ }
20
+ if (!tagList && index === -1 && !newValue) {
21
+ return;
22
+ }
23
+ const oldVal = oldValue || clone.deepClone(state.innerModelValue);
24
+ if (newValue) {
25
+ state.innerModelValue = newValue;
26
+ } else if (index !== -1) {
27
+ newTag ? state.innerModelValue.splice(index, 1, newTag) : state.innerModelValue.splice(index, 1);
28
+ } else {
29
+ state.innerModelValue.push(...tagList);
30
+ }
31
+ const { innerModelValue } = state;
32
+ dropdown.showDropdown(state, false);
33
+ dropdown.showPopover(state, false);
34
+ emits("update:modelValue", innerModelValue);
35
+ emits("change", clone.deepClone(state.innerModelValue), oldVal);
36
+ };
37
+ const createNewTag = (newTag) => newTag;
38
+ const getTagId = (props, prevItem, item) => {
39
+ const idKey = prevItem.idMapKey || props.idMapKey;
40
+ return item && item[idKey] !== void 0 ? { [idKey]: item[idKey] } : null;
41
+ };
42
+ exports.createNewTag = createNewTag;
43
+ exports.emitChangeModelEvent = emitChangeModelEvent;
44
+ exports.getTagId = getTagId;
45
+ exports.hasTagItem = hasTagItem;
46
+ exports.resetInput = resetInput;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isNumber = (value) => parseFloat(value).toString() !== "NaN";
4
+ exports.isNumber = isNumber;