@cg-devcenter/aim 0.1.896 → 0.1.897
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/dist/aim.common.js
CHANGED
|
@@ -4015,7 +4015,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4015
4015
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4016
4016
|
|
|
4017
4017
|
"use strict";
|
|
4018
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n });\n this.calcWidthPixString(\"100%\");\n }\n});\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4018
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n }, [\"valueFormat\", \"format\", \"defaultTime\"]);\n this.calcWidthPixString(\"100%\");\n this.myDisabledDate = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.cc, \"pickerOptions.myDisabledDate\", undefined);\n },\n computed: {\n watchValue() {\n return this.dataRef[this.fieldName];\n }\n },\n watch: {\n watchValue(newVal, oldVal) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate && this.isSameDay(newVal, startDate()) && !this.isSameDay(newVal, oldVal)) {\n this.$set(this.dataRef, this.fieldName, startDate());\n }\n }\n },\n data() {\n return {\n myDisabledDate: undefined // 禁用时间使用\n };\n },\n methods: {\n input(timestamp) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate) {\n this.$set(this.cc.pickerOptions, 'selectableRange', this.isSameDay(new Date(timestamp), startDate()) ? this.getSelectableRange() : \"00:00:00 - 23:59:59\");\n }\n },\n isSameDay(t1, t2) {\n const d1 = new Date(t1),\n d2 = new Date(t2);\n return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();\n },\n getSelectableRange() {\n const now = new Date();\n let futureTime = now;\n if (typeof this.myDisabledDate.startDate == 'function') {\n futureTime = new Date(this.myDisabledDate.startDate());\n }\n const startTime = Math.max(futureTime.getTime(), new Date(now).setHours(0, 0, 0, 0));\n return `${new Date(startTime).toTimeString().slice(0, 8)} - 23:59:59`;\n }\n }\n});\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4019
4019
|
|
|
4020
4020
|
/***/ }),
|
|
4021
4021
|
|
|
@@ -4499,7 +4499,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4499
4499
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4500
4500
|
|
|
4501
4501
|
"use strict";
|
|
4502
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4502
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}, copyVal = []) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(copyVal, function (val) {\n const value = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(_this.fieldSchema, val);\n value && _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathSet(_this.cc, val, value);\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4503
4503
|
|
|
4504
4504
|
/***/ }),
|
|
4505
4505
|
|
|
@@ -4774,7 +4774,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4774
4774
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4775
4775
|
|
|
4776
4776
|
"use strict";
|
|
4777
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n size: \"mini\"\n },\n on: {\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4777
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n \"value-format\": _vm.cc.valueFormat,\n format: _vm.cc.format,\n size: \"mini\"\n },\n on: {\n input: _vm.input,\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://@cg-devcenter/aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4778
4778
|
|
|
4779
4779
|
/***/ }),
|
|
4780
4780
|
|
package/dist/aim.umd.js
CHANGED
|
@@ -4025,7 +4025,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4025
4025
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4026
4026
|
|
|
4027
4027
|
"use strict";
|
|
4028
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n });\n this.calcWidthPixString(\"100%\");\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4028
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n }, [\"valueFormat\", \"format\", \"defaultTime\"]);\n this.calcWidthPixString(\"100%\");\n this.myDisabledDate = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.cc, \"pickerOptions.myDisabledDate\", undefined);\n },\n computed: {\n watchValue() {\n return this.dataRef[this.fieldName];\n }\n },\n watch: {\n watchValue(newVal, oldVal) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate && this.isSameDay(newVal, startDate()) && !this.isSameDay(newVal, oldVal)) {\n this.$set(this.dataRef, this.fieldName, startDate());\n }\n }\n },\n data() {\n return {\n myDisabledDate: undefined // 禁用时间使用\n };\n },\n methods: {\n input(timestamp) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate) {\n this.$set(this.cc.pickerOptions, 'selectableRange', this.isSameDay(new Date(timestamp), startDate()) ? this.getSelectableRange() : \"00:00:00 - 23:59:59\");\n }\n },\n isSameDay(t1, t2) {\n const d1 = new Date(t1),\n d2 = new Date(t2);\n return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();\n },\n getSelectableRange() {\n const now = new Date();\n let futureTime = now;\n if (typeof this.myDisabledDate.startDate == 'function') {\n futureTime = new Date(this.myDisabledDate.startDate());\n }\n const startTime = Math.max(futureTime.getTime(), new Date(now).setHours(0, 0, 0, 0));\n return `${new Date(startTime).toTimeString().slice(0, 8)} - 23:59:59`;\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4029
4029
|
|
|
4030
4030
|
/***/ }),
|
|
4031
4031
|
|
|
@@ -4509,7 +4509,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4509
4509
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4510
4510
|
|
|
4511
4511
|
"use strict";
|
|
4512
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4512
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}, copyVal = []) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(copyVal, function (val) {\n const value = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(_this.fieldSchema, val);\n value && _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathSet(_this.cc, val, value);\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4513
4513
|
|
|
4514
4514
|
/***/ }),
|
|
4515
4515
|
|
|
@@ -4784,7 +4784,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4784
4784
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4785
4785
|
|
|
4786
4786
|
"use strict";
|
|
4787
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n size: \"mini\"\n },\n on: {\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4787
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n \"value-format\": _vm.cc.valueFormat,\n format: _vm.cc.format,\n size: \"mini\"\n },\n on: {\n input: _vm.input,\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4788
4788
|
|
|
4789
4789
|
/***/ }),
|
|
4790
4790
|
|
package/dist/aim.umd.min.js
CHANGED
|
@@ -4025,7 +4025,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4025
4025
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4026
4026
|
|
|
4027
4027
|
"use strict";
|
|
4028
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n });\n this.calcWidthPixString(\"100%\");\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4028
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/cells/mixins/MixinCellEditorConfig.vue */ \"./src/components/cells/mixins/MixinCellEditorConfig.vue\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'CellDatePicker',\n mixins: [_components_cells_mixins_MixinCellEditorConfig_vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]],\n created() {\n this.ccConfigMerge({\n defaultTime: \"00:00:00\",\n placeholder: \"选择日期时间\"\n }, [\"valueFormat\", \"format\", \"defaultTime\"]);\n this.calcWidthPixString(\"100%\");\n this.myDisabledDate = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.cc, \"pickerOptions.myDisabledDate\", undefined);\n },\n computed: {\n watchValue() {\n return this.dataRef[this.fieldName];\n }\n },\n watch: {\n watchValue(newVal, oldVal) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate && this.isSameDay(newVal, startDate()) && !this.isSameDay(newVal, oldVal)) {\n this.$set(this.dataRef, this.fieldName, startDate());\n }\n }\n },\n data() {\n return {\n myDisabledDate: undefined // 禁用时间使用\n };\n },\n methods: {\n input(timestamp) {\n const {\n startDate\n } = this.myDisabledDate || {};\n if (startDate) {\n this.$set(this.cc.pickerOptions, 'selectableRange', this.isSameDay(new Date(timestamp), startDate()) ? this.getSelectableRange() : \"00:00:00 - 23:59:59\");\n }\n },\n isSameDay(t1, t2) {\n const d1 = new Date(t1),\n d2 = new Date(t2);\n return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();\n },\n getSelectableRange() {\n const now = new Date();\n let futureTime = now;\n if (typeof this.myDisabledDate.startDate == 'function') {\n futureTime = new Date(this.myDisabledDate.startDate());\n }\n const startTime = Math.max(futureTime.getTime(), new Date(now).setHours(0, 0, 0, 0));\n return `${new Date(startTime).toTimeString().slice(0, 8)} - 23:59:59`;\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4029
4029
|
|
|
4030
4030
|
/***/ }),
|
|
4031
4031
|
|
|
@@ -4509,7 +4509,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _com
|
|
|
4509
4509
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4510
4510
|
|
|
4511
4511
|
"use strict";
|
|
4512
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4512
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cg-devcenter/jsb */ \"./node_modules/@cg-devcenter/jsb/index.js\");\n/* harmony import */ var _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'MixinCellEditorConfig',\n props: {\n cellConfig: {},\n // 组件配置,editor的cellConfig必须为Object,但是对viewer可以为组件需要的值\n\n data: Object,\n // 父对象数据,必须是一个Object,组件的model为data[fieldName]\n fieldName: String,\n formatter: Function,\n // 格式化化方法\n\n options: [Function, Array, Promise],\n styleOverride: Object,\n // 便于组件覆盖基础配置,如form中所有的元素设定为100% width,但是少数对象如checkbox不允许100%\n styleBase: Object,\n // 便于父对象定义基础配置,如form中所有的元素设定为100% width\n disabled: Boolean,\n // 是否只读\n\n fieldSchema: Object,\n // trigger时需要通过fieldSchema定位fields字段数据\n getRow: Function,\n tableDataGetter: Function\n },\n watch: {\n options: {\n handler: function () {\n this.fetchOptionsData();\n },\n deep: true\n }\n },\n data() {\n const _this = this;\n return {\n dataRef: {},\n cc: {\n style: {},\n change: _this.emitChange,\n clearable: true\n },\n inOptionLoading: false,\n optionsUsing: [],\n optionsRefresh: false,\n fieldSchemaRef: this.fieldSchema,\n optionValueKey: 'value'\n };\n },\n async created() {\n if (this.data) {\n this.dataRef = this.data;\n }\n await this.fetchOptionsData();\n },\n methods: {\n optionsParameter(force = false) {\n return {\n force: force,\n parent: this.dataRef,\n row: this.getRow ? this.getRow() : null,\n table: this.tableDataGetter ? this.tableDataGetter() : null\n };\n },\n async manualFetchOptionsData() {\n return this.fetchOptionsData(true);\n },\n async fetchOptionsData(force = false) {\n try {\n this.inOptionLoading = true;\n await this.__fetchOptionsData(force);\n } catch (error) {\n if (this.fieldSchemaRef) {\n this.fieldSchemaRef.errorMessage = error;\n } else {\n console.log(\"aim option fresh got error \", error);\n }\n } finally {\n this.inOptionLoading = false;\n }\n },\n async __fetchOptionsData(force = false) {\n let optionsGot = [];\n let tmpOptionsRefresh = false;\n if (typeof this.options === 'function') {\n tmpOptionsRefresh = true;\n // 如果 options 是一个函数,则调用它并等待它的返回值\n optionsGot = this.options(this.optionsParameter(force));\n if (optionsGot instanceof Promise) {\n optionsGot = await optionsGot;\n }\n } else if (this.options instanceof Promise) {\n tmpOptionsRefresh = true;\n // 如果 options 是一个 Promise,则等待 Promise 完成并赋值给 optionsInner\n optionsGot = await this.options;\n } else if (Array.isArray(this.options)) {\n tmpOptionsRefresh = false;\n // 如果 options 是一个数组,直接赋值\n optionsGot = this.options;\n }\n let autoGroupField = '';\n let autoGroupSort = '';\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isObjectOrMap(optionsGot)) {\n tmpOptionsRefresh = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'refresh', false);\n autoGroupField = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroup', '');\n autoGroupSort = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'autoGroupSort', 'desc');\n optionsGot = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(optionsGot, 'options', []);\n }\n this.optionsUsing = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(this.optionsFmt(optionsGot, autoGroupField, autoGroupSort), v => {\n this.optionsUsing.push(v);\n });\n this.optionsRefresh = tmpOptionsRefresh;\n },\n optionsTryGroup(options, field, autoGroupSort) {\n let group2Options = {};\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(options, item => {\n const groupVal = item[field] || '';\n if (!group2Options[groupVal]) {\n group2Options[groupVal] = [];\n }\n group2Options[groupVal].push(item);\n });\n let optionGroup = [];\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(group2Options, (item, key) => {\n optionGroup.push({\n label: key,\n options: item\n });\n });\n // 优先显示group\n optionGroup = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().orderBy(optionGroup, [{\n field: 'label',\n order: autoGroupSort\n }]);\n if (optionGroup.length === 1 && optionGroup[0].label === \"\") {\n return optionGroup[0].options;\n }\n return optionGroup;\n },\n optionsFmt(optionsGot, autoGroupField, autoGroupSort) {\n const options = [];\n // 将数组转换为option对象\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(optionsGot, v => {\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(v) || _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isNumber(v)) {\n options.push({\n label: v,\n value: v\n });\n } else {\n options.push(v);\n }\n });\n this.optionValueKey = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(options, '0.valueKey', 'value');\n if (autoGroupField) {\n // 如果option的属性字段中含有aimGroup,则自动将其聚合为group\n return this.optionsTryGroup(options, autoGroupField, autoGroupSort);\n }\n return options;\n },\n emitChange(valNew) {\n this.$emit(\"input\", valNew);\n },\n calcWidthPixString(defaultVal) {\n this.cc.style.width = this.cc.style.width ? _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isString(this.cc.style.width) ? this.cc.style.width : `${this.cc.style.width}px` : defaultVal;\n return this.cc.style.width;\n },\n ccConfigMerge(initVal = {}, copyVal = []) {\n const _this = this;\n // styleDefault => styleBase => styleUser => styleOverride\n const mergeFiled = ['style'];\n this.cc.style = Object.assign(this.cc.style, this.styleBase);\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(initVal, function (val, key) {\n if (mergeFiled.includes(key)) {\n _this.cc[key] = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().merge(_this.cc[key], val);\n } else {\n _this.cc[key] = val;\n }\n });\n _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().each(copyVal, function (val) {\n const value = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(_this.fieldSchema, val);\n value && _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathSet(_this.cc, val, value);\n });\n if (_cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().isPlainObject(this.cellConfig)) {\n this.cc = Object.assign(this.cc, this.cellConfig);\n }\n this.cc.style = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().assign(this.cc.style, this.styleOverride);\n this.cc.placeholder = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'placeholder', this.cc.placeholder);\n this.cc.pickerOptions = _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.fieldSchema, 'pickerOptions', this.cc.pickerOptions);\n },\n change(newVal) {\n this.$forceUpdate();\n if (this.cc.change) {\n this.cc.change(newVal);\n }\n if (this.cc['changeEx']) {\n this.cc['changeEx']({\n value: newVal,\n parent: this.data\n });\n }\n if (this.fieldSchema && this.fieldSchema.__tableCallbackOnChange) {\n this.fieldSchema.__tableCallbackOnChange({\n row: this.data\n });\n }\n },\n emitClick(jsEvent) {\n this.$emit('code-cell-click', {\n code: this.cc.code,\n jsEvent: jsEvent\n });\n },\n emitClickWithCode(jsEvent, code) {\n this.$emit('code-cell-click', {\n code: code,\n jsEvent: jsEvent\n });\n },\n emitData(options) {\n return Object.assign({\n // 这里使用实际数据\n fieldValue: _cg_devcenter_jsb__WEBPACK_IMPORTED_MODULE_1___default().pathGet(this.data, this.fieldName)\n }, options);\n }\n }\n});\n\n//# sourceURL=webpack://aim/./src/components/cells/mixins/MixinCellEditorConfig.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4513
4513
|
|
|
4514
4514
|
/***/ }),
|
|
4515
4515
|
|
|
@@ -4784,7 +4784,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4784
4784
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4785
4785
|
|
|
4786
4786
|
"use strict";
|
|
4787
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n size: \"mini\"\n },\n on: {\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4787
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ render: function() { return /* binding */ render; },\n/* harmony export */ staticRenderFns: function() { return /* binding */ staticRenderFns; }\n/* harmony export */ });\nvar render = function render() {\n var _vm = this,\n _c = _vm._self._c;\n return _c(\"el-date-picker\", {\n style: _vm.cc.style,\n attrs: {\n disabled: _vm.disabled,\n type: \"datetime\",\n \"default-time\": _vm.cc.defaultTime,\n placeholder: _vm.cc.placeholder,\n \"picker-options\": _vm.cc.pickerOptions,\n \"value-format\": _vm.cc.valueFormat,\n format: _vm.cc.format,\n size: \"mini\"\n },\n on: {\n input: _vm.input,\n change: _vm.change\n },\n model: {\n value: _vm.dataRef[_vm.fieldName],\n callback: function ($$v) {\n _vm.$set(_vm.dataRef, _vm.fieldName, $$v);\n },\n expression: \"dataRef[fieldName]\"\n }\n });\n};\nvar staticRenderFns = [];\nrender._withStripped = true;\n\n\n//# sourceURL=webpack://aim/./src/components/cells/CellDatePicker.vue?./node_modules/babel-loader/lib/index.js??clonedRuleSet-124.use%5B0%5D!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet%5B1%5D.rules%5B3%5D!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
4788
4788
|
|
|
4789
4789
|
/***/ }),
|
|
4790
4790
|
|
package/package.json
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
:default-time="cc.defaultTime"
|
|
7
7
|
:placeholder="cc.placeholder"
|
|
8
8
|
:picker-options="cc.pickerOptions"
|
|
9
|
+
:value-format="cc.valueFormat"
|
|
10
|
+
:format="cc.format"
|
|
11
|
+
@input="input"
|
|
9
12
|
@change="change"
|
|
10
13
|
size="mini"
|
|
11
14
|
:style="cc.style"
|
|
@@ -16,6 +19,7 @@
|
|
|
16
19
|
<script>
|
|
17
20
|
|
|
18
21
|
import MixinCellEditorConfig from "@/components/cells/mixins/MixinCellEditorConfig.vue";
|
|
22
|
+
import jsb from "@cg-devcenter/jsb";
|
|
19
23
|
|
|
20
24
|
export default {
|
|
21
25
|
name: 'CellDatePicker',
|
|
@@ -24,8 +28,54 @@ export default {
|
|
|
24
28
|
this.ccConfigMerge({
|
|
25
29
|
defaultTime: "00:00:00",
|
|
26
30
|
placeholder: "选择日期时间"
|
|
27
|
-
})
|
|
31
|
+
}, ["valueFormat", "format", "defaultTime"])
|
|
28
32
|
this.calcWidthPixString("100%")
|
|
33
|
+
this.myDisabledDate = jsb.pathGet(this.cc, "pickerOptions.myDisabledDate", undefined)
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
watchValue() {
|
|
37
|
+
return this.dataRef[this.fieldName]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
watch: {
|
|
41
|
+
watchValue(newVal, oldVal) {
|
|
42
|
+
const {startDate} = this.myDisabledDate || {}
|
|
43
|
+
if (startDate && this.isSameDay(newVal, startDate()) && !this.isSameDay(newVal, oldVal)) {
|
|
44
|
+
this.$set(this.dataRef, this.fieldName, startDate())
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
myDisabledDate: undefined // 禁用时间使用
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
input(timestamp) {
|
|
55
|
+
const {startDate} = this.myDisabledDate || {}
|
|
56
|
+
if (startDate) {
|
|
57
|
+
this.$set(this.cc.pickerOptions, 'selectableRange',
|
|
58
|
+
this.isSameDay(new Date(timestamp), startDate()) ? this.getSelectableRange() : "00:00:00 - 23:59:59"
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
isSameDay(t1, t2) {
|
|
63
|
+
const d1 = new Date(t1), d2 = new Date(t2);
|
|
64
|
+
return d1.getFullYear() === d2.getFullYear()
|
|
65
|
+
&& d1.getMonth() === d2.getMonth()
|
|
66
|
+
&& d1.getDate() === d2.getDate();
|
|
67
|
+
},
|
|
68
|
+
getSelectableRange() {
|
|
69
|
+
const now = new Date()
|
|
70
|
+
let futureTime = now
|
|
71
|
+
if (typeof this.myDisabledDate.startDate == 'function') {
|
|
72
|
+
futureTime = new Date(this.myDisabledDate.startDate())
|
|
73
|
+
}
|
|
74
|
+
const startTime = Math.max(futureTime.getTime(),
|
|
75
|
+
new Date(now).setHours(0, 0, 0, 0)
|
|
76
|
+
)
|
|
77
|
+
return `${new Date(startTime).toTimeString().slice(0, 8)} - 23:59:59`
|
|
78
|
+
}
|
|
29
79
|
},
|
|
30
80
|
}
|
|
31
81
|
</script>
|
|
@@ -150,7 +150,7 @@ export default {
|
|
|
150
150
|
this.cc.style.width = this.cc.style.width?(jsb.isString(this.cc.style.width)?this.cc.style.width : `${ this.cc.style.width}px`):defaultVal
|
|
151
151
|
return this.cc.style.width
|
|
152
152
|
},
|
|
153
|
-
ccConfigMerge(initVal = {}) {
|
|
153
|
+
ccConfigMerge(initVal = {},copyVal =[]) {
|
|
154
154
|
const _this = this
|
|
155
155
|
// styleDefault => styleBase => styleUser => styleOverride
|
|
156
156
|
const mergeFiled = ['style']
|
|
@@ -162,6 +162,10 @@ export default {
|
|
|
162
162
|
_this.cc[key] = val
|
|
163
163
|
}
|
|
164
164
|
})
|
|
165
|
+
jsb.each(copyVal, function (val) {
|
|
166
|
+
const value = jsb.pathGet(_this.fieldSchema, val)
|
|
167
|
+
value && jsb.pathSet(_this.cc, val, value)
|
|
168
|
+
})
|
|
165
169
|
if (jsb.isPlainObject(this.cellConfig)) {
|
|
166
170
|
this.cc = Object.assign(this.cc, this.cellConfig)
|
|
167
171
|
}
|
|
@@ -192,7 +196,7 @@ export default {
|
|
|
192
196
|
// 这里使用实际数据
|
|
193
197
|
fieldValue:jsb.pathGet(this.data,this.fieldName)
|
|
194
198
|
},options)
|
|
195
|
-
}
|
|
199
|
+
},
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
</script>
|