@opentiny/vue-search-box 0.1.1-alpha.1 → 0.1.1-alpha.3

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 (43) hide show
  1. package/README.md +28 -0
  2. package/README.zh-CN.md +28 -0
  3. package/dist/es/index.es.js +11 -3
  4. package/dist/es/index.vue.es2.js +11 -42
  5. package/dist/es/utils/en_US.es.js +37 -37
  6. package/dist/es/utils/zh_CN.es.js +1 -1
  7. package/dist/lib/index.cjs.js +10 -2
  8. package/dist/lib/index.vue.cjs2.js +83 -114
  9. package/dist/lib/utils/en_US.cjs.js +38 -38
  10. package/dist/lib/utils/zh_CN.cjs.js +2 -2
  11. package/dist/types/utils/en_US.d.ts +2 -1
  12. package/dist/types/utils/zh_CN.d.ts +2 -1
  13. package/package.json +24 -20
  14. package/__tests__/search-box.spec.ts +0 -0
  15. package/scripts/pre-release.cjs +0 -8
  16. package/src/composables/use-checkbox.ts +0 -90
  17. package/src/composables/use-custom.ts +0 -53
  18. package/src/composables/use-datepicker.ts +0 -90
  19. package/src/composables/use-dropdown.ts +0 -251
  20. package/src/composables/use-edit.ts +0 -119
  21. package/src/composables/use-init.ts +0 -69
  22. package/src/composables/use-match.ts +0 -193
  23. package/src/composables/use-num-range.ts +0 -86
  24. package/src/composables/use-placeholder.ts +0 -43
  25. package/src/composables/use-tag.ts +0 -54
  26. package/src/index.less +0 -376
  27. package/src/index.ts +0 -13
  28. package/src/index.type.ts +0 -192
  29. package/src/index.vue +0 -1138
  30. package/src/smb-theme.ts +0 -15
  31. package/src/theme.json +0 -135
  32. package/src/utils/clone.ts +0 -37
  33. package/src/utils/date.ts +0 -724
  34. package/src/utils/dropdown.ts +0 -27
  35. package/src/utils/en_US.ts +0 -41
  36. package/src/utils/index.ts +0 -11
  37. package/src/utils/tag.ts +0 -80
  38. package/src/utils/type.ts +0 -6
  39. package/src/utils/validate.ts +0 -234
  40. package/src/utils/zh_CN.ts +0 -41
  41. package/src/vars.less +0 -56
  42. package/vite.config.theme.ts +0 -20
  43. package/vite.config.ts +0 -60
