|
@@ -38158,6 +38158,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
Scope.SHOW_PAGE_STACK = [];
|
|
|
return Scope;
|
|
|
}());
|
|
|
+ //# sourceMappingURL=Scope.js.map
|
|
|
|
|
|
/**
|
|
|
* 全局 ajax 方法
|
|
@@ -38336,6 +38337,10 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
exportExcelCurrentPage: 1,
|
|
|
exportExcelTotal: 0,
|
|
|
};
|
|
|
+ var search = {
|
|
|
+ labelAlign: 'left',
|
|
|
+ labelWidth: labelWidth,
|
|
|
+ };
|
|
|
var text = {
|
|
|
labelTextAlign: 'right',
|
|
|
labelWidth: 80,
|
|
@@ -38378,178 +38383,160 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
};
|
|
|
//# sourceMappingURL=Defaults.js.map
|
|
|
|
|
|
- /**
|
|
|
- * 创建一个 Ajax 客户端
|
|
|
- */
|
|
|
- function createAjax(createOption) {
|
|
|
- if (createOption.baseUrl) {
|
|
|
- axios$1.defaults.baseURL = createOption.baseUrl;
|
|
|
- axios$1.defaults.timeout = createOption.timeout;
|
|
|
- axios$1.defaults.timeoutErrorMessage = '网络超时';
|
|
|
+ if (!window["time_offset"]) {
|
|
|
+ window["time_offset"] = 0;
|
|
|
+ }
|
|
|
+ function syncDate(date) {
|
|
|
+ if (date && date.setTime && date.getTime) {
|
|
|
+ date.setTime(date.getTime() + window["time_offset"]);
|
|
|
}
|
|
|
- return function (option) {
|
|
|
- //@ts-ignore
|
|
|
- option.method = (option.method || 'get').toLocaleLowerCase();
|
|
|
- //@ts-ignore
|
|
|
- var ax = __assign({}, option);
|
|
|
- switch (option.method) {
|
|
|
- case 'get':
|
|
|
- ax.method = 'GET';
|
|
|
- ax.params = option.param;
|
|
|
- ax.headers = __assign({}, option.headers);
|
|
|
- break;
|
|
|
- case 'post':
|
|
|
- ax.method = 'POST';
|
|
|
- ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
|
|
|
- ax.params = option.param;
|
|
|
- ax.data = lib.stringify(option.data);
|
|
|
- break;
|
|
|
- case 'put':
|
|
|
- case 'patch':
|
|
|
- case 'delete':
|
|
|
- ax.method = option.method;
|
|
|
- ax.headers = option.headers;
|
|
|
- ax.params = option.param;
|
|
|
- ax.data = lib.stringify(option.data);
|
|
|
- break;
|
|
|
- case 'download':
|
|
|
- downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
|
|
|
- return new Promise(function (resolver, reject) {
|
|
|
- });
|
|
|
- case "invoke":
|
|
|
- ax.url = serverInvokeUrlTransform(option.url, option);
|
|
|
- ax.method = 'POST';
|
|
|
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
- if (typeof option.args === 'object') {
|
|
|
- ax.data = JSON.stringify({
|
|
|
- args: option.args,
|
|
|
- });
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+ //# sourceMappingURL=utils.js.map
|
|
|
+
|
|
|
+ function initDate () {
|
|
|
+ var cc = Ext.field.Date.prototype.constructor;
|
|
|
+ var _a = Ext.field.Date.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
|
|
|
+ Ext.field.Date.override({
|
|
|
+ dateFormat: 'Y-m-d',
|
|
|
+ altFormats: 'Y-m-d',
|
|
|
+ constructor: function (config) {
|
|
|
+ var newConfig = lodash.defaultsDeep({
|
|
|
+ // 强制属性
|
|
|
+ }, date, config);
|
|
|
+ cc.call(this, newConfig);
|
|
|
+ },
|
|
|
+ getValue: function () {
|
|
|
+ var ov = getValue.call(this);
|
|
|
+ var nv = Ext.util.Format.date(ov, 'Y-m-d');
|
|
|
+ return nv;
|
|
|
+ },
|
|
|
+ onPickerChange: function (sender, value) {
|
|
|
+ var _a, _b, _c;
|
|
|
+ onPickerChange.call(this, sender, value);
|
|
|
+ value = Ext.util.Format.date(value, 'Y-m-d');
|
|
|
+ var scope = lookupScope(this);
|
|
|
+ // console.log('cc:', nv, ov)
|
|
|
+ if (scope) {
|
|
|
+ var bind = '';
|
|
|
+ if (typeof ((_a = this.config.bind) === null || _a === void 0 ? void 0 : _a.value) === 'string') {
|
|
|
+ bind = (_b = this.config.bind) === null || _b === void 0 ? void 0 : _b.value;
|
|
|
}
|
|
|
- else {
|
|
|
- ax.data = JSON.stringify({
|
|
|
- args: [
|
|
|
- __assign(__assign({}, option.data), option.param)
|
|
|
- ],
|
|
|
- filterModel: option.filterModel,
|
|
|
- sortModel: option.sortModel
|
|
|
- });
|
|
|
+ else if (typeof this.config.bind === 'string') {
|
|
|
+ bind = this.config.bind;
|
|
|
}
|
|
|
- break;
|
|
|
- case 'post-json':
|
|
|
- ax.method = 'POST';
|
|
|
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
- ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
|
|
|
- break;
|
|
|
- case 'post-raw':
|
|
|
- ax.method = 'POST';
|
|
|
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
- ax.data = option.data;
|
|
|
- break;
|
|
|
- case 'post-file':
|
|
|
- //TODO 刘壮. 上传文件
|
|
|
- var forms = new FormData();
|
|
|
- ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
|
|
|
- lodash.forOwn(option.data, function (value, key) {
|
|
|
- if (key === 'files') {
|
|
|
- var i_1 = 0;
|
|
|
- lodash.each(value, function (f) {
|
|
|
- // @ts-ignore
|
|
|
- forms.append('file' + (++i_1), f);
|
|
|
- });
|
|
|
+ if (bind && lodash.startsWith(bind, '{') && lodash.endsWith(bind, '}')) {
|
|
|
+ bind = bind.substr(1, bind.length - 2);
|
|
|
+ if (bind) {
|
|
|
+ scope.viewModel.set(bind, value);
|
|
|
+ (_c = sender.ownerCmp) === null || _c === void 0 ? void 0 : _c.fireEvent('change2', sender, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initialize: function () {
|
|
|
+ this.on({
|
|
|
+ expand: function (sender, opts) {
|
|
|
+ var value = sender.getRawValue();
|
|
|
+ if (value) {
|
|
|
+ //@ts-ignore
|
|
|
+ var dt_1 = moment(value).toDate();
|
|
|
+ var picker_1 = sender.getPicker();
|
|
|
+ picker_1.setValue(dt_1);
|
|
|
+ // 延迟200毫秒后再设定一次值,动画会造成 bug
|
|
|
+ setTimeout(function () {
|
|
|
+ picker_1.setValue(dt_1);
|
|
|
+ }, 200);
|
|
|
}
|
|
|
else {
|
|
|
- forms.append(key, value);
|
|
|
+ var dt_2 = syncDate(new Date());
|
|
|
+ var picker_2 = sender.getPicker();
|
|
|
+ picker_2.setValue(dt_2);
|
|
|
+ setTimeout(function () { return picker_2.setValue(dt_2); }, 200);
|
|
|
}
|
|
|
- });
|
|
|
- ax.data = forms;
|
|
|
- ax.method = 'POST';
|
|
|
+ },
|
|
|
+ });
|
|
|
+ initialize.call(this);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //# sourceMappingURL=datefield.js.map
|
|
|
+
|
|
|
+ function initText () {
|
|
|
+ var cc = Ext.field.Text.prototype.constructor;
|
|
|
+ var _a = Ext.field.Text.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
|
|
|
+ Ext.field.Text.override({
|
|
|
+ constructor: function (config) {
|
|
|
+ var newConfig = lodash.defaultsDeep({
|
|
|
+ // 强制属性
|
|
|
+ }, config, text);
|
|
|
+ cc.call(this, newConfig);
|
|
|
+ },
|
|
|
+ initialize: function () {
|
|
|
+ var that = this;
|
|
|
+ this.on({
|
|
|
+ initialize: function () {
|
|
|
+ $(this.el.dom).on('keyup', function (e) {
|
|
|
+ if ([10, 13, 20, 40].includes(e.keyCode)) {
|
|
|
+ // const value = sender.getRawValue()
|
|
|
+ // console.log('keyup2', value)
|
|
|
+ that.fireEvent('scancode', that, e.target.value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ initialize.call(this);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //# sourceMappingURL=textfield.js.map
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构建所有组件的公共属性
|
|
|
+ * @param config 原始config
|
|
|
+ * @param dragType 组件模式
|
|
|
+ * 不填,代表不能在设计时被拖拽
|
|
|
+ * row-container 是一个rows容器
|
|
|
+ * col-container 是一个cols容器
|
|
|
+ * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
|
|
|
+ * row-item rows中的一行,比如 tree / grid / panel 等等
|
|
|
+ */
|
|
|
+ function baseConfig(config, dragType) {
|
|
|
+ if (config && config.designMode && dragType) {
|
|
|
+ var cc = '';
|
|
|
+ switch (dragType) {
|
|
|
+ case "cols-container":
|
|
|
+ cc = 'design_cols_container';
|
|
|
break;
|
|
|
- case "sql":
|
|
|
- ax.url = sqlUrlTransform(option.url);
|
|
|
- ax.method = 'POST';
|
|
|
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
- ax.data = JSON.stringify({
|
|
|
- args: [option.data],
|
|
|
- db: option.db,
|
|
|
- filterModel: option.filterModel,
|
|
|
- sortModel: option.sortModel
|
|
|
- });
|
|
|
+ case "col-item":
|
|
|
+ cc = 'design_col_item';
|
|
|
+ break;
|
|
|
+ case "rows-container":
|
|
|
+ cc = 'design_rows_container';
|
|
|
+ break;
|
|
|
+ case "row-item":
|
|
|
+ cc = 'design_row_item';
|
|
|
break;
|
|
|
- default:
|
|
|
- throw new Error('not implements');
|
|
|
}
|
|
|
- return new Promise(function (resolver, reject) {
|
|
|
- axios$1(ax).then(function (resolverRaw) {
|
|
|
- var apiResult = {
|
|
|
- rawData: resolverRaw.data,
|
|
|
- status: resolverRaw.status,
|
|
|
- success: (resolverRaw.data && resolverRaw.data.success),
|
|
|
- data: resolverRaw.data.data,
|
|
|
- pagination: resolverRaw.data.pagination,
|
|
|
- msg: (resolverRaw.data.msg),
|
|
|
- errors: resolverRaw.data.errors,
|
|
|
- headers: resolverRaw.headers
|
|
|
- };
|
|
|
- resolver(apiResult);
|
|
|
- }).catch(function (reason) {
|
|
|
- reject(reason);
|
|
|
+ if (typeof config.cls === 'string') {
|
|
|
+ lodash.extend(config, {
|
|
|
+ cls: [config.cls, 'yvan_design', cc]
|
|
|
});
|
|
|
- });
|
|
|
- };
|
|
|
- }
|
|
|
- function downLoad(downLoadUrl, filename, data, header, isJson) {
|
|
|
- if (isJson === void 0) { isJson = false; }
|
|
|
- var YvanUI = lodash.get(window, 'YvanUI');
|
|
|
- YvanUI.loading();
|
|
|
- var createObjectURL = function (object) {
|
|
|
- return (window.URL) ? window.URL.createObjectURL(object) : lodash.get(window, 'webkitURL').createObjectURL(object);
|
|
|
- };
|
|
|
- // const formData = new FormData();
|
|
|
- // _.forOwn(data, (v, k) => {
|
|
|
- // formData.append(k, v);
|
|
|
- // });
|
|
|
- var formData = '';
|
|
|
- var xhr = new XMLHttpRequest();
|
|
|
- xhr.open('POST', downLoadUrl);
|
|
|
- xhr.responseType = 'blob';
|
|
|
- // xhr.setRequestHeader('Authorization', $.cookie('auth'))
|
|
|
- if (isJson) {
|
|
|
- formData = data ? JSON.stringify(data) : '';
|
|
|
- xhr.setRequestHeader('Content-Type', 'application/json');
|
|
|
- }
|
|
|
- else {
|
|
|
- formData = data ? lib.stringify(data) : '';
|
|
|
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
- }
|
|
|
- //
|
|
|
- if (header) {
|
|
|
- lodash.forOwn(header, function (v, k) {
|
|
|
- xhr.setRequestHeader(k, v);
|
|
|
- });
|
|
|
- }
|
|
|
- xhr.onload = function (e) {
|
|
|
- if (this.status === 200) {
|
|
|
- var blob = this.response;
|
|
|
- if (lodash.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
|
|
|
- navigator.msSaveBlob(blob, filename);
|
|
|
- YvanUI.clearLoading();
|
|
|
- }
|
|
|
- else {
|
|
|
- var a = document.createElement('a');
|
|
|
- var url = createObjectURL(blob);
|
|
|
- a.href = url;
|
|
|
- a.download = filename;
|
|
|
- document.append(a);
|
|
|
- a.click();
|
|
|
- a.remove();
|
|
|
- window.URL.revokeObjectURL(url);
|
|
|
- YvanUI.clearLoading();
|
|
|
- }
|
|
|
}
|
|
|
- };
|
|
|
- xhr.send(formData);
|
|
|
+ else if (lodash.isArray(config.cls)) {
|
|
|
+ lodash.extend(config, {
|
|
|
+ cls: __spread(config.cls, ['yvan_design', cc])
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ lodash.extend(config, {
|
|
|
+ cls: ['yvan_design', cc]
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return config;
|
|
|
}
|
|
|
- //# sourceMappingURL=ajax.js.map
|
|
|
+ //# sourceMappingURL=base.js.map
|
|
|
|
|
|
function prompt(message, multiLine, value) {
|
|
|
if (value === void 0) { value = ''; }
|
|
@@ -39866,160 +39853,143 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
getGridEditRows: getGridEditRows
|
|
|
});
|
|
|
|
|
|
- if (!window["time_offset"]) {
|
|
|
- window["time_offset"] = 0;
|
|
|
- }
|
|
|
- function syncDate(date) {
|
|
|
- if (date && date.setTime && date.getTime) {
|
|
|
- date.setTime(date.getTime() + window["time_offset"]);
|
|
|
- }
|
|
|
- return date;
|
|
|
- }
|
|
|
- //# sourceMappingURL=utils.js.map
|
|
|
-
|
|
|
- function initDate () {
|
|
|
- var cc = Ext.field.Date.prototype.constructor;
|
|
|
- var _a = Ext.field.Date.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
|
|
|
- Ext.field.Date.override({
|
|
|
- dateFormat: 'Y-m-d',
|
|
|
- altFormats: 'Y-m-d',
|
|
|
+ function initMultipleSearch () {
|
|
|
+ var _a = Ext.field.Text.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
|
|
|
+ Ext.define('Yvan.MultipleSearch', {
|
|
|
+ extend: 'Ext.field.Text',
|
|
|
+ xtype: 'multiplesearch',
|
|
|
+ bindTargert: '',
|
|
|
constructor: function (config) {
|
|
|
+ var _a, _b, _c, _d;
|
|
|
+ var self = this;
|
|
|
var newConfig = lodash.defaultsDeep({
|
|
|
- // 强制属性
|
|
|
- }, date, config);
|
|
|
- cc.call(this, newConfig);
|
|
|
- },
|
|
|
- getValue: function () {
|
|
|
- var ov = getValue.call(this);
|
|
|
- var nv = Ext.util.Format.date(ov, 'Y-m-d');
|
|
|
- return nv;
|
|
|
- },
|
|
|
- onPickerChange: function (sender, value) {
|
|
|
- var _a, _b, _c;
|
|
|
- onPickerChange.call(this, sender, value);
|
|
|
- value = Ext.util.Format.date(value, 'Y-m-d');
|
|
|
- var scope = lookupScope(this);
|
|
|
- // console.log('cc:', nv, ov)
|
|
|
- if (scope) {
|
|
|
- var bind = '';
|
|
|
- if (typeof ((_a = this.config.bind) === null || _a === void 0 ? void 0 : _a.value) === 'string') {
|
|
|
- bind = (_b = this.config.bind) === null || _b === void 0 ? void 0 : _b.value;
|
|
|
- }
|
|
|
- else if (typeof this.config.bind === 'string') {
|
|
|
- bind = this.config.bind;
|
|
|
- }
|
|
|
- if (bind && lodash.startsWith(bind, '{') && lodash.endsWith(bind, '}')) {
|
|
|
- bind = bind.substr(1, bind.length - 2);
|
|
|
- if (bind) {
|
|
|
- scope.viewModel.set(bind, value);
|
|
|
- (_c = sender.ownerCmp) === null || _c === void 0 ? void 0 : _c.fireEvent('change2', sender, value);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- initialize: function () {
|
|
|
- this.on({
|
|
|
- expand: function (sender, opts) {
|
|
|
- var value = sender.getRawValue();
|
|
|
- if (value) {
|
|
|
- //@ts-ignore
|
|
|
- var dt_1 = moment(value).toDate();
|
|
|
- var picker_1 = sender.getPicker();
|
|
|
- picker_1.setValue(dt_1);
|
|
|
- // 延迟200毫秒后再设定一次值,动画会造成 bug
|
|
|
- setTimeout(function () {
|
|
|
- picker_1.setValue(dt_1);
|
|
|
- }, 200);
|
|
|
- }
|
|
|
- else {
|
|
|
- var dt_2 = syncDate(new Date());
|
|
|
- var picker_2 = sender.getPicker();
|
|
|
- picker_2.setValue(dt_2);
|
|
|
- setTimeout(function () { return picker_2.setValue(dt_2); }, 200);
|
|
|
+ // 强制性属性
|
|
|
+ triggers: {
|
|
|
+ clear: {
|
|
|
+ weight: 0,
|
|
|
+ cls: Ext.baseCSSPrefix + 'form-clear-trigger',
|
|
|
+ hidden: true,
|
|
|
+ handler: 'onClearClick',
|
|
|
}
|
|
|
},
|
|
|
- });
|
|
|
- initialize.call(this);
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- //# sourceMappingURL=datefield.js.map
|
|
|
-
|
|
|
- function initText () {
|
|
|
- var cc = Ext.field.Text.prototype.constructor;
|
|
|
- var _a = Ext.field.Text.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
|
|
|
- Ext.field.Text.override({
|
|
|
- constructor: function (config) {
|
|
|
- var newConfig = lodash.defaultsDeep({
|
|
|
- // 强制属性
|
|
|
- }, config, text);
|
|
|
- cc.call(this, newConfig);
|
|
|
+ transformRawValue: function (o) {
|
|
|
+ return o;
|
|
|
+ },
|
|
|
+ listeners: {
|
|
|
+ specialkey: function (sender, e) {
|
|
|
+ var me = this;
|
|
|
+ if (e.getKey() === e.ENTER) {
|
|
|
+ me.fireEvent('search', me, e);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }, baseConfig(config, 'col-item'), config, search);
|
|
|
+ this.superclass.constructor.call(self, newConfig);
|
|
|
+ var vv = (_d = (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.bind) === null || _b === void 0 ? void 0 : _b.value) || ((_c = this.config) === null || _c === void 0 ? void 0 : _c.bind))) !== null && _d !== void 0 ? _d : '';
|
|
|
+ vv = lodash.replace(vv, "{", "");
|
|
|
+ vv = lodash.replace(vv, "}", "");
|
|
|
+ this.bindTargert = vv;
|
|
|
+ this.bindTargert = lodash.trim(this.bindTargert);
|
|
|
},
|
|
|
initialize: function () {
|
|
|
var that = this;
|
|
|
this.on({
|
|
|
initialize: function () {
|
|
|
- $(this.el.dom).on('keyup', function (e) {
|
|
|
- if ([10, 13, 20, 40].includes(e.keyCode)) {
|
|
|
- // const value = sender.getRawValue()
|
|
|
- // console.log('keyup2', value)
|
|
|
- that.fireEvent('scancode', that, e.target.value);
|
|
|
- }
|
|
|
- });
|
|
|
+ that.replaceRawInputEvent();
|
|
|
}
|
|
|
});
|
|
|
initialize.call(this);
|
|
|
},
|
|
|
- });
|
|
|
- }
|
|
|
- //# sourceMappingURL=textfield.js.map
|
|
|
-
|
|
|
- /**
|
|
|
- * 构建所有组件的公共属性
|
|
|
- * @param config 原始config
|
|
|
- * @param dragType 组件模式
|
|
|
- * 不填,代表不能在设计时被拖拽
|
|
|
- * row-container 是一个rows容器
|
|
|
- * col-container 是一个cols容器
|
|
|
- * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
|
|
|
- * row-item rows中的一行,比如 tree / grid / panel 等等
|
|
|
- */
|
|
|
- function baseConfig(config, dragType) {
|
|
|
- if (config && config.designMode && dragType) {
|
|
|
- var cc = '';
|
|
|
- switch (dragType) {
|
|
|
- case "cols-container":
|
|
|
- cc = 'design_cols_container';
|
|
|
- break;
|
|
|
- case "col-item":
|
|
|
- cc = 'design_col_item';
|
|
|
- break;
|
|
|
- case "rows-container":
|
|
|
- cc = 'design_rows_container';
|
|
|
- break;
|
|
|
- case "row-item":
|
|
|
- cc = 'design_row_item';
|
|
|
- break;
|
|
|
- }
|
|
|
- if (typeof config.cls === 'string') {
|
|
|
- lodash.extend(config, {
|
|
|
- cls: [config.cls, 'yvan_design', cc]
|
|
|
+ setBindValue: function (arrValue) {
|
|
|
+ if (this.bindTargert) {
|
|
|
+ this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ replaceRawInputEvent: function () {
|
|
|
+ var me = this;
|
|
|
+ var $dom = $(me.el.dom);
|
|
|
+ $dom.on('input', function (e) {
|
|
|
+ var _a, _b, _c, _d, _e;
|
|
|
+ if ((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.endsWith(" ")) {
|
|
|
+ var a = lodash.trimEnd((_b = e.target) === null || _b === void 0 ? void 0 : _b.value);
|
|
|
+ if (!a.endsWith(",") && a.length > 0) {
|
|
|
+ e.target.value = a + ",";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ e.target.value = a;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ e.target.value = (_c = e.target.value) === null || _c === void 0 ? void 0 : _c.replaceAll(",,", ",");
|
|
|
+ var arr = (_e = (_d = e.target) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.split(",");
|
|
|
+ lodash.remove(arr, function (it) {
|
|
|
+ return !it;
|
|
|
+ });
|
|
|
+ me.setBindValue(arr);
|
|
|
+ stopEvent(e);
|
|
|
});
|
|
|
- }
|
|
|
- else if (lodash.isArray(config.cls)) {
|
|
|
- lodash.extend(config, {
|
|
|
- cls: __spread(config.cls, ['yvan_design', cc])
|
|
|
+ $dom.on('keyup', function (e) {
|
|
|
+ me.fireEvent('keyup', me, e);
|
|
|
+ // invokeMethod(me.config.listeners?.keyup, me, e)
|
|
|
+ stopEvent(e);
|
|
|
});
|
|
|
- }
|
|
|
- else {
|
|
|
- lodash.extend(config, {
|
|
|
- cls: ['yvan_design', cc]
|
|
|
+ $dom.on('keydown', function (e) {
|
|
|
+ me.fireEvent('keydown', me, e);
|
|
|
+ // invokeMethod(me.config.listeners?.keydown, me, e)
|
|
|
+ //stopEvent(e)
|
|
|
+ });
|
|
|
+ $dom.on('change', function (e) {
|
|
|
+ stopEvent(e);
|
|
|
+ });
|
|
|
+ $dom.on('paste', function (e) {
|
|
|
+ var _a, _b;
|
|
|
+ // @ts-ignore
|
|
|
+ var clipdata = e.originalEvent.clipboardData || window.clipboardData;
|
|
|
+ var text = clipdata.getData("text/plain");
|
|
|
+ var spliter = ',';
|
|
|
+ text = text.replaceAll("\r", "");
|
|
|
+ text = text.replaceAll("\n", spliter);
|
|
|
+ text = ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
|
|
|
+ var arr = text.split(spliter);
|
|
|
+ if (arr && Array.isArray(arr)) {
|
|
|
+ for (var i = 0; i < arr.length; i++) {
|
|
|
+ arr[i] = lodash.trim(arr[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lodash.remove(arr, function (it) {
|
|
|
+ return !it;
|
|
|
+ });
|
|
|
+ me.setBindValue(arr);
|
|
|
+ if ((_b = e.target) === null || _b === void 0 ? void 0 : _b.value) {
|
|
|
+ e.target.value = text;
|
|
|
+ }
|
|
|
+ stopEvent(e);
|
|
|
});
|
|
|
+ },
|
|
|
+ onChange: function (newVal, oldVal) {
|
|
|
+ var me = this;
|
|
|
+ var value = newVal;
|
|
|
+ if (value) {
|
|
|
+ me.getTrigger('clear').show();
|
|
|
+ me.updateLayout();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ me.getTrigger('clear').hide();
|
|
|
+ me.updateLayout();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 清空所有值
|
|
|
+ */
|
|
|
+ onClearClick: function (sender, e) {
|
|
|
+ var me = this;
|
|
|
+ var config = me.config;
|
|
|
+ var lookup = config.lookup;
|
|
|
+ me.setValue('');
|
|
|
+ clearViewModelByLookup(sender, lookup);
|
|
|
}
|
|
|
- }
|
|
|
- return config;
|
|
|
+ });
|
|
|
}
|
|
|
- //# sourceMappingURL=base.js.map
|
|
|
+ //# sourceMappingURL=multiplesearch.js.map
|
|
|
|
|
|
/**
|
|
|
* 构建一个 grid 支持的 dataSource
|
|
@@ -41373,6 +41343,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
initComponent();
|
|
|
initDate();
|
|
|
initText();
|
|
|
+ initMultipleSearch();
|
|
|
initList();
|
|
|
initCols();
|
|
|
initLocale();
|
|
@@ -41382,6 +41353,179 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
}
|
|
|
//# sourceMappingURL=init.js.map
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建一个 Ajax 客户端
|
|
|
+ */
|
|
|
+ function createAjax(createOption) {
|
|
|
+ if (createOption.baseUrl) {
|
|
|
+ axios$1.defaults.baseURL = createOption.baseUrl;
|
|
|
+ axios$1.defaults.timeout = createOption.timeout;
|
|
|
+ axios$1.defaults.timeoutErrorMessage = '网络超时';
|
|
|
+ }
|
|
|
+ return function (option) {
|
|
|
+ //@ts-ignore
|
|
|
+ option.method = (option.method || 'get').toLocaleLowerCase();
|
|
|
+ //@ts-ignore
|
|
|
+ var ax = __assign({}, option);
|
|
|
+ switch (option.method) {
|
|
|
+ case 'get':
|
|
|
+ ax.method = 'GET';
|
|
|
+ ax.params = option.param;
|
|
|
+ ax.headers = __assign({}, option.headers);
|
|
|
+ break;
|
|
|
+ case 'post':
|
|
|
+ ax.method = 'POST';
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
|
|
|
+ ax.params = option.param;
|
|
|
+ ax.data = lib.stringify(option.data);
|
|
|
+ break;
|
|
|
+ case 'put':
|
|
|
+ case 'patch':
|
|
|
+ case 'delete':
|
|
|
+ ax.method = option.method;
|
|
|
+ ax.headers = option.headers;
|
|
|
+ ax.params = option.param;
|
|
|
+ ax.data = lib.stringify(option.data);
|
|
|
+ break;
|
|
|
+ case 'download':
|
|
|
+ downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
|
|
|
+ return new Promise(function (resolver, reject) {
|
|
|
+ });
|
|
|
+ case "invoke":
|
|
|
+ ax.url = serverInvokeUrlTransform(option.url, option);
|
|
|
+ ax.method = 'POST';
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
+ if (typeof option.args === 'object') {
|
|
|
+ ax.data = JSON.stringify({
|
|
|
+ args: option.args,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ax.data = JSON.stringify({
|
|
|
+ args: [
|
|
|
+ __assign(__assign({}, option.data), option.param)
|
|
|
+ ],
|
|
|
+ filterModel: option.filterModel,
|
|
|
+ sortModel: option.sortModel
|
|
|
+ });
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'post-json':
|
|
|
+ ax.method = 'POST';
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
+ ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
|
|
|
+ break;
|
|
|
+ case 'post-raw':
|
|
|
+ ax.method = 'POST';
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
+ ax.data = option.data;
|
|
|
+ break;
|
|
|
+ case 'post-file':
|
|
|
+ //TODO 刘壮. 上传文件
|
|
|
+ var forms = new FormData();
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
|
|
|
+ lodash.forOwn(option.data, function (value, key) {
|
|
|
+ if (key === 'files') {
|
|
|
+ var i_1 = 0;
|
|
|
+ lodash.each(value, function (f) {
|
|
|
+ // @ts-ignore
|
|
|
+ forms.append('file' + (++i_1), f);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ forms.append(key, value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ax.data = forms;
|
|
|
+ ax.method = 'POST';
|
|
|
+ break;
|
|
|
+ case "sql":
|
|
|
+ ax.url = sqlUrlTransform(option.url);
|
|
|
+ ax.method = 'POST';
|
|
|
+ ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
|
|
|
+ ax.data = JSON.stringify({
|
|
|
+ args: [option.data],
|
|
|
+ db: option.db,
|
|
|
+ filterModel: option.filterModel,
|
|
|
+ sortModel: option.sortModel
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new Error('not implements');
|
|
|
+ }
|
|
|
+ return new Promise(function (resolver, reject) {
|
|
|
+ axios$1(ax).then(function (resolverRaw) {
|
|
|
+ var apiResult = {
|
|
|
+ rawData: resolverRaw.data,
|
|
|
+ status: resolverRaw.status,
|
|
|
+ success: (resolverRaw.data && resolverRaw.data.success),
|
|
|
+ data: resolverRaw.data.data,
|
|
|
+ pagination: resolverRaw.data.pagination,
|
|
|
+ msg: (resolverRaw.data.msg),
|
|
|
+ errors: resolverRaw.data.errors,
|
|
|
+ headers: resolverRaw.headers
|
|
|
+ };
|
|
|
+ resolver(apiResult);
|
|
|
+ }).catch(function (reason) {
|
|
|
+ reject(reason);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+ }
|
|
|
+ function downLoad(downLoadUrl, filename, data, header, isJson) {
|
|
|
+ if (isJson === void 0) { isJson = false; }
|
|
|
+ var YvanUI = lodash.get(window, 'YvanUI');
|
|
|
+ YvanUI.loading();
|
|
|
+ var createObjectURL = function (object) {
|
|
|
+ return (window.URL) ? window.URL.createObjectURL(object) : lodash.get(window, 'webkitURL').createObjectURL(object);
|
|
|
+ };
|
|
|
+ // const formData = new FormData();
|
|
|
+ // _.forOwn(data, (v, k) => {
|
|
|
+ // formData.append(k, v);
|
|
|
+ // });
|
|
|
+ var formData = '';
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
+ xhr.open('POST', downLoadUrl);
|
|
|
+ xhr.responseType = 'blob';
|
|
|
+ // xhr.setRequestHeader('Authorization', $.cookie('auth'))
|
|
|
+ if (isJson) {
|
|
|
+ formData = data ? JSON.stringify(data) : '';
|
|
|
+ xhr.setRequestHeader('Content-Type', 'application/json');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ formData = data ? lib.stringify(data) : '';
|
|
|
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
+ }
|
|
|
+ //
|
|
|
+ if (header) {
|
|
|
+ lodash.forOwn(header, function (v, k) {
|
|
|
+ xhr.setRequestHeader(k, v);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ xhr.onload = function (e) {
|
|
|
+ if (this.status === 200) {
|
|
|
+ var blob = this.response;
|
|
|
+ if (lodash.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
|
|
|
+ navigator.msSaveBlob(blob, filename);
|
|
|
+ YvanUI.clearLoading();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var a = document.createElement('a');
|
|
|
+ var url = createObjectURL(blob);
|
|
|
+ a.href = url;
|
|
|
+ a.download = filename;
|
|
|
+ document.append(a);
|
|
|
+ a.click();
|
|
|
+ a.remove();
|
|
|
+ window.URL.revokeObjectURL(url);
|
|
|
+ YvanUI.clearLoading();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ xhr.send(formData);
|
|
|
+ }
|
|
|
+ //# sourceMappingURL=ajax.js.map
|
|
|
+
|
|
|
exports.Lib = Lib;
|
|
|
exports.LibParam = LibParam;
|
|
|
exports.Scope = Scope;
|