@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.
Files changed (85) hide show
  1. package/{dist/index.css → index.css} +22 -19
  2. package/index.js +2804 -0
  3. package/index.js.map +1 -0
  4. package/package.json +38 -56
  5. package/README.md +0 -134
  6. package/README.zh-CN.md +0 -135
  7. package/dist/es/components/first-level-panel.vue.es.js +0 -4
  8. package/dist/es/components/first-level-panel.vue.es2.js +0 -177
  9. package/dist/es/components/second-level-panel.vue.es.js +0 -4
  10. package/dist/es/components/second-level-panel.vue.es2.js +0 -466
  11. package/dist/es/composables/use-checkbox.es.js +0 -74
  12. package/dist/es/composables/use-custom.es.js +0 -49
  13. package/dist/es/composables/use-datepicker.es.js +0 -86
  14. package/dist/es/composables/use-dropdown.es.js +0 -216
  15. package/dist/es/composables/use-edit.es.js +0 -108
  16. package/dist/es/composables/use-init.es.js +0 -78
  17. package/dist/es/composables/use-match.es.js +0 -170
  18. package/dist/es/composables/use-num-range.es.js +0 -77
  19. package/dist/es/composables/use-placeholder.es.js +0 -41
  20. package/dist/es/composables/use-tag.es.js +0 -56
  21. package/dist/es/index-Tlzvfwv-.css +0 -401
  22. package/dist/es/index.es.js +0 -45
  23. package/dist/es/index.type.es.js +0 -1
  24. package/dist/es/index.vue.es.js +0 -4
  25. package/dist/es/index.vue.es2.js +0 -780
  26. package/dist/es/smb-theme.es.js +0 -18
  27. package/dist/es/utils/clone.es.js +0 -29
  28. package/dist/es/utils/date.es.js +0 -431
  29. package/dist/es/utils/dropdown.es.js +0 -24
  30. package/dist/es/utils/en_US.es.js +0 -45
  31. package/dist/es/utils/index.es.js +0 -13
  32. package/dist/es/utils/tag.es.js +0 -44
  33. package/dist/es/utils/type.es.js +0 -4
  34. package/dist/es/utils/validate.es.js +0 -179
  35. package/dist/es/utils/zh_CN.es.js +0 -45
  36. package/dist/lib/components/first-level-panel.vue.cjs.js +0 -4
  37. package/dist/lib/components/first-level-panel.vue.cjs2.js +0 -177
  38. package/dist/lib/components/second-level-panel.vue.cjs.js +0 -4
  39. package/dist/lib/components/second-level-panel.vue.cjs2.js +0 -466
  40. package/dist/lib/composables/use-checkbox.cjs.js +0 -74
  41. package/dist/lib/composables/use-custom.cjs.js +0 -49
  42. package/dist/lib/composables/use-datepicker.cjs.js +0 -86
  43. package/dist/lib/composables/use-dropdown.cjs.js +0 -216
  44. package/dist/lib/composables/use-edit.cjs.js +0 -108
  45. package/dist/lib/composables/use-init.cjs.js +0 -78
  46. package/dist/lib/composables/use-match.cjs.js +0 -170
  47. package/dist/lib/composables/use-num-range.cjs.js +0 -77
  48. package/dist/lib/composables/use-placeholder.cjs.js +0 -41
  49. package/dist/lib/composables/use-tag.cjs.js +0 -56
  50. package/dist/lib/index-Tlzvfwv-.css +0 -401
  51. package/dist/lib/index.cjs.js +0 -45
  52. package/dist/lib/index.type.cjs.js +0 -1
  53. package/dist/lib/index.vue.cjs.js +0 -4
  54. package/dist/lib/index.vue.cjs2.js +0 -780
  55. package/dist/lib/smb-theme.cjs.js +0 -18
  56. package/dist/lib/utils/clone.cjs.js +0 -29
  57. package/dist/lib/utils/date.cjs.js +0 -431
  58. package/dist/lib/utils/dropdown.cjs.js +0 -24
  59. package/dist/lib/utils/en_US.cjs.js +0 -45
  60. package/dist/lib/utils/index.cjs.js +0 -13
  61. package/dist/lib/utils/tag.cjs.js +0 -44
  62. package/dist/lib/utils/type.cjs.js +0 -4
  63. package/dist/lib/utils/validate.cjs.js +0 -179
  64. package/dist/lib/utils/zh_CN.cjs.js +0 -45
  65. package/dist/types/composables/use-checkbox.d.ts +0 -8
  66. package/dist/types/composables/use-custom.d.ts +0 -7
  67. package/dist/types/composables/use-datepicker.d.ts +0 -11
  68. package/dist/types/composables/use-dropdown.d.ts +0 -14
  69. package/dist/types/composables/use-edit.d.ts +0 -13
  70. package/dist/types/composables/use-init.d.ts +0 -10
  71. package/dist/types/composables/use-match.d.ts +0 -8
  72. package/dist/types/composables/use-num-range.d.ts +0 -9
  73. package/dist/types/composables/use-placeholder.d.ts +0 -8
  74. package/dist/types/composables/use-tag.d.ts +0 -9
  75. package/dist/types/smb-theme.d.ts +0 -15
  76. package/dist/types/utils/clone.d.ts +0 -12
  77. package/dist/types/utils/date.d.ts +0 -234
  78. package/dist/types/utils/dropdown.d.ts +0 -12
  79. package/dist/types/utils/en_US.d.ts +0 -43
  80. package/dist/types/utils/index.d.ts +0 -1
  81. package/dist/types/utils/tag.d.ts +0 -46
  82. package/dist/types/utils/type.d.ts +0 -6
  83. package/dist/types/utils/validate.d.ts +0 -31
  84. package/dist/types/utils/zh_CN.d.ts +0 -43
  85. /package/{dist/types → types}/index.type.d.ts +0 -0