package/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # TinySearchBox
2
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3
+ [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
4
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
2
5
 
3
6
  TinySearchBox is a comprehensive search component based on Vue3. It uses the TinyVue component library and follows the OpenTiny design specifications. It is easy to use and powerful. It supports single selection, multiple selection, time, time range and so on.
4
7
 
@@ -104,3 +107,28 @@ Open a browser to access:[http://localhost:5173/tiny-search-box/](http://local
104
107
  ## License
105
108
 
106
109
  [MIT](LICENSE)
110
+
111
+ ## Contributors ✨
112
+
113
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
114
+
115
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
116
+ <!-- prettier-ignore-start -->
117
+ <!-- markdownlint-disable -->
118
+ <table>
119
+ <tbody>
120
+ <tr>
121
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/chenxi-20"><img src="https://avatars.githubusercontent.com/u/76168465?v=4?s=100" width="100px;" alt="chenxi-20"/><br /><sub><b>chenxi-20</b></sub></a><br /><a href="https://github.com/opentiny/tiny-vue/commits?author=chenxi-20" title="Code">💻</a></td>
122
+ <td align="center" valign="top" width="12.5%"><a href="https://kagol.github.io/blogs"><img src="https://avatars.githubusercontent.com/u/9566362?v=4?s=100" width="100px;" alt="Kagol"/><br /><sub><b>Kagol</b></sub></a><br /><a href="https://github.com/opentiny/tiny-search-box/commits?author=kagol" title="Code">💻</a></td>
123
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/zzcr"><img src="https://avatars.githubusercontent.com/u/18521562?v=4?s=100" width="100px;" alt="ajaxzheng"/><br /><sub><b>ajaxzheng</b></sub></a><br /><a href="https://github.com/opentiny/tiny-search-box/commits?author=zzcr" title="Code">💻</a></td>
124
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/discreted66"><img src="https://avatars.githubusercontent.com/u/190872652?v=4?s=100" width="100px;" alt="liukun"/><br /><sub><b>liukun</b></sub></a><br /><a href="https://github.com/opentiny/tiny-vue/commits?author=discreted66" title="Code">💻</a></td>
125
+ </tr>
126
+ </tbody>
127
+ </table>
128
+
129
+ <!-- markdownlint-restore -->
130
+ <!-- prettier-ignore-end -->
131
+
132
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
133
+
134
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
package/README.zh-CN.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # TinySearchBox 综合搜索组件
2
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3
+ [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
4
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
2
5
 
3
6
  TinySearchBox 是一个基于 Vue3 的综合搜索组件,使用 TinyVue 组件库,遵循 OpenTiny 设计规范,简单易用、功能强大,支持单选、多选、时间、时间区间等多条件筛选。
4
7
 
@@ -105,3 +108,28 @@ pnpm dev
105
108
  ## License
106
109
 
107
110
  [MIT](LICENSE)
111
+
112
+ ## Contributors ✨
113
+
114
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
115
+
116
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
117
+ <!-- prettier-ignore-start -->
118
+ <!-- markdownlint-disable -->
119
+ <table>
120
+ <tbody>
121
+ <tr>
122
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/chenxi-20"><img src="https://avatars.githubusercontent.com/u/76168465?v=4?s=100" width="100px;" alt="chenxi-20"/><br /><sub><b>chenxi-20</b></sub></a><br /><a href="https://github.com/opentiny/tiny-vue/commits?author=chenxi-20" title="Code">💻</a></td>
123
+ <td align="center" valign="top" width="12.5%"><a href="https://kagol.github.io/blogs"><img src="https://avatars.githubusercontent.com/u/9566362?v=4?s=100" width="100px;" alt="Kagol"/><br /><sub><b>Kagol</b></sub></a><br /><a href="https://github.com/opentiny/tiny-search-box/commits?author=kagol" title="Code">💻</a></td>
124
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/zzcr"><img src="https://avatars.githubusercontent.com/u/18521562?v=4?s=100" width="100px;" alt="ajaxzheng"/><br /><sub><b>ajaxzheng</b></sub></a><br /><a href="https://github.com/opentiny/tiny-search-box/commits?author=zzcr" title="Code">💻</a></td>
125
+ <td align="center" valign="top" width="12.5%"><a href="https://github.com/discreted66"><img src="https://avatars.githubusercontent.com/u/190872652?v=4?s=100" width="100px;" alt="liukun"/><br /><sub><b>liukun</b></sub></a><br /><a href="https://github.com/opentiny/tiny-vue/commits?author=discreted66" title="Code">💻</a></td>
126
+ </tr>
127
+ </tbody>
128
+ </table>
129
+
130
+ <!-- markdownlint-restore -->
131
+ <!-- prettier-ignore-end -->
132
+
133
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
134
+
135
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -1,14 +1,22 @@
1
1
  import "./index.vue.es.js";
2
- import { zhCN } from "./utils/zh_CN.es.js";
3
- import { enUS } from "./utils/en_US.es.js";
2
+ import zhCN from "./utils/zh_CN.es.js";
3
+ import { default as default2 } from "./utils/en_US.es.js";
4
4
  /* empty css */
5
5
  import "./index.type.es.js";
6
6
  import _sfc_main from "./index.vue.es2.js";
7
+ let apps;
7
8
  _sfc_main.install = function(app) {
9
+ apps = app;
8
10
  app.component(_sfc_main.name, _sfc_main);
9
11
  };
12
+ const t = (key) => {
13
+ var _a, _b, _c, _d, _e, _f, _g;
14
+ const array = key.split(".");
15
+ return ((_b = (_a = apps == null ? void 0 : apps.config) == null ? void 0 : _a.globalProperties) == null ? void 0 : _b.$t) ? (_d = (_c = apps == null ? void 0 : apps.config) == null ? void 0 : _c.globalProperties) == null ? void 0 : _d.$t(key) : (_g = (_f = (_e = zhCN) == null ? void 0 : _e[array == null ? void 0 : array[0]]) == null ? void 0 : _f[array == null ? void 0 : array[1]]) == null ? void 0 : _g[array == null ? void 0 : array[2]];
16
+ };
10
17
  export {
11
18
  _sfc_main as default,
12
- enUS,
19
+ default2 as enUS,
20
+ t,
13
21
  zhCN
14
22
  };
@@ -15,7 +15,7 @@ import TinyPopover from "@opentiny/vue-popover";
15
15
  import TinySelect from "@opentiny/vue-select";
16
16
  import TinyOption from "@opentiny/vue-option";
17
17
  import { iconSearch, iconClose, iconHelpQuery } from "@opentiny/vue-icon";
18
- import { t } from "@opentiny/vue-locale";
18
+ import { t } from "./index.es.js";
19
19
  import { useTag } from "./composables/use-tag.es.js";
20
20
  import { useDropdown } from "./composables/use-dropdown.es.js";
21
21
  import { useMatch } from "./composables/use-match.es.js";
@@ -166,7 +166,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
166
166
  },
167
167
  emptyPlaceholder: {
168
168
  type: String,
169
- default: t("tvp.tvpSearchbox.defaultPlaceholder")
169
+ default: ""
170
170
  },
171
171
  potentialOptions: {
172
172
  type: Object,
@@ -212,13 +212,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
212
212
  default: true
213
213
  }
214
214
  },
215
- emits: [
216
- "update:modelValue",
217
- "change",
218
- "search",
219
- "exceed",
220
- "first-level-select"
221
- ],
215
+ emits: ["update:modelValue", "change", "search", "exceed", "first-level-select"],
222
216
  setup(__props, { expose: __expose, emit: __emit }) {
223
217
  const props = __props;
224
218
  const emits = __emit;
@@ -329,13 +323,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
329
323
  emits
330
324
  });
