fast-element-plus 2.0.15 → 2.0.16
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.
- package/CHANGELOG.md +9 -0
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/index.d.ts +1 -1
- package/dist/components/contextMenu/index.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +2 -2
- package/dist/components/contextMenu/src/contextMenu.mjs +2 -2
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/dialog/src/dialog.d.ts +6 -6
- package/dist/components/dialog/src/dialog.mjs +4 -4
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +2 -2
- package/dist/components/drawer/src/drawer.mjs +6 -6
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +10 -4
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +4 -4
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/form/utils/form.d.ts +1 -1
- package/dist/components/form/utils/form.mjs +4 -8
- package/dist/components/form/utils/form.mjs.map +1 -1
- package/dist/components/image/src/image.mjs +1 -1
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +4 -4
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +1 -3
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/index.d.ts +1 -1
- package/dist/components/layoutGrid/index.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +3 -3
- package/dist/components/layoutGrid/src/layoutGrid.mjs +2 -2
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +2 -2
- package/dist/components/select/src/select.mjs +2 -2
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +5 -5
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +2 -2
- package/dist/components/selectV2/src/selectV2.mjs +3 -3
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/index.mjs +1 -3
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/table.d.ts +9 -9
- package/dist/components/table/src/table.mjs +21 -23
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +3 -3
- package/dist/components/table/src/tableColumn.mjs +9 -16
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.mjs +8 -8
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +3 -3
- package/dist/components/table/src/tableSearchForm.mjs +15 -21
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.mjs +7 -7
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.mjs +1 -1
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +3 -3
- package/dist/components/tree/src/tree.mjs +1 -1
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +8 -8
- package/dist/components/treeSelect/src/treeSelect.mjs +3 -3
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.mjs +1 -1
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.mjs +3 -3
- package/dist/components/upload/src/useUpload.mjs.map +1 -1
- package/dist/components/upload/utils/upload.d.ts +1 -1
- package/dist/components/upload/utils/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +7 -4
- package/dist/components/uploadImage/src/uploadImage.mjs +11 -5
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +7 -4
- package/dist/components/uploadImages/src/uploadImages.mjs +9 -3
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-copy/index.d.ts +1 -1
- package/dist/directives/click-copy/index.mjs.map +1 -1
- package/dist/directives/click-debounce/index.d.ts +1 -1
- package/dist/directives/click-draggable/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.mjs.map +1 -1
- package/dist/directives/click-longpress/index.d.ts +1 -1
- package/dist/directives/click-throttle/index.d.ts +1 -1
- package/dist/element-plus.mjs.map +1 -1
- package/dist/hooks/use-screenFull/index.mjs.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/utils/async/index.mjs +6 -4
- package/dist/utils/async/index.mjs.map +1 -1
- package/dist/utils/string/index.mjs +19 -11
- package/dist/utils/string/index.mjs.map +1 -1
- package/dist/utils/vue/install.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/components/table/src/page.type.mjs +0 -45
- package/dist/components/table/src/page.type.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/src/form.tsx"],"sourcesContent":["import { computed, defineComponent, provide, reactive, ref } from \"vue\";\nimport { ElForm, formEmits, formProps, useGlobalSize } from \"element-plus\";\nimport { isNumber, isObject } from \"lodash-unified\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaLayoutGrid } from \"../../layoutGrid\";\nimport { formUtil } from \"../utils/form\";\nimport type { FormInstance, FormItemContext, FormValidateCallback, FormValidationResult } from \"element-plus\";\nimport type { FaLayoutGridBreakPoint } from \"../../layoutGrid\";\n\n/** FaForm 的运行时 Props 定义。 */\nexport const faFormProps = {\n\t...formProps,\n\t/** @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */\n\tlabelWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"auto\",\n\t},\n\t/** @description Suffix of the label. */\n\tlabelSuffix: {\n\t\ttype: String,\n\t\tdefault: \":\",\n\t},\n\t/** @description When validation fails, scroll to the first error form entry. */\n\tscrollToError: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 详情From,会删除 FormItem 的 paddinfa-bottom */\n\tdetailForm: Boolean,\n\t/** @description Grid布局*/\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description Grid布局列配置 */\n\tcols: {\n\t\ttype: definePropType<string | number | Record<FaLayoutGridBreakPoint, number>>([String, Number, Object]),\n\t\tdefault: (): Record<FaLayoutGridBreakPoint, number> => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t},\n};\n\n/** FaForm 的运行时事件定义。 */\nexport const faFormEmits = {\n\t...formEmits,\n};\n\n/** FaForm 的插槽参数。 */\nexport interface FaFormSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { cols: Record<FaLayoutGridBreakPoint, number>; gap: [number, number] };\n}\n\nexport default defineComponent({\n\tname: \"FaForm\",\n\tprops: faFormProps,\n\temits: faFormEmits,\n\tslots: makeSlots<FaFormSlots>(),\n\tsetup(props, { slots, expose, emit }) {\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tcols: computed(() => {\n\t\t\t\tif (isObject(props.cols)) {\n\t\t\t\t\treturn props.cols;\n\t\t\t\t} else {\n\t\t\t\t\tconst colsNumber = isNumber(props.cols) ? props.cols : Number(props.cols);\n\t\t\t\t\treturn { xs: 1, sm: colsNumber, md: colsNumber, lg: colsNumber, xl: colsNumber };\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgap: computed<[number, number]>(() => (_globalSize.value === \"small\" ? [15, 0] : [20, 0])),\n\t\t});\n\n\t\tconst formRef = ref<FormInstance>();\n\n\t\t// 注入 cols\n\t\tprovide(\"faFormCols\", state.cols);\n\n\t\tconst elFormProps = useProps(props, formProps);\n\t\tconst elFormEmits = useEmits(formEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElForm\n\t\t\t\t{...elFormProps.value}\n\t\t\t\t{...elFormEmits.value}\n\t\t\t\tref={formRef}\n\t\t\t\tclass={[\"fa-form\", `fa-form-${_globalSize.value}`, { [`fa-form-detail fa-form-detail_${_globalSize.value}`]: props.detailForm }]}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\tprops.grid ? (\n\t\t\t\t\t\t\t<FaLayoutGrid collapsed gap={state.gap} cols={state.cols}>\n\t\t\t\t\t\t\t\t{slots.default?.(state)}\n\t\t\t\t\t\t\t</FaLayoutGrid>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tslots.default?.(state)\n\t\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElForm>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidate: (callback?: FormValidateCallback): FormValidationResult =>\n\t\t\t\tcallback ? (formRef.value?.validate(callback) ?? Promise.reject(new Error(\"ElForm 实例尚未挂载。\"))) : formUtil.validate(formRef),\n\t\t\t/** @description 验证具体的某个字段。 */\n\t\t\tvalidateField: computed(() => formRef.value?.validateField),\n\t\t\t/** @description 重置该表单项,将其值重置为初始值,并移除校验结果 */\n\t\t\tresetFields: computed(() => formRef.value?.resetFields),\n\t\t\t/** @description 清理某个字段的表单验证信息。 */\n\t\t\tclearValidate: computed(() => formRef.value?.clearValidate),\n\t\t\t/** @description 滚动到指定的字段 */\n\t\t\tscrollToField: computed(() => formRef.value?.scrollToField),\n\t\t\t/** @description 获取所有字段的 context */\n\t\t\tfields: computed(() => formRef.value?.fields as FormItemContext[]),\n\t\t\t/** @description 获取指定字段的 context。 */\n\t\t\tgetField: computed(() => formRef.value?.getField),\n\t\t\t/** @description 设置表单字段的初始值。 */\n\t\t\tsetInitialValues: computed(() => formRef.value?.setInitialValues),\n\t\t\t/** @description 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidateScrollToField: (): FormValidationResult => formUtil.validateScrollToField(formRef),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/src/form.tsx"],"sourcesContent":["import { computed, defineComponent, provide, reactive, ref } from \"vue\";\nimport { ElForm, formEmits, formProps, useGlobalSize } from \"element-plus\";\nimport { isNumber, isObject } from \"lodash-unified\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaLayoutGrid } from \"../../layoutGrid\";\nimport { formUtil } from \"../utils/form\";\nimport type { FormInstance, FormItemContext, FormValidateCallback, FormValidationResult } from \"element-plus\";\nimport type { FaLayoutGridBreakPoint } from \"../../layoutGrid\";\n\n/** FaForm 的运行时 Props 定义。 */\nexport const faFormProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...formProps,\n\t/** @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */\n\tlabelWidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"auto\",\n\t},\n\t/** @description Suffix of the label. */\n\tlabelSuffix: {\n\t\ttype: String,\n\t\tdefault: \":\",\n\t},\n\t/** @description When validation fails, scroll to the first error form entry. */\n\tscrollToError: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 详情From,会删除 FormItem 的 paddinfa-bottom */\n\tdetailForm: Boolean,\n\t/** @description Grid布局*/\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description Grid布局列配置 */\n\tcols: {\n\t\ttype: definePropType<string | number | Record<FaLayoutGridBreakPoint, number>>([String, Number, Object]),\n\t\tdefault: (): Record<FaLayoutGridBreakPoint, number> => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t},\n};\n\n/** FaForm 的运行时事件定义。 */\nexport const faFormEmits = {\n\t...formEmits,\n};\n\n/** FaForm 的插槽参数。 */\nexport interface FaFormSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { cols: Record<FaLayoutGridBreakPoint, number>; gap: [number, number] };\n}\n\nexport default defineComponent({\n\tname: \"FaForm\",\n\tprops: faFormProps,\n\temits: faFormEmits,\n\tslots: makeSlots<FaFormSlots>(),\n\tsetup(props, { slots, expose, emit }) {\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tcols: computed(() => {\n\t\t\t\tif (isObject(props.cols)) {\n\t\t\t\t\treturn props.cols;\n\t\t\t\t} else {\n\t\t\t\t\tconst colsNumber = isNumber(props.cols) ? props.cols : Number(props.cols);\n\t\t\t\t\treturn { xs: 1, sm: colsNumber, md: colsNumber, lg: colsNumber, xl: colsNumber };\n\t\t\t\t}\n\t\t\t}),\n\t\t\tgap: computed<[number, number]>(() => (_globalSize.value === \"small\" ? [15, 0] : [20, 0])),\n\t\t});\n\n\t\tconst formRef = ref<FormInstance>();\n\n\t\t// 注入 cols\n\t\tprovide(\"faFormCols\", state.cols);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elFormProps = useProps(props, formProps);\n\t\tconst elFormEmits = useEmits(formEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElForm\n\t\t\t\t{...elFormProps.value}\n\t\t\t\t{...elFormEmits.value}\n\t\t\t\tref={formRef}\n\t\t\t\tclass={[\"fa-form\", `fa-form-${_globalSize.value}`, { [`fa-form-detail fa-form-detail_${_globalSize.value}`]: props.detailForm }]}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\tprops.grid ? (\n\t\t\t\t\t\t\t<FaLayoutGrid collapsed gap={state.gap} cols={state.cols}>\n\t\t\t\t\t\t\t\t{slots.default?.(state)}\n\t\t\t\t\t\t\t</FaLayoutGrid>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tslots.default?.(state)\n\t\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElForm>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 对整个表单的内容进行验证。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidate: (callback?: FormValidateCallback): FormValidationResult =>\n\t\t\t\tcallback ? (formRef.value?.validate(callback) ?? Promise.reject(new Error(\"ElForm 实例尚未挂载。\"))) : formUtil.validate(formRef),\n\t\t\t/** @description 验证具体的某个字段。 */\n\t\t\tvalidateField: computed(() => formRef.value?.validateField),\n\t\t\t/** @description 重置该表单项,将其值重置为初始值,并移除校验结果 */\n\t\t\tresetFields: computed(() => formRef.value?.resetFields),\n\t\t\t/** @description 清理某个字段的表单验证信息。 */\n\t\t\tclearValidate: computed(() => formRef.value?.clearValidate),\n\t\t\t/** @description 滚动到指定的字段 */\n\t\t\tscrollToField: computed(() => formRef.value?.scrollToField),\n\t\t\t/** @description 获取所有字段的 context */\n\t\t\tfields: computed(() => formRef.value?.fields as FormItemContext[]),\n\t\t\t/** @description 获取指定字段的 context。 */\n\t\t\tgetField: computed(() => formRef.value?.getField),\n\t\t\t/** @description 设置表单字段的初始值。 */\n\t\t\tsetInitialValues: computed(() => formRef.value?.setInitialValues),\n\t\t\t/** @description 对整个表单的内容进行验证,带滚动。 接收一个回调函数,或返回 Promise。 */\n\t\t\tvalidateScrollToField: (): FormValidationResult => formUtil.validateScrollToField(formRef),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,cAAc;CAE1B,GAAG;;CAEH,YAAY;EACX,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,eAAe;EACd,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;;CAEZ,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,MAAM;EACL,MAAM,eAAyE;GAAC;GAAQ;GAAQ;EAAM,CAAC;EACvG,gBAAwD;GAAE,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;EAAE;CAC7F;AACD;;AAGA,MAAa,cAAc,EAC1B,GAAG,UACJ;AAQA,IAAA,eAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAuB;CAC9B,MAAM,OAAO,EAAE,OAAO,QAAQ,QAAQ;EACrC,MAAM,cAAc,cAAc;EAElC,MAAM,QAAQ,SAAS;GACtB,MAAM,eAAe;IACpB,IAAI,SAAS,MAAM,IAAI,GACtB,OAAO,MAAM;SACP;KACN,MAAM,aAAa,SAAS,MAAM,IAAI,IAAI,MAAM,OAAO,OAAO,MAAM,IAAI;KACxE,OAAO;MAAE,IAAI;MAAG,IAAI;MAAY,IAAI;MAAY,IAAI;MAAY,IAAI;KAAW;IAChF;GACD,CAAC;GACD,KAAK,eAAkC,YAAY,UAAU,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE;EAC1F,CAAC;EAED,MAAM,UAAU,IAAkB;EAGlC,QAAQ,cAAc,MAAM,IAAI;EAGhC,MAAM,cAAc,SAAS,OAAO,SAAS;EAC7C,MAAM,cAAc,SAAS,WAAW,IAAI;EAE5C,gBAAU,YAAA,QAAA,WAEJ,YAAY,OACZ,YAAY,OAAK;GAAA,OAChB;GAAO,SACL;IAAC;IAAW,WAAW,YAAY;IAAS,GAAG,iCAAiC,YAAY,UAAU,MAAM,WAAW;GAAC;EAAC,CAAA,GAAA,EAG/H,eACC,MAAM,OAAI,YAAA,cAAA;GAAA,aAAA;GAAA,OACoB,MAAM;GAAG,QAAQ,MAAM;EAAI,GAAA,EAAA,eAAA,CACtD,MAAM,UAAU,KAAK,CAAC,EAAA,CAAA,IAGxB,MAAM,UAAU,KAAK,EACrB,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;GAExB,WAAW,aACV,WAAY,QAAQ,OAAO,SAAS,QAAQ,KAAK,QAAQ,uBAAO,IAAI,MAAM,gBAAgB,CAAC,IAAK,SAAS,SAAS,OAAO;;GAE1H,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,aAAa,eAAe,QAAQ,OAAO,WAAW;;GAEtD,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,eAAe,eAAe,QAAQ,OAAO,aAAa;;GAE1D,QAAQ,eAAe,QAAQ,OAAO,MAA2B;;GAEjE,UAAU,eAAe,QAAQ,OAAO,QAAQ;;GAEhD,kBAAkB,eAAe,QAAQ,OAAO,gBAAgB;;GAEhE,6BAAmD,SAAS,sBAAsB,OAAO;EAC1F,CAAC;CACF;AACD,CAAC"}
|
|
@@ -34,7 +34,7 @@ export declare const faFormItemProps: {
|
|
|
34
34
|
};
|
|
35
35
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
36
36
|
rules: {
|
|
37
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...
|
|
37
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
38
38
|
readonly required: false;
|
|
39
39
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
40
40
|
__epPropKey: true;
|
|
@@ -104,7 +104,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
104
104
|
};
|
|
105
105
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
106
106
|
rules: {
|
|
107
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...
|
|
107
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
108
108
|
readonly required: false;
|
|
109
109
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
110
110
|
__epPropKey: true;
|
|
@@ -175,7 +175,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
175
175
|
};
|
|
176
176
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
177
177
|
rules: {
|
|
178
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...
|
|
178
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>) | (((new (...args: any[]) => import("element-plus").FormItemRule | import("element-plus").FormItemRule[]) | (() => import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>)) | null)[], unknown, unknown>>;
|
|
179
179
|
readonly required: false;
|
|
180
180
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
181
181
|
__epPropKey: true;
|
|
@@ -200,7 +200,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
200
200
|
required: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
201
201
|
offset: string | number;
|
|
202
202
|
grid: boolean;
|
|
203
|
-
labelPosition: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<StringConstructor, "" | "
|
|
203
|
+
labelPosition: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<StringConstructor, "" | "left" | "right" | "top", unknown>;
|
|
204
204
|
inlineMessage: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
205
205
|
showMessage: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
206
206
|
row: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formItem.mjs","names":[],"sources":["../../../../src/components/form/src/formItem.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, ref } from \"vue\";\nimport { ElFormItem, formItemProps } from \"element-plus\";\nimport { isNumber } from \"lodash-unified\";\nimport { makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaFormItemTip } from \"../../formItemTip\";\nimport { FaLayoutGridItem } from \"../../layoutGrid\";\nimport type { FormItemInstance } from \"element-plus\";\nimport type { Ref, VNode } from \"vue\";\n\n/** FaFormItem 的运行时 Props 定义。 */\nexport const faFormItemProps = {\n\t...formItemProps,\n\t/** @description Label tips 提示 */\n\ttips: String,\n\t/** @description Grid 布局 */\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 偏移量 */\n\toffset: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/** @description 栅格跨度 */\n\tspan: {\n\t\ttype: [String, Number],\n\t},\n\t/** @description 独占一行。如果设置 span 则无效 */\n\trow: Boolean,\n};\n\n/** FaFormItem 的插槽参数。 */\nexport interface FaFormItemSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 标签位置显示的内容 */\n\tlabel: { label: string };\n\t/** @description 验证错误信息的显示内容 */\n\terror: { error: string };\n}\n\nexport default defineComponent({\n\tname: \"FaFormItem\",\n\tprops: faFormItemProps,\n\tslots: makeSlots<FaFormItemSlots>(),\n\tsetup(props, { slots, expose }) {\n\t\tconst formItemRef = ref<FormItemInstance>();\n\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(4));\n\n\t\t// 获取响应式设置\n\t\tconst getResponsive = (): {\n\t\t\tspan?: number;\n\t\t\toffset?: number;\n\t\t} => {\n\t\t\tif (!props.grid) return {};\n\t\t\tif (props.span) {\n\t\t\t\treturn {\n\t\t\t\t\tspan: isNumber(props.span) ? props.span : Number(props.span),\n\t\t\t\t\toffset: isNumber(props.offset) ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst result = {\n\t\t\t\t\tspan: 1,\n\t\t\t\t\toffset: isNumber(props.offset) ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t\tif (props.row) {\n\t\t\t\t\tresult.span = cols.value;\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\n\t\tconst elFormItemProps = useProps(props, formItemProps);\n\n\t\tconst ParcelComponent = props.grid ? FaLayoutGridItem : Fragment;\n\n\t\tuseRender(() => (\n\t\t\t<ParcelComponent {...getResponsive()}>\n\t\t\t\t<ElFormItem ref={formItemRef} {...elFormItemProps.value}>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () => slots.default?.() ?? [],\n\t\t\t\t\t\t...(slots.label && !props.tips && { label: ({ label }: { label: string }): VNode[] => slots.label?.({ label }) ?? [] }),\n\t\t\t\t\t\t...(slots.label &&\n\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\tlabel: ({ label }: { label: string }): VNode[] => [\n\t\t\t\t\t\t\t\t\t<FaFormItemTip>\n\t\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\t\tlabel: () => slots.label?.({ label }) ?? [],\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t</FaFormItemTip>,\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t...(!slots.label &&\n\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\tlabel: ({ label }: { label
|
|
1
|
+
{"version":3,"file":"formItem.mjs","names":[],"sources":["../../../../src/components/form/src/formItem.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, ref } from \"vue\";\nimport { ElFormItem, formItemProps } from \"element-plus\";\nimport { isNumber } from \"lodash-unified\";\nimport { makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { FaFormItemTip } from \"../../formItemTip\";\nimport { FaLayoutGridItem } from \"../../layoutGrid\";\nimport type { FormItemInstance } from \"element-plus\";\nimport type { Ref, VNode } from \"vue\";\n\n/** FaFormItem 的运行时 Props 定义。 */\nexport const faFormItemProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...formItemProps,\n\t/** @description Label tips 提示 */\n\ttips: String,\n\t/** @description Grid 布局 */\n\tgrid: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 偏移量 */\n\toffset: {\n\t\ttype: [String, Number],\n\t\tdefault: 0,\n\t},\n\t/** @description 栅格跨度 */\n\tspan: {\n\t\ttype: [String, Number],\n\t},\n\t/** @description 独占一行。如果设置 span 则无效 */\n\trow: Boolean,\n};\n\n/** FaFormItem 的插槽参数。 */\nexport interface FaFormItemSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 标签位置显示的内容 */\n\tlabel: { label: string };\n\t/** @description 验证错误信息的显示内容 */\n\terror: { error: string };\n}\n\nexport default defineComponent({\n\tname: \"FaFormItem\",\n\tprops: faFormItemProps,\n\tslots: makeSlots<FaFormItemSlots>(),\n\tsetup(props, { slots, expose }) {\n\t\tconst formItemRef = ref<FormItemInstance>();\n\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(4));\n\n\t\t// 获取响应式设置\n\t\tconst getResponsive = (): {\n\t\t\tspan?: number;\n\t\t\toffset?: number;\n\t\t} => {\n\t\t\tif (!props.grid) return {};\n\t\t\tif (props.span) {\n\t\t\t\treturn {\n\t\t\t\t\tspan: isNumber(props.span) ? props.span : Number(props.span),\n\t\t\t\t\toffset: isNumber(props.offset) ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst result = {\n\t\t\t\t\tspan: 1,\n\t\t\t\t\toffset: isNumber(props.offset) ? props.offset : Number(props.offset),\n\t\t\t\t};\n\t\t\t\tif (props.row) {\n\t\t\t\t\tresult.span = cols.value;\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elFormItemProps = useProps(props, formItemProps);\n\n\t\tconst ParcelComponent = props.grid ? FaLayoutGridItem : Fragment;\n\n\t\tuseRender(() => (\n\t\t\t<ParcelComponent {...getResponsive()}>\n\t\t\t\t<ElFormItem ref={formItemRef} {...elFormItemProps.value}>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () => slots.default?.() ?? [],\n\t\t\t\t\t\t...(slots.label && !props.tips && { label: ({ label }: { label: string }): VNode[] => slots.label?.({ label }) ?? [] }),\n\t\t\t\t\t\t...(slots.label &&\n\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\tlabel: ({ label }: { label: string }): VNode[] => [\n\t\t\t\t\t\t\t\t\t<FaFormItemTip>\n\t\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\t\tlabel: () => slots.label?.({ label }) ?? [],\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t</FaFormItemTip>,\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t...(!slots.label &&\n\t\t\t\t\t\t\tprops.tips && {\n\t\t\t\t\t\t\t\tlabel: ({ label }: { label?: string }): VNode[] => [<FaFormItemTip label={label ?? props.label} tips={props.tips} />],\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t...(slots.error && { error: ({ error }: { error: string }): VNode[] => slots.error?.({ error }) ?? [] }),\n\t\t\t\t\t}}\n\t\t\t\t</ElFormItem>\n\t\t\t</ParcelComponent>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 表单项大小 */\n\t\t\tsize: computed(() => formItemRef.value?.size),\n\t\t\t/** @description 校验消息 */\n\t\t\tvalidateMessage: computed(() => formItemRef.value?.validateMessage),\n\t\t\t/** @description 校验状态 */\n\t\t\tvalidateState: computed(() => formItemRef.value?.validateState),\n\t\t\t/** @description 验证表单项 */\n\t\t\tvalidate: computed(() => formItemRef.value?.validate),\n\t\t\t/** @description 移除该表单项的校验结果 */\n\t\t\tclearValidate: computed(() => formItemRef.value?.clearValidate),\n\t\t\t/** @description 对该表单项进行重置,将其值重置为初始值并移除校验结果 */\n\t\t\tresetField: computed(() => formItemRef.value?.resetField),\n\t\t\t/** @description 设置该表单项的初始值。 */\n\t\t\tsetInitialValue: computed(() => formItemRef.value?.setInitialValue),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,kBAAkB;CAE9B,GAAG;;CAEH,MAAM;;CAEN,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,QAAQ;EACP,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,MAAM,EACL,MAAM,CAAC,QAAQ,MAAM,EACtB;;CAEA,KAAK;AACN;AAYA,IAAA,mBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO,UAA2B;CAClC,MAAM,OAAO,EAAE,OAAO,UAAU;EAC/B,MAAM,cAAc,IAAsB;EAE1C,MAAM,OAAO,OAAoB,QAAQ,IAAI,CAAC,CAAC;EAG/C,MAAM,sBAGD;GACJ,IAAI,CAAC,MAAM,MAAM,OAAO,CAAC;GACzB,IAAI,MAAM,MACT,OAAO;IACN,MAAM,SAAS,MAAM,IAAI,IAAI,MAAM,OAAO,OAAO,MAAM,IAAI;IAC3D,QAAQ,SAAS,MAAM,MAAM,IAAI,MAAM,SAAS,OAAO,MAAM,MAAM;GACpE;QACM;IACN,MAAM,SAAS;KACd,MAAM;KACN,QAAQ,SAAS,MAAM,MAAM,IAAI,MAAM,SAAS,OAAO,MAAM,MAAM;IACpE;IACA,IAAI,MAAM,KACT,OAAO,OAAO,KAAK;IAEpB,OAAO;GACR;EACD;EAGA,MAAM,kBAAkB,SAAS,OAAO,aAAa;EAErD,MAAM,kBAAkB,MAAM,OAAO,mBAAmB;EAExD,gBAAU,YAAA,iBACY,cAAc,GAAC,EAAA,eAAA,CAAA,YAAA,YAAA,WAAA,EAAA,OAClB,YAAW,GAAM,gBAAgB,KAAK,GAAA;GAErD,eAAe,MAAM,UAAU,KAAK,CAAA;GACpC,GAAI,MAAM,SAAS,CAAC,MAAM,QAAQ,EAAE,QAAQ,EAAE,YAAwC,MAAM,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAA,EAAG;GACrH,GAAI,MAAM,SACT,MAAM,QAAQ,EACb,QAAQ,EAAE,YAAwC,CAAA,YAAA,eAAA,MAAA,EAG/C,aAAa,MAAM,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAA,EAAE,CAAA,CAAA,EAI/C;GACD,GAAI,CAAC,MAAM,SACV,MAAM,QAAQ,EACb,QAAQ,EAAE,YAAyC,CAAA,YAAA,eAAA;IAAA,SAAuB,SAAS,MAAM;IAAK,QAAQ,MAAM;GAAI,GAAA,IAAA,CAAA,EACjH;GACD,GAAI,MAAM,SAAS,EAAE,QAAQ,EAAE,YAAwC,MAAM,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAA,EAAG;EAAE,CAAA,CAAA,EAAA,CAAA,CAI3G;EAED,OAAO,UAAU,QAAQ;;GAExB,MAAM,eAAe,YAAY,OAAO,IAAI;;GAE5C,iBAAiB,eAAe,YAAY,OAAO,eAAe;;GAElE,eAAe,eAAe,YAAY,OAAO,aAAa;;GAE9D,UAAU,eAAe,YAAY,OAAO,QAAQ;;GAEpD,eAAe,eAAe,YAAY,OAAO,aAAa;;GAE9D,YAAY,eAAe,YAAY,OAAO,UAAU;;GAExD,iBAAiB,eAAe,YAAY,OAAO,eAAe;EACnE,CAAC;CACF;AACD,CAAC"}
|
|
@@ -34,7 +34,7 @@ export declare const formUtil: {
|
|
|
34
34
|
/**
|
|
35
35
|
* 车牌号
|
|
36
36
|
*/
|
|
37
|
-
carNumber(_rule: FormItemRule, value: string, callback: ValidationCallback): void;
|
|
37
|
+
carNumber(_rule: FormItemRule, value: string | null | undefined, callback: ValidationCallback): void;
|
|
38
38
|
/**
|
|
39
39
|
* editor 必填
|
|
40
40
|
*/
|
|
@@ -17,10 +17,7 @@ const formUtil = {
|
|
|
17
17
|
}
|
|
18
18
|
form.validate((isValid, invalidFields) => {
|
|
19
19
|
if (isValid) resolve(isValid);
|
|
20
|
-
else
|
|
21
|
-
if (invalidFields) console.warn("[Fast:formUtil]", "表单验证失败。", invalidFields);
|
|
22
|
-
reject(isValid);
|
|
23
|
-
}
|
|
20
|
+
else reject(invalidFields);
|
|
24
21
|
});
|
|
25
22
|
});
|
|
26
23
|
},
|
|
@@ -39,8 +36,7 @@ const formUtil = {
|
|
|
39
36
|
if (isValid) resolve(isValid);
|
|
40
37
|
else {
|
|
41
38
|
form.scrollToField(Object.keys(invalidFields ?? {}));
|
|
42
|
-
|
|
43
|
-
reject(isValid);
|
|
39
|
+
reject(invalidFields);
|
|
44
40
|
}
|
|
45
41
|
});
|
|
46
42
|
});
|
|
@@ -90,8 +86,8 @@ const formUtil = {
|
|
|
90
86
|
* editor 必填
|
|
91
87
|
*/
|
|
92
88
|
editorRequired(_rule, value, callback) {
|
|
93
|
-
if (value === "<p><br></p>")
|
|
94
|
-
|
|
89
|
+
if (value === "<p><br></p>") callback(/* @__PURE__ */ new Error("内容不能为空"));
|
|
90
|
+
else callback();
|
|
95
91
|
},
|
|
96
92
|
/**
|
|
97
93
|
* 外部链接
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/utils/form.ts"],"sourcesContent":["import { RegExps } from \"../../../constants\";\nimport type { FormInstance, FormItemRule, FormValidationResult } from \"element-plus\";\nimport type { Ref } from \"vue\";\n\ntype ValidationCallback = (error?: Error) => void;\n\n/**\n * 表单工具类\n */\nexport const formUtil = {\n\t/**\n\t * ElForm 表单验证\n\t * @param elFormRef ElForm 组件ref\n\t */\n\tvalidate(elFormRef: Ref<FormInstance | undefined>): FormValidationResult {\n\t\treturn new Promise<boolean>((resolve, reject) => {\n\t\t\tconst form = elFormRef.value;\n\t\t\tif (form === undefined) {\n\t\t\t\treject(new Error(\"ElForm 实例尚未挂载。\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\
|
|
1
|
+
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/components/form/utils/form.ts"],"sourcesContent":["import { RegExps } from \"../../../constants\";\nimport type { FormInstance, FormItemRule, FormValidationResult } from \"element-plus\";\nimport type { Ref } from \"vue\";\n\ntype ValidationCallback = (error?: Error) => void;\n\n/**\n * 表单工具类\n */\nexport const formUtil = {\n\t/**\n\t * ElForm 表单验证\n\t * @param elFormRef ElForm 组件ref\n\t */\n\tvalidate(elFormRef: Ref<FormInstance | undefined>): FormValidationResult {\n\t\treturn new Promise<boolean>((resolve, reject) => {\n\t\t\tconst form = elFormRef.value;\n\t\t\tif (form === undefined) {\n\t\t\t\treject(new Error(\"ElForm 实例尚未挂载。\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tform.validate((isValid: boolean, invalidFields?) => {\n\t\t\t\tif (isValid) {\n\t\t\t\t\tresolve(isValid);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(invalidFields);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t},\n\t/**\n\t * ElForm 表单验证,带滚动\n\t * @param elFormRef ElForm 组件ref\n\t */\n\tvalidateScrollToField(elFormRef: Ref<FormInstance | undefined>): FormValidationResult {\n\t\treturn new Promise<boolean>((resolve, reject) => {\n\t\t\tconst form = elFormRef.value;\n\t\t\tif (form === undefined) {\n\t\t\t\treject(new Error(\"ElForm 实例尚未挂载。\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tform.validate((isValid: boolean, invalidFields?) => {\n\t\t\t\tif (isValid) {\n\t\t\t\t\tresolve(isValid);\n\t\t\t\t} else {\n\t\t\t\t\tform.scrollToField(Object.keys(invalidFields ?? {}));\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(invalidFields);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t},\n\t/**\n\t * 手机号\n\t */\n\tmobile(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (!value) {\n\t\t\tcallback(new Error(\"请输入手机号码\"));\n\t\t} else if (RegExps.Mobile.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的手机号码\"));\n\t\t}\n\t},\n\t/**\n\t * 电话号码\n\t */\n\tphone(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (!value) {\n\t\t\tcallback();\n\t\t} else if (RegExps.Phone.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的电话号码\"));\n\t\t}\n\t},\n\t/**\n\t * 邮箱\n\t */\n\temail(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (!value) {\n\t\t\tcallback();\n\t\t} else if (RegExps.Email.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的邮箱地址\"));\n\t\t}\n\t},\n\t/**\n\t * 身份证\n\t */\n\tidCard(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.IdCard.test(value) || !value) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的身份证号码\"));\n\t\t}\n\t},\n\t/**\n\t * 车牌号\n\t */\n\tcarNumber(_rule: FormItemRule, value: string | null | undefined, callback: ValidationCallback): void {\n\t\tlet success = false;\n\t\tif (value?.length === 7) {\n\t\t\tsuccess = RegExps.CarNumber.test(value);\n\t\t} else if (value?.length === 8) {\n\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(value);\n\t\t}\n\t\tif (success) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的车牌号码\"));\n\t\t}\n\t},\n\t/**\n\t * editor 必填\n\t */\n\teditorRequired(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (value === \"<p><br></p>\") {\n\t\t\tcallback(new Error(\"内容不能为空\"));\n\t\t} else {\n\t\t\tcallback();\n\t\t}\n\t},\n\t/**\n\t * 外部链接\n\t */\n\texternal(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.External.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入正确的外部链接\"));\n\t\t}\n\t},\n\t/**\n\t * 有效的URL\n\t */\n\turl(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.Url.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的 URL。\"));\n\t\t}\n\t},\n\t/**\n\t * 邮政编码\n\t */\n\tpostCode(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.PostCode.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的邮政编码\"));\n\t\t}\n\t},\n\t/**\n\t * 账号(6-20位字母或数字,必须以字母开头,不能全为数字)\n\t */\n\taccount(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.Account.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的账号(6-20位字母或数字,必须以字母开头,不能全为数字)\"));\n\t\t}\n\t},\n\t/**\n\t * 弱密码(只包含字母和数字,长度为6到18位)\n\t */\n\tpassword(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.Password.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的密码(只包含字母和数字,长度为6到18位)\"));\n\t\t}\n\t},\n\t/**\n\t * 强密码(8到20位,包含大小写字母、数字及特殊字符)\n\t */\n\tstrongPassword(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.StrongPassword.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的密码(8到20位,包含大小写字母、数字及特殊字符)\"));\n\t\t}\n\t},\n\t/**\n\t * 中文字符\n\t */\n\tchinese(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.Chinese.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的中文字符\"));\n\t\t}\n\t},\n\t/**\n\t * 英文字符\n\t */\n\tenglish(_rule: FormItemRule, value: string, callback: ValidationCallback): void {\n\t\tif (RegExps.English.test(value)) {\n\t\t\tcallback();\n\t\t} else {\n\t\t\tcallback(new Error(\"请输入有效的英文字符\"));\n\t\t}\n\t},\n\t/**\n\t * 文本框必填\n\t */\n\tinputRequired(message: string, trigger = \"blur\"): FormItemRule {\n\t\treturn {\n\t\t\trequired: true,\n\t\t\tmessage,\n\t\t\ttrigger,\n\t\t};\n\t},\n\t/**\n\t * 选择器必选\n\t */\n\tselectRequired(message: string, trigger = \"change\"): FormItemRule {\n\t\treturn {\n\t\t\trequired: true,\n\t\t\tmessage,\n\t\t\ttrigger,\n\t\t};\n\t},\n};\n"],"mappings":";;;;;AASA,MAAa,WAAW;;;;;CAKvB,SAAS,WAAgE;EACxE,OAAO,IAAI,SAAkB,SAAS,WAAW;GAChD,MAAM,OAAO,UAAU;GACvB,IAAI,SAAS,KAAA,GAAW;IACvB,uBAAO,IAAI,MAAM,gBAAgB,CAAC;IAClC;GACD;GACA,KAAK,UAAU,SAAkB,kBAAmB;IACnD,IAAI,SACH,QAAQ,OAAO;SAGf,OAAO,aAAa;GAEtB,CAAC;EACF,CAAC;CACF;;;;;CAKA,sBAAsB,WAAgE;EACrF,OAAO,IAAI,SAAkB,SAAS,WAAW;GAChD,MAAM,OAAO,UAAU;GACvB,IAAI,SAAS,KAAA,GAAW;IACvB,uBAAO,IAAI,MAAM,gBAAgB,CAAC;IAClC;GACD;GACA,KAAK,UAAU,SAAkB,kBAAmB;IACnD,IAAI,SACH,QAAQ,OAAO;SACT;KACN,KAAK,cAAc,OAAO,KAAK,iBAAiB,CAAC,CAAC,CAAC;KAEnD,OAAO,aAAa;IACrB;GACD,CAAC;EACF,CAAC;CACF;;;;CAIA,OAAO,OAAqB,OAAe,UAAoC;EAC9E,IAAI,CAAC,OACJ,yBAAS,IAAI,MAAM,SAAS,CAAC;OACvB,IAAI,QAAQ,OAAO,KAAK,KAAK,GACnC,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,MAAM,OAAqB,OAAe,UAAoC;EAC7E,IAAI,CAAC,OACJ,SAAS;OACH,IAAI,QAAQ,MAAM,KAAK,KAAK,GAClC,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,MAAM,OAAqB,OAAe,UAAoC;EAC7E,IAAI,CAAC,OACJ,SAAS;OACH,IAAI,QAAQ,MAAM,KAAK,KAAK,GAClC,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,OAAO,OAAqB,OAAe,UAAoC;EAC9E,IAAI,QAAQ,OAAO,KAAK,KAAK,KAAK,CAAC,OAClC,SAAS;OAET,yBAAS,IAAI,MAAM,aAAa,CAAC;CAEnC;;;;CAIA,UAAU,OAAqB,OAAkC,UAAoC;EACpG,IAAI,UAAU;EACd,IAAI,OAAO,WAAW,GACrB,UAAU,QAAQ,UAAU,KAAK,KAAK;OAChC,IAAI,OAAO,WAAW,GAC5B,UAAU,QAAQ,mBAAmB,KAAK,KAAK;EAEhD,IAAI,SACH,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,eAAe,OAAqB,OAAe,UAAoC;EACtF,IAAI,UAAU,eACb,yBAAS,IAAI,MAAM,QAAQ,CAAC;OAE5B,SAAS;CAEX;;;;CAIA,SAAS,OAAqB,OAAe,UAAoC;EAChF,IAAI,QAAQ,SAAS,KAAK,KAAK,GAC9B,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,IAAI,OAAqB,OAAe,UAAoC;EAC3E,IAAI,QAAQ,IAAI,KAAK,KAAK,GACzB,SAAS;OAET,yBAAS,IAAI,MAAM,aAAa,CAAC;CAEnC;;;;CAIA,SAAS,OAAqB,OAAe,UAAoC;EAChF,IAAI,QAAQ,SAAS,KAAK,KAAK,GAC9B,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,QAAQ,OAAqB,OAAe,UAAoC;EAC/E,IAAI,QAAQ,QAAQ,KAAK,KAAK,GAC7B,SAAS;OAET,yBAAS,IAAI,MAAM,qCAAqC,CAAC;CAE3D;;;;CAIA,SAAS,OAAqB,OAAe,UAAoC;EAChF,IAAI,QAAQ,SAAS,KAAK,KAAK,GAC9B,SAAS;OAET,yBAAS,IAAI,MAAM,6BAA6B,CAAC;CAEnD;;;;CAIA,eAAe,OAAqB,OAAe,UAAoC;EACtF,IAAI,QAAQ,eAAe,KAAK,KAAK,GACpC,SAAS;OAET,yBAAS,IAAI,MAAM,iCAAiC,CAAC;CAEvD;;;;CAIA,QAAQ,OAAqB,OAAe,UAAoC;EAC/E,IAAI,QAAQ,QAAQ,KAAK,KAAK,GAC7B,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,QAAQ,OAAqB,OAAe,UAAoC;EAC/E,IAAI,QAAQ,QAAQ,KAAK,KAAK,GAC7B,SAAS;OAET,yBAAS,IAAI,MAAM,YAAY,CAAC;CAElC;;;;CAIA,cAAc,SAAiB,UAAU,QAAsB;EAC9D,OAAO;GACN,UAAU;GACV;GACA;EACD;CACD;;;;CAIA,eAAe,SAAiB,UAAU,UAAwB;EACjE,OAAO;GACN,UAAU;GACV;GACA;EACD;CACD;AACD"}
|
|
@@ -79,7 +79,7 @@ var image_default = defineComponent({
|
|
|
79
79
|
emit("error", event);
|
|
80
80
|
}
|
|
81
81
|
}), {
|
|
82
|
-
error: () => slots.error ? slots.error
|
|
82
|
+
error: () => slots.error ? slots.error() : createVNode("div", { "class": "fa-image__error-image" }, [createVNode(ElIcon, { "class": "icon" }, { default: () => [createVNode(Picture, null, null)] })]),
|
|
83
83
|
...slots.placeholder && { placeholder: () => slots.placeholder?.() ?? [] },
|
|
84
84
|
...slots.viewer && { viewer: () => slots.viewer?.({ src: state.src }) ?? [] },
|
|
85
85
|
...slots.progress && { progress: (scope) => slots.progress?.(scope) ?? [] },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.mjs","names":["viewer-error"],"sources":["../../../../src/components/image/src/image.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch } from \"vue\";\nimport { Picture as ElIconPicture } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, imageEmits, imageProps } from \"element-plus\";\nimport { makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ImageInstance, ImageViewerAction } from \"element-plus\";\nimport type { VNode } from \"vue\";\n\n/** FaImage 的运行时 Props 定义。 */\nexport const faImageProps = {\n\t...imageProps,\n\t/** @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */\n\thideOnClickModal: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */\n\tpreviewTeleported: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether to use lazy load. */\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description Base64图片 */\n\tbase64: Boolean,\n\t/** @description 原图 */\n\toriginal: Boolean,\n\t/** @description 标准 */\n\tnormal: Boolean,\n\t/** @description 小图 */\n\tsmall: Boolean,\n\t/** @description 缩略图 */\n\tthumb: Boolean,\n\t/** @description 是否可以预览图片 */\n\tpreview: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n};\n\n/** FaImage 的运行时事件定义。 */\nexport const faImageEmits = {\n\t...imageEmits,\n};\n\n/** FaImage 的插槽参数。 */\nexport interface FaImageSlots extends Record<string, unknown> {\n\t/** @description 当图像尚未加载时,自定义的占位符内容 */\n\tplaceholder: never;\n\t/** @description 自定义图像加载失败的内容 */\n\terror: never;\n\t/** @description 当图像预览时自定义内容 */\n\tviewer: { src?: string };\n\t/** @description 图片预览进度内容 */\n\tprogress: { activeIndex: number; total: number };\n\t/** @description 图片预览工具栏内容 */\n\ttoolbar: {\n\t\tactions: (action: ImageViewerAction, options?: Record<string, never>) => void;\n\t\tprev: () => void;\n\t\tnext: () => void;\n\t\treset: () => void;\n\t\tactiveIndex: number;\n\t\tsetActiveItem: (index: number) => void;\n\t};\n\t/** @description 图片预览加载失败内容 */\n\t\"viewer-error\": { activeIndex: number; src: string };\n}\n\nexport default defineComponent({\n\tname: \"FaImage\",\n\tprops: faImageProps,\n\temits: faImageEmits,\n\tslots: makeSlots<FaImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\t/** 图片加载错误 */\n\t\t\tloadError: false,\n\t\t\tsrc: computed(() => {\n\t\t\t\tif (!props.src) return undefined;\n\t\t\t\tif (props.base64) {\n\t\t\t\t\treturn `data:image/png;base64,${props.src}`;\n\t\t\t\t} else if (props.original || state.loadError) {\n\t\t\t\t\treturn props.src;\n\t\t\t\t} else if (props.normal) {\n\t\t\t\t\treturn `${props.src}@!normal`;\n\t\t\t\t} else if (props.small) {\n\t\t\t\t\treturn `${props.src}@!small`;\n\t\t\t\t} else if (props.thumb) {\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t} else {\n\t\t\t\t\t// 默认使用缩略图\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tpreviewList: computed(() => (props.preview && props.src ? [props.base64 ? `data:image/png;base64,${props.src}` : props.src] : [])),\n\t\t});\n\t\tconst imageRef = ref<ImageInstance>();\n\n\t\twatch(\n\t\t\t() => props.src,\n\t\t\t() => {\n\t\t\t\tstate.loadError = false;\n\t\t\t}\n\t\t);\n\n\t\tconst bindProps = useProps(props, imageProps, [\"src\", \"previewSrcList\"]);\n\t\tconst bindEmits = useEmits(imageEmits, emit, [\"error\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElImage\n\t\t\t\t{...bindProps.value}\n\t\t\t\t{...bindEmits.value}\n\t\t\t\tclass=\"fa-image\"\n\t\t\t\tref={imageRef}\n\t\t\t\tsrc={state.src}\n\t\t\t\tpreviewSrcList={state.previewList}\n\t\t\t\tonError={(event) => {\n\t\t\t\t\tstate.loadError ||= true;\n\t\t\t\t\temit(\"error\", event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\terror: () =>\n\t\t\t\t\t\tslots.error ? (\n\t\t\t\t\t\t\
|
|
1
|
+
{"version":3,"file":"image.mjs","names":["viewer-error"],"sources":["../../../../src/components/image/src/image.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch } from \"vue\";\nimport { Picture as ElIconPicture } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, imageEmits, imageProps } from \"element-plus\";\nimport { makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ImageInstance, ImageViewerAction } from \"element-plus\";\nimport type { VNode } from \"vue\";\n\n/** FaImage 的运行时 Props 定义。 */\nexport const faImageProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...imageProps,\n\t/** @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode. */\n\thideOnClickModal: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`. */\n\tpreviewTeleported: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether to use lazy load. */\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description Base64图片 */\n\tbase64: Boolean,\n\t/** @description 原图 */\n\toriginal: Boolean,\n\t/** @description 标准 */\n\tnormal: Boolean,\n\t/** @description 小图 */\n\tsmall: Boolean,\n\t/** @description 缩略图 */\n\tthumb: Boolean,\n\t/** @description 是否可以预览图片 */\n\tpreview: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n};\n\n/** FaImage 的运行时事件定义。 */\nexport const faImageEmits = {\n\t...imageEmits,\n};\n\n/** FaImage 的插槽参数。 */\nexport interface FaImageSlots extends Record<string, unknown> {\n\t/** @description 当图像尚未加载时,自定义的占位符内容 */\n\tplaceholder: never;\n\t/** @description 自定义图像加载失败的内容 */\n\terror: never;\n\t/** @description 当图像预览时自定义内容 */\n\tviewer: { src?: string };\n\t/** @description 图片预览进度内容 */\n\tprogress: { activeIndex: number; total: number };\n\t/** @description 图片预览工具栏内容 */\n\ttoolbar: {\n\t\tactions: (action: ImageViewerAction, options?: Record<string, never>) => void;\n\t\tprev: () => void;\n\t\tnext: () => void;\n\t\treset: () => void;\n\t\tactiveIndex: number;\n\t\tsetActiveItem: (index: number) => void;\n\t};\n\t/** @description 图片预览加载失败内容 */\n\t\"viewer-error\": { activeIndex: number; src: string };\n}\n\nexport default defineComponent({\n\tname: \"FaImage\",\n\tprops: faImageProps,\n\temits: faImageEmits,\n\tslots: makeSlots<FaImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\t/** 图片加载错误 */\n\t\t\tloadError: false,\n\t\t\tsrc: computed(() => {\n\t\t\t\tif (!props.src) return undefined;\n\t\t\t\tif (props.base64) {\n\t\t\t\t\treturn `data:image/png;base64,${props.src}`;\n\t\t\t\t} else if (props.original || state.loadError) {\n\t\t\t\t\treturn props.src;\n\t\t\t\t} else if (props.normal) {\n\t\t\t\t\treturn `${props.src}@!normal`;\n\t\t\t\t} else if (props.small) {\n\t\t\t\t\treturn `${props.src}@!small`;\n\t\t\t\t} else if (props.thumb) {\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t} else {\n\t\t\t\t\t// 默认使用缩略图\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tpreviewList: computed(() => (props.preview && props.src ? [props.base64 ? `data:image/png;base64,${props.src}` : props.src] : [])),\n\t\t});\n\t\tconst imageRef = ref<ImageInstance>();\n\n\t\twatch(\n\t\t\t() => props.src,\n\t\t\t() => {\n\t\t\t\tstate.loadError = false;\n\t\t\t}\n\t\t);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst bindProps = useProps(props, imageProps, [\"src\", \"previewSrcList\"]);\n\t\tconst bindEmits = useEmits(imageEmits, emit, [\"error\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElImage\n\t\t\t\t{...bindProps.value}\n\t\t\t\t{...bindEmits.value}\n\t\t\t\tclass=\"fa-image\"\n\t\t\t\tref={imageRef}\n\t\t\t\tsrc={state.src}\n\t\t\t\tpreviewSrcList={state.previewList}\n\t\t\t\tonError={(event) => {\n\t\t\t\t\tstate.loadError ||= true;\n\t\t\t\t\temit(\"error\", event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\terror: () =>\n\t\t\t\t\t\tslots.error ? (\n\t\t\t\t\t\t\tslots.error()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div class=\"fa-image__error-image\">\n\t\t\t\t\t\t\t\t<ElIcon class=\"icon\">\n\t\t\t\t\t\t\t\t\t<ElIconPicture />\n\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t...(slots.placeholder && { placeholder: (): VNode[] => slots.placeholder?.() ?? [] }),\n\t\t\t\t\t...(slots.viewer && { viewer: (): VNode[] => slots.viewer?.({ src: state.src }) ?? [] }),\n\t\t\t\t\t...(slots.progress && {\n\t\t\t\t\t\tprogress: (scope: { activeIndex: number; total: number }): VNode[] => slots.progress?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots.toolbar && {\n\t\t\t\t\t\ttoolbar: (scope: FaImageSlots[\"toolbar\"]): VNode[] => slots.toolbar?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t\t...(slots[\"viewer-error\"] && {\n\t\t\t\t\t\t\"viewer-error\": (scope: { activeIndex: number; src: string }): VNode[] => slots[\"viewer-error\"]?.(scope) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElImage>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 手动打开图片预览。 */\n\t\t\tshowPreview: computed(() => imageRef.value?.showPreview),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAQA,MAAa,eAAe;CAE3B,GAAG;;CAEH,kBAAkB;EACjB,MAAM;EACN,SAAS;CACV;;CAEA,mBAAmB;EAClB,MAAM;EACN,SAAS;CACV;;CAEA,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,QAAQ;;CAER,UAAU;;CAEV,QAAQ;;CAER,OAAO;;CAEP,OAAO;;CAEP,SAAS;EACR,MAAM;EACN,SAAS;CACV;AACD;;AAGA,MAAa,eAAe,EAC3B,GAAG,WACJ;AAyBA,IAAA,gBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAwB;CAC/B,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,QAAQ,SAAS;;GAEtB,WAAW;GACX,KAAK,eAAe;IACnB,IAAI,CAAC,MAAM,KAAK,OAAO,KAAA;IACvB,IAAI,MAAM,QACT,OAAO,yBAAyB,MAAM;SAChC,IAAI,MAAM,YAAY,MAAM,WAClC,OAAO,MAAM;SACP,IAAI,MAAM,QAChB,OAAO,GAAG,MAAM,IAAG;SACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;SACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;SAGnB,OAAO,GAAG,MAAM,IAAG;GAErB,CAAC;GACD,aAAa,eAAgB,MAAM,WAAW,MAAM,MAAM,CAAC,MAAM,SAAS,yBAAyB,MAAM,QAAQ,MAAM,GAAG,IAAI,CAAA,CAAG;EAClI,CAAC;EACD,MAAM,WAAW,IAAmB;EAEpC,YACO,MAAM,WACN;GACL,MAAM,YAAY;EACnB,CACD;EAGA,MAAM,YAAY,SAAS,OAAO,YAAY,CAAC,OAAO,gBAAgB,CAAC;EACvE,MAAM,YAAY,SAAS,YAAY,MAAM,CAAC,OAAO,CAAC;EAEtD,gBAAU,YAAA,SAAA,WAEJ,UAAU,OACV,UAAU,OAAK;GAAA,SAAA;GAAA,OAEd;GAAQ,OACR,MAAM;GAAG,kBACE,MAAM;GAAW,YACvB,UAAU;IACnB,MAAM,cAAc;IACpB,KAAK,SAAS,KAAK;GACpB;EAAC,CAAA,GAAA;GAGA,aACC,MAAM,QACL,MAAM,MAAM,IAAC,YAAA,OAAA,EAAA,SAAA,wBAAA,GAAA,CAAA,YAAA,QAAA,EAAA,SAAA,OAAA,GAAA,EAAA,eAAA,CAAA,YAAA,SAAA,MAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA;GAQf,GAAI,MAAM,eAAe,EAAE,mBAA4B,MAAM,cAAc,KAAK,CAAA,EAAG;GACnF,GAAI,MAAM,UAAU,EAAE,cAAuB,MAAM,SAAS,EAAE,KAAK,MAAM,IAAI,CAAC,KAAK,CAAA,EAAG;GACtF,GAAI,MAAM,YAAY,EACrB,WAAW,UAA2D,MAAM,WAAW,KAAK,KAAK,CAAA,EAClG;GACA,GAAI,MAAM,WAAW,EACpB,UAAU,UAA4C,MAAM,UAAU,KAAK,KAAK,CAAA,EACjF;GACA,GAAI,MAAM,mBAAmB,EAC5B,iBAAiB,UAAyD,MAAM,eAAe,GAAG,KAAK,KAAK,CAAA,EAC7G;EAAE,CAAA,CAGJ;EAED,OAAO,UAAU,QAAQ;;AAExB,aAAa,eAAe,SAAS,OAAO,WAAW,EACxD,CAAC;CACF;AACD,CAAC"}
|
|
@@ -5,7 +5,7 @@ import type { DefaultRow, PagedInput, PagedResult } from "../../table";
|
|
|
5
5
|
export declare const faInputDialogPageProps: {
|
|
6
6
|
/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
7
7
|
rowKey: {
|
|
8
|
-
type: PropType<TableProps<DefaultRow>["rowKey"]
|
|
8
|
+
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
11
|
/** @description v-model绑定值 */
|
|
@@ -50,7 +50,7 @@ export interface FaInputDialogPageSlots extends Record<string, unknown> {
|
|
|
50
50
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
51
51
|
/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
52
52
|
rowKey: {
|
|
53
|
-
type: PropType<TableProps<DefaultRow>["rowKey"]
|
|
53
|
+
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
54
54
|
default: string;
|
|
55
55
|
};
|
|
56
56
|
/** @description v-model绑定值 */
|
|
@@ -94,7 +94,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
94
94
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
95
95
|
/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
|
|
96
96
|
rowKey: {
|
|
97
|
-
type: PropType<TableProps<DefaultRow>["rowKey"]
|
|
97
|
+
type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
|
|
98
98
|
default: string;
|
|
99
99
|
};
|
|
100
100
|
/** @description v-model绑定值 */
|
|
@@ -128,7 +128,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
128
128
|
}>, {
|
|
129
129
|
disabled: boolean;
|
|
130
130
|
placeholder: string;
|
|
131
|
-
rowKey: string | ((row: DefaultRow) => string) | undefined
|
|
131
|
+
rowKey: NonNullable<string | ((row: DefaultRow) => string) | undefined>;
|
|
132
132
|
labelKey: string;
|
|
133
133
|
}, import("../../../utils").TypedSlotsDeclaration<FaInputDialogPageSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
134
134
|
export default _default;
|
|
@@ -119,9 +119,7 @@ var inputDialogPage_default = defineComponent({
|
|
|
119
119
|
}, null), createVNode(ElButton, {
|
|
120
120
|
"disabled": props.disabled,
|
|
121
121
|
"icon": Search,
|
|
122
|
-
"onClick":
|
|
123
|
-
handleSearchClick();
|
|
124
|
-
}
|
|
122
|
+
"onClick": handleSearchClick
|
|
125
123
|
}, null)] }) }), createVNode(FaDialog, {
|
|
126
124
|
"ref": faDialogRef,
|
|
127
125
|
"style": "--height: 70%;",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { computed, defineComponent, reactive, ref } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props 定义。 */\nexport const faInputDialogPageProps = {\n\t/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<TableProps<DefaultRow>[\"rowKey\"]
|
|
1
|
+
{"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { computed, defineComponent, reactive, ref } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { isFunction, isNull, isNumber, isString } from \"lodash-unified\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props 定义。 */\nexport const faInputDialogPageProps = {\n\t/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<NonNullable<TableProps<DefaultRow>[\"rowKey\"]>>,\n\t\tdefault: \"id\",\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: [String, Number] as PropType<string | number | null>,\n\t/** @description v-model:label绑定值 */\n\tlabel: String as PropType<string | null>,\n\t/** @description 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** @description 禁用 */\n\tdisabled: Boolean,\n\t/** @description 标题 */\n\ttitle: String,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n\t/** @description 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\n/** FaInputDialogPage 的运行时 Emits 定义。 */\nexport const faInputDialogPageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number | null): boolean => isString(value) || isNumber(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | null): boolean => isString(value) || isNull(value),\n\t/** @description 选中数据改变 */\n\tchange: (_data: DefaultRow | null, _value?: string | number | null): boolean => true,\n};\n\n/** FaInputDialogPage 的插槽参数。 */\nexport interface FaInputDialogPageSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaInputDialogPage\",\n\tprops: faInputDialogPageProps,\n\temits: faInputDialogPageEmits,\n\tslots: makeSlots<FaInputDialogPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst modelValue = useVModel(props, \"modelValue\", emit, { passive: true });\n\t\tconst selectedLabel = useVModel(props, \"label\", emit, { passive: true });\n\n\t\tconst state = reactive({\n\t\t\tselectionRow: withDefineType<DefaultRow | undefined>(),\n\t\t});\n\n\t\tconst faDialogRef = ref<FaDialogInstance>();\n\t\tconst faTableRef = ref<FaTableInstance>();\n\n\t\tconst handleDeleteClick = (): void => {\n\t\t\tmodelValue.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\tstate.selectionRow = undefined;\n\t\t\temit(\"change\", null, null);\n\t\t};\n\n\t\tconst handleSearchClick = async (): Promise<void> => {\n\t\t\tawait faDialogRef.value?.open(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tif (table === undefined) return;\n\t\t\t\tif (state.selectionRow) {\n\t\t\t\t\t// 判断当前行是否选中\n\t\t\t\t\tconst rawRowKey: unknown = isFunction(props.rowKey) ? props.rowKey(state.selectionRow) : state.selectionRow[props.rowKey];\n\t\t\t\t\tconst rowSelected = (typeof rawRowKey === \"string\" || typeof rawRowKey === \"number\") && table.selectedListIds.includes(rawRowKey);\n\t\t\t\t\tif (!rowSelected) {\n\t\t\t\t\t\ttable.toggleRowSelection?.(state.selectionRow);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tfaDialogRef.value?.close(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tconst selectedData = table?.selectedList[0];\n\t\t\t\tif (table?.selected && selectedData) {\n\t\t\t\t\tstate.selectionRow = selectedData;\n\t\t\t\t\tconst selectedValue: unknown = isFunction(props.rowKey) ? props.rowKey(selectedData) : selectedData[props.rowKey];\n\t\t\t\t\tmodelValue.value = typeof selectedValue === \"string\" || typeof selectedValue === \"number\" ? selectedValue : null;\n\t\t\t\t\tconst label: unknown = selectedData[props.labelKey];\n\t\t\t\t\tselectedLabel.value = typeof label === \"string\" ? label : null;\n\t\t\t\t\temit(\"change\", selectedData, modelValue.value);\n\t\t\t\t} else {\n\t\t\t\t\tmodelValue.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectionRow = undefined;\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleTableRowDblclick = (row: DefaultRow): void => {\n\t\t\tfaTableRef.value?.clearSelection?.();\n\t\t\tfaTableRef.value?.toggleRowSelection?.(row);\n\t\t\tstate.selectionRow = row;\n\t\t\thandleConfirmClick();\n\t\t};\n\n\t\tuseRender(() => (\n\t\t\t<div class=\"fa-input-dialog-page\">\n\t\t\t\t<ElInput vModel={selectedLabel.value} placeholder={props.placeholder} disabled={props.disabled} readonly>\n\t\t\t\t\t{{\n\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t<ElButtonGroup>\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Delete} onClick={handleDeleteClick} />\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Search} onClick={handleSearchClick} />\n\t\t\t\t\t\t\t</ElButtonGroup>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElInput>\n\t\t\t\t<FaDialog\n\t\t\t\t\tref={faDialogRef}\n\t\t\t\t\tstyle=\"--height: 70%;\"\n\t\t\t\t\twidth=\"50%\"\n\t\t\t\t\ttitle={props.title}\n\t\t\t\t\tfullHeight\n\t\t\t\t\tdisabledConfirmButton={!faTableRef.value?.selected}\n\t\t\t\t\tonConfirmClick={handleConfirmClick}\n\t\t\t\t>\n\t\t\t\t\t<FaTable\n\t\t\t\t\t\tref={faTableRef}\n\t\t\t\t\t\trowKey={props.rowKey}\n\t\t\t\t\t\trequestApi={props.requestApi}\n\t\t\t\t\t\tinitParam={props.initParam}\n\t\t\t\t\t\tsingle\n\t\t\t\t\t\trowClickSelection\n\t\t\t\t\t\thideSearchTime\n\t\t\t\t\t\tonRowDblclick={handleTableRowDblclick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</FaTable>\n\t\t\t\t</FaDialog>\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 选择行数据 */\n\t\t\tselectionRow: computed(() => state.selectionRow),\n\t\t\t/** @description 打开选择器弹窗 */\n\t\t\topen: handleSearchClick,\n\t\t\t/** @description 清除选择 */\n\t\t\tclear: handleDeleteClick,\n\t\t});\n\t},\n});\n"],"mappings":"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"}
|
|
@@ -8,7 +8,7 @@ export declare const FaLayoutGrid: TSXWithInstall<typeof LayoutGrid> & {
|
|
|
8
8
|
export default FaLayoutGrid;
|
|
9
9
|
/** 可独立注册的响应式布局项组件。 */
|
|
10
10
|
export declare const FaLayoutGridItem: TSXWithInstall<typeof LayoutGridItem>;
|
|
11
|
-
export * from "./src/layoutGrid.type";
|
|
11
|
+
export type * from "./src/layoutGrid.type";
|
|
12
12
|
export type { FaLayoutGridSlots } from "./src/layoutGrid";
|
|
13
13
|
export type { FaLayoutGridItemSlots } from "./src/layoutGridItem";
|
|
14
14
|
/** FaLayoutGrid 暴露的组件实例类型。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["LayoutGrid","LayoutGridItem"],"sources":["../../../src/components/layoutGrid/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport LayoutGrid from \"./src/layoutGrid\";\nimport LayoutGridItem from \"./src/layoutGridItem\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 根据断点和容器宽度排列内容的响应式布局组件。 */\nexport const FaLayoutGrid: TSXWithInstall<typeof LayoutGrid> & { LayoutGridItem: typeof LayoutGridItem } = withInstall(LayoutGrid, {\n\tLayoutGridItem,\n});\nexport default FaLayoutGrid;\n\n/** 可独立注册的响应式布局项组件。 */\nexport const FaLayoutGridItem: TSXWithInstall<typeof LayoutGridItem> = withNoopInstall(LayoutGridItem);\n\nexport * from \"./src/layoutGrid.type\";\nexport type { FaLayoutGridSlots } from \"./src/layoutGrid\";\nexport type { FaLayoutGridItemSlots } from \"./src/layoutGridItem\";\n\n/** FaLayoutGrid 暴露的组件实例类型。 */\nexport type FaLayoutGridInstance = InstanceType<typeof LayoutGrid>;\n\n/** FaLayoutGridItem 暴露的组件实例类型。 */\nexport type FaLayoutGridItemInstance = InstanceType<typeof LayoutGridItem>;\n"],"mappings":";;;;;AAMA,MAAa,eAA8F,YAAYA,oBAAY,EAClI,gBAAA,uBACD,CAAC;;AAID,MAAa,mBAA0D,gBAAgBC,sBAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["LayoutGrid","LayoutGridItem"],"sources":["../../../src/components/layoutGrid/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport LayoutGrid from \"./src/layoutGrid\";\nimport LayoutGridItem from \"./src/layoutGridItem\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 根据断点和容器宽度排列内容的响应式布局组件。 */\nexport const FaLayoutGrid: TSXWithInstall<typeof LayoutGrid> & { LayoutGridItem: typeof LayoutGridItem } = withInstall(LayoutGrid, {\n\tLayoutGridItem,\n});\nexport default FaLayoutGrid;\n\n/** 可独立注册的响应式布局项组件。 */\nexport const FaLayoutGridItem: TSXWithInstall<typeof LayoutGridItem> = withNoopInstall(LayoutGridItem);\n\nexport type * from \"./src/layoutGrid.type\";\nexport type { FaLayoutGridSlots } from \"./src/layoutGrid\";\nexport type { FaLayoutGridItemSlots } from \"./src/layoutGridItem\";\n\n/** FaLayoutGrid 暴露的组件实例类型。 */\nexport type FaLayoutGridInstance = InstanceType<typeof LayoutGrid>;\n\n/** FaLayoutGridItem 暴露的组件实例类型。 */\nexport type FaLayoutGridItemInstance = InstanceType<typeof LayoutGridItem>;\n"],"mappings":";;;;;AAMA,MAAa,eAA8F,YAAYA,oBAAY,EAClI,gBAAA,uBACD,CAAC;;AAID,MAAa,mBAA0D,gBAAgBC,sBAAc"}
|
|
@@ -7,7 +7,7 @@ export interface FaLayoutGridSlots extends Record<string, unknown> {
|
|
|
7
7
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
/** @description Grid布局列配置 */
|
|
9
9
|
cols: {
|
|
10
|
-
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakPoint, number
|
|
10
|
+
type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakPoint, number>>>;
|
|
11
11
|
default: () => Record<FaLayoutGridBreakPoint, number>;
|
|
12
12
|
};
|
|
13
13
|
/** @description 折叠 */
|
|
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
33
33
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
34
|
/** @description Grid布局列配置 */
|
|
35
35
|
cols: {
|
|
36
|
-
type: import("vue").PropType<string | number | Record<FaLayoutGridBreakPoint, number
|
|
36
|
+
type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakPoint, number>>>;
|
|
37
37
|
default: () => Record<FaLayoutGridBreakPoint, number>;
|
|
38
38
|
};
|
|
39
39
|
/** @description 折叠 */
|
|
@@ -54,7 +54,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
54
54
|
}) => any) | undefined;
|
|
55
55
|
}>, {
|
|
56
56
|
collapsed: boolean;
|
|
57
|
-
cols: string | number | Record<FaLayoutGridBreakPoint, number
|
|
57
|
+
cols: string | number | Partial<Record<FaLayoutGridBreakPoint, number>>;
|
|
58
58
|
collapsedRows: string | number;
|
|
59
59
|
gap: number | [number, number];
|
|
60
60
|
}, import("../../../utils").TypedSlotsDeclaration<FaLayoutGridSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -124,8 +124,8 @@ breakPointChange: ({ breakPoint: _breakPoint }) => true },
|
|
|
124
124
|
const fields = [];
|
|
125
125
|
let suffix;
|
|
126
126
|
defaultSlot.forEach((slot) => {
|
|
127
|
-
if (typeof slot.type === "object" &&
|
|
128
|
-
if (typeof slot.type === "symbol" && Array.isArray(slot
|
|
127
|
+
if (typeof slot.type === "object" && "name" in slot.type && slot.type.name === "FaLayoutGridItem" && slot.props?.["suffix"] !== void 0) suffix = slot;
|
|
128
|
+
if (typeof slot.type === "symbol" && Array.isArray(slot.children)) fields.push(...slot.children);
|
|
129
129
|
});
|
|
130
130
|
let suffixCols = 0;
|
|
131
131
|
if (suffix?.props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, watch } from \"vue\";\nimport { isArray, isNumber, isObject } from \"lodash-unified\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { VNode, VNodeArrayChildren } from \"vue\";\nimport type { FaLayoutGridBreakPoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGrid 的插槽参数。 */\nexport interface FaLayoutGridSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGrid\",\n\tprops: {\n\t\t/** @description Grid布局列配置 */\n\t\tcols: {\n\t\t\ttype: definePropType<string | number | Record<FaLayoutGridBreakPoint, number
|
|
1
|
+
{"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, watch } from \"vue\";\nimport { isArray, isNumber, isObject } from \"lodash-unified\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { VNode, VNodeArrayChildren } from \"vue\";\nimport type { FaLayoutGridBreakPoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGrid 的插槽参数。 */\nexport interface FaLayoutGridSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGrid\",\n\tprops: {\n\t\t/** @description Grid布局列配置 */\n\t\tcols: {\n\t\t\ttype: definePropType<string | number | Partial<Record<FaLayoutGridBreakPoint, number>>>([String, Number, Object]),\n\t\t\tdefault: (): Record<FaLayoutGridBreakPoint, number> => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t\t},\n\t\t/** @description 折叠 */\n\t\tcollapsed: Boolean,\n\t\t/** @description 折叠行数 */\n\t\tcollapsedRows: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 间距,偏移 */\n\t\tgap: {\n\t\t\ttype: definePropType<number | [number, number]>([Number, Array]),\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 断点变化事件 */\n\t\tbreakPointChange: ({ breakPoint: _breakPoint }: { breakPoint: FaLayoutGridBreakPoint }) => true,\n\t},\n\tslots: makeSlots<FaLayoutGridSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst divElRef = ref<HTMLElement>();\n\n\t\t// 注入 gap 间距\n\t\tprovide(\"gap\", isArray(props.gap) ? props.gap[0] : props.gap);\n\n\t\t// 注入响应式断点\n\t\tconst breakPoint = ref<FaLayoutGridBreakPoint>(\"xl\");\n\t\tprovide(\"breakPoint\", breakPoint);\n\n\t\t// 注入要开始折叠的 index\n\t\tconst hiddenIndex = ref(-1);\n\t\tprovide(\"shouldHiddenIndex\", hiddenIndex);\n\n\t\t// 注入 cols\n\t\tconst cols = computed<string | number>(() => {\n\t\t\tif (isObject(props.cols)) return props.cols[breakPoint.value] ?? 1;\n\t\t\treturn props.cols;\n\t\t});\n\t\tprovide(\"cols\", cols);\n\n\t\tconst collapsedRows = isNumber(props.collapsedRows) ? props.collapsedRows : Number(props.collapsedRows);\n\n\t\t// 断点映射\n\t\tconst breakpoints = {\n\t\t\t// 小于480屏幕(如手机)\n\t\t\txs: { min: 0, max: 479 },\n\t\t\t// 平板竖屏\n\t\t\tsm: { min: 480, max: 768 },\n\t\t\t// 平板横屏\n\t\t\tmd: { min: 768, max: 1024 },\n\t\t\t// 小型桌面\n\t\t\tlg: { min: 1024, max: 1440 },\n\t\t\t// 大型桌面\n\t\t\txl: { min: 1440, max: Infinity },\n\t\t};\n\n\t\t// 监听屏幕变化\n\t\tconst resize = (e: ResizeObserverEntry[]): void => {\n\t\t\t// 当前只监听布局容器,ResizeObserver 每次回调应当只有一个目标。\n\t\t\tif (e.length !== 1 || e[0] === undefined) throw new Error(\"FaLayoutGrid 监听到了非预期数量的布局容器。\");\n\t\t\tconst curEl = e[0];\n\t\t\tconst width = curEl.target.scrollWidth;\n\n\t\t\tfor (const [key, { min, max }] of Object.entries(breakpoints)) {\n\t\t\t\tif (width >= min && width <= max) {\n\t\t\t\t\tbreakPoint.value = key as FaLayoutGridBreakPoint;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tlet resizeObserver: ResizeObserver | undefined;\n\t\tconst observeResize = (): void => {\n\t\t\tconst element = divElRef.value;\n\t\t\tif (!element) return;\n\t\t\tresizeObserver?.disconnect();\n\t\t\tresizeObserver = new ResizeObserver(resize);\n\t\t\tresizeObserver.observe(element);\n\t\t};\n\n\t\tonMounted(() => {\n\t\t\tnextTick(observeResize);\n\n\t\t\t// 断点变化时 执行 findIndex\n\t\t\twatch(\n\t\t\t\t() => breakPoint.value,\n\t\t\t\t(newValue) => {\n\t\t\t\t\temit(\"breakPointChange\", { breakPoint: newValue });\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timmediate: true,\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tonActivated(() => {\n\t\t\tnextTick(observeResize);\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tonDeactivated(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\t// 设置间距\n\t\tconst gap = computed(() => {\n\t\t\tif (isNumber(props.gap)) return `${props.gap}px`;\n\t\t\tif (isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;\n\t\t\treturn \"unset\";\n\t\t});\n\n\t\t// 设置 style\n\t\tconst style = computed(() => {\n\t\t\treturn {\n\t\t\t\tdisplay: \"grid\",\n\t\t\t\tgridGap: gap.value,\n\t\t\t\tgridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`,\n\t\t\t};\n\t\t});\n\n\t\tuseRender(() => {\n\t\t\tconst defaultSlot = slots.default?.() ?? [];\n\n\t\t\tif (props.collapsed) {\n\t\t\t\tconst fields: VNodeArrayChildren = [];\n\t\t\t\tlet suffix: VNode | undefined;\n\n\t\t\t\tdefaultSlot.forEach((slot) => {\n\t\t\t\t\t// suffix\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof slot.type === \"object\" &&\n\t\t\t\t\t\t\"name\" in slot.type &&\n\t\t\t\t\t\tslot.type.name === \"FaLayoutGridItem\" &&\n\t\t\t\t\t\tslot.props?.[\"suffix\"] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\tsuffix = slot;\n\t\t\t\t\t}\n\t\t\t\t\t// slot children\n\t\t\t\t\tif (typeof slot.type === \"symbol\" && Array.isArray(slot.children)) fields.push(...slot.children);\n\t\t\t\t});\n\n\t\t\t\t// 计算 suffix 所占用的列\n\t\t\t\tlet suffixCols = 0;\n\t\t\t\tif (suffix?.props) {\n\t\t\t\t\tconst breakPointProps = suffix.props[breakPoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\tsuffixCols =\n\t\t\t\t\t\t(breakPointProps?.span ?? Number(suffix.props[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(breakPointProps?.offset ?? Number(suffix.props[\"offset\"] ?? 0));\n\t\t\t\t}\n\n\t\t\t\tlet occupiedCols = 0;\n\t\t\t\thiddenIndex.value = -1;\n\t\t\t\tfor (const [index, current] of fields.entries()) {\n\t\t\t\t\tconst currentVNode = current as VNode;\n\t\t\t\t\tconst currentProps = currentVNode.props;\n\t\t\t\t\tif (currentProps === null) continue;\n\t\t\t\t\tconst breakPointProps = currentProps[breakPoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\toccupiedCols +=\n\t\t\t\t\t\t(breakPointProps?.span ?? Number(currentProps[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(breakPointProps?.offset ?? Number(currentProps[\"offset\"] ?? 0));\n\t\t\t\t\tif (occupiedCols > collapsedRows * Number(cols.value) - suffixCols) {\n\t\t\t\t\t\thiddenIndex.value = index;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thiddenIndex.value = -1;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div ref={divElRef} style={style.value}>\n\t\t\t\t\t{defaultSlot}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 响应式断点 */\n\t\t\tbreakPoint,\n\t\t});\n\t},\n});\n"],"mappings":"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"}
|
|
@@ -12,7 +12,7 @@ export default FaSelect;
|
|
|
12
12
|
export declare const FaSelectOption: TSXWithInstall<typeof SelectOption>;
|
|
13
13
|
export { faSelectProps };
|
|
14
14
|
export type { FaSelectSlots } from "./src/select";
|
|
15
|
-
export * from "./src/select.type";
|
|
15
|
+
export type * from "./src/select.type";
|
|
16
16
|
/** FaSelect 暴露的组件实例类型。 */
|
|
17
17
|
export type FaSelectInstance = InstanceType<typeof Select>;
|
|
18
18
|
/** FaSelect 的完整 Props 类型。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Select","SelectOption"],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport Select, { faSelectProps } from \"./src/select\";\nimport SelectOption from \"./src/selectOption\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\nimport type { faSelectEmits } from \"./src/select\";\n\n/** 支持远程数据、分页和自定义选项的选择器组件。 */\nexport const FaSelect: TSXWithInstall<typeof Select> & { SelectOption: typeof SelectOption } = withInstall(Select, {\n\tSelectOption,\n});\nexport default FaSelect;\n\n/** 可独立注册的 FaSelect 选项组件。 */\nexport const FaSelectOption: TSXWithInstall<typeof SelectOption> = withNoopInstall(SelectOption);\n\nexport { faSelectProps };\nexport type { FaSelectSlots } from \"./src/select\";\nexport * from \"./src/select.type\";\n\n/** FaSelect 暴露的组件实例类型。 */\nexport type FaSelectInstance = InstanceType<typeof Select>;\n\n/** FaSelect 的完整 Props 类型。 */\nexport type FaSelectProps = ExtractPropTypes<typeof faSelectProps>;\n\n/** FaSelect 的 Emits 类型。 */\nexport type FaSelectEmits = typeof faSelectEmits;\n\n/** FaSelectOption 暴露的组件实例类型。 */\nexport type FaSelectOptionInstance = InstanceType<typeof SelectOption>;\n"],"mappings":";;;;;AAQA,MAAa,WAAkF,YAAYA,gBAAQ,EAClH,cAAA,qBACD,CAAC;;AAID,MAAa,iBAAsD,gBAAgBC,oBAAY"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Select","SelectOption"],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport Select, { faSelectProps } from \"./src/select\";\nimport SelectOption from \"./src/selectOption\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\nimport type { faSelectEmits } from \"./src/select\";\n\n/** 支持远程数据、分页和自定义选项的选择器组件。 */\nexport const FaSelect: TSXWithInstall<typeof Select> & { SelectOption: typeof SelectOption } = withInstall(Select, {\n\tSelectOption,\n});\nexport default FaSelect;\n\n/** 可独立注册的 FaSelect 选项组件。 */\nexport const FaSelectOption: TSXWithInstall<typeof SelectOption> = withNoopInstall(SelectOption);\n\nexport { faSelectProps };\nexport type { FaSelectSlots } from \"./src/select\";\nexport type * from \"./src/select.type\";\n\n/** FaSelect 暴露的组件实例类型。 */\nexport type FaSelectInstance = InstanceType<typeof Select>;\n\n/** FaSelect 的完整 Props 类型。 */\nexport type FaSelectProps = ExtractPropTypes<typeof faSelectProps>;\n\n/** FaSelect 的 Emits 类型。 */\nexport type FaSelectEmits = typeof faSelectEmits;\n\n/** FaSelectOption 暴露的组件实例类型。 */\nexport type FaSelectOptionInstance = InstanceType<typeof SelectOption>;\n"],"mappings":";;;;;AAQA,MAAa,WAAkF,YAAYA,gBAAQ,EAClH,cAAA,qBACD,CAAC;;AAID,MAAa,iBAAsD,gBAAgBC,oBAAY"}
|
|
@@ -553,11 +553,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
553
553
|
__epPropKey: true;
|
|
554
554
|
};
|
|
555
555
|
}>> & Readonly<{
|
|
556
|
-
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
557
|
-
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
|
558
556
|
onClear?: (() => any) | undefined;
|
|
559
557
|
onChange?: ((_data: ElSelectorOutput<ElSelectorValue, any> | ElSelectorOutput<ElSelectorValue, any>[] | null, _value?: ElSelectorModelValue) => any) | undefined;
|
|
560
558
|
"onUpdate:modelValue"?: ((value: ElSelectorModelValue) => any) | undefined;
|
|
559
|
+
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
|
560
|
+
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
561
561
|
"onEnd-reached"?: ((direction: import("element-plus").ScrollbarDirection) => any) | undefined;
|
|
562
562
|
"onVisible-change"?: ((visible: boolean) => any) | undefined;
|
|
563
563
|
"onUpdate:label"?: ((value: string | string[] | null) => any) | undefined;
|
|
@@ -122,7 +122,7 @@ var select_default = defineComponent({
|
|
|
122
122
|
/** 首次出现 */
|
|
123
123
|
debut: true,
|
|
124
124
|
/** 回显 */
|
|
125
|
-
echo: props.data
|
|
125
|
+
echo: props.data.length > 0 ? false : true,
|
|
126
126
|
/** 下次刷新 */
|
|
127
127
|
nextRefresh: false
|
|
128
128
|
});
|
|
@@ -268,7 +268,7 @@ var select_default = defineComponent({
|
|
|
268
268
|
await loadData();
|
|
269
269
|
const firstItem = state.selectorData[0];
|
|
270
270
|
if (firstItem?.value !== void 0) handleModelValueUpdate(props.multiple ? [firstItem.value] : firstItem.value);
|
|
271
|
-
} else if (!props.requestApi && props.data
|
|
271
|
+
} else if (!props.requestApi && props.data.length > 0) {
|
|
272
272
|
state.debut = false;
|
|
273
273
|
await loadData();
|
|
274
274
|
} else if (!props.lazy) await loadData();
|