hzzt-plus 2.0.0 → 2.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 (76) hide show
  1. package/attributes.json +1 -1
  2. package/dist/index.full.js +20 -14
  3. package/dist/index.full.min.js +3 -3
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +8 -8
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +20 -14
  8. package/dist/locale/en.js +1 -1
  9. package/dist/locale/en.min.js +1 -1
  10. package/dist/locale/en.min.mjs +1 -1
  11. package/dist/locale/en.mjs +1 -1
  12. package/dist/locale/zh-cn.js +1 -1
  13. package/dist/locale/zh-cn.min.js +1 -1
  14. package/dist/locale/zh-cn.min.mjs +1 -1
  15. package/dist/locale/zh-cn.mjs +1 -1
  16. package/es/components/index.mjs +2 -2
  17. package/es/components/input-range/index.mjs +2 -2
  18. package/es/components/input-range/src/input-range.mjs +76 -26
  19. package/es/components/input-range/src/input-range.mjs.map +1 -1
  20. package/es/components/input-range/src/input-range2.mjs +26 -76
  21. package/es/components/input-range/src/input-range2.mjs.map +1 -1
  22. package/es/components/scroll/index.mjs +2 -2
  23. package/es/components/scroll/src/scroll.mjs +86 -0
  24. package/es/components/scroll/src/scroll.mjs.map +1 -1
  25. package/es/components/scroll/src/scroll2.mjs +0 -86
  26. package/es/components/scroll/src/scroll2.mjs.map +1 -1
  27. package/es/components/select-input/index.d.ts +4 -4
  28. package/es/components/select-input/src/select-input.d.ts +1 -1
  29. package/es/components/select-input/src/select-input.mjs +1 -1
  30. package/es/components/select-input/src/select-input.mjs.map +1 -1
  31. package/es/components/select-input/src/select-input.vue.d.ts +4 -4
  32. package/es/components/select-input/src/select-input2.mjs +2 -2
  33. package/es/components/select-input/src/select-input2.mjs.map +1 -1
  34. package/es/components/select-textarea/index.mjs +2 -2
  35. package/es/components/select-textarea/src/select-textarea.d.ts +2 -1
  36. package/es/components/select-textarea/src/select-textarea.mjs +31 -100
  37. package/es/components/select-textarea/src/select-textarea.mjs.map +1 -1
  38. package/es/components/select-textarea/src/select-textarea.vue.d.ts +14 -4
  39. package/es/components/select-textarea/src/select-textarea2.mjs +105 -30
  40. package/es/components/select-textarea/src/select-textarea2.mjs.map +1 -1
  41. package/es/index.mjs +2 -2
  42. package/es/version.d.ts +1 -1
  43. package/es/version.mjs +1 -1
  44. package/es/version.mjs.map +1 -1
  45. package/lib/components/index.js +2 -2
  46. package/lib/components/input-range/index.js +2 -2
  47. package/lib/components/input-range/src/input-range.js +76 -27
  48. package/lib/components/input-range/src/input-range.js.map +1 -1
  49. package/lib/components/input-range/src/input-range2.js +27 -76
  50. package/lib/components/input-range/src/input-range2.js.map +1 -1
  51. package/lib/components/scroll/index.js +2 -2
  52. package/lib/components/scroll/src/scroll.js +89 -0
  53. package/lib/components/scroll/src/scroll.js.map +1 -1
  54. package/lib/components/scroll/src/scroll2.js +0 -89
  55. package/lib/components/scroll/src/scroll2.js.map +1 -1
  56. package/lib/components/select-input/index.d.ts +4 -4
  57. package/lib/components/select-input/src/select-input.d.ts +1 -1
  58. package/lib/components/select-input/src/select-input.js +1 -1
  59. package/lib/components/select-input/src/select-input.js.map +1 -1
  60. package/lib/components/select-input/src/select-input.vue.d.ts +4 -4
  61. package/lib/components/select-input/src/select-input2.js +2 -2
  62. package/lib/components/select-input/src/select-input2.js.map +1 -1
  63. package/lib/components/select-textarea/index.js +2 -2
  64. package/lib/components/select-textarea/src/select-textarea.d.ts +2 -1
  65. package/lib/components/select-textarea/src/select-textarea.js +32 -100
  66. package/lib/components/select-textarea/src/select-textarea.js.map +1 -1
  67. package/lib/components/select-textarea/src/select-textarea.vue.d.ts +14 -4
  68. package/lib/components/select-textarea/src/select-textarea2.js +105 -31
  69. package/lib/components/select-textarea/src/select-textarea2.js.map +1 -1
  70. package/lib/index.js +2 -2
  71. package/lib/version.d.ts +1 -1
  72. package/lib/version.js +1 -1
  73. package/lib/version.js.map +1 -1
  74. package/package.json +1 -1
  75. package/tags.json +1 -1
  76. package/web-types.json +1 -1
package/es/index.mjs CHANGED
@@ -25,9 +25,9 @@ export { scanEmits, scanProps } from './components/scan/src/scan.mjs';
25
25
  export { HzztScan } from './components/scan/index.mjs';
26
26
  export { selectInputEmits, selectInputProps } from './components/select-input/src/select-input.mjs';
27
27
  export { HzztSelectInput } from './components/select-input/index.mjs';
28
- export { selectTextareaEmits, selectTextareaProps } from './components/select-textarea/src/select-textarea2.mjs';
28
+ export { selectTextareaEmits, selectTextareaProps } from './components/select-textarea/src/select-textarea.mjs';
29
29
  export { HzztSelectTextarea } from './components/select-textarea/index.mjs';
30
- export { inputRangeEmits, inputRangeProps } from './components/input-range/src/input-range.mjs';
30
+ export { inputRangeEmits, inputRangeProps } from './components/input-range/src/input-range2.mjs';
31
31
  export { HzztInputRange } from './components/input-range/index.mjs';
32
32
  export { cascaderEmits, cascaderProps } from './components/cascader/src/cascader.mjs';
33
33
  export { HzztCascader } from './components/cascader/index.mjs';