331
325
  const { handleConfirm, handleEditConfirm } = useCustom({ state, emits });
332
- const {
333
- initItems,
334
- watchOutsideClick,
335
- watchMouseDown,
336
- watchMouseMove,
337
- handleClick
338
- } = useInit({
326
+ const { initItems, watchOutsideClick, watchMouseDown, watchMouseMove, handleClick } = useInit({
339
327
  props,
340
328
  state
341
329
  });
@@ -382,7 +370,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
382
370
  });
383
371
  showPopover(state, false);
384
372
  if (newVal.length === 0) {
385
- setPlaceholder(props.emptyPlaceholder);
373
+ setPlaceholder(props.emptyPlaceholder || t("tvp.tvpSearchbox.defaultPlaceholder"));
386
374
  }
387
375
  if (props.editable && !state.inputEditValue.length && newVal[0]) {
388
376
  state.inputEditValue = newVal[0].value;
@@ -418,10 +406,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
418
406
  return openBlock(), createBlock(unref(TinyTag), {
419
407
  key: tag.field + index,
420
408
  closable: "",
421
- class: normalizeClass([
422
- "tvp-search-box__tag",
423
- __props.editable && tag.type !== "map" ? "tvp-search-box__tag-editor" : ""
424
- ]),
409
+ class: normalizeClass(["tvp-search-box__tag", __props.editable && tag.type !== "map" ? "tvp-search-box__tag-editor" : ""]),
425
410
  title: `${tag.label} ${tag.operator || ":"} ${tag.value}`,
426
411
  onClose: ($event) => unref(deleteTag)(tag),
427
412
  onClick: withModifiers(($event) => unref(editTag)(tag, index, $event), ["stop"])
@@ -498,9 +483,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
498
483
  }), 128))
