UNPKG

mldong-flow-designer-plus

Version:

本项目包含了作者为B站课堂视频[《工作流设计器开发最佳实践》](https://www.bilibili.com/cheese/play/ss24484)的过程源码。教程中开发的组件也可用于实际生产环境中。以下是和使用文档和课程章节说明。 ## 实战项目 [演示地址](https://flow-pro.mldong.com/)

261 lines (260 loc) 7.95 kB
import { inject, ref, computed, isRef, unref, getCurrentInstance } from "vue"; import { j as get, m as isEqual } from "./index-C41_Bymr.js"; import { a as buildProps, q as isFunction, k as isArray, g as definePropType, f as debugWarn } from "./error-DEV4o0cD.js"; var en_default = { name: "en", el: { breadcrumb: { label: "Breadcrumb" }, colorpicker: { confirm: "OK", clear: "Clear", defaultLabel: "color picker", description: "current color is {color}. press enter to select a new color.", alphaLabel: "pick alpha value", alphaDescription: "alpha {alpha}, current color is {color}", hueLabel: "pick hue value", hueDescription: "hue {hue}, current color is {color}", svLabel: "pick saturation and brightness value", svDescription: "saturation {saturation}, brightness {brightness}, current color is {color}", predefineDescription: "select {value} as the color" }, datepicker: { now: "Now", today: "Today", cancel: "Cancel", clear: "Clear", confirm: "OK", dateTablePrompt: "Use the arrow keys and enter to select the day of the month", monthTablePrompt: "Use the arrow keys and enter to select the month", yearTablePrompt: "Use the arrow keys and enter to select the year", selectedDate: "Selected date", selectDate: "Select date", selectTime: "Select time", startDate: "Start Date", startTime: "Start Time", endDate: "End Date", endTime: "End Time", prevYear: "Previous Year", nextYear: "Next Year", prevMonth: "Previous Month", nextMonth: "Next Month", year: "", month1: "January", month2: "February", month3: "March", month4: "April", month5: "May", month6: "June", month7: "July", month8: "August", month9: "September", month10: "October", month11: "November", month12: "December", weeks: { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat" }, weeksFull: { sun: "Sunday", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday" }, months: { jan: "Jan", feb: "Feb", mar: "Mar", apr: "Apr", may: "May", jun: "Jun", jul: "Jul", aug: "Aug", sep: "Sep", oct: "Oct", nov: "Nov", dec: "Dec" } }, inputNumber: { decrease: "decrease number", increase: "increase number" }, select: { loading: "Loading", noMatch: "No matching data", noData: "No data", placeholder: "Select" }, mention: { loading: "Loading" }, dropdown: { toggleDropdown: "Toggle Dropdown" }, cascader: { noMatch: "No matching data", loading: "Loading", placeholder: "Select", noData: "No data" }, pagination: { goto: "Go to", pagesize: "/page", total: "Total {total}", pageClassifier: "", page: "Page", prev: "Go to previous page", next: "Go to next page", currentPage: "page {pager}", prevPages: "Previous {pager} pages", nextPages: "Next {pager} pages", deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" }, dialog: { close: "Close this dialog" }, drawer: { close: "Close this dialog" }, messagebox: { title: "Message", confirm: "OK", cancel: "Cancel", error: "Illegal input", close: "Close this dialog" }, upload: { deleteTip: "press delete to remove", delete: "Delete", preview: "Preview", continue: "Continue" }, slider: { defaultLabel: "slider between {min} and {max}", defaultRangeStartLabel: "pick start value", defaultRangeEndLabel: "pick end value" }, table: { emptyText: "No Data", confirmFilter: "Confirm", resetFilter: "Reset", clearFilter: "All", sumText: "Sum", selectAllLabel: "Select all rows", selectRowLabel: "Select this row", expandRowLabel: "Expand this row", collapseRowLabel: "Collapse this row", sortLabel: "Sort by {column}", filterLabel: "Filter by {column}" }, tag: { close: "Close this tag" }, tour: { next: "Next", previous: "Previous", finish: "Finish", close: "Close this dialog" }, tree: { emptyText: "No Data" }, transfer: { noMatch: "No matching data", noData: "No data", titles: ["List 1", "List 2"], filterPlaceholder: "Enter keyword", noCheckedFormat: "{total} items", hasCheckedFormat: "{checked}/{total} checked" }, image: { error: "FAILED" }, pageHeader: { title: "Back" }, popconfirm: { confirmButtonText: "Yes", cancelButtonText: "No" }, carousel: { leftArrow: "Carousel arrow left", rightArrow: "Carousel arrow right", indicator: "Carousel switch to index {index}" }, inputOTP: { groupLabel: "OTP Input", defaultLabel: "Please enter OTP character {index}" } } }; const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale)); const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => `${(option == null ? void 0 : option[key]) ?? `{${key}}`}`); const buildLocaleContext = (locale) => { return { lang: computed(() => unref(locale).name), locale: isRef(locale) ? locale : ref(locale), t: buildTranslator(locale) }; }; const localeContextKey = Symbol("localeContextKey"); const useLocale = (localeOverrides) => { const locale = localeOverrides || inject(localeContextKey, ref()); return buildLocaleContext(computed(() => locale.value || en_default)); }; const emptyValuesContextKey = Symbol("emptyValuesContextKey"); const SCOPE = "use-empty-values"; const DEFAULT_EMPTY_VALUES = [ "", void 0, null ]; const useEmptyValuesProps = buildProps({ /** * @description empty values supported by the component */ emptyValues: Array, /** * @description return value when cleared, if you want to set `undefined`, use `() => undefined` */ valueOnClear: { type: definePropType([ String, Number, Boolean, Function ]), default: void 0, validator: (val) => { val = isFunction(val) ? val() : val; if (isArray(val)) return val.every((item) => !item); return !val; } } }); const useEmptyValues = (props, defaultValue) => { const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({}); const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES); const valueOnClear = computed(() => { if (isFunction(props.valueOnClear)) return props.valueOnClear(); else if (props.valueOnClear !== void 0) return props.valueOnClear; else if (isFunction(config.value.valueOnClear)) return config.value.valueOnClear(); else if (config.value.valueOnClear !== void 0) return config.value.valueOnClear; return void 0; }); const isEmptyValue = (value) => { let result = true; if (isArray(value)) result = emptyValues.value.some((emptyValue) => { return isEqual(value, emptyValue); }); else result = emptyValues.value.includes(value); return result; }; if (!isEmptyValue(valueOnClear.value)) debugWarn(SCOPE, "value-on-clear should be a value of empty-values"); return { emptyValues, valueOnClear, isEmptyValue }; }; export { useEmptyValuesProps as a, useLocale as b, emptyValuesContextKey as e, localeContextKey as l, useEmptyValues as u }; //# sourceMappingURL=index-BbcOBREW.js.map