ll-plus 2.6.17 → 2.6.18

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 (118) hide show
  1. package/es/components/advanced-filtering/index.d.ts +388 -0
  2. package/es/components/advanced-filtering/src/advanced-filtering.vue.d.ts +194 -0
  3. package/es/components/advanced-filtering/src/components/advanced-filtering-params.vue.d.ts +194 -0
  4. package/es/components/cropper/index.d.ts +19 -0
  5. package/es/components/cropper/src/cropper-image.d.ts +2 -0
  6. package/es/components/cropper/src/cropper-image.vue.d.ts +6 -0
  7. package/es/components/cropper/src/cropper-modal.vue.d.ts +13 -0
  8. package/es/components/form/index.d.ts +197 -0
  9. package/es/components/form/src/components/form-component.vue.d.ts +3 -0
  10. package/es/components/form/src/config/form.d.ts +3 -0
  11. package/es/components/form/src/form.vue.d.ts +194 -0
  12. package/es/components/icon-picker/index.d.ts +4 -0
  13. package/es/components/icon-picker/src/components/modal.vue.d.ts +4 -0
  14. package/es/components/icon-picker/src/icon-picker.vue.d.ts +4 -0
  15. package/es/components/input/index.d.ts +2 -0
  16. package/es/components/input/src/input.vue.d.ts +2 -0
  17. package/es/components/input-number/index.d.ts +2 -0
  18. package/es/components/input-number/src/input-number.vue.d.ts +2 -0
  19. package/es/components/key-value/index.d.ts +1493 -338
  20. package/es/components/key-value/src/components/key-value-item.vue.d.ts +385 -0
  21. package/es/components/key-value/src/key-value.vue.d.ts +1493 -338
  22. package/es/components/number-range/index.d.ts +2 -0
  23. package/es/components/number-range/src/number-range.vue.d.ts +2 -0
  24. package/es/packages/components/cropper/src/cropper-image.mjs +8 -0
  25. package/es/packages/components/cropper/src/cropper-image.mjs.map +1 -1
  26. package/es/packages/components/cropper/src/cropper-image.vue2.mjs +43 -22
  27. package/es/packages/components/cropper/src/cropper-image.vue2.mjs.map +1 -1
  28. package/es/packages/components/cropper/src/cropper-modal.vue2.mjs +108 -72
  29. package/es/packages/components/cropper/src/cropper-modal.vue2.mjs.map +1 -1
  30. package/es/packages/components/form/src/components/form-component.vue2.mjs +19 -2
  31. package/es/packages/components/form/src/components/form-component.vue2.mjs.map +1 -1
  32. package/es/packages/components/form/src/config/form.mjs +21 -0
  33. package/es/packages/components/form/src/config/form.mjs.map +1 -1
  34. package/es/packages/components/form/src/form.vue2.mjs +56 -5
  35. package/es/packages/components/form/src/form.vue2.mjs.map +1 -1
  36. package/es/packages/components/icon-picker/src/components/modal.vue2.mjs +97 -76
  37. package/es/packages/components/icon-picker/src/components/modal.vue2.mjs.map +1 -1
  38. package/es/packages/components/input/src/input.vue2.mjs +8 -1
  39. package/es/packages/components/input/src/input.vue2.mjs.map +1 -1
  40. package/es/packages/components/input-number/src/input-number.vue2.mjs +8 -1
  41. package/es/packages/components/input-number/src/input-number.vue2.mjs.map +1 -1
  42. package/es/packages/components/key-value/src/config/key-value.mjs +2 -2
  43. package/es/packages/components/key-value/src/config/key-value.mjs.map +1 -1
  44. package/index.full.js +362 -175
  45. package/index.full.min.js +17 -17
  46. package/index.full.min.js.map +1 -1
  47. package/index.full.min.mjs +21 -21
  48. package/index.full.min.mjs.map +1 -1
  49. package/index.full.mjs +362 -175
  50. package/lib/components/advanced-filtering/index.d.ts +388 -0
  51. package/lib/components/advanced-filtering/src/advanced-filtering.vue.d.ts +194 -0
  52. package/lib/components/advanced-filtering/src/components/advanced-filtering-params.vue.d.ts +194 -0
  53. package/lib/components/cropper/index.d.ts +19 -0
  54. package/lib/components/cropper/src/cropper-image.d.ts +2 -0
  55. package/lib/components/cropper/src/cropper-image.vue.d.ts +6 -0
  56. package/lib/components/cropper/src/cropper-modal.vue.d.ts +13 -0
  57. package/lib/components/form/index.d.ts +197 -0
  58. package/lib/components/form/src/components/form-component.vue.d.ts +3 -0
  59. package/lib/components/form/src/config/form.d.ts +3 -0
  60. package/lib/components/form/src/form.vue.d.ts +194 -0
  61. package/lib/components/icon-picker/index.d.ts +4 -0
  62. package/lib/components/icon-picker/src/components/modal.vue.d.ts +4 -0
  63. package/lib/components/icon-picker/src/icon-picker.vue.d.ts +4 -0
  64. package/lib/components/input/index.d.ts +2 -0
  65. package/lib/components/input/src/input.vue.d.ts +2 -0
  66. package/lib/components/input-number/index.d.ts +2 -0
  67. package/lib/components/input-number/src/input-number.vue.d.ts +2 -0
  68. package/lib/components/key-value/index.d.ts +1493 -338
  69. package/lib/components/key-value/src/components/key-value-item.vue.d.ts +385 -0
  70. package/lib/components/key-value/src/key-value.vue.d.ts +1493 -338
  71. package/lib/components/number-range/index.d.ts +2 -0
  72. package/lib/components/number-range/src/number-range.vue.d.ts +2 -0
  73. package/lib/packages/components/cropper/src/cropper-image.js +8 -0
  74. package/lib/packages/components/cropper/src/cropper-image.js.map +1 -1
  75. package/lib/packages/components/cropper/src/cropper-image.vue2.js +42 -21
  76. package/lib/packages/components/cropper/src/cropper-image.vue2.js.map +1 -1
  77. package/lib/packages/components/cropper/src/cropper-modal.vue2.js +107 -71
  78. package/lib/packages/components/cropper/src/cropper-modal.vue2.js.map +1 -1
  79. package/lib/packages/components/form/src/components/form-component.vue2.js +18 -1
  80. package/lib/packages/components/form/src/components/form-component.vue2.js.map +1 -1
  81. package/lib/packages/components/form/src/config/form.js +21 -0
  82. package/lib/packages/components/form/src/config/form.js.map +1 -1
  83. package/lib/packages/components/form/src/form.vue2.js +54 -3
  84. package/lib/packages/components/form/src/form.vue2.js.map +1 -1
  85. package/lib/packages/components/icon-picker/src/components/modal.vue2.js +96 -75
  86. package/lib/packages/components/icon-picker/src/components/modal.vue2.js.map +1 -1
  87. package/lib/packages/components/input/src/input.vue2.js +8 -1
  88. package/lib/packages/components/input/src/input.vue2.js.map +1 -1
  89. package/lib/packages/components/input-number/src/input-number.vue2.js +8 -1
  90. package/lib/packages/components/input-number/src/input-number.vue2.js.map +1 -1
  91. package/lib/packages/components/key-value/src/config/key-value.js +2 -2
  92. package/lib/packages/components/key-value/src/config/key-value.js.map +1 -1
  93. package/package.json +1 -1
  94. package/theme-chalk/css/icon-picker.css +1 -1
  95. package/theme-chalk/css/index.css +1 -1
  96. package/types/packages/components/advanced-filtering/index.d.ts +388 -0
  97. package/types/packages/components/advanced-filtering/src/advanced-filtering.vue.d.ts +194 -0
  98. package/types/packages/components/advanced-filtering/src/components/advanced-filtering-params.vue.d.ts +194 -0
  99. package/types/packages/components/cropper/index.d.ts +19 -0
  100. package/types/packages/components/cropper/src/cropper-image.d.ts +2 -0
  101. package/types/packages/components/cropper/src/cropper-image.vue.d.ts +6 -0
  102. package/types/packages/components/cropper/src/cropper-modal.vue.d.ts +13 -0
  103. package/types/packages/components/form/index.d.ts +197 -0
  104. package/types/packages/components/form/src/components/form-component.vue.d.ts +3 -0
  105. package/types/packages/components/form/src/config/form.d.ts +3 -0
  106. package/types/packages/components/form/src/form.vue.d.ts +194 -0
  107. package/types/packages/components/icon-picker/index.d.ts +4 -0
  108. package/types/packages/components/icon-picker/src/components/modal.vue.d.ts +4 -0
  109. package/types/packages/components/icon-picker/src/icon-picker.vue.d.ts +4 -0
  110. package/types/packages/components/input/index.d.ts +2 -0
  111. package/types/packages/components/input/src/input.vue.d.ts +2 -0
  112. package/types/packages/components/input-number/index.d.ts +2 -0
  113. package/types/packages/components/input-number/src/input-number.vue.d.ts +2 -0
  114. package/types/packages/components/key-value/index.d.ts +1493 -338
  115. package/types/packages/components/key-value/src/components/key-value-item.vue.d.ts +385 -0
  116. package/types/packages/components/key-value/src/key-value.vue.d.ts +1493 -338
  117. package/types/packages/components/number-range/index.d.ts +2 -0
  118. package/types/packages/components/number-range/src/number-range.vue.d.ts +2 -0
@@ -13,10 +13,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
13
13
  __name: "form-component",
14
14
  props: formComponent.formComponentProps,
15
15
  emits: formComponent.formComponentEmits,
16
- setup(__props, { emit: __emit }) {
16
+ setup(__props, { expose: __expose, emit: __emit }) {
17
17
  const props = __props;
18
18
  const emits = __emit;
19
19
  const formData = vue.reactive(props.formData);
20
+ const componentRef = vue.ref();
20
21
  const getBindValue = (item) => {
21
22
  const obj = { ...item };
22
23
  return lodashEs.omit(obj, ["label", "onChange", "change"]);
@@ -31,13 +32,29 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
31
32
  }
32
33
  emits("changeField", item);
33
34
  };
35
+ const focus = async () => {
36
+ await vue.nextTick();
37
+ console.log(componentRef.value);
38
+ componentRef.value?.focus();
39
+ };
40
+ const getItem = () => {
41
+ return props.item;
42
+ };
43
+ __expose({
44
+ focus,
45
+ getItem
46
+ });
34
47
  return (_ctx, _cache) => {
35
48
  return vue.unref(components.checkedType).includes(_ctx.item.type) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(`ll-${_ctx.item.type}`), vue.mergeProps({
36
49
  key: 0,
50
+ ref_key: "componentRef",
51
+ ref: componentRef,
37
52
  checked: formData[_ctx.item.key],
38
53
  "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => formData[_ctx.item.key] = $event)
39
54
  }, getBindValue(_ctx.item), { onChange: handleChange }), null, 16, ["checked"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(`ll-${_ctx.item.type}`), vue.mergeProps({
40
55
  key: 1,
56
+ ref_key: "componentRef",
57
+ ref: componentRef,
41
58
  value: formData[_ctx.item.key],
42
59
  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => formData[_ctx.item.key] = $event)
43
60
  }, getBindValue(_ctx.item), { onChange: handleChange }), null, 16, ["value"]));