@@ -1,18 +0,0 @@
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;
@@ -1,29 +0,0 @@
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;
@@ -1,431 +0,0 @@
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;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const showDropdown = (state, isShow = true) => {
4
- if (isShow) {
5
- state.visibleTimer = setTimeout(() => {
6
- state.visible = true;
7
- }, 0);
8
- } else {
9
- clearTimeout(state.visibleTimer);
10
- state.visibleTimer = null;
11
- state.visible = false;
12
- }
13
- };
14
- const showPopover = (state, isShow = true) => {
15
- state.popoverVisible = isShow;
16
- const { dropdownRef } = state.instance.refs;
17
- if (isShow && dropdownRef.state.visible) {
18
- clearTimeout(Number(dropdownRef.state.timeout));
19
- dropdownRef.state.timeout = null;
20
- dropdownRef.state.visible = false;
21
- }
22
- };
23
- exports.showDropdown = showDropdown;
24
- exports.showPopover = showPopover;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const enUS = {
4
- tvp: {
5
- tvpSearchbox: {
6
- defaultPlaceholder: "Select attribute filtering or enter keywords",
7
- addPlaceholder: "Add filtering criteria",
8
- tagPlaceholder: 'Please select tag key/value search, or enter "key=value" to search',
9
- dynamicPlaceholder: "Please select {newValue} to search",
10
- attributeType: "Attribute Type",
11
- propertyValue: "The value of {0}",
12
- matched: "Potential matching items",
13
- allValues: "All values",
14
- allProperty: "All Properties",
15
- operator: "Operator",
16
- clearAll: "Clear",
17
- emptyValue: "Empty value",
18
- help: "Click to view help",
19
- switchText: "Switch to default search terms",
20
- tagKey: "Key",
21
- tagValue: "Value",
22
- minValueText: "Minimum value",
23
- maxValueText: "Maximum value",
24
- rangeMinErr: "The input value must be between {0} and {1}",
25
- rangeMaxErr: "The maximum value must be greater than or equal to the minimum value, or empty",
26
- rangeNumberTitle: "Please enter at least one value",
27
- rangeDateTitle: "Please enter at least one date",
28
- timeLengthTitle: "The optional time span is within {value} days",
29
- rangeBeginLabel: "Start date",
30
- rangeEndLabel: "End date",
31
- rulekeyword1: "Keywords",
32
- notBeNull: "The value cannot be empty",
33
- noData: "There is currently no matching data available ..",
34
- selectAll: "Select All",
35
- confirm: "Confirm",
36
- cancel: "Cancel",
37
- equal: "Equal",
38
- notEqual: "Not equal",
39
- contain: "Contain",
40
- notContain: "Does not contain",
41
- initUse: "Search"
42
- }
43
- }
44
- };
45
- exports.default = enUS;
@@ -1,13 +0,0 @@
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;
@@ -1,44 +0,0 @@
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.propItem = {};
12
- state.inputValue = "";
13
- };
14
- const emitChangeModelEvent = ({ emits, state, ...args }) => {
15
- dropdown.showPopover(state, false);
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
- emits("update:modelValue", innerModelValue);
33
- emits("change", clone.deepClone(state.innerModelValue), oldVal);
34
- };
35
- const createNewTag = (newTag) => newTag;
36
- const getTagId = (props, prevItem, item) => {
37
- const idKey = prevItem.idMapKey || props.idMapKey;
38
- return item && item[idKey] !== void 0 ? { [idKey]: item[idKey] } : null;
39
- };
40
- exports.createNewTag = createNewTag;
41
- exports.emitChangeModelEvent = emitChangeModelEvent;
42
- exports.getTagId = getTagId;
43
- exports.hasTagItem = hasTagItem;
44
- exports.resetInput = resetInput;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isNumber = (value) => parseFloat(value).toString() !== "NaN";
4
- exports.isNumber = isNumber;