orion-design 0.1.30 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. package/README.md +5 -5
  2. package/dist/Throne/index.js +30 -14
  3. package/dist/Throne/index.js.map +1 -1
  4. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  5. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  6. package/dist/components/Button/index.js +40 -33
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Flex/index.js +122 -89
  9. package/dist/components/Flex/index.js.map +1 -1
  10. package/dist/components/Form/Form.js +2 -2
  11. package/dist/components/Form/Form.js.map +1 -1
  12. package/dist/components/Form/LovInput/LovInput.js +2 -2
  13. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  14. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  15. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  16. package/dist/components/Form/LovInput/index.js +4 -4
  17. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  18. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  19. package/dist/components/Form/hooks/index.js +128 -66
  20. package/dist/components/Form/hooks/index.js.map +1 -1
  21. package/dist/components/Form/index.js +836 -656
  22. package/dist/components/Form/index.js.map +1 -1
  23. package/dist/components/Form/utils/index.js +30 -18
  24. package/dist/components/Form/utils/index.js.map +1 -1
  25. package/dist/components/LovTable/index.js +179 -105
  26. package/dist/components/LovTable/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +111 -56
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/Modal/types.js +4 -3
  30. package/dist/components/Modal/types.js.map +1 -1
  31. package/dist/components/Modal/useModal.js +5 -5
  32. package/dist/components/Modal/useModal.js.map +1 -1
  33. package/dist/components/Pagetable/hooks/useColumns.js +88 -80
  34. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  35. package/dist/components/Pagetable/index.js +687 -542
  36. package/dist/components/Pagetable/index.js.map +1 -1
  37. package/dist/components/Pagetable/utils/index.js +92 -54
  38. package/dist/components/Pagetable/utils/index.js.map +1 -1
  39. package/dist/components/Querytable/hooks/useColumns.js +82 -74
  40. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  41. package/dist/components/Querytable/index.js +579 -469
  42. package/dist/components/Querytable/index.js.map +1 -1
  43. package/dist/components/Querytable/utils/index.js +92 -54
  44. package/dist/components/Querytable/utils/index.js.map +1 -1
  45. package/dist/components/RichTextEditor/index.js +100 -74
  46. package/dist/components/RichTextEditor/index.js.map +1 -1
  47. package/dist/components/Tabs/constants.js +2 -2
  48. package/dist/components/Tabs/constants.js.map +1 -1
  49. package/dist/components/Tabs/index.js +603 -358
  50. package/dist/components/Tabs/index.js.map +1 -1
  51. package/dist/components/Tabs/tab-bar.js +6 -6
  52. package/dist/components/Tabs/tab-bar.js.map +1 -1
  53. package/dist/components/Tabs/tab-pane.js +3 -3
  54. package/dist/components/Tabs/tab-pane.js.map +1 -1
  55. package/dist/components/_constants/aria.js +2 -2
  56. package/dist/components/_constants/aria.js.map +1 -1
  57. package/dist/components/_constants/event.js +6 -4
  58. package/dist/components/_constants/event.js.map +1 -1
  59. package/dist/components/_constants/index.js +6 -6
  60. package/dist/components/_hooks/index.js +7 -7
  61. package/dist/components/_hooks/use-namespace/index.js +74 -39
  62. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  63. package/dist/components/_hooks/use-ordered-children/index.js +29 -19
  64. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  65. package/dist/components/_util/arrays.js +9 -5
  66. package/dist/components/_util/arrays.js.map +1 -1
  67. package/dist/components/_util/browser.js +6 -6
  68. package/dist/components/_util/browser.js.map +1 -1
  69. package/dist/components/_util/classNames.js +22 -17
  70. package/dist/components/_util/classNames.js.map +1 -1
  71. package/dist/components/_util/dom/aria.js +74 -39
  72. package/dist/components/_util/dom/aria.js.map +1 -1
  73. package/dist/components/_util/dom/element.js +9 -8
  74. package/dist/components/_util/dom/element.js.map +1 -1
  75. package/dist/components/_util/dom/event.js +14 -7
  76. package/dist/components/_util/dom/event.js.map +1 -1
  77. package/dist/components/_util/dom/index.js +36 -36
  78. package/dist/components/_util/dom/position.js +49 -25
  79. package/dist/components/_util/dom/position.js.map +1 -1
  80. package/dist/components/_util/dom/scroll.js +103 -61
  81. package/dist/components/_util/dom/scroll.js.map +1 -1
  82. package/dist/components/_util/dom/style.js +65 -50
  83. package/dist/components/_util/dom/style.js.map +1 -1
  84. package/dist/components/_util/easings.js +8 -4
  85. package/dist/components/_util/easings.js.map +1 -1
  86. package/dist/components/_util/error.js +12 -11
  87. package/dist/components/_util/error.js.map +1 -1
  88. package/dist/components/_util/functions.js +3 -3
  89. package/dist/components/_util/i18n.js +2 -2
  90. package/dist/components/_util/i18n.js.map +1 -1
  91. package/dist/components/_util/index.js +137 -137
  92. package/dist/components/_util/isValid.js +4 -2
  93. package/dist/components/_util/isValid.js.map +1 -1
  94. package/dist/components/_util/objects.js +18 -14
  95. package/dist/components/_util/objects.js.map +1 -1
  96. package/dist/components/_util/props-util/index.js +46 -20
  97. package/dist/components/_util/props-util/index.js.map +1 -1
  98. package/dist/components/_util/props-util/initDefaultProps.js +18 -10
  99. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  100. package/dist/components/_util/raf.js +5 -4
  101. package/dist/components/_util/raf.js.map +1 -1
  102. package/dist/components/_util/rand.js +4 -3
  103. package/dist/components/_util/rand.js.map +1 -1
  104. package/dist/components/_util/strings.js +9 -8
  105. package/dist/components/_util/strings.js.map +1 -1
  106. package/dist/components/_util/throttleByRaf.js +16 -10
  107. package/dist/components/_util/throttleByRaf.js.map +1 -1
  108. package/dist/components/_util/type.js +41 -38
  109. package/dist/components/_util/type.js.map +1 -1
  110. package/dist/components/_util/types.js +41 -22
  111. package/dist/components/_util/types.js.map +1 -1
  112. package/dist/components/_util/typescript.js +2 -2
  113. package/dist/components/_util/typescript.js.map +1 -1
  114. package/dist/components/_util/util.js +85 -43
  115. package/dist/components/_util/util.js.map +1 -1
  116. package/dist/components/_util/vue/global-node.js +27 -15
  117. package/dist/components/_util/vue/global-node.js.map +1 -1
  118. package/dist/components/_util/vue/icon.js +29 -25
  119. package/dist/components/_util/vue/icon.js.map +1 -1
  120. package/dist/components/_util/vue/index.js +41 -41
  121. package/dist/components/_util/vue/install.js +35 -18
  122. package/dist/components/_util/vue/install.js.map +1 -1
  123. package/dist/components/_util/vue/props/index.js +6 -6
  124. package/dist/components/_util/vue/props/runtime.js +46 -30
  125. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  126. package/dist/components/_util/vue/refs.js +12 -6
  127. package/dist/components/_util/vue/refs.js.map +1 -1
  128. package/dist/components/_util/vue/size.js +5 -3
  129. package/dist/components/_util/vue/size.js.map +1 -1
  130. package/dist/components/_util/vue/validator.js +5 -4
  131. package/dist/components/_util/vue/validator.js.map +1 -1
  132. package/dist/components/_util/vue/vnode.js +100 -54
  133. package/dist/components/_util/vue/vnode.js.map +1 -1
  134. package/dist/components/_util/vue-types/index.js +231 -220
  135. package/dist/components/_util/vue-types/index.js.map +1 -1
  136. package/dist/components/components.js +20 -20
  137. package/dist/components/index.js +38 -35
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/components-B3d9m_tn.js +27 -0
  140. package/dist/components-B3d9m_tn.js.map +1 -0
  141. package/dist/error/OrionError.js +8 -4
  142. package/dist/error/OrionError.js.map +1 -1
  143. package/dist/functions-BeMkokbY.js +63 -0
  144. package/dist/functions-BeMkokbY.js.map +1 -0
  145. package/dist/index-BOKLZnqH.js +54 -0
  146. package/dist/index-BOKLZnqH.js.map +1 -0
  147. package/dist/index-D1m0KTpK.js +69 -0
  148. package/dist/index-D1m0KTpK.js.map +1 -0
  149. package/dist/index-DR5ZP7mD.js +160 -0
  150. package/dist/index-DR5ZP7mD.js.map +1 -0
  151. package/dist/index-DkwIULcN.js +200 -0
  152. package/dist/index-DkwIULcN.js.map +1 -0
  153. package/dist/index.css +797 -1
  154. package/dist/index.js +36 -36
  155. package/dist/print/LodopFuncs.js +101 -43
  156. package/dist/print/LodopFuncs.js.map +1 -1
  157. package/dist/print/index.js +200 -108
  158. package/dist/print/index.js.map +1 -1
  159. package/dist/request/ErrorHandlerChain.js +17 -14
  160. package/dist/request/ErrorHandlerChain.js.map +1 -1
  161. package/dist/request/RequestFilterChain.js +16 -13
  162. package/dist/request/RequestFilterChain.js.map +1 -1
  163. package/dist/request/ResponseParserChain.js +17 -14
  164. package/dist/request/ResponseParserChain.js.map +1 -1
  165. package/dist/request/disivion/DateSerializer.js +47 -22
  166. package/dist/request/disivion/DateSerializer.js.map +1 -1
  167. package/dist/request/disivion/DivisionErrorHandler.js +40 -25
  168. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  169. package/dist/request/disivion/DivisionResponseParser.js +16 -10
  170. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  171. package/dist/request/disivion/index.js +305 -201
  172. package/dist/request/disivion/index.js.map +1 -1
  173. package/dist/request/error/BizExceptionResponseError.js +11 -5
  174. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  175. package/dist/request/error/ExceptionResponseError.js +11 -5
  176. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  177. package/dist/request/error/ResponseError.js +9 -4
  178. package/dist/request/error/ResponseError.js.map +1 -1
  179. package/dist/request/error/SessionExceptionResponseError.js +11 -5
  180. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  181. package/dist/request/index.js +11 -11
  182. package/dist/utils/DateUtil.js +48 -33
  183. package/dist/utils/DateUtil.js.map +1 -1
  184. package/dist/utils/NumberUtil.js +6 -6
  185. package/dist/utils/NumberUtil.js.map +1 -1
  186. package/dist/utils/cloneDeep.js +2 -2
  187. package/dist/utils/delay.js +3 -3
  188. package/dist/utils/delay.js.map +1 -1
  189. package/dist/utils/functions.js +3 -3
  190. package/dist/utils/index.js +12 -12
  191. package/dist/utils/md5.js +191 -93
  192. package/dist/utils/md5.js.map +1 -1
  193. package/dist/utils/uuid.js +35 -25
  194. package/dist/utils/uuid.js.map +1 -1
  195. package/dist/version/index.js +2 -2
  196. package/dist/version/version.d.ts +1 -1
  197. package/dist/version/version.js +2 -2
  198. package/dist/version/version.js.map +1 -1
  199. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Form/Form.vue","../../../src/components/Form/StringInput/StringInput.vue","../../../src/components/Form/PasswordInput/PasswordInput.vue","../../../src/components/Form/Textarea/Textarea.vue","../../../src/components/Form/SingleSelect/SingleSelect.vue","../../../src/components/Form/MultiSelect/MultiSelect.vue","../../../src/components/Form/RadioGroup/RadioGroup.vue","../../../src/components/Form/CheckboxGroup/CheckboxGroup.vue","../../../src/components/Form/Checkbox/Checkbox.vue","../../../src/components/Form/Switch/Switch.vue","../../../src/components/Form/DateInput/DateInput.vue","../../../src/components/Form/FileInput/FileInput.vue","../../../src/components/Form/ButtonGroup/ButtonGroup.vue","../../../src/components/Form/DiyItem/DiyItem.vue","../../../src/components/Form/LovInput/LovInput.vue","../../../src/components/Form/NumberInput/NumberInput.vue","../../../src/components/Form/index.ts"],"sourcesContent":["<template>\r\n <el-form ref=\"form\" :model=\"modelValue\" :rules=\"rules\" :label-width=\"itemLabelWidth\" :disabled=\"disabled\">\r\n <el-row :gutter=\"16\">\r\n <slot></slot>\r\n </el-row>\r\n </el-form>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { provide, reactive, toRef, useTemplateRef } from 'vue'\r\nimport { ElForm, ElRow } from 'element-plus'\r\nimport { type FormProps, type FormExpose, formContextKey } from './Form'\r\nimport OrionError from '../../error/OrionError'\r\nimport { difference, isEmpty } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OForm', inheritAttrs: false })\r\n\r\nconst { rules, itemSpan = 6, itemLabelWidth = 'auto', disabled = false, modelValue } = defineProps<FormProps>()\r\n\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst updateModelValue = (name: string, value: any) => {\r\n if (!Object.keys(modelValue).includes(name)) {\r\n throw new OrionError(`modelValue中不存在[${name}]`)\r\n }\r\n emit('update:modelValue', { ...modelValue, [name]: value })\r\n}\r\n\r\nconst updateModelValueMulti = (data: Record<string, any>) => {\r\n const modelKeys = Object.keys(modelValue)\r\n const dataKeys = Object.keys(data)\r\n const diff = difference(dataKeys, modelKeys)\r\n if (!isEmpty(diff)) {\r\n throw new OrionError(`modelValue中不存在[${diff.join(',')}]`)\r\n }\r\n emit('update:modelValue', { ...modelValue, ...data })\r\n}\r\n\r\nconst formRef = useTemplateRef('form')\r\n\r\nconst validate: FormExpose['validate'] = async () => {\r\n return await formRef.value!.validate()\r\n}\r\n\r\ndefineExpose({\r\n validate,\r\n})\r\n\r\nprovide(\r\n formContextKey,\r\n reactive({\r\n modelValue: toRef(() => modelValue),\r\n updateModelValue,\r\n updateModelValueMulti,\r\n rules: toRef(() => rules),\r\n itemSpan: toRef(() => itemSpan),\r\n disabled: toRef(() => disabled),\r\n })\r\n)\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-model=\"elModel\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" :readonly=\"readonly\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { StringInputProps } from './StringInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormString', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly } = defineProps<StringInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-model=\"elModel\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" :readonly=\"readonly\" type=\"password\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { PasswordInputProps } from './PasswordInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormPassword', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly } = defineProps<PasswordInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input\r\n v-model=\"elModel\"\r\n :maxlength=\"maxlength\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n type=\"textarea\"\r\n :rows=\"rows\"\r\n :resize=\"'none'\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { TextareaProps } from './Textarea'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormTextarea', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly, rows } = defineProps<TextareaProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-if=\"normalizedDisabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select v-else v-model=\"elModel\" :placeholder=\"placeholder\" :clearable=\"clearable\" :filterable=\"filterable\" @change=\"attrs.onChange as any\">\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed, useAttrs } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport type { SingleSelectProps } from './SingleSelect'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemDisabled, useFormItemCode, useFormItemStringModel } from '../hooks'\r\nimport { getSingleCodeContent } from '../utils'\r\n\r\ndefineOptions({ name: 'OFormSingleselect', inheritAttrs: false })\r\nconst attrs = useAttrs()\r\n\r\nconst { name, label, labelWidth, required, placeholder, clearable, filterable } = defineProps<SingleSelectProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedDisabled = useFormItemDisabled()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemStringModel()\r\nconst content = computed(() => getSingleCodeContent(normalizedCode.value, elModel.value))\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-if=\"normalizedDisabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select\r\n v-else\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n multiple\r\n :collapse-tags=\"collapseTags\"\r\n :collapse-tags-tooltip=\"collapseTagsTooltip\"\r\n @change=\"attrs.onChange as any\"\r\n >\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed, useAttrs } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport type { MultiSelectProps } from './MultiSelect'\r\nimport { useFormContext, useFormItemSpan, useFormItemRules, useFormItemDisabled, useFormItemCode, useFormItemMultiModel } from '../hooks'\r\nimport { getMultiCodeContent } from '../utils'\r\n\r\ndefineOptions({ name: 'OFormMultiselect', inheritAttrs: false })\r\nconst attrs = useAttrs()\r\n\r\nconst { name, label, labelWidth, required, placeholder, collapseTags, collapseTagsTooltip } = defineProps<MultiSelectProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedDisabled = useFormItemDisabled()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemMultiModel()\r\nconst formContext = useFormContext()!\r\nconst content = computed(() => getMultiCodeContent(normalizedCode.value, formContext.modelValue[name]))\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-radio-group v-model=\"elModel\" :disabled=\"disabled\">\r\n <el-radio v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :value=\"codeItem.value\">\r\n {{ codeItem.content }}\r\n </el-radio>\r\n </el-radio-group>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElRadioGroup, ElRadio } from 'element-plus'\r\nimport type { RadioGroupProps } from './RadioGroup'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemCode, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormRadiogroup', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<RadioGroupProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-checkbox-group v-model=\"elModel\" :disabled=\"disabled\">\r\n <el-checkbox v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-checkbox-group>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElCheckboxGroup, ElCheckbox } from 'element-plus'\r\nimport type { CheckboxGroupProps } from './CheckboxGroup'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemCode, useFormItemMultiModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormCheckboxgroup', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<CheckboxGroupProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemMultiModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :rules=\"rules\">\r\n <el-checkbox v-model=\"elModel\" :disabled=\"disabled\"></el-checkbox>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElCheckbox } from 'element-plus'\r\nimport type { CheckboxProps } from './Checkbox'\r\nimport { useFormItemBooleanModel, useFormItemSpan } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormCheckbox', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, rules, disabled } = defineProps<CheckboxProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst elModel = useFormItemBooleanModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :rules=\"rules\">\r\n <el-switch v-model=\"elModel\" :disabled=\"disabled\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElSwitch } from 'element-plus'\r\nimport type { SwitchProps } from './Switch'\r\nimport { useFormItemBooleanModel, useFormItemSpan } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormSwitch', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, rules, disabled } = defineProps<SwitchProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst elModel = useFormItemBooleanModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-time-picker\r\n v-if=\"isTimePicker\"\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :editable=\"editable\"\r\n :clearable=\"clearable\"\r\n :format=\"normalizedSourceFormat\"\r\n arrow-control\r\n style=\"width: 100%\"\r\n />\r\n <el-date-picker\r\n v-else\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :editable=\"editable\"\r\n :clearable=\"clearable\"\r\n :type=\"dateType\"\r\n :format=\"normalizedSourceFormat\"\r\n style=\"width: 100%\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from 'vue'\r\nimport { ElCol, ElFormItem, ElDatePicker, ElTimePicker, dayjs } from 'element-plus'\r\nimport type { DateInputProps } from './DateInput'\r\nimport { useFormContext, useFormItemSpan, useFormItemRules } from '../hooks'\r\nimport { isDate, isString } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\ndefineOptions({ name: 'OFormDate', inheritAttrs: false })\r\n\r\nconst {\r\n name,\r\n label,\r\n labelWidth,\r\n required,\r\n placeholder,\r\n disabled,\r\n readonly,\r\n editable = true,\r\n clearable = true,\r\n format = 'YYYY-MM-DD',\r\n sourceFormat,\r\n} = defineProps<DateInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n\r\nconst isTimePicker = computed(() => format.startsWith('H') || format.startsWith('h') || format.startsWith('m') || format.startsWith('s'))\r\n\r\nconst normalizedSourceFormat = computed(() => {\r\n if (sourceFormat) {\r\n return sourceFormat\r\n }\r\n if (isTimePicker.value) {\r\n return 'HH:mm:ss'\r\n } else {\r\n return 'YYYY-MM-DD'\r\n }\r\n})\r\n\r\nconst dateType = computed(() => {\r\n let picker: 'date' | 'year' | 'month' | 'datetime' = 'date'\r\n\r\n // 配置年 yyyy指年 YYYY指周年,年末年初的值可能有所变化\r\n if (format.indexOf('y') > -1 || format.indexOf('Y') > -1) {\r\n picker = 'year'\r\n }\r\n\r\n // 配置月,M指月份,m指分钟\r\n if (format.indexOf('M') > -1) {\r\n picker = 'month'\r\n }\r\n\r\n // 配置日,d指星期,D指月的天,DDD指年的天\r\n if (format.indexOf('d') > -1 || format.indexOf('D') > -1) {\r\n picker = 'date'\r\n }\r\n\r\n // 配置小时,H指24小时制(0~23),k指24小时制(1~24),h指12小时制,m指分钟,s指秒,S指小数秒\r\n if (\r\n format.indexOf('H') > -1 ||\r\n format.indexOf('h') > -1 ||\r\n format.indexOf('k') > -1 ||\r\n format.indexOf('m') > -1 ||\r\n format.indexOf('s') > -1 ||\r\n format.indexOf('S') > -1\r\n ) {\r\n picker = 'datetime'\r\n }\r\n\r\n return picker\r\n})\r\n\r\nconst formContext = useFormContext()!\r\nconst elModel = computed<Date | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name]\r\n if (!value) {\r\n return undefined\r\n }\r\n if (isDate(value)) {\r\n return value as Date\r\n } else if (isString(value)) {\r\n const dayjsObj = dayjs(value, normalizedSourceFormat.value, true)\r\n if (!dayjsObj.isValid()) {\r\n throw new OrionError(`日期输入框的值无效,不符合${normalizedSourceFormat.value}格式`)\r\n }\r\n return dayjsObj.toDate()\r\n } else {\r\n throw new OrionError('日期输入框的值只能为字符串或日期类型')\r\n }\r\n },\r\n set: (newValue) => {\r\n if (sourceFormat) {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, '')\r\n } else {\r\n formContext.updateModelValue(name, dayjs(newValue).format(normalizedSourceFormat.value))\r\n }\r\n } else {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, undefined)\r\n } else {\r\n formContext.updateModelValue(name, newValue)\r\n }\r\n }\r\n },\r\n})\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input ref=\"inputRef\" v-model=\"file\" :disabled=\"disabled\" type=\"file\" :validate-event=\"false\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { onMounted, ref, useTemplateRef, watch } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { FileInputProps } from './FileInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormFile', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<FileInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\nwatch(elModel, () => {\r\n if (!elModel.value) {\r\n file.value = ''\r\n }\r\n})\r\n\r\nconst file = ref('')\r\nconst fileRef = useTemplateRef('inputRef')\r\nonMounted(() => {\r\n fileRef.value!.input!.onchange = (event) => {\r\n //@ts-ignore\r\n elModel.value = event?.target?.files[0]\r\n }\r\n file.value = ''\r\n})\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\" :style=\"style\">\r\n <space :gutter=\"gutter\" style=\"margin-bottom: 18px\"> <slot></slot> </space>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol } from 'element-plus'\r\nimport type { ButtonGroupProps } from './ButtonGroup'\r\nimport Space from '../../Space'\r\nimport { useFormItemSpan } from '../hooks'\r\nimport { computed, CSSProperties } from 'vue'\r\n\r\ndefineOptions({ name: 'OFormButtongroup', inheritAttrs: false })\r\n\r\nconst { gutter, align = 'right' } = defineProps<ButtonGroupProps>()\r\nconst style = computed<CSSProperties>(() => {\r\n return {\r\n textAlign: align,\r\n }\r\n})\r\n\r\nconst normalizedSpan = useFormItemSpan()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <slot></slot>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem } from 'element-plus'\r\nimport type { DiyItemProps } from './DiyItem'\r\nimport { useFormItemSpan, useFormItemRules } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormDiy', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required } = defineProps<DiyItemProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-dropdown ref=\"dropdown\" :trigger=\"'click'\" @visible-change=\"onVisibleChange\" style=\"width: 100%\">\r\n <el-input\r\n v-model=\"elModel\"\r\n :maxlength=\"maxlength\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n @input=\"onInput\"\r\n @keydown=\"onKeydown\"\r\n @change=\"onChange\"\r\n :suffix-icon=\"Search\"\r\n />\r\n <template #dropdown> <slot></slot> </template>\r\n </el-dropdown>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput, ElDropdown } from 'element-plus'\r\nimport { Search } from '@element-plus/icons-vue'\r\nimport { KeydownHandler, LovContext, lovContextKey, type LovInputProps } from './LovInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel, useFormContext } from '../hooks'\r\nimport { provide, reactive, ref, useTemplateRef } from 'vue'\r\nimport { isString } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OFormLov', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly, fillMapping } = defineProps<LovInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\nconst formContext = useFormContext()!\r\n\r\nconst visible = ref(false)\r\nconst onVisibleChange = (val: boolean) => {\r\n visible.value = val\r\n}\r\n\r\nconst changed = ref(false)\r\nconst onInput = () => {\r\n if (!changed.value) {\r\n changed.value = true\r\n }\r\n\r\n if (!visible.value) {\r\n dropdownRef.value?.handleOpen()\r\n }\r\n}\r\n\r\nlet keydownHandler: KeydownHandler | undefined\r\nconst registerKeydownHandler: LovContext['registerKeydownHandler'] = (handler) => {\r\n keydownHandler = handler\r\n}\r\n\r\nconst onKeydown = (e: any) => {\r\n const fallthroughCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter', 'Space']\r\n\r\n if (fallthroughCodes.indexOf(e.code) > -1) {\r\n if (visible.value) {\r\n keydownHandler && keydownHandler(e.code)\r\n }\r\n e.stopPropagation()\r\n }\r\n\r\n const triggerCodes = ['ArrowUp', 'ArrowDown']\r\n if (triggerCodes.indexOf(e.code) > -1 && !visible.value) {\r\n dropdownRef.value?.handleOpen()\r\n }\r\n}\r\n\r\nconst onChange = () => {\r\n if (!changed.value) {\r\n return\r\n }\r\n\r\n if (isString(fillMapping)) {\r\n const data: Record<string, any> = {}\r\n\r\n const pairs = fillMapping.split(',')\r\n for (let i = 0; i < pairs.length; i++) {\r\n const dstName = pairs[i].split(':')[0].trim()\r\n data[dstName] = undefined\r\n }\r\n\r\n formContext.updateModelValueMulti(data)\r\n }\r\n}\r\n\r\nconst dropdownRef = useTemplateRef('dropdown')\r\nconst backfill: LovContext['backfill'] = (params) => {\r\n dropdownRef.value?.handleClose()\r\n\r\n if (isString(fillMapping)) {\r\n const data: Record<string, any> = {}\r\n\r\n const pairs = fillMapping.split(',')\r\n for (let i = 0; i < pairs.length; i++) {\r\n const dstName = pairs[i].split(':')[0].trim()\r\n const srcName = pairs[i].split(':')[1].trim()\r\n const srcValue = params[srcName]\r\n data[dstName] = srcValue\r\n }\r\n\r\n formContext.updateModelValueMulti(data)\r\n } else {\r\n fillMapping && fillMapping(params)\r\n }\r\n\r\n if (changed.value) {\r\n changed.value = false\r\n }\r\n}\r\n\r\nprovide(\r\n lovContextKey,\r\n reactive({\r\n lovValue: elModel,\r\n backfill,\r\n registerKeydownHandler,\r\n })\r\n)\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input-number\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :min=\"min\"\r\n :max=\"max\"\r\n :step=\"step\"\r\n :step-strictly=\"stepStrictly\"\r\n :precision=\"precision\"\r\n :controls=\"controls\"\r\n :controls-position=\"controlsPosition\"\r\n style=\"width: 100%\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInputNumber } from 'element-plus'\r\nimport type { NumberInputProps } from './NumberInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormContext } from '../hooks'\r\nimport { computed } from 'vue'\r\nimport { isNumber, isString, toNumber } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\ndefineOptions({ name: 'OFormNumber', inheritAttrs: false })\r\n\r\nconst {\r\n name,\r\n label,\r\n labelWidth,\r\n required,\r\n placeholder,\r\n disabled,\r\n readonly,\r\n min,\r\n max,\r\n step,\r\n stepStrictly,\r\n precision,\r\n controls = true,\r\n controlsPosition,\r\n} = defineProps<NumberInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n\r\nconst formContext = useFormContext()!\r\nconst elModel = computed<number | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name]\r\n if (!value) {\r\n return undefined\r\n }\r\n if (isNumber(value)) {\r\n return value\r\n } else if (isString(value)) {\r\n return toNumber(value)\r\n } else {\r\n throw new OrionError('数字输入框的值只能为字符串或数字类型')\r\n }\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, undefined)\r\n } else {\r\n formContext.updateModelValue(name, newValue)\r\n }\r\n },\r\n})\r\n</script>\r\n","import { withInstall } from '../_util'\r\n\r\nimport Form from './Form.vue'\r\nimport StringInput from './StringInput/StringInput.vue'\r\nimport PasswordInput from './PasswordInput/PasswordInput.vue'\r\nimport Textarea from './Textarea/Textarea.vue'\r\nimport SingleSelect from './SingleSelect/SingleSelect.vue'\r\nimport MultiSelect from './MultiSelect/MultiSelect.vue'\r\nimport RadioGroup from './RadioGroup/RadioGroup.vue'\r\nimport CheckboxGroup from './CheckboxGroup/CheckboxGroup.vue'\r\nimport Checkbox from './Checkbox/Checkbox.vue'\r\nimport Switch from './Switch/Switch.vue'\r\nimport DateInput from './DateInput/DateInput.vue'\r\nimport FileInput from './FileInput/FileInput.vue'\r\nimport ButtonGroup from './ButtonGroup/ButtonGroup.vue'\r\nimport DiyItem from './DiyItem/DiyItem.vue'\r\nimport LovInput from './LovInput/LovInput.vue'\r\nimport NumberInput from './NumberInput/NumberInput.vue'\r\n\r\nexport default withInstall<\r\n typeof Form,\r\n {\r\n StringInput: typeof StringInput\r\n PasswordInput: typeof PasswordInput\r\n Textarea: typeof Textarea\r\n SingleSelect: typeof SingleSelect\r\n MultiSelect: typeof MultiSelect\r\n RadioGroup: typeof RadioGroup\r\n CheckboxGroup: typeof CheckboxGroup\r\n Checkbox: typeof Checkbox\r\n Switch: typeof Switch\r\n DateInput: typeof DateInput\r\n FileInput: typeof FileInput\r\n ButtonGroup: typeof ButtonGroup\r\n DiyItem: typeof DiyItem\r\n LovInput: typeof LovInput\r\n NumberInput: typeof NumberInput\r\n }\r\n>(Form, {\r\n StringInput,\r\n PasswordInput,\r\n Textarea,\r\n SingleSelect,\r\n MultiSelect,\r\n RadioGroup,\r\n CheckboxGroup,\r\n Checkbox,\r\n Switch,\r\n DateInput,\r\n FileInput,\r\n ButtonGroup,\r\n DiyItem,\r\n LovInput,\r\n NumberInput,\r\n})\r\n\r\nexport * from './Form'\r\nexport * from './StringInput'\r\nexport * from './PasswordInput'\r\nexport * from './Textarea'\r\nexport * from './SingleSelect'\r\nexport * from './MultiSelect'\r\nexport * from './RadioGroup'\r\nexport * from './CheckboxGroup'\r\nexport * from './Checkbox'\r\nexport * from './Switch'\r\nexport * from './DateInput'\r\nexport * from './FileInput'\r\nexport * from './ButtonGroup'\r\nexport * from './DiyItem'\r\nexport * from './LovInput'\r\nexport * from './NumberInput'\r\n"],"names":["emit","__emit","updateModelValue","name","value","__props","OrionError","updateModelValueMulti","data","modelKeys","dataKeys","diff","difference","isEmpty","formRef","useTemplateRef","__expose","provide","formContextKey","reactive","toRef","normalizedSpan","useFormItemSpan","normalizedRules","useFormItemRules","elModel","useFormItemStringModel","attrs","useAttrs","normalizedDisabled","useFormItemDisabled","normalizedCode","useFormItemCode","content","computed","getSingleCodeContent","useFormItemMultiModel","formContext","useFormContext","getMultiCodeContent","useFormItemBooleanModel","isTimePicker","normalizedSourceFormat","dateType","picker","isDate","isString","dayjsObj","dayjs","newValue","watch","file","ref","fileRef","onMounted","event","_a","style","visible","onVisibleChange","val","changed","onInput","dropdownRef","keydownHandler","registerKeydownHandler","handler","onKeydown","e","onChange","pairs","i","dstName","lovContextKey","params","srcName","srcValue","isNumber","toNumber","index","withInstall","Form","StringInput","PasswordInput","Textarea","SingleSelect","MultiSelect","RadioGroup","CheckboxGroup","Checkbox","Switch","DateInput","FileInput","ButtonGroup","DiyItem","LovInput","NumberInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,UAAMA,IAAOC,GAEPC,IAAmB,CAACC,GAAcC,MAAe;AACjD,UAAA,CAAC,OAAO,KAAKC,EAAA,UAAU,EAAE,SAASF,CAAI;AACxC,cAAM,IAAIG,EAAW,kBAAkBH,CAAI,GAAG;AAE3C,MAAAH,EAAA,qBAAqB,EAAE,GAAGK,cAAY,CAACF,CAAI,GAAGC,EAAA,CAAO;AAAA,IAAA,GAGtDG,IAAwB,CAACC,MAA8B;AAC3D,YAAMC,IAAY,OAAO,KAAKJ,EAAA,UAAU,GAClCK,IAAW,OAAO,KAAKF,CAAI,GAC3BG,IAAOC,GAAWF,GAAUD,CAAS;AACvC,UAAA,CAACI,GAAQF,CAAI;AACf,cAAM,IAAIL,EAAW,kBAAkBK,EAAK,KAAK,GAAG,CAAC,GAAG;AAE1D,MAAAX,EAAK,qBAAqB,EAAE,GAAGK,EAAU,YAAE,GAAGG,GAAM;AAAA,IAAA,GAGhDM,IAAUC,EAAe,MAAM;AAMxB,WAAAC,EAAA;AAAA,MACX,UALuC,YAChC,MAAMF,EAAQ,MAAO;IAI5B,CACD,GAEDG;AAAA,MACEC;AAAA,MACAC,EAAS;AAAA,QACP,YAAYC,EAAM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,EAAI,MAAE,MAAS;AAAA,MAIhD;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICrDc0E,KAAAC,GAmBbC,IAAM;AAAA,EAAA,aACNC;AAAAA,EAAA,eACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,aACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,eACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,QACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,aACAC;AAAAA,EAAA,SACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,aACAC;AACF,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Form/Form.vue","../../../src/components/Form/StringInput/StringInput.vue","../../../src/components/Form/PasswordInput/PasswordInput.vue","../../../src/components/Form/Textarea/Textarea.vue","../../../src/components/Form/SingleSelect/SingleSelect.vue","../../../src/components/Form/MultiSelect/MultiSelect.vue","../../../src/components/Form/RadioGroup/RadioGroup.vue","../../../src/components/Form/CheckboxGroup/CheckboxGroup.vue","../../../src/components/Form/Checkbox/Checkbox.vue","../../../src/components/Form/Switch/Switch.vue","../../../src/components/Form/DateInput/DateInput.vue","../../../src/components/Form/FileInput/FileInput.vue","../../../src/components/Form/ButtonGroup/ButtonGroup.vue","../../../src/components/Form/DiyItem/DiyItem.vue","../../../src/components/Form/LovInput/LovInput.vue","../../../src/components/Form/NumberInput/NumberInput.vue","../../../src/components/Form/index.ts"],"sourcesContent":["<template>\r\n <el-form ref=\"form\" :model=\"modelValue\" :rules=\"rules\" :label-width=\"itemLabelWidth\" :disabled=\"disabled\">\r\n <el-row :gutter=\"16\">\r\n <slot></slot>\r\n </el-row>\r\n </el-form>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { provide, reactive, toRef, useTemplateRef } from 'vue'\r\nimport { ElForm, ElRow } from 'element-plus'\r\nimport { type FormProps, type FormExpose, formContextKey } from './Form'\r\nimport OrionError from '../../error/OrionError'\r\nimport { difference, isEmpty } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OForm', inheritAttrs: false })\r\n\r\nconst { rules, itemSpan = 6, itemLabelWidth = 'auto', disabled = false, modelValue } = defineProps<FormProps>()\r\n\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst updateModelValue = (name: string, value: any) => {\r\n if (!Object.keys(modelValue).includes(name)) {\r\n throw new OrionError(`modelValue中不存在[${name}]`)\r\n }\r\n emit('update:modelValue', { ...modelValue, [name]: value })\r\n}\r\n\r\nconst updateModelValueMulti = (data: Record<string, any>) => {\r\n const modelKeys = Object.keys(modelValue)\r\n const dataKeys = Object.keys(data)\r\n const diff = difference(dataKeys, modelKeys)\r\n if (!isEmpty(diff)) {\r\n throw new OrionError(`modelValue中不存在[${diff.join(',')}]`)\r\n }\r\n emit('update:modelValue', { ...modelValue, ...data })\r\n}\r\n\r\nconst formRef = useTemplateRef('form')\r\n\r\nconst validate: FormExpose['validate'] = async () => {\r\n return await formRef.value!.validate()\r\n}\r\n\r\ndefineExpose({\r\n validate,\r\n})\r\n\r\nprovide(\r\n formContextKey,\r\n reactive({\r\n modelValue: toRef(() => modelValue),\r\n updateModelValue,\r\n updateModelValueMulti,\r\n rules: toRef(() => rules),\r\n itemSpan: toRef(() => itemSpan),\r\n disabled: toRef(() => disabled),\r\n })\r\n)\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-model=\"elModel\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" :readonly=\"readonly\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { StringInputProps } from './StringInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormString', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly } = defineProps<StringInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-model=\"elModel\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" :readonly=\"readonly\" type=\"password\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { PasswordInputProps } from './PasswordInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormPassword', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly } = defineProps<PasswordInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input\r\n v-model=\"elModel\"\r\n :maxlength=\"maxlength\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n type=\"textarea\"\r\n :rows=\"rows\"\r\n :resize=\"'none'\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { TextareaProps } from './Textarea'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormTextarea', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly, rows } = defineProps<TextareaProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-if=\"normalizedDisabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select v-else v-model=\"elModel\" :placeholder=\"placeholder\" :clearable=\"clearable\" :filterable=\"filterable\" @change=\"attrs.onChange as any\">\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed, useAttrs } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport type { SingleSelectProps } from './SingleSelect'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemDisabled, useFormItemCode, useFormItemStringModel } from '../hooks'\r\nimport { getSingleCodeContent } from '../utils'\r\n\r\ndefineOptions({ name: 'OFormSingleselect', inheritAttrs: false })\r\nconst attrs = useAttrs()\r\n\r\nconst { name, label, labelWidth, required, placeholder, clearable, filterable } = defineProps<SingleSelectProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedDisabled = useFormItemDisabled()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemStringModel()\r\nconst content = computed(() => getSingleCodeContent(normalizedCode.value, elModel.value))\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input v-if=\"normalizedDisabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select\r\n v-else\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n multiple\r\n :collapse-tags=\"collapseTags\"\r\n :collapse-tags-tooltip=\"collapseTagsTooltip\"\r\n @change=\"attrs.onChange as any\"\r\n >\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed, useAttrs } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport type { MultiSelectProps } from './MultiSelect'\r\nimport { useFormContext, useFormItemSpan, useFormItemRules, useFormItemDisabled, useFormItemCode, useFormItemMultiModel } from '../hooks'\r\nimport { getMultiCodeContent } from '../utils'\r\n\r\ndefineOptions({ name: 'OFormMultiselect', inheritAttrs: false })\r\nconst attrs = useAttrs()\r\n\r\nconst { name, label, labelWidth, required, placeholder, collapseTags, collapseTagsTooltip } = defineProps<MultiSelectProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedDisabled = useFormItemDisabled()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemMultiModel()\r\nconst formContext = useFormContext()!\r\nconst content = computed(() => getMultiCodeContent(normalizedCode.value, formContext.modelValue[name]))\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-radio-group v-model=\"elModel\" :disabled=\"disabled\">\r\n <el-radio v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :value=\"codeItem.value\">\r\n {{ codeItem.content }}\r\n </el-radio>\r\n </el-radio-group>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElRadioGroup, ElRadio } from 'element-plus'\r\nimport type { RadioGroupProps } from './RadioGroup'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemCode, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormRadiogroup', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<RadioGroupProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemStringModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-checkbox-group v-model=\"elModel\" :disabled=\"disabled\">\r\n <el-checkbox v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\" :value=\"codeItem.value\" />\r\n </el-checkbox-group>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElCheckboxGroup, ElCheckbox } from 'element-plus'\r\nimport type { CheckboxGroupProps } from './CheckboxGroup'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemCode, useFormItemMultiModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormCheckboxgroup', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<CheckboxGroupProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst normalizedCode = useFormItemCode()\r\nconst elModel = useFormItemMultiModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :rules=\"rules\">\r\n <el-checkbox v-model=\"elModel\" :disabled=\"disabled\"></el-checkbox>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElCheckbox } from 'element-plus'\r\nimport type { CheckboxProps } from './Checkbox'\r\nimport { useFormItemBooleanModel, useFormItemSpan } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormCheckbox', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, rules, disabled } = defineProps<CheckboxProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst elModel = useFormItemBooleanModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :rules=\"rules\">\r\n <el-switch v-model=\"elModel\" :disabled=\"disabled\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElSwitch } from 'element-plus'\r\nimport type { SwitchProps } from './Switch'\r\nimport { useFormItemBooleanModel, useFormItemSpan } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormSwitch', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, rules, disabled } = defineProps<SwitchProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst elModel = useFormItemBooleanModel()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-time-picker\r\n v-if=\"isTimePicker\"\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :editable=\"editable\"\r\n :clearable=\"clearable\"\r\n :format=\"normalizedSourceFormat\"\r\n arrow-control\r\n style=\"width: 100%\"\r\n />\r\n <el-date-picker\r\n v-else\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :editable=\"editable\"\r\n :clearable=\"clearable\"\r\n :type=\"dateType\"\r\n :format=\"normalizedSourceFormat\"\r\n style=\"width: 100%\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { computed } from 'vue'\r\nimport { ElCol, ElFormItem, ElDatePicker, ElTimePicker, dayjs } from 'element-plus'\r\nimport type { DateInputProps } from './DateInput'\r\nimport { useFormContext, useFormItemSpan, useFormItemRules } from '../hooks'\r\nimport { isDate, isString } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\ndefineOptions({ name: 'OFormDate', inheritAttrs: false })\r\n\r\nconst {\r\n name,\r\n label,\r\n labelWidth,\r\n required,\r\n placeholder,\r\n disabled,\r\n readonly,\r\n editable = true,\r\n clearable = true,\r\n format = 'YYYY-MM-DD',\r\n sourceFormat,\r\n} = defineProps<DateInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n\r\nconst isTimePicker = computed(() => format.startsWith('H') || format.startsWith('h') || format.startsWith('m') || format.startsWith('s'))\r\n\r\nconst normalizedSourceFormat = computed(() => {\r\n if (sourceFormat) {\r\n return sourceFormat\r\n }\r\n if (isTimePicker.value) {\r\n return 'HH:mm:ss'\r\n } else {\r\n return 'YYYY-MM-DD'\r\n }\r\n})\r\n\r\nconst dateType = computed(() => {\r\n let picker: 'date' | 'year' | 'month' | 'datetime' = 'date'\r\n\r\n // 配置年 yyyy指年 YYYY指周年,年末年初的值可能有所变化\r\n if (format.indexOf('y') > -1 || format.indexOf('Y') > -1) {\r\n picker = 'year'\r\n }\r\n\r\n // 配置月,M指月份,m指分钟\r\n if (format.indexOf('M') > -1) {\r\n picker = 'month'\r\n }\r\n\r\n // 配置日,d指星期,D指月的天,DDD指年的天\r\n if (format.indexOf('d') > -1 || format.indexOf('D') > -1) {\r\n picker = 'date'\r\n }\r\n\r\n // 配置小时,H指24小时制(0~23),k指24小时制(1~24),h指12小时制,m指分钟,s指秒,S指小数秒\r\n if (\r\n format.indexOf('H') > -1 ||\r\n format.indexOf('h') > -1 ||\r\n format.indexOf('k') > -1 ||\r\n format.indexOf('m') > -1 ||\r\n format.indexOf('s') > -1 ||\r\n format.indexOf('S') > -1\r\n ) {\r\n picker = 'datetime'\r\n }\r\n\r\n return picker\r\n})\r\n\r\nconst formContext = useFormContext()!\r\nconst elModel = computed<Date | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name]\r\n if (!value) {\r\n return undefined\r\n }\r\n if (isDate(value)) {\r\n return value as Date\r\n } else if (isString(value)) {\r\n const dayjsObj = dayjs(value, normalizedSourceFormat.value, true)\r\n if (!dayjsObj.isValid()) {\r\n throw new OrionError(`日期输入框的值无效,不符合${normalizedSourceFormat.value}格式`)\r\n }\r\n return dayjsObj.toDate()\r\n } else {\r\n throw new OrionError('日期输入框的值只能为字符串或日期类型')\r\n }\r\n },\r\n set: (newValue) => {\r\n if (sourceFormat) {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, '')\r\n } else {\r\n formContext.updateModelValue(name, dayjs(newValue).format(normalizedSourceFormat.value))\r\n }\r\n } else {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, undefined)\r\n } else {\r\n formContext.updateModelValue(name, newValue)\r\n }\r\n }\r\n },\r\n})\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input ref=\"inputRef\" v-model=\"file\" :disabled=\"disabled\" type=\"file\" :validate-event=\"false\" />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { onMounted, ref, useTemplateRef, watch } from 'vue'\r\nimport { ElCol, ElFormItem, ElInput } from 'element-plus'\r\nimport type { FileInputProps } from './FileInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormFile', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, disabled } = defineProps<FileInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\nwatch(elModel, () => {\r\n if (!elModel.value) {\r\n file.value = ''\r\n }\r\n})\r\n\r\nconst file = ref('')\r\nconst fileRef = useTemplateRef('inputRef')\r\nonMounted(() => {\r\n fileRef.value!.input!.onchange = (event) => {\r\n //@ts-ignore\r\n elModel.value = event?.target?.files[0]\r\n }\r\n file.value = ''\r\n})\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\" :style=\"style\">\r\n <space :gutter=\"gutter\" style=\"margin-bottom: 18px\"> <slot></slot> </space>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol } from 'element-plus'\r\nimport type { ButtonGroupProps } from './ButtonGroup'\r\nimport Space from '../../Space'\r\nimport { useFormItemSpan } from '../hooks'\r\nimport { computed, CSSProperties } from 'vue'\r\n\r\ndefineOptions({ name: 'OFormButtongroup', inheritAttrs: false })\r\n\r\nconst { gutter, align = 'right' } = defineProps<ButtonGroupProps>()\r\nconst style = computed<CSSProperties>(() => {\r\n return {\r\n textAlign: align,\r\n }\r\n})\r\n\r\nconst normalizedSpan = useFormItemSpan()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <slot></slot>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem } from 'element-plus'\r\nimport type { DiyItemProps } from './DiyItem'\r\nimport { useFormItemSpan, useFormItemRules } from '../hooks'\r\n\r\ndefineOptions({ name: 'OFormDiy', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required } = defineProps<DiyItemProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-dropdown ref=\"dropdown\" :trigger=\"'click'\" @visible-change=\"onVisibleChange\" style=\"width: 100%\">\r\n <el-input\r\n v-model=\"elModel\"\r\n :maxlength=\"maxlength\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n @input=\"onInput\"\r\n @keydown=\"onKeydown\"\r\n @change=\"onChange\"\r\n :suffix-icon=\"Search\"\r\n />\r\n <template #dropdown> <slot></slot> </template>\r\n </el-dropdown>\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInput, ElDropdown } from 'element-plus'\r\nimport { Search } from '@element-plus/icons-vue'\r\nimport { KeydownHandler, LovContext, lovContextKey, type LovInputProps } from './LovInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormItemStringModel, useFormContext } from '../hooks'\r\nimport { provide, reactive, ref, useTemplateRef } from 'vue'\r\nimport { isString } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'OFormLov', inheritAttrs: false })\r\n\r\nconst { name, label, labelWidth, required, maxlength, placeholder, disabled, readonly, fillMapping } = defineProps<LovInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\nconst elModel = useFormItemStringModel()\r\nconst formContext = useFormContext()!\r\n\r\nconst visible = ref(false)\r\nconst onVisibleChange = (val: boolean) => {\r\n visible.value = val\r\n}\r\n\r\nconst changed = ref(false)\r\nconst onInput = () => {\r\n if (!changed.value) {\r\n changed.value = true\r\n }\r\n\r\n if (!visible.value) {\r\n dropdownRef.value?.handleOpen()\r\n }\r\n}\r\n\r\nlet keydownHandler: KeydownHandler | undefined\r\nconst registerKeydownHandler: LovContext['registerKeydownHandler'] = (handler) => {\r\n keydownHandler = handler\r\n}\r\n\r\nconst onKeydown = (e: any) => {\r\n const fallthroughCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter', 'Space']\r\n\r\n if (fallthroughCodes.indexOf(e.code) > -1) {\r\n if (visible.value) {\r\n keydownHandler && keydownHandler(e.code)\r\n }\r\n e.stopPropagation()\r\n }\r\n\r\n const triggerCodes = ['ArrowUp', 'ArrowDown']\r\n if (triggerCodes.indexOf(e.code) > -1 && !visible.value) {\r\n dropdownRef.value?.handleOpen()\r\n }\r\n}\r\n\r\nconst onChange = () => {\r\n if (!changed.value) {\r\n return\r\n }\r\n\r\n if (isString(fillMapping)) {\r\n const data: Record<string, any> = {}\r\n\r\n const pairs = fillMapping.split(',')\r\n for (let i = 0; i < pairs.length; i++) {\r\n const dstName = pairs[i].split(':')[0].trim()\r\n data[dstName] = undefined\r\n }\r\n\r\n formContext.updateModelValueMulti(data)\r\n }\r\n}\r\n\r\nconst dropdownRef = useTemplateRef('dropdown')\r\nconst backfill: LovContext['backfill'] = (params) => {\r\n dropdownRef.value?.handleClose()\r\n\r\n if (isString(fillMapping)) {\r\n const data: Record<string, any> = {}\r\n\r\n const pairs = fillMapping.split(',')\r\n for (let i = 0; i < pairs.length; i++) {\r\n const dstName = pairs[i].split(':')[0].trim()\r\n const srcName = pairs[i].split(':')[1].trim()\r\n const srcValue = params[srcName]\r\n data[dstName] = srcValue\r\n }\r\n\r\n formContext.updateModelValueMulti(data)\r\n } else {\r\n fillMapping && fillMapping(params)\r\n }\r\n\r\n if (changed.value) {\r\n changed.value = false\r\n }\r\n}\r\n\r\nprovide(\r\n lovContextKey,\r\n reactive({\r\n lovValue: elModel,\r\n backfill,\r\n registerKeydownHandler,\r\n })\r\n)\r\n</script>\r\n","<template>\r\n <el-col :span=\"normalizedSpan\">\r\n <el-form-item :prop=\"name\" :label=\"label\" :label-width=\"labelWidth\" :required=\"required\" :rules=\"normalizedRules\">\r\n <el-input-number\r\n v-model=\"elModel\"\r\n :placeholder=\"placeholder\"\r\n :disabled=\"disabled\"\r\n :readonly=\"readonly\"\r\n :min=\"min\"\r\n :max=\"max\"\r\n :step=\"step\"\r\n :step-strictly=\"stepStrictly\"\r\n :precision=\"precision\"\r\n :controls=\"controls\"\r\n :controls-position=\"controlsPosition\"\r\n style=\"width: 100%\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { ElCol, ElFormItem, ElInputNumber } from 'element-plus'\r\nimport type { NumberInputProps } from './NumberInput'\r\nimport { useFormItemSpan, useFormItemRules, useFormContext } from '../hooks'\r\nimport { computed } from 'vue'\r\nimport { isNumber, isString, toNumber } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\ndefineOptions({ name: 'OFormNumber', inheritAttrs: false })\r\n\r\nconst {\r\n name,\r\n label,\r\n labelWidth,\r\n required,\r\n placeholder,\r\n disabled,\r\n readonly,\r\n min,\r\n max,\r\n step,\r\n stepStrictly,\r\n precision,\r\n controls = true,\r\n controlsPosition,\r\n} = defineProps<NumberInputProps>()\r\nconst normalizedSpan = useFormItemSpan()\r\nconst normalizedRules = useFormItemRules()\r\n\r\nconst formContext = useFormContext()!\r\nconst elModel = computed<number | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name]\r\n if (!value) {\r\n return undefined\r\n }\r\n if (isNumber(value)) {\r\n return value\r\n } else if (isString(value)) {\r\n return toNumber(value)\r\n } else {\r\n throw new OrionError('数字输入框的值只能为字符串或数字类型')\r\n }\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name, undefined)\r\n } else {\r\n formContext.updateModelValue(name, newValue)\r\n }\r\n },\r\n})\r\n</script>\r\n","import { withInstall } from '../_util'\r\n\r\nimport Form from './Form.vue'\r\nimport StringInput from './StringInput/StringInput.vue'\r\nimport PasswordInput from './PasswordInput/PasswordInput.vue'\r\nimport Textarea from './Textarea/Textarea.vue'\r\nimport SingleSelect from './SingleSelect/SingleSelect.vue'\r\nimport MultiSelect from './MultiSelect/MultiSelect.vue'\r\nimport RadioGroup from './RadioGroup/RadioGroup.vue'\r\nimport CheckboxGroup from './CheckboxGroup/CheckboxGroup.vue'\r\nimport Checkbox from './Checkbox/Checkbox.vue'\r\nimport Switch from './Switch/Switch.vue'\r\nimport DateInput from './DateInput/DateInput.vue'\r\nimport FileInput from './FileInput/FileInput.vue'\r\nimport ButtonGroup from './ButtonGroup/ButtonGroup.vue'\r\nimport DiyItem from './DiyItem/DiyItem.vue'\r\nimport LovInput from './LovInput/LovInput.vue'\r\nimport NumberInput from './NumberInput/NumberInput.vue'\r\n\r\nexport default withInstall<\r\n typeof Form,\r\n {\r\n StringInput: typeof StringInput\r\n PasswordInput: typeof PasswordInput\r\n Textarea: typeof Textarea\r\n SingleSelect: typeof SingleSelect\r\n MultiSelect: typeof MultiSelect\r\n RadioGroup: typeof RadioGroup\r\n CheckboxGroup: typeof CheckboxGroup\r\n Checkbox: typeof Checkbox\r\n Switch: typeof Switch\r\n DateInput: typeof DateInput\r\n FileInput: typeof FileInput\r\n ButtonGroup: typeof ButtonGroup\r\n DiyItem: typeof DiyItem\r\n LovInput: typeof LovInput\r\n NumberInput: typeof NumberInput\r\n }\r\n>(Form, {\r\n StringInput,\r\n PasswordInput,\r\n Textarea,\r\n SingleSelect,\r\n MultiSelect,\r\n RadioGroup,\r\n CheckboxGroup,\r\n Checkbox,\r\n Switch,\r\n DateInput,\r\n FileInput,\r\n ButtonGroup,\r\n DiyItem,\r\n LovInput,\r\n NumberInput,\r\n})\r\n\r\nexport * from './Form'\r\nexport * from './StringInput'\r\nexport * from './PasswordInput'\r\nexport * from './Textarea'\r\nexport * from './SingleSelect'\r\nexport * from './MultiSelect'\r\nexport * from './RadioGroup'\r\nexport * from './CheckboxGroup'\r\nexport * from './Checkbox'\r\nexport * from './Switch'\r\nexport * from './DateInput'\r\nexport * from './FileInput'\r\nexport * from './ButtonGroup'\r\nexport * from './DiyItem'\r\nexport * from './LovInput'\r\nexport * from './NumberInput'\r\n"],"names":["Form","StringInput","PasswordInput","Textarea","SingleSelect","MultiSelect","RadioGroup","CheckboxGroup","Checkbox","Switch","DateInput","FileInput","ButtonGroup","DiyItem","LovInput","NumberInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA,UAAM,OAAO;AAEP,UAAA,mBAAmB,CAAC,MAAc,UAAe;AACjD,UAAA,CAAC,OAAO,KAAK,QAAA,UAAU,EAAE,SAAS,IAAI,GAAG;AAC3C,cAAM,IAAI,WAAW,kBAAkB,IAAI,GAAG;AAAA,MAChD;AACK,WAAA,qBAAqB,EAAE,GAAG,oBAAY,CAAC,IAAI,GAAG,MAAA,CAAO;AAAA,IAAA;AAGtD,UAAA,wBAAwB,CAAC,SAA8B;AAC3D,YAAM,YAAY,OAAO,KAAK,QAAA,UAAU;AAClC,YAAA,WAAW,OAAO,KAAK,IAAI;AAC3B,YAAA,OAAO,WAAW,UAAU,SAAS;AACvC,UAAA,CAAC,QAAQ,IAAI,GAAG;AAClB,cAAM,IAAI,WAAW,kBAAkB,KAAK,KAAK,GAAG,CAAC,GAAG;AAAA,MAC1D;AACA,WAAK,qBAAqB,EAAE,GAAG,QAAU,YAAE,GAAG,MAAM;AAAA,IAAA;AAGhD,UAAA,UAAU,eAAe,MAAM;AAErC,UAAM,WAAmC,YAAY;AAC5C,aAAA,MAAM,QAAQ,MAAO;IAAS;AAG1B,aAAA;AAAA,MACX;AAAA,IAAA,CACD;AAED;AAAA,MACE;AAAA,MACA,SAAS;AAAA,QACP,YAAY,MAAM,MAAM,QAAU,UAAA;AAAA,QAClC;AAAA,QACA;AAAA,QACA,OAAO,MAAM,MAAM,QAAA,KAAK;AAAA,QACxB,UAAU,MAAM,MAAM,QAAA,QAAQ;AAAA,QAC9B,UAAU,MAAM,MAAM,QAAA,QAAQ;AAAA,MAAA,CAC/B;AAAA,IA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AK,MAAM;AACT,cAAM,QAAQ,YAAY,WAAW,QAAA,IAAI;AACzC,YAAI,CAAC,OAAO;AACH,iBAAA;AAAA,QACT;AACI,YAAA,SAAS,KAAK,GAAG;AACZ,iBAAA;AAAA,QAAA,WACE,SAAS,KAAK,GAAG;AAC1B,iBAAO,SAAS,KAAK;AAAA,QAAA,OAChB;AACC,gBAAA,IAAI,WAAW,oBAAoB;AAAA,QAC3C;AAAA,MACF;AAAA,MACA,KAAK,CAAC,aAAa;AACjB,YAAI,CAAC,UAAU;AACD,sBAAA,iBAAiB,QAAI,MAAE,MAAS;AAAA,QAAA,OACvC;AACO,sBAAA,iBAAiB,QAAA,MAAM,QAAQ;AAAA,QAC7C;AAAA,MACF;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrDD,MAAe,QAAA,YAmBbA,aAAM;AAAA,EAAA,aACNC;AAAAA,EAAA,eACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,aACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,eACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,QACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,aACAC;AAAAA,EAAA,SACAC;AAAAA,EAAA,UACAC;AAAAA,EAAA,aACAC;AACF,CAAC;"}