@@ -1 +1 @@
1
- {"version":3,"file":"form-component.vue2.js","sources":["../../../../../../../packages/components/form/src/components/form-component.vue"],"sourcesContent":["<template>\n <template v-if=\"checkedType.includes(item.type)\">\n <component\n :is=\"`ll-${item.type}`\"\n v-model:checked=\"formData[item.key]\"\n v-bind=\"getBindValue(item)\"\n @change=\"handleChange\"\n />\n </template>\n <template v-else>\n <component\n :is=\"`ll-${item.type}`\"\n v-model:value=\"formData[item.key]\"\n v-bind=\"getBindValue(item)\"\n @change=\"handleChange\"\n />\n </template>\n</template>\n\n<script setup lang=\"ts\">\nimport { reactive } from 'vue'\nimport { omit, has } from 'lodash-es'\nimport {\n formComponentProps,\n formComponentEmits,\n checkedType,\n type FormColumn\n} from '../config'\n\nconst props = defineProps(formComponentProps)\n\nconst emits = defineEmits(formComponentEmits)\n\nconst formData = reactive(props.formData)\n\nconst getBindValue = (item: FormColumn) => {\n const obj = { ...item }\n return omit(obj, ['label', 'onChange', 'change'])\n}\n\nconst handleChange = (...arg) => {\n const item: FormColumn = props.item\n if (has(item, 'change')) {\n item.change(...arg)\n }\n if (has(item, 'onChange')) {\n item.onChange(...arg)\n }\n emits('changeField', item)\n}\n</script>\n"],"names":["reactive","omit","has"],"mappings":";;;;;;;;;;;;;;;;AA6BA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,QAAA,GAAWA,YAAS,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAExC,IAAM,MAAA,YAAA,GAAe,CAAC,IAAqB,KAAA;AACzC,MAAM,MAAA,GAAA,GAAM,EAAE,GAAG,IAAK,EAAA,CAAA;AACtB,MAAA,OAAOC,cAAK,GAAK,EAAA,CAAC,OAAS,EAAA,UAAA,EAAY,QAAQ,CAAC,CAAA,CAAA;AAAA,KAClD,CAAA;AAEA,IAAM,MAAA,YAAA,GAAe,IAAI,GAAQ,KAAA;AAC/B,MAAA,MAAM,OAAmB,KAAM,CAAA,IAAA,CAAA;AAC/B,MAAI,IAAAC,YAAA,CAAI,IAAM,EAAA,QAAQ,CAAG,EAAA;AACvB,QAAK,IAAA,CAAA,MAAA,CAAO,GAAG,GAAG,CAAA,CAAA;AAAA,OACpB;AACA,MAAI,IAAAA,YAAA,CAAI,IAAM,EAAA,UAAU,CAAG,EAAA;AACzB,QAAK,IAAA,CAAA,QAAA,CAAS,GAAG,GAAG,CAAA,CAAA;AAAA,OACtB;AACA,MAAA,KAAA,CAAM,eAAe,IAAI,CAAA,CAAA;AAAA,KAC3B,CAAA;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form-component.vue2.js","sources":["../../../../../../../packages/components/form/src/components/form-component.vue"],"sourcesContent":["<template>\n <template v-if=\"checkedType.includes(item.type)\">\n <component\n :is=\"`ll-${item.type}`\"\n ref=\"componentRef\"\n v-model:checked=\"formData[item.key]\"\n v-bind=\"getBindValue(item)\"\n @change=\"handleChange\"\n />\n </template>\n <template v-else>\n <component\n :is=\"`ll-${item.type}`\"\n ref=\"componentRef\"\n v-model:value=\"formData[item.key]\"\n v-bind=\"getBindValue(item)\"\n @change=\"handleChange\"\n />\n </template>\n</template>\n\n<script setup lang=\"ts\">\nimport { nextTick, reactive, ref } from 'vue'\nimport { omit, has } from 'lodash-es'\nimport {\n formComponentProps,\n formComponentEmits,\n checkedType,\n type FormColumn\n} from '../config'\n\nconst props = defineProps(formComponentProps)\n\nconst emits = defineEmits(formComponentEmits)\n\nconst formData = reactive(props.formData)\n\nconst componentRef = ref()\n\nconst getBindValue = (item: FormColumn) => {\n const obj = { ...item }\n return omit(obj, ['label', 'onChange', 'change'])\n}\n\nconst handleChange = (...arg) => {\n const item: FormColumn = props.item\n if (has(item, 'change')) {\n item.change(...arg)\n }\n if (has(item, 'onChange')) {\n item.onChange(...arg)\n }\n emits('changeField', item)\n}\n// 获取焦点\nconst focus = async () => {\n await nextTick()\n console.log(componentRef.value)\n componentRef.value?.focus()\n}\n\nconst getItem = () => {\n return props.item\n}\ndefineExpose({\n focus,\n getItem\n})\n</script>\n"],"names":["reactive","ref","omit","has","nextTick"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,QAAA,GAAWA,YAAS,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAExC,IAAA,MAAM,eAAeC,OAAI,EAAA,CAAA;AAEzB,IAAM,MAAA,YAAA,GAAe,CAAC,IAAqB,KAAA;AACzC,MAAM,MAAA,GAAA,GAAM,EAAE,GAAG,IAAK,EAAA,CAAA;AACtB,MAAA,OAAOC,cAAK,GAAK,EAAA,CAAC,OAAS,EAAA,UAAA,EAAY,QAAQ,CAAC,CAAA,CAAA;AAAA,KAClD,CAAA;AAEA,IAAM,MAAA,YAAA,GAAe,IAAI,GAAQ,KAAA;AAC/B,MAAA,MAAM,OAAmB,KAAM,CAAA,IAAA,CAAA;AAC/B,MAAI,IAAAC,YAAA,CAAI,IAAM,EAAA,QAAQ,CAAG,EAAA;AACvB,QAAK,IAAA,CAAA,MAAA,CAAO,GAAG,GAAG,CAAA,CAAA;AAAA,OACpB;AACA,MAAI,IAAAA,YAAA,CAAI,IAAM,EAAA,UAAU,CAAG,EAAA;AACzB,QAAK,IAAA,CAAA,QAAA,CAAS,GAAG,GAAG,CAAA,CAAA;AAAA,OACtB;AACA,MAAA,KAAA,CAAM,eAAe,IAAI,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAA,MAAM,QAAQ,YAAY;AACxB,MAAA,MAAMC,YAAS,EAAA,CAAA;AACf,MAAQ,OAAA,CAAA,GAAA,CAAI,aAAa,KAAK,CAAA,CAAA;AAC9B,MAAA,YAAA,CAAa,OAAO,KAAM,EAAA,CAAA;AAAA,KAC5B,CAAA;AAEA,IAAA,MAAM,UAAU,MAAM;AACpB,MAAA,OAAO,KAAM,CAAA,IAAA,CAAA;AAAA,KACf,CAAA;AACA,IAAa,QAAA,CAAA;AAAA,MACX,KAAA;AAAA,MACA,OAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;"}
@@ -43,6 +43,27 @@ const formProps = runtime.buildProps({
43
43
  loading: {
44
44
  type: Boolean,
45
45
  default: false
46
+ },
47
+ /**
48
+ * @description 自动聚焦
49
+ */
50
+ autoFocus: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ /**
55
+ * @description 是否全体禁用
56
+ */
57
+ disabled: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ /**
62
+ * @description 当某一规则校验不通过时,是否停止剩下的规则的校验
63
+ */
64
+ validateErrorStop: {
65
+ type: Boolean,
66
+ default: false
46
67
  }
47
68
  });
48
69
  const formEmits = {
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sources":["../../../../../../../packages/components/form/src/config/form.ts"],"sourcesContent":["import { buildProps, definePropType } from '@ll-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type {\n FormItemProps,\n RowProps,\n ColProps,\n FormProps as AntFormProps\n} from 'ant-design-vue'\nimport type { TooltipProps } from '@ll-plus/components'\nimport type Form from '../form.vue'\n\ntype FormType<T = any> = (\n | 'input'\n | 'input-number'\n | 'cascader'\n | 'checkbox'\n | 'checkbox-group'\n | 'code-editor'\n | 'date-picker'\n | 'time-picker'\n | 'date-range'\n | 'time-range'\n | 'radio'\n | 'radio-group'\n | 'select'\n | 'switch'\n | 'textarea'\n | 'upload-image'\n) &\n T\n\nexport interface FormChangeEvent {\n item: FormColumn\n value: any\n formData: FormData\n}\nexport interface BasicFormColumn extends FormItemProps {\n label?: string\n key: string\n spanCol?: number | 24 // 一行几条\n colOptions?: ColProps\n tip?: string\n tipConfig?: TooltipProps\n type: FormType\n unit?: string\n change?: () => void\n rowOptions?: RowProps\n children?: FormColumn[]\n [key: string]: any\n}\n\nexport type FormColumn<T = any> = BasicFormColumn & T\n\nexport type FormData = Record<string, any>\n\nexport const formProps = buildProps({\n /**\n * @description 表单项列表\n */\n formColumns: {\n type: definePropType<FormColumn[]>(Array),\n default: () => []\n },\n /**\n * @description 展开的行变化时触发\n */\n formOptions: {\n type: definePropType<AntFormProps>(Object),\n default: () => ({\n layout: 'horizontal'\n })\n },\n /**\n * @description 展开的行变化时触发\n */\n formData: {\n type: definePropType<FormData>(Object),\n default: () => ({})\n },\n /**\n * @description 展开的行变化时触发\n */\n rowOptions: {\n type: definePropType<RowProps>(Object),\n default: () => ({\n gutter: 16\n })\n },\n /**\n * @description 表单加载状态\n */\n loading: {\n type: Boolean,\n default: false\n }\n} as const)\n\nexport const formEmits = {\n /**\n * @description 表单项值改变时触发\n */\n change: (params: FormChangeEvent) => !!params\n}\n\n// props\nexport type FormProps = ExtractPropTypes<typeof formProps>\n\n// emits\nexport type FormEmits = typeof formEmits\n\n// instance\nexport type FormInstance = InstanceType<typeof Form>\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;AAwDO,MAAM,YAAYA,kBAAW,CAAA;AAAA;AAAA;AAAA;AAAA,EAIlC,WAAa,EAAA;AAAA,IACX,IAAA,EAAMC,uBAA6B,KAAK,CAAA;AAAA,IACxC,OAAA,EAAS,MAAM,EAAC;AAAA,GAClB;AAAA;AAAA;AAAA;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAA,EAAMA,uBAA6B,MAAM,CAAA;AAAA,IACzC,SAAS,OAAO;AAAA,MACd,MAAQ,EAAA,YAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA;AAAA;AAAA;AAAA,EAIA,QAAU,EAAA;AAAA,IACR,IAAA,EAAMA,uBAAyB,MAAM,CAAA;AAAA,IACrC,OAAA,EAAS,OAAO,EAAC,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAA,EAAMA,uBAAyB,MAAM,CAAA;AAAA,IACrC,SAAS,OAAO;AAAA,MACd,MAAQ,EAAA,EAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA;AAAA;AAAA;AAAA,EAIA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AACF,CAAU,EAAA;AAEH,MAAM,SAAY,GAAA;AAAA;AAAA;AAAA;AAAA,EAIvB,MAAQ,EAAA,CAAC,MAA4B,KAAA,CAAC,CAAC,MAAA;AACzC;;;;;"}
1
+ {"version":3,"file":"form.js","sources":["../../../../../../../packages/components/form/src/config/form.ts"],"sourcesContent":["import { buildProps, definePropType } from '@ll-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type {\n FormItemProps,\n RowProps,\n ColProps,\n FormProps as AntFormProps\n} from 'ant-design-vue'\nimport type { TooltipProps } from '@ll-plus/components'\nimport type Form from '../form.vue'\n\ntype FormType<T = any> = (\n | 'input'\n | 'input-number'\n | 'cascader'\n | 'checkbox'\n | 'checkbox-group'\n | 'code-editor'\n | 'date-picker'\n | 'time-picker'\n | 'date-range'\n | 'time-range'\n | 'radio'\n | 'radio-group'\n | 'select'\n | 'switch'\n | 'textarea'\n | 'upload-image'\n) &\n T\n\nexport interface FormChangeEvent {\n item: FormColumn\n value: any\n formData: FormData\n}\nexport interface BasicFormColumn extends FormItemProps {\n label?: string\n key: string\n spanCol?: number | 24 // 一行几条\n colOptions?: ColProps\n tip?: string\n tipConfig?: TooltipProps\n type: FormType\n unit?: string\n change?: () => void\n rowOptions?: RowProps\n children?: FormColumn[]\n [key: string]: any\n}\n\nexport type FormColumn<T = any> = BasicFormColumn & T\n\nexport type FormData = Record<string, any>\n\nexport const formProps = buildProps({\n /**\n * @description 表单项列表\n */\n formColumns: {\n type: definePropType<FormColumn[]>(Array),\n default: () => []\n },\n /**\n * @description 展开的行变化时触发\n */\n formOptions: {\n type: definePropType<AntFormProps>(Object),\n default: () => ({\n layout: 'horizontal'\n })\n },\n /**\n * @description 展开的行变化时触发\n */\n formData: {\n type: definePropType<FormData>(Object),\n default: () => ({})\n },\n /**\n * @description 展开的行变化时触发\n */\n rowOptions: {\n type: definePropType<RowProps>(Object),\n default: () => ({\n gutter: 16\n })\n },\n /**\n * @description 表单加载状态\n */\n loading: {\n type: Boolean,\n default: false\n },\n /**\n * @description 自动聚焦\n */\n autoFocus: {\n type: Boolean,\n default: false\n },\n /**\n * @description 是否全体禁用\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * @description 当某一规则校验不通过时,是否停止剩下的规则的校验\n */\n validateErrorStop: {\n type: Boolean,\n default: false\n }\n} as const)\n\nexport const formEmits = {\n /**\n * @description 表单项值改变时触发\n */\n change: (params: FormChangeEvent) => !!params\n}\n\n// props\nexport type FormProps = ExtractPropTypes<typeof formProps>\n\n// emits\nexport type FormEmits = typeof formEmits\n\n// instance\nexport type FormInstance = InstanceType<typeof Form>\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;AAwDO,MAAM,YAAYA,kBAAW,CAAA;AAAA;AAAA;AAAA;AAAA,EAIlC,WAAa,EAAA;AAAA,IACX,IAAA,EAAMC,uBAA6B,KAAK,CAAA;AAAA,IACxC,OAAA,EAAS,MAAM,EAAC;AAAA,GAClB;AAAA;AAAA;AAAA;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAA,EAAMA,uBAA6B,MAAM,CAAA;AAAA,IACzC,SAAS,OAAO;AAAA,MACd,MAAQ,EAAA,YAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA;AAAA;AAAA;AAAA,EAIA,QAAU,EAAA;AAAA,IACR,IAAA,EAAMA,uBAAyB,MAAM,CAAA;AAAA,IACrC,OAAA,EAAS,OAAO,EAAC,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAA,EAAMA,uBAAyB,MAAM,CAAA;AAAA,IACrC,SAAS,OAAO;AAAA,MACd,MAAQ,EAAA,EAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA;AAAA;AAAA;AAAA,EAIA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,iBAAmB,EAAA;AAAA,IACjB,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AACF,CAAU,EAAA;AAEH,MAAM,SAAY,GAAA;AAAA;AAAA;AAAA;AAAA,EAIvB,MAAQ,EAAA,CAAC,MAA4B,KAAA,CAAC,CAAC,MAAA;AACzC;;;;;"}
@@ -22,9 +22,46 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
22
  const bem = createNamespace.createNamespace("form");
23
23
  const formData = vue.reactive(props.formData);
24
24
  const formRef = vue.ref();
25
+ const formComponents = vue.ref([]);
26
+ const computedFormColumns = vue.computed(() => {
27
+ return props.formColumns.map((e) => {
28
+ e.disabled = lodashEs.has(e, "disabled") ? e.disabled : props.disabled;
29
+ if (e.children && e.children.length) {
30
+ e.children.map((a) => {
31
+ a.disabled = lodashEs.has(a, "disabled") ? a.disabled : props.disabled;
32
+ return a;
33
+ });
34
+ }
35
+ return e;
36
+ });
37
+ });
38
+ const validateFields = vue.computed(() => {
39
+ return props.formColumns.filter((e) => e.required || lodashEs.has(e, "rules") && e.rules.length > 0).map((e) => {
40
+ return e.key;
41
+ });
42
+ });
43
+ const computedFormOptions = vue.computed(() => {
44
+ return {
45
+ scrollToFirstError: !props.validateErrorStop,
46
+ ...props.formOptions
47
+ };
48
+ });
25
49
  const id = vue.ref(`ll-form-${+/* @__PURE__ */ new Date()}`);
26
50
  const validate = async () => {
27
- return await formRef.value.validateFields();
51
+ if (props.validateErrorStop) {
52
+ clearValidate();
53
+ let bool = true;
54
+ if (!validateFields.value.length)
55
+ return bool;
56
+ for (const i of validateFields.value) {
57
+ bool = await formRef.value.validateFields([i]);
58
+ if (!bool) {
59
+ return bool;
60
+ }
61
+ }
62
+ } else {
63
+ return await formRef.value.validateFields();
64
+ }
28
65
  };
29
66
  const resetFields = async () => {
30
67
  return await formRef.value.resetFields();
@@ -64,6 +101,18 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
64
101
  immediate: true
65
102
  }
66
103
  );
104
+ vue.onMounted(async () => {
105
+ await vue.nextTick();
106
+ if (props.autoFocus) {
107
+ for (const element of formComponents.value) {
108
+ const item = element?.getItem();
109
+ if (["input", "textarea", "input-number"].includes(item.type)) {
110
+ element?.focus();
111
+ break;
112
+ }
113
+ }
114
+ }
115
+ });
67
116
  __expose({
68
117
  validate,
69
118
  resetFields,
@@ -87,7 +136,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
87
136
  spinning: props.loading
88
137
  }, {
89
138
  default: vue.withCtx(() => [
90
- vue.createVNode(_component_a_form, vue.mergeProps(props.formOptions, {
139
+ vue.createVNode(_component_a_form, vue.mergeProps(computedFormOptions.value, {
91
140
  id: id.value,
92
141
  ref_key: "formRef",
93
142
  ref: formRef,
@@ -102,7 +151,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
102
151
  (vue.openBlock(true), vue.createElementBlock(
103
152
  vue.Fragment,
104
153
  null,
105
- vue.renderList(props.formColumns, (item, index) => {
154
+ vue.renderList(computedFormColumns.value, (item, index) => {
106
155
  return vue.openBlock(), vue.createBlock(_component_a_col, vue.mergeProps({
107
156
  key: index,
108
157
  ref_for: true
@@ -213,6 +262,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
213
262
  /* FULL_PROPS, DYNAMIC_SLOTS */
214
263
  )) : (vue.openBlock(), vue.createBlock(formComponent.default, {
215
264
  key: 1,
265
+ ref_for: true,
266
+ ref: (el) => formComponents.value[index] = el,
216
267
  item,
217
268
  "form-data": formData,
218
269
  onChangeField: handleChangeField
@@ -1 +1 @@
1
- {"version":3,"file":"form.vue2.js","sources":["../../../../../../packages/components/form/src/form.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <a-spin :spinning=\"props.loading\">\n <a-form\n v-bind=\"props.formOptions\"\n :id=\"id\"\n ref=\"formRef\"\n :model=\"props.formData\"\n >\n <a-row v-bind=\"props.rowOptions\">\n <a-col\n v-for=\"(item, index) in props.formColumns\"\n :key=\"index\"\n v-bind=\"item?.colOptions ?? {}\"\n :span=\"item?.spanCol ?? 24\"\n >\n <slot name=\"formItem\" :item=\"item\" :index=\"index\">\n <ll-form-item\n :name=\"item?.key ?? index\"\n :class=\"getFormItemClass(item)\"\n v-bind=\"getBindValue(item)\"\n >\n <template #label>\n <slot name=\"label\" :item=\"item\" :index=\"index\">\n <span>{{ item.label }}</span>\n <span v-if=\"item?.tip\" :class=\"bem.e('tooltip-wrapper')\">\n <ll-tooltip\n style=\"margin-left: 8px\"\n :overlay-class-name=\"bem.e('tooltip')\"\n :arrow-point-at-center=\"true\"\n :max-width=\"item?.tipConfig?.maxWidth ?? 406\"\n :placement=\"item?.tipConfig?.placement ?? 'top'\"\n :tip=\"item.tip\"\n :font-size=\"'16px'\"\n v-bind=\"item?.tipConfig\"\n />\n </span>\n </slot>\n </template>\n <slot name=\"content\" :item=\"item\" :index=\"index\">\n <template v-if=\"!isEmpty(item.children)\">\n <a-row :gutter=\"5\" v-bind=\"item.rowOptions\">\n <a-col\n v-for=\"(child, childIndex) in item.children\"\n :key=\"childIndex\"\n :style=\"{\n display: 'flex',\n 'align-items': 'center'\n }\"\n v-bind=\"item?.colOptions ?? {}\"\n >\n <slot name=\"children\" :item=\"child\" :index=\"index\">\n <form-component\n :item=\"child\"\n :form-data=\"formData\"\n @change-field=\"handleChangeField\"\n />\n </slot>\n </a-col>\n </a-row>\n </template>\n <form-component\n v-else\n :item=\"item\"\n :form-data=\"formData\"\n @change-field=\"handleChangeField\"\n />\n </slot>\n </ll-form-item>\n </slot>\n </a-col>\n </a-row>\n </a-form>\n </a-spin>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { reactive, ref, watch } from 'vue'\nimport { omit, isEmpty } from 'lodash-es'\nimport { formProps, formEmits, type FormColumn } from './config'\n\nimport type { NamePath } from 'ant-design-vue/es/form/interface'\n\nimport { createNamespace } from '@ll-plus/utils'\n\nimport formComponent from './components/form-component.vue'\n\n// 定义组件名称\ndefineOptions({ name: 'LlForm' })\n\n// Props\nconst props = defineProps(formProps)\n\nconst emits = defineEmits(formEmits)\n\nconst bem = createNamespace('form')\n\nconst formData = reactive(props.formData)\n\nconst formRef = ref()\n\nconst id = ref(`ll-form-${+new Date()}`)\n\nconst validate = async () => {\n return await formRef.value.validateFields()\n}\n\nconst resetFields = async () => {\n return await formRef.value.resetFields()\n}\n\nconst clearValidate = async (nameList?: NamePath[]) => {\n return await formRef.value.clearValidate(nameList)\n}\n\nconst scrollToField = async (name: NamePath, options?: ScrollOptions) => {\n return await formRef.value.scrollToField(name, options)\n}\n\nconst getBindValue = (item: FormColumn) => {\n const obj = { ...item }\n return omit(obj, ['label'])\n}\n\nconst getFormItemClass = (item = {} as FormColumn) => {\n if (props.formOptions.layout === 'horizontal') {\n if (item?.labelCol) {\n return item.labelCol.span && item.labelCol.span >= 24\n ? bem.is('label-top')\n : bem.is('label-left')\n } else {\n return bem.is('label-left')\n }\n }\n return bem.is('label-top')\n}\n\nconst handleChangeField = (item: FormColumn) => {\n emits('change', { item, value: formData[item.key], formData })\n}\n\n// watch(\n// () => formData,\n// val => {\n// emits('change', val)\n// },\n// {\n// deep: true\n// }\n// )\n\nwatch(\n () => props.formData,\n async val => {\n for (const i in val) {\n formData[i] = val[i]\n }\n },\n {\n deep: true,\n immediate: true\n }\n)\n\ndefineExpose({\n validate,\n resetFields,\n clearValidate,\n scrollToField\n})\n</script>\n"],"names":["createNamespace","reactive","ref","omit","watch"],"mappings":";;;;;;;;;;;;;;;;;;;AA2FA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,GAAA,GAAMA,gCAAgB,MAAM,CAAA,CAAA;AAElC,IAAM,MAAA,QAAA,GAAWC,YAAS,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAExC,IAAA,MAAM,UAAUC,OAAI,EAAA,CAAA;AAEpB,IAAA,MAAM,KAAKA,OAAI,CAAA,CAAA,QAAA,EAAW,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SAC5B;AAAA,OACF;AACA,MAAO,OAAA,GAAA,CAAI,GAAG,WAAW,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,iBAAA,GAAoB,CAAC,IAAqB,KAAA;AAC9C,MAAM,KAAA,CAAA,QAAA,EAAU,EAAE,IAAM,EAAA,KAAA,EAAO,SAAS,IAAK,CAAA,GAAG,CAAG,EAAA,QAAA,EAAU,CAAA,CAAA;AAAA,KAC/D,CAAA;AAYA,IAAAC,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,QAAA;AAAA,MACZ,OAAM,GAAO,KAAA;AACX,QAAA,KAAA,MAAW,KAAK,GAAK,EAAA;AACnB,UAAS,QAAA,CAAA,CAAC,CAAI,GAAA,GAAA,CAAI,CAAC,CAAA,CAAA;AAAA,SACrB;AAAA,OACF;AAAA,MACA;AAAA,QACE,IAAM,EAAA,IAAA;AAAA,QACN,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AAEA,IAAa,QAAA,CAAA;AAAA,MACX,QAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form.vue2.js","sources":["../../../../../../packages/components/form/src/form.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <a-spin :spinning=\"props.loading\">\n <a-form\n v-bind=\"computedFormOptions\"\n :id=\"id\"\n ref=\"formRef\"\n :model=\"props.formData\"\n >\n <a-row v-bind=\"props.rowOptions\">\n <a-col\n v-for=\"(item, index) in computedFormColumns\"\n :key=\"index\"\n v-bind=\"item?.colOptions ?? {}\"\n :span=\"item?.spanCol ?? 24\"\n >\n <slot name=\"formItem\" :item=\"item\" :index=\"index\">\n <ll-form-item\n :name=\"item?.key ?? index\"\n :class=\"getFormItemClass(item)\"\n v-bind=\"getBindValue(item)\"\n >\n <template #label>\n <slot name=\"label\" :item=\"item\" :index=\"index\">\n <span>{{ item.label }}</span>\n <span v-if=\"item?.tip\" :class=\"bem.e('tooltip-wrapper')\">\n <ll-tooltip\n style=\"margin-left: 8px\"\n :overlay-class-name=\"bem.e('tooltip')\"\n :arrow-point-at-center=\"true\"\n :max-width=\"item?.tipConfig?.maxWidth ?? 406\"\n :placement=\"item?.tipConfig?.placement ?? 'top'\"\n :tip=\"item.tip\"\n :font-size=\"'16px'\"\n v-bind=\"item?.tipConfig\"\n />\n </span>\n </slot>\n </template>\n <slot name=\"content\" :item=\"item\" :index=\"index\">\n <template v-if=\"!isEmpty(item.children)\">\n <a-row :gutter=\"5\" v-bind=\"item.rowOptions\">\n <a-col\n v-for=\"(child, childIndex) in item.children\"\n :key=\"childIndex\"\n :style=\"{\n display: 'flex',\n 'align-items': 'center'\n }\"\n v-bind=\"item?.colOptions ?? {}\"\n >\n <slot name=\"children\" :item=\"child\" :index=\"index\">\n <form-component\n :item=\"child\"\n :form-data=\"formData\"\n @change-field=\"handleChangeField\"\n />\n </slot>\n </a-col>\n </a-row>\n </template>\n <form-component\n v-else\n :ref=\"el => (formComponents[index] = el)\"\n :item=\"item\"\n :form-data=\"formData\"\n @change-field=\"handleChangeField\"\n />\n </slot>\n </ll-form-item>\n </slot>\n </a-col>\n </a-row>\n </a-form>\n </a-spin>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { reactive, ref, watch, onMounted, nextTick, computed } from 'vue'\nimport { omit, isEmpty, has } from 'lodash-es'\nimport { formProps, formEmits, type FormColumn } from './config'\n\nimport type { NamePath } from 'ant-design-vue/es/form/interface'\n\nimport { createNamespace } from '@ll-plus/utils'\n\nimport formComponent from './components/form-component.vue'\n\n// 定义组件名称\ndefineOptions({ name: 'LlForm' })\n\n// Props\nconst props = defineProps(formProps)\n\nconst emits = defineEmits(formEmits)\n\nconst bem = createNamespace('form')\n\nconst formData = reactive(props.formData)\n\nconst formRef = ref()\n\nconst formComponents = ref<InstanceType<typeof formComponent>[]>([])\n\nconst computedFormColumns = computed(() => {\n return props.formColumns.map(e => {\n e.disabled = has(e, 'disabled') ? e.disabled : props.disabled\n if (e.children && e.children.length) {\n e.children.map(a => {\n a.disabled = has(a, 'disabled') ? a.disabled : props.disabled\n return a\n })\n }\n return e\n })\n})\n\nconst validateFields = computed(() => {\n return props.formColumns\n .filter(e => e.required || (has(e, 'rules') && e.rules.length > 0))\n .map(e => {\n return e.key\n })\n})\n\nconst computedFormOptions = computed(() => {\n return {\n scrollToFirstError: !props.validateErrorStop,\n ...props.formOptions\n }\n})\n\nconst id = ref(`ll-form-${+new Date()}`)\n\nconst validate = async () => {\n if (props.validateErrorStop) {\n clearValidate()\n let bool = true\n if (!validateFields.value.length) return bool\n for (const i of validateFields.value) {\n bool = await formRef.value.validateFields([i])\n if (!bool) {\n return bool\n }\n }\n } else {\n return await formRef.value.validateFields()\n }\n}\n\nconst resetFields = async () => {\n return await formRef.value.resetFields()\n}\n\nconst clearValidate = async (nameList?: NamePath[]) => {\n return await formRef.value.clearValidate(nameList)\n}\n\nconst scrollToField = async (name: NamePath, options?: ScrollOptions) => {\n return await formRef.value.scrollToField(name, options)\n}\n\nconst getBindValue = (item: FormColumn) => {\n const obj = { ...item }\n return omit(obj, ['label'])\n}\n\nconst getFormItemClass = (item = {} as FormColumn) => {\n if (props.formOptions.layout === 'horizontal') {\n if (item?.labelCol) {\n return item.labelCol.span && item.labelCol.span >= 24\n ? bem.is('label-top')\n : bem.is('label-left')\n } else {\n return bem.is('label-left')\n }\n }\n return bem.is('label-top')\n}\n\nconst handleChangeField = (item: FormColumn) => {\n emits('change', { item, value: formData[item.key], formData })\n}\n\nwatch(\n () => props.formData,\n async val => {\n for (const i in val) {\n formData[i] = val[i]\n }\n },\n {\n deep: true,\n immediate: true\n }\n)\n\nonMounted(async () => {\n await nextTick()\n if (props.autoFocus) {\n for (const element of formComponents.value) {\n const item = element?.getItem()\n if (['input', 'textarea', 'input-number'].includes(item.type)) {\n element?.focus()\n break\n }\n }\n }\n})\n\ndefineExpose({\n validate,\n resetFields,\n clearValidate,\n scrollToField\n})\n</script>\n"],"names":["createNamespace","reactive","ref","computed","has","omit","watch","onMounted","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;AA4FA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,GAAA,GAAMA,gCAAgB,MAAM,CAAA,CAAA;AAElC,IAAM,MAAA,QAAA,GAAWC,YAAS,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AAExC,IAAA,MAAM,UAAUC,OAAI,EAAA,CAAA;AAEpB,IAAM,MAAA,cAAA,GAAiBA,OAA0C,CAAA,EAAE,CAAA,CAAA;AAEnE,IAAM,MAAA,mBAAA,GAAsBC,aAAS,MAAM;AACzC,MAAO,OAAA,KAAA,CAAM,WAAY,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA;AAChC,QAAA,CAAA,CAAE,WAAWC,YAAI,CAAA,CAAA,EAAG,UAAU,CAAI,GAAA,CAAA,CAAE,WAAW,KAAM,CAAA,QAAA,CAAA;AACrD,QAAA,IAAI,CAAE,CAAA,QAAA,IAAY,CAAE,CAAA,QAAA,CAAS,MAAQ,EAAA;AACnC,UAAE,CAAA,CAAA,QAAA,CAAS,IAAI,CAAK,CAAA,KAAA;AAClB,YAAA,CAAA,CAAE,WAAWA,YAAI,CAAA,CAAA,EAAG,UAAU,CAAI,GAAA,CAAA,CAAE,WAAW,KAAM,CAAA,QAAA,CAAA;AACrD,YAAO,OAAA,CAAA,CAAA;AAAA,WACR,CAAA,CAAA;AAAA,SACH;AACA,QAAO,OAAA,CAAA,CAAA;AAAA,OACR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ineProperty(exports, '__esModule', { value: true });
5
5
  var vue = require('vue');
6
6
  require('../../../../utils/index.js');
7
7
  require('../config/index.js');
8
+ require('../../../../hooks/index.js');
8
9
  var modal = require('../config/modal.js');
10
+ var index = require('../../../../hooks/use-scroll/index.js');
9
11
  var createNamespace = require('../../../../utils/create-namespace.js');
10
12
 
11
13
  "use strict";
@@ -19,10 +21,14 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
21
  setup(__props, { emit: __emit }) {
20
22
  const props = __props;
21
23
  const emits = __emit;
24
+ const { scrollPosition, isHasScrollBar, scrollRef } = index.useScroll();
22
25
  const searchIconValue = vue.ref("");
23
26
  const selectIcon = vue.ref("");
24
27
  const iconList = vue.ref([]);
25
28
  const bem = createNamespace.createNamespace("icon-picker-modal");
29
+ const isShowContentBottomBox = vue.computed(() => {
30
+ return isHasScrollBar.value && scrollPosition.value !== "bottom";
31
+ });
26
32
  const handleOk = () => {
27
33
  emits("changeIconValue", selectIcon.value);
28
34
  emits("update:visible");
@@ -34,13 +40,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
34
40
  (newVisible) => {
35
41
  if (newVisible)
36
42
  searchIconValue.value = "";
37
- }
38
- );
39
- vue.watch(
40
- () => props.value,
41
- (newV) => {
42
- if (newV)
43
- selectIcon.value = newV;
43
+ if (newVisible && props.value)
44
+ selectIcon.value = props.value;
44
45
  },
45
46
  {
46
47
  immediate: true
@@ -60,97 +61,117 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
60
61
  (ele) => ~ele.font_class.indexOf(searchIconValue.value)
61
62
  );
62
63
  });
64
+ vue.watchEffect(() => {
65
+ if (props.visible) {
66
+ if (isHasScrollBar && scrollRef.value && !scrollRef.value.scrollTop) {
67
+ scrollRef.value.scrollTop = 0;
68
+ scrollPosition.value = "top";
69
+ }
70
+ }
71
+ });
63
72
  return (_ctx, _cache) => {
64
73
  const _component_ll_icon = vue.resolveComponent("ll-icon");
65
74
  const _component_a_input = vue.resolveComponent("a-input");
66
75
  const _component_a_form_item = vue.resolveComponent("a-form-item");
67
76
  const _component_a_button = vue.resolveComponent("a-button");
68
77
  const _component_a_space = vue.resolveComponent("a-space");
69
- const _component_ll_modal = vue.resolveComponent("ll-modal");
70
- return vue.openBlock(), vue.createBlock(_component_ll_modal, {
78
+ const _component_ll_new_modal = vue.resolveComponent("ll-new-modal");
79
+ return vue.openBlock(), vue.createBlock(_component_ll_new_modal, {
71
80
  open: _ctx.visible,
72
81
  title: "\u56FE\u6807\u9009\u62E9",
73
82
  class: vue.normalizeClass(`icon-picker-modal-wrapper ${vue.unref(bem).b()}`),
74
83
  width: "766px",
75
84
  keyboard: false,
76
85
  "mask-closable": false,
86
+ "is-show-footer-shadow": isShowContentBottomBox.value,
87
+ "footer-shadow-placement": "outer",
77
88
  onOk: handleOk,
78
89
  onCancel: handleCancel
79
90
  }, {
80
- step: vue.withCtx(() => [
91
+ default: vue.withCtx(() => [
81
92
  vue.createElementVNode(
82
93
  "div",
83
94
  {
84
- class: vue.normalizeClass(vue.unref(bem).e("input-container"))
95
+ class: vue.normalizeClass(vue.unref(bem).e("modal-content"))
85
96
  },
86
97
  [
87
- vue.createVNode(_component_a_form_item, { name: "h" }, {
88
- default: vue.withCtx(() => [
89
- vue.createVNode(_component_a_input, {
90
- value: searchIconValue.value,
91
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchIconValue.value = $event),
92
- class: vue.normalizeClass(vue.unref(bem).e("input")),
93
- "allow-clear": "",
94
- placeholder: "\u641C\u7D22..."
98
+ vue.createElementVNode(
99
+ "div",
100
+ {
101
+ class: vue.normalizeClass(vue.unref(bem).e("input-container"))
102
+ },
103
+ [
104
+ vue.createVNode(_component_a_form_item, { name: "h" }, {
105
+ default: vue.withCtx(() => [
106
+ vue.createVNode(_component_a_input, {
107
+ value: searchIconValue.value,
108
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchIconValue.value = $event),
109
+ class: vue.normalizeClass(vue.unref(bem).e("input")),
110
+ "allow-clear": "",
111
+ placeholder: "\u641C\u7D22..."
112
+ }, {
113
+ prefix: vue.withCtx(() => [
114
+ vue.createVNode(_component_ll_icon, { "icon-name": "icon-search" })
115
+ ]),
116
+ _: 1
117
+ /* STABLE */
118
+ }, 8, ["value", "class"])
119
+ ]),
120
+ _: 1
121
+ /* STABLE */
122
+ })
123
+ ],
124
+ 2
125
+ /* CLASS */
126
+ ),
127
+ vue.createElementVNode(
128
+ "div",
129
+ {
130
+ ref_key: "scrollRef",
131
+ ref: scrollRef,
132
+ class: vue.normalizeClass(vue.unref(bem).e("list"))
133
+ },
134
+ [
135
+ vue.createVNode(_component_a_space, {
136
+ size: [16, 16],
137
+ wrap: "",
138
+ class: vue.normalizeClass(vue.unref(bem).e("space"))
95
139
  }, {
96
- prefix: vue.withCtx(() => [
97
- vue.createVNode(_component_ll_icon, { "icon-name": "icon-search" })
140
+ default: vue.withCtx(() => [
141
+ (vue.openBlock(true), vue.createElementBlock(
142
+ vue.Fragment,
143
+ null,
144
+ vue.renderList(iconList.value, (item) => {
145
+ return vue.openBlock(), vue.createBlock(_component_a_button, {
146
+ key: item.icon_id,
147
+ type: "default",
148
+ class: vue.normalizeClass([
149
+ vue.unref(bem).e("button"),
150
+ selectIcon.value === item.font_class ? vue.unref(bem).is("active") : ""
151
+ ]),
152
+ onClick: ($event) => handleSelectIcon(item)
153
+ }, {
154
+ icon: vue.withCtx(() => [
155
+ vue.createVNode(_component_ll_icon, {
156
+ "icon-name": "icon-" + item.font_class,
157
+ style: { "font-size": "28px" }
158
+ }, null, 8, ["icon-name"])
159
+ ]),
160
+ _: 2
161
+ /* DYNAMIC */
162
+ }, 1032, ["class", "onClick"]);
163
+ }),
164
+ 128
165
+ /* KEYED_FRAGMENT */
166
+ ))
98
167
  ]),
99
168
  _: 1
100
169
  /* STABLE */
101
- }, 8, ["value", "class"])
102
- ]),
103
- _: 1
104
- /* STABLE */
105
- })
106
- ],
107
- 2
108
- /* CLASS */
109
- )
110
- ]),
111
- default: vue.withCtx(() => [
112
- vue.createElementVNode(
113
- "div",
114
- {
115
- class: vue.normalizeClass(vue.unref(bem).e("list"))
116
- },
117
- [
118
- vue.createVNode(_component_a_space, {
119
- size: [16, 16],
120
- wrap: "",
121
- class: vue.normalizeClass(vue.unref(bem).e("space"))
122
- }, {
123
- default: vue.withCtx(() => [
124
- (vue.openBlock(true), vue.createElementBlock(
125
- vue.Fragment,
126
- null,
127
- vue.renderList(iconList.value, (item) => {
128
- return vue.openBlock(), vue.createBlock(_component_a_button, {
129
- key: item.icon_id,
130
- type: "default",
131
- class: vue.normalizeClass([
132
- vue.unref(bem).e("button"),
133
- selectIcon.value === item.font_class ? vue.unref(bem).is("active") : ""
134
- ]),
135
- onClick: ($event) => handleSelectIcon(item)
136
- }, {
137
- icon: vue.withCtx(() => [
138
- vue.createVNode(_component_ll_icon, {
139
- "icon-name": "icon-" + item.font_class,
140
- style: { "font-size": "28px" }
141
- }, null, 8, ["icon-name"])
142
- ]),
143
- _: 2
144
- /* DYNAMIC */
145
- }, 1032, ["class", "onClick"]);
146
- }),
147
- 128
148
- /* KEYED_FRAGMENT */
149
- ))
150
- ]),
151
- _: 1
152
- /* STABLE */
153
- }, 8, ["class"])
170
+ }, 8, ["class"])
171
+ ],
172
+ 2
173
+ /* CLASS */
174
+ )
154
175
  ],
155
176
  2
156
177
  /* CLASS */
@@ -158,7 +179,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
158
179
  ]),
159
180
  _: 1
160
181
  /* STABLE */
161
- }, 8, ["open", "class"]);
182
+ }, 8, ["open", "class", "is-show-footer-shadow"]);
162
183
  };
163
184
  }
164
185
  });
@@ -1 +1 @@
1
- {"version":3,"file":"modal.vue2.js","sources":["../../../../../../../packages/components/icon-picker/src/components/modal.vue"],"sourcesContent":["<template>\n <ll-modal\n :open=\"visible\"\n :title=\"'图标选择'\"\n :class=\"`icon-picker-modal-wrapper ${bem.b()}`\"\n width=\"766px\"\n :keyboard=\"false\"\n :mask-closable=\"false\"\n @ok=\"handleOk\"\n @cancel=\"handleCancel\"\n >\n <template #step>\n <div :class=\"bem.e('input-container')\">\n <a-form-item name=\"h\">\n <a-input\n v-model:value=\"searchIconValue\"\n :class=\"bem.e('input')\"\n allow-clear\n placeholder=\"搜索...\"\n >\n <template #prefix>\n <ll-icon icon-name=\"icon-search\" />\n </template>\n </a-input>\n </a-form-item>\n </div>\n </template>\n <div :class=\"bem.e('list')\">\n <a-space :size=\"[16, 16]\" wrap :class=\"bem.e('space')\">\n <a-button\n v-for=\"item in iconList\"\n :key=\"item.icon_id\"\n type=\"default\"\n :class=\"[\n bem.e('button'),\n selectIcon === item.font_class ? bem.is('active') : ''\n ]\"\n @click=\"handleSelectIcon(item)\"\n >\n <template #icon>\n <ll-icon\n :icon-name=\"'icon-' + item.font_class\"\n style=\"font-size: 28px\"\n />\n </template>\n </a-button>\n </a-space>\n </div>\n </ll-modal>\n</template>\n<script lang=\"ts\" setup>\nimport { ref, watch } from 'vue'\n\nimport { createNamespace } from '@ll-plus/utils'\nimport { iconPickerModalProps, iconPickerModalEmits } from '../config'\n\nimport type { IconPickerItem } from '../config'\n\ndefineOptions({\n name: 'LlIconPickerModal'\n})\n\nconst props = defineProps(iconPickerModalProps)\nconst emits = defineEmits(iconPickerModalEmits)\n\nconst searchIconValue = ref('')\nconst selectIcon = ref('')\nconst iconList = ref<IconPickerItem[]>([])\nconst bem = createNamespace('icon-picker-modal')\n\nconst handleOk = () => {\n emits('changeIconValue', selectIcon.value)\n emits('update:visible')\n}\nconst handleCancel = () => emits('update:visible')\nconst handleSelectIcon = (icon: IconPickerItem) =>\n (selectIcon.value = icon?.font_class as string)\n\n// 监听选择的icon\nwatch(\n () => props.visible,\n newVisible => {\n if (newVisible) searchIconValue.value = ''\n }\n)\nwatch(\n () => props.value,\n newV => {\n if (newV) selectIcon.value = newV\n },\n {\n immediate: true\n }\n)\nwatch(\n () => props.data,\n newData => {\n iconList.value = [...newData]\n },\n {\n immediate: true\n }\n)\nwatch(searchIconValue, () => {\n iconList.value = props.data.filter(\n ele => ~ele.font_class!.indexOf(searchIconValue.value)\n )\n})\n</script>\n"],"names":["ref","createNamespace","watch"],"mappings":";;;;;;;;;;;;;;;;;;;AA8DA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,eAAA,GAAkBA,QAAI,EAAE,CAAA,CAAA;AAC9B,IAAM,MAAA,UAAA,GAAaA,QAAI,EAAE,CAAA,CAAA;AACzB,IAAM,MAAA,QAAA,GAAWA,OAAsB,CAAA,EAAE,CAAA,CAAA;AACzC,IAAM,MAAA,GAAA,GAAMC,gCAAgB,mBAAmB,CAAA,CAAA;AAE/C,IAAA,MAAM,WAAW,MAAM;AACrB,MAAM,KAAA,CAAA,iBAAA,EAAmB,WAAW,KAAK,CAAA,CAAA;AACzC,MAAA,KAAA,CAAM,gBAAgB,CAAA,CAAA;AAAA,KACxB,CAAA;AACA,IAAM,MAAA,YAAA,GAAe,MAAM,KAAA,CAAM,gBAAgB,CAAA,CAAA;AACjD,IAAA,MAAM,gBAAmB,GAAA,CAAC,IACvB,KAAA,UAAA,CAAW,QAAQ,IAAM,EAAA,UAAA,CAAA;AAG5B,IAAAC,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,OAAA;AAAA,MACZ,CAAc,UAAA,KAAA;AACZ,QAAI,IAAA,UAAA;AAAY,UAAA,eAAA,CAAgB,KAAQ,GAAA,EAAA,CAAA;AAAA,OAC1C;AAAA,KACF,CAAA;AACA,IAAAA,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,KAAA;AAAA,MACZ,CAAQ,IAAA,KAAA;AACN,QAAI,IAAA,IAAA;AAAM,UAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,OAC/B;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AACA,IAAAA,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,CAAW,OAAA,KAAA;AACT,QAAS,QAAA,CAAA,KAAA,GAAQ,CAAC,GAAG,OAAO,CAAA,CAAA;AAAA,OAC9B;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AACA,IAAAA,SAAA,CAAM,iBAAiB,MAAM;AAC3B,MAAS,QAAA,CAAA,KAAA,GAAQ,MAAM,IAAK,CAAA,MAAA;AAAA,QAC1B,SAAO,CAAC,GAAA,CAAI,UAAY,CAAA,OAAA,CAAQ,gBAAgB,KAAK,CAAA;AAAA,OACvD,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"modal.vue2.js","sources":["../../../../../../../packages/components/icon-picker/src/components/modal.vue"],"sourcesContent":["<template>\n <ll-new-modal\n :open=\"visible\"\n :title=\"'图标选择'\"\n :class=\"`icon-picker-modal-wrapper ${bem.b()}`\"\n width=\"766px\"\n :keyboard=\"false\"\n :mask-closable=\"false\"\n :is-show-footer-shadow=\"isShowContentBottomBox\"\n footer-shadow-placement=\"outer\"\n @ok=\"handleOk\"\n @cancel=\"handleCancel\"\n >\n <div :class=\"bem.e('modal-content')\">\n <div :class=\"bem.e('input-container')\">\n <a-form-item name=\"h\">\n <a-input\n v-model:value=\"searchIconValue\"\n :class=\"bem.e('input')\"\n allow-clear\n placeholder=\"搜索...\"\n >\n <template #prefix>\n <ll-icon icon-name=\"icon-search\" />\n </template>\n </a-input>\n </a-form-item>\n </div>\n <div ref=\"scrollRef\" :class=\"bem.e('list')\">\n <a-space :size=\"[16, 16]\" wrap :class=\"bem.e('space')\">\n <a-button\n v-for=\"item in iconList\"\n :key=\"item.icon_id\"\n type=\"default\"\n :class=\"[\n bem.e('button'),\n selectIcon === item.font_class ? bem.is('active') : ''\n ]\"\n @click=\"handleSelectIcon(item)\"\n >\n <template #icon>\n <ll-icon\n :icon-name=\"'icon-' + item.font_class\"\n style=\"font-size: 28px\"\n />\n </template>\n </a-button>\n </a-space>\n </div>\n </div>\n </ll-new-modal>\n</template>\n<script lang=\"ts\" setup>\nimport { computed, ref, watch, watchEffect } from 'vue'\n\nimport { createNamespace } from '@ll-plus/utils'\nimport { iconPickerModalProps, iconPickerModalEmits } from '../config'\n\nimport type { IconPickerItem } from '../config'\nimport { useScroll } from '@ll-plus/hooks'\n\ndefineOptions({\n name: 'LlIconPickerModal'\n})\n\nconst props = defineProps(iconPickerModalProps)\nconst emits = defineEmits(iconPickerModalEmits)\n\nconst { scrollPosition, isHasScrollBar, scrollRef } = useScroll()\n\nconst searchIconValue = ref('')\nconst selectIcon = ref('')\nconst iconList = ref<IconPickerItem[]>([])\nconst bem = createNamespace('icon-picker-modal')\n\n// 是否显示内容区域底部的阴影div\nconst isShowContentBottomBox = computed(() => {\n return isHasScrollBar.value && scrollPosition.value !== 'bottom'\n})\n\nconst handleOk = () => {\n emits('changeIconValue', selectIcon.value)\n emits('update:visible')\n}\nconst handleCancel = () => emits('update:visible')\nconst handleSelectIcon = (icon: IconPickerItem) =>\n (selectIcon.value = icon?.font_class as string)\n\nwatch(\n () => props.visible,\n newVisible => {\n // 清空查询值\n if (newVisible) searchIconValue.value = ''\n\n if (newVisible && props.value) selectIcon.value = props.value\n },\n {\n immediate: true\n }\n)\nwatch(\n () => props.data,\n newData => {\n iconList.value = [...newData]\n },\n {\n immediate: true\n }\n)\nwatch(searchIconValue, () => {\n iconList.value = props.data.filter(\n ele => ~ele.font_class!.indexOf(searchIconValue.value)\n )\n})\n\n// 滚动条回到顶部\nwatchEffect(() => {\n if (props.visible) {\n // 头部有步骤条回到顶部\n if (isHasScrollBar && scrollRef.value && !scrollRef.value.scrollTop) {\n scrollRef.value.scrollTop = 0\n scrollPosition.value = 'top'\n }\n }\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ACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AACA,IAAAA,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,CAAW,OAAA,KAAA;AACT,QAAS,QAAA,CAAA,KAAA,GAAQ,CAAC,GAAG,OAAO,CAAA,CAAA;AAAA,OAC9B;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;AACA,IAAAA,SAAA,CAAM,iBAAiB,MAAM;AAC3B,MAAS,QAAA,CAAA,KAAA,GAAQ,MAAM,IAAK,CAAA,MAAA;AAAA,QAC1B,SAAO,CAAC,GAAA,CAAI,UAAY,CAAA,OAAA,CAAQ,gBAAgB,KAAK,CAAA;AAAA,OACvD,CAAA;AAAA,KACD,CAAA,CAAA;AAGD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAA,IAAI,MAAM,OAAS,EAAA;AAEjB,QAAA,IAAI,kBAAkB,SAAU,CAAA,KAAA,IAAS,CAAC,SAAA,CAAU,MAAM,SAAW,EAAA;AACnE,UAAA,SAAA,CAAU,MAAM,SAAY,GAAA,CAAA,CAAA;AAC5B,UAAA,cAAA,CAAe,KAAQ,GAAA,KAAA,CAAA;AAAA,SACzB;AAAA,OACF;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,10 +13,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
13
13
  ...{ name: "LlInput" },
14
14
  __name: "input",
15
15
  props: input.inputProps,
16
- setup(__props) {
16
+ setup(__props, { expose: __expose }) {
17
17
  const bem = createNamespace.createNamespace("input");
18
18
  const props = __props;
19
19
  const innerValue = vue.ref("");
20
+ const inputRef = vue.ref();
20
21
  vue.watchEffect(() => {
21
22
  if (props.value !== innerValue.value) {
22
23
  innerValue.value = props.value;
@@ -27,9 +28,15 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
27
28
  const attrs = { ...vue.useAttrs(), ...props };
28
29
  return attrs;
29
30
  });
31
+ const focus = () => {
32
+ inputRef.value.focus();
33
+ };
34
+ __expose({ focus });
30
35
  return (_ctx, _cache) => {
31
36
  const _component_ll_icon = vue.resolveComponent("ll-icon");
32
37
  return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentType)), vue.mergeProps({
38
+ ref_key: "inputRef",
39
+ ref: inputRef,
33
40
  class: vue.unref(bem).b()
34
41
  }, computedAttrs.value), vue.createSlots({
35
42
  _: 2
@@ -1 +1 @@
1
- {"version":3,"file":"input.vue2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <component :is=\"componentType\" :class=\"bem.b()\" v-bind=\"computedAttrs\">\n <template v-for=\"item in Object.keys($slots)\" :key=\"item\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"prefixIcon\" #prefix>\n <ll-icon :icon-name=\"prefixIcon\" class-name=\"prefix-icon\" />\n </template>\n <template v-if=\"suffixIcon\" #suffix>\n <ll-icon :icon-name=\"suffixIcon\" class-name=\"suffix-icon\" />\n </template>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, useAttrs, watchEffect } from 'vue'\nimport { Input } from 'ant-design-vue'\nimport { createNamespace } from '@ll-plus/utils'\nimport { InputValue, inputProps } from './input'\n\ndefineOptions({ name: 'LlInput' })\n\nconst bem = createNamespace('input')\n\nconst props = defineProps(inputProps)\n\nconst innerValue = ref<InputValue>('')\n\nwatchEffect(() => {\n if (props.value !== innerValue.value) {\n innerValue.value = props.value\n }\n})\n\nconst componentType = props.showPassword ? Input.Password : Input\n\nconst computedAttrs = computed(() => {\n const attrs = { ...useAttrs(), ...props }\n\n return attrs\n})\n</script>\n"],"names":["createNamespace","ref","watchEffect","Input","computed","useAttrs"],"mappings":";;;;;;;;;;;;;;;;AAsBA,IAAM,MAAA,GAAA,GAAMA,gCAAgB,OAAO,CAAA,CAAA;AAEnC,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAM,MAAA,UAAA,GAAaC,QAAgB,EAAE,CAAA,CAAA;AAErC,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAI,IAAA,KAAA,CAAM,KAAU,KAAA,UAAA,CAAW,KAAO,EAAA;AACpC,QAAA,UAAA,CAAW,QAAQ,KAAM,CAAA,KAAA,CAAA;AAAA,OAC3B;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAM,aAAgB,GAAA,KAAA,CAAM,YAAe,GAAAC,kBAAA,CAAM,QAAW,GAAAA,kBAAA,CAAA;AAE5D,IAAM,MAAA,aAAA,GAAgBC,aAAS,MAAM;AACnC,MAAA,MAAM,QAAQ,EAAE,GAAGC,YAAS,EAAA,EAAG,GAAG,KAAM,EAAA,CAAA;AAExC,MAAO,OAAA,KAAA,CAAA;AAAA,KACR,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"input.vue2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <component\n :is=\"componentType\"\n ref=\"inputRef\"\n :class=\"bem.b()\"\n v-bind=\"computedAttrs\"\n >\n <template v-for=\"item in Object.keys($slots)\" :key=\"item\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"prefixIcon\" #prefix>\n <ll-icon :icon-name=\"prefixIcon\" class-name=\"prefix-icon\" />\n </template>\n <template v-if=\"suffixIcon\" #suffix>\n <ll-icon :icon-name=\"suffixIcon\" class-name=\"suffix-icon\" />\n </template>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, useAttrs, watchEffect } from 'vue'\nimport { Input } from 'ant-design-vue'\nimport { createNamespace } from '@ll-plus/utils'\nimport { InputValue, inputProps } from './input'\n\ndefineOptions({ name: 'LlInput' })\n\nconst bem = createNamespace('input')\n\nconst props = defineProps(inputProps)\n\nconst innerValue = ref<InputValue>('')\n\nconst inputRef = ref()\n\nwatchEffect(() => {\n if (props.value !== innerValue.value) {\n innerValue.value = props.value\n }\n})\n\nconst componentType = props.showPassword ? Input.Password : Input\n\nconst computedAttrs = computed(() => {\n const attrs = { ...useAttrs(), ...props }\n\n return attrs\n})\n\nconst focus = () => {\n inputRef.value.focus()\n}\n\ndefineExpose({ focus })\n</script>\n"],"names":["createNamespace","ref","watchEffect","Input","computed","useAttrs"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAM,MAAA,GAAA,GAAMA,gCAAgB,OAAO,CAAA,CAAA;AAEnC,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAM,MAAA,UAAA,GAAaC,QAAgB,EAAE,CAAA,CAAA;AAErC,IAAA,MAAM,WAAWA,OAAI,EAAA,CAAA;AAErB,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAI,IAAA,KAAA,CAAM,KAAU,KAAA,UAAA,CAAW,KAAO,EAAA;AACpC,QAAA,UAAA,CAAW,QAAQ,KAAM,CAAA,KAAA,CAAA;AAAA,OAC3B;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAM,aAAgB,GAAA,KAAA,CAAM,YAAe,GAAAC,kBAAA,CAAM,QAAW,GAAAA,kBAAA,CAAA;AAE5D,IAAM,MAAA,aAAA,GAAgBC,aAAS,MAAM;AACnC,MAAA,MAAM,QAAQ,EAAE,GAAGC,YAAS,EAAA,EAAG,GAAG,KAAM,EAAA,CAAA;AAExC,MAAO,OAAA,KAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAA,MAAM,QAAQ,MAAM;AAClB,MAAA,QAAA,CAAS,MAAM,KAAM,EAAA,CAAA;AAAA,KACvB,CAAA;AAEA,IAAa,QAAA,CAAA,EAAE,OAAO,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -21,12 +21,13 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
21
21
  __name: "input-number",
22
22
  props: inputNumber.inputNumberProps,
23
23
  emits: inputNumber.inputNumberEmits,
24
- setup(__props, { emit: __emit }) {
24
+ setup(__props, { expose: __expose, emit: __emit }) {
25
25
  const props = __props;
26
26
  const emit = __emit;
27
27
  const bem = createNamespace.createNamespace("input-number");
28
28
  const attrs = vue.useAttrs();
29
29
  const innerValue = vue.ref("");
30
+ const inputRef = vue.ref();
30
31
  const integerCongfig = vue.computed(() => {
31
32
  let obj = {};
32
33
  if (props.integer) {
@@ -64,6 +65,10 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
64
65
  emit("update:value", value);
65
66
  emit("change", value);
66
67
  }
68
+ const focus = () => {
69
+ inputRef.value.focus();
70
+ };
71
+ __expose({ focus });
67
72
  return (_ctx, _cache) => {
68
73
  return vue.openBlock(), vue.createElementBlock(
69
74
  "div",
@@ -79,6 +84,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
79
84
  },
80
85
  [
81
86
  vue.createVNode(vue.unref(antDesignVue.InputNumber), vue.mergeProps({
87
+ ref_key: "inputRef",
88
+ ref: inputRef,
82
89
  value: innerValue.value,
83
90
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event)
84
91
  }, getBindValue.value, { onChange }), vue.createSlots({
@@ -1 +1 @@
1
- {"version":3,"file":"input-number.vue2.js","sources":["../../../../../../packages/components/input-number/src/input-number.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <div v-if=\"!detailed\" :class=\"bem.e('container')\">\n <InputNumber\n v-model:value=\"innerValue\"\n v-bind=\"getBindValue\"\n @change=\"onChange\"\n >\n <template v-for=\"item in Object.keys($slots)\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"getBindValue.unit\" #addonAfter>\n <div :class=\"bem.e('unit')\">\n {{ getBindValue.unit }}\n </div>\n </template>\n </InputNumber>\n </div>\n\n <p\n v-if=\"detailed\"\n :class=\"bem.e('detailed')\"\n :title=\"thousands ? thousandsFormat(innerValue) : innerValue\"\n >\n <span v-if=\"$attrs.addonBefore\">{{ $attrs.addonBefore }}</span>\n {{ thousands ? thousandsFormat(innerValue) : innerValue }}\n <span v-if=\"$attrs.addonAfter\">{{ $attrs.addonAfter }}</span>\n </p>\n <p\n v-if=\"isAmountChinese && getChineseName\"\n :class=\"bem.e('amount-chinese-name')\"\n >\n {{ getChineseName }}\n </p>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch, useAttrs } from 'vue'\nimport { InputNumber } from 'ant-design-vue'\nimport { isNil } from 'lodash-es'\nimport {\n getAmountChinese,\n thousandsFormat,\n createNamespace\n} from '@ll-plus/utils'\nimport { inputNumberProps, inputNumberEmits } from './input-number'\nimport { integerDict, type Integer } from './config'\nimport type { InputNumberProps } from 'ant-design-vue'\ndefineOptions({ name: 'LlInputNumber' })\nconst props = defineProps(inputNumberProps)\nconst emit = defineEmits(inputNumberEmits)\nconst bem = createNamespace('input-number')\nconst attrs = useAttrs()\nconst innerValue = ref('')\nconst integerCongfig = computed(() => {\n let obj = {} as Integer\n if (props.integer) {\n obj = integerDict[props.integer]\n }\n return obj\n})\n\nconst getBindValue = computed(() => {\n const bindValue = {\n ...attrs,\n ...integerCongfig.value\n } as InputNumberProps & { unit: string }\n if (props.thousands) {\n bindValue.formatter = (value: string | number) => thousandsFormat(value)\n bindValue.parser = (value: string) => value.replace(/\\$\\s?|(,*)/g, '')\n }\n return bindValue\n})\n\nconst getChineseName = computed(() => {\n let str = ''\n str =\n !props.isAmountChinese || isNil(innerValue.value)\n ? ''\n : getAmountChinese(Number(innerValue.value))\n return str\n})\n\nwatch(\n () => props.value,\n val => {\n setValue(val)\n },\n { immediate: true }\n)\n\nfunction setValue(value) {\n innerValue.value = isNil(value) || isNaN(value) ? null : value\n // (!value && value !== 0) || isNaN(value) ? null : Number(value)\n}\nfunction onChange(value) {\n emit('update:value', value)\n emit('change', value)\n}\n</script>\n"],"names":["createNamespace","useAttrs","ref","computed","integerDict","thousandsFormat","isNil","getAmountChinese","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AACb,IAAM,MAAA,GAAA,GAAMA,gCAAgB,cAAc,CAAA,CAAA;AAC1C,IAAA,MAAM,QAAQC,YAAS,EAAA,CAAA;AACvB,IAAM,MAAA,UAAA,GAAaC,QAAI,EAAE,CAAA,CAAA;AACzB,IAAM,MAAA,cAAA,GAAiBC,aAAS,MAAM;AACpC,MAAA,IAAI,MAAM,EAAC,CAAA;AACX,MAAA,IAAI,MAAM,OAAS,EAAA;AACjB,QAAM,GAAA,GAAAC,yBAAA,CAAY,MAAM,OAAO,CAAA,CAAA;AAAA,OACjC;AACA,MAAO,OAAA,GAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,YAAA,GAAeD,aAAS,MAAM;AAClC,MAAA,MAAM,SAAY,GAAA;AAAA,QAChB,GAAG,KAAA;AAAA,QACH,GAAG,cAAe,CAAA,KAAA;AAAA,OACpB,CAAA;AACA,MAAA,IAAI,MAAM,SAAW,EAAA;AACnB,QAAA,SAAA,CAAU,SAAY,GAAA,CAAC,KAA2B,KAAAE,sBAAA,CAAgB,KAAK,CAAA,CAAA;AACvE,QAAA,SAAA,CAAU,SAAS,CAAC,KAAA,KAAkB,KAAM,CAAA,OAAA,CAAQ,eAAe,EAAE,CAAA,CAAA;AAAA,OACvE;AACA,MAAO,OAAA,SAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,cAAA,GAAiBF,aAAS,MAAM;AACpC,MAAA,IAAI,GAAM,GAAA,EAAA,CAAA;AACV,MAAA,GAAA,GACE,CAAC,KAAA,CAAM,eAAmB,IAAAG,cAAA,CAAM,UAAW,CAAA,KAAK,CAC5C,GAAA,EAAA,GACAC,uBAAiB,CAAA,MAAA,CAAO,UAAW,CAAA,KAAK,CAAC,CAAA,CAAA;AAC/C,MAAO,OAAA,GAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAAC,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,KAAA;AAAA,MACZ,CAAO,GAAA,KAAA;AACL,QAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AAAA,OACd;AAAA,MACA,EAAE,WAAW,IAAK,EAAA;AAAA,KACpB,CAAA;AAEA,IAAA,SAAS,SAAS,KAAO,EAAA;AACvB,MAAA,UAAA,CAAW,QAAQF,cAAM,CAAA,KAAK,KAAK,KAAM,CAAA,KAAK,IAAI,IAAO,GAAA,KAAA,CAAA;AAAA,KAE3D;AACA,IAAA,SAAS,SAAS,KAAO,EAAA;AACvB,MAAA,IAAA,CAAK,gBAAgB,KAAK,CAAA,CAAA;AAC1B,MAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,KACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"input-number.vue2.js","sources":["../../../../../../packages/components/input-number/src/input-number.vue"],"sourcesContent":["<template>\n <div :class=\"bem.b()\">\n <div v-if=\"!detailed\" :class=\"bem.e('container')\">\n <InputNumber\n ref=\"inputRef\"\n v-model:value=\"innerValue\"\n v-bind=\"getBindValue\"\n @change=\"onChange\"\n >\n <template v-for=\"item in Object.keys($slots)\" #[item]=\"data\">\n <slot :name=\"item\" v-bind=\"data || {}\"></slot>\n </template>\n <template v-if=\"getBindValue.unit\" #addonAfter>\n <div :class=\"bem.e('unit')\">\n {{ getBindValue.unit }}\n </div>\n </template>\n </InputNumber>\n </div>\n\n <p\n v-if=\"detailed\"\n :class=\"bem.e('detailed')\"\n :title=\"thousands ? thousandsFormat(innerValue) : innerValue\"\n >\n <span v-if=\"$attrs.addonBefore\">{{ $attrs.addonBefore }}</span>\n {{ thousands ? thousandsFormat(innerValue) : innerValue }}\n <span v-if=\"$attrs.addonAfter\">{{ $attrs.addonAfter }}</span>\n </p>\n <p\n v-if=\"isAmountChinese && getChineseName\"\n :class=\"bem.e('amount-chinese-name')\"\n >\n {{ getChineseName }}\n </p>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, watch, useAttrs } from 'vue'\nimport { InputNumber } from 'ant-design-vue'\nimport { isNil } from 'lodash-es'\nimport {\n getAmountChinese,\n thousandsFormat,\n createNamespace\n} from '@ll-plus/utils'\nimport { inputNumberProps, inputNumberEmits } from './input-number'\nimport { integerDict, type Integer } from './config'\nimport type { InputNumberProps } from 'ant-design-vue'\ndefineOptions({ name: 'LlInputNumber' })\nconst props = defineProps(inputNumberProps)\nconst emit = defineEmits(inputNumberEmits)\nconst bem = createNamespace('input-number')\nconst attrs = useAttrs()\nconst innerValue = ref('')\nconst inputRef = ref()\nconst integerCongfig = computed(() => {\n let obj = {} as Integer\n if (props.integer) {\n obj = integerDict[props.integer]\n }\n return obj\n})\n\nconst getBindValue = computed(() => {\n const bindValue = {\n ...attrs,\n ...integerCongfig.value\n } as InputNumberProps & { unit: string }\n if (props.thousands) {\n bindValue.formatter = (value: string | number) => thousandsFormat(value)\n bindValue.parser = (value: string) => value.replace(/\\$\\s?|(,*)/g, '')\n }\n return bindValue\n})\n\nconst getChineseName = computed(() => {\n let str = ''\n str =\n !props.isAmountChinese || isNil(innerValue.value)\n ? ''\n : getAmountChinese(Number(innerValue.value))\n return str\n})\n\nwatch(\n () => props.value,\n val => {\n setValue(val)\n },\n { immediate: true }\n)\n\nfunction setValue(value) {\n innerValue.value = isNil(value) || isNaN(value) ? null : value\n // (!value && value !== 0) || isNaN(value) ? null : Number(value)\n}\nfunction onChange(value) {\n emit('update:value', value)\n emit('change', value)\n}\n\nconst focus = () => {\n inputRef.value.focus()\n}\n\ndefineExpose({ focus })\n</script>\n"],"names":["createNamespace","useAttrs","ref","computed","integerDict","thousandsFormat","isNil","getAmountChinese","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AACb,IAAM,MAAA,GAAA,GAAMA,gCAAgB,cAAc,CAAA,CAAA;AAC1C,IAAA,MAAM,QAAQC,YAAS,EAAA,CAAA;AACvB,IAAM,MAAA,UAAA,GAAaC,QAAI,EAAE,CAAA,CAAA;AACzB,IAAA,MAAM,WAAWA,OAAI,EAAA,CAAA;AACrB,IAAM,MAAA,cAAA,GAAiBC,aAAS,MAAM;AACpC,MAAA,IAAI,MAAM,EAAC,CAAA;AACX,MAAA,IAAI,MAAM,OAAS,EAAA;AACjB,QAAM,GAAA,GAAAC,yBAAA,CAAY,MAAM,OAAO,CAAA,CAAA;AAAA,OACjC;AACA,MAAO,OAAA,GAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,YAAA,GAAeD,aAAS,MAAM;AAClC,MAAA,MAAM,SAAY,GAAA;AAAA,QAChB,GAAG,KAAA;AAAA,QACH,GAAG,cAAe,CAAA,KAAA;AAAA,OACpB,CAAA;AACA,MAAA,IAAI,MAAM,SAAW,EAAA;AACnB,QAAA,SAAA,CAAU,SAAY,GAAA,CAAC,KAA2B,KAAAE,sBAAA,CAAgB,KAAK,CAAA,CAAA;AACvE,QAAA,SAAA,CAAU,SAAS,CAAC,KAAA,KAAkB,KAAM,CAAA,OAAA,CAAQ,eAAe,EAAE,CAAA,CAAA;AAAA,OACvE;AACA,MAAO,OAAA,SAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,cAAA,GAAiBF,aAAS,MAAM;AACpC,MAAA,IAAI,GAAM,GAAA,EAAA,CAAA;AACV,MAAA,GAAA,G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