package/es/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.0.0";
1
+ export declare const version = "2.0.1";
package/es/version.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const version = "2.0.0";
1
+ const version = "2.0.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../packages/hzzt-plus/version.ts"],"sourcesContent":["export const version = '2.0.0'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../packages/hzzt-plus/version.ts"],"sourcesContent":["export const version = '2.0.1'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
@@ -28,8 +28,8 @@ var constants = require('./config-provider/src/constants.js');
28
28
  var useGlobalConfig = require('./config-provider/src/hooks/use-global-config.js');
29
29
  var scan = require('./scan/src/scan.js');
30
30
  var selectInput = require('./select-input/src/select-input.js');
31
- var selectTextarea = require('./select-textarea/src/select-textarea2.js');
32
- var inputRange = require('./input-range/src/input-range.js');
31
+ var selectTextarea = require('./select-textarea/src/select-textarea.js');
32
+ var inputRange = require('./input-range/src/input-range2.js');
33
33
  var cascader = require('./cascader/src/cascader.js');
34
34
  var select = require('./select/src/select.js');
35
35
  var clickInput = require('./click-input/src/click-input.js');
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
- var inputRange$1 = require('./src/input-range2.js');
7
- var inputRange = require('./src/input-range.js');
6
+ var inputRange$1 = require('./src/input-range.js');
7
+ var inputRange = require('./src/input-range2.js');
8
8
  var install = require('../../utils/vue/install.js');
9
9
 
10
10
  const HzztInputRange = install.withInstall(inputRange$1["default"]);
@@ -2,35 +2,84 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../utils/index.js');
5
+ var vue = require('vue');
6
+ var inputRange = require('./input-range2.js');
7
+ var elementPlus = require('element-plus');
6
8
  require('../../../hooks/index.js');
7
- require('../../../constants/index.js');
8
- var runtime = require('../../../utils/vue/props/runtime.js');
9
- var index = require('../../../hooks/use-size/index.js');
10
- var event = require('../../../constants/event.js');
11
- var shared = require('@vue/shared');
9
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
10
+ var index = require('../../../hooks/use-namespace/index.js');
11
+ var index$1 = require('../../../hooks/use-size/index.js');
12
12
 
13
- const inputRangeProps = runtime.buildProps({
14
- modelValue: {
15
- type: Array,
16
- default: () => []
17
- },
18
- size: index.useSizeProp,
19
- disabled: Boolean,
20
- clearable: {
21
- type: Boolean,
22
- default: false
23
- },
24
- startPlaceholder: String,
25
- endPlaceholder: String,
26
- startProps: Object,
27
- endProps: Object
13
+ const _hoisted_1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "margin-h-1" }, "\u2014\u2014", -1);
14
+ const __default__ = vue.defineComponent({
15
+ name: "HzztInputRange"
28
16
  });
29
- const inputRangeEmits = {
30
- [event.UPDATE_MODEL_EVENT]: (val) => shared.isArray(val),
31
- [event.CHANGE_EVENT]: (val) => shared.isArray(val)
32
- };
17
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
18
+ ...__default__,
19
+ props: inputRange.inputRangeProps,
20
+ emits: inputRange.inputRangeEmits,
21
+ setup(__props, { emit }) {
22
+ const props = __props;
23
+ const startValue = vue.ref(props.modelValue[0]);
24
+ const endValue = vue.ref(props.modelValue[1]);
25
+ const nsInput = index.useNamespace("input-range");
26
+ const formSize = elementPlus.useFormSize();
27
+ const formDisabled = elementPlus.useFormDisabled();
28
+ const trueSize = vue.computed(() => props.size || formSize.value || index$1.useGlobalSize().value);
29
+ const trueDisabled = vue.computed(() => props.disabled || formDisabled.value);
30
+ const containerCls = vue.computed(() => [
31
+ nsInput.b(),
32
+ nsInput.m(trueSize.value)
33
+ ]);
34
+ vue.watch(() => props.modelValue, (v) => {
35
+ startValue.value = v[0];
36
+ endValue.value = v[1];
37
+ }, {
38
+ deep: true
39
+ });
40
+ function change() {
41
+ if (startValue.value || endValue.value) {
42
+ const modelValue = [startValue.value, endValue.value];
43
+ emit("update:modelValue", modelValue);
44
+ emit("change", modelValue);
45
+ } else if (!startValue.value && !endValue.value) {
46
+ emit("update:modelValue", []);
47
+ emit("change", []);
48
+ }
49
+ }
50
+ return (_ctx, _cache) => {
51
+ const _component_el_input = vue.resolveComponent("el-input");
52
+ return vue.openBlock(), vue.createElementBlock("div", {
53
+ class: vue.normalizeClass(["flex align-items-center", vue.unref(containerCls)])
54
+ }, [
55
+ vue.createVNode(_component_el_input, vue.mergeProps({
56
+ modelValue: startValue.value,
57
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => startValue.value = $event)
58
+ }, _ctx.startProps, {
59
+ clearable: _ctx.clearable,
60
+ placeholder: _ctx.startPlaceholder,
61
+ size: vue.unref(trueSize),
62
+ disabled: vue.unref(trueDisabled),
63
+ class: "flex-1",
64
+ onChange: change
65
+ }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"]),
66
+ _hoisted_1,
67
+ vue.createVNode(_component_el_input, vue.mergeProps({
68
+ modelValue: endValue.value,
69
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => endValue.value = $event)
70
+ }, _ctx.endProps, {
71
+ clearable: _ctx.clearable,
72
+ placeholder: _ctx.endPlaceholder,
73
+ size: vue.unref(trueSize),
74
+ disabled: vue.unref(trueDisabled),
75
+ class: "flex-1",
76
+ onChange: change
77
+ }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"])
78
+ ], 2);
79
+ };
80
+ }
81
+ });
82
+ var InputRange = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "input-range.vue"]]);
33
83
 
34
- exports.inputRangeEmits = inputRangeEmits;
35
- exports.inputRangeProps = inputRangeProps;
84
+ exports["default"] = InputRange;
36
85
  //# sourceMappingURL=input-range.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-range.js","sources":["../../../../../../packages/components/input-range/src/input-range.ts"],"sourcesContent":["import {buildProps, isArray} from '@hzzt-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type InputRange from './input-range.vue'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\nimport {CHANGE_EVENT, UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const inputRangeProps = buildProps({\n modelValue: {\n type: Array,\n default: () => [],\n },\n size: useSizeProp,\n disabled: Boolean,\n clearable: {\n type: Boolean,\n default: false,\n },\n startPlaceholder: String,\n endPlaceholder: String,\n startProps: Object,\n endProps: Object,\n})\n\nexport type InputRangeProps = ExtractPropTypes<typeof inputRangeProps>\n\nexport const inputRangeEmits = {\n [UPDATE_MODEL_EVENT]: (val: Array<string>) => isArray(val),\n [CHANGE_EVENT]: (val: Array<string>) => isArray(val),\n}\nexport type InputRangeEmits = typeof inputRangeEmits\n\nexport type InputRangeInstance = InstanceType<typeof InputRange>\n"],"names":["buildProps","useSizeProp","UPDATE_MODEL_EVENT","isArray","CHANGE_EVENT"],"mappings":";;;;;;;;;;;;AAGY,MAAC,eAAe,GAAGA,kBAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,gBAAgB,EAAE,MAAM;AAC1B,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,QAAQ,EAAE,MAAM;AAClB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,cAAO,CAAC,GAAG,CAAC;AAC7C,EAAE,CAACC,kBAAY,GAAG,CAAC,GAAG,KAAKD,cAAO,CAAC,GAAG,CAAC;AACvC;;;;;"}