499
484
  ], 64)) : createCommentVNode("", true),
500
485
  value["attrValue"].length ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
501
- createElementVNode("span", _hoisted_8, toDisplayString(unref(t)("tvp.tvpSearchbox.propertyValue", [
502
- key === "0" ? unref(t)("tvp.tvpSearchbox.attributeType") : key
503
- ])), 1),
486
+ createElementVNode("span", _hoisted_8, toDisplayString(unref(t)("tvp.tvpSearchbox.propertyValue", [key === "0" ? unref(t)("tvp.tvpSearchbox.attributeType") : key])), 1),
504
487
  (openBlock(true), createElementBlock(Fragment, null, renderList(value["attrValue"], (item, index) => {
505
488
  return openBlock(), createBlock(unref(TinyDropdownItem), {
506
489
  key: item.label + index,
@@ -554,10 +537,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
554
537
  [vShow, props.potentialOptions]
555
538
  ])
556
539
  ], 512), [
557
- [
558
- vShow,
559
- state.isResetFlag && !state.propItem.label && state.inputValue.trim()
560
- ]
540
+ [vShow, state.isResetFlag && !state.propItem.label && state.inputValue.trim()]
561
541
  ]),
562
542
  withDirectives(createElementVNode("div", _hoisted_14, [
563
543
  (openBlock(true), createElementBlock(Fragment, null, renderList(state.groupItems, (group, key) => {
@@ -580,10 +560,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
580
560
  ], 64);
581
561
  }), 128))
582
562
  ], 512), [
583
- [
584
- vShow,
585
- state.isResetFlag && !state.propItem.label && !state.inputValue.trim()
586
- ]
563
+ [vShow, state.isResetFlag && !state.propItem.label && !state.inputValue.trim()]
587
564
  ]),