@@ -1,26 +1,38 @@
1
- const d = (e, n) => {
2
- if (!n)
1
+ const getSingleCodeContent = (options, curValue) => {
2
+ if (!curValue) {
3
3
  return null;
4
- for (let t = 0; t < e.length; t++) {
5
- const { value: r, content: o } = e[t];
6
- if (r == n)
7
- return o;
8
4
  }
9
- return n + "(?)";
10
- }, c = (e, n) => {
11
- if (!n)
5
+ for (let i = 0; i < options.length; i++) {
6
+ const { value, content } = options[i];
7
+ if (value == curValue) {
8
+ return content;
9
+ }
10
+ }
11
+ return curValue + "(?)";
12
+ };
13
+ const getMultiCodeContent = (options, curValue) => {
14
+ if (!curValue) {
12
15
  return null;
13
- let t = "";
14
- const r = n.split(",");
15
- return r.forEach((o, f) => {
16
- const i = e.findIndex((l) => {
17
- if (l.value == o) return !0;
16
+ }
17
+ let content = "";
18
+ const data = curValue.split(",");
19
+ data.forEach((selectValue, valueIndex) => {
20
+ const index = options.findIndex((item) => {
21
+ if (item.value == selectValue) return true;
18
22
  });
19
- i == -1 ? t += `${o}(?)` : t += e[i].content, f != r.length - 1 && (t += ",");
20
- }), t;
23
+ if (index == -1) {
24
+ content += `${selectValue}(?)`;
25
+ } else {
26
+ content += options[index].content;
27
+ }
28
+ if (valueIndex != data.length - 1) {
29
+ content += ",";
30
+ }
31
+ });
32
+ return content;
21
33
  };
22
34
  export {
23
- c as getMultiCodeContent,
24
- d as getSingleCodeContent
35
+ getMultiCodeContent,
36
+ getSingleCodeContent
25
37
  };
26
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Form/utils/index.ts"],"sourcesContent":["export const getSingleCodeContent = (\r\n options: Array<{\r\n value: string\r\n content: string\r\n }>,\r\n curValue: string\r\n) => {\r\n if (!curValue) {\r\n return null\r\n }\r\n\r\n for (let i = 0; i < options.length; i++) {\r\n const { value, content } = options[i]\r\n if (value == curValue) {\r\n return content\r\n }\r\n }\r\n\r\n return curValue + '(?)'\r\n}\r\n\r\nexport const getMultiCodeContent = (\r\n options: Array<{\r\n value: string\r\n content: string\r\n }>,\r\n curValue: string\r\n) => {\r\n if (!curValue) {\r\n return null\r\n }\r\n\r\n let content = ''\r\n\r\n const data = curValue.split(',')\r\n data.forEach((selectValue, valueIndex) => {\r\n const index = options.findIndex((item) => {\r\n if (item.value == selectValue) return true\r\n })\r\n\r\n if (index == -1) {\r\n content += `${selectValue}(?)`\r\n } else {\r\n content += options[index].content\r\n }\r\n\r\n if (valueIndex != data.length - 1) {\r\n content += ','\r\n }\r\n })\r\n\r\n return content\r\n}\r\n"],"names":["getSingleCodeContent","options","curValue","i","value","content","getMultiCodeContent","data","selectValue","valueIndex","index","item"],"mappings":"AAAa,MAAAA,IAAuB,CAClCC,GAIAC,MACG;AACH,MAAI,CAACA;AACI,WAAA;AAGT,WAASC,IAAI,GAAGA,IAAIF,EAAQ,QAAQE,KAAK;AACvC,UAAM,EAAE,OAAAC,GAAO,SAAAC,EAAQ,IAAIJ,EAAQE,CAAC;AACpC,QAAIC,KAASF;AACJ,aAAAG;AAAA,EAEX;AAEA,SAAOH,IAAW;AACpB,GAEaI,IAAsB,CACjCL,GAIAC,MACG;AACH,MAAI,CAACA;AACI,WAAA;AAGT,MAAIG,IAAU;AAER,QAAAE,IAAOL,EAAS,MAAM,GAAG;AAC1B,SAAAK,EAAA,QAAQ,CAACC,GAAaC,MAAe;AACxC,UAAMC,IAAQT,EAAQ,UAAU,CAACU,MAAS;AACpC,UAAAA,EAAK,SAASH,EAAoB,QAAA;AAAA,IAAA,CACvC;AAED,IAAIE,KAAS,KACXL,KAAW,GAAGG,CAAW,QAEdH,KAAAJ,EAAQS,CAAK,EAAE,SAGxBD,KAAcF,EAAK,SAAS,MACnBF,KAAA;AAAA,EACb,CACD,GAEMA;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Form/utils/index.ts"],"sourcesContent":["export const getSingleCodeContent = (\r\n options: Array<{\r\n value: string\r\n content: string\r\n }>,\r\n curValue: string\r\n) => {\r\n if (!curValue) {\r\n return null\r\n }\r\n\r\n for (let i = 0; i < options.length; i++) {\r\n const { value, content } = options[i]\r\n if (value == curValue) {\r\n return content\r\n }\r\n }\r\n\r\n return curValue + '(?)'\r\n}\r\n\r\nexport const getMultiCodeContent = (\r\n options: Array<{\r\n value: string\r\n content: string\r\n }>,\r\n curValue: string\r\n) => {\r\n if (!curValue) {\r\n return null\r\n }\r\n\r\n let content = ''\r\n\r\n const data = curValue.split(',')\r\n data.forEach((selectValue, valueIndex) => {\r\n const index = options.findIndex((item) => {\r\n if (item.value == selectValue) return true\r\n })\r\n\r\n if (index == -1) {\r\n content += `${selectValue}(?)`\r\n } else {\r\n content += options[index].content\r\n }\r\n\r\n if (valueIndex != data.length - 1) {\r\n content += ','\r\n }\r\n })\r\n\r\n return content\r\n}\r\n"],"names":[],"mappings":"AAAa,MAAA,uBAAuB,CAClC,SAIA,aACG;AACH,MAAI,CAAC,UAAU;AACN,WAAA;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,EAAE,OAAO,QAAQ,IAAI,QAAQ,CAAC;AACpC,QAAI,SAAS,UAAU;AACd,aAAA;AAAA,IACT;AAAA,EACF;AAEA,SAAO,WAAW;AACpB;AAEa,MAAA,sBAAsB,CACjC,SAIA,aACG;AACH,MAAI,CAAC,UAAU;AACN,WAAA;AAAA,EACT;AAEA,MAAI,UAAU;AAER,QAAA,OAAO,SAAS,MAAM,GAAG;AAC1B,OAAA,QAAQ,CAAC,aAAa,eAAe;AACxC,UAAM,QAAQ,QAAQ,UAAU,CAAC,SAAS;AACpC,UAAA,KAAK,SAAS,YAAoB,QAAA;AAAA,IAAA,CACvC;AAED,QAAI,SAAS,IAAI;AACf,iBAAW,GAAG,WAAW;AAAA,IAAA,OACpB;AACM,iBAAA,QAAQ,KAAK,EAAE;AAAA,IAC5B;AAEI,QAAA,cAAc,KAAK,SAAS,GAAG;AACtB,iBAAA;AAAA,IACb;AAAA,EAAA,CACD;AAEM,SAAA;AACT;"}
@@ -1,137 +1,211 @@
1
- import { findIndex as P } from "lodash-es";
2
- import { defineComponent as A, useTemplateRef as x, ref as v, watch as k, openBlock as y, createBlock as I, unref as L, withCtx as S, renderSlot as z } from "vue";
3
- import { withInstall as U } from "../_util/vue/install.js";
1
+ import { findIndex } from "lodash-es";
2
+ import { defineComponent, useTemplateRef, ref, watch, openBlock, createBlock, unref, withCtx, renderSlot } from "vue";
3
+ import { withInstall } from "../_util/vue/install.js";
4
4
  import "element-plus";
5
- import T from "../Querytable/index.js";
5
+ import Querytable from "../Querytable/index.js";
6
6
  import "../Form/index.js";
7
- import D from "../Form/LovInput/hooks/useLov.js";
8
- import q from "../Pagetable/index.js";
9
- const B = /* @__PURE__ */ A({
10
- name: "OLovQuerytable",
11
- inheritAttrs: !0,
7
+ import useLov from "../Form/LovInput/hooks/useLov.js";
8
+ import Pagetable from "../Pagetable/index.js";
9
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10
+ ...{ name: "OLovQuerytable", inheritAttrs: true },
12
11
  __name: "LovQuerytable",
13
12
  props: {
14
13
  data: {}
15
14
  },
16
- setup(e) {
17
- const d = x("table"), i = v(), s = v(), l = D();
18
- l == null || l.registerKeydownHandler((a) => {
19
- if (a == "ArrowUp") {
20
- let o;
21
- i.value == 0 ? o = e.data[e.data.length - 1] : o = e.data[i.value - 1], d.value.setCurrentRow(o), r(i.value);
22
- } else if (a == "ArrowDown") {
23
- let o;
24
- i.value == e.data.length - 1 ? o = e.data[0] : o = e.data[i.value + 1], d.value.setCurrentRow(o), r(i.value);
25
- } else a == "Enter" && s.value && (l == null || l.backfill(s.value));
15
+ setup(__props) {
16
+ const tableRef = useTemplateRef("table");
17
+ const currentRowIndex = ref();
18
+ const currentRowData = ref();
19
+ const lov = useLov();
20
+ lov == null ? void 0 : lov.registerKeydownHandler((code) => {
21
+ if (code == "ArrowUp") {
22
+ let nextRow;
23
+ if (currentRowIndex.value == 0) {
24
+ nextRow = __props.data[__props.data.length - 1];
25
+ } else {
26
+ nextRow = __props.data[currentRowIndex.value - 1];
27
+ }
28
+ tableRef.value.setCurrentRow(nextRow);
29
+ scrollToRow(currentRowIndex.value);
30
+ } else if (code == "ArrowDown") {
31
+ let nextRow;
32
+ if (currentRowIndex.value == __props.data.length - 1) {
33
+ nextRow = __props.data[0];
34
+ } else {
35
+ nextRow = __props.data[currentRowIndex.value + 1];
36
+ }
37
+ tableRef.value.setCurrentRow(nextRow);
38
+ scrollToRow(currentRowIndex.value);
39
+ } else if (code == "Enter") {
40
+ currentRowData.value && (lov == null ? void 0 : lov.backfill(currentRowData.value));
41
+ }
26
42
  });
27
- const r = (a) => {
28
- var t;
29
- ((t = d.value) == null ? void 0 : t.$el).querySelectorAll(".el-table__row")[a].scrollIntoViewIfNeeded();
30
- }, f = (a) => {
31
- l == null || l.backfill(a);
32
- }, u = (a) => {
33
- const o = P(e.data, a);
34
- o == -1 ? (i.value = 0, s.value = e.data[0]) : (i.value = o, s.value = a);
43
+ const scrollToRow = (index2) => {
44
+ var _a;
45
+ const $table = (_a = tableRef.value) == null ? void 0 : _a.$el;
46
+ const $row = $table.querySelectorAll(".el-table__row")[index2];
47
+ $row.scrollIntoViewIfNeeded();
48
+ };
49
+ const onRowClick = (row) => {
50
+ lov == null ? void 0 : lov.backfill(row);
35
51
  };
36
- return k(
37
- () => e.data,
52
+ const handleCurrentRowChange = (row) => {
53
+ const index2 = findIndex(__props.data, row);
54
+ if (index2 == -1) {
55
+ currentRowIndex.value = 0;
56
+ currentRowData.value = __props.data[0];
57
+ } else {
58
+ currentRowIndex.value = index2;
59
+ currentRowData.value = row;
60
+ }
61
+ };
62
+ watch(
63
+ () => __props.data,
38
64
  () => {
39
- e.data.length > 0 && d.value.setCurrentRow(e.data[0]);
65
+ if (__props.data.length > 0) {
66
+ tableRef.value.setCurrentRow(__props.data[0]);
67
+ }
40
68
  }
41
- ), (a, o) => (y(), I(L(T), {
42
- ref: "table",
43
- data: a.data,
44
- onRowClick: f,
45
- "current-row-mode": "",
46
- onCurrentRowChange: u,
47
- size: "small"
48
- }, {
49
- default: S(() => [
50
- z(a.$slots, "default")
51
- ]),
52
- _: 3
53
- }, 8, ["data"]));
69
+ );
70
+ return (_ctx, _cache) => {
71
+ return openBlock(), createBlock(unref(Querytable), {
72
+ ref: "table",
73
+ data: _ctx.data,
74
+ onRowClick,
75
+ "current-row-mode": "",
76
+ onCurrentRowChange: handleCurrentRowChange,
77
+ size: "small"
78
+ }, {
79
+ default: withCtx(() => [
80
+ renderSlot(_ctx.$slots, "default")
81
+ ]),
82
+ _: 3
83
+ }, 8, ["data"]);
84
+ };
54
85
  }
55
- }), E = /* @__PURE__ */ A({
56
- name: "OLovPagetable",
57
- inheritAttrs: !0,
86
+ });
87
+ const _sfc_main = /* @__PURE__ */ defineComponent({
88
+ ...{ name: "OLovPagetable", inheritAttrs: true },
58
89
  __name: "LovPagetable",
59
90
  props: {
60
91
  data: {},
61
92
  pagination: {}
62
93
  },
63
94
  emits: ["update:pagination"],
64
- setup(e, { emit: d }) {
65
- const i = d, s = (t) => {
66
- i("update:pagination", t);
67
- }, l = x("table"), r = v(), f = v(), u = D();
68
- u == null || u.registerKeydownHandler((t) => {
69
- var c, R, g, h, C, $;
70
- if (t == "ArrowUp") {
71
- let n;
72
- r.value == 0 ? n = e.data[e.data.length - 1] : n = e.data[r.value - 1], l.value.setCurrentRow(n), a(r.value);
73
- } else if (t == "ArrowDown") {
74
- let n;
75
- r.value == e.data.length - 1 ? n = e.data[0] : n = e.data[r.value + 1], l.value.setCurrentRow(n), a(r.value);
76
- } else if (t == "Enter")
77
- f.value && (u == null || u.backfill(f.value));
78
- else if (t == "ArrowLeft") {
79
- const n = (c = e.pagination) == null ? void 0 : c.currentPage, w = (R = e.pagination) == null ? void 0 : R.pageSize, m = (g = e.pagination) == null ? void 0 : g.total;
80
- if (!n || !w || !m)
95
+ setup(__props, { emit: __emit }) {
96
+ const emits = __emit;
97
+ const onUpdatePagination = (data) => {
98
+ emits("update:pagination", data);
99
+ };
100
+ const tableRef = useTemplateRef("table");
101
+ const currentRowIndex = ref();
102
+ const currentRowData = ref();
103
+ const lov = useLov();
104
+ lov == null ? void 0 : lov.registerKeydownHandler((code) => {
105
+ var _a, _b, _c, _d, _e, _f;
106
+ if (code == "ArrowUp") {
107
+ let nextRow;
108
+ if (currentRowIndex.value == 0) {
109
+ nextRow = __props.data[__props.data.length - 1];
110
+ } else {
111
+ nextRow = __props.data[currentRowIndex.value - 1];
112
+ }
113
+ tableRef.value.setCurrentRow(nextRow);
114
+ scrollToRow(currentRowIndex.value);
115
+ } else if (code == "ArrowDown") {
116
+ let nextRow;
117
+ if (currentRowIndex.value == __props.data.length - 1) {
118
+ nextRow = __props.data[0];
119
+ } else {
120
+ nextRow = __props.data[currentRowIndex.value + 1];
121
+ }
122
+ tableRef.value.setCurrentRow(nextRow);
123
+ scrollToRow(currentRowIndex.value);
124
+ } else if (code == "Enter") {
125
+ currentRowData.value && (lov == null ? void 0 : lov.backfill(currentRowData.value));
126
+ } else if (code == "ArrowLeft") {
127
+ const currentPage = (_a = __props.pagination) == null ? void 0 : _a.currentPage;
128
+ const pageSize = (_b = __props.pagination) == null ? void 0 : _b.pageSize;
129
+ const total = (_c = __props.pagination) == null ? void 0 : _c.total;
130
+ if (!currentPage || !pageSize || !total) {
81
131
  return;
82
- n > 1 && i("update:pagination", {
83
- ...e.pagination,
84
- currentPage: n - 1
85
- });
86
- } else if (t == "ArrowRight") {
87
- const n = (h = e.pagination) == null ? void 0 : h.currentPage, w = (C = e.pagination) == null ? void 0 : C.pageSize, m = ($ = e.pagination) == null ? void 0 : $.total;
88
- if (!n || !w || !m)
132
+ }
133
+ if (currentPage > 1) {
134
+ emits("update:pagination", {
135
+ ...__props.pagination,
136
+ currentPage: currentPage - 1
137
+ });
138
+ }
139
+ } else if (code == "ArrowRight") {
140
+ const currentPage = (_d = __props.pagination) == null ? void 0 : _d.currentPage;
141
+ const pageSize = (_e = __props.pagination) == null ? void 0 : _e.pageSize;
142
+ const total = (_f = __props.pagination) == null ? void 0 : _f.total;
143
+ if (!currentPage || !pageSize || !total) {
89
144
  return;
90
- const Q = Math.ceil(m / w);
91
- n < Q && i("update:pagination", {
92
- ...e.pagination,
93
- currentPage: n + 1
94
- });
145
+ }
146
+ const totalPage = Math.ceil(total / pageSize);
147
+ if (currentPage < totalPage) {
148
+ emits("update:pagination", {
149
+ ...__props.pagination,
150
+ currentPage: currentPage + 1
151
+ });
152
+ }
95
153
  }
96
154
  });
97
- const a = (t) => {
98
- var g;
99
- ((g = l.value) == null ? void 0 : g.$el).querySelectorAll(".el-table__row")[t].scrollIntoViewIfNeeded();
100
- }, o = (t) => {
101
- u == null || u.backfill(t);
102
- }, b = (t) => {
103
- const c = P(e.data, t);
104
- c == -1 ? (r.value = 0, f.value = e.data[0]) : (r.value = c, f.value = t);
155
+ const scrollToRow = (index2) => {
156
+ var _a;
157
+ const $table = (_a = tableRef.value) == null ? void 0 : _a.$el;
158
+ const $row = $table.querySelectorAll(".el-table__row")[index2];
159
+ $row.scrollIntoViewIfNeeded();
160
+ };
161
+ const onRowClick = (row) => {
162
+ lov == null ? void 0 : lov.backfill(row);
105
163
  };
106
- return k(
107
- () => e.data,
164
+ const handleCurrentRowChange = (row) => {
165
+ const index2 = findIndex(__props.data, row);
166
+ if (index2 == -1) {
167
+ currentRowIndex.value = 0;
168
+ currentRowData.value = __props.data[0];
169
+ } else {
170
+ currentRowIndex.value = index2;
171
+ currentRowData.value = row;
172
+ }
173
+ };
174
+ watch(
175
+ () => __props.data,
108
176
  () => {
109
- e.data.length > 0 && l.value.setCurrentRow(e.data[0]);
177
+ if (__props.data.length > 0) {
178
+ tableRef.value.setCurrentRow(__props.data[0]);
179
+ }
110
180
  }
111
- ), (t, c) => (y(), I(L(q), {
112
- ref: "table",
113
- data: t.data,
114
- onRowClick: o,
115
- "current-row-mode": "",
116
- onCurrentRowChange: b,
117
- pagination: t.pagination,
118
- "onUpdate:pagination": s,
119
- size: "small"
120
- }, {
121
- default: S(() => [
122
- z(t.$slots, "default")
123
- ]),
124
- _: 3
125
- }, 8, ["data", "pagination"]));
181
+ );
182
+ return (_ctx, _cache) => {
183
+ return openBlock(), createBlock(unref(Pagetable), {
184
+ ref: "table",
185
+ data: _ctx.data,
186
+ onRowClick,
187
+ "current-row-mode": "",
188
+ onCurrentRowChange: handleCurrentRowChange,
189
+ pagination: _ctx.pagination,
190
+ "onUpdate:pagination": onUpdatePagination,
191
+ size: "small"
192
+ }, {
193
+ default: withCtx(() => [
194
+ renderSlot(_ctx.$slots, "default")
195
+ ]),
196
+ _: 3
197
+ }, 8, ["data", "pagination"]);
198
+ };
126
199
  }
127
- }), G = U(
200
+ });
201
+ const index = withInstall(
128
202
  {},
129
203
  {
130
- LovQuerytable: B,
131
- LovPagetable: E
204
+ LovQuerytable: _sfc_main$1,
205
+ LovPagetable: _sfc_main
132
206
  }
133
207
  );
134
208
  export {
135
- G as default
209
+ index as default
136
210
  };
137
211
  //# sourceMappingURL=index.js.map