1
+ {"version":3,"file":"input-range.js","sources":["../../../../../../packages/components/input-range/src/input-range.vue"],"sourcesContent":["<template>\n <div class=\"flex align-items-center\" :class=\"containerCls\">\n <el-input\n v-model=\"startValue\"\n v-bind=\"startProps\"\n :clearable=\"clearable\"\n :placeholder=\"startPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n <span class=\"margin-h-1\">——</span>\n <el-input\n v-model=\"endValue\"\n v-bind=\"endProps\"\n :clearable=\"clearable\"\n :placeholder=\"endPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {inputRangeEmits, inputRangeProps} from './input-range'\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import {computed, ref, watch} from \"vue\";\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n\n defineOptions({\n name: 'HzztInputRange',\n })\n\n const props = defineProps(inputRangeProps)\n const emit = defineEmits(inputRangeEmits)\n\n const startValue = ref(props.modelValue[0])\n const endValue = ref(props.modelValue[1])\n\n const nsInput = useNamespace('input-range')\n\n const formSize = useFormSize()\n const formDisabled = useFormDisabled()\n\n const trueSize = computed(\n () => props.size || formSize.value || useGlobalSize().value\n )\n\n const trueDisabled = computed(() => props.disabled || formDisabled.value)\n\n const containerCls = computed(() => [\n nsInput.b(),\n nsInput.m(trueSize.value),\n ])\n\n watch(() => props.modelValue, (v) => {\n startValue.value = v[0];\n endValue.value = v[1];\n }, {\n deep: true,\n })\n\n function change() {\n if (startValue.value || endValue.value) {\n const modelValue = [startValue.value, endValue.value] as Array<string>;\n emit('update:modelValue', modelValue);\n emit('change', modelValue);\n } else if (!startValue.value && !endValue.value) {\n emit('update:modelValue', []);\n emit('change', []);\n }\n }\n\n</script>\n"],"names":["_defineComponent","computed","watch","_resolveComponent","_openBlock","_createElementBlock","_unref","_createVNode","_mergeProps"],"mappings":";;;;;;;;;;;;;;AA2BE,EAAA,IAAA,EAAA;AACA,CAAA,CAAA,CAAA;AACA,MAAQ,SAAA,mBAA2BA,mBAAA,CAAA;AACnC,EAAA,GAAA;;mCAEc;AAAA,EACZ,KAAM,CAAA,OAAA,EAAA,EAAA,IAAA,EAAA,EAAA;AACR,IAAA,MAAA,KAAA,GAAA,OAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,YAAa,GAAAC,YAAU,CAAA,MAAA,KAAY,CAAC,QAAA,IAAA,YAAA,CAAA,KAAA,CAAA,CAAA;AAC1C,IAAA,MAAM,YAAW,GAAIA,YAAM,CAAA,MAAA;AAE3B,MAAM,OAAA,CAAA,CAAA,EAAA;AAEN,MAAA,kBAA6B,CAAA,KAAA,CAAA;AAC7B,KAAA,CAAA,CAAA;AAEA,IAAAC,SAAA,CAAM,MAAW,KAAA,CAAA,UAAA,EAAA,CAAA,CAAA,KAAA;AAAA,MACf,UAAY,CAAA,KAAA,GAAA,CAAQ,CAAS,CAAA,CAAA,CAAA;AAAyB,MACxD,QAAA,CAAA,KAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,KAAA,EAAA;AAEA,MAAM,IAAA,EAAA,IAAA;AAA8B,KAAA,CAClC;AAAU,IACV,SAAA,MAAU,GAAA;AAAc,MACzB,IAAA,UAAA,CAAA,KAAA,IAAA,QAAA,CAAA,KAAA,EAAA;AAED,QAAA,MAAY,UAAkB,GAAA,CAAA,UAAO,CAAA,KAAA,EAAA,QAAA,CAAA,KAAA,CAAA,CAAA;AACnC,QAAW,IAAA,CAAA,mBAAW,EAAA,UAAA,CAAA,CAAA;AACtB,QAAS,IAAA,CAAA,QAAA,EAAQ,UAAG,CAAA,CAAA;AAAA,OACnB,MAAA,IAAA,CAAA,UAAA,CAAA,KAAA,IAAA,CAAA,QAAA,CAAA,KAAA,EAAA;AAAA,QACK,IAAA,CAAA,mBAAA,EAAA,EAAA,CAAA,CAAA;AAAA,QACP,IAAA,CAAA,QAAA,EAAA,EAAA,CAAA,CAAA;AAED,OAAA;AACE,KAAI;AACF,IAAA,OAAA,CAAA,IAAmB,EAAA,MAAA,KAAY;AAC/B,MAAA,MAAA,sBAA0BC,oBAAU,CAAA,UAAA,CAAA,CAAA;AACpC,MAAA,OAAKC,aAAU,EAAU,EAAAC,sBAAA,CAAA,KAAA,EAAA;AAAA,iCACK,CAAA,CAAA,yBAAiB,EAAAC,SAAA,CAAA,YAAA,CAAA,CAAA,CAAA;AAC/C,OAAK,EAAA;AACL,QAAKC,eAAA,CAAA,mBAAY,EAAAC,cAAA,CAAA;AAAA,UACnB,UAAA,EAAA,UAAA,CAAA,KAAA;AAAA,UACF,qBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,UAAA,CAAA,KAAA,GAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,84 +2,35 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- var inputRange = require('./input-range.js');
7
- var elementPlus = require('element-plus');
5
+ require('../../../utils/index.js');
8
6
  require('../../../hooks/index.js');
9
- var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
10
- var index = require('../../../hooks/use-namespace/index.js');
11
- var index$1 = require('../../../hooks/use-size/index.js');
7
+ require('../../../constants/index.js');
8
+ var runtime = require('../../../utils/vue/props/runtime.js');
9
+ var index = require('../../../hooks/use-size/index.js');
10
+ var event = require('../../../constants/event.js');
11
+ var shared = require('@vue/shared');
12
12
 
13
- const _hoisted_1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "margin-h-1" }, "\u2014\u2014", -1);
14
- const __default__ = vue.defineComponent({
15
- name: "HzztInputRange"
13
+ const inputRangeProps = runtime.buildProps({
14
+ modelValue: {
15
+ type: Array,
16
+ default: () => []
17
+ },
18
+ size: index.useSizeProp,
19
+ disabled: Boolean,
20
+ clearable: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ startPlaceholder: String,
25
+ endPlaceholder: String,
26
+ startProps: Object,
27
+ endProps: Object
16
28
  });
17
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
18
- ...__default__,
19
- props: inputRange.inputRangeProps,
20
- emits: inputRange.inputRangeEmits,
21
- setup(__props, { emit }) {
22
- const props = __props;
23
- const startValue = vue.ref(props.modelValue[0]);
24
- const endValue = vue.ref(props.modelValue[1]);
25
- const nsInput = index.useNamespace("input-range");
26
- const formSize = elementPlus.useFormSize();
27
- const formDisabled = elementPlus.useFormDisabled();
28
- const trueSize = vue.computed(() => props.size || formSize.value || index$1.useGlobalSize().value);
29
- const trueDisabled = vue.computed(() => props.disabled || formDisabled.value);
30
- const containerCls = vue.computed(() => [
31
- nsInput.b(),
32
- nsInput.m(trueSize.value)
33
- ]);
34
- vue.watch(() => props.modelValue, (v) => {
35
- startValue.value = v[0];
36
- endValue.value = v[1];
37
- }, {
38
- deep: true
39
- });
40
- function change() {
41
- if (startValue.value || endValue.value) {
42
- const modelValue = [startValue.value, endValue.value];
43
- emit("update:modelValue", modelValue);
44
- emit("change", modelValue);
45
- } else if (!startValue.value && !endValue.value) {
46
- emit("update:modelValue", []);
47
- emit("change", []);
48
- }
49
- }
50
- return (_ctx, _cache) => {
51
- const _component_el_input = vue.resolveComponent("el-input");
52
- return vue.openBlock(), vue.createElementBlock("div", {
53
- class: vue.normalizeClass(["flex align-items-center", vue.unref(containerCls)])
54
- }, [
55
- vue.createVNode(_component_el_input, vue.mergeProps({
56
- modelValue: startValue.value,
57
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => startValue.value = $event)
58
- }, _ctx.startProps, {
59
- clearable: _ctx.clearable,
60
- placeholder: _ctx.startPlaceholder,
61
- size: vue.unref(trueSize),
62
- disabled: vue.unref(trueDisabled),
63
- class: "flex-1",
64
- onChange: change
65
- }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"]),
66
- _hoisted_1,
67
- vue.createVNode(_component_el_input, vue.mergeProps({
68
- modelValue: endValue.value,
69
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => endValue.value = $event)
70
- }, _ctx.endProps, {
71
- clearable: _ctx.clearable,
72
- placeholder: _ctx.endPlaceholder,
73
- size: vue.unref(trueSize),
74
- disabled: vue.unref(trueDisabled),
75
- class: "flex-1",
76
- onChange: change
77
- }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"])
78
- ], 2);
79
- };
80
- }
81
- });
82
- var InputRange = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "input-range.vue"]]);
29
+ const inputRangeEmits = {
30
+ [event.UPDATE_MODEL_EVENT]: (val) => shared.isArray(val),
31
+ [event.CHANGE_EVENT]: (val) => shared.isArray(val)
32
+ };
83
33
 