588
565
  withDirectives(createElementVNode("div", null, [
589
566
  ((_a = state.currentOperators) == null ? void 0 : _a.length) ? (openBlock(), createElementBlock("div", _hoisted_17, [
@@ -1025,10 +1002,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1025
1002
  label: unref(t)("tvp.tvpSearchbox.allProperty"),
1026
1003
  value: state.allTypeAttri.label,
1027
1004
  disabled: unref(selectItemIsDisable)(state.allTypeAttri),
1028
- onClick: _cache[21] || (_cache[21] = ($event) => unref(selectPropChange)(
1029
- state.allTypeAttri,
1030
- unref(selectItemIsDisable)(state.allTypeAttri)
1031
- ))
1005
+ onClick: _cache[21] || (_cache[21] = ($event) => unref(selectPropChange)(state.allTypeAttri, unref(selectItemIsDisable)(state.allTypeAttri)))
1032
1006
  }, null, 8, ["label", "value", "disabled"])),
1033
1007
  (openBlock(true), createElementBlock(Fragment, null, renderList(state.recordItems, (item) => {
1034
1008
  return openBlock(), createBlock(unref(TinyOption), {
@@ -1070,12 +1044,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1070
1044
  _: 1
1071
1045
  })) : createCommentVNode("", true),
1072
1046
  state.prevItem.type !== "numRange" ? (openBlock(), createElementBlock("div", _hoisted_51, toDisplayString(unref(t)("tvp.tvpSearchbox.tagValue")), 1)) : createCommentVNode("", true),
1073
- ![
1074
- "numRange",
1075
- "dateRange",
1076
- "datetimeRange",
1077
- "custom"
1078
- ].includes(state.prevItem.type) ? (openBlock(), createBlock(unref(TinyFormItem), {
1047
+ !["numRange", "dateRange", "datetimeRange", "custom"].includes(state.prevItem.type) ? (openBlock(), createBlock(unref(TinyFormItem), {
1079
1048
  key: 3,
1080
1049
  prop: "inputEditValue",
1081
1050
  class: "tvp-search-box__number-item"
@@ -1,44 +1,44 @@
1
- const enUS = {
1
+ const en_US = {
2
2
  tvp: {
3
3
  tvpSearchbox: {
4
- defaultPlaceholder: "请选择属性筛选,或输入关键字",
5
- addPlaceholder: "添加筛选条件",
6
- tagPlaceholder: "请选择标签键/值搜索,或输入“键=值”搜索",
7
- dynamicPlaceholder: "请选择{newValue}搜索",
8
- attributeType: "属性类型",
9
- propertyValue: "{0}的值",
10
- matched: "潜在匹配项",
11
- allValues: "所有值",
12
- allProperty: "全部属性",
13
- operator: "运算符",
14
- clearAll: "清空",
15
- emptyValue: " ",
16
- help: "点击查看帮助",
17
- switchText: "切换到默认搜索项",
18
- tagKey: "",
19
- tagValue: "",
20
- minValueText: "最小值",
21
- maxValueText: "最大值",
22
- rangeMinErr: "输入值必须在{0}~{1}之间",
23
- rangeMaxErr: "最大值必须大于等于最小值,或者为空",
24
- rangeNumberTitle: "请至少输入一个值",
25
- rangeDateTitle: "请至少输入一个日期",
26
- timeLengthTitle: "可选时间跨度为{value}天内",
27
- rangeBeginLabel: "开始日期",
28
- rangeEndLabel: "结束日期",
29
- rulekeyword1: "关键字",
30
- notBeNull: "值不能为空",
31
- noData: "暂无匹配数据...",
32
- selectAll: "全选",
33
- confirm: "确定",
34
- cancel: "取消",
35
- equal: "等于",
36
- notEqual: "不等于",
37
- contain: "包含",
38
- notContain: "不包含"
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
39
  }
40
40
  }
41
41
  };
42
42
  export {
43
- enUS
43
+ en_US as default
44
44
  };
@@ -40,5 +40,5 @@ const zhCN = {
40
40
  }
41
41
  };
42
42
  export {
43
- zhCN
43
+ zhCN as default
44
44
  };
@@ -6,9 +6,17 @@ const en_US = require("./utils/en_US.cjs.js");
6
6
  ;/* empty css */
7
7
  require("./index.type.cjs.js");
8
8
  const index_vue_vue_type_script_setup_true_lang = require("./index.vue.cjs2.js");
9
+ let apps;
9
10
  index_vue_vue_type_script_setup_true_lang.default.install = function(app) {
11
+ apps = app;
10
12
  app.component(index_vue_vue_type_script_setup_true_lang.default.name, index_vue_vue_type_script_setup_true_lang.default);
11
13
  };
12
- exports.zhCN = zh_CN.zhCN;
13
- exports.enUS = en_US.enUS;
14
+ const t = (key) => {
15
+ var _a, _b, _c, _d, _e, _f, _g;
16
+ const array = key.split(".");
17
+ return ((_b = (_a = apps == null ? void 0 : apps.config) == null ? void 0 : _a.globalProperties) == null ? void 0 : _b.$t) ? (_d = (_c = apps == null ? void 0 : apps.config) == null ? void 0 : _c.globalProperties) == null ? void 0 : _d.$t(key) : (_g = (_f = (_e = zh_CN.default) == null ? void 0 : _e[array == null ? void 0 : array[0]]) == null ? void 0 : _f[array == null ? void 0 : array[1]]) == null ? void 0 : _g[array == null ? void 0 : array[2]];
18
+ };
19
+ exports.zhCN = zh_CN.default;
20
+ exports.enUS = en_US.default;
14
21
  exports.default = index_vue_vue_type_script_setup_true_lang.default;
22
+ exports.t = t;