84
- exports["default"] = InputRange;
34
+ exports.inputRangeEmits = inputRangeEmits;
35
+ exports.inputRangeProps = inputRangeProps;
85
36
  //# sourceMappingURL=input-range2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-range2.js","sources":["../../../../../../packages/components/input-range/src/input-range.vue"],"sourcesContent":["<template>\n <div class=\"flex align-items-center\" :class=\"containerCls\">\n <el-input\n v-model=\"startValue\"\n v-bind=\"startProps\"\n :clearable=\"clearable\"\n :placeholder=\"startPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n <span class=\"margin-h-1\">——</span>\n <el-input\n v-model=\"endValue\"\n v-bind=\"endProps\"\n :clearable=\"clearable\"\n :placeholder=\"endPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {inputRangeEmits, inputRangeProps} from './input-range'\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import {computed, ref, watch} from \"vue\";\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n\n defineOptions({\n name: 'HzztInputRange',\n })\n\n const props = defineProps(inputRangeProps)\n const emit = defineEmits(inputRangeEmits)\n\n const startValue = ref(props.modelValue[0])\n const endValue = ref(props.modelValue[1])\n\n const nsInput = useNamespace('input-range')\n\n const formSize = useFormSize()\n const formDisabled = useFormDisabled()\n\n const trueSize = computed(\n () => props.size || formSize.value || useGlobalSize().value\n )\n\n const trueDisabled = computed(() => props.disabled || formDisabled.value)\n\n const containerCls = computed(() => [\n nsInput.b(),\n nsInput.m(trueSize.value),\n ])\n\n watch(() => props.modelValue, (v) => {\n startValue.value = v[0];\n endValue.value = v[1];\n }, {\n deep: true,\n })\n\n function change() {\n if (startValue.value || endValue.value) {\n const modelValue = [startValue.value, endValue.value] as Array<string>;\n emit('update:modelValue', modelValue);\n emit('change', modelValue);\n } else if (!startValue.value && !endValue.value) {\n emit('update:modelValue', []);\n emit('change', []);\n }\n }\n\n</script>\n"],"names":["_defineComponent","computed","watch","_resolveComponent","_openBlock","_createElementBlock","_unref","_createVNode","_mergeProps"],"mappings":";;;;;;;;;;;;;;AA2BE,EAAA,IAAA,EAAA;AACA,CAAA,CAAA,CAAA;AACA,MAAQ,SAAA,mBAA2BA,mBAAA,CAAA;AACnC,EAAA,GAAA;;mCAEc;AAAA,EACZ,KAAM,CAAA,OAAA,EAAA,EAAA,IAAA,EAAA,EAAA;AACR,IAAA,MAAA,KAAA,GAAA,OAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,YAAa,GAAAC,YAAU,CAAA,MAAA,KAAY,CAAC,QAAA,IAAA,YAAA,CAAA,KAAA,CAAA,CAAA;AAC1C,IAAA,MAAM,YAAW,GAAIA,YAAM,CAAA,MAAA;AAE3B,MAAM,OAAA,CAAA,CAAA,EAAA;AAEN,MAAA,kBAA6B,CAAA,KAAA,CAAA;AAC7B,KAAA,CAAA,CAAA;AAEA,IAAAC,SAAA,CAAM,MAAW,KAAA,CAAA,UAAA,EAAA,CAAA,CAAA,KAAA;AAAA,MACf,UAAY,CAAA,KAAA,GAAA,CAAQ,CAAS,CAAA,CAAA,CAAA;AAAyB,MACxD,QAAA,CAAA,KAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,KAAA,EAAA;AAEA,MAAM,IAAA,EAAA,IAAA;AAA8B,KAAA,CAClC;AAAU,IACV,SAAA,MAAU,GAAA;AAAc,MACzB,IAAA,UAAA,CAAA,KAAA,IAAA,QAAA,CAAA,KAAA,EAAA;AAED,QAAA,MAAY,UAAkB,GAAA,CAAA,UAAO,CAAA,KAAA,EAAA,QAAA,CAAA,KAAA,CAAA,CAAA;AACnC,QAAW,IAAA,CAAA,mBAAW,EAAA,UAAA,CAAA,CAAA;AACtB,QAAS,IAAA,CAAA,QAAA,EAAQ,UAAG,CAAA,CAAA;AAAA,OACnB,MAAA,IAAA,CAAA,UAAA,CAAA,KAAA,IAAA,CAAA,QAAA,CAAA,KAAA,EAAA;AAAA,QACK,IAAA,CAAA,mBAAA,EAAA,EAAA,CAAA,CAAA;AAAA,QACP,IAAA,CAAA,QAAA,EAAA,EAAA,CAAA,CAAA;AAED,OAAA;AACE,KAAI;AACF,IAAA,OAAA,CAAA,IAAmB,EAAA,MAAA,KAAY;AAC/B,MAAA,MAAA,sBAA0BC,oBAAU,CAAA,UAAA,CAAA,CAAA;AACpC,MAAA,OAAKC,aAAU,EAAU,EAAAC,sBAAA,CAAA,KAAA,EAAA;AAAA,iCACK,CAAA,CAAA,yBAAiB,EAAAC,SAAA,CAAA,YAAA,CAAA,CAAA,CAAA;AAC/C,OAAK,EAAA;AACL,QAAKC,eAAA,CAAA,mBAAY,EAAAC,cAAA,CAAA;AAAA,UACnB,UAAA,EAAA,UAAA,CAAA,KAAA;AAAA,UACF,qBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,UAAA,CAAA,KAAA,GAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"input-range2.js","sources":["../../../../../../packages/components/input-range/src/input-range.ts"],"sourcesContent":["import {buildProps, isArray} from '@hzzt-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type InputRange from './input-range.vue'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\nimport {CHANGE_EVENT, UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const inputRangeProps = buildProps({\n modelValue: {\n type: Array,\n default: () => [],\n },\n size: useSizeProp,\n disabled: Boolean,\n clearable: {\n type: Boolean,\n default: false,\n },\n startPlaceholder: String,\n endPlaceholder: String,\n startProps: Object,\n endProps: Object,\n})\n\nexport type InputRangeProps = ExtractPropTypes<typeof inputRangeProps>\n\nexport const inputRangeEmits = {\n [UPDATE_MODEL_EVENT]: (val: Array<string>) => isArray(val),\n [CHANGE_EVENT]: (val: Array<string>) => isArray(val),\n}\nexport type InputRangeEmits = typeof inputRangeEmits\n\nexport type InputRangeInstance = InstanceType<typeof InputRange>\n"],"names":["buildProps","useSizeProp","UPDATE_MODEL_EVENT","isArray","CHANGE_EVENT"],"mappings":";;;;;;;;;;;;AAGY,MAAC,eAAe,GAAGA,kBAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,gBAAgB,EAAE,MAAM;AAC1B,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,QAAQ,EAAE,MAAM;AAClB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,cAAO,CAAC,GAAG,CAAC;AAC7C,EAAE,CAACC,kBAAY,GAAG,CAAC,GAAG,KAAKD,cAAO,CAAC,GAAG,CAAC;AACvC;;;;;"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
- var scroll = require('./src/scroll2.js');
7
- require('./src/scroll.js');
6
+ var scroll = require('./src/scroll.js');
7
+ require('./src/scroll2.js');
8
8
  var install = require('../../utils/vue/install.js');
9
9
 
10
10
  const HzztScroll = install.withInstall(scroll["default"]);
@@ -1,3 +1,92 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var core = require('@vueuse/core');
7
+ var index = require('../../icon/src/index.js');
8
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
+
10
+ const __default__ = vue.defineComponent({
11
+ name: "HzztScroll"
12
+ });
13
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
+ ...__default__,
15
+ setup(__props) {
16
+ const navTranslateX = vue.ref(0);
17
+ const scrollRef = vue.ref(null);
18
+ const scrollContentRef = vue.ref(null);
19
+ const scrollable = vue.ref(false);
20
+ function update() {
21
+ if (!scrollRef.value || !scrollContentRef.value)
22
+ return;
23
+ const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
24
+ const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
25
+ if (scrollWidth >= contentWidth) {
26
+ scrollable.value = false;
27
+ navTranslateX.value = 0;
28
+ return;
29
+ }
30
+ scrollable.value = true;
31
+ }
32
+ core.useResizeObserver(scrollContentRef, update);
33
+ vue.onUpdated(() => update());
34
+ function btnNavPrev() {
35
+ var _a;
36
+ const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
37
+ const currentOffset = navTranslateX.value;
38
+ if (!currentOffset)
39
+ return;
40
+ const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
41
+ navTranslateX.value = newOffset;
42
+ }
43
+ function btnNavNext() {
44
+ var _a, _b;
45
+ const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
46
+ const currentOffset = navTranslateX.value;
47
+ const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
48
+ if (navSize - currentOffset < containerSize)
49
+ return;
50
+ const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
51
+ navTranslateX.value = newOffset;
52
+ }
53
+ return (_ctx, _cache) => {
54
+ return vue.openBlock(), vue.createElementBlock("div", {
55
+ class: vue.normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
56
+ }, [
57
+ scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
58
+ key: 0,
59
+ class: "hzzt-scroll__nav-prev",
60
+ onClick: btnNavPrev
61
+ }, [
62
+ vue.createVNode(index["default"], { name: "arrow-left" })
63
+ ])) : vue.createCommentVNode("v-if", true),
64
+ scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
65
+ key: 1,
66
+ class: "hzzt-scroll__nav-next",
67
+ onClick: btnNavNext
68
+ }, [
69
+ vue.createVNode(index["default"], { name: "arrow-right" })
70
+ ])) : vue.createCommentVNode("v-if", true),
71
+ vue.createElementVNode("div", {
72
+ ref_key: "scrollRef",
73
+ ref: scrollRef,
74
+ class: "overflow-hidden"
75
+ }, [
76
+ vue.createElementVNode("div", {
77
+ ref_key: "scrollContentRef",
78
+ ref: scrollContentRef,
79
+ style: vue.normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
80
+ class: "hzzt-scroll__content"
81
+ }, [
82
+ vue.renderSlot(_ctx.$slots, "default")
83
+ ], 4)
84
+ ], 512)
85
+ ], 2);
86
+ };
87
+ }
88
+ });
89
+ var Scroll = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "scroll.vue"]]);
90
+
91
+ exports["default"] = Scroll;
3
92
  //# sourceMappingURL=scroll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"scroll.js","sources":["../../../../../../packages/components/scroll/src/scroll.vue"],"sourcesContent":["<template>\n <div :class=\"{'is-scrollable':scrollable}\" class=\"relative hzzt-scroll\">\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-prev\" @click=\"btnNavPrev\">\n <hzzt-icon name=\"arrow-left\" />\n </div>\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-next\" @click=\"btnNavNext\">\n <hzzt-icon name=\"arrow-right\" />\n </div>\n <div ref=\"scrollRef\" class=\"overflow-hidden\">\n <div ref=\"scrollContentRef\" :style=\"{transform: `translateX(${-navTranslateX}px)`}\" class=\"hzzt-scroll__content\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {onUpdated, ref} from 'vue';\n import {useResizeObserver} from '@vueuse/core';\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n defineOptions({\n name: 'HzztScroll',\n })\n\n const navTranslateX = ref(0);\n const scrollRef = ref<HTMLElement | null>(null);\n const scrollContentRef = ref<HTMLElement | null>(null);\n const scrollable = ref(false);\n\n function update() {\n if (!scrollRef.value || !scrollContentRef.value) return;\n const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;\n const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;\n if (scrollWidth >= contentWidth) {\n scrollable.value = false;\n navTranslateX.value = 0;\n return;\n }\n scrollable.value = true;\n }\n\n useResizeObserver(scrollContentRef, update);\n\n onUpdated(() => update());\n\n function btnNavPrev() {\n const containerSize = scrollRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n if (!currentOffset) return;\n const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;\n navTranslateX.value = newOffset;\n }\n\n function btnNavNext() {\n const navSize = scrollContentRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n const containerSize = scrollRef.value?.offsetWidth || 0;\n if (navSize - currentOffset < containerSize) return;\n const newOffset = navSize - currentOffset > containerSize * 2 ?\n currentOffset + containerSize :\n navSize - containerSize;\n navTranslateX.value = newOffset;\n }\n</script>\n"],"names":["ref","useResizeObserver","onUpdated"],"mappings":";;;;;;;;;uCAqBgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,aAAA,GAAgBA,QAAI,CAAC,CAAA,CAAA;AAC3B,IAAM,MAAA,SAAA,GAAYA,QAAwB,IAAI,CAAA,CAAA;AAC9C,IAAM,MAAA,gBAAA,GAAmBA,QAAwB,IAAI,CAAA,CAAA;AACrD,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAA,SAAS,MAAS,GAAA;AAChB,MAAA,IAAI,CAAC,SAAA,CAAU,KAAS,IAAA,CAAC,gBAAiB,CAAA,KAAA;AAAO,QAAA,OAAA;AACjD,MAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAQ,GAAA,SAAA,CAAU,MAAM,WAAc,GAAA,CAAA,CAAA;AACpE,MAAA,MAAM,YAAe,GAAA,gBAAA,CAAiB,KAAQ,GAAA,gBAAA,CAAiB,MAAM,WAAc,GAAA,CAAA,CAAA;AACnF,MAAA,IAAI,eAAe,YAAc,EAAA;AAC/B,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,CAAA,CAAA;AACtB,QAAA,OAAA;AAAA,OACF;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB;AAEA,IAAAC,sBAAA,CAAkB,kBAAkB,MAAM,CAAA,CAAA;AAE1C,IAAUC,aAAA,CAAA,MAAM,QAAQ,CAAA,CAAA;AAExB,IAAA,SAAS,UAAa,GAAA;AACpB,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,MAAM,gBAAgB,CAAc,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACpC,MAAA,MAAK,aAAA,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,IAAA,CAAA,aAAA;AACpB,QAAA,OAAkB;AAClB,MAAA,MAAA,SAAsB,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA;AAAA,MACxB,aAAA,CAAA,KAAA,GAAA,SAAA,CAAA;AAEA,KAAA;AACE,IAAM,SAAA,UAA2B,GAAA;AACjC,MAAA,IAAA,EAAM;AACN,MAAM,MAAA,OAAA,GAAA,CAAA,CAAA,EAAA,GAA0B,gBAAO,CAAe,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACtD,MAAA,mBAA8B,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,MAAA,aAAA,GAAA,CAAA,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AAC7C,MAAA,IAAA,uBAA4B,GAAA,aAAA;AAG5B,QAAA,OAAA;AAAsB,MACxB,MAAA,SAAA,GAAA,OAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,GAAA,aAAA,GAAA,aAAA,GAAA,OAAA,GAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,92 +1,3 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var core = require('@vueuse/core');
7
- var index = require('../../icon/src/index.js');
8
- var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
-
10
- const __default__ = vue.defineComponent({
11
- name: "HzztScroll"
12
- });
13
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
- ...__default__,
15
- setup(__props) {
16
- const navTranslateX = vue.ref(0);
17
- const scrollRef = vue.ref(null);
18
- const scrollContentRef = vue.ref(null);
19
- const scrollable = vue.ref(false);
20
- function update() {
21
- if (!scrollRef.value || !scrollContentRef.value)
22
- return;
23
- const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
24
- const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
25
- if (scrollWidth >= contentWidth) {
26
- scrollable.value = false;
27
- navTranslateX.value = 0;
28
- return;
29
- }
30
- scrollable.value = true;
31
- }
32
- core.useResizeObserver(scrollContentRef, update);
33
- vue.onUpdated(() => update());
34
- function btnNavPrev() {
35
- var _a;
36
- const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
37
- const currentOffset = navTranslateX.value;
38
- if (!currentOffset)
39
- return;
40
- const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
41
- navTranslateX.value = newOffset;
42
- }
43
- function btnNavNext() {
44
- var _a, _b;
45
- const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
46
- const currentOffset = navTranslateX.value;
47
- const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
48
- if (navSize - currentOffset < containerSize)
49
- return;
50
- const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
51
- navTranslateX.value = newOffset;
52
- }
53
- return (_ctx, _cache) => {
54
- return vue.openBlock(), vue.createElementBlock("div", {
55
- class: vue.normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
56
- }, [
57
- scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
58
- key: 0,
59
- class: "hzzt-scroll__nav-prev",
60
- onClick: btnNavPrev
61
- }, [
62
- vue.createVNode(index["default"], { name: "arrow-left" })
63
- ])) : vue.createCommentVNode("v-if", true),
64
- scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
65
- key: 1,
66
- class: "hzzt-scroll__nav-next",
67
- onClick: btnNavNext
68
- }, [
69
- vue.createVNode(index["default"], { name: "arrow-right" })
70
- ])) : vue.createCommentVNode("v-if", true),
71
- vue.createElementVNode("div", {
72
- ref_key: "scrollRef",
73
- ref: scrollRef,
74
- class: "overflow-hidden"
75
- }, [
76
- vue.createElementVNode("div", {
77
- ref_key: "scrollContentRef",
78
- ref: scrollContentRef,
79
- style: vue.normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
80
- class: "hzzt-scroll__content"
81
- }, [
82
- vue.renderSlot(_ctx.$slots, "default")
83
- ], 4)
84
- ], 512)
85
- ], 2);
86
- };
87
- }
88
- });
89
- var Scroll = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "scroll.vue"]]);
90
-
91
- exports["default"] = Scroll;
92
3
  //# sourceMappingURL=scroll2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll2.js","sources":["../../../../../../packages/components/scroll/src/scroll.vue"],"sourcesContent":["<template>\n <div :class=\"{'is-scrollable':scrollable}\" class=\"relative hzzt-scroll\">\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-prev\" @click=\"btnNavPrev\">\n <hzzt-icon name=\"arrow-left\" />\n </div>\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-next\" @click=\"btnNavNext\">\n <hzzt-icon name=\"arrow-right\" />\n </div>\n <div ref=\"scrollRef\" class=\"overflow-hidden\">\n <div ref=\"scrollContentRef\" :style=\"{transform: `translateX(${-navTranslateX}px)`}\" class=\"hzzt-scroll__content\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {onUpdated, ref} from 'vue';\n import {useResizeObserver} from '@vueuse/core';\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n defineOptions({\n name: 'HzztScroll',\n })\n\n const navTranslateX = ref(0);\n const scrollRef = ref<HTMLElement | null>(null);\n const scrollContentRef = ref<HTMLElement | null>(null);\n const scrollable = ref(false);\n\n function update() {\n if (!scrollRef.value || !scrollContentRef.value) return;\n const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;\n const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;\n if (scrollWidth >= contentWidth) {\n scrollable.value = false;\n navTranslateX.value = 0;\n return;\n }\n scrollable.value = true;\n }\n\n useResizeObserver(scrollContentRef, update);\n\n onUpdated(() => update());\n\n function btnNavPrev() {\n const containerSize = scrollRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n if (!currentOffset) return;\n const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;\n navTranslateX.value = newOffset;\n }\n\n function btnNavNext() {\n const navSize = scrollContentRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n const containerSize = scrollRef.value?.offsetWidth || 0;\n if (navSize - currentOffset < containerSize) return;\n const newOffset = navSize - currentOffset > containerSize * 2 ?\n currentOffset + containerSize :\n navSize - containerSize;\n navTranslateX.value = newOffset;\n }\n</script>\n"],"names":["ref","useResizeObserver","onUpdated"],"mappings":";;;;;;;;;uCAqBgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,aAAA,GAAgBA,QAAI,CAAC,CAAA,CAAA;AAC3B,IAAM,MAAA,SAAA,GAAYA,QAAwB,IAAI,CAAA,CAAA;AAC9C,IAAM,MAAA,gBAAA,GAAmBA,QAAwB,IAAI,CAAA,CAAA;AACrD,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAA,SAAS,MAAS,GAAA;AAChB,MAAA,IAAI,CAAC,SAAA,CAAU,KAAS,IAAA,CAAC,gBAAiB,CAAA,KAAA;AAAO,QAAA,OAAA;AACjD,MAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAQ,GAAA,SAAA,CAAU,MAAM,WAAc,GAAA,CAAA,CAAA;AACpE,MAAA,MAAM,YAAe,GAAA,gBAAA,CAAiB,KAAQ,GAAA,gBAAA,CAAiB,MAAM,WAAc,GAAA,CAAA,CAAA;AACnF,MAAA,IAAI,eAAe,YAAc,EAAA;AAC/B,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,CAAA,CAAA;AACtB,QAAA,OAAA;AAAA,OACF;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB;AAEA,IAAAC,sBAAA,CAAkB,kBAAkB,MAAM,CAAA,CAAA;AAE1C,IAAUC,aAAA,CAAA,MAAM,QAAQ,CAAA,CAAA;AAExB,IAAA,SAAS,UAAa,GAAA;AACpB,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,MAAM,gBAAgB,CAAc,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACpC,MAAA,MAAK,aAAA,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,IAAA,CAAA,aAAA;AACpB,QAAA,OAAkB;AAClB,MAAA,MAAA,SAAsB,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA;AAAA,MACxB,aAAA,CAAA,KAAA,GAAA,SAAA,CAAA;AAEA,KAAA;AACE,IAAM,SAAA,UAA2B,GAAA;AACjC,MAAA,IAAA,EAAM;AACN,MAAM,MAAA,OAAA,GAAA,CAAA,CAAA,EAAA,GAA0B,gBAAO,CAAe,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACtD,MAAA,mBAA8B,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,MAAA,aAAA,GAAA,CAAA,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AAC7C,MAAA,IAAA,uBAA4B,GAAA,aAAA;AAG5B,QAAA,OAAA;AAAsB,MACxB,MAAA,SAAA,GAAA,OAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,GAAA,aAAA,GAAA,aAAA,GAAA,OAAA,GAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"scroll2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -4,7 +4,7 @@ export declare const HzztSelectInput: import("hzzt-plus/es/utils").SFCWithInstal
4
4
  disabled: BooleanConstructor;
5
5
  replace: BooleanConstructor;
6
6
  label: StringConstructor;
7
- data: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
7
+ options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
8
8
  inputProps: ObjectConstructor;
9
9
  customProps: ObjectConstructor;
10
10
  position: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
@@ -28,7 +28,7 @@ export declare const HzztSelectInput: import("hzzt-plus/es/utils").SFCWithInstal
28
28
  disabled: BooleanConstructor;
29
29
  replace: BooleanConstructor;
30
30
  label: StringConstructor;
31
- data: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
31
+ options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
32
32
  inputProps: ObjectConstructor;
33
33
  customProps: ObjectConstructor;
34
34
  position: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
@@ -831,7 +831,7 @@ export declare const HzztSelectInput: import("hzzt-plus/es/utils").SFCWithInstal
831
831
  disabled: BooleanConstructor;
832
832
  replace: BooleanConstructor;
833
833
  label: StringConstructor;
834
- data: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
834
+ options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]) | ((new (...args: any[]) => import("..").OptionType[]) | (() => import("..").OptionType[]))[], unknown, unknown, () => never[], boolean>;
835
835
  inputProps: ObjectConstructor;
836
836
  customProps: ObjectConstructor;
837
837
  position: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
@@ -854,10 +854,10 @@ export declare const HzztSelectInput: import("hzzt-plus/es/utils").SFCWithInstal
854
854
  onInput?: ((value: string | undefined) => any) | undefined;
855
855
  }, {
856
856
  disabled: boolean;
857
+ options: import("..").OptionType[];
857
858
  modelValue: import("hzzt-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number | null | undefined) & {}) | (() => string | number | null | undefined) | ((new (...args: any[]) => (string | number | null | undefined) & {}) | (() => string | number | null | undefined))[], unknown, unknown>;
858
859
  replace: boolean;
859
860
  split: string;
860
- data: import("..").OptionType[];
861
861
  position: string;
862
862
  indexType: string;
863
863
  }>> & Record<string, any>;
@@ -7,7 +7,7 @@ export declare const selectInputProps: {
7
7
  disabled: BooleanConstructor;
8
8
  replace: BooleanConstructor;
9
9
  label: StringConstructor;
10
- data: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => OptionType[]) | (() => OptionType[]) | ((new (...args: any[]) => OptionType[]) | (() => OptionType[]))[], unknown, unknown, () => never[], boolean>;
10
+ options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => OptionType[]) | (() => OptionType[]) | ((new (...args: any[]) => OptionType[]) | (() => OptionType[]))[], unknown, unknown, () => never[], boolean>;
11
11
  inputProps: ObjectConstructor;
12
12
  customProps: ObjectConstructor;
13
13
  position: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
@@ -25,7 +25,7 @@ const selectInputProps = runtime.buildProps({
25
25
  disabled: Boolean,
26
26
  replace: Boolean,
27
27
  label: String,
28
- data: {
28
+ options: {
29
29
  type: runtime.definePropType(Array),
30
30
  default: () => []
31
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"select-input.js","sources":["../../../../../../packages/components/select-input/src/select-input.ts"],"sourcesContent":["import {buildProps, definePropType, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type SelectInput from './select-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\nimport {OptionType} from \"@hzzt-plus/components/select/src/select\";\n\nexport const selectInputProps = buildProps({\n modelValue: {\n type: definePropType<string | number | null | undefined>([\n String,\n Number,\n ]),\n default: '',\n },\n indexType: {\n type: String,\n default: 'number',\n },\n disabled: Boolean,\n replace: Boolean,\n label: String,\n data: {\n type: definePropType<OptionType[]>(Array),\n default: () => [],\n },\n inputProps: Object,\n customProps: Object,\n position: {\n type: String,\n default: 'left',\n },\n formatLabel: {\n type: Function,\n },\n split: {\n type: String,\n default: '',\n },\n size: useSizeProp,\n})\n\nexport type SelectInputProps = ExtractPropTypes<typeof selectInputProps>\n\nexport const selectInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string | undefined) => isString(value),\n input: (value: string | undefined) => isString(value),\n change: (value: string | undefined) => isString(value),\n}\nexport type SelectInputEmits = typeof selectInputEmits\n\nexport type SelectInputInstance = InstanceType<typeof SelectInput>\n"],"names":["buildProps","definePropType","useSizeProp","UPDATE_MODEL_EVENT","isString"],"mappings":";;;;;;;;;;;;AAGY,MAAC,gBAAgB,GAAGA,kBAAU,CAAC;AAC3C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAEC,sBAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAEA,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,QAAQ;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,CAACC,wBAAkB,GAAG,CAAC,KAAK,KAAKC,eAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACpC;;;;;"}
1
+ {"version":3,"file":"select-input.js","sources":["../../../../../../packages/components/select-input/src/select-input.ts"],"sourcesContent":["import {buildProps, definePropType, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type SelectInput from './select-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\nimport {OptionType} from \"@hzzt-plus/components/select/src/select\";\n\nexport const selectInputProps = buildProps({\n modelValue: {\n type: definePropType<string | number | null | undefined>([\n String,\n Number,\n ]),\n default: '',\n },\n indexType: {\n type: String,\n default: 'number',\n },\n disabled: Boolean,\n replace: Boolean,\n label: String,\n options: {\n type: definePropType<OptionType[]>(Array),\n default: () => [],\n },\n inputProps: Object,\n customProps: Object,\n position: {\n type: String,\n default: 'left',\n },\n formatLabel: {\n type: Function,\n },\n split: {\n type: String,\n default: '',\n },\n size: useSizeProp,\n})\n\nexport type SelectInputProps = ExtractPropTypes<typeof selectInputProps>\n\nexport const selectInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string | undefined) => isString(value),\n input: (value: string | undefined) => isString(value),\n change: (value: string | undefined) => isString(value),\n}\nexport type SelectInputEmits = typeof selectInputEmits\n\nexport type SelectInputInstance = InstanceType<typeof SelectInput>\n"],"names":["buildProps","definePropType","useSizeProp","UPDATE_MODEL_EVENT","isString"],"mappings":";;;;;;;;;;;;AAGY,MAAC,gBAAgB,GAAGA,kBAAU,CAAC;AAC3C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAEC,sBAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEA,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,QAAQ;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,CAACC,wBAAkB,GAAG,CAAC,KAAK,KAAKC,eAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACpC;;;;;"}