define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { 'use strict'; var axios__default = 'default' in axios ? axios['default'] : axios; Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs; _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2; $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2; moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1; XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX; localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage; BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler; LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL; handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars; sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat; var labelWidth = 80; var windows = { modal: true, width: 900, height: 600, maximizable: true, constrain: true, shadow: false, }; var date = { labelAlign: 'right', labelWidth: labelWidth, }; var tagfield = { labelAlign: 'right', labelWidth: labelWidth, valueField: 'id', displayField: 'text', autoLoad: true, mode: 'local', forceSelection: true, triggerAction: 'all', enableKeyEvents: true, queryMode: 'local', filterPickList: true, }; var combo = { labelAlign: 'right', labelWidth: labelWidth, valueField: 'id', displayField: 'text', autoLoad: true, mode: 'local', forceSelection: true, triggerAction: 'all', enableKeyEvents: true, typeAheadDelay: 1, queryDelay: 1, }; var comboGrid = { selectOnTab: true, pickerHeight: 500, pickerWidth: 850, editEnable: null, }; var comboGridPicker = { xtype: 'yvgrid', layout: 'fit', selModel: { selType: 'rowmodel', mode: 'SINGLE' }, }; var comboGridMulti = { selectOnTab: true, pickerHeight: 500, pickerWidth: 850, editEnable: null, splitChar: ',', displayField: 'text', valueField: 'id', autoLoad: true, }; var comboGridMultiPicker = { selType: 'checkboxmodel', selModel: { type: 'checkboxmodel', checkOnly: false }, }; var numberfield = { labelAlign: 'right', decimalPrecision: 6, labelWidth: labelWidth, }; var checkbox = { labelAlign: 'right', labelWidth: labelWidth, checkedValue: true, uncheckedValue: false, }; var checkboxgroup = { labelAlign: 'right', labelWidth: labelWidth, }; var radio = { labelAlign: 'right', labelWidth: labelWidth, }; var radiogroup = { labelAlign: 'right', labelWidth: labelWidth, simpleValue: true, layout: 'hbox', defaults: { xtype: 'radio', name: 'type', margin: '0 15 0 0' }, }; var form = { margin: '5 5 0 0', border: false, defaults: { margin: '0 0 5 0', border: false, }, }; var column = { filter: { type: 'string' }, }; var grid = { border: true, columnLines: true, rowLines: true, plugins: { cellediting: { clicksToEdit: 1, }, gridfilters: true }, multiColumnSort: true, viewConfig: { enableTextSelection: true, sortOnClick: false, emptyText: '没有数据' }, selModel: { type: 'checkboxmodel', checkOnly: false }, pagination: true, pageSize: 50, pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'], hideFootbar: false, hideRefresh: false, hideExport: false, hideAutoSize: false, hideClearFilter: false, hideSaveGridUIConfig: false, hideClearGridUIConfig: false, autoLoad: true, remoteSort: false, remoteFilter: false, enableLocking: true, syncRowHeight: false, enableColumnMove: true, enableColumnHide: true, enableColumnResize: true, hidden: false, disabled: false, exportExcelPageSize: 100, exportExcelCurrentPage: 1, exportExcelTotal: 0, cellTip: false, }; var fieldContainer = { labelAlign: 'right', labelWidth: labelWidth, layout: 'hbox', defaults: { flex: 1, } }; var tree = { autoLoad: true, hideFilter: false, hideToolbar: false, hideRefresh: false, hideExpand: false, hideCollapse: false, root: [], rootVisible: false, }; var search = { labelAlign: 'right', labelWidth: labelWidth, }; var text = { labelAlign: 'right', labelWidth: labelWidth, msgTarget: 'qtip', }; var toolbar = { overflowHandler: 'menu', }; var tbfill = {}; var tbseparator = {}; var button = {}; var fieldSet = { margin: '5 5 0 0', border: false, defaults: { margin: '0 0 5 0', border: false, }, }; var storeAjax = { timeout: 60000 }; var panel = {}; var splitter = {}; var maintab = {}; var rows = {}; var cols = { defaults: { flex: 1 }, }; var bpmn = { hideRefresh: false, autoLoad: true, dataSource: '', bpmnConfig: {} }; //# sourceMappingURL=Defaults.js.map var Defaults = /*#__PURE__*/Object.freeze({ __proto__: null, windows: windows, date: date, tagfield: tagfield, combo: combo, comboGrid: comboGrid, comboGridPicker: comboGridPicker, comboGridMulti: comboGridMulti, comboGridMultiPicker: comboGridMultiPicker, numberfield: numberfield, checkbox: checkbox, checkboxgroup: checkboxgroup, radio: radio, radiogroup: radiogroup, form: form, column: column, grid: grid, fieldContainer: fieldContainer, tree: tree, search: search, text: text, toolbar: toolbar, tbfill: tbfill, tbseparator: tbseparator, button: button, fieldSet: fieldSet, storeAjax: storeAjax, panel: panel, splitter: splitter, maintab: maintab, rows: rows, cols: cols, bpmn: bpmn }); var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var dist = createCommonjsModule(function (module, exports) { (function (global, factory) { module.exports = factory() ; }(commonjsGlobal, (function () { function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var _global = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef }); var _core = createCommonjsModule(function (module) { var core = module.exports = { version: '2.6.5' }; if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef }); var _core_1 = _core.version; var _isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var _anObject = function (it) { if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); } return it; }; var _fails = function (exec) { try { return !!exec(); } catch (e) { return true; } }; // Thank's IE8 for his funny defineProperty var _descriptors = !_fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); var document = _global.document; // typeof document.createElement is 'object' in old IE var is = _isObject(document) && _isObject(document.createElement); var _domCreate = function (it) { return is ? document.createElement(it) : {}; }; var _ie8DomDefine = !_descriptors && !_fails(function () { return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; }); // 7.1.1 ToPrimitive(input [, PreferredType]) // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var _toPrimitive = function (it, S) { if (!_isObject(it)) { return it; } var fn, val; if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; } if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; } if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; } throw TypeError("Can't convert object to primitive value"); }; var dP = Object.defineProperty; var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { _anObject(O); P = _toPrimitive(P, true); _anObject(Attributes); if (_ie8DomDefine) { try { return dP(O, P, Attributes); } catch (e) { /* empty */ } } if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); } if ('value' in Attributes) { O[P] = Attributes.value; } return O; }; var _objectDp = { f: f }; var _propertyDesc = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var _hide = _descriptors ? function (object, key, value) { return _objectDp.f(object, key, _propertyDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var hasOwnProperty = {}.hasOwnProperty; var _has = function (it, key) { return hasOwnProperty.call(it, key); }; var id = 0; var px = Math.random(); var _uid = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; var _shared = createCommonjsModule(function (module) { var SHARED = '__core-js_shared__'; var store = _global[SHARED] || (_global[SHARED] = {}); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: _core.version, mode: 'global', copyright: '© 2019 Denis Pushkarev (zloirock.ru)' }); }); var _functionToString = _shared('native-function-to-string', Function.toString); var _redefine = createCommonjsModule(function (module) { var SRC = _uid('src'); var TO_STRING = 'toString'; var TPL = ('' + _functionToString).split(TO_STRING); _core.inspectSource = function (it) { return _functionToString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); } if (O[key] === val) { return; } if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); } if (O === _global) { O[key] = val; } else if (!safe) { delete O[key]; _hide(O, key, val); } else if (O[key]) { O[key] = val; } else { _hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || _functionToString.call(this); }); }); var _aFunction = function (it) { if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); } return it; }; // optional / simple context binding var _ctx = function (fn, that, length) { _aFunction(fn); if (that === undefined) { return fn; } switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) { source = name; } for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; // extend global if (target) { _redefine(target, key, out, type & $export.U); } // export if (exports[key] != out) { _hide(exports, key, exp); } if (IS_PROTO && expProto[key] != out) { expProto[key] = out; } } }; _global.core = _core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` var _export = $export; // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; var _toInteger = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; // 7.2.1 RequireObjectCoercible(argument) var _defined = function (it) { if (it == undefined) { throw TypeError("Can't call method on " + it); } return it; }; // true -> String#at // false -> String#codePointAt var _stringAt = function (TO_STRING) { return function (that, pos) { var s = String(_defined(that)); var i = _toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; } a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; var $at = _stringAt(false); _export(_export.P, 'String', { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: function codePointAt(pos) { return $at(this, pos); } }); var codePointAt = _core.String.codePointAt; var max = Math.max; var min = Math.min; var _toAbsoluteIndex = function (index, length) { index = _toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; var fromCharCode = String.fromCharCode; var $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function fromCodePoint(x) { var arguments$1 = arguments; // eslint-disable-line no-unused-vars var res = []; var aLen = arguments.length; var i = 0; var code; while (aLen > i) { code = +arguments$1[i++]; if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); } res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); } }); var fromCodePoint = _core.String.fromCodePoint; // This is a generated file. Do not edit. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/; var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/; var unicode = { Space_Separator: Space_Separator, ID_Start: ID_Start, ID_Continue: ID_Continue }; var util = { isSpaceSeparator: function isSpaceSeparator (c) { return typeof c === 'string' && unicode.Space_Separator.test(c) }, isIdStartChar: function isIdStartChar (c) { return typeof c === 'string' && ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c === '$') || (c === '_') || unicode.ID_Start.test(c) ) }, isIdContinueChar: function isIdContinueChar (c) { return typeof c === 'string' && ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (c === '$') || (c === '_') || (c === '\u200C') || (c === '\u200D') || unicode.ID_Continue.test(c) ) }, isDigit: function isDigit (c) { return typeof c === 'string' && /[0-9]/.test(c) }, isHexDigit: function isHexDigit (c) { return typeof c === 'string' && /[0-9A-Fa-f]/.test(c) }, }; var source; var parseState; var stack; var pos; var line; var column; var token; var key; var root; var parse = function parse (text, reviver) { source = String(text); parseState = 'start'; stack = []; pos = 0; line = 1; column = 0; token = undefined; key = undefined; root = undefined; do { token = lex(); // This code is unreachable. // if (!parseStates[parseState]) { // throw invalidParseState() // } parseStates[parseState](); } while (token.type !== 'eof') if (typeof reviver === 'function') { return internalize({'': root}, '', reviver) } return root }; function internalize (holder, name, reviver) { var value = holder[name]; if (value != null && typeof value === 'object') { for (var key in value) { var replacement = internalize(value, key, reviver); if (replacement === undefined) { delete value[key]; } else { value[key] = replacement; } } } return reviver.call(holder, name, value) } var lexState; var buffer; var doubleQuote; var sign; var c; function lex () { lexState = 'default'; buffer = ''; doubleQuote = false; sign = 1; for (;;) { c = peek(); // This code is unreachable. // if (!lexStates[lexState]) { // throw invalidLexState(lexState) // } var token = lexStates[lexState](); if (token) { return token } } } function peek () { if (source[pos]) { return String.fromCodePoint(source.codePointAt(pos)) } } function read () { var c = peek(); if (c === '\n') { line++; column = 0; } else if (c) { column += c.length; } else { column++; } if (c) { pos += c.length; } return c } var lexStates = { default: function default$1 () { switch (c) { case '\t': case '\v': case '\f': case ' ': case '\u00A0': case '\uFEFF': case '\n': case '\r': case '\u2028': case '\u2029': read(); return case '/': read(); lexState = 'comment'; return case undefined: read(); return newToken('eof') } if (util.isSpaceSeparator(c)) { read(); return } // This code is unreachable. // if (!lexStates[parseState]) { // throw invalidLexState(parseState) // } return lexStates[parseState]() }, comment: function comment () { switch (c) { case '*': read(); lexState = 'multiLineComment'; return case '/': read(); lexState = 'singleLineComment'; return } throw invalidChar(read()) }, multiLineComment: function multiLineComment () { switch (c) { case '*': read(); lexState = 'multiLineCommentAsterisk'; return case undefined: throw invalidChar(read()) } read(); }, multiLineCommentAsterisk: function multiLineCommentAsterisk () { switch (c) { case '*': read(); return case '/': read(); lexState = 'default'; return case undefined: throw invalidChar(read()) } read(); lexState = 'multiLineComment'; }, singleLineComment: function singleLineComment () { switch (c) { case '\n': case '\r': case '\u2028': case '\u2029': read(); lexState = 'default'; return case undefined: read(); return newToken('eof') } read(); }, value: function value () { switch (c) { case '{': case '[': return newToken('punctuator', read()) case 'n': read(); literal('ull'); return newToken('null', null) case 't': read(); literal('rue'); return newToken('boolean', true) case 'f': read(); literal('alse'); return newToken('boolean', false) case '-': case '+': if (read() === '-') { sign = -1; } lexState = 'sign'; return case '.': buffer = read(); lexState = 'decimalPointLeading'; return case '0': buffer = read(); lexState = 'zero'; return case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': buffer = read(); lexState = 'decimalInteger'; return case 'I': read(); literal('nfinity'); return newToken('numeric', Infinity) case 'N': read(); literal('aN'); return newToken('numeric', NaN) case '"': case "'": doubleQuote = (read() === '"'); buffer = ''; lexState = 'string'; return } throw invalidChar(read()) }, identifierNameStartEscape: function identifierNameStartEscape () { if (c !== 'u') { throw invalidChar(read()) } read(); var u = unicodeEscape(); switch (u) { case '$': case '_': break default: if (!util.isIdStartChar(u)) { throw invalidIdentifier() } break } buffer += u; lexState = 'identifierName'; }, identifierName: function identifierName () { switch (c) { case '$': case '_': case '\u200C': case '\u200D': buffer += read(); return case '\\': read(); lexState = 'identifierNameEscape'; return } if (util.isIdContinueChar(c)) { buffer += read(); return } return newToken('identifier', buffer) }, identifierNameEscape: function identifierNameEscape () { if (c !== 'u') { throw invalidChar(read()) } read(); var u = unicodeEscape(); switch (u) { case '$': case '_': case '\u200C': case '\u200D': break default: if (!util.isIdContinueChar(u)) { throw invalidIdentifier() } break } buffer += u; lexState = 'identifierName'; }, sign: function sign$1 () { switch (c) { case '.': buffer = read(); lexState = 'decimalPointLeading'; return case '0': buffer = read(); lexState = 'zero'; return case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': buffer = read(); lexState = 'decimalInteger'; return case 'I': read(); literal('nfinity'); return newToken('numeric', sign * Infinity) case 'N': read(); literal('aN'); return newToken('numeric', NaN) } throw invalidChar(read()) }, zero: function zero () { switch (c) { case '.': buffer += read(); lexState = 'decimalPoint'; return case 'e': case 'E': buffer += read(); lexState = 'decimalExponent'; return case 'x': case 'X': buffer += read(); lexState = 'hexadecimal'; return } return newToken('numeric', sign * 0) }, decimalInteger: function decimalInteger () { switch (c) { case '.': buffer += read(); lexState = 'decimalPoint'; return case 'e': case 'E': buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { buffer += read(); return } return newToken('numeric', sign * Number(buffer)) }, decimalPointLeading: function decimalPointLeading () { if (util.isDigit(c)) { buffer += read(); lexState = 'decimalFraction'; return } throw invalidChar(read()) }, decimalPoint: function decimalPoint () { switch (c) { case 'e': case 'E': buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { buffer += read(); lexState = 'decimalFraction'; return } return newToken('numeric', sign * Number(buffer)) }, decimalFraction: function decimalFraction () { switch (c) { case 'e': case 'E': buffer += read(); lexState = 'decimalExponent'; return } if (util.isDigit(c)) { buffer += read(); return } return newToken('numeric', sign * Number(buffer)) }, decimalExponent: function decimalExponent () { switch (c) { case '+': case '-': buffer += read(); lexState = 'decimalExponentSign'; return } if (util.isDigit(c)) { buffer += read(); lexState = 'decimalExponentInteger'; return } throw invalidChar(read()) }, decimalExponentSign: function decimalExponentSign () { if (util.isDigit(c)) { buffer += read(); lexState = 'decimalExponentInteger'; return } throw invalidChar(read()) }, decimalExponentInteger: function decimalExponentInteger () { if (util.isDigit(c)) { buffer += read(); return } return newToken('numeric', sign * Number(buffer)) }, hexadecimal: function hexadecimal () { if (util.isHexDigit(c)) { buffer += read(); lexState = 'hexadecimalInteger'; return } throw invalidChar(read()) }, hexadecimalInteger: function hexadecimalInteger () { if (util.isHexDigit(c)) { buffer += read(); return } return newToken('numeric', sign * Number(buffer)) }, string: function string () { switch (c) { case '\\': read(); buffer += escape(); return case '"': if (doubleQuote) { read(); return newToken('string', buffer) } buffer += read(); return case "'": if (!doubleQuote) { read(); return newToken('string', buffer) } buffer += read(); return case '\n': case '\r': throw invalidChar(read()) case '\u2028': case '\u2029': separatorChar(c); break case undefined: throw invalidChar(read()) } buffer += read(); }, start: function start () { switch (c) { case '{': case '[': return newToken('punctuator', read()) // This code is unreachable since the default lexState handles eof. // case undefined: // return newToken('eof') } lexState = 'value'; }, beforePropertyName: function beforePropertyName () { switch (c) { case '$': case '_': buffer = read(); lexState = 'identifierName'; return case '\\': read(); lexState = 'identifierNameStartEscape'; return case '}': return newToken('punctuator', read()) case '"': case "'": doubleQuote = (read() === '"'); lexState = 'string'; return } if (util.isIdStartChar(c)) { buffer += read(); lexState = 'identifierName'; return } throw invalidChar(read()) }, afterPropertyName: function afterPropertyName () { if (c === ':') { return newToken('punctuator', read()) } throw invalidChar(read()) }, beforePropertyValue: function beforePropertyValue () { lexState = 'value'; }, afterPropertyValue: function afterPropertyValue () { switch (c) { case ',': case '}': return newToken('punctuator', read()) } throw invalidChar(read()) }, beforeArrayValue: function beforeArrayValue () { if (c === ']') { return newToken('punctuator', read()) } lexState = 'value'; }, afterArrayValue: function afterArrayValue () { switch (c) { case ',': case ']': return newToken('punctuator', read()) } throw invalidChar(read()) }, end: function end () { // This code is unreachable since it's handled by the default lexState. // if (c === undefined) { // read() // return newToken('eof') // } throw invalidChar(read()) }, }; function newToken (type, value) { return { type: type, value: value, line: line, column: column, } } function literal (s) { for (var i = 0, list = s; i < list.length; i += 1) { var c = list[i]; var p = peek(); if (p !== c) { throw invalidChar(read()) } read(); } } function escape () { var c = peek(); switch (c) { case 'b': read(); return '\b' case 'f': read(); return '\f' case 'n': read(); return '\n' case 'r': read(); return '\r' case 't': read(); return '\t' case 'v': read(); return '\v' case '0': read(); if (util.isDigit(peek())) { throw invalidChar(read()) } return '\0' case 'x': read(); return hexEscape() case 'u': read(); return unicodeEscape() case '\n': case '\u2028': case '\u2029': read(); return '' case '\r': read(); if (peek() === '\n') { read(); } return '' case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': throw invalidChar(read()) case undefined: throw invalidChar(read()) } return read() } function hexEscape () { var buffer = ''; var c = peek(); if (!util.isHexDigit(c)) { throw invalidChar(read()) } buffer += read(); c = peek(); if (!util.isHexDigit(c)) { throw invalidChar(read()) } buffer += read(); return String.fromCodePoint(parseInt(buffer, 16)) } function unicodeEscape () { var buffer = ''; var count = 4; while (count-- > 0) { var c = peek(); if (!util.isHexDigit(c)) { throw invalidChar(read()) } buffer += read(); } return String.fromCodePoint(parseInt(buffer, 16)) } var parseStates = { start: function start () { if (token.type === 'eof') { throw invalidEOF() } push(); }, beforePropertyName: function beforePropertyName () { switch (token.type) { case 'identifier': case 'string': key = token.value; parseState = 'afterPropertyName'; return case 'punctuator': // This code is unreachable since it's handled by the lexState. // if (token.value !== '}') { // throw invalidToken() // } pop(); return case 'eof': throw invalidEOF() } // This code is unreachable since it's handled by the lexState. // throw invalidToken() }, afterPropertyName: function afterPropertyName () { // This code is unreachable since it's handled by the lexState. // if (token.type !== 'punctuator' || token.value !== ':') { // throw invalidToken() // } if (token.type === 'eof') { throw invalidEOF() } parseState = 'beforePropertyValue'; }, beforePropertyValue: function beforePropertyValue () { if (token.type === 'eof') { throw invalidEOF() } push(); }, beforeArrayValue: function beforeArrayValue () { if (token.type === 'eof') { throw invalidEOF() } if (token.type === 'punctuator' && token.value === ']') { pop(); return } push(); }, afterPropertyValue: function afterPropertyValue () { // This code is unreachable since it's handled by the lexState. // if (token.type !== 'punctuator') { // throw invalidToken() // } if (token.type === 'eof') { throw invalidEOF() } switch (token.value) { case ',': parseState = 'beforePropertyName'; return case '}': pop(); } // This code is unreachable since it's handled by the lexState. // throw invalidToken() }, afterArrayValue: function afterArrayValue () { // This code is unreachable since it's handled by the lexState. // if (token.type !== 'punctuator') { // throw invalidToken() // } if (token.type === 'eof') { throw invalidEOF() } switch (token.value) { case ',': parseState = 'beforeArrayValue'; return case ']': pop(); } // This code is unreachable since it's handled by the lexState. // throw invalidToken() }, end: function end () { // This code is unreachable since it's handled by the lexState. // if (token.type !== 'eof') { // throw invalidToken() // } }, }; function push () { var value; switch (token.type) { case 'punctuator': switch (token.value) { case '{': value = {}; break case '[': value = []; break } break case 'null': case 'boolean': case 'numeric': case 'string': value = token.value; break // This code is unreachable. // default: // throw invalidToken() } if (root === undefined) { root = value; } else { var parent = stack[stack.length - 1]; if (Array.isArray(parent)) { parent.push(value); } else { parent[key] = value; } } if (value !== null && typeof value === 'object') { stack.push(value); if (Array.isArray(value)) { parseState = 'beforeArrayValue'; } else { parseState = 'beforePropertyName'; } } else { var current = stack[stack.length - 1]; if (current == null) { parseState = 'end'; } else if (Array.isArray(current)) { parseState = 'afterArrayValue'; } else { parseState = 'afterPropertyValue'; } } } function pop () { stack.pop(); var current = stack[stack.length - 1]; if (current == null) { parseState = 'end'; } else if (Array.isArray(current)) { parseState = 'afterArrayValue'; } else { parseState = 'afterPropertyValue'; } } // This code is unreachable. // function invalidParseState () { // return new Error(`JSON5: invalid parse state '${parseState}'`) // } // This code is unreachable. // function invalidLexState (state) { // return new Error(`JSON5: invalid lex state '${state}'`) // } function invalidChar (c) { if (c === undefined) { return syntaxError(("JSON5: invalid end of input at " + line + ":" + column)) } return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column)) } function invalidEOF () { return syntaxError(("JSON5: invalid end of input at " + line + ":" + column)) } // This code is unreachable. // function invalidToken () { // if (token.type === 'eof') { // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) // } // const c = String.fromCodePoint(token.value.codePointAt(0)) // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) // } function invalidIdentifier () { column -= 5; return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column)) } function separatorChar (c) { console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping")); } function formatChar (c) { var replacements = { "'": "\\'", '"': '\\"', '\\': '\\\\', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\v': '\\v', '\0': '\\0', '\u2028': '\\u2028', '\u2029': '\\u2029', }; if (replacements[c]) { return replacements[c] } if (c < ' ') { var hexString = c.charCodeAt(0).toString(16); return '\\x' + ('00' + hexString).substring(hexString.length) } return c } function syntaxError (message) { var err = new SyntaxError(message); err.lineNumber = line; err.columnNumber = column; return err } var stringify = function stringify (value, replacer, space) { var stack = []; var indent = ''; var propertyList; var replacerFunc; var gap = ''; var quote; if ( replacer != null && typeof replacer === 'object' && !Array.isArray(replacer) ) { space = replacer.space; quote = replacer.quote; replacer = replacer.replacer; } if (typeof replacer === 'function') { replacerFunc = replacer; } else if (Array.isArray(replacer)) { propertyList = []; for (var i = 0, list = replacer; i < list.length; i += 1) { var v = list[i]; var item = (void 0); if (typeof v === 'string') { item = v; } else if ( typeof v === 'number' || v instanceof String || v instanceof Number ) { item = String(v); } if (item !== undefined && propertyList.indexOf(item) < 0) { propertyList.push(item); } } } if (space instanceof Number) { space = Number(space); } else if (space instanceof String) { space = String(space); } if (typeof space === 'number') { if (space > 0) { space = Math.min(10, Math.floor(space)); gap = ' '.substr(0, space); } } else if (typeof space === 'string') { gap = space.substr(0, 10); } return serializeProperty('', {'': value}) function serializeProperty (key, holder) { var value = holder[key]; if (value != null) { if (typeof value.toJSON5 === 'function') { value = value.toJSON5(key); } else if (typeof value.toJSON === 'function') { value = value.toJSON(key); } } if (replacerFunc) { value = replacerFunc.call(holder, key, value); } if (value instanceof Number) { value = Number(value); } else if (value instanceof String) { value = String(value); } else if (value instanceof Boolean) { value = value.valueOf(); } switch (value) { case null: return 'null' case true: return 'true' case false: return 'false' } if (typeof value === 'string') { return quoteString(value) } if (typeof value === 'number') { return String(value) } if (typeof value === 'object') { return Array.isArray(value) ? serializeArray(value) : serializeObject(value) } return undefined } function quoteString (value) { var quotes = { "'": 0.1, '"': 0.2, }; var replacements = { "'": "\\'", '"': '\\"', '\\': '\\\\', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', '\v': '\\v', '\0': '\\0', '\u2028': '\\u2028', '\u2029': '\\u2029', }; var product = ''; for (var i = 0; i < value.length; i++) { var c = value[i]; switch (c) { case "'": case '"': quotes[c]++; product += c; continue case '\0': if (util.isDigit(value[i + 1])) { product += '\\x00'; continue } } if (replacements[c]) { product += replacements[c]; continue } if (c < ' ') { var hexString = c.charCodeAt(0).toString(16); product += '\\x' + ('00' + hexString).substring(hexString.length); continue } product += c; } var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; }); product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]); return quoteChar + product + quoteChar } function serializeObject (value) { if (stack.indexOf(value) >= 0) { throw TypeError('Converting circular structure to JSON5') } stack.push(value); var stepback = indent; indent = indent + gap; var keys = propertyList || Object.keys(value); var partial = []; for (var i = 0, list = keys; i < list.length; i += 1) { var key = list[i]; var propertyString = serializeProperty(key, value); if (propertyString !== undefined) { var member = serializeKey(key) + ':'; if (gap !== '') { member += ' '; } member += propertyString; partial.push(member); } } var final; if (partial.length === 0) { final = '{}'; } else { var properties; if (gap === '') { properties = partial.join(','); final = '{' + properties + '}'; } else { var separator = ',\n' + indent; properties = partial.join(separator); final = '{\n' + indent + properties + ',\n' + stepback + '}'; } } stack.pop(); indent = stepback; return final } function serializeKey (key) { if (key.length === 0) { return quoteString(key) } var firstChar = String.fromCodePoint(key.codePointAt(0)); if (!util.isIdStartChar(firstChar)) { return quoteString(key) } for (var i = firstChar.length; i < key.length; i++) { if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { return quoteString(key) } } return key } function serializeArray (value) { if (stack.indexOf(value) >= 0) { throw TypeError('Converting circular structure to JSON5') } stack.push(value); var stepback = indent; indent = indent + gap; var partial = []; for (var i = 0; i < value.length; i++) { var propertyString = serializeProperty(String(i), value); partial.push((propertyString !== undefined) ? propertyString : 'null'); } var final; if (partial.length === 0) { final = '[]'; } else { if (gap === '') { var properties = partial.join(','); final = '[' + properties + ']'; } else { var separator = ',\n' + indent; var properties$1 = partial.join(separator); final = '[\n' + indent + properties$1 + ',\n' + stepback + ']'; } } stack.pop(); indent = stepback; return final } }; var JSON5 = { parse: parse, stringify: stringify, }; var lib = JSON5; var es5 = lib; return es5; }))); }); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var PropertyDescription = /** @class */ (function () { function PropertyDescription() { var _this = this; var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this.propertyes = { props: [], events: [] }; _$2.each(args, function (arg) { _this.merge(arg); }); } PropertyDescription.prototype.merge = function (pd) { this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name')); if (pd.events) { if (this.propertyes.events) { this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name')); } else { this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name'); } } }; /** * 根据分组名 获取属性定义 */ PropertyDescription.prototype.getPropsByGroup = function (name) { return _$2.filter(this.propertyes.props, function (i) { return i.group === name; }); }; /** * 获取全部事件 */ PropertyDescription.prototype.getEvents = function () { return this.propertyes.events; }; return PropertyDescription; }()); //# sourceMappingURL=PropertyDescription.js.map var PropertyDescriptionTable = new Map(); var width = { name: 'width', default: '', group: 'common', desc: '宽', type: 'string' }; var height = { name: 'height', default: '', group: 'common', desc: '高', type: 'string' }; var fieldLabel = { name: 'fieldLabel', default: '', group: 'common', desc: '文本描述', type: 'string', expr: true, }; var text$1 = { name: 'text', default: '', group: 'common', desc: '文本描述', type: 'string', expr: true, }; var iconCls = { name: 'iconCls', default: '', group: 'common', desc: '图标', type: 'string', expr: true, }; var disabled = { name: 'disabled', default: false, group: 'common', desc: '禁用', type: 'boolean', expr: true, }; var value = { name: 'value', default: '', group: 'common', desc: '字段值', type: 'string', expr: true, }; var template = { name: 'template', default: '', group: 'common', desc: 'HTML内容', type: 'string', expr: true, }; var reference = { name: 'reference', default: '', group: 'common', desc: '组件句柄', type: 'string', expr: true, }; var tooltip = { name: 'tooltip', default: '', group: 'common', desc: '悬停提示', type: 'string' }; // =============事件 ============== var click = { name: 'click', default: '', group: 'listeners', desc: '点击事件', eventParamter: [ 'sender', 'e: any' ], type: 'listeners' }; var change = { name: 'change', default: '', group: 'listeners', desc: 'value change事件', eventParamter: [ 'sender', 'e: any' ], type: 'listeners' }; var keyup = { name: 'keyup', default: '', group: 'listeners', desc: '键盘按键抬起事件', eventParamter: [ 'sender', 'e' ], type: 'listeners' }; var afterrender = { name: 'afterrender', default: '', group: 'listeners', desc: '控件渲染后触发', eventParamter: [ 'sender', 'e' ], type: 'listeners' }; // =============特性 ============== var fix = { name: 'fix', default: '', group: 'fix', desc: '特性', type: 'fix', expr: true, }; PropertyDescriptionTable.set('cols', new PropertyDescription({ props: [ height ] })); PropertyDescriptionTable.set('layout', new PropertyDescription({ props: [ { name: 'borderless', default: true, group: 'css', desc: '有无边框', type: 'boolean' }, { name: 'type', default: '', group: 'css', desc: '布局类型', type: ['line', 'clean', 'wide', 'space', 'form'] }, { name: '_designMode', default: 'module', group: 'common', desc: '设计类型', type: ['none', 'module', 'scroll-module'] } ] })); var YvBase = { props: [ width, height, reference, afterrender, fix ], events: [ // {name: 'onRender', desc: '第一次控件被渲染时触发'} ] }; PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, { props: [ template ] })); PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, { props: [ { name: 'label', default: '', group: 'common', desc: '字段组标题', type: 'string' } ] })); PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, { props: [ { name: 'src', default: '', group: 'common', desc: '地址路径', type: 'string' } ] })); PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, { props: [ width, height, { name: 'value', default: '上传', group: 'common', desc: '文本描述', type: 'string' }, { name: 'upload', default: '/upload', group: 'common', desc: '上传地址', type: 'string' }, ], events: [ { name: 'onFileUpload', desc: '文件上传成功结束时触发' }, { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' }, ] })); PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, { props: [ value, { name: 'imgWidth', default: '', group: 'common', desc: '图片宽', type: 'string' }, { name: 'imgHeight', default: '', group: 'common', desc: '图片高', type: 'string' } ] })); PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, { props: [ value, { name: 'imgWidth', default: '', group: 'common', desc: '图片宽', type: 'string' }, { name: 'imgHeight', default: '', group: 'common', desc: '图片高', type: 'string' } ] })); PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, { props: [text$1, disabled, height, width, iconCls, click, afterrender], })); PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height ], })); PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height ], })); PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, keyup, afterrender, change ], })); PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, { props: [ fieldLabel, value, disabled, tooltip, width, height, afterrender, change ], })); //# sourceMappingURL=PropertyDescriptionTable.js.map /** * 弹出输入框,输入文字 * @param message 提示文字 * @param defaultValue 默认值 * @param multiLine 是否多行输入 */ function prompt$1(message, defaultValue, multiLine) { if (defaultValue === void 0) { defaultValue = ""; } if (multiLine === void 0) { multiLine = false; } return new Promise(function (resolve) { Ext.MessageBox.prompt('请输入', message, function (button, value) { if (button === 'ok') { resolve(value); } }, null, multiLine, defaultValue); }); } /** * 显示错误异常信息 * @param msg 错误内容 * @param sender 发送者按钮(可以为空) */ function showErrorDialog(msg, sender) { console.error(msg); Ext.MessageBox.show({ title: '错误', msg: msg, buttons: Ext.MessageBox.OK, animateTarget: sender, icon: 'error', cls: 'show-icon-messagebox', }); } /** * 显示错误异常信息 * @param msg 错误内容 * @param sender 发送者按钮(可以为空) */ function showInfoDialogSimple(msg, sender) { console.info(msg); Ext.MessageBox.show({ title: '提示', msg: msg, buttons: Ext.MessageBox.OK, animateTarget: sender, icon: 'info', cls: 'show-icon-messagebox', }); } function msgError(msg, sender) { showErrorDialog(msg, sender); } /** * 中间灰底白字提示 */ function msg(message) { console.log(message); var t = { message: message }; var WMSTranslate = window["WMSTranslate"]; if (WMSTranslate) { if (typeof window['viewTranslate'] === 'function') { window['viewTranslate'](t, message, "message"); } } var $body = $$2('body'); $body.find('[xtype=tooltip]').remove(); var $w = $$2('
' + '
' + _$2.escape(t.message) + '
'); $body.append($w); var iframeWidth = $w.parent().width(); var iframeHeight = $w.parent().height(); var windowWidth = $w.width(); var windowHeight = $w.height(); var setWidth = (iframeWidth - windowWidth) / 2; var setHeight = (iframeHeight - windowHeight) / 2; if (iframeHeight < windowHeight || setHeight < 0) { setHeight = 0; } if (iframeWidth < windowWidth || setWidth < 0) { setWidth = 0; } $w.css({ left: setWidth, top: setHeight }); setTimeout(function () { $w.remove(); }, 3000); } //# sourceMappingURL=message.js.map localforage.config({ name: "studio", storeName: "item", }); function getItem(key, callback) { localforage.getItem(key).then(function (value) { if (callback) { callback(value); } }); } function setItem(key, value, callback) { localforage.setItem(key, value).then(function (val) { if (callback) { callback(); } }); } var native = { /** * 读取文件 */ loadFile: function (fileName, callback) { console.log('loadFile', fileName); getItem('NATIVE_' + fileName, callback); }, /** * 保存文件 */ saveFile: function (fileName, content) { console.log('saveFile', fileName, content); setItem('NATIVE_' + fileName, content); }, openInIdea: function (path) { msg(path); }, /** * 初始化 native 工具类 */ init: function () { var ClipboardJS = window['ClipboardJS']; if (!ClipboardJS) { msg('没有引入 ClipboardJS'); return; } $(document.body).append("\n \n "); var clipboard = new ClipboardJS('.__btnClipboard'); }, /** * 设置剪切板 */ clipboardSet: function (c) { var $btn = $('.__btnClipboard'); $btn.attr('data-clipboard-text', c); $btn.trigger("click"); }, }; /** * 判断变量是否有值 value === null || value === undefined * @param value 目标变量 */ var noValue = function (value) { return value === null || value === undefined; }; //# sourceMappingURL=Utils.js.map function initStateTree () { Ext.define('com.yvan.studio.StateTree', { extend: 'Ext.tree.Panel', _saveStateFlag: true, _filterText: '', fbar: [ { xtype: 'textfield', flex: 1, emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: function (sender) { var tree = sender.up("treepanel"); tree.filterByText(this.getRawValue()); }, keyup: function (sender, e) { var tree = sender.up("treepanel"); if (e.ESC === e.getKey()) { sender.setValue(''); tree.filterByText(''); } } } }, ], getStateFilename: function () { throw Error('没有实现这个函数'); }, initComponent: function () { var me = this; this.on({ afterrender: function () { var _this = this; // 回车后打开节点 $(me.el.dom).keydown(function (event) { if (event.keyCode === 13) { event.preventDefault(); _this.fireEvent('itemverify'); return; } }); }, afteritemexpand: { fn: function (node, index, item, eOpts) { this.saveState(); }, buffer: 100, }, afteritemcollapse: { fn: function (node, index, item, eOpts) { this.saveState(); }, buffer: 100, }, itemdblclick: function (sender, record) { this.fireEvent('itemverify'); }, itemclick: { fn: function (node, index, item, eOpts) { this.saveState(); }, buffer: 100, } }); this.superclass.superclass.initComponent.apply(this, arguments); }, restoreState: function () { var _this = this; native.loadFile(this.getStateFilename(), function (content) { if (!content) return; var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize; _this._saveStateFlag = false; if (_.isArray(expands)) { _.forEach(expands, function (p) { _this.expandPath(p); }); } if (_.isArray(selections) && selections[0]) { try { _this.selectPath(selections[0]); } catch (e) { } } if (scrollPosition && scrollSize) { var size = _this.scrollable.getSize(); if (size.x === scrollSize.x && size.y === scrollSize.y) { try { _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y); } catch (e) { } } } setTimeout(function () { _this._saveStateFlag = true; }, 200); }); }, saveState: function () { if (!this._saveStateFlag) { return; } if (this._filterText) { // 有筛选,不保存展开状态 return; } var expands = []; var selections = []; var selection = this.getSelection(); _.forEach(selection, function (item) { selections.push(item.getPath()); }); var data = this.getStore().data; _.forEach(data.items, function (item) { if (item.data.expanded === true) { expands.push(item.getPath()); } }); var scrollPosition = this.scrollable.position; var scrollSize = this.scrollable.getSize(); native.saveFile(this.getStateFilename(), { selections: selections, expands: expands, scrollPosition: scrollPosition, scrollSize: scrollSize }); }, filterByText: function (text) { this._filterText = text; this._filterBy(this, text, 'text'); }, _filterBy: _.debounce(function (me, text, by) { var view = me.getView(); me.store.clearFilter(); if (!me._filterText) { // 没有筛选内容,还原状态 var selections = me.getSelection(); var selectionPaths_1 = []; _.forEach(me.getSelection(), function (item) { selectionPaths_1.push(item.getPath()); }); me.collapseAll(); me.restoreState(); _.forEach(selectionPaths_1, function (path) { me.expandPath(path); }); me.setSelection(selections); return; } // 递归查找所有需要可见的节点 id 数组 var nodesAndParents = []; var expandPaths = []; me.getRootNode().cascadeBy(function (tree, view) { var currNode = this; currNode.collapse(); if (currNode && currNode.data[by] && currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) { // 展开到匹配的路径 // me.expandPath(currNode.getPath()); expandPaths.push(currNode.getPath()); // 沿途父节点全部设定为可见 while (currNode.parentNode) { nodesAndParents.push(currNode.id); currNode = currNode.parentNode; } } }, null, [me, view]); me.store.filterBy(function (r) { return Ext.Array.contains(nodesAndParents, r.get('id')); }); _.forEach(expandPaths, function (path) { me.expandPath(path); }); }, 1000), }); } //# sourceMappingURL=StateTree.js.map function initDashboard () { Ext.define('com.yvan.studio.Dashboard', { extend: 'Ext.panel.Panel', alias: 'widget.dashboard', xtype: 'dashboard', html: '' }); } //# sourceMappingURL=dashboard.js.map var handles$1 = { mainWindow: undefined, fileTree: undefined, dbTree: undefined, viewoutlinetree: undefined, statusbar: undefined, dictTree: undefined, property: undefined, dbcode: undefined, report: undefined, widget: undefined, whLayout: undefined, }; window['handles'] = handles$1; function setDictTree(value) { handles$1.dictTree = value; } function setMainWindow(value) { handles$1.mainWindow = value; } function setReport(value) { handles$1.report = value; } function setStatusbar(statusbar) { handles$1.statusbar = statusbar; } function setFileTree(value) { handles$1.fileTree = value; } function setDbTree(value) { handles$1.dbTree = value; } function setWidget(value) { handles$1.widget = value; } function setWhLayout(value) { handles$1.whLayout = value; } function setViewoutlinetree(value) { handles$1.viewoutlinetree = value; } function setPropertyPanel(value) { handles$1.property = value; } function setDbCode(value) { handles$1.dbcode = value; } //# sourceMappingURL=Handles.js.map /** * 调用方法 */ function invokeMethod(fn, sender, args) { if (typeof fn === 'function') { fn.apply.apply(fn, __spread([sender], args)); } } /** * 判断事件是否为有效的输入字符 * @param e */ function isChartEvent(e) { if (e.key === 'Shift' || e.key === 'Control' || e.key === 'Alt' || e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'Tab' || e.key === 'ArrowLeft') { return false; } if (e.keyCode >= 48 && e.keyCode <= 57) { // 0-9 return true; } if (e.keyCode >= 65 && e.keyCode <= 90) { // a-z return true; } if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) { // 小键盘 0-9 return true; } return false; } 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 isDesignMode(control, config) { var _a, _b; if (window["IS_DESIGN_MODE"]) { return true; } if ((control === null || control === void 0 ? void 0 : control.designMode) === true) { return true; } if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) { return true; } if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) { return true; } if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) { return true; } return false; } function toString(value) { if (typeof value === 'undefined' || value === null) { return ""; } if (typeof value === 'number' && isNaN(value)) { return ""; } if (value == 'N/A') { return ""; } return ("" + value); } function isEmpty(value) { if (typeof value === 'undefined' || value === null) { return true; } if (typeof value === 'number' && isNaN(value)) { return true; } if (value == 'N/A') { return true; } return ("" + value).trim().length <= 0; } function createUUID() { //@ts-ignore return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) { return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16); }); } function getRegList() { var regList = _$2.get(window, 'yvanLib.regList'); if (!regList) { regList = []; _$2.set(window, 'yvanLib.regList', regList); } return regList; } function getRegParamList(methodName) { var regParamList = _$2.get(window, 'yvanLib.regParamList'); if (!regParamList) { regParamList = {}; _$2.set(window, 'yvanLib.regParamList', regParamList); } if (!_$2.has(regParamList, methodName)) { regParamList[methodName] = []; } return regParamList[methodName]; } /** * 模拟点击按钮 */ function raiseClick(buttonHandle) { if (!buttonHandle) { return false; } if (buttonHandle.disabled) { // 按钮是禁止状态 return false; } if (buttonHandle.hidden) { // 按钮是隐藏状态 return false; } // 按钮点击 buttonHandle.click(); return true; } /** * 标注系统全局函数的参数 * @param title 函数名称 * @param type 函数类型 * @param allowEmpty 可否为空 */ function LibParam(title, type, allowEmpty) { if (allowEmpty === void 0) { allowEmpty = false; } return function (target, methodName, paramsIndex) { var systemFnArgs = getRegParamList(methodName); systemFnArgs[paramsIndex] = { type: type, title: title, name: methodName, allowEmpty: allowEmpty, }; }; } /** * 标注函数变成"系统全局函数" */ function Lib(registe) { return function (target, propertyKey, descriptor) { var libList = getRegList(); libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] })); if (registe.type === 'system') { _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]); } else if (registe.type === 'format') { _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]); } return target; }; } /** * 解析事件 * 'scope.私有方法名' * 'system.系统函数名' * 'format.格式化名' */ function lookupFn(scope, event, errorWho) { if (isDesignMode(scope, undefined)) { return Ext.emptyFn; } if (!_$2.startsWith(event, 'scope.') && !_$2.startsWith(event, 'system.') && !_$2.startsWith(event, 'format.')) { console.error('无法识别的事件响应类型', event); throw new TypeError('无法识别的事件响应类型'); } // 为 eval 准备环境 var _a = window['yvanLib'], system = _a.system, format = _a.format; var data = scope.viewModel.data; var keys = []; var values = []; _$2.forOwn(data, function (value, key) { var idxKey = key.indexOf('//'); if (idxKey >= 0) { keys.push(key.substr(0, idxKey)); } else { keys.push(key); } values.push(value); }); var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event])); var funcResult = func.apply(void 0, __spread([scope, system, format], values)); if (typeof funcResult !== 'function') { console.error('无法识别的事件响应类型', event, func, errorWho); throw new TypeError('无法识别的事件响应类型'); } return funcResult; } /** * 从 ext.element 获取 scope 对象 */ function lookupScope(extHandle) { if (!extHandle) { // @ts-ignore return; } if (extHandle.isScope) { return extHandle; } if (extHandle.column) { // 列上的组件 return extHandle.column.lookupReferenceHolder().yvanScope; } if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ; if (typeof extHandle.lookupViewModel === 'function') { var vm = extHandle.lookupViewModel(); return vm.yvanScope; } return; } //# sourceMappingURL=lib.js.map /** * 全局 ajax 方法 */ var ajax = {}; /** * 计算拼音的函数 */ var pinyinFunc = function (str) { return (str); }; exports.scopeOnLoad = null; exports.apiConvert = undefined; var baseConfigProcessList = []; /** * 在基类添加 Config 的处理方法 */ function baseConfigProcess(option) { return function (target, propertyKey) { baseConfigProcessList.push(target[propertyKey]); }; } // let designMode: boolean = false // // export function isDesignMode(): boolean { // return designMode // } // // export function setDesignMode(v: boolean) { // designMode = v // } /** * 将业务定义的 url 转换为调用服务端 groovy 的 url */ function serverInvokeUrlTransform(url, option) { return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option); } /** * 将业务定义的 url 转换为调用服务端 sql 的 Url */ function sqlUrlTransform(url) { return _$2.get(window, '_YvanUI_sqlPrefix')(url); } /** * YvanUI 全局扩展配置 */ function extend(option) { if (option.ajax) { ajax.func = option.ajax; } if (option.serverInvokeUrlTransform) { _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform }); } if (option.sqlUrlTransform) { _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform }); } if (option.pinyinFunction) { pinyinFunc = option.pinyinFunction; } if (option.scopeOnLoad) { exports.scopeOnLoad = option.scopeOnLoad; } if (option.scopeOnCreate) { exports.scopeOnCreate = option.scopeOnCreate; } if (option.apiConvert) { exports.apiConvert = option.apiConvert; } // if (typeof option.designMode !== 'undefined') { // setDesignMode(option.designMode) // } } function getApiConvert() { return exports.apiConvert; } function getScopeOnCreate() { return exports.scopeOnCreate; } function getPinyin(v) { return pinyinFunc(v); } /** * 适用于 Select / Tree 等,作筛选的通用方法. * 1.首字母模糊匹配(不区分大小写) * 2.标识的模糊匹配(不区分大小写) * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司” */ function keywordFilter(keyword, label, value) { if (!keyword) { return true; } var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g); // const labelPy = _.toLower(getPinyin(label)) //@ts-ignore var labelPy = _$2.toLower(getFirstPinyin2(label)); value = _$2.toLower(_$2.trim(value)); var found = 0; _$2.some(ws, function (word) { if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) { found++; return; } if (value && value.indexOf(word.toLowerCase()) >= 0) { found++; return; } }); return found >= ws.length; } //# sourceMappingURL=config.js.map var idPrefix = "_ds_"; var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container" var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container" var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"]; var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]); var layoutOrXtypeNameMap = { fit: 'fit布局', border: 'border布局', center: '中部', north: '上部', south: '下部', west: '左部', east: '右部', yvgrid: '表格', tree: '树', tabpanel: '标签页', form: '表单', fieldset: '字段组', tbar: '顶部工具栏', fbar: '底部工具栏', toolbar: '工具栏', cols: '列容器', rows: '行容器', textfield: '文本框', textareafield: '长文本框', numberfield: '数字框', label: "文本", combo: "下拉框", combobox: "下拉框", combotree: "下拉树", combogrid: "下拉表", datefield: "日期框", searchfield: "搜索框", button: "按钮", checkbox: "勾选", checkboxgroup: "勾选组", radio: "点选", radiogroup: "点选组", container: "占位" }; /** * 从 VJSON 中找到 rows/cols 的数组 */ function findArrayContainer(vjson, id) { var parentVJson = getSuperVjson(vjson, id); if (_$2.isArray(parentVJson)) { return parentVJson; } if (parentVJson.hasOwnProperty('items')) { return parentVJson.items; } } /** * 根据id查找上级vjson * @param vjson 原始 vjson 视图 * @param targetId 子元素的id */ function getSuperVjson(vjson, targetId) { return deepTravFindSuper(vjson, vjson, targetId); } /** * 根据id查找上级vjson id * @param vjson 原始 vjson 视图 * @param targetId 子元素的id */ function getSuperVjsonId(vjson, targetId) { var vj = getSuperVjson(vjson, targetId); return vj.id; } function deepTravFindSuper(superVjson, vjson, targetId) { var rObj = null; _$2.forOwn(vjson, function (value, key) { if (rObj) { return; } if (typeof value !== "object") { return; } if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') { if (key !== 'items') { return; } } else { // 模型、数据、数据源不扫描 if (key === 'data' || key === 'dataSource' || key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' || key === 'viewModel' || key === 'store') { return; } } //事件不扫描 if (key === "on" && _$2.isObject(value)) { return; } if (key.startsWith("on") && _$2.size(key) > 2) { return; } if (value.id === targetId) { if (_$2.isArray(vjson)) { rObj = superVjson; } else { rObj = vjson; } return; } rObj = deepTravFindSuper(vjson, value, targetId); }); return rObj; } /** * 深度遍历 vjson * @param vjson 视图JSON * @param resolver 分析函数 * @return 记录 resolver 方法返回 true 时,对象的访问路径 */ function deepTravVJson(vjson, resolver, propDeep) { if (propDeep === void 0) { propDeep = false; } var markerList = []; deepTrav1(vjson, resolver, markerList, propDeep); return markerList; } function deepTrav1(obj, resolver, marker, propDeep) { if (propDeep === void 0) { propDeep = false; } var isMarker = resolver(obj); if (marker && isMarker === true) { marker.unshift({ id: 0, keyName: '', object: obj }); } _$2.forOwn(obj, function (value, key) { if (typeof value !== 'object') { return; } if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') { if (key !== 'items' && key !== 'children') { return; } } else { // 模型、数据、数据源不扫描 if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') { return; } if (!propDeep && (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' || key === 'listeners' || key === 'bind')) { return; } } //事件不扫描 if (key === 'on' && _$2.isObject(value)) { return; } if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) { return; } var isMarkerChild = deepTrav1(value, resolver, marker, propDeep); if (marker && isMarkerChild === true) { isMarker = true; marker.unshift({ id: obj.id, keyName: key, object: value }); } }); // @ts-ignore 删除作废对象 _$2.remove(obj, function (v) { return v && v.isFiltered; }); return isMarker; } /** * 在代码中找到 reference 对应的对象 */ function findInCode(code, id) { try { deepTravVJson(code, function (child) { if (child.id === id) { throw child; } }); return undefined; } catch (err) { return err; } } function replaceVjsonById(vjson, itemVjson, itemId) { if (!itemVjson || (!itemVjson.id && !itemId)) { msgError('无法定位组件!'); debugger; return; } var id = itemId || itemVjson.id; deepTravVJson(vjson, function (obj) { if (obj.id == id) { _$2.assign(obj, itemVjson, { id: id }); } }); } function deepTravDeleteVjson(obj, targetId) { var isDelete = false; _$2.forOwn(obj, function (value, key) { if (isDelete) { return; } if (typeof value !== 'object') { return; } if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') { if (key !== 'items') { return; } } else { // 模型、数据、数据源不扫描 if (key === 'data' || key === 'dataSource' || key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' || key === 'viewModel' || key === 'store') { return; } } //事件不扫描 if (key === 'on' && _$2.isObject(value)) { return; } if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) { return; } if (value.id === targetId) { isDelete = true; /** 如果是数组的元素*/ if (_$2.isArray(obj)) { obj.splice(key, 1); } else { delete obj[key]; } return; } isDelete = deepTravDeleteVjson(value, targetId); }); return isDelete; } /** * 根据id删除Vjson 会删除因删除元素造成的空对象 * @param obj 原始 vjson 视图 * @param targetId 子元素的id */ function deletVjsonById(vjson, targetId) { var isDeleted = deepTravDeleteVjson(vjson, targetId); // if (_.isArray(obj)) { // if (obj.length <= 0) { // let T: any = { // view: "template", // template: "拖动任何组件到此处", // role: "placeholder", // id: webix.uid() // } // obj.push(T); // } // } return isDeleted; } function removeDesignProp(vjson) { deepTravVJson(vjson, function (obj) { if (obj.hasOwnProperty('id')) { delete obj.id; } if (obj.hasOwnProperty("designMode")) { delete obj.designMode; } }); if (vjson.hasOwnProperty("cls")) { delete vjson.cls; } if (vjson.hasOwnProperty("viewModel")) { delete vjson.viewModel; } if (vjson.hasOwnProperty("store")) { delete vjson.store; } } function getLayoutOutline(vjson) { deepTravVJson(vjson, function (obj) { if (!Array.isArray(obj)) { _$2.forOwn(obj, function (value, key) { if (key === 'id' || key === 'region' || key === 'layoutName' || key === 'text' || key === 'fieldLabel' || key === 'title' || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') { if (key === 'region' || (key === 'xtype' && !_$2.has(obj, 'region')) || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) { if (!_$2.has(obj, 'layoutName')) { obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key]; obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName; // console.log(obj.layoutName, obj.layoutNameDesc) } } } else { if (key === 'items') { obj.children = obj[key]; } if (key === 'tbar') { var t = obj[key]; t.layoutName = key; t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName; // console.log(t.layoutName, t.layoutNameDesc) if (_$2.has(obj, "items")) { obj.items.splice(0, 0, t); } else if (_$2.has(obj, "children")) { obj.children.splice(0, 0, t); } else { obj.children = [t]; } } if (key === 'fbar') { var t = obj[key]; t.layoutName = key; t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName; // console.log(t.layoutName, t.layoutNameDesc) if (_$2.has(obj, "items")) { obj.items.push(t); } else if (_$2.has(obj, "children")) { obj.children.push(t); } else { obj.children = [t]; } } delete obj[key]; } }); if (!obj.hasOwnProperty("children")) { obj.leaf = true; } if (!obj.hasOwnProperty("expanded")) { obj.expanded = true; } } }); return vjson; } //# sourceMappingURL=ViewHelper.js.map var Scope = /** @class */ (function () { function Scope(args) { /** * 业务模块的唯一编号 */ this.id = _$2.uniqueId('scope_'); this.IS_DESIGN_MODE = false; /** * onload 运行完成之后才会设置本标记为 true */ this.isLoadFinish = false; this._isLoading = false; var model = args.model, vjson = args.vjson, i18n = args.i18n; this.model = model; if (typeof vjson.layout === 'undefined') { // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局 var ret = buildPlus({ model: model, vjson: vjson }); model = ret.model; vjson = ret.vjson; } this.originalVjson = _$2.cloneDeep(vjson); this.vjson = this.originalVjson; // this.buildVjson() var WMSTranslate = window["WMSTranslate"]; if (WMSTranslate) { var i18nPath_1 = this.constructor.name; if (i18n) { WMSTranslate[i18nPath_1] = i18n; } this.vjson.i18nPath = i18nPath_1; deepTravVJson(this.vjson, function (obj) { if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) { return; } obj.i18nPath = i18nPath_1; }); } var extScope = getScopeOnCreate(); if (typeof extScope === 'function') { extScope({ vjson: vjson, model: model }, this); } } Scope.prototype._addWatch = function (tplExpress, fn) { if (!this._watchList) { this._watchList = []; } this._watchList.push({ watch: tplExpress, fn: fn }); }; Scope.prototype._applyWatchList = function () { var _this = this; _$2.forEach(this._watchList, function (item) { _this.viewModel.bind(item.watch, item.fn.bind(_this)); }); }; Object.defineProperty(Scope.prototype, "isScope", { get: function () { return true; }, enumerable: true, configurable: true }); /** * 产生一个当前模块有效的唯一id * @param key 唯一编号 */ Scope.prototype.uid = function (key) { return this.id + key; }; /** * 对话框"保存"成功. * 关闭对话框,并响应 success 方法 * @param data 要傳回的數據(可以為空) */ Scope.prototype.dialogSuccess = function (data) { this._handle.fireEvent('success', this, data); var sender = this._handle.config.animateTarget; var scope = lookupScope(sender); if (typeof this['success'] === 'function') { this['success'].call(scope, sender, data); } this.close(); }; /** * 设置等待状态 * @param value * @param msg */ Scope.prototype.setLoading = function (value) { var _a; var scope = this; this._isLoading = value; (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value); }; Scope.prototype.getLoading = function () { return this._isLoading; }; /** * 以对话框模式打开当前模块 * @param sender 发送者(按钮或Scope对象) * @param vjsonOption 界面覆盖选项(可以为空) * @param dataOption 数据覆盖选项(可以为空) */ Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) { var _a; var that = this; var vmodel = _$2.defaultsDeep({ // }, dataOption, that.model); this.viewModel = new Ext.app.ViewModel(vmodel); this.viewModel.yvanScope = this; this._applyWatchList(); this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption)); var config = _$2.defaultsDeep({ animateTarget: sender, viewModel: this.viewModel, yvanScope: this, referenceHolder: true, }, vjsonOption, that.vjson, windows); if (config.height === 'unset') { delete config.height; } if (config.width === 'unset') { delete config.width; } // const holder = sender?.lookupReferenceHolder() // delete config.constrain var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope; if (topScope) { config.constrain = true; this.topScope = topScope; } var win = new Ext.Window(config); // if (holder) { // holder.add(win) // } if (topScope) { topScope._handle.add(win); } win.addListener('beforerender', function (sender) { // 记录句柄 if (sender && !that._handle) { that._handle = sender; } }); win.addListener('afterrender', function (sender) { // 调用onLoad回调 try { that._onLoad(); } catch (e) { console.error('errorAt onLoad', e); } window['cw'] = that; }); win.addListener('destroy', this._destroy.bind(this)); win.show(); }; /** * 以标签模式打开当前模块 * @param vjsonOption 界面覆盖选项(可以为空) * @param dataOption 数据覆盖选项(可以为空) */ Scope.prototype.showPage = function (vjsonOption, dataOption) { var _this = this; var that = this; this._vjsonOption = vjsonOption; this._dataOption = dataOption; var vmodel = _$2.defaultsDeep({ data: {} }, dataOption, that.model); this.viewModel = new Ext.app.ViewModel(vmodel); this.viewModel.yvanScope = this; this._applyWatchList(); this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption)); // 根级不能设置id delete that.vjson.id; var config = _$2.defaultsDeep({ viewModel: this.viewModel, yvanScope: this, referenceHolder: true, }, vjsonOption, that.vjson); var tt = Ext.getCmp('TT'); var handle = tt.addScope(this, config, function (handle) { handle.addListener('added', function (sender) { // 记录句柄 if (sender && !that._handle) { that._handle = sender; } }); handle.addListener('afterrender', function (sender) { // 调用onLoad回调 try { that._onLoad(); } catch (e) { console.error('errorAt onLoad', e); } }); handle.addListener('destroy', _this._destroy.bind(_this)); }); return handle; }; /** * 直接渲染到元素 * @param element 渲染目标 * @param vjsonOption 界面覆盖选项(可以为空) * @param dataOption 数据覆盖选项(可以为空) */ Scope.prototype.renderTo = function (element, vjsonOption, dataOption) { var that = this; this._vjsonOption = vjsonOption; this._dataOption = dataOption; var vmodel = _$2.defaultsDeep({ data: {} }, that.model, dataOption); this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption)); this.viewModel = new Ext.app.ViewModel(vmodel); this.viewModel.yvanScope = this; this._applyWatchList(); var config = _$2.defaultsDeep({ viewModel: this.viewModel, yvanScope: this, referenceHolder: true, renderTo: element, listeners: { afterrender: function (sender) { var _a; // 记录句柄 if (sender && !that._handle) { that._handle = sender; } // 调用onLoad回调 that._onLoad(); // 如果vjson中配置了 afterrender ,需要恢复状态 invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments); }, }, }, vjsonOption, that.vjson); new Ext.container.Viewport(config); }; Scope.prototype.showDesigner = function (designer, option) { var that = this; var vmodel = _$2.defaultsDeep({ data: { IS_DESIGN_MODE: true, } }, that.model); this.IS_DESIGN_MODE = true; this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson)); this.viewModel = new Ext.app.ViewModel(vmodel); this.viewModel.yvanScope = this; this._applyWatchList(); var config = _$2.defaultsDeep({ viewModel: this.viewModel, yvanScope: this, referenceHolder: true, listeners: { afterrender: function (sender) { var _a; // 记录句柄 if (sender && !that._handle) { that._handle = sender; } // 调用onLoad回调 that._onLoad(); // 如果vjson中配置了 afterrender ,需要恢复状态 invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments); }, }, }, that.vjson); designer.removeAll(true); designer.add(config); }; /** * 关闭对话框(或标签页) */ Scope.prototype.close = function () { this._handle.close(); }; Object.defineProperty(Scope.prototype, "data", { /** * 获取 viewModel 里包含的数据(只读) */ get: function () { return this.viewModel.getData(); }, enumerable: true, configurable: true }); /** * 设置 viewModel 中的数据 * 可以是 key, value 模式 * 也可以是 {key:value} 模式 */ Scope.prototype.set = function (path, value) { return this.viewModel.set(path, value); }; /** * 寻找模块内所有的 xtype 对应的对象 * @param xtypeKey */ Scope.prototype.down = function (xtypeKey) { return this._handle.down(xtypeKey); }; Object.defineProperty(Scope.prototype, "refs", { /** * 获取所有设置过 Reference 名称的组件 */ get: function () { var _a, _b; return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {}; }, enumerable: true, configurable: true }); Scope.prototype._destroy = function () { var that = this; that.onDestroy(); delete that._watchList; delete that._handle; this.isLoadFinish = false; }; /** * 私有渲染完成后的回调 */ Scope.prototype._onLoad = function () { var _this = this; if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') { exports.scopeOnLoad(this); } this.onLoad(); _$2.defer(function () { _this.isLoadFinish = true; }); }; /** * 默认 渲染完成之后调用的函数 */ Scope.prototype.onLoad = function () { }; /** * 组件卸载之后的回调 */ Scope.prototype.onDestroy = function () { }; return Scope; }()); /** * 观察装饰器,viewModel 属性更改时触发成员方法 * @param tplExpress tpl表达式,例如 "{form.f1}" */ function watch(tplExpress, deep) { if (deep === void 0) { deep = false; } return function (target, propertyKey, pd) { target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]); return target[propertyKey]; }; } // 获取vjson的hash值 function getVjsonHash(str) { var hash = 3465217896, i, ch; for (i = str.length - 1; i >= 0; i--) { ch = str.charCodeAt(i); hash ^= ((hash << 5) + ch + (hash >> 2)); } return (hash & 0x7FFFFFFF) + ""; } function buildPlus(_a) { var model = _a.model, vjson = _a.vjson; var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [ { layout: 'border', // tbar: vjson.action, items: vjson.items, }, ] }); if (_$2.isArray(vjson.action)) { vjsonNew.items[0].tbar = vjson.action; } return { model: model, vjson: vjsonNew }; } //# sourceMappingURL=Scope.js.map var model = { data: { leftTabTitle: '' } }; //# sourceMappingURL=Workbench.model.js.map var vjson = { frame: false, layout: 'border', width: '100%', height: '100%', border: false, defaults: { border: false }, items: [ { region: 'north', height: 60, cls: 'main-header', reference: 'mainTop', layout: 'hbox', items: [ { html: '
', flex: 1, border: false }, { xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60, menu: [ { text: '通用数据设置', iconCls: 'x-fa fa-cog', reference: 'commonSetting' }, { text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api', listeners: { // click: 'scope.ready_api_click' } }, ] }, { xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60, cls: 'header-menu', menu: [ { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" }, ] }, ] }, { region: 'west', bind: { title: '{leftTabTitle}', }, titleAlign: 'center', border: true, split: true, width: 340, collapsible: true, reference: 'leftTab', xtype: 'tabpanel', tabPosition: 'left', tabRotation: 0, tabBar: { border: false }, listeners: { tabchange: 'scope.leftTabChange', }, items: [ { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" }, { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' }, { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' }, // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',}, { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' }, { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' }, { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" }, { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' }, { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' }, { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" }, { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" }, { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" }, { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" }, { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" }, { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" }, { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" }, ] }, { region: 'east', border: true, split: true, width: 340, collapsible: true, collapsed: true, title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign" }, { region: 'center', split: true, border: true, xtype: 'maintab', reference: 'tt', id: 'TT', plain: true, listeners: { restorypage: 'scope.openScope', tabchange: 'scope.tabchange' }, items: [] }, ], }; //# sourceMappingURL=Workbench.view.js.map /** * 获取当前打开的项目资料 */ function getCurrentProject() { // const value = sessionStorage.getItem('CurrentProject'); // if (value) { // project = JSON.parse(value) // if (!project.url) { // project = undefined // } // } // return project return { uuid: '00000000', name: '本服项目', url: '', }; } /** * 设置当前打开的项目资料(全局) */ function setCurrentProject(value) { sessionStorage.setItem('CurrentProject', JSON.stringify(value)); } //# sourceMappingURL=Project.js.map // ------------------------------------------------------------------------------------------ types /** 订阅消息key类型 */ var EventType; (function (EventType) { /** FileTree打开Module */ EventType["ModuleOpen"] = "ModuleOpen"; /** ModulePage 创建 */ EventType["ModulePageCreate"] = "ModulePageCreate"; /** ModuleItem内容变化 */ EventType["ModuleItemChange"] = "ModuleItemChange"; /** ModuleItem的 jsView 内容变化 */ EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange"; /** 设置 vjson */ EventType["SetVjson"] = "SetVjson"; /** 更新 vjson */ EventType["UpdateVjson"] = "UpdateVjson"; /** 更新 组件vjson */ EventType["UpdateComponentVjson"] = "UpdateComponentVjson"; /** Component 选中内容变化 */ EventType["ComponentSelectionChange"] = "ComponentSelectionChange"; /** Component 选中内容变化 */ EventType["ComponentContextmenu"] = "ComponentContextmenu"; /** Component 删除事件 */ EventType["ComponentDelete"] = "ComponentDelete"; /** MainTab 选中改变事件 */ EventType["MainTabChange"] = "MainTabChange"; /** ModuleTab 选中改变事件 */ EventType["ModuleTabChange"] = "ModuleTabChange"; /** 保存事件 */ EventType["SaveCall"] = "SaveCall"; /** 撤销 */ EventType["Undo"] = "Undo"; /** 还原 */ EventType["Redo"] = "Redo"; /** 剪切 */ EventType["Cut"] = "Cut"; /** 复制 */ EventType["Copy"] = "Copy"; /** 粘贴 */ EventType["Paste"] = "Paste"; /** 全选 */ EventType["SelectAll"] = "SelectAll"; /** 读取剪切板 */ EventType["ClipboardRead"] = "ClipboardRead"; /** 检查模块更新 */ EventType["RunCheckModule"] = "RunCheckModule"; /** 停止检查模块更新 */ EventType["StopCheckModule"] = "StopCheckModule"; })(EventType || (EventType = {})); // ------------------------------------------------------------------------------------------ impls var EventBus = /** @class */ (function () { function EventBus() { /** 事件数据 */ this.store = {}; /** 事件订阅者注册表 */ this.observeStoreTable = {}; this.init(); } EventBus.prototype.init = function () { var _this = this; // 更改store值就会自动publish消息 - 实现 this.store = new Proxy({}, { get: function (target, key) { return target[key]; }, // 代理object赋值操作,设置值的时候,触发订阅时的回调函数 set: function (target, key, data) { if (noValue(key)) return false; target[key] = data; // 消息通知订阅者 var observerArr = _this.observeStoreTable[key]; if (noValue(observerArr) || observerArr.length <= 0) return true; observerArr.forEach(function (handler) { //try { handler(data, key); // } catch (err) { // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler); // } }); return true; }, }); }; /** 取消注册订阅者 */ EventBus.prototype.unregisterObserver = function (key, handler) { var _this = this; var observerArr = this.observeStoreTable[key]; if (noValue(observerArr) || observerArr.length <= 0) return; if (noValue(handler)) { this.observeStoreTable[key] = []; } else { observerArr.forEach(function (obsHandler, index) { if (obsHandler !== handler) return; _this.observeStoreTable[key].splice(index, 1); }); } }; /** 注册订阅者 */ EventBus.prototype.registerObserver = function (key, handler) { var observerArr = this.observeStoreTable[key]; if (noValue(observerArr) || observerArr.length <= 0) { observerArr = []; this.observeStoreTable[key] = observerArr; } observerArr.push(handler); // if (noValue(key)) return; // const sourceValue = this.store[key]; // if (noValue(sourceValue)) return; // handler(sourceValue, key); }; /** 获取存储对象,修改这个对象属性即可publish消息 */ EventBus.prototype.getStore = function () { return this.store; }; /** * 取消订阅 * @param key 订阅的消息key * @param handler 指定取消的监听函数 */ EventBus.prototype.unsubscribe = function (key, handler) { var _this = this; if (key instanceof Array) { key.forEach(function (k) { return _this.unregisterObserver(k, handler); }); } else { this.unregisterObserver(key, handler); } }; /** * 消息订阅 * @param key 订阅的消息key * @param handler 监听函数 */ EventBus.prototype.subscribe = function (key, handler) { var _this = this; var cancelSubscribe = { key: key, cancel: function () { }, }; if (key instanceof Array) { key.forEach(function (k) { return _this.registerObserver(k, handler); }); cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); }; } else { this.registerObserver(key, handler); cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); }; } return cancelSubscribe; }; /** * 消息订阅(只订阅一次) * @param key 订阅的消息key * @param handler 监听函数 */ EventBus.prototype.subscribeOnce = function (key, handler) { var cancelSubscribe = this.subscribe(key, function (data) { // try { handler(data, key); // } catch (err) { // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler); // } cancelSubscribe.cancel(); }); }; /** * 发送消息(触发订阅监听函数) * @param key 消息key * @param eventData 消息值 */ EventBus.prototype.publish = function (key, eventData) { var _this = this; if (key instanceof Array) { key.forEach(function (k) { return _this.store[k] = eventData; }); } else { this.store[key] = eventData; } }; return EventBus; }()); // ------------------------------------------------------------------------------------------ use var eventBus = new EventBus(); //# sourceMappingURL=EventBus.js.map var model$1 = { data: { dataSync_isStart: false, dataSync: { skipError: false, clearData: false, tables: [] }, dataSyncResult: { jobId: '' }, dataSource1: '', dataSource2: '', schema1: '', schema2: '', hasDiff: false, } }; //# sourceMappingURL=DbSync.model.js.map var vjson$1 = { title: '数据库同步', layout: 'fit', items: [ { reference: 'wizard1', layout: 'card', items: [ { reference: 'first', layout: 'fit', bbar: [ '->', { xtype: 'button', iconCls: 'x-fa fa-road', text: '结构同步 »', bind: { disabled: '{!hasDiff}' }, listeners: { click: 'scope.structCopyTo', } }, { xtype: 'button', iconCls: 'x-fa fa-files-o', text: '数据同步 »', bind: { disabled: '{!hasDiff}' }, listeners: { click: 'scope.dataCopyTo', } }, { xtype: 'button', iconCls: 'x-fa fa-sort-alpha-desc', text: '索引同步 »', bind: { disabled: '{!hasDiff}' }, listeners: { click: 'scope.indexCopyTo', } }, { xtype: 'button', iconCls: 'x-fa fa-product-hunt', text: '存储过程同步 »', bind: { disabled: '{!hasDiff}' }, listeners: { click: 'scope.procedureCopyTo', } }, ], items: [ { title: '数据库对比', reference: 'grid1', xtype: 'yvgrid', pagination: false, border: false, cellTip: true, selModel: { type: 'checkboxmodel', mode: 'MULTI', }, tbar: { xtype: 'toolbar', items: [ { xtype: 'combo', fieldLabel: '源数据库', bind: { value: '{dataSource1}' }, dataSource: 'scope.getDataBaseName' }, { xtype: 'combo', fieldLabel: '目标数据库', bind: { value: '{dataSource2}' }, dataSource: 'scope.getDataBaseName' }, { xtype: 'button', iconCls: 'x-fa fa-flash', text: '对比', bind: { disabled: '{!dataSource1 || !dataSource2}' }, listeners: { click: 'scope.diff', } }, { xtype: 'button', iconCls: 'x-fa fa-cloud-download', text: '重新拉取结构(耗时!)', bind: { disabled: '{!dataSource1 || !dataSource2}' }, listeners: { click: 'scope.dbToMeta', } }, ] }, columns: [ { dataIndex: 'table_name1', header: '源表', width: 300, }, { dataIndex: 'table_name2', header: '目标表', width: 300, }, { dataIndex: 'diff', header: '对比结果', width: 100, }, { xtype: 'actioncolumn', width: 30, sortable: false, menuDisabled: true, items: [ { iconCls: 'x-fa fa-bars', text: '打开', handler: 'scope.showDetail', } ] }, { dataIndex: 'remark', header: '详情', width: 200, sortable: true, }, ], }, ] }, { reference: 'ddl', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, items: [ { xtype: 'sqleditor', reference: 'ddleditor', flex: 1, }, { xtype: 'toolbar', items: [ '->', { xtype: 'button', text: '« 上一步', listeners: { click: 'scope.back' } }, { xtype: 'button', iconCls: 'x-fa fa-flash', text: '执行', listeners: { click: 'scope.executeDDL' } }, ] } ] }, { reference: 'ddl_idx', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, items: [ { xtype: 'sqleditor', reference: 'ddleditor_idx', flex: 1, }, { xtype: 'toolbar', items: [ '->', { xtype: 'button', text: '« 上一步', listeners: { click: 'scope.back' } }, { xtype: 'button', iconCls: 'x-fa fa-flash', text: '执行', listeners: { click: 'scope.executeDDLIdx' } }, ] } ] }, { reference: 'ddl_procedure', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, items: [ { xtype: 'sqleditor', reference: 'ddleditor_procedure', flex: 1, }, { xtype: 'toolbar', items: [ '->', { xtype: 'button', text: '« 上一步', listeners: { click: 'scope.back' } }, { xtype: 'button', iconCls: 'x-fa fa-flash', text: '执行', listeners: { click: 'scope.executeProcedureSQL' } }, ] } ] }, { reference: 'datacopy', xtype: 'yvgrid', pagination: false, tbar: { xtype: 'toolbar', items: [ { xtype: 'checkbox', fieldLabel: '忽略错误', bind: { value: '{dataSync.skipError}' }, }, { xtype: 'checkbox', fieldLabel: '清空数据', bind: { value: '{dataSync.clearData}' }, }, { xtype: 'button', iconCls: 'x-fa fa-play-circle', text: '开始', bind: { disabled: '{dataSync_isStart}' }, listeners: { click: 'scope.dataSync_start' } }, { xtype: 'button', iconCls: 'x-fa fa-stop-circle', text: '停止', bind: { disabled: '{!dataSync_isStart}' }, listeners: { click: 'scope.dataSync_stop' } }, ] }, columns: [ { dataIndex: 'tableName', header: '表名', width: 300, }, { dataIndex: 'dataCount', header: '总记录数', width: 150, }, { dataIndex: 'currentIdx', header: '当前记录数', width: 150, }, { dataIndex: 'syncCount', header: '同步数', width: 150, }, { dataIndex: 'deleteCount', header: '删除', width: 150, }, { dataIndex: 'syncProgress', header: '进度', width: 150, dataType: 'int', formatter: 'percentRenderer' }, ] } ] } ] }; //# sourceMappingURL=DbSync.view.js.map var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms'; function createEmptyModule(path, filename) { return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] }); } function createFolder(parentPath, filename) { return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] }); } function getModuleFileContent(module) { return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] }); } function saveFile(fileFullPath, fileContent) { return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) { // @ts-ignore system.msg("保存成功"); return res; }); } function getQueryDslInfo(tableName) { return request.post(getBaseUrl() + "@getQueryDslInfo", { args: [ { tableName: tableName } ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function invokeServer(url, param) { url = getCurrentProject().url + "/api/com/galaxis/wms" + url; return request.post(url, { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function parseSqlApi(sql) { return request.post(getBaseUrl() + "@parseSqlApi", { args: [sql] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveModuleFiles(param) { return request.post(getBaseUrl() + "@saveModuleFiles", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function createQueryDSLFile(_a) { var schema_name = _a.schema_name, table_name = _a.table_name; return request.post(getBaseUrl() + "@createQueryDSLFile", { args: [{ schema_name: schema_name, table_name: table_name }] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function dbToMeta(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@dbToMeta", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getColumnDomainApi(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@getColumnDomain", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getMateData(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@getMateData", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getMateDataByTableName(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@getMateDataByTableName", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveMetaTableChanges(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@saveMetaTableChanges", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getModifyTableDDL(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@getModifyTableDDL", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function pushToDbCommitApi(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@pushToDbCommit", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } /** * 保存 元数据Ex,并构建与数据库差别的 DDL 语句 */ function saveMetaExBuildDDL(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@saveMetaExBuildDDL", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function registerResource(params) { return request.post(getBaseUrl() + "@registerResource", { args: [params] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getMenuTree(params) { return request.post(getBaseUrl() + "@getMenuTree", { args: [params] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function moduleTree() { return request.post(getBaseUrl() + "@moduleTree") .catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function dropTableDDL(schemaName, tableName) { return request.post(getBaseUrl() + "@dropTableDDL", { args: [ { schemaName: schemaName, tableName: tableName }, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function renameTableDDL(schemaName, tableName, reTableName) { return request.post(getBaseUrl() + "@renameTableDDL", { args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function executeModifyProcedureSQL(param) { return request.post(getBaseUrl() + "@executeModifyProcedureSQL", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function parseDynamicSqlApi(sql, dataSource) { return request.post(getBaseUrl() + "@parseDynamicSql", { args: [ { sql: sql, dataSource: dataSource }, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function exporerList() { return request.post(getBaseUrl() + "@exporerList", { args: [{}] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function reportListApi() { return request.post(getBaseUrl() + "@reportList", { args: [] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function reportByIdApi(reportId) { return request.post(getBaseUrl() + "@reportById", { args: [ { reportId: reportId }, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function createReportApi(reportName) { return request.post(getBaseUrl() + "@createReport", { args: [ { reportName: reportName }, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveReportApi(param) { return request.post(getBaseUrl() + "@saveReport", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function delReportApi(report_id) { return request.post(getBaseUrl() + "@delReport", { args: [{ report_id: report_id },] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getDict(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@getDict", { args: [ param ] }); } function saveDictApi(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@saveDict", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveDictItemsApi(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function createDictEnum(param) { return request.post(getBaseUrl() + "@createDictEnum", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function loadSqlContentApi(url) { return request.post(getBaseUrl() + "@loadSqlContent", { args: [ { url: GLOBAL_NAMESPACE_PREFIX + url, } ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveSqlContentApi(url, content) { return request.post(getBaseUrl() + "@saveSqlContent", { args: [ { url: GLOBAL_NAMESPACE_PREFIX + url, content: content, } ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function readBpmn(param) { return request.post(getBaseUrl() + "@readBpmn", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function createBpmn(path, filename) { return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveBpmn(fileFullPath, fileContent) { return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) { // @ts-ignore system.msg("保存成功"); return res; }); } function deleteBpmn(path, filename) { return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function createDevForm(param) { return request.post(getBaseUrl() + "@createDevForm", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function readDevForm(param) { return request.post(getBaseUrl() + "@readDevForm", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function calcColumnForm(param) { return request.post(getBaseUrl() + "@calcColumnForm", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function widgetListApi(param) { return request.post(getBaseUrl() + "@widgetListApi", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function readWidget(param) { return request.post(getBaseUrl() + "@readWidget", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveWidget(param) { return request.post(getBaseUrl() + "@saveWidget", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function deleteWidget(param) { return request.post(getBaseUrl() + "@deleteWidget", { args: [param] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getDataBaseNameApi() { return request.post(getBaseUrl() + "@getDataBaseName", { args: [] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function getDiffDDLApi(param) { return request.post(getBaseUrl() + "@getDiffDDL", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function dataSyncApi(param) { return request.post(getBaseUrl() + "@dataSync", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function dataSyncInfoApi(param) { return request.post(getBaseUrl() + "@dataSyncInfo", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!'; showErrorDialog(msg); console.error(msg, e); }); } function saveColumnDomain(param) { if (typeof param === 'undefined') { param = { datasource: 'master' }; } else if (typeof param.datasource === 'undefined') { param.datasource = 'master'; } return request.post(getBaseUrl() + "@saveColumnDomain", { args: [ param ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function devOpsList() { return request.post(getBaseUrl() + "@devOpsList", { args: [{}] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function devOpsById(opsId) { return request.post(getBaseUrl() + "@devOpsById", { args: [{ opsId: opsId }] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function metricsRequestApi() { return request.get("/api/metrics/request") .catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function metricsJdbcApi() { return request.get("/api/metrics/jdbc") .catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function executeDDL(param) { return request.post(getBaseUrl() + "@executeDDL", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function getModifyIdxDDL(param) { return request.post(getBaseUrl() + "@getModifyIdxDDL", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function getModifyProcedureSQL(param) { return request.post(getBaseUrl() + "@getModifyProcedureSQL", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function saveWhLayout(param) { return request.post(getLayoutUrl() + "@saveWhLayout", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function deleteWhLayout(param) { return request.post(getLayoutUrl() + "@deleteWhLayout", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function loadWhLayoutAll() { return request.post(getLayoutUrl() + "@loadWhLayoutAll", { args: [] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } function loadWhLayout(param) { return request.post(getLayoutUrl() + "@loadWhLayout", { args: [ param, ] }).catch(function (e) { var _a, _b; var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!'; showErrorDialog('发生错误:' + msg); console.error(msg, e); }); } var baseUrl = "/api/com/yvan/studio/FileManager"; var layoutUrl = "/api/com/yvan/studio/LayoutManager"; function getBaseUrl() { // return getCurrentProject().url + baseUrl return baseUrl; } function getLayoutUrl() { // return getCurrentProject().url + baseUrl return layoutUrl; } var Request = /** @class */ (function () { function Request(axiosInstance) { this.axiosInstance = axiosInstance; } // 全局响应数据转换处理 Request.transformResponse = function (response) { var _a; return (_a = response.data) !== null && _a !== void 0 ? _a : null; }; Request.prototype.get = function (url, config) { return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.delete = function (url, config) { return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.head = function (url, config) { return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.options = function (url, config) { return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.post = function (url, data, config) { return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.put = function (url, data, config) { return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.patch = function (url, data, config) { return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); }); }; Request.prototype.request = function (config) { return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); }); }; return Request; }()); /** 创建一个axios实例对象 */ function axiosCreate(config) { return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config)); } var axiosInstance; function init() { axiosInstance = axiosCreate({ validateStatus: function (status) { return (status >= 200 && status < 400); }, }); request = new Request(axiosInstance); } var request; //# sourceMappingURL=Api.js.map /** * 对比两个列 是否存在不一致 */ function compareColumn(t1, c1, t2, c2) { if (typeof c2 === 'undefined') { return 'column_name'; } if (c1.column_name !== c2.column_name) { return 'column_name'; } if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) { return 'default_value'; } if (toString(c1.column_comment) !== toString(c2.column_comment)) { return 'column_comment'; } if (c1.is_primary_key !== c2.is_primary_key) { return 'is_primary_key'; } if (c1.not_null !== c2.not_null) { return 'not_null'; } var symbol1 = getDataTypeSymbol(t1, c1); var symbol2 = getDataTypeSymbol(t2, c2); if (symbol1 !== symbol2) { console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]"); return 'data_type'; } if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ; else if (!_$2.includes(['char', 'varchar'], symbol1)) { // 只关注长度 if (c1.column_size != c2.column_size) { return 'column_size'; } } else { // 其他情况,长度和精度都要关注 if (c1.column_size != c2.column_size) { return 'column_size'; } if (c1.decimal_digits !== c2.decimal_digits) { return 'decimal_digits'; } } } function compareDomainApply(tableInfo, column, domain, is_fix_size) { var symbol1 = getDataTypeSymbol(tableInfo, column); var symbol2 = getDataTypeSymbol(tableInfo, domain); if (symbol1 !== symbol2) { console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]"); return 'data_type'; } if (is_fix_size) { // 字段域吧大小限制住了 if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ; else if (_$2.includes(['char', 'varchar'], symbol1)) { // 只关注长度 if (column.column_size != domain.column_size) { return 'column_size'; } } else { // 其他情况,长度和精度都要关注 if (column.column_size != domain.column_size) { return 'column_size'; } if (column.decimal_digits !== domain.decimal_digits) { return 'decimal_digits'; } } } } function checkColumn(table, col) { if (isEmpty(col.column_name)) { return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A"; } if (isKeyword(col.column_name)) { return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!"; } if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) { return "\u5B57\u6BB5\u540D\u975E\u6CD5"; } return undefined; } function applyDomain(dbType, domain) { var editRow = { data_type: domain[dbType + '_datatype'], }; domain = _$2.cloneDeep(domain); if (!editRow.data_type) { throw Error('字段域没有定义数据类型!'); } // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0 var match = editRow.data_type.match(/^(.+)\((\d+)\)$/); if (match) { // 类型里面包含括号 var sz = parseInt(match[2]); if (isNaN(sz)) { throw Error('字段域的定义错误:' + editRow.data_type); } domain.is_fix_size = true; editRow.data_type = match[1]; domain.column_size = sz; domain.decimal_digits = 0; } else { // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8 var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/); if (match2) { // 类型里面包含括号 var sz = parseInt(match2[2]); if (isNaN(sz)) { throw Error('字段域的定义错误:' + editRow.data_type); } var dg = parseInt(match2[3]); if (isNaN(dg)) { throw Error('字段域的定义错误:' + editRow.data_type); } domain.is_fix_size = true; editRow.data_type = match[1]; domain.column_size = sz; domain.decimal_digits = dg; } } if (domain.domain_column_ui) { _$2.extend(editRow, { column_ui: domain.domain_column_ui, }); } if (domain.domain_column_dict) { _$2.extend(editRow, { column_dict: domain.domain_column_dict, }); } if (domain.is_fix_size) { _$2.extend(editRow, { column_size: domain.column_size, decimal_digits: domain.decimal_digits }); } if (domain.is_fix_default_value) { _$2.extend(editRow, { default_value: domain.default_value, }); } return editRow; } /** * 获取字段类型代号(用于做跨数据库数据类型对比) */ function getDataTypeSymbol(table, col) { if (table.db_type === 'oracle') { switch (col.data_type) { case 'number': if (col.column_size <= 10 && !col.decimal_digits) { return 'integer'; } else if (col.column_size <= 19 && !col.decimal_digits) { return 'long'; } return 'bigdecimal'; case 'char': if (col.column_size > 3000) { return 'clob'; } return 'char'; case 'integer': return 'integer'; case 'varchar': case 'varchar2': if (col.column_size > 3000) { return 'clob'; } return 'varchar'; case 'clob': return 'clob'; case 'blob': return 'blob'; case 'date': case 'timestamp': case 'timestamp(6)': case 'timestamp with local time zone': case 'timestamp(6) with local time zone': case 'timestamp(6) with time zone': return 'timestamp'; } return "undefined"; // throw Error('未知 Oracle 数据类型:' + col.data_type) } if (table.db_type === 'pgsql') { switch (col.data_type) { case 'int4': return 'integer'; case 'int8': return 'long'; case 'char': return 'char'; case 'varchar': case 'varchar2': if (col.column_size > 3000) { return 'clob'; } return 'varchar'; case 'numeric': if (col.column_size <= 10 && !col.decimal_digits) { return 'integer'; } else if (col.column_size <= 19 && !col.decimal_digits) { return 'long'; } return 'bigdecimal'; case 'timestamp': case 'timestamptz': return 'timestamp'; case 'bytea': return 'blob'; } return "undefined"; // throw Error('未知 PostgreSQL 数据类型:' + col.data_type) } throw Error('未知数据库类型:' + table.db_type); } /** * 判断对象名称是不是数据库关键字(保留字) */ function isKeyword(word) { if (!word || typeof word !== 'string') { return false; } var kk = ['access', 'add', 'all', 'alter', 'and', 'any', 'as', 'asc', 'audit', 'between', 'by', 'char', 'check', 'cluster', 'column', 'comment', 'compress', 'connect', 'create', 'current', 'date', 'decimal', 'default', 'delete', 'desc', 'distinct', 'drop', 'else', 'exclusive', 'exists', 'file', 'float', 'for', 'from', 'grant', 'group', 'having', 'identified', 'immediate', 'in', 'increment', 'index', 'initial', 'insert', 'integer', 'intersect', 'into', 'is', 'level', 'like', 'lock', 'long', 'maxextents', 'minus', 'mlslabel', 'mode', 'modify', 'noaudit', 'nocompress', 'not', 'nowait', 'null', 'number', 'of', 'offline', 'on', 'online', 'option', 'or', 'order', 'p', 'ctfree', 'prior', 'privileges', 'public', 'raw', 'rename', 'resource', 'revoke', 'row', 'rowid', 'rownum', 'rows', 'select', 'session', 'set', 'share', 'size', 'smallint', 'start', 'successful', 'synonym', 'sysdate', 'table', 'then', 'to', 'trigger', 'uid', 'union', 'unique', 'update', 'user', 'validate', 'values', 'varchar', 'varchar2', 'view', 'whenever', 'where', 'with']; return _$2.includes(kk, word.toLowerCase()); } //# sourceMappingURL=DbUtils.js.map var DbSync = /** @class */ (function (_super) { __extends(DbSync, _super); function DbSync() { return _super.call(this, { model: model$1, vjson: vjson$1 }) || this; } DbSync.prototype.onLoad = function () { }; DbSync.prototype.getDataBaseName = function (sender, _a) { var successCallback = _a.successCallback, failCallback = _a.failCallback; getDataBaseNameApi().then(function (res) { successCallback(res.data.map(function (name) { return { id: name, text: name }; })); }); }; DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) { showInfoDialog(record.get('remark')); }; DbSync.prototype.diff = function () { var _this = this; var promise1 = getMateData({ datasource: this.viewModel.get('dataSource1') }); var promise2 = getMateData({ datasource: this.viewModel.get('dataSource2') }); this.viewModel.set('schema1', ''); this.viewModel.set('schema2', ''); this.refs.grid1.setLoading(true); Promise.all([promise1, promise2]).then(function (_a) { var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1]; var rows = []; if (_$2.size(res1) > 0) { // res1 起码有一个 schema _this.viewModel.set('schema1', res1[0].schema_name); _this.viewModel.set('schema2', res2[0].schema_name); if (!_this.viewModel.get('schema1')) { msg$1('datasource1 最起码需要一张表'); return; } if (!_this.viewModel.get('schema2')) { msg$1('datasource2 最起码需要一张表'); return; } _$2.forEach(res1[0].table_list, function (table1) { var _a; var table2 = _$2.find((_a = res2[0]) === null || _a === void 0 ? void 0 : _a.table_list, function (r) { return r.table_name === table1.table_name; }); if (table1.schema_name) { _this.viewModel.set('schema1', table1.schema_name); } if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) { _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name); } var row = { table_name1: table1.table_name, table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name, table_info: table1 }; if (!table2) { row.diff = '不一致'; row.remark = '目标表缺失'; } else if (table1.column_list.length !== table2.column_list.length) { row.diff = '不一致'; row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length; } else { row.diff = '一致'; var remark_1 = []; _$2.forEach(table1.column_list, function (col1) { var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; }); if (!col2) { row.diff = '不一致'; remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]"); } else { var colDiff = compareColumn(table1, col1, table2, col2); if (colDiff) { row.diff = '不一致'; remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]"); } } }); row.remark = remark_1.join('\n'); } rows.push(row); }); } _this.refs.grid1.setData(rows); _this.viewModel.set('hasDiff', true); }).finally(function () { _this.refs.grid1.setLoading(false); }); }; DbSync.prototype.structCopyTo = function () { var _this = this; if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) { msg$1('选择数据源!'); return; } var recordList = this.refs.grid1.getSelection(); var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); }); if (_$2.size(tableNameList) <= 0) { msg$1('请选择要同步的表'); return; } var error = undefined; _$2.forEach(tableNameList, function (tableInfo) { _$2.forEach(tableInfo.column_list, function (col) { error = checkColumn(tableInfo, col); return false; }); if (error) { return false; } }); if (error) { msg$1(error); return; } var schema1 = this.viewModel.get('schema1'); var schema2 = this.viewModel.get('schema2'); if (!schema1 || !schema2) { msg$1('无法识别 schema 名称'); return; } this.refs.grid1.setLoading(true); getDiffDDLApi({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2'), schema1: this.viewModel.get('schema1'), schema2: this.viewModel.get('schema2'), tables: tableNameList, }).then(function (res) { if (res.success) { _this.refs.ddleditor.setCode(res.data); _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl); } }).finally(function () { _this.refs.grid1.setLoading(false); }); }; DbSync.prototype.indexCopyTo = function () { var _this = this; if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) { msg$1('选择数据源!'); return; } var recordList = this.refs.grid1.getSelection(); var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); }); if (_$2.size(tableNameList) <= 0) { msg$1('请选择要同步的表'); return; } var schema1 = this.viewModel.get('schema1'); var schema2 = this.viewModel.get('schema2'); if (!schema1 || !schema2) { msg$1('无法识别 schema 名称'); return; } this.refs.grid1.setLoading(true); getModifyIdxDDL({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2'), schema1: this.viewModel.get('schema1'), schema2: this.viewModel.get('schema2'), tables: tableNameList, }).then(function (res) { if (res.success) { _this.refs.ddleditor_idx.setCode(res.data); _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx); } }).finally(function () { _this.refs.grid1.setLoading(false); }); }; DbSync.prototype.procedureCopyTo = function () { var _this = this; if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) { msg$1('选择数据源!'); return; } var schema1 = this.viewModel.get('schema1'); var schema2 = this.viewModel.get('schema2'); if (!schema1 || !schema2) { msg$1('无法识别 schema 名称'); return; } this.refs.grid1.setLoading(true); getModifyProcedureSQL({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2'), schema1: this.viewModel.get('schema1'), schema2: this.viewModel.get('schema2'), }).then(function (res) { if (res.success) { _this.refs.ddleditor_procedure.setCode(res.data); _this.refs.ddleditor_procedure.updateOptions({ readOnly: true }); _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure); } }).finally(function () { _this.refs.grid1.setLoading(false); }); }; DbSync.prototype.dataSync_start = function () { var _this = this; this.viewModel.set('dataSync_isStart', true); var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync')); this.refs.datacopy.setLoading(true); dataSyncApi(dataSync) .then(function (res) { mergeViewModel(_this.viewModel, "dataSyncResult", res, false); _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000); }) .finally(function () { _this.refs.datacopy.setLoading(false); }); }; DbSync.prototype.dataSync_process = function () { var _this = this; var jobId = this.viewModel.get('dataSyncResult.jobId'); dataSyncInfoApi({ jobId: jobId }) .then(function (res) { if (_$2.isArray(res.tableSyncInfos)) { var scrollPosition = _this.refs.datacopy.scrollable.position; _this.refs.datacopy.setData(res.tableSyncInfos); try { _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y); } catch (e) { } } if (res.endTime) { // 已经结束 var cost = ((res.endTime - res.startTime) / 1000).toFixed(0); if (res.success) { showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!"); } else { showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!"); } _this.dataSync_stop(); } }) .catch(function (e) { showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!"); console.error(e); // this.dataSync_stop() }) .finally(function () { _this.refs.datacopy.setLoading(false); }); }; DbSync.prototype.dataSync_stop = function () { this.viewModel.set('dataSync_isStart', false); clearInterval(this.dataSyncInterval); delete this.dataSyncInterval; }; DbSync.prototype.dataCopyTo = function () { if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) { msg$1('选择数据源!'); return; } var recordList = this.refs.grid1.getSelection(); var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); }); if (_$2.size(tableNameList) <= 0) { msg$1('请选择要同步的表'); return; } var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; }); this.viewModel.set('dataSync.tables', tableNameList); this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy); }; DbSync.prototype.next = function () { this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl); }; DbSync.prototype.back = function () { this.refs.wizard1.getLayout().setActiveItem(this.refs.first); }; DbSync.prototype.dbToMeta = function () { var _this = this; var dataSource1 = this.viewModel.get('dataSource1'); var dataSource2 = this.viewModel.get('dataSource2'); confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) { var promise1 = dbToMeta({ datasource: dataSource1 }); var promise2 = dbToMeta({ datasource: dataSource2 }); _this.refs.grid1.setLoading(true); Promise.all([promise1, promise2]).then(function (_a) { var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1]; _this.diff(); }).catch(function (res) { _this.refs.grid1.setLoading(false); showErrorDialog$1(res); }); }); }; DbSync.prototype.executeDDL = function () { var _this = this; var code = this.refs.ddleditor.getValue(); var dataSource2 = this.viewModel.get('dataSource2'); var target_schema_name = this.viewModel.get('schema2'); var recordList = this.refs.grid1.getSelection(); var table_infos = _$2.map(recordList, function (r) { return r.get('table_info'); }); this.setLoading(true); pushToDbCommitApi({ datasource: dataSource2, ddl: code, table_infos: table_infos, target_schema_name: target_schema_name, }).then(function (res) { if (res === null || res === void 0 ? void 0 : res.success) { msg$1('执行成功'); _this.back(); _this.diff(); return; } showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg)); }).finally(function () { _this.setLoading(false); }); }; DbSync.prototype.executeDDLIdx = function () { var _this = this; var code = this.refs.ddleditor_idx.getValue(); var dataSource2 = this.viewModel.get('dataSource2'); this.setLoading(true); executeDDL({ datasource: dataSource2, ddl: code, }).then(function (res) { if (res === null || res === void 0 ? void 0 : res.success) { msg$1('执行成功'); _this.back(); return; } showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg)); }).finally(function () { _this.setLoading(false); }); }; DbSync.prototype.executeProcedureSQL = function () { var _this = this; this.setLoading(true); executeModifyProcedureSQL({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2'), schema1: this.viewModel.get('schema1'), schema2: this.viewModel.get('schema2'), }).then(function (res) { if (res === null || res === void 0 ? void 0 : res.success) { msg$1('执行成功'); _this.back(); return; } showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg)); }).finally(function () { _this.setLoading(false); }); }; return DbSync; }(Scope)); //# sourceMappingURL=DbSync.js.map var model$2 = { data: {} }; //# sourceMappingURL=DbCodeTemplate.model.js.map var vjson$2 = { title: '示例代码', layout: 'fit', items: [ { layout: 'border', items: [ { region: 'north', split: true, height: 200, title: '表格数据', reference: 'dataeditor', xtype: 'jsoneditor', listeners: { change: 'scope.dataChanged' }, }, { region: 'west', split: true, width: 230, title: '模板', reference: 'tree1', xtype: 'treepanel', rootVisible: false, useArrows: true, colspan: 2, lines: true, multiSelect: false, listeners: { itemclick: 'scope.templateChange', }, }, { region: 'center', title: '参考代码', reference: 'preview', xtype: 'jsoneditor', }, ] } ] }; //# sourceMappingURL=DbCodeTemplate.view.js.map var rootNode = { id: 'ROOT', type: "ROOT", path: "", expanded: true, leaf: false, children: [ { id: 'form', url: 'form.js', text: 'PC表单', leaf: true }, { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true }, { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true }, { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true }, { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true }, { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true }, ], }; var TemplateDev = /** @class */ (function (_super) { __extends(TemplateDev, _super); function TemplateDev() { var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this; _this.dataChanged = _$2.debounce(function () { var me = _this; if (me.refs.tree1.selection) { me.templateChange(me.refs.tree1, me.refs.tree1.selection); } }, 50); return _this; } TemplateDev.prototype.onDestroy = function () { setDbCode(undefined); handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange); }; TemplateDev.prototype.onLoad = function () { setDbCode(this); handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange); this.refs.tree1.setRootNode(rootNode); getColumnDomainApi({}).then(function (_a) { var data = _a.data; return window['dev_column_domain'] = data; }); }; TemplateDev.prototype.dbTreeNodeChange = function () { var me = handles$1.dbcode; var tables = []; _$2.forEach(handles$1.dbTree.getSelection(), function (r) { var raw = _$2.cloneDeep(r.get('raw')); raw.id = r.get('id'); if (r.get('type') === 'table') { tables.push(raw); return; } if (r.get('type') === 'column') { var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; }); if (!tableInfo) { tableInfo = _$2.cloneDeep(r.parentNode.get('raw')); tables.push(tableInfo); } if (!tableInfo.column_list) { tableInfo.column_list = [raw]; } else { tableInfo.column_list.push(raw); } } }); // 对于没有选择列的表格,默认加上所有列 _$2.forEach(tables, function (tableInfo) { if (typeof tableInfo.column_list === 'undefined') { tableInfo.column_list = []; handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) { tableInfo.column_list.push(_$2.cloneDeep(r.get('raw'))); }); } }); var code = JSON.stringify(tables, null, ' '); me.refs.dataeditor.setCode(code); }; TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) { var url = record.data.url; var rd = _$2.uniqueId('db_code_request'); if (url) { var data = void 0; try { data = JSON.parse(this.refs.dataeditor.getCode()); } catch (e) { return; } // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => { // if (typeof node.default === "function") { // const v = toString(node.default(data)) // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext") // this.refs.preview.setLanguage("plaintext") // this.refs.preview.setCode(v) // } // }) showErrorDialog$1('没做这里'); } }; return TemplateDev; }(Scope)); //# sourceMappingURL=DbCodeTemplate.js.map var model$3 = { data: { hasChanged: false, } }; //# sourceMappingURL=DbDomain.model.js.map var vjson$3 = { bind: { title: '字段域{grid1.ischanged?" *":""}', }, layout: 'fit', items: [ { layout: 'border', items: [ { region: 'center', xtype: 'yvgrid', selModel: { type: 'spreadsheet', columnSelect: true, pruneRemoved: false, extensible: 'y' }, plugins: { clipboard: true, selectionreplicator: true }, reference: 'grid1', pagination: false, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addField' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeField' } }, { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', bind: { disabled: '{!grid1.ischanged}' }, listeners: { click: 'scope.save' } }, ] }, listeners: { editfinish: 'scope.gridEditFinish', }, columns: [ { text: '字段域名称', dataIndex: 'domain_name', sortable: false, menuDisabled: true, locked: true, editor: { selectOnFocus: true } }, { text: 'PgSQL类型', dataIndex: 'pgsql_datatype', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: 'MySQL类型', dataIndex: 'mysql_datatype', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: 'Oracle类型', dataIndex: 'oracle_datatype', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: 'SqlServer类型', dataIndex: 'sqlserver_datatype', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: 'Java类型', dataIndex: 'java_datatype', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: '固定长度', dataIndex: 'is_fix_size', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 88, resizable: false, }, { text: '长度', dataIndex: 'column_size', sortable: false, menuDisabled: true, dataType: 'int', xtype: 'numbercolumn', format: '0', editor: { selectOnFocus: true } }, { text: '小数位', dataIndex: 'decimal_digits', sortable: false, menuDisabled: true, dataType: 'int', xtype: 'numbercolumn', format: '0', editor: { selectOnFocus: true } }, { text: '字典', dataIndex: 'domain_column_dict', sortable: false, menuDisabled: true, // fix: ['system.getDict("DICT")'], width: 200, editor: { xtype: 'combo', listConfig: { minWidth: 350 }, } }, { text: '固定默认值', dataIndex: 'is_fix_default_value', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 88, resizable: false, }, { text: '默认值', dataIndex: 'default_value', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: 'UI建议', dataIndex: 'domain_column_ui', sortable: false, menuDisabled: true, // fix: ['system.getDict("column_ui")'], editor: { xtype: 'combo', allowBlank: true, listConfig: { minWidth: 200 }, } }, { text: '详细描述', dataIndex: 'domain_note', sortable: false, menuDisabled: true, editor: {} }, { text: '责任人', dataIndex: 'domain_person', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, { text: '版本', dataIndex: 'domain_version', sortable: false, menuDisabled: true, editor: { selectOnFocus: true } }, ] } ] }, ] }; //# sourceMappingURL=DbDomain.view.js.map var CacheStore = /** @class */ (function () { function CacheStore() { // 订阅 this.subscribeList = []; this.apiResponse = undefined; } /** * 订阅结果集 */ CacheStore.prototype.registe = function (fn) { this.subscribeList.push(fn); }; /** * 取消订阅 */ CacheStore.prototype.unregiste = function (fn) { _$2.remove(this.subscribeList, function (item) { return item === fn; }); }; /** * 尝试取数据(先读缓存) */ CacheStore.prototype.reloadIfNeed = function (param) { var _this = this; if (typeof this.apiResponse === 'undefined') { // 从未有获取过值 var cacheKey = this.getCacheKey(param); if (cacheKey) { // 可以从缓存读 var fileName = getCurrentProject().uuid + "/" + cacheKey; native.loadFile(fileName, function (res) { if (res) { // 缓存有值 _this.apiResponse = res; _this.notifyRefresh(); } else { // 缓存没值 _this.reloadForce(param).then(function (res) { }); } }); } else { // 不能从缓存读 this.reloadForce(param).then(function (res) { }); } return true; } return false; }; /** * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse */ CacheStore.prototype.reloadIfNeedPromise = function (param) { var _this = this; return new Promise(function (resolve, reject) { if (typeof _this.apiResponse === 'undefined') { // 从未有获取过值 var cacheKey = _this.getCacheKey(param); if (cacheKey) { // 可以从缓存读 var fileName = getCurrentProject().uuid + "/" + cacheKey; native.loadFile(fileName, function (res) { if (res) { // 缓存有值 _this.apiResponse = res; _this.notifyRefresh(); resolve(_this.apiResponse); } else { // 缓存没值 _this.reloadForce(param).then(function (res) { resolve(_this.apiResponse); }); } }); } else { // 不能从缓存读 _this.reloadForce(param).then(function (res) { resolve(_this.apiResponse); }); } } else { // 有值,获取过 resolve(_this.apiResponse); } }); }; /** * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍 */ CacheStore.prototype.reloadForce = function (param) { var _this = this; _$2.forEach(this.subscribeList, function (fn) { fn(true); }); return this.invokeApi(param) .then(function (res) { _this.apiResponse = res; var cacheKey = _this.getCacheKey(param); if (cacheKey) { // 可以保存到缓存 var fileName = getCurrentProject().uuid + '/' + cacheKey; native.saveFile(fileName, res); } // 通知订阅者刷新 _this.notifyRefresh(); }) .finally(function () { _$2.forEach(_this.subscribeList, function (fn) { fn(false); }); }); }; /** * 通知组件,isLoading状态被更改 */ CacheStore.prototype.notifyLoading = function (isLoading) { var _this = this; _$2.forEach(this.subscribeList, function (fn) { fn(_this.apiResponse); }); }; /** * 通知数据更改,需要刷新 */ CacheStore.prototype.notifyRefresh = function () { var _this = this; _$2.forEach(this.subscribeList, function (fn) { fn(_this.apiResponse); }); }; return CacheStore; }()); //# sourceMappingURL=CacheStore.js.map // 字段域数据 var columnDomain = undefined; var DomainStore = /** @class */ (function (_super) { __extends(DomainStore, _super); function DomainStore() { return _super !== null && _super.apply(this, arguments) || this; } DomainStore.prototype.getCacheKey = function (param) { return "domain_data.json"; }; DomainStore.prototype.invokeApi = function (param) { return getColumnDomainApi(); }; /** * 设置全局可访问的 字段域数据 */ DomainStore.prototype.getColumnDomainComboData = function () { var _this = this; return new Promise(function (resolve) { _this.reloadIfNeedPromise(undefined).then(function (res) { resolve(_this.apiResponse.data.map(function (v) { return { id: v.domain_id, text: v.domain_name }; })); }); }); }; /** * 设置全局可访问的 字段域数据 */ DomainStore.prototype.getColumnDomainById = function (value) { return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; }); }; DomainStore.prototype.getAllDomain = function () { return new Promise(function (resolve, reject) { getColumnDomainApi() .then(function (res) { if (res.success) { if (res.success) { var tt = _$2.map(res.data, function (row) { return { text: row.domain_name, id: row.domain_id, }; }); _$2.set(window, 'DICT_CACHE.column_domain', tt); } columnDomain = res.data; resolve(res.data); } else { window['showErrorDialog']('getColumnDomain error!\n' + res.msg); console.error('getColumnDomain', res.msg); } }) .catch(function (e) { window['showErrorDialog']('getColumnDomain error!'); console.error('getColumnDomain', e); reject(e); }); }); }; return DomainStore; }(CacheStore)); var instance = new DomainStore(); //# sourceMappingURL=DomainStore.js.map var DbDomain = /** @class */ (function (_super) { __extends(DbDomain, _super); function DbDomain() { return _super.call(this, { model: model$3, vjson: vjson$3 }) || this; } DbDomain.prototype.onLoad = function () { var _this = this; instance.getAllDomain().then(function (data) { _this.refs.grid1.setData(data); }); }; DbDomain.prototype.gridEditFinish = function () { this.viewModel.set('hasChanged', true); }; DbDomain.prototype.addField = function () { this.refs.grid1.appendEditRow({ domainName: '', pgSqlDataType: '', mysqlDataType: '', oracleDataType: '', sqlserverDataType: '', javaDataType: '', isFixSize: true, size: '', decimalDigits: '', isFixDefaultValue: false, defaultValue: null, domainColumnDict: '', domainColumnUI: '', note: '', domainPerson: '', domainVersion: '', }, 0); }; DbDomain.prototype.removeField = function () { var _this = this; var rows = []; this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _.forEach(rows, function (r) { _this.refs.grid1.getStore().remove(r); }); }; DbDomain.prototype.save = function () { var _this = this; // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err) var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err; if (err) { // 如果有异常就不保存 return; } // 进行业务上的逻辑校验,比如说必填校验等等 var hasError = false; _.forEach(rows, function (row, i) { if (isEmpty(row.domain_name)) { system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!"); hasError = true; return false; } if (isEmpty(row.pgsql_datatype) || isEmpty(row.mysql_datatype) || isEmpty(row.oracle_datatype) || isEmpty(row.sqlserver_datatype)) { system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!"); hasError = true; return false; } }); if (hasError) { return; } // 设置当前界面为 "保存中..." 状态 this.setLoading(true); saveColumnDomain({ // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交 newRows: newRows, modifyRows: modifyRows, removeRecords: removeRecords, }).then(function (res) { // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置) system.msg(res.msg); instance.reloadForce({}).then(function () { instance.getAllDomain().then(function (data) { _this.refs.grid1.setData(data); }); }).finally(function () { // 无论正常异常,关闭 "保存中..." 状态 _this.setLoading(false); }); }).catch(function (e) { // 无论正常异常,关闭 "保存中..." 状态 _this.setLoading(false); }); }; return DbDomain; }(Scope)); //# sourceMappingURL=DbDomain.js.map var model$4 = { data: { report_id: '', report_name: '', report_enable: false, report: { dataSource: '', grid: { pagination: true, }, query: [], columns: [], summary: [], }, querySql: '', summarySql: '', createAt: '', createBy: '', updateAt: '', updateBy: '', } }; //# sourceMappingURL=ReportDesign.model.js.map var vjson$4 = { bind: { title: '报表-{report_name}', }, layout: 'fit', items: [ { layout: 'border', items: [ { region: 'north', items: [ { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.load' } }, { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: { click: 'scope.save' } }, { xtype: 'button', text: '预览', iconCls: 'x-fa fa-play-circle-o', listeners: { click: 'scope.preview' } }, { xtype: 'textfield', fieldLabel: '报表名称', flex: 1, bind: { value: '{report_name}' } }, { xtype: 'checkbox', fieldLabel: '启用报表', checkedValue: 1, uncheckedValue: 0, bind: { value: '{report_enable}' } }, { xtype: 'checkbox', fieldLabel: '启用分页', bind: { value: '{report.grid.pagination}' } }, { xtype: 'textfield', fieldLabel: '数据源', flex: 1, bind: { value: '{report.dataSource}' } }, ] } ] }, { xtype: 'tabpanel', region: 'center', plain: true, border: false, items: [ { title: 'SQL和查询条件', layout: 'border', border: false, items: [ { region: 'north', height: 200, border: false, split: true, xtype: 'yvgrid', reference: 'gridCondition', pagination: false, hideFootbar: true, plugins: { clipboard: true, selectionreplicator: true }, selModel: { type: 'spreadsheet', columnSelect: false, pruneRemoved: false, extensible: 'y' }, tbar: { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '添加条件', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addCondition' } }, { xtype: 'button', text: '删除条件', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeCondition' } }, '-', { xtype: 'button', text: '自动分析条件变量', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcCondition' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUp' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDown' } }, ] }, columns: [ { text: '条件变量', dataIndex: 'conditionFieldBind', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '中文标题', dataIndex: 'conditionFieldLabel', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '编辑类型', dataIndex: 'conditionFieldXtype', width: 80, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['textfield', 'textfield'], ['combo', 'combo'], ['datefield', 'datefield'], ['datetimefield', 'datetimefield'], ['numberfield', 'numberfield'], ['multiplesearch', 'multiplesearch'], ] } }, { text: '权重', dataIndex: 'conditionFieldFlex', align: 'right', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: false, minValue: 0, maxValue: 10 }, }, { text: '字典', dataIndex: 'conditionFieldDict', width: 160, sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, { xtype: 'checkcolumn', dataIndex: "conditionFieldWrap", header: "换行", width: 65, sortable: false, menuDisabled: true, }, { text: '扩展参数', dataIndex: 'conditionFieldExtend', sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, ] }, { region: 'center', xtype: 'sqleditor', layout: 'fit', reference: 'sqlEditor', split: true, }, ] }, { title: '查询结果字段', xtype: 'yvgrid', reference: 'gridColumn', pagination: false, hideFootbar: true, border: false, plugins: { clipboard: true, selectionreplicator: true }, selModel: { type: 'spreadsheet', columnSelect: false, pruneRemoved: false, extensible: 'y' }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addColumn' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeColumn' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcColumn' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUp' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDown' } }, ] }, columns: [ { xtype: 'rownumberer' }, { text: '字段', dataIndex: 'dataIndex', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '标题', dataIndex: 'header', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '显示类型', dataIndex: 'xtype', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['', ''], ['rownum', 'rownum'], ['button', 'button'], ['checkbox', 'checkbox'], ['progres', 'progres'], ] } }, { text: '数据类型', dataIndex: 'dataType', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['', ''], ['string', 'string'], ['number', 'number'], ['date', 'date'], ] } }, { text: '宽度', dataIndex: 'width', align: 'right', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: true, minValue: 0, maxValue: 1000 }, }, { text: '权重', dataIndex: 'flex', align: 'right', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: true, minValue: 0, maxValue: 10 }, }, { text: '字典', dataIndex: 'dict', sortable: false, menuDisabled: true, width: 120, editor: { selectOnFocus: true, }, }, { text: '对齐', dataIndex: 'align', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: false, store: [ ['', ''], ['start', 'start'], ['center', 'center'], ['end', 'end'], ] }, }, { text: '过滤', dataIndex: 'filterable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '隐藏', dataIndex: 'hidden', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '排序', dataIndex: 'sortable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '扩展参数', dataIndex: 'fieldExtend', sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, ], }, { title: '汇总和汇总逻辑', layout: 'border', border: false, items: [ { xtype: 'yvgrid', region: 'north', layout: 'fit', reference: 'gridSum', pagination: false, hideFootbar: true, height: 200, split: true, border: false, plugins: { clipboard: true, selectionreplicator: true }, selModel: { type: 'spreadsheet', columnSelect: false, pruneRemoved: false, extensible: 'y' }, tbar: { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addSum' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeSum' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcSum' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUp' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDown' } }, ] }, columns: [ { text: '字段名', dataIndex: 'sumFieldBind', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '标题', dataIndex: 'sumFieldLabel', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '权重', dataIndex: 'sumFieldFlex', align: 'right', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: false, allowBlank: true, minValue: 0, maxValue: 10 }, }, { xtype: 'checkcolumn', dataIndex: "sumFieldWrap", header: "换行", sortable: false, menuDisabled: true, width: 65, }, { text: '扩展参数', dataIndex: 'sumFieldExtend', sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, ] }, { region: 'center', xtype: 'sqleditor', layout: 'fit', reference: 'sqlSumEditor', }, ] }, ] } ] } ] }; // // //# sourceMappingURL=ReportDesign.view.js.map var DbStore = /** @class */ (function (_super) { __extends(DbStore, _super); function DbStore() { return _super !== null && _super.apply(this, arguments) || this; } DbStore.prototype.getCacheKey = function (param) { return "db_data.json"; }; DbStore.prototype.invokeApi = function (param) { return getMateData(param); }; /** * 保存 元数据Ex,并构建与数据库差别的 DDL 语句 */ DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) { return new Promise(function (resolve, reject) { saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) { resolve(res1); // TODO 好像不需要,先跳过 // reloadByTableName(schema_name, table_name).then(res2 => { // resolve(res1) // }).catch(e => { // reject(e) // }) }).catch(function (e) { reject(e); }); }); }; /** * 保存元数据至表格 */ DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) { var _this = this; return new Promise(function (resolve, reject) { saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) { // 保存后重新刷新 _this.reloadByTableName(schema_name, table_name).then(function (res2) { resolve({ data: res2, msg: res1.msg }); }).catch(function (e) { reject(e); }); }).catch(function (e) { reject(e); }); }); }; /** * 预览生成的 DDL 语句 */ DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) { return new Promise(function (resolve, reject) { getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list }) .then(function (res) { resolve(res); }); }); }; /** * 执行 DDL */ DbStore.prototype.pushToDbCommit = function (arg) { return new Promise(function (resolve, reject) { pushToDbCommitApi(arg).then(function (res) { resolve(res); }).catch(function (e) { reject(e); }); }); }; /** * 重读某一个表格的 meta 元数据 */ DbStore.prototype.reloadByTableName = function (schema_name, table_name) { var _this = this; return new Promise(function (resolve, reject) { getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) { if (!res[0] || !res[0].table_list[0]) { showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name); return; } var tableRow = _this.getTableByName(schema_name, table_name); if (!tableRow) { // 没有找到这个表格,就添加一个表格到对应的 schemaRow var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); }); if (!schemaRow) { showErrorDialog$1('没有找到 schema:' + schema_name); return; } schemaRow.table_list.push(res[0].table_list[0]); } else { // 找到了目标表格,就吧 table 所有属性都赋值过去 Object.assign(tableRow, res[0].table_list[0]); } // 所有界面通知一遍刷新 _this.notifyRefresh(); resolve(res); }).catch(function (e) { reject(e); }); }); }; DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) { var result = undefined; _$2.forEach(this.apiResponse, function (schemaRow) { var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); }); if (tableRow) { var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); }); if (columnRow) { result = columnRow; return false; } } }); return result; }; DbStore.prototype.getTableByName = function (schemaName, tableName) { var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); }); if (!schemaRow) { showErrorDialog$1('没有找到 schema:' + schemaName); return; } var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); }); if (!schemaRow) { showErrorDialog$1('没有找到 table:' + tableName); return; } return tableRow; }; /** * 添加一个新表格 */ DbStore.prototype.appendNewTable = function (tableInfo) { var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); }); if (!schemaRow) { showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name); return; } schemaRow.table_list.push(tableInfo); }; /** * 从数据库结构重新生成元数据 */ DbStore.prototype.dbToMetaAndReload = function () { var _this = this; this.notifyLoading(true); dbToMeta().then(function () { _this.reloadForce(undefined); }).catch(function (e) { _this.notifyLoading(false); }); }; DbStore.prototype.getSchemaDbType = function (schemaName) { var dbType = undefined; _$2.forEach(this.apiResponse, function (schemaRow) { if (schemaRow.schema_name === schemaName) { dbType = schemaRow.db_type; return false; } }); return dbType; }; return DbStore; }(CacheStore)); function syncQueryDSL(_a) { var schema_name = _a.schema_name, table_name = _a.table_name; return createQueryDSLFile({ schema_name: schema_name, table_name: table_name }); } var instance$1 = new DbStore(); // // 字段域数据 // let columnDomain = undefined // // 元数据 // let apiResponse = [] // // // 订阅 // const subscribeList = [] // /** // * 获取全部元数据 // */ // export function getApiResponse() { // return apiResponse // } // // export function getColumnDomain() { // return columnDomain // } // window['getApiResponse'] = getApiResponse // window['getColumnDomain'] = getColumnDomain // window['getDbTreeStore'] = function () { // return apiResponse // } // // /** // * 订阅结果集 // */ // export function subscribe(fn) { // subscribeList.push(fn) // } // // /** // * 取消订阅 // */ // export function describe(fn) { // _.remove(subscribeList, item => item === fn) // } // // /** // * 刷新,如果前端从来没有取到过结果的话 // * 如果强制刷新成功,就返回 true // * 如果没有被强制刷新,返回 false // */ // export function reloadIfNeed() { // if (_.size(apiResponse) <= 0) { // reloadForce() // return true // } // return false // } // // export function reloadIfNeedPromise() { // return new Promise((resolve, reject) => { // if (_.size(apiResponse) <= 0) { // // 从未有获取过值 // reloadForce().then(res => { // resolve(apiResponse) // }) // return // } // resolve(apiResponse) // return // }) // } // // /** // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍 // */ // export function reloadForce() { // _.forEach(subscribeList, fn => { // fn(true) // }) // // return getMateData().then((content) => { // apiResponse = content // _.forEach(subscribeList, fn => { // fn(apiResponse) // }) // }).finally(() => { // _.forEach(subscribeList, fn => { // fn(false) // }) // }) // } // // /** // * 通知刷新元数据 // */ // export function notifyRefresh() { // _.forEach(subscribeList, fn => { // fn(apiResponse) // }) // } // export function getAllDomain() { // return new Promise((resolve, reject) => { // getColumnDomainApi() // .then(res => { // if (res.success) { // columnDomain = res.data // resolve(res.data) // } else { // showErrorDialog('getColumnDomain error!\n' + res.msg) // console.error('getColumnDomain', res.msg) // } // // }) // .catch(e => { // showErrorDialog('getColumnDomain error!') // console.error('getColumnDomain', e) // reject(e) // }) // }) // } //# sourceMappingURL=DbStore.js.map var PROJECT_DICT_CACHE = {}; window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE; /** *项目运行时构建 **/ function createRuntime() { { // 已经构建过了 return new Promise(function (resolve) { resolve(); }); } } //# sourceMappingURL=ProjectRuntime.js.map function ReportRunner(reportId, setLoadingFn) { return new Promise(function (resolve) { setLoadingFn(true); Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) { // const {model, vjson, report} = buildVjson(res.data) // const ret = new ReportScope({model, vjson}) // ret.report_id = reportId // ret.report = report // resolve(ret) var _b = __read(_a, 1), res = _b[0]; var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict"); resolve(ret); }).finally(function () { setLoadingFn(false); }); }); } //# sourceMappingURL=ReportRunner.js.map //gridCondition //gridColumn //gridSum //sqlSumEditor //sqlEditor var ReportDesign = /** @class */ (function (_super) { __extends(ReportDesign, _super); function ReportDesign() { return _super.call(this, { model: model$4, vjson: vjson$4 }) || this; } ReportDesign.prototype.onLoad = function () { this.load(); }; ReportDesign.prototype.save = function (sender) { var _this = this; this.viewModel.set('querySql', this.refs.sqlEditor.getCode()); this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode()); this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData()); this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData()); this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData()); var report = this.viewModel.get('report'); var data = { report_id: this.viewModel.get('report_id'), report_name: this.viewModel.get('report_name'), report_enable: this.viewModel.get('report_enable'), query_sql: this.viewModel.get('querySql'), summary_sql: this.viewModel.get('summarySql'), report: json5.stringify(report, null, ' '), }; sender.setLoading(true); saveReportApi(data).then(function (res) { if (res.success) { msg$1('保存成功'); _this.dialogSuccess(data); _this.load(); } }).finally(function () { sender.setLoading(false); }); }; ReportDesign.prototype.preview = function (sender) { var reportId = this.viewModel.get('report_id'); ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) { handles.mainWindow.showReportPreview(reportId, scope); }); }; ReportDesign.prototype.load = function () { var _this = this; var reportId = this.viewModel.get('report_id'); this.setLoading(true); reportByIdApi(reportId).then(function (res) { var _a = res.data, query_sql = _a.query_sql, report = _a.report, report_enable = _a.report_enable, report_name = _a.report_name, summary_sql = _a.summary_sql; if (report) { report = json5.parse(report); } else { report = {}; } _this.viewModel.set('report_enable', report_enable); _this.viewModel.set('report_name', report_name); _this.viewModel.set('querySql', query_sql || ''); _this.viewModel.set('summarySql', summary_sql || ''); system.mergeViewModel(_this.viewModel, 'report', report, false); var query = _this.viewModel.get('report.query') || []; var columns = _this.viewModel.get('report.columns') || []; var summary = _this.viewModel.get('report.summary') || []; var querySql = _this.viewModel.get('querySql'); var summarySql = _this.viewModel.get('summarySql'); _this.refs.gridCondition.setData(query); _this.refs.gridColumn.setData(columns); _this.refs.gridSum.setData(summary); _this.refs.sqlEditor.setCode(querySql); _this.refs.sqlSumEditor.setCode(summarySql); }).finally(function () { _this.setLoading(false); }); }; ReportDesign.prototype.addCondition = function () { this.refs.gridCondition.appendEditRow({ conditionFieldBind: '', conditionFieldLabel: '', conditionFieldXtype: 'textfield', conditionFieldFlex: 1, conditionFieldDict: '', conditionFieldWrap: false, conditionFieldExtend: '{}', }, 'conditionFieldBind'); }; ReportDesign.prototype.removeCondition = function () { var _this = this; var rows = []; this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _.forEach(rows, function (r) { _this.refs.gridCondition.getStore().remove(r); }); }; ReportDesign.prototype.moveUp = function (sender) { var grid = sender.up('grid'); grid.rowMoveUp(); }; ReportDesign.prototype.moveDown = function (sender) { var grid = sender.up('grid'); grid.rowMoveDown(); }; ReportDesign.prototype.calcCondition = function () { var _this = this; var sql = this.refs.sqlEditor.getCode(); var re = sql.matchAll(/#{(.+?)}/gi); var rows = this.refs.gridCondition.getDataRows(); this.refs.gridCondition.setLoading(true); Promise.all([ parseDynamicSqlApi(sql), instance$1.reloadIfNeedPromise(), ]).then(function (_a) { var e_1, _b; var _c = __read(_a, 1), res1 = _c[0]; if (res1.success) { var tables_1 = []; _.forEach(res1.data, function (parseItem) { var tableName = parseItem.tableName, columnName = parseItem.columnName; if (tableName && !_.includes(tables_1, tableName)) { tables_1.push(tableName); } }); var _loop_1 = function (m) { var e_2, _a; var columnName = m[1]; // 没有这个列才添加 if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) { var meta = undefined; try { for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) { var tableName = tables_2_1.value; meta = instance$1.getColumnByTableNameColumnName(tableName, columnName); if (meta) { break; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2); } finally { if (e_2) throw e_2.error; } } if (meta) { // 找到元数据 var r = { conditionFieldBind: meta.column_name, conditionFieldLabel: meta.column_comment, conditionFieldXtype: 'textfield', conditionFieldFlex: 1, conditionFieldDict: '', conditionFieldWrap: false, conditionFieldExtend: '{}', }; if (meta.column_ui === 'combo' && meta.column_dict) { r.conditionFieldXtype = 'combo'; r.conditionFieldDict = meta.column_dict; } else if (meta.column_ui === "checkbox") { r.conditionFieldXtype = 'checkbox'; } else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) { r.conditionFieldXtype = 'numberfield'; } _this.refs.gridCondition.appendEditRow(r); } else { // 没找到元数据,直接添加 _this.refs.gridCondition.appendEditRow({ conditionFieldBind: columnName, conditionFieldLabel: '', conditionFieldXtype: 'textfield', conditionFieldFlex: 1, conditionFieldDict: '', conditionFieldWrap: false, conditionFieldExtend: '{}', }); } } }; try { for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) { var m = re_1_1.value; _loop_1(m); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1); } finally { if (e_1) throw e_1.error; } } } }).finally(function () { _this.refs.gridCondition.setLoading(false); }); }; ReportDesign.prototype.addColumn = function () { this.refs.gridColumn.appendEditRow({ dataIndex: '', header: '', xtype: '', dataType: '', width: '', dict: '', align: '', filterable: true, hidden: false, sortable: true, fieldExtend: '{}', }, 'header'); }; ReportDesign.prototype.removeColumn = function () { var _this = this; var rows = []; this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _.forEach(rows, function (r) { _this.refs.gridColumn.getStore().remove(r); }); }; ReportDesign.prototype.calcColumn = function () { var _this = this; var sql = this.refs.sqlEditor.getCode(); this.refs.gridColumn.setLoading(true); var rows = this.refs.gridColumn.getDataRows(); Promise.all([ parseDynamicSqlApi(sql), instance$1.reloadIfNeedPromise(), ]).then(function (_a) { var _b = __read(_a, 1), res1 = _b[0]; if (res1.success) { _.forEach(res1.data, function (parseItem) { var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName; // 是否找到重复字段 var exists = _.find(rows, function (r) { return r.dataIndex === columnName; }); if (exists) { if ((columnTypeName || "").toLowerCase() === "number") { var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; })); if (record) { record.set("dataType", "number"); record.set("align", "end"); } } return; } if (tableName) { // 解出表格名和字段名 var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName); if (meta) { // 找到了元数据 var r = { dataIndex: meta.column_name, header: meta.column_comment, xtype: '', dataType: '', width: '', dict: '', align: '', filterable: true, hidden: false, sortable: true, fieldExtend: '{}', }; if (meta.column_ui === 'combo' && meta.column_dict) { r.dict = meta.column_dict; } else if (meta.column_ui === "checkbox") { r.xtype = 'checkbox'; } else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) { r.dataType = meta.data_type; r.align = 'end'; } if ((columnTypeName || "").toLowerCase() === "number") { r.dataType = "number"; r.align = 'end'; } _this.refs.gridColumn.appendEditRow(r); return; } } if (columnName) { // 解出字段名 var r = { dataIndex: columnName, header: columnName, xtype: '', dataType: '', width: '', dict: '', align: '', filterable: true, hidden: false, sortable: true, fieldExtend: '{}', }; if ((columnTypeName || "").toLowerCase() === "number") { r.dataType = "number"; r.align = 'end'; } _this.refs.gridColumn.appendEditRow(r); } }); } }).finally(function () { _this.refs.gridColumn.setLoading(false); }); }; ReportDesign.prototype.addSum = function () { this.refs.gridSum.appendEditRow({ sumFieldBind: '', sumFieldLabel: '', sumFieldFlex: 1, sumFieldWrap: false, sumFieldExtend: '{}', }, 'sumFieldBind'); }; ReportDesign.prototype.removeSum = function () { var _this = this; var rows = []; this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _.forEach(rows, function (r) { _this.refs.gridSum.getStore().remove(r); }); }; ReportDesign.prototype.calcSum = function () { var _this = this; var sql = this.refs.sqlSumEditor.getCode(); var rows = this.refs.gridSum.getDataRows(); this.refs.gridSum.setLoading(true); parseDynamicSqlApi(sql).then(function (res1) { if (res1.success) { _.forEach(res1.data, function (parseItem) { var tableName = parseItem.tableName, columnName = parseItem.columnName; // 是否找到重复字段 if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) { return; } if (columnName) { // 解出字段名 _this.refs.gridSum.appendEditRow({ sumFieldBind: columnName, sumFieldLabel: columnName, sumFieldFlex: 1, sumFieldWrap: false, sumFieldExtend: '{}', }); } }); } }).finally(function () { _this.refs.gridSum.setLoading(false); }); }; Object.defineProperty(ReportDesign.prototype, "reportId", { get: function () { return this.viewModel.get('report_id'); }, enumerable: true, configurable: true }); return ReportDesign; }(Scope)); //# sourceMappingURL=ReportDesign.js.map var model$5 = { data: { originalTableInfo: { table_name: '', description: '', }, hasChanged: false, schema_name: undefined, table_name: undefined, column_name: undefined, tableInfo: { schema_name: '', table_name: '', description: '', biz_category: '', note: '', archive_enable: false, archive_cron: '', archive_condition: '', column_list: [] }, }, formulas: { shouldSave: function (get) { // console.log("-->", get('grid1.ischanged')) return get('grid1.ischanged') || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name')) || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description')); }, }, }; //# sourceMappingURL=DbColumn.model.js.map var vjson$5 = { bind: { title: '{tableName}{shouldSave?" *":""}', }, layout: 'fit', items: [ { layout: 'border', tbar: { xtype: 'toolbar', items: [ // { // xtype: 'button', // text: '拉取库结构', // iconCls: 'x-fa fa-cloud-download', // listeners: { // click: 'scope.pullFromDb' // } // }, { xtype: 'button', text: '保存至数据库', iconCls: 'x-fa fa-save', bind: { disabled: '{!shouldSave}' }, listeners: { click: 'scope.pushToDb' } }, '-', { xtype: 'button', text: '刷新 QueryDSL', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.syncQueryDSL' } }, { xtype: 'button', text: '生成 DDL', iconCls: 'x-fa fa-file-text', listeners: { click: 'scope.buildDDL' } } ] }, items: [ { region: 'center', xtype: 'tabpanel', items: [ { title: '字段', xtype: 'yvgrid', selModel: { type: 'spreadsheet', columnSelect: true, pruneRemoved: false, extensible: 'y' }, enableLocking: false, idField: 'column_name', plugins: { clipboard: true, selectionreplicator: true }, reference: 'grid1', pagination: false, // hideFootbar: true, tbar: { xtype: 'form', items: [ { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '表格名', reference: 'text_table_name', readOnly: true, bind: { value: '{tableInfo.table_name}' } }, { xtype: 'textfield', fieldLabel: '描述', // readOnly: true, bind: { value: '{tableInfo.description}' } }, ] }, { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addField' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeField' } }, ] }, ] }, listeners: { editbefore: 'scope.gridEditBefore' }, columns: [ { text: '字段名', dataIndex: 'column_name', sortable: false, menuDisabled: true, width: 120, editor: { allowBlank: true, selectOnFocus: false } }, { text: '字段中文', dataIndex: 'column_comment', width: 130, sortable: false, menuDisabled: true, editor: { allowBlank: true, selectOnFocus: false } }, { text: '主键', dataIndex: 'is_primary_key', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 48, resizable: false, }, { text: '必填', dataIndex: 'not_null', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 48, resizable: false, }, { text: '字段域', dataIndex: 'column_domain', sortable: false, menuDisabled: true, width: 148, dict: 'column_domain', editor: { xtype: 'combo', allowBlank: true, selectOnFocus: true, // fix: ['system.getDict("column_domain")'], dict: 'column_domain', listConfig: { minWidth: 200 }, listeners: { change: 'scope.columnDomainChange', } } }, { text: '数据类型', dataIndex: 'data_type', sortable: false, menuDisabled: true, editor: { allowBlank: true, selectOnFocus: true } }, { text: '长度', dataIndex: 'column_size', sortable: false, menuDisabled: true, xtype: 'numbercolumn', format: '0', editor: { allowBlank: true, selectOnFocus: true } }, { text: '小数位', dataIndex: 'decimal_digits', sortable: false, menuDisabled: true, xtype: 'numbercolumn', format: '0', editor: { allowBlank: true, selectOnFocus: true } }, { text: '默认值', dataIndex: 'default_value', sortable: false, menuDisabled: true, editor: { allowBlank: true, selectOnFocus: true } }, { text: '字典', dataIndex: 'column_dict', sortable: false, menuDisabled: true, // fix: ['system.getDict("DICT")'], width: 200, editor: { xtype: 'combo', allowBlank: true, listConfig: { minWidth: 350 }, } }, { text: 'UI建议', dataIndex: 'column_ui', sortable: false, menuDisabled: true, // fix: ['system.getDict("column_ui")'], editor: { xtype: 'combo', allowBlank: true, listConfig: { minWidth: 200 }, } }, { text: '详细描述', dataIndex: 'column_note', sortable: false, menuDisabled: true, editor: { allowBlank: true, } }, ] }, { title: '高级属性', xtype: 'form', items: [ // { // xtype: 'textfield', // fieldLabel: '表格名', // bind: { // value: '{tableName}' // } // }, // { // xtype: 'textfield', // fieldLabel: '中文含义', // bind: { // value: '{tableInfo.description}' // } // }, { xtype: 'combo', fieldLabel: '业务类型', bind: { value: '{tableInfo.biz_category}' }, store: [ '基础资料', '系统', '账目与库存', '单据', '指令', '规则与流程', '开发辅助', ] }, { xtype: 'textfield', fieldLabel: '详细描述', bind: { value: '{tableInfo.note}' }, }, { xtype: 'checkbox', fieldLabel: '允许归档', bind: "{tableInfo.archive_enable}", }, { xtype: 'textfield', fieldLabel: '归档周期', bind: { value: '{tableInfo.archive_cron}', hidden: '{!tableInfo.archive_enable}', } }, { xtype: 'textfield', fieldLabel: '归档条件', bind: { value: '{tableInfo.archive_condition}', hidden: '{!tableInfo.archive_enable}', } }, ] }, ] } ] }, ] }; //# sourceMappingURL=DbColumn.view.js.map var DbColumn = /** @class */ (function (_super) { __extends(DbColumn, _super); function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) { var _this = _super.call(this, { model: getModel(model$5, schemaName, tableName, columnName, isCreateTable), vjson: vjson$5 }) || this; _this.isCreate = false; _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false; return _this; } DbColumn.prototype.onLoad = function () { var _this = this; var _a, _b, _c, _d, _e, _f, _g, _h; console.log('me', this); this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list); this.refs.grid1.autoSizeColumns(); // this.refs.grid1.columns[0].hide() // 自动定位到选定的列 if (this.viewModel.get('column_name')) { for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) { if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) { this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]); return; } } } instance.getColumnDomainComboData().then(function () { _this.checkDomain(); }); this.viewModel.set('originalTableInfo.table_name', (_c = (_b = (_a = this.viewModel.data) === null || _a === void 0 ? void 0 : _a.tableInfo) === null || _b === void 0 ? void 0 : _b.table_name) !== null && _c !== void 0 ? _c : ""); this.viewModel.set('originalTableInfo.description', (_f = (_e = (_d = this.viewModel.data) === null || _d === void 0 ? void 0 : _d.tableInfo) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : ""); if (this.isCreate) (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false); }; DbColumn.prototype.checkDomain = function () { // 走查一遍 domain // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype var dbType = this.viewModel.get('tableInfo.db_type'); var diffColumnName = []; var tableInfo = this.viewModel.get('tableInfo'); this.refs.grid1.store.data.items.forEach(function (record) { var data = record.data; var column_domain = data.column_domain; var domain = instance.getColumnDomainById(column_domain); if (!domain) { // 没有找到 domain return; } var editRow = applyDomain(dbType, domain); // 字段跟领域做对比 var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size); if (typeof compareResult === 'string') { // 不一样的情况下,要改成一致 _$2.forOwn(editRow, function (value, key) { // 改成与 domain 一致 record.set(key, value); }); diffColumnName.push(data.column_name + '.' + compareResult); } }); if (diffColumnName.length > 0) { showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:
" + diffColumnName.join('
')); } }; DbColumn.prototype.addField = function () { this.refs.grid1.appendEditRow({ column_name: '', column_comment: '', is_primary_key: false, not_null: true, column_domain: '', data_type: '', column_size: 0, decimal_digits: 0, default_value: '', column_dict: '', column_ui: '', column_note: '', }, 'column_name'); }; DbColumn.prototype.removeField = function () { var _this = this; var rows = []; this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _$2.forEach(rows, function (r) { _this.refs.grid1.getStore().remove(r); }); }; DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) { instance.getColumnDomainComboData().then(function (data) { editor.cmp.columns[5].getEditor().setStore({ data: data }); }); // 被字段域锁定的内容,不允许修改 var record = context.record, field = context.field; var domainId = record.get('column_domain'); if (!domainId) { return; } var domain = instance.getColumnDomainById(domainId); if (!domain) { msg$1('没有找到字段域' + domainId); return; } if (field === "data_type") { // 字段类型不允许修改 context.cancel = true; return; } if (domain.is_fix_size && (field === "column_size" || field === "decimal_digits")) { // 锁定长度的情况下,大小不允许修改 context.cancel = true; return; } if (domain.is_fix_default_value && field === "default_value") { // 锁定默认值的情况下,默认值不允许修改 context.cancel = true; return; } }; DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) { if (!newValue) { return; } var grid = editor.up('grid').ownerGrid; var domain = instance.getColumnDomainById(newValue); if (!domain) { msg$1('没有找到 domain:' + newValue); return; } // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype var dbType = this.viewModel.get('tableInfo.db_type'); var editRow = applyDomain(dbType, domain); grid.setEditRow(editRow); }; DbColumn.prototype.pullFromDb = function () { }; DbColumn.prototype.pushToDb = function (sender) { var _this = this; // 设置当前界面为 "保存中..." 状态 var me = this; var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name; this.viewModel.set('tableInfo.table_name', table_name); this.viewModel.set('tableInfo.schema_name', schema_name); var tableInfo = this.viewModel.get('tableInfo'); var column_list = this.refs.grid1.getDataRows(); var hasError = false; if (column_list.length <= 0) { msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01"); hasError = true; } var columnNameExistsCheck = {}; _$2.forEach(column_list, function (row, i) { var checkResult = checkColumn(tableInfo, row); if (typeof checkResult !== 'undefined') { msg$1(checkResult); hasError = true; _this.refs.grid1.beginEdit(i, 'column_name'); return false; } if (!row.column_domain || row.column_domain === '0') { msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01"); hasError = true; _this.refs.grid1.beginEdit(i, 'column_domain'); return false; } if (isEmpty(row.data_type)) { msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A"); hasError = true; _this.refs.grid1.beginEdit(i, 'data_type'); return false; } if (_$2.has(columnNameExistsCheck, row.column_name)) { // 列名已存在 msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!"); hasError = true; _this.refs.grid1.beginEdit(i, 'column_name'); return false; } columnNameExistsCheck[row.column_name] = true; }); if (hasError) return; // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL me.setLoading(true); instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list) .then(function (res) { var _a; if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') { // 返回 DDL 就要显示出来 var window_1 = Ext.create('Ext.window.Window', { title: 'SQL 预览', height: 400, width: 600, modal: true, animateTarget: sender, maximizable: true, layout: 'fit', items: { xtype: 'sqleditor', value: res.data.ddl }, buttons: [ { xtype: 'button', text: '执行', iconCls: 'x-fa fa-save', handler: function (sender) { var editor = sender.up('window').down('sqleditor'); var ddl = editor.getValue(); me.pushToDbCommit(schema_name, table_name, ddl, window_1); } }, { xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', handler: function () { window_1.close(); } } ] }).show(); return; } var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]); var tableRow = instance$1.getTableByName(schema_name, table_name); if (!tableRow) { // throw Error('没有找到 table', schemaName, tableName, columnName) console.log('这是一个新 table'); instance$1.appendNewTable(tableInfo); } _this.viewModel.set('schema_name', schema_name); _this.viewModel.set('table_name', table_name); _this.viewModel.set('tableInfo', tableInfo); _this.refs.grid1.setData(tableInfo.column_list); if (tableRow) Object.assign(tableRow, tableInfo); msg$1('保存成功'); _this.viewModel.set('hasChanged', false); }) .finally(function () { me.setLoading(false); }); }; DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) { var _this = this; window.setLoading(true); instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl }) .then(function (res) { var _a, _b, _c, _d; var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]); // 保存成功就提示一下,并重新载入数据 msg$1(res.msg); instance$1.reloadForce(undefined); var tableRow = instance$1.getTableByName(schema_name, table_name); if (!tableRow) { // throw Error('没有找到 table', schemaName, tableName, columnName) console.log('这是一个新 table'); instance$1.appendNewTable(tableInfo); } _this.viewModel.set('schema_name', schema_name); _this.viewModel.set('table_name', table_name); _this.viewModel.set('tableInfo', tableInfo); _this.refs.grid1.setData(tableInfo.column_list); if (tableRow) Object.assign(tableRow, tableInfo); instance$1.notifyRefresh(); window.close(); _this.viewModel.set('hasChanged', false); _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : ""); _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : ""); (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true); }) .finally(function () { // 无论正常异常,关闭 "保存中..." 状态 window.setLoading(false); }); }; DbColumn.prototype.syncQueryDSL = function () { var _this = this; var tableInfo = this.viewModel.get("tableInfo"); this.setLoading(true); syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name }) .then(function () { msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!"); }) .finally(function () { _this.setLoading(false); }); }; DbColumn.prototype.buildDDL = function () { }; return DbColumn; }(Scope)); function getModel(model, schemaName, tableName, columnName, isCreateTable) { model.data.schema_name = schemaName; model.data.table_name = tableName; model.data.column_name = columnName; if (isCreateTable) { var dbType = instance$1.getSchemaDbType(schemaName); if (!dbType) { throw Error('无法识别数据库类型' + schemaName); } model.data.tableInfo.schema_name = model.data.schema_name; model.data.tableInfo.table_name = model.data.table_name; model.data.tableInfo.db_type = dbType; model.data.tableInfo.column_list = []; model.data.tableInfo.is_create = true; return model; } var tableRow = instance$1.getTableByName(schemaName, tableName); if (!tableRow) { throw Error('没有找到 table' + schemaName + tableName + columnName); } model.data.tableInfo = _$2.cloneDeep(tableRow); model.data.tableInfo.is_create = false; // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes) return model; } //# sourceMappingURL=DbColumn.js.map var model$6 = { data: { id: '', path: '', form: { title: '', sqlId: '', } } }; //# sourceMappingURL=WidgetDesign.model.js.map var vjson$6 = { bind: { title: '{title}', }, layout: 'fit', items: [ { layout: 'border', items: [ { region: 'center', layout: 'border', items: [ { region: 'north', items: [ { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.load' } }, { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: { click: 'scope.widgetSave' } }, { xtype: 'button', text: '预览', iconCls: 'x-fa fa-play-circle-o', listeners: { //click: 'scope.preview' } }, { xtype: 'textfield', fieldLabel: '弹窗文件', reference: "wPath", labelWidth: 80, //width: 200, bind: { value: '{widgetPath}', }, readOnly: true, }, { xtype: 'textfield', fieldLabel: '弹窗名称', reference: "wTitle", labelWidth: 80, //width: 200, bind: { value: '{form.title}', }, readOnly: true, }, { xtype: 'textfield', fieldLabel: 'sqlId', bind: { value: '{form.sqlId}', }, readOnly: true, }, ] }, ] }, { xtype: 'tabpanel', region: 'center', plain: true, border: false, items: [ { title: "SQL和条件", layout: 'border', border: false, items: [ { region: 'north', height: 200, xtype: 'yvgrid', reference: "grid2", split: true, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, store: {}, pagination: false, hideFootbar: true, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {} }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.delCondition' } }, '-', { xtype: 'button', text: '上移', iconCls: 'x-fa fa-refresh', listeners: { //click: 'scope.saveAll' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-refresh', listeners: { //click: 'scope.saveAll' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.calcCondition' } }, ] }, columns: [ { text: '条件变量', dataIndex: 'conditionFieldBind', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '中文标题', dataIndex: 'conditionFieldLabel', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '编辑类型', dataIndex: 'xtype', sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['textfield', 'textfield'], ['combo', 'combo'], ['datefield', 'datefield'], ['datetimefield', 'datetimefield'], ['numberfield', 'numberfield'], ['multiplesearch', 'multiplesearch'], ] } }, { text: '权重', dataIndex: 'conditionFieldFlex', align: 'right', sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: false, minValue: 0, maxValue: 10 }, }, { text: '字典', dataIndex: 'conditionFieldDict', width: 160, sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, { xtype: 'checkcolumn', dataIndex: "conditionFieldWrap", header: "换行", width: 65, sortable: false, menuDisabled: true, }, ] }, { region: 'center', xtype: 'sqleditor', layout: 'fit', reference: 'sqlEditor', split: true, bind: { value: "{form.sql}" }, }, ] }, { title: "结果字段定义", border: false, xtype: 'yvgrid', reference: "grid3", selModel: { selType: 'rowmodel', mode: 'SINGLE', }, store: {}, pagination: false, hideFootbar: true, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {} }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.delColumn' } }, '-', { xtype: 'button', text: '上移', iconCls: 'x-fa fa-refresh', listeners: { //click: 'scope.saveAll' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-refresh', listeners: { //click: 'scope.saveAll' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.calcColumn' } }, ] }, columns: [ { xtype: 'rownumberer' }, { text: '字段', dataIndex: 'dataIndex', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '标题', dataIndex: 'header', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '显示类型', dataIndex: 'xtype', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['', ''], ['rownum', 'rownum'], ['button', 'button'], ['checkbox', 'checkbox'], ['progres', 'progres'], ] } }, { text: '数据类型', dataIndex: 'dataType', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['', ''], ['string', 'string'], ['number', 'number'], ['date', 'date'], ] } }, { text: '数据字典', dataIndex: 'dict', sortable: false, menuDisabled: true, width: 120, editor: { selectOnFocus: true, }, }, ], }, ] }, ] }, ] } ] }; // // //# sourceMappingURL=WidgetDesign.view.js.map var WidgetDesign = /** @class */ (function (_super) { __extends(WidgetDesign, _super); function WidgetDesign(widgetPath, widgetName) { var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this; _this.widgetPath = widgetPath; _this.widgetName = widgetName; return _this; } WidgetDesign.prototype.onLoad = function () { if (this.widgetPath) { this.loadForm(this.widgetPath); this.viewModel.set("widgetPath", this.widgetPath); this.refs.wTitle.setReadOnly(true); this.refs.wPath.setReadOnly(true); } else { this.refs.wTitle.setReadOnly(false); this.refs.wPath.setReadOnly(false); } }; WidgetDesign.prototype.load = function () { var widgetPath = this.viewModel.get("widgetPath"); if (widgetPath) { this.loadForm(widgetPath); } }; WidgetDesign.prototype.loadForm = function (widgetPath) { var _this = this; var me = this; me.setLoading(true); readWidget({ widgetPath: widgetPath }).then(function (res) { msg$1(res.msg); if (res.success) { _this.viewModel.set("widgetPath", widgetPath); me.refs.grid3.getStore().removeAll(); if (res.data.form.columns) { me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; })); } _this.viewModel.set("form.title", res.data.form.title); _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId); // set sql _this.refs.sqlEditor.setCode(res.data.sql); } }).finally(function () { me.setLoading(false); }); }; WidgetDesign.prototype.widgetAdd = function (sender) { var _this = this; var title = this.viewModel.get("form.title"); if (title) { Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) { if (btn == 'yes') { alert(1); } else { alert(2); } }); } else { var me_1 = this; var win_1 = new Ext.Window({ autoDestroy: true, title: "新建弹框", width: 400, height: 220, resizable: true, closable: true, maximizable: true, minimizable: true, plain: true, // constrainHeader: true, constrain: true, layout: 'fit', animateTarget: sender, buttonAlign: 'center', items: [ { xtype: "form", layout: "hbox", margin: '10px 20px', border: 0, items: [ { flex: 1, layout: 'vbox', items: [ { xtype: "textfield", name: "widgetcode", fieldLabel: "弹框编号", flex: 1, allowBlank: false, regex: /^[a-zA-Z][a-zA-Z0-9]*$/, regexText: "编号名只能以英文字母开头,且只包含英文字母、数字", labelWidth: 50, width: "100%", }, { xtype: "textfield", name: "widgetname", fieldLabel: "弹框名称", flex: 1, allowBlank: false, labelWidth: 50, width: "100%", }, ] }, ] } ], //窗口按钮 buttons: [ { xtype: 'button', text: '保存', handler: function (btn) { //窗口获取表单 var form = win_1.down('form'); var vaildSuccess = form.isValid(); if (!vaildSuccess) { return; } var title = form.down('textfield[name="widgetname"]').getValue(); var widgetPath = form.down('textfield[name="widgetcode"]').getValue(); me_1.viewModel.set("form.title", title); me_1.viewModel.set("widgetPath", widgetPath); var formdata = _this.viewModel.get("form"); saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) { if (res.success) { msg$1('添加成功'); } me_1.loadForm(widgetPath); win_1.close(); }); } }, { xtype: 'button', text: '取消', handler: function (btn) { //窗口关闭 win_1.close(); } } ] }); win_1.show(); } }; WidgetDesign.prototype.widgetSave = function () { var _this = this; var _a, _b; var widgetPath = this.viewModel.get("widgetPath"); if (!widgetPath) { msg$1("请选择或添加弹框后再保存!"); return; } var title = this.viewModel.get("form.title"); if (!title) { msg$1("请选择或添加弹框后再保存!"); return; } // 获取条件 var conditions = (_a = this.refs.grid2.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }).map(function (r) { delete r.id; return r; }); this.viewModel.set("form.conditions", conditions); // 获取查询列 var columns = (_b = this.refs.grid3.getStore().getData().items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }).map(function (r) { delete r.id; if (r.dict) { r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"]; } return r; }); this.viewModel.set("form.columns", columns); // sql var sql = this.refs.sqlEditor.getCode(); this.viewModel.set("form.sql", sql); var form = this.viewModel.get("form"); saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) { msg$1(res.msg); if (res.success) { msg$1('保存成功'); _this.loadForm(widgetPath); } }).catch(function (res) { }); }; WidgetDesign.prototype.delCondition = function () { var _a; this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items); }; WidgetDesign.prototype.delColumn = function () { var _a; this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items); }; WidgetDesign.prototype.calcCondition = function () { var _this = this; var sql = this.refs.sqlEditor.getCode(); var re = sql.matchAll(/#{(.+?)}/gi); var rows = this.refs.grid2.getDataRows(); this.refs.grid2.setLoading(true); parseDynamicSqlApi(sql).then(function (res) { var e_1, _a; if (res.success) { var tables_1 = []; _.forEach(res.data, function (parseItem) { var tableName = parseItem.tableName, columnName = parseItem.columnName; if (tableName && !_.includes(tables_1, tableName)) { tables_1.push(tableName); } }); var _loop_1 = function (m) { var e_2, _a; var columnName = m[1]; // 没有这个列才添加 if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) { var meta = undefined; try { for (var tables_2 = (e_2 = void 0, __values(tables_1)), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) { var tableName = tables_2_1.value; meta = instance$1.getColumnByTableNameColumnName(tableName, columnName); if (meta) { break; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2); } finally { if (e_2) throw e_2.error; } } if (meta) { // 没找到元数据,直接添加 _this.refs.grid2.appendEditRow({ conditionFieldBind: columnName, conditionFieldLabel: meta.column_comment, conditionFieldXtype: 'textfield', conditionFieldFlex: 1, conditionFieldDict: '', conditionFieldWrap: false, }); } else { _this.refs.grid2.appendEditRow({ conditionFieldBind: columnName, conditionFieldLabel: '', conditionFieldXtype: 'textfield', conditionFieldFlex: 1, conditionFieldDict: '', conditionFieldWrap: false, }); } } }; try { for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) { var m = re_1_1.value; _loop_1(m); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1); } finally { if (e_1) throw e_1.error; } } } }).finally(function () { _this.refs.grid2.setLoading(false); }); }; WidgetDesign.prototype.calcColumn = function () { var _this = this; var sql = this.refs.sqlEditor.getCode(); var rows = this.refs.grid3.getDataRows(); this.refs.grid3.setLoading(true); parseDynamicSqlApi(sql).then(function (res) { _.forEach(res.data, function (parseItem) { var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName; // 是否找到重复字段 var exists = _.find(rows, function (r) { return r.dataIndex === columnName; }); if (exists) { return; } if (tableName) { // 解出表格名和字段名 var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName); if (meta) { // 找到了元数据 var r = { dataIndex: meta.column_name, header: meta.column_comment, xtype: '', dataType: 'string', dict: '', }; if (meta.column_ui === 'combo' && meta.column_dict) { r.dict = meta.column_dict; } else if (meta.column_ui === "checkbox") { r.xtype = 'checkbox'; } else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) { r.dataType = meta.data_type; } _this.refs.grid3.appendEditRow(r); return; } } if (columnName) { // 解出字段名 var r = { dataIndex: columnName, header: columnName, xtype: '', dataType: 'string', dict: '', }; _this.refs.grid3.appendEditRow(r); } }); }).finally(function () { _this.refs.grid3.setLoading(false); }); }; return WidgetDesign; }(Scope)); //# sourceMappingURL=WidgetDesign.js.map var model$7 = { data: { // spreadsheet: false, // multSelect: false, // showCheckColumn: false, // checkColumncheckOnly: false, // disableSelection: false, vjson: { reference: '', pagination: false, pageSize: false, pageSizeOption: false, hideFootbar: false, hideRefresh: false, hideExport: false, hideAutoSize: false, hideClearFilter: false, hideSaveGridUIConfig: false, hideClearGridUIConfig: false, selectMode: '', cellediting_clicksToEdit: 1, columnLines: false, rowLines: false, border: false, autoLoad: false, remoteSort: false, remoteFilter: false, enableLocking: false, enableColumnHide: false, enableColumnMove: false, gridfilters: false, enableColumnResize: false, sortOnClick: false, hidden: false, cls: '', dataSource: { url: '', params: { formData: '{form}', }, }, listeners: { beforeselect: '', selectionchange: '', itemclick: '', itemdblclick: '', cellClick: '', celldblclick: '', afterrender: '', destory: '', } }, } }; //# sourceMappingURL=YvgridDesign.model.js.map var vjson$7 = { title: '表格-高级', height: 450, width: 970, layout: 'fit', modal: true, items: [ { xtype: 'tabpanel', items: [ { title: '属性', xtype: 'form', scrollable: true, items: [ { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '引用名', tooltip: 'reference', bind: '{vjson.reference}', }, ] }, { xtype: 'cols', border: false, items: [ // 允许分页、页大小、页大小选项 // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽 // 多选、显示勾选、自动勾选、 // 单击编辑、列分割线、行分割线、边框 // 数据源自动加载、后端排序、后端过滤 // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选 { xtype: 'checkbox', fieldLabel: '允许分页', bind: { value: "{vjson.pagination}" } }, { xtype: 'numberfield', fieldLabel: '页大小', bind: '{vjson.pageSize}', }, { xtype: 'textfield', fieldLabel: '页大小选项', flex: 2, bind: '{vjson.pageSizeOption}', }, ] }, { layout: 'hbox', border: false, items: [ { xtype: 'combo', fieldLabel: '选择模式', flex: 4, data: [ { id: 'spreadsheet', text: 'Excel模式' }, { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' }, { id: 'checkColumn', text: '勾选框' }, { id: 'row_mulity', text: '行选择-允许多选' }, { id: 'row_single', text: '行选择-单选' }, { id: 'disableSelection', text: '禁用' }, ], bind: { value: '{vjson.selectMode}' } } ] }, { layout: 'hbox', border: false, defaults: { xtype: 'checkbox', margin: '0 15 0 0', }, items: [ { xtype: 'container', margin: '3', border: false, width: 80, }, { boxLabel: '隐藏底部', bind: { value: "{vjson.hideFootbar}" } }, { boxLabel: '隐藏刷新', bind: { value: "{vjson.hideRefresh}" } }, { boxLabel: '隐藏导出', bind: { value: "{vjson.hideExport}" } }, { boxLabel: '隐藏自动调宽', bind: { value: "{vjson.hideAutoSize}" } }, { boxLabel: '隐藏清空筛选', bind: { value: "{vjson.hideClearFilter}" } }, { boxLabel: '隐藏保存布局', bind: { value: "{vjson.hideSaveGridUIConfig}" } }, { boxLabel: '隐藏重置布局', bind: { value: "{vjson.hideClearGridUIConfig}" } }, ] }, { layout: 'hbox', border: false, defaults: { xtype: 'checkbox', margin: '0 15 0 0', }, items: [ { xtype: 'container', margin: '3', border: false, width: 80 }, { boxLabel: '单击编辑', bind: { value: "{vjson.cellediting_clicksToEdit}" } }, { boxLabel: '列分隔线', bind: { value: "{vjson.columnLines}" } }, { boxLabel: '行分隔线', bind: { value: "{vjson.rowLines}" } }, { boxLabel: '边框', bind: { value: "{vjson.border}" } }, ] }, { layout: 'hbox', border: false, defaults: { xtype: 'checkbox', margin: '0 15 0 0', }, items: [ { xtype: 'container', margin: '3', border: false, width: 80 }, { boxLabel: '数据源自动加载', bind: { value: "{vjson.autoLoad}" } }, { boxLabel: '后端排序', bind: { value: "{vjson.remoteSort}" } }, { boxLabel: '后端过滤', bind: { value: "{vjson.remoteFilter}" } }, ] }, { layout: 'hbox', border: false, defaults: { xtype: 'checkbox', margin: '0 15 0 0', }, items: [ { xtype: 'container', margin: '3', border: false, width: 80 }, { boxLabel: '自定义锁定', bind: { value: "{vjson.enableLocking}" } }, { boxLabel: '自定义隐藏', bind: { value: "{vjson.enableColumnHide}" } }, { boxLabel: '用户拖拽字段', bind: { value: "{vjson.enableColumnMove}" } }, { boxLabel: '自定义筛选', bind: { value: "{vjson.gridfilters}" } }, { boxLabel: '用户拖拽字段宽度', bind: { value: "{vjson.enableColumnResize}" } }, { boxLabel: '点击列头排序', bind: { value: "{vjson.sortOnClick}" } }, { xtype: 'checkbox', boxLabel: '隐藏', bind: { value: "{vjson.hidden}" } }, ] }, { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '样式', bind: '{vjson.cls}', flex: 4 }, ] }, ] }, { title: '字段', xtype: 'yvgrid', reference: 'grid1', pagination: false, hideFootbar: true, plugins: { clipboard: true, selectionreplicator: true }, selModel: { type: 'spreadsheet', columnSelect: true, pruneRemoved: false, extensible: 'y' }, listeners: { editfinish: 'scope.gridEditFinish', }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addColumn' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeColumn' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcColumn' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUp' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDown' } }, ] }, columns: [ { xtype: 'rownumberer' }, { text: '字段', dataIndex: 'dataIndex', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true, }, }, { text: '标题', dataIndex: 'header', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true, }, }, { text: '类型', dataIndex: 'xtype', width: 100, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: false, listConfig: { minWidth: 200 }, store: [ ['', '默认'], ['rownum', 'rownum'], ['checkcolumn', 'checkcolumn'], ] }, }, { text: '数据类型', dataIndex: 'dataType', width: 100, sortable: false, menuDisabled: true, editor: { xtype: 'combo', selectOnFocus: true, listConfig: { minWidth: 200 }, store: [ ['', '默认'], ['string', 'string'], ['number', 'number'], ['date', 'date'], ] }, }, { text: '编辑模式', dataIndex: 'editor', width: 100, sortable: false, menuDisabled: true, editor: { xtype: 'combo', selectOnFocus: true, listConfig: { minWidth: 200 }, store: [ ['', ''], ['textfield', 'textfield'], ['numberfield', 'numberfield'], ['combo', 'combo'], ['combogrid', 'combogrid'], ['datefield', 'datefield'], ] }, }, { text: '宽度', dataIndex: 'width', align: 'right', width: 100, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: true, minValue: 0, maxValue: 1000 }, }, { text: '权重', dataIndex: 'flex', align: 'right', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: true, minValue: 0, maxValue: 10 }, }, { text: '字典', dataIndex: 'dict', sortable: false, menuDisabled: true, width: 210, editor: { selectOnFocus: true, }, }, { text: '对齐', dataIndex: 'align', width: 90, sortable: false, menuDisabled: true, editor: { xtype: 'combo', selectOnFocus: true, listConfig: { minWidth: 120 }, store: [ ['start', 'start'], ['center', 'center'], ['end', 'end'], ] }, }, { text: '必填', dataIndex: 'notAllowBlank', width: 50, resizable: false, sortable: false, menuDisabled: true, xtype: 'checkcolumn', }, { text: '禁用', dataIndex: 'disabled', width: 50, resizable: false, sortable: false, menuDisabled: true, xtype: 'checkcolumn', }, { text: '禁菜', dataIndex: 'menuDisabled', width: 50, resizable: false, sortable: false, menuDisabled: true, xtype: 'checkcolumn', }, { text: '过滤', dataIndex: 'filterable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '隐藏', dataIndex: 'hidden', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '可隐', dataIndex: 'hideable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '调宽', dataIndex: 'resizable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '排序', dataIndex: 'sortable', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { text: '适宽', dataIndex: 'autoSize', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, ], }, { title: '数据源', layout: 'border', listeners: { activate: 'scope.dataSourceActivate' }, items: [ { region: 'north', xtype: 'toolbar', border: false, items: [ { xtype: 'textfield', fieldLabel: '数据源', flex: 1, bind: { value: '{vjson.dataSource.url}' } }, { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: { click: 'scope.dataSourceSave' } }, { xtype: 'button', text: '读取', iconCls: 'x-fa fa-folder-open', listeners: { click: 'scope.reloadSqlContent' } }, ] }, { region: 'center', xtype: 'sqleditor', layout: 'fit', reference: 'sqlEditor', }, { region: 'south', xtype: 'jsoneditor', height: 200, split: true, collapsible: true, title: '参数', reference: 'sqlParams', } ] }, { title: '事件', xtype: 'form', scrollable: true, margin: '10', defaults: { width: '100%', labelAlign: 'top', }, items: [ { xtype: 'textfield', fieldLabel: '选中前触发 beforeSelect', bind: { value: '{vjson.listeners.beforeselect}' }, }, { xtype: 'textfield', fieldLabel: '选择范围改变 selectionChange', bind: { value: '{vjson.listeners.selectionchange}' }, }, { xtype: 'textfield', fieldLabel: '行点击 itemClick', bind: { value: '{vjson.listeners.itemclick}' }, }, { xtype: 'textfield', fieldLabel: '行双击 itemDblClick', bind: { value: '{vjson.listeners.itemdblclick}' }, }, { xtype: 'textfield', fieldLabel: '单元格点击 cellClick', bind: { value: '{vjson.listeners.cellClick}' }, }, { xtype: 'textfield', fieldLabel: '单元格双击 cellDblClick', bind: { value: '{vjson.listeners.celldblclick}' }, }, { xtype: 'textfield', fieldLabel: '渲染后触发 afterrender', bind: { value: '{vjson.listeners.afterrender}' }, }, { xtype: 'textfield', fieldLabel: '销毁后触发 destory', bind: { value: '{vjson.listeners.destory}' }, }, ] }, ], } ], fbar: [ { text: '应用', iconCls: 'x-fa fa-save', listeners: { click: 'scope.save' } }, '-', { text: '确定', iconCls: 'x-fa fa-check-circle', listeners: { click: 'scope.saveClose' } }, { text: '取消', iconCls: 'x-fa fa-times-circle', listeners: { click: 'system.closeMe()' } }, ] }; //# sourceMappingURL=YvgridDesign.view.js.map var checkFlags = {}; // ------------------------------------------------------------------------------------------ impls function jsViewToVJson(modulePage, jsView) { if (!jsView) return {}; jsView = jsView.replace(/^\s*export\s+default/, ""); jsView = _$2.trim(jsView) || "{}"; try { var json = dist.parse(jsView); return modulePage.addViewId(json); } catch (e) { //@ts-ignore Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn); } } function stringToJsonObj(jsonStr) { if (!jsonStr) return {}; try { return dist.parse(jsonStr); } catch (e) { return {}; } } /** * 获取view.js 文件 string */ function vjsonTojsView(vjson) { var reVjson = _$2.cloneDeep(vjson); removeDesignProp(reVjson); return "export default " + dist.stringify(__assign({}, reVjson), null, ' '); } var ModuleStore = /** @class */ (function (_super) { __extends(ModuleStore, _super); function ModuleStore() { var _this = _super.call(this) || this; _this.store = {}; eventBus.subscribe(EventType.ModulePageCreate, function (_a) { var id = _a.id, module = _a.module, modulePage = _a.modulePage; _this.addModule(id, module, modulePage); }); eventBus.subscribe(EventType.MainTabChange, function (_a) { var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from; _this.onMainTabChange(moduleId, oldModuleId, from); }); return _this; } ModuleStore.prototype.getCacheKey = function (param) { return "filetree_data.json"; }; ModuleStore.prototype.invokeApi = function (param) { return moduleTree(); }; ModuleStore.prototype.reloadModule = function (id) { var moduleObject = this.store[id]; if (!moduleObject) return; var module = moduleObject.module; getModuleFileContent(module).then(function (_a) { var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime; moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis }; moduleObject.lastModifyTime = lastModifyTime; moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) }; // 触发事件 ModuleItemChange moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject); moduleObject.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: "reloadModule" }); eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" }); }); }; ModuleStore.prototype.addModule = function (id, module, modulePage) { var _this = this; window['mainWindow'].setLoading(true); getModuleFileContent(module) .then(function (_a) { var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime; var moduleObject = { id: id, module: module, fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis }, lastModifyTime: lastModifyTime, moduleObj: { vjson: jsViewToVJson(modulePage, jsView) }, modulePage: modulePage, moduleEventBus: modulePage.moduleEventBus }; _this.store[id] = moduleObject; // 触发事件 ModuleItemChange moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject); // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"}) eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" }); }) .finally(function () { window['mainWindow'].setLoading(false); }); }; ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) { if (this.store[moduleId]) { eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from }); } }; ModuleStore.prototype.updateJsController = function (id, codeValue, from) { var moduleObject = this.store[id]; moduleObject.fileContent.jsController = codeValue; }; ModuleStore.prototype.updateJsView = function (id, codeValue, from) { var moduleObject = this.store[id]; moduleObject.fileContent.jsView = codeValue; moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue); handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: from }); eventBus.publish(EventType.SetVjson, { moduleId: id, from: from }); }; ModuleStore.prototype.updateJsModel = function (id, codeValue, from) { var moduleObject = this.store[id]; moduleObject.fileContent.jsModel = codeValue; }; ModuleStore.prototype.updateGroovy = function (id, codeValue, from) { var moduleObject = this.store[id]; moduleObject.fileContent.groovy = codeValue; }; ModuleStore.prototype.updateMybatis = function (id, codeValue, from) { var moduleObject = this.store[id]; moduleObject.fileContent.mybatis = codeValue; }; ModuleStore.prototype.getModuleObject = function (id) { return this.store[id]; }; ModuleStore.prototype.saveFile = function (moduleId, fileType) { if (checkFlags[moduleId] === 1) { // @ts-ignore system.msg("正在检测文件是否有外部修改,请稍后操作"); } eventBus.publish(EventType.StopCheckModule, {}); var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath; var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType]; saveFile(fileFullPath, fileContent).then(function (res) { if (res.data && res.data.lastModified) { moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified; } }).finally(function () { eventBus.publish(EventType.RunCheckModule, {}); }); }; ModuleStore.prototype.check = function (moduleId) { { return; } }; return ModuleStore; }(CacheStore)); // ------------------------------------------------------------------------------------------ use var moduleStore = new ModuleStore(); //# sourceMappingURL=ModuleStore.js.map var VjsonExchange = /** @class */ (function () { function VjsonExchange(vjson) { this.pendingSet = true; this.vjsonOrigin = _$2.cloneDeep(vjson); this.vjson = _$2.cloneDeep(this.vjsonOrigin); } /** * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化 * @param propName * @param value */ VjsonExchange.prototype.setPropValue = function (propName, value) { if (this.pendingSet) { return; } // selectMode // pageSizeOption // cellediting_clicksToEdit msg$1('' + propName + '=' + value); _$2.set(this.vjson, propName, value); }; /** * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化 */ VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) { var _a, _b, _c; if (this.pendingSet) { return; } // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性 // 如果不使用默认属性,就直接设定 undefined var vs = { dataIndex: undefined, header: undefined, xtype: '', width: undefined, flex: undefined, align: 'start', editor: undefined, dataType: 'string', dict: undefined, disabled: false, menuDisabled: false, notAllowBlank: false, filterable: true, hidden: false, hideable: true, resizable: true, sortable: true, autoSize: true, }; var raw = record.get('raw'); if (raw === undefined || raw == null) { raw = {}; record.set('raw', raw); } var setRaw = function (propName, value) { if (typeof value === 'undefined' || value == null) { msg$1("delete columns[" + rowIdx + "]." + propName); delete raw[propName]; return; } var defaultValue = vs[propName]; if (typeof defaultValue !== 'undefined' && value === defaultValue) { // 要设的值,与默认值相同,就直接删除这个属性 msg$1("delete columns[" + rowIdx + "]." + propName); delete raw[propName]; return; } msg$1("set columns[" + rowIdx + "]." + propName + "=" + value); _$2.set(raw, propName, value); }; if (!vs.hasOwnProperty(propName)) { msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName); return; } else if (propName === 'dict') { if (value) { setRaw('fix', ["system.getDict(\"" + value + "\")"]); if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') { setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]); } } else { setRaw('fix', undefined); if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) { msg$1("delete columns[" + rowIdx + "].editor.fix"); delete raw.editor.fix; } } } else if (propName === 'xtype') { if (!value) { setRaw('xtype', undefined); } else { setRaw('xtype', value); } } else if (propName === 'notAllowBlank') { setRaw('editor.allowBlank', !value); } else if (propName === 'editor') { if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) { showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value); value = undefined; } // editor.xtype if (!value) { // 不需要编辑器 if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) { msg$1("delete columns[" + rowIdx + "].editor"); delete raw.editor; record.set('notAllowBlank', false); } } else { setRaw('editor.xtype', value); var dict = record.get('dict'); if (value === 'combo' && dict) { setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]); } } } else if (propName === 'width') { var width = value; var flex = record.get('flex'); if (!width && !flex) { setRaw('width', undefined); setRaw('flex', undefined); record.set('flex', undefined); record.set('width', undefined); return; } else if (!!width) { setRaw('flex', undefined); record.set('flex', undefined); setRaw('width', width); return; } } else if (propName === 'flex') { var width = record.get('width'); var flex = value; if (!width && !flex) { setRaw('width', undefined); setRaw('flex', undefined); record.set('flex', undefined); record.set('width', undefined); return; } else if (!!flex) { setRaw('width', undefined); record.set('width', undefined); setRaw('flex', flex); return; } } else { // 其他属性,作为同名属性,与 raw 同步 setRaw(propName, value); } }; /** * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性 */ VjsonExchange.prototype.attachViewModel = function (viewModel) { var _this = this; var vs = [ 'reference', 'pagination', 'pageSize', 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig', 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide', 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls', 'listeners.beforeselect', 'listeners.selectionchange', 'listeners.itemclick', 'listeners.itemdblclick', 'listeners.cellClick', 'listeners.celldblclick', 'listeners.afterrender', 'listeners.destory', ]; _$2.forEach(vs, function (v) { viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v)); }); }; VjsonExchange.prototype.bindChangeProp = function (propName) { var me = this; return function (value) { me.setPropValue(propName, value); }; }; VjsonExchange.prototype.parseModel = function () { var _this = this; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14; //@ts-ignore var df = YvanUI.Defaults.grid; var vjson = _$2.assign({}, df, this.vjson); var model = { reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '', pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true, pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50, pageSizeOption: '["20", "50", "100", "200", "300"]', hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false, hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false, hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false, hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false, hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false, hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false, hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false, selectMode: 'spreadsheet', cellediting_clicksToEdit: true, columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true, rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true, border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true, autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true, remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false, remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false, enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false, enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true, enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true, gridfilters: true, enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true, sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true, hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false, cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '', columns: [], listeners: { beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '', selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '', itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '', itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '', cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '', celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '', afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '', destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '', } }; if (_$2.isArray(this.vjson.pageSizeOption)) { model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption); } model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters'); if (_$2.get(vjson, 'disableSelection') == true) { model.selectMode = 'disableSelection'; } else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') { model.selectMode = 'spreadsheet'; } else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) { model.selectMode = 'onlyCheckColumn'; } else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') { model.selectMode = 'checkColumn'; } else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') { model.selectMode = 'row_mulity'; } else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') { model.selectMode = 'row_single'; } else { model.selectMode = 'row_single'; } model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0); if (_$2.get(vjson, 'dataSource.method') === 'invoke') { model.dataSource = { url: _$2.get(vjson, 'dataSource.url'), //@ts-ignore params: _$2.get(vjson, 'dataSource.params') }; } _$2.forEach(vjson.columns, function (column) { model.columns.push(_this.parseColumn(column)); }); return model; }; VjsonExchange.prototype.parseColumn = function (column) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; var model = { dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '', header: (_b = column.header) !== null && _b !== void 0 ? _b : '', xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '', width: (_d = column.width) !== null && _d !== void 0 ? _d : 0, flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0, align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start', editor: '', editParam: '', dict: '', disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false, menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false, notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false, filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true, hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false, hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true, resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true, sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true, locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false, lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false, autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true, raw: _$2.cloneDeep(column), }; // width / flex 只能留一个属性, 或者全不留 if (model.width <= 0 && model.flex <= 0) { delete model.width; delete model.flex; } else if (model.width > 0) { delete model.flex; } else { delete model.width; } // editor if (_$2.isObject(_$2.get(column, 'editor'))) { model.editor = _$2.get(column, 'editor.xtype'); // model.editParam = window['YvanUI'].json5.stringify(column.editor) if (!model.editor) { // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框 model.editor = 'textfield'; } else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) { msg$1('不可识别的 editor.xtype=' + model.editor); console.error('不可识别的 editor.xtype', column); } if (_$2.get(column, 'editor.allowBlank') === false) { model.notAllowBlank = true; } } // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], } if (_$2.isString(_$2.get(column, 'fix[0]'))) { var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/); if (match && match[1]) { model.dict = match[1]; } } return model; }; return VjsonExchange; }()); // //# sourceMappingURL=YvgridExchange.js.map var YvgridDesign = /** @class */ (function (_super) { __extends(YvgridDesign, _super); function YvgridDesign(moduleId) { var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this; _this.moduleId = ''; _this.name = 'YvgridDesign'; _this.dataSourceIsActived = false; _this.setModuleId(moduleId); return _this; } YvgridDesign.prototype.setModuleId = function (moduleId) { var _this = this; this.moduleId = moduleId; if (this.componentSelectionChangeSubscribe) { this.componentSelectionChangeSubscribe.cancel(); this.componentSelectionChangeSubscribe = null; } this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) { var id = _a.id, from = _a.from; _this.onComponentSelectionChange(id, from); }); var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId; var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id); if (vj.xtype !== 'yvgrid') { throw Error('非 yvgrid 组件'); } this.vjsonExchange = new VjsonExchange(vj); }; YvgridDesign.prototype.onLoad = function () { var _this = this; var model = this.vjsonExchange.parseModel(); this.vjsonExchange.pendingSet = true; mergeViewModel(this.viewModel, "vjson", model, false); this.refs.grid1.setData(model.columns); this.vjsonExchange.attachViewModel(this.viewModel); _$2.defer(function () { _this.vjsonExchange.pendingSet = false; }); }; YvgridDesign.prototype.moveUp = function (sender) { var grid = sender.up('grid'); grid.rowMoveUp(); }; YvgridDesign.prototype.moveDown = function (sender) { var grid = sender.up('grid'); grid.rowMoveDown(); }; YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) { this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx); }; YvgridDesign.prototype.reloadSqlContent = function () { var _this = this; var url = this.viewModel.get('vjson.dataSource.url'); if (url) { loadSqlContentApi(url).then(function (res) { _this.refs.sqlEditor.setCode(''); if (res.success) { _this.refs.sqlEditor.setCode(res.data.content); } }).catch(function () { _this.refs.sqlEditor.setCode(''); }); } }; YvgridDesign.prototype.dataSourceSave = function () { var url = this.viewModel.get('vjson.dataSource.url'); if (!url) { msg$1('必须填写 groovy/SQL 模块路径'); return; } var content = this.refs.sqlEditor.getCode(); saveSqlContentApi(url, content).then(function (res) { if (res.success) { msg$1('保存成功'); } else { msg$1(res.msg); } }); }; YvgridDesign.prototype.dataSourceActivate = function () { if (!this.dataSourceIsActived) { // 激活 this.reloadSqlContent(); var params = this.viewModel.get('vjson.dataSource.params'); if (_$2.isObject(params)) { this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' ')); } this.dataSourceIsActived = true; } }; // 外部控件选择发生改变 YvgridDesign.prototype.onComponentSelectionChange = function (id, from) { if (!id || from === this.name) { return; } this.setVjson(id); }; YvgridDesign.prototype.setVjson = function (id) { // 找到对应的组件 判断是不是表格 }; YvgridDesign.prototype.save = function () { var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; }); if (this.dataSourceIsActived) { var url = this.viewModel.get('vjson.dataSource.url'); // 解析 params var paramsString = this.refs.sqlParams.getCode(''); var params = undefined; if (paramsString) { try { params = window['YvanUI'].json5.parse(paramsString); } catch (e) { msg$1('dataSource.params 格式非法,请检查'); return; } } if (typeof params === 'undefined') { params = this.viewModel.get('vjson.dataSource.params'); } if (url) { _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url); _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke'); _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params); } else { delete this.vjsonExchange.vjson['dataSource']; } } moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, { cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }), from: this.name, ignoreRenderUI: false }); }; YvgridDesign.prototype.saveClose = function () { this.save(); this.close(); }; YvgridDesign.prototype.addColumn = function () { this.refs.grid1.appendEditRow({ dataIndex: '', header: '', xtype: '', width: 80, align: '', editor: '', editParam: '', dict: '', disabled: false, notAllowBlank: false, menuDisabled: false, filterable: false, hidden: false, hideable: true, resizable: true, sortable: true, locked: false, lockable: false, autoSize: true, raw: undefined, }, 'header'); }; YvgridDesign.prototype.removeColumn = function () { var _this = this; var rows = []; this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _$2.forEach(rows, function (r) { _this.refs.grid1.getStore().remove(r); }); }; YvgridDesign.prototype.calcColumn = function () { msg$1('暂未实现'); }; YvgridDesign.prototype.onDestroy = function () { if (this.componentSelectionChangeSubscribe) { this.componentSelectionChangeSubscribe.cancel(); this.componentSelectionChangeSubscribe = null; } }; return YvgridDesign; }(Scope)); //# sourceMappingURL=YvgridDesign.js.map // export const idPrefix = "_ds_" var _designInstance; function setDesignInstance(instance) { _designInstance = instance; } function getDesignInstance() { return _designInstance; } function delegateDragmove(node, source, info) { if (_designInstance && typeof _designInstance.dragmove === 'function') { //@ts-ignore _designInstance.dragmove(node, source, info); } } function delegateDragend(node, source, info) { if (_designInstance && typeof _designInstance.dragend === 'function') { //@ts-ignore _designInstance.dragend(node, source, info); } } //# sourceMappingURL=DropHelper.js.map var YvanUI$1 = window['YvanUI']; var _$1 = window["_"]; var Ext$1 = window['Ext']; var $$1 = window["$"]; var historySize = 100; var ViewDesign = /** @class */ (function () { function ViewDesign(moduleId, reference) { var _this = this; this.name = "ViewDesign"; this.expandedVjsonObjArray = []; // 编辑历史 this.undoVjsonList = []; // 撤销历史 this.redoVjsonList = []; // 订阅事件列表 this.subscribeList = []; // private getOuterCopyValueTimer: any = null /** * 唯一编号 */ this.id = _$1.uniqueId("_dv"); this.moduleId = moduleId; this.moduleObject = moduleStore.getModuleObject(moduleId); this.$overlay = $$1('
'); this.designReference = reference; this.designElement = reference.ariaEl.dom; this.$overlay.appendTo(this.designElement); this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson; // 添加到撤销 this.lastVjson = _$1.cloneDeep(this.vjson); this.$overlay.on('contextmenu', '.studio_mask', function (event) { event.stopPropagation(); event.preventDefault(); eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name }); }); this.$overlay.on('click', '.studio_mask', function (event) { event.stopPropagation(); event.preventDefault(); _this.clearSelection(); _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name }); _$1.defer(function () { _this.$overlay.focus(); }); }); this.$overlay.on('click', this.overlayClickFunction.bind(this)); this.$overlay.on('keyup', this.onKeyPress.bind(this)); this.$overlay.on('copy', this.onCopy.bind(this)); this.$overlay.on('paste', this.onPaste.bind(this)); this.$overlay.on('focus', this.onfocus.bind(this)); // this.$overlay.on('mouseenter', ()=>{ // clearTimeout(this.getOuterCopyValueTimer); // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500) // }) this.$overlay.on('mousemove', _$1.debounce(function (event) { _this.onMousemove(event); }, 300, { maxWait: 500 }).bind(this)); window.addEventListener('message', this.onMessageEvent.bind(this)); this.subscribe(); setDesignInstance(this); } // todo ======== 方法 ========== ViewDesign.prototype.subscribe = function () { var _this = this; this.setSelection(this.moduleObject.modulePage.currentComponentSelectId); this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) { var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.setVjson(vjson, from, ignoreRenderUI); })); this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) { var id = _a.id, from = _a.from; _this.onComponentSelectionChange(id, from); })); this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) { var id = _a.id, from = _a.from; _this.onComponentDelete(id, from); })); }; ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) { if (vjson === void 0) { vjson = this.vjson; } if (from === void 0) { from = this.name; } this.vjson = vjson; if (from !== "undo" && from !== "redo") { if (this.undoVjsonList.length >= 100) { this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1); } this.undoVjsonList.push(this.lastVjson); } this.lastVjson = _$1.cloneDeep(vjson); this.setSelection(this.moduleObject.modulePage.currentComponentSelectId); }; /** * 覆盖层点击事件 */ ViewDesign.prototype.overlayClickFunction = function (event) { if (!event.altKey && !event.shiftKey) { var target = this.findElByXY(event.clientX, event.clientY); if (target) { var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect(); var extHandle = Ext$1.get(target).component; var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay"); rect.x = position.x; rect.y = position.y; this.clearSelection(); this.appendMaskbox(rect, extHandle.id); } } }; ViewDesign.prototype.findElByXY = function (x, y, dragType) { if (dragType === void 0) { dragType = ""; } var _a, _b, _c, _d, _e, _f, _g, _h, _j; var ele = document.elementsFromPoint(x, y); if (ele.length <= 1) { return; } var target = null; for (var i = 0; i < ele.length; i++) { // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' ) if (((_a = ele[i].getAttribute("class")) === null || _a === void 0 ? void 0 : _a.indexOf("yvan_design ")) >= 0 && ele[i].id && ele[i].id.indexOf('-') < 0) { switch (dragType) { case "cols-container": if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0 || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) { target = ele[i]; } break; case "col-item": if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0 || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) { target = ele[i]; } break; case "rows-container": if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0 || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) { target = ele[i]; } break; case "row-item": if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0 || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) { target = ele[i]; } break; default: target = ele[i]; break; } if (target) { break; } } } return target; }; /** * 清空选择项 */ ViewDesign.prototype.clearSelection = function () { // $(this.designElement).removeClass('selected'); // // $(this.designElement).find('.selected').removeClass('selected') // $(this.designElement).find('.ds_mask') // .not('.mask_not_hide') // .remove(); $$1('.studio_mask').remove(); // $(this.designElement).find('.selected').each(function () { // $(this).removeClass('selected'); // // const extHandle = Ext.get(this).component // // if (extHandle) { // // extHandle.removeCls('selected') // // } // }) }; /** * 添加遮罩层 */ ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) { var that = this; if (vjsonId) { this.moduleObject.modulePage.currentComponentSelectId = vjsonId; } // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => { // return item === cj.xtype // }) >= 0 var top = rect.top, left = rect.left, width = rect.width, height = rect.height; this.$mask = $$1("\n
\n dsMain.BILL_DATE\n \n \n
"); // ${canMove ? '' : ''} this.$mask.css({ position: 'absolute', top: top, left: left, width: width, height: height, border: '2px dashed #1890ff', zIndex: 100, }); this.$mask.appendTo(this.$overlay); this.$mask.on("click", ".ds_del", function (e) { e.stopPropagation(); e.preventDefault(); that.deleteComponent(vjsonId); }); // 点击选中父级 this.$mask.on('click', '.ds_parent', function (e) { e.stopPropagation(); e.preventDefault(); that.selectParent(vjsonId); }); var sel = document.getElementById(vjsonId); var sVjosn = findInCode(this.vjson, vjsonId); // 限制可以拖动的组件 if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) { var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : ''; this.dragSource = new Ext$1.drag.Source({ element: this.$mask[0], constrain: this.$overlay[0], listeners: { dragmove: this.dragmove.bind(that, this.vjson), dragend: this.dragend.bind(that, this.vjson) }, startRect: rect, sourceVjson: findInCode(this.vjson, vjsonId), sourceVjsonId: vjsonId, dragType: dragType }); } this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name }); }; /** * 选中某个选项 */ ViewDesign.prototype.setSelection = function (id) { var _a, _b; if (!this.designElement) { return; } // 清空选中内容 this.clearSelection(); if (!id) { return; } var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect(); var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay"); rect.x = position.x; rect.y = position.y; this.appendMaskbox(rect, id); }; /** * 删除组件 * @param id */ ViewDesign.prototype.deleteComponent = function (id) { deletVjsonById(this.vjson, id); this.moduleObject.modulePage.currentComponentSelectId = null; this.setVjson(); this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name }); this.clearSelection(); }; ViewDesign.prototype.selectParent = function (id) { var pid = getSuperVjsonId(this.vjson, id); this.moduleObject.modulePage.currentComponentSelectId = pid; this.setSelection(pid); }; // todo ====== 拖拽事件 ====== ViewDesign.prototype.dragmove = function (node, source, info) { var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType); if (!target) { return; } var rect = target.getBoundingClientRect(); var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay"); var extHandle = Ext$1.get(target).component; if (!extHandle) { return; } var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType); rect.x = position.x; rect.y = position.y; this.appendDirection(rect, extHandle.id, direction); }; ViewDesign.prototype.dragend = function (node, source, info) { var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType); if (!target) { return; } var rect = target.getBoundingClientRect(); var extHandle = Ext$1.get(target).component; var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType); if (!extHandle) { return; } this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType); this.removeDirection(); }; ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) { var top = rect.top, left = rect.left, width = rect.width, height = rect.height; var cv = findInCode(this.vjson, vjsonId); if (this.$direction) { $$1('#direction' + this.id).remove(); } // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) { // // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) { if (direction) { if (direction === "top") { // direction = 'center' height = height / 4; } else if (direction === "bottom") { // direction = 'center' top = top + height / 4 * 3; height = height / 4; } else if (direction === "left") { width = width / 4; } else if (direction === "right") { left = left + width / 4 * 3; width = width / 4; } this.$direction = $$1("
"); this.$direction.css({ position: 'absolute', top: top, left: left, width: width, height: height, // border: '2px dashed #1890ff', background: 'rgba(40,224,218,0.75)', zIndex: 100, }); this.$direction.appendTo(this.$overlay); // } } }; ViewDesign.prototype.removeDirection = function () { if (this.$direction) { this.$direction.remove(); this.$direction = null; } }; ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) { var arrS; if (sourceVjId) { arrS = findArrayContainer(this.vjson, sourceVjId); sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId)); var indexS = _$1.findIndex(arrS, function (v) { return v.id === sourceVjId; }); if (indexS < 0) { return; } } delete sourceVjson.id; var vjsonT = findInCode(this.vjson, targetVjId); var arrT = findArrayContainer(this.vjson, targetVjId); var indexT = _$1.findIndex(arrT, function (v) { return v.id === targetVjId; }); if (indexT < 0) { return; } switch (direction) { case 'top': case 'left': if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0) || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) { vjsonT.items.splice(0, 0, sourceVjson); } else { arrT.splice(indexT, 0, sourceVjson); } break; case 'bottom': case 'right': if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0) || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) { vjsonT.items.push(sourceVjson); } else { arrT.splice(indexT + 1, 0, sourceVjson); } break; case 'center': if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0) || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) { vjsonT.items.push(sourceVjson); } else { arrT.splice(indexT, 1, sourceVjson); } break; } if (sourceVjId) { deletVjsonById(this.vjson, sourceVjId); sourceVjson.id = sourceVjId; } this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson }); }; // todo ======== 事件 ========== // 接收 postMessage 事件分发 ViewDesign.prototype.onMessageEvent = function (event) { var _a, _b; var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method; if (fucName && typeof this[fucName] === 'function') { this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null); } }; // 接收外部选中组件事件 ViewDesign.prototype.onComponentSelectionChange = function (id, from) { if (from !== this.name) { this.setSelection(id); } }; // 接收外部组件删除事件 ViewDesign.prototype.onComponentDelete = function (id, from) { if (from !== this.name) { this.deleteComponent(id); } }; // 组件被选中 ViewDesign.prototype.onComponentSelect = function (args) { if (args[2] != this.moduleId) { return; } if (args[0]) { var rect = args[0]; var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]); rect.x = position.x; rect.y = position.y; this.clearSelection(); this.appendMaskbox(rect, args[1]); this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name }); } }; ViewDesign.prototype.onComponentInfo = function (_a) { var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3]; if (moduleId != this.moduleId) { return; } if (rect) { var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]); rect.x = position.x; rect.y = position.y; var top = rect.top, left = rect.left, width = rect.width, height = rect.height; var cv_1 = findInCode(this.vjson, vjsonId); if (this.$direction) { $$1('#direction' + this.id).remove(); } if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ; else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) { if (direction) { if (direction === "top") { direction = 'center'; //height = height/3 } else if (direction === "bottom") { direction = 'center'; // top=top+height/3*2 // height = height/3 } else if (direction === "left") { width = width / 3; } else if (direction === "right") { left = left + width / 3 * 2; width = width / 3; } this.$direction = $$1("
"); this.$direction.css({ position: 'absolute', top: top, left: left, width: width, height: height, // border: '2px dashed #1890ff', background: 'rgba(74,106,201,0.42)', zIndex: 100, }); this.$direction.appendTo(this.$overlay); } } console.log("direction", direction); // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0]) // rect.x = position.x // rect.y = position.y // this.clearSelection() // this.appendMaskbox(rect, args[1]) // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name}) } }; ViewDesign.prototype.onUndo = function () { if (this.undoVjsonList.length > 0) { if (this.redoVjsonList.length >= 100) { this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1); } this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson)); this.vjson = this.undoVjsonList.pop(); // this.setVjson(this.vjson, "", false, "undo") this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" }); } }; ViewDesign.prototype.onRedo = function () { if (this.redoVjsonList.length > 0) { if (this.undoVjsonList.length >= 100) { this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1); } this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson)); this.vjson = this.redoVjsonList.pop(); // this.setVjson(this.vjson, "", false, "redo") this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" }); } }; ViewDesign.prototype.onKeyPress = function (event) { // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) { // if (this.backStep()) { // event.stopPropagation() // event.preventDefault() // return // } // } // // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) { // if (this.recoverStep()) { // event.stopPropagation() // event.preventDefault() // return // } // } // if (event.key === 'ArrowUp') { // if (this.selectParent()) { // event.stopPropagation() // event.preventDefault() // return; // } // } if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) { this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId); event.stopPropagation(); event.preventDefault(); return; } // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) { // if (this.copyView()) { // event.stopPropagation() // event.preventDefault() // return; // } // } // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) { // if (this.copyView(true)) { // event.stopPropagation() // event.preventDefault() // return; // } // } // // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) { // if (this.selectRoot()) { // event.stopPropagation() // event.preventDefault() // return; // } // }; ViewDesign.prototype.onCopy = function (event) { if (this.moduleObject.modulePage.currentComponentSelectId) { var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId); if (copyVjson) { removeDesignProp(copyVjson); this.moduleObject.modulePage.currentCopyVjson = copyVjson; native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' ')); } } }; ViewDesign.prototype.onPaste = function (event) { debugger; }; ViewDesign.prototype.onfocus = function () { console.log("getCopy"); console.log("document.activeElement", document.activeElement.id); // clearTimeout(this.getOuterCopyValueTimer); // native.clipboardRead() }; ViewDesign.prototype.onMousemove = function (event) { var _a; if (document.activeElement.id === this.$overlay[0].id) { // console.log(event.clientX, event.clientY) if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) { var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay"); // this.iframeWindow.postMessage({ // method: 'overlayGetInfo', // args: [position, this.moduleId] // }, '*') } } }; ViewDesign.prototype.onDestroy = function () { window.removeEventListener('message', this.onMessageEvent.bind(this)); for (var i = 0; i < this.subscribeList.length; i++) { this.subscribeList[i].cancel(); } }; // todo ======== 工具方法 ========== ViewDesign.prototype.getPosition = function (pos, from, to, relative) { if (relative === void 0) { relative = null; } if (from === "main" && to === "overlay") { var overlayRect = this.$overlay[0].getBoundingClientRect(); var x = overlayRect.x; var y = overlayRect.y; if (relative) { var relativeRect = relative.getBoundingClientRect(); console.log("main->", relativeRect.x, relativeRect.y); x = x - relativeRect.x; y = y - relativeRect.y; } pos.x = pos.x - x; pos.y = pos.y - y; } else if (from === "overlay" && to === "main") { var overlayRect = this.$overlay[0].getBoundingClientRect(); var x = overlayRect.x; var y = overlayRect.y; if (relative) { var relativeRect = relative.getBoundingClientRect(); console.log("iframe->", relativeRect.x, relativeRect.y); x = x - relativeRect.x; y = y - relativeRect.y; } pos.x = pos.x + x; pos.y = pos.y + y; } return pos; }; ViewDesign.prototype.getDirection = function (x, y, rect, dragType) { if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2) && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) { return "center"; } // col-item 只能放左右 if (dragType === "col-item" || dragType === "") { if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) { if (x > rect.x && x < rect.x + rect.width / 3) { return "left"; } else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) { return "right"; } } } // cols-container 只能放上下 if (dragType === "cols-container" || dragType === "") { if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) { if (y > rect.y && y < rect.y + rect.height / 3) { return "top"; } else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) { return "bottom"; } } } return ""; }; return ViewDesign; }()); // //# sourceMappingURL=ViewDesign.js.map var model$8 = { data: { iframeSrc: '' } }; //# sourceMappingURL=ModulePage.model.js.map var vjson$8 = { layout: 'fit', border: false, iconCls: 'x-fa fa-newspaper-o', referenceHolder: true, items: [ { layout: 'border', border: false, items: [ { region: 'center', xtype: 'tabpanel', border: false, tabPosition: 'bottom', reference: 'tabPanel', listeners: { tabchange: 'scope.tabchange' }, defaults: { border: false, }, items: [ { title: 'controller.js', xtype: 'jseditor', reference: 'controllerEditor', }, { title: 'view.design', xtype: 'designer', reference: 'designer', listeners: { afterrender: 'scope.previewRender' }, }, { title: 'view.js', xtype: 'jseditor', reference: 'viewEditor', }, { title: 'model.js', xtype: 'jseditor', reference: 'modelEditor', }, { title: 'groovy', xtype: 'groovyeditor', reference: 'groovyEditor', }, { title: 'SQL', xtype: 'sqleditor', reference: 'sqlEditor', } ] } ] } ] }; //# sourceMappingURL=ModulePage.view.js.map var ModulePage = /** @class */ (function (_super) { __extends(ModulePage, _super); function ModulePage(moduleId, module) { var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this; _this.name = "ModulePage"; _this.viewDesign = null; _this.maxViewId = 0; _this.moduleEventBus = new EventBus(); _this.codeChange = _$2.debounce(function (code, from, e) { try { switch (from) { case _this.refs.controllerEditor.name: moduleStore.updateJsController(_this.moduleId, code, from); break; case _this.refs.viewEditor.name: moduleStore.updateJsView(_this.moduleId, code, from); break; case _this.refs.modelEditor.name: moduleStore.updateJsModel(_this.moduleId, code, from); break; case _this.refs.groovyEditor.name: moduleStore.updateGroovy(_this.moduleId, code, from); break; case _this.refs.sqlEditor.name: moduleStore.updateMybatis(_this.moduleId, code, from); break; } } catch (e) { } }, 500, { maxWait: 10000 }); _this.moduleId = moduleId; _this.module = module; _this.cancelSubscribe = []; _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) { _this.initEditor(moduleItem); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) { var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.previewReRender(); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) { var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.updateVjson(vjson, from, ignoreRenderUI); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) { var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) { var id = _a.id, from = _a.from; _this.onComponentSelectionChange(id, from); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () { _this.onUndo(); })); _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () { _this.onRedo(); })); _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) { _this.currentCopyVjson = stringToJsonObj(value); })); return _this; } ModulePage.prototype.onLoad = function () { var _this = this; // this.refs.preview.src = href // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI)); this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () { _this.saveCall(); })); this.activeEditor = this.refs.controllerEditor; this.refs.controllerEditor.modulePage = this; this.refs.viewEditor.modulePage = this; this.refs.modelEditor.modulePage = this; this.refs.groovyEditor.modulePage = this; this.refs.sqlEditor.modulePage = this; this.refs.controllerEditor.name = "controllerEditor"; this.refs.viewEditor.name = "viewEditor"; this.refs.modelEditor.name = "modelEditor"; this.refs.groovyEditor.name = "groovyEditor"; this.refs.sqlEditor.name = "sqlEditor"; this.refs.controllerEditor.codeChange = this.codeChange; this.refs.viewEditor.codeChange = this.codeChange; this.refs.modelEditor.codeChange = this.codeChange; this.refs.groovyEditor.codeChange = this.codeChange; this.refs.sqlEditor.codeChange = this.codeChange; }; ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) { if (!cmpVjson || from === this.name) { return; } var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson; replaceVjsonById(vj, cmpVjson); this.updateVjson(vj, from, ignoreRenderUI); }; ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) { var _this = this; var _a, _b; if (!vjson || from === this.name) { return; } this.addViewId(vjson); moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson; moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson); (_a = this.refs.viewEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleStore.getModuleObject(this.moduleId).fileContent) === null || _b === void 0 ? void 0 : _b.jsView); this.previewReRender(); _$2.defer(function () { _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from }); }); }; ModulePage.prototype.previewRender = function (sender) { var _this = this; var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson; if (!this.designScope) { this.designScope = new Scope({ vjson: vjson, model: { data: {} } }); } else { this.designScope.vjson = vjson; } this.designScope.showDesigner(sender, { moduleId: this.moduleId, }); if (this.viewDesign) { return; } _$2.defer(function () { _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer); handles$1.mainWindow.setLoading(false); }); }; ModulePage.prototype.previewReRender = function () { var designer = this.refs.designer; this.previewRender(designer); }; ModulePage.prototype.initEditor = function (moduleItem) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent)) return; (_a = this.refs.controllerEditor) === null || _a === void 0 ? void 0 : _a.setCode((_b = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _b === void 0 ? void 0 : _b.jsController); (_c = this.refs.viewEditor) === null || _c === void 0 ? void 0 : _c.setCode((_d = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _d === void 0 ? void 0 : _d.jsView); (_e = this.refs.modelEditor) === null || _e === void 0 ? void 0 : _e.setCode((_f = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _f === void 0 ? void 0 : _f.jsModel); (_g = this.refs.groovyEditor) === null || _g === void 0 ? void 0 : _g.setCode((_h = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _h === void 0 ? void 0 : _h.groovy); (_j = this.refs.sqlEditor) === null || _j === void 0 ? void 0 : _j.setCode((_k = moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent) === null || _k === void 0 ? void 0 : _k.mybatis); }; ModulePage.prototype.onComponentSelectionChange = function (id, from) { this.currentComponentSelectId = id; }; ModulePage.prototype.onUndo = function () { if (this.activeEditor === this.refs.designer && this.viewDesign) { this.viewDesign.onUndo(); } }; ModulePage.prototype.onRedo = function () { if (this.activeEditor === this.refs.designer && this.viewDesign) { this.viewDesign.onRedo(); } }; ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) { this.activeEditor = newCard; eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts }); }; ModulePage.prototype.saveCall = function () { if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) { moduleStore.saveFile(this.moduleId, "jsView"); } else if (this.activeEditor === this.refs.controllerEditor) { moduleStore.saveFile(this.moduleId, "jsController"); } else if (this.activeEditor === this.refs.modelEditor) { moduleStore.saveFile(this.moduleId, "jsModel"); } else if (this.activeEditor === this.refs.groovyEditor) { moduleStore.saveFile(this.moduleId, "groovy"); } else if (this.activeEditor === this.refs.sqlEditor) { moduleStore.saveFile(this.moduleId, "mybatis"); } }; ModulePage.prototype.check = function () { moduleStore.check(this.moduleId); }; /** * 为vjson添加id * @param vjson * @param isAll */ ModulePage.prototype.addViewId = function (vjson, isAll) { var _this = this; if (isAll === void 0) { isAll = false; } var maxIdTag = 0; // 先提取当前的最大id deepTravVJson(vjson, function (obj) { if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) { return; } if (obj.id && obj.id.indexOf(idPrefix)) { var sutr = obj.id.substring(obj.id.indexOf(idPrefix)); if (sutr.length > 0) { var tid = sutr.replace(idPrefix, ""); var idNum = parseInt(tid); if (idNum && maxIdTag < idNum) { maxIdTag = idNum; } } } }); // 标记最大的id号,避免重复 this.maxViewId = maxIdTag; deepTravVJson(vjson, function (obj) { if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) { return; } if (!obj.hasOwnProperty('id')) { obj.id = _this.createViewId(); } if (!obj.hasOwnProperty('designMode')) { obj.designMode = true; } // if (obj.xtype == "tabview" && obj.activeTab) { // // 设置默认的选项 // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) { // if (typeof obj.activeTab === 'number') { // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id // } else if (typeof obj.activeTab === 'string') { // this._tabViewSelect[obj.id] = obj.activeTab // } // // } // } if (isAll && obj.hasOwnProperty("view")) ; }); return vjson; }; /** * 为组件创建 ID */ ModulePage.prototype.createViewId = function () { this.maxViewId++; return this.id + idPrefix + this.maxViewId; }; ModulePage.prototype.onDestroy = function () { for (var i = 0; i < this.cancelSubscribe.length; i++) { this.cancelSubscribe[i].cancel(); } _super.prototype.onDestroy.call(this); }; return ModulePage; }(Scope)); //# sourceMappingURL=ModulePage.js.map var camundaModdleDescriptor = { "name": "Camunda", "uri": "http://camunda.org/schema/1.0/bpmn", "prefix": "camunda", "xml": { "tagAlias": "lowerCase" }, "associations": [], "types": [ { "name": "Definitions", "isAbstract": true, "extends": [ "bpmn:Definitions" ], "properties": [ { "name": "diagramRelationId", "isAttr": true, "type": "String" } ] }, { "name": "InOutBinding", "superClass": [ "Element" ], "isAbstract": true, "properties": [ { "name": "source", "isAttr": true, "type": "String" }, { "name": "sourceExpression", "isAttr": true, "type": "String" }, { "name": "target", "isAttr": true, "type": "String" }, { "name": "businessKey", "isAttr": true, "type": "String" }, { "name": "local", "isAttr": true, "type": "Boolean", "default": false }, { "name": "variables", "isAttr": true, "type": "String" } ] }, { "name": "In", "superClass": [ "InOutBinding" ], "meta": { "allowedIn": [ "bpmn:CallActivity", "bpmn:SignalEventDefinition" ] } }, { "name": "Out", "superClass": [ "InOutBinding" ], "meta": { "allowedIn": [ "bpmn:CallActivity" ] } }, { "name": "AsyncCapable", "isAbstract": true, "extends": [ "bpmn:Activity", "bpmn:Gateway", "bpmn:Event" ], "properties": [ { "name": "async", "isAttr": true, "type": "Boolean", "default": false }, { "name": "asyncBefore", "isAttr": true, "type": "Boolean", "default": false }, { "name": "asyncAfter", "isAttr": true, "type": "Boolean", "default": false }, { "name": "exclusive", "isAttr": true, "type": "Boolean", "default": true } ] }, { "name": "JobPriorized", "isAbstract": true, "extends": [ "bpmn:Process", "camunda:AsyncCapable" ], "properties": [ { "name": "jobPriority", "isAttr": true, "type": "String" } ] }, { "name": "SignalEventDefinitionExtension", "isAbstract": true, "extends": [ "bpmn:SignalEventDefinition" ], "properties": [ { "name": "async", "isAttr": true, "type": "Boolean", "default": false } ] }, { "name": "ErrorEventDefinitionExtension", "isAbstract": true, "extends": [ "bpmn:ErrorEventDefinition" ], "properties": [ { "name": "errorCodeVariable", "isAttr": true, "type": "String" }, { "name": "errorMessageVariable", "isAttr": true, "type": "String" } ] }, { "name": "ErrorEventDefinition", "superClass": [ "bpmn:ErrorEventDefinition", "Element" ], "properties": [ { "name": "expression", "isAttr": true, "type": "String" } ], "meta": { "allowedIn": ["bpmn:ServiceTask"] } }, { "name": "Error", "isAbstract": true, "extends": [ "bpmn:Error" ], "properties": [ { "name": "camunda:errorMessage", "isAttr": true, "type": "String" } ] }, { "name": "PotentialStarter", "superClass": [ "Element" ], "properties": [ { "name": "resourceAssignmentExpression", "type": "bpmn:ResourceAssignmentExpression" } ] }, { "name": "FormSupported", "isAbstract": true, "extends": [ "bpmn:StartEvent", "bpmn:UserTask" ], "properties": [ { "name": "formHandlerClass", "isAttr": true, "type": "String" }, { "name": "formKey", "isAttr": true, "type": "String" }, { "name": "formRef", "isAttr": true, "type": "String" }, { "name": "formRefBinding", "isAttr": true, "type": "String" }, { "name": "formRefVersion", "isAttr": true, "type": "String" } ] }, { "name": "TemplateSupported", "isAbstract": true, "extends": [ "bpmn:Collaboration", "bpmn:Process", "bpmn:FlowElement" ], "properties": [ { "name": "modelerTemplate", "isAttr": true, "type": "String" }, { "name": "modelerTemplateVersion", "isAttr": true, "type": "Integer" } ] }, { "name": "Initiator", "isAbstract": true, "extends": ["bpmn:StartEvent"], "properties": [ { "name": "initiator", "isAttr": true, "type": "String" } ] }, { "name": "ScriptTask", "isAbstract": true, "extends": [ "bpmn:ScriptTask" ], "properties": [ { "name": "resultVariable", "isAttr": true, "type": "String" }, { "name": "resource", "isAttr": true, "type": "String" } ] }, { "name": "Process", "isAbstract": true, "extends": [ "bpmn:Process" ], "properties": [ { "name": "candidateStarterGroups", "isAttr": true, "type": "String" }, { "name": "candidateStarterUsers", "isAttr": true, "type": "String" }, { "name": "versionTag", "isAttr": true, "type": "String" }, { "name": "historyTimeToLive", "isAttr": true, "type": "String" }, { "name": "isStartableInTasklist", "isAttr": true, "type": "Boolean", "default": true } ] }, { "name": "EscalationEventDefinitionExtension", "isAbstract": true, "extends": [ "bpmn:EscalationEventDefinition" ], "properties": [ { "name": "escalationCodeVariable", "isAttr": true, "type": "String" } ] }, { "name": "FormalExpression", "isAbstract": true, "extends": [ "bpmn:FormalExpression" ], "properties": [ { "name": "resource", "isAttr": true, "type": "String" } ] }, { "name": "Assignable", "extends": ["bpmn:UserTask"], "properties": [ { "name": "assignee", "isAttr": true, "type": "String" }, { "name": "candidateUsers", "isAttr": true, "type": "String" }, { "name": "candidateGroups", "isAttr": true, "type": "String" }, { "name": "dueDate", "isAttr": true, "type": "String" }, { "name": "followUpDate", "isAttr": true, "type": "String" }, { "name": "priority", "isAttr": true, "type": "String" } ] }, { "name": "CallActivity", "extends": ["bpmn:CallActivity"], "properties": [ { "name": "calledElementBinding", "isAttr": true, "type": "String", "default": "latest" }, { "name": "calledElementVersion", "isAttr": true, "type": "String" }, { "name": "calledElementVersionTag", "isAttr": true, "type": "String" }, { "name": "calledElementTenantId", "isAttr": true, "type": "String" }, { "name": "caseRef", "isAttr": true, "type": "String" }, { "name": "caseBinding", "isAttr": true, "type": "String", "default": "latest" }, { "name": "caseVersion", "isAttr": true, "type": "String" }, { "name": "caseTenantId", "isAttr": true, "type": "String" }, { "name": "variableMappingClass", "isAttr": true, "type": "String" }, { "name": "variableMappingDelegateExpression", "isAttr": true, "type": "String" } ] }, { "name": "ServiceTaskLike", "extends": [ "bpmn:ServiceTask", "bpmn:BusinessRuleTask", "bpmn:SendTask", "bpmn:MessageEventDefinition" ], "properties": [ { "name": "expression", "isAttr": true, "type": "String" }, { "name": "class", "isAttr": true, "type": "String" }, { "name": "delegateExpression", "isAttr": true, "type": "String" }, { "name": "resultVariable", "isAttr": true, "type": "String" } ] }, { "name": "DmnCapable", "extends": [ "bpmn:BusinessRuleTask" ], "properties": [ { "name": "decisionRef", "isAttr": true, "type": "String" }, { "name": "decisionRefBinding", "isAttr": true, "type": "String", "default": "latest" }, { "name": "decisionRefVersion", "isAttr": true, "type": "String" }, { "name": "mapDecisionResult", "isAttr": true, "type": "String", "default": "resultList" }, { "name": "decisionRefTenantId", "isAttr": true, "type": "String" } ] }, { "name": "ExternalCapable", "extends": [ "camunda:ServiceTaskLike" ], "properties": [ { "name": "type", "isAttr": true, "type": "String" }, { "name": "topic", "isAttr": true, "type": "String" } ] }, { "name": "TaskPriorized", "extends": [ "bpmn:Process", "camunda:ExternalCapable" ], "properties": [ { "name": "taskPriority", "isAttr": true, "type": "String" } ] }, { "name": "Properties", "superClass": [ "Element" ], "meta": { "allowedIn": ["*"] }, "properties": [ { "name": "values", "type": "Property", "isMany": true } ] }, { "name": "Property", "superClass": [ "Element" ], "properties": [ { "name": "id", "type": "String", "isAttr": true }, { "name": "name", "type": "String", "isAttr": true }, { "name": "value", "type": "String", "isAttr": true } ] }, { "name": "Connector", "superClass": [ "Element" ], "meta": { "allowedIn": [ "camunda:ServiceTaskLike" ] }, "properties": [ { "name": "inputOutput", "type": "InputOutput" }, { "name": "connectorId", "type": "String" } ] }, { "name": "InputOutput", "superClass": [ "Element" ], "meta": { "allowedIn": [ "bpmn:FlowNode", "camunda:Connector" ] }, "properties": [ { "name": "inputOutput", "type": "InputOutput" }, { "name": "connectorId", "type": "String" }, { "name": "inputParameters", "isMany": true, "type": "InputParameter" }, { "name": "outputParameters", "isMany": true, "type": "OutputParameter" } ] }, { "name": "InputOutputParameter", "properties": [ { "name": "name", "isAttr": true, "type": "String" }, { "name": "value", "isBody": true, "type": "String" }, { "name": "definition", "type": "InputOutputParameterDefinition" } ] }, { "name": "InputOutputParameterDefinition", "isAbstract": true }, { "name": "List", "superClass": ["InputOutputParameterDefinition"], "properties": [ { "name": "items", "isMany": true, "type": "InputOutputParameterDefinition" } ] }, { "name": "Map", "superClass": ["InputOutputParameterDefinition"], "properties": [ { "name": "entries", "isMany": true, "type": "Entry" } ] }, { "name": "Entry", "properties": [ { "name": "key", "isAttr": true, "type": "String" }, { "name": "value", "isBody": true, "type": "String" }, { "name": "definition", "type": "InputOutputParameterDefinition" } ] }, { "name": "Value", "superClass": [ "InputOutputParameterDefinition" ], "properties": [ { "name": "id", "isAttr": true, "type": "String" }, { "name": "name", "isAttr": true, "type": "String" }, { "name": "value", "isBody": true, "type": "String" } ] }, { "name": "Script", "superClass": ["InputOutputParameterDefinition"], "properties": [ { "name": "scriptFormat", "isAttr": true, "type": "String" }, { "name": "resource", "isAttr": true, "type": "String" }, { "name": "value", "isBody": true, "type": "String" } ] }, { "name": "Field", "superClass": ["Element"], "meta": { "allowedIn": [ "camunda:ServiceTaskLike", "camunda:ExecutionListener", "camunda:TaskListener" ] }, "properties": [ { "name": "name", "isAttr": true, "type": "String" }, { "name": "expression", "type": "String" }, { "name": "stringValue", "isAttr": true, "type": "String" }, { "name": "string", "type": "String" } ] }, { "name": "InputParameter", "superClass": ["InputOutputParameter"] }, { "name": "OutputParameter", "superClass": ["InputOutputParameter"] }, { "name": "Collectable", "isAbstract": true, "extends": ["bpmn:MultiInstanceLoopCharacteristics"], "superClass": ["camunda:AsyncCapable"], "properties": [ { "name": "collection", "isAttr": true, "type": "String" }, { "name": "elementVariable", "isAttr": true, "type": "String" } ] }, { "name": "FailedJobRetryTimeCycle", "superClass": ["Element"], "meta": { "allowedIn": [ "camunda:AsyncCapable", "bpmn:MultiInstanceLoopCharacteristics" ] }, "properties": [ { "name": "body", "isBody": true, "type": "String" } ] }, { "name": "ExecutionListener", "superClass": ["Element"], "meta": { "allowedIn": [ "bpmn:Task", "bpmn:ServiceTask", "bpmn:UserTask", "bpmn:BusinessRuleTask", "bpmn:ScriptTask", "bpmn:ReceiveTask", "bpmn:ManualTask", "bpmn:ExclusiveGateway", "bpmn:SequenceFlow", "bpmn:ParallelGateway", "bpmn:InclusiveGateway", "bpmn:EventBasedGateway", "bpmn:StartEvent", "bpmn:IntermediateCatchEvent", "bpmn:IntermediateThrowEvent", "bpmn:EndEvent", "bpmn:BoundaryEvent", "bpmn:CallActivity", "bpmn:SubProcess", "bpmn:Process" ] }, "properties": [ { "name": "expression", "isAttr": true, "type": "String" }, { "name": "class", "isAttr": true, "type": "String" }, { "name": "delegateExpression", "isAttr": true, "type": "String" }, { "name": "event", "isAttr": true, "type": "String" }, { "name": "script", "type": "Script" }, { "name": "fields", "type": "Field", "isMany": true } ] }, { "name": "TaskListener", "superClass": ["Element"], "meta": { "allowedIn": [ "bpmn:UserTask" ] }, "properties": [ { "name": "expression", "isAttr": true, "type": "String" }, { "name": "class", "isAttr": true, "type": "String" }, { "name": "delegateExpression", "isAttr": true, "type": "String" }, { "name": "event", "isAttr": true, "type": "String" }, { "name": "script", "type": "Script" }, { "name": "fields", "type": "Field", "isMany": true }, { "name": "id", "type": "String", "isAttr": true }, { "name": "eventDefinitions", "type": "bpmn:TimerEventDefinition", "isMany": true } ] }, { "name": "FormProperty", "superClass": ["Element"], "meta": { "allowedIn": [ "bpmn:StartEvent", "bpmn:UserTask" ] }, "properties": [ { "name": "id", "type": "String", "isAttr": true }, { "name": "name", "type": "String", "isAttr": true }, { "name": "type", "type": "String", "isAttr": true }, { "name": "required", "type": "String", "isAttr": true }, { "name": "readable", "type": "String", "isAttr": true }, { "name": "writable", "type": "String", "isAttr": true }, { "name": "variable", "type": "String", "isAttr": true }, { "name": "expression", "type": "String", "isAttr": true }, { "name": "datePattern", "type": "String", "isAttr": true }, { "name": "default", "type": "String", "isAttr": true }, { "name": "values", "type": "Value", "isMany": true } ] }, { "name": "FormData", "superClass": ["Element"], "meta": { "allowedIn": [ "bpmn:StartEvent", "bpmn:UserTask" ] }, "properties": [ { "name": "fields", "type": "FormField", "isMany": true }, { "name": "businessKey", "type": "String", "isAttr": true } ] }, { "name": "FormField", "superClass": ["Element"], "properties": [ { "name": "id", "type": "String", "isAttr": true }, { "name": "label", "type": "String", "isAttr": true }, { "name": "type", "type": "String", "isAttr": true }, { "name": "datePattern", "type": "String", "isAttr": true }, { "name": "defaultValue", "type": "String", "isAttr": true }, { "name": "properties", "type": "Properties" }, { "name": "validation", "type": "Validation" }, { "name": "values", "type": "Value", "isMany": true } ] }, { "name": "Validation", "superClass": ["Element"], "properties": [ { "name": "constraints", "type": "Constraint", "isMany": true } ] }, { "name": "Constraint", "superClass": ["Element"], "properties": [ { "name": "name", "type": "String", "isAttr": true }, { "name": "config", "type": "String", "isAttr": true } ] }, { "name": "ConditionalEventDefinitionExtension", "isAbstract": true, "extends": [ "bpmn:ConditionalEventDefinition" ], "properties": [ { "name": "variableName", "isAttr": true, "type": "String" }, { "name": "variableEvents", "isAttr": true, "type": "String" } ] } ], "emumerations": [] }; //# sourceMappingURL=camundaModdleDescriptor.js.map /** * This is a sample file that should be replaced with the actual translation. * * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available * translations and labels to translate. */ var translations = { // Labels 'Activate the global connect tool': '激活全局连接工具', 'Append {type}': '追加 {type}', 'Append EndEvent': '追加 结束事件 ', 'Append Task': '追加 任务', 'Append Gateway': '追加 网关', 'Append Intermediate/Boundary Event': '追加 中间/边界 事件', 'Add Lane above': '在上面添加道', 'Divide into two Lanes': '分割成两个道', 'Divide into three Lanes': '分割成三个道', 'Add Lane below': '在下面添加道', 'Append compensation activity': '追加补偿活动', 'Change type': '修改类型', 'Connect using Association': '使用关联连接', 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接', 'Connect using DataInputAssociation': '使用数据输入关联连接', 'Remove': '移除', 'Activate the hand tool': '激活抓手工具', 'Activate the lasso tool': '激活套索工具', 'Activate the create/remove space tool': '激活创建/删除空间工具', 'Create expanded SubProcess': '创建扩展子过程', 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件', 'Create Pool/Participant': '创建池/参与者', 'Parallel Multi Instance': '并行多重事件', 'Sequential Multi Instance': '时序多重事件', 'DataObjectReference': '数据对象参考', 'DataStoreReference': '数据存储参考', 'Loop': '循环', 'Ad-hoc': '即席', 'Create {type}': '创建 {type}', 'Create Task': '创建任务', 'Create StartEvent': '创建开始事件', 'Create EndEvent': '创建结束事件', 'Create Group': '创建组', 'Task': '任务', 'Send Task': '发送任务', 'Receive Task': '接收任务', 'User Task': '用户任务', 'Manual Task': '手工任务', 'Business Rule Task': '业务规则任务', 'Service Task': '服务任务', 'Script Task': '脚本任务', 'Call Activity': '调用活动', 'Sub Process (collapsed)': '子流程(折叠的)', 'Sub Process (expanded)': '子流程(展开的)', 'Start Event': '开始事件', 'StartEvent': '开始事件', 'Intermediate Throw Event': '中间事件', 'End Event': '结束事件', 'EndEvent': '结束事件', 'Create Gateway': '创建网关', 'GateWay': '网关', 'Create Intermediate/Boundary Event': '创建中间/边界事件', 'Message Start Event': '消息开始事件', 'Timer Start Event': '定时开始事件', 'Conditional Start Event': '条件开始事件', 'Signal Start Event': '信号开始事件', 'Error Start Event': '错误开始事件', 'Escalation Start Event': '升级开始事件', 'Compensation Start Event': '补偿开始事件', 'Message Start Event (non-interrupting)': '消息开始事件(非中断)', 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)', 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)', 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)', 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)', 'Message Intermediate Catch Event': '消息中间捕获事件', 'Message Intermediate Throw Event': '消息中间抛出事件', 'Timer Intermediate Catch Event': '定时中间捕获事件', 'Escalation Intermediate Throw Event': '升级中间抛出事件', 'Conditional Intermediate Catch Event': '条件中间捕获事件', 'Link Intermediate Catch Event': '链接中间捕获事件', 'Link Intermediate Throw Event': '链接中间抛出事件', 'Compensation Intermediate Throw Event': '补偿中间抛出事件', 'Signal Intermediate Catch Event': '信号中间捕获事件', 'Signal Intermediate Throw Event': '信号中间抛出事件', 'Message End Event': '消息结束事件', 'Escalation End Event': '定时结束事件', 'Error End Event': '错误结束事件', 'Cancel End Event': '取消结束事件', 'Compensation End Event': '补偿结束事件', 'Signal End Event': '信号结束事件', 'Terminate End Event': '终止结束事件', 'Message Boundary Event': '消息边界事件', 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)', 'Timer Boundary Event': '定时边界事件', 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)', 'Escalation Boundary Event': '升级边界事件', 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)', 'Conditional Boundary Event': '条件边界事件', 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)', 'Error Boundary Event': '错误边界事件', 'Cancel Boundary Event': '取消边界事件', 'Signal Boundary Event': '信号边界事件', 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)', 'Compensation Boundary Event': '补偿边界事件', 'Exclusive Gateway': '互斥网关', 'Parallel Gateway': '并行网关', 'Inclusive Gateway': '相容网关', 'Complex Gateway': '复杂网关', 'Event based Gateway': '事件网关', 'Transaction': '转运', 'Sub Process': '子流程', 'Event Sub Process': '事件子流程', 'Collapsed Pool': '折叠池', 'Expanded Pool': '展开池', // Errors 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类', 'no shape type specified': '没有指定的形状类型', 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类', 'out of bounds release': 'out of bounds release', 'more than {count} child lanes': '子道大于{count} ', 'element required': '元素不能为空', 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范', 'no diagram to display': '没有可展示的流程图', 'no process or collaboration to display': '没有可展示的流程/协作', 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制', 'already rendered {element}': '{element} 已被渲染', 'failed to import {element}': '导入{element}失败', // 属性面板的参数 'Id': '编号', 'Name': '名称', 'General': '常规', 'Details': '详情', 'Message Name': '消息名称', 'Message': '消息', 'Initiator': '创建者', 'Asynchronous Continuations': '持续异步', 'Asynchronous Before': '异步前', 'Asynchronous After': '异步后', 'Job Configuration': '工作配置', 'Exclusive': '排除', 'Job Priority': '工作优先级', 'Retry Time Cycle': '重试时间周期', 'Documentation': '文档', 'Element Documentation': '元素文档', 'History Configuration': '历史配置', 'History Time To Live': '历史的生存时间', 'Forms': '表单', 'Form Key': '表单key', 'Form Fields': '表单字段', 'Business Key': '业务key', 'Form Field': '表单字段', 'ID': '编号', 'Type': '类型', 'Label': '名称', 'Default Value': '默认值', 'Validation': '校验', 'Add Constraint': '添加约束', 'Config': '配置', 'Properties': '属性', 'Add Property': '添加属性', 'Value': '值', 'Add': '添加', 'Values': '值', 'Add Value': '添加值', 'Listeners': '监听器', 'Execution Listener': '执行监听', 'Event Type': '事件类型', 'Listener Type': '监听器类型', 'Java Class': 'Java类', 'Expression': '表达式', 'Must provide a value': '必须提供一个值', 'Delegate Expression': '代理表达式', 'Script': '脚本', 'Script Format': '脚本格式', 'Script Type': '脚本类型', 'Inline Script': '内联脚本', 'External Script': '外部脚本', 'Resource': '资源', 'Field Injection': '字段注入', 'Extensions': '扩展', 'Input/Output': '输入/输出', 'Input Parameters': '输入参数', 'Output Parameters': '输出参数', 'Parameters': '参数', 'Output Parameter': '输出参数', 'Timer Definition Type': '定时器定义类型', 'Timer Definition': '定时器定义', 'Date': '日期', 'Duration': '持续', 'Cycle': '循环', 'Signal': '信号', 'Signal Name': '信号名称', 'Escalation': '升级', 'Error': '错误', 'Link Name': '链接名称', 'Condition': '条件名称', 'Variable Name': '变量名称', 'Variable Event': '变量事件', 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开', 'Wait for Completion': '等待完成', 'Activity Ref': '活动参考', 'Version Tag': '版本标签', 'Executable': '可执行文件', 'External Task Configuration': '扩展任务配置', 'Task Priority': '任务优先级', 'External': '外部', 'Connector': '连接器', 'Must configure Connector': '必须配置连接器', 'Connector Id': '连接器编号', 'Implementation': '实现方式', 'Field Injections': '字段注入', 'Fields': '字段', 'Result Variable': '结果变量', 'Topic': '主题', 'Configure Connector': '配置连接器', 'Input Parameter': '输入参数', 'Assignee': '代理人', 'Candidate Users': '候选用户', 'Candidate Groups': '候选组', 'Due Date': '到期时间', 'Follow Up Date': '跟踪日期', 'Priority': '优先级', // eslint-disable-next-line no-template-curly-in-string 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00', // eslint-disable-next-line no-template-curly-in-string 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00', 'Variables': '变量', 'Candidate Starter Configuration': '候选开始配置', 'Task Listener': '任务监听器', 'Candidate Starter Groups': '候选开始组', 'Candidate Starter Users': '候选开始用户', 'Tasklist Configuration': '任务列表配置', 'Startable': '启动', 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔', 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔', 'This maps to the process definition key.': '这会映射为流程定义的键', 'CallActivity Type': '调用活动类型', 'Condition Type': '条件类型', 'Create UserTask': '创建用户任务', 'Create CallActivity': '创建调用活动', 'Called Element': '调用元素', 'Create DataObjectReference': '创建数据对象引用', 'Create DataStoreReference': '创建数据存储引用', 'Multi Instance': '多实例', 'Loop Cardinality': '实例数量', Collection: '任务参与人列表', 'Element Variable': '元素变量', 'Completion Condition': '完成条件' }; //# sourceMappingURL=translations.js.map function customTranslate(template, replacements) { replacements = replacements || {}; // Translate template = translations[template] || template; // Replace return template.replace(/{([^}]+)}/g, function (_, key) { return replacements[key] || '{' + key + '}'; }); } //# sourceMappingURL=customTranslate.js.map var vjson$9 = { title: '导入流程', layout: 'fit', width: 400, height: 400, items: [ { layout: 'border', items: [ { xtype: 'form', items: [ // { // xtype: 'cols', // items: [ // { // xtype: 'textfield', // allowBlank: false, // fieldLabel: '流程名称', // bind: '{name}' // }, // ], // }, { xtype: 'cols', items: [ { xtype: 'filefield', name: 'deployFile', fieldLabel: '文件名称', // labelWidth: '100%', msgTarget: 'side', reference: 'MOBANB_FILE', fileUpload: true, allowBlank: false, // flex: 1, // width: '100%', buttonText: '请选择文件位置', listeners: { change: 'scope.fileChange' } // bind: '{FILE}' }, ] } ], region: 'center', split: true, }, ], }, ], fbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: { click: 'scope.save', }, } ], }, }; //# sourceMappingURL=ImportBpmn.view.js.map var model$9 = { data: { name: '', file_content: '' } }; //# sourceMappingURL=ImportBpmn.model.js.map var ImportBpmn = /** @class */ (function (_super) { __extends(ImportBpmn, _super); function ImportBpmn() { return _super.call(this, { model: model$9, vjson: vjson$9 }) || this; } ImportBpmn.prototype.onLoad = function () { }; ImportBpmn.prototype.save = function (sender) { if (this.data.file_content) { this.dialogSuccess(this.data); } else { Ext.Msg.alert('提示', "请先上传文件"); } }; ImportBpmn.prototype.fileChange = function (e) { var _this = this; // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0] var file = e.fileInputEl.dom.files[0]; //获取文件 var reader = new FileReader(); reader.readAsText(file, "UTF-8"); reader.onload = function () { _this.data.file_content = reader.result; }; }; return ImportBpmn; }(Scope)); //# sourceMappingURL=ImportBpmn.js.map var model$a = { data: { form_id: '', form_name: '', save_dir_path: '', absolute_path: '', form: { id: '', code: '', name: '', table: '', controller: '', groovy: '', fields: [], buttons: [], }, } }; //# sourceMappingURL=ConfigStrategy.model.js.map var vjson$a = { title: '配置适配策略', layout: 'fit', items: [ { layout: 'border', items: [ { region: 'center', xtype: 'yvgrid', pagination: false, hideFootbar: true, plugins: { clipboard: true, selectionreplicator: true }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加策略', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addStrategy' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: {} }, '-', { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: {} }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: {} }, ] }, columns: [ { xtype: 'rownumberer' }, { header: '优先级', dataIndex: 'priority', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { header: '策略编号', dataIndex: 'strategy_code', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { header: '策略名称', dataIndex: 'strategy_name', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { header: "条件表达式", dataIndex: "strategy_exp", }, ], }, { title: '适配条件', region: 'south', height: '50%', xtype: 'form', items: [ { xtype: 'cols', items: [ { xtype: 'rows', items: [ { xtype: 'textfield', fieldLabel: "仓库", }, { xtype: 'textfield', fieldLabel: "货主", }, { xtype: 'textfield', fieldLabel: "项目", }, { xtype: 'textfield', fieldLabel: "行政区划", }, { xtype: 'textfield', fieldLabel: "客户", }, { xtype: 'textfield', fieldLabel: "商品", } ] }, { xtype: 'rows', margin: '8 0 0 10', items: [ { xtype: 'label', html: '自定义表达式', }, { xtype: 'textarea', } ] } ] } ] } ] } ] }; // //# sourceMappingURL=ConfigStrategy.view.js.map // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request"; // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore"; // import ReportRunner from "./ReportRunner"; var ConfigStrategy = /** @class */ (function (_super) { __extends(ConfigStrategy, _super); function ConfigStrategy() { return _super.call(this, { model: model$a, vjson: vjson$a }) || this; } ConfigStrategy.prototype.onLoad = function () { this.load(); }; ConfigStrategy.prototype.load = function () { var _this = this; var form_id = this.viewModel.get("form_id"); var absolute_path = this.viewModel.get("absolute_path"); var save_dir_path = this.viewModel.get("save_dir_path"); if (absolute_path && form_id) { this.setLoading(true); readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) { if (res.success) { // 基础属性 _this.viewModel.set('form', res.data.form); // 字段定义 _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields')); // 按钮 _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons')); } }).finally(function () { _this.setLoading(false); }); } }; ConfigStrategy.prototype.saveAll = function () { var _this = this; var save_dir_path = this.viewModel.get("save_dir_path"); if (!save_dir_path) { msg("save_dir_path error"); return; } var form_id = this.viewModel.get("form_id"); var absolute_path = this.viewModel.get("absolute_path"); // 表格校验 if (!this.refs.form1.isValid()) { msg("请检查表单必填项!"); return; } // 字段数据 var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) { delete item.id; if (item.hide) { delete item.hide_text; } else { item.hide = item.hide_text; delete item.hide_text; } if (item.readonly) { delete item.readonly_text; } else { item.readonly = item.readonly_text; delete item.readonly_text; } if (item.disabled) { delete item.disabled_text; } else { item.disabled = item.disabled_text; delete item.disabled_text; } if (item.required) { delete item.required_text; } else { item.required = item.required_text; delete item.required_text; } return item; }); this.viewModel.set("form.fields", gridColumnRows); // 按钮数据 var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) { delete item.id; return item; }); this.viewModel.set("form.buttons", gridBtnRows); // 查询条件 // 策略 var form = this.viewModel.get("form"); this.setLoading(true); createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) { if (res.success) { msg('保存成功'); handles$1.mainWindow.refs['exporerTree'].reload(); } }).finally(function () { _this.setLoading(false); }); }; ConfigStrategy.prototype.addColumn = function () { this.refs.gridColumn.getStore().add({}); }; ConfigStrategy.prototype.removeColumn = function () { this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection()); }; ConfigStrategy.prototype.calcColumn = function (sender) { var _this = this; var table = this.viewModel.get("form.table"); if (!table) { msg("表名不存在!"); return; } this.setLoading(true); calcColumnForm({ table: table }).then(function (res) { if (res.success) { msg(res.msg); if (res.data.columns.length > 0) { _$2.forEach(res.data.columns, function (it) { _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName }); }); } } }).finally(function () { _this.setLoading(false); }); }; ConfigStrategy.prototype.addButton = function () { this.refs.gridButton.getStore().add({}); }; ConfigStrategy.prototype.moveUp = function (sender) { var grid = sender.up('grid'); grid.rowMoveUp(); }; ConfigStrategy.prototype.moveDown = function (sender) { var grid = sender.up('grid'); grid.rowMoveDown(); }; ConfigStrategy.prototype.addStrategy = function (sender, path) { var win = new Ext.Window({ autoDestroy: true, title: "添加(编辑)策略", width: 400, height: 300, resizable: true, closable: true, maximizable: true, minimizable: true, plain: true, // constrainHeader: true, constrain: true, layout: 'fit', animateTarget: sender, buttonAlign: 'center', items: [ { xtype: "form", layout: "hbox", margin: '10px 20px', border: 0, items: [ { flex: 1, layout: 'vbox', items: [ { xtype: "numberfield", fieldLabel: "优先级", flex: 1, allowBlank: false, labelWidth: 50, width: "100%", }, { xtype: "textfield", fieldLabel: "策略名称", flex: 1, allowBlank: false, labelWidth: 50, width: "100%", }, { xtype: "textfield", fieldLabel: "策略编号", flex: 1, allowBlank: false, regex: /^[a-zA-Z][a-zA-Z0-9]*$/, regexText: "文件名只能以英文字母开头,且只包含英文字母、数字", labelWidth: 50, width: "100%", }, { xtype: "textfield", fieldLabel: "仓库ID", flex: 1, allowBlank: false, regex: /^[a-zA-Z][a-zA-Z0-9]*$/, regexText: "文件名只能以英文字母开头,且只包含英文字母、数字", labelWidth: 50, width: "100%", }, ] }, ] } ], //窗口按钮 buttons: [ { xtype: 'button', text: '保存', handler: function (btn) { //窗口获取表单 var form = win.down('form'); var vaildSuccess = form.isValid(); if (!vaildSuccess) { return; } var filename = form.down('textfield[name="filename"]').getValue(); } }, { xtype: 'button', text: '取消', handler: function (btn) { //窗口关闭 win.close(); } } ] }); win.show(); }; return ConfigStrategy; }(Scope)); //# sourceMappingURL=ConfigStrategy.js.map var buildVjson = function () { return { bind: { title: '流程编辑-{text}', }, layout: 'fit', items: [{ layout: 'border', tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '撤销', listeners: { click: "scope.undo" } }, { xtype: 'button', text: '还原', listeners: { click: "scope.redo" } }, { xtype: 'button', text: '保存', listeners: { click: "scope.save" } }, { xtype: 'button', text: '导入BPM', listeners: { click: "scope.importBpm" } }, { xtype: 'button', text: '配置适配策略', listeners: { click: "scope.configStrategy" } }, { fieldLabel: '选择配置分支', xtype: 'combogrid', }, ] }, items: [ { xtype: "panel", region: 'center', reference: "bpmn_view", html: "
", }, { split: true, xtype: "panel", region: 'east', width: '30%', reference: "bpmn_properties", html: "
", } ], }], listeners: { afterrender: 'scope.onViewRender' } }; }; var BpmnDesign = /** @class */ (function (_super) { __extends(BpmnDesign, _super); function BpmnDesign() { var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this; _this.bpmnModeler = null; _this.bpmnModelerName = ""; return _this; } BpmnDesign.prototype.onLoad = function () { var _this = this; _super.prototype.onLoad.call(this); this.setLoading(true); this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn")); readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) { if (res && res.success && res.data && res.data.bpmn) { var diagramXML = res.data.bpmn; _this.bpmnModeler.importXML(diagramXML).then(function (res) { var elements = _this.bpmnModeler._definitions.rootElements; if (Array.isArray(elements) && elements.length > 0) { elements[0].name = _this.bpmnModelerName; } }).catch(function (err) { msgError(err); }); } else { msgError(res.msg); } }).finally(function () { _this.setLoading(false); }); }; BpmnDesign.prototype.onViewRender = function (sender) { var customTranslateModule = { translate: ['value', customTranslate] }; this.bpmnModeler = new BpmnModeler({ container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0], propertiesPanel: { parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0], }, additionalModules: [ bpmnJsPropertiesPanel.BpmnPropertiesPanelModule, bpmnJsPropertiesPanel.BpmnPropertiesProviderModule, bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule, bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule, bpmnJsPropertiesPanel.CloudElementTemplatesValidator, bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule, bpmnJsPropertiesPanel.ZeebeDescriptionProvider, bpmnJsPropertiesPanel.ZeebePropertiesProviderModule, customTranslateModule, ], moddleExtensions: { camunda: camundaModdleDescriptor }, keyboard: { bindTo: document } // 使用键盘快捷键 }); }; //开启快捷键 //modeler.get('keyboard').bind(document); //关闭快捷键 //modeler.get('keyboard').unbind(); BpmnDesign.prototype.undo = function (sender) { this.bpmnModeler.get('commandStack').undo(); }; BpmnDesign.prototype.redo = function (sender) { this.bpmnModeler.get('commandStack').redo(); }; BpmnDesign.prototype.save = function (sender) { var _this = this; this.setLoading(true); this.bpmnModeler.saveXML().then(function (resBpm) { saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) { if (res.success) { msg$1("保存成功"); } else { msgError(res.msg); } }).catch(function (e) { var _a, _b; var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg; msgError(msg); }).finally(function () { _this.setLoading(false); }); }).catch(function (e) { msgError(e); _this.setLoading(false); }); }; BpmnDesign.prototype.importBpm = function (sender) { var _this = this; var dlg = new ImportBpmn(); //@ts-ignore dlg.success = function (sen, data) { _this.bpmnModeler.importXML(data.file_content).then(function (res) { var elements = _this.bpmnModeler._definitions.rootElements; if (Array.isArray(elements) && elements.length > 0) { elements[0].name = _this.bpmnModelerName; } }).catch(function (err) { msgError(err); }); }; dlg.showDialog(sender, {}, {}); // this.bpmnModeler.importXML() }; BpmnDesign.prototype.configStrategy = function (sender) { var configStrategy = new ConfigStrategy(); configStrategy.showDialog(sender, {}, {}); }; return BpmnDesign; }(Scope)); //# sourceMappingURL=BpmnDesign.js.map var model$b = { data: { id: '', path: '', form: { title: '', sqlId: '', } } }; //# sourceMappingURL=WhLayoutDesign.model.js.map var vjson$b = { bind: { title: '{title}', }, layout: 'fit', items: [ { layout: 'border', items: [ { region: 'center', reference: 'editor', border: true, // html: '
', // listeners: { // afterrender: 'scope.editorInit' // } html: '', listeners: { afterrender: 'scope.iframeRender' } }, ] } ] }; // // //# sourceMappingURL=WhLayoutDesign.view.js.map var WidgetDesign$1 = /** @class */ (function (_super) { __extends(WidgetDesign, _super); function WidgetDesign(layoutCode, layoutName) { var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this; _this.layoutCode = layoutCode; _this.layoutName = layoutName; return _this; } WidgetDesign.prototype.onLoad = function () { this.viewModel.set('layoutCode', this.layoutCode); this.viewModel.set('layoutName', this.layoutName); if (this.layoutCode) { this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']'); } else { this.viewModel.set('title', '新建图纸'); } }; WidgetDesign.prototype.reload = function () { var _this = this; this.setLoading(true); loadWhLayout({ layoutCode: this.layoutCode, layoutName: this.layoutName, }).then(function (res) { if (res.success) { var xml = res.data.layoutContent; var doc = _this.mxUtils.parseXml(xml); var graph = _this.editorUi.editor.graph; graph.setSelectionCells(graph.importGraphModel(doc.documentElement)); } }).finally(function () { _this.setLoading(false); }); }; WidgetDesign.prototype.editorInit = function (sender) { var that = this; var dom = $(sender.el.dom).find('.geEditor')[0]; //@ts-ignore require(['mxgraph'], function () { var editorUiInit = EditorUi.prototype.init; EditorUi.prototype.init = function () { editorUiInit.apply(this, arguments); this.actions.get('save').funct = that.onFileSave.bind(that); this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that); this.actions.get('open').visible = false; this.actions.get('new').visible = false; this.actions.get('preview').visible = false; this.actions.get('print').visible = false; this.actions.get('pageSetup').visible = false; this.actions.get('help').visible = false; this.actions.get('export').visible = false; this.actions.get('about').visible = false; this.menus.menus.help.setEnabled(false); that.editorUi = this; if (that.layoutCode) { that.reload(); } }; var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor'; var mxLanguage = 'zh'; mxResources.loadDefaultBundle = false; var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) || mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage); var STYLE_PATH = '/assets/mxgraph-editor/styles'; // Fixes possible asynchronous requests mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) { // Adds bundle text to resources mxResources.parse(xhr[0].getText()); // Configures the default graph theme var themes = new Object(); themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement(); // Main new EditorUi(new Editor(false, themes), dom); }, function () { dom.innerHTML = '
Error loading resource files. Please check browser console.
'; }); }); }; WidgetDesign.prototype.iframeRender = function (sender) { var that = this; var iframe = $(sender.el.dom).find('iframe')[0]; iframe.contentWindow['designer'] = that; iframe.contentWindow['editorInitFn'] = function (editorUi) { editorUi.actions.get('save').funct = that.onFileSave.bind(that); editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that); editorUi.actions.get('open').visible = false; editorUi.actions.get('new').visible = false; editorUi.actions.get('preview').visible = false; editorUi.actions.get('print').visible = false; editorUi.actions.get('pageSetup').visible = false; editorUi.actions.get('help').visible = false; editorUi.actions.get('export').visible = false; editorUi.actions.get('about').visible = false; editorUi.menus.menus.help.setEnabled(false); that.editorUi = editorUi; that.mxUtils = iframe.contentWindow['mxUtils']; if (that.layoutCode) { that.reload(); } }; }; WidgetDesign.prototype.onDestroy = function () { var _a; try { (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy(); } catch (e) { } }; WidgetDesign.prototype.onFileSaveAs = function () { var _this = this; this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName }) .then(function (_a) { var code = _a.code, name = _a.name; _this.layoutCode = code; _this.layoutName = name; _this.onSave(); }); }; WidgetDesign.prototype.onSave = function () { var _this = this; var layoutContent = this.editorUi.getEditBlankXml(); var layoutCode = this.layoutCode; var layoutName = this.layoutName; if (!layoutCode || !layoutName) { msg$1('图形编号和图形名称必填'); return; } this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']'); this.setLoading(true); saveWhLayout({ layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent }).then(function (res) { msg$1(res.msg); handles$1.whLayout.reload(); }).finally(function () { _this.setLoading(false); }); }; WidgetDesign.prototype.onFileSave = function () { if (!this.layoutCode || !this.layoutName) { this.onFileSaveAs(); } else { this.onSave(); } }; WidgetDesign.prototype.showSaveAsDlg = function (_a) { var code = _a.code, name = _a.name; return new Promise(function (resolve, reject) { var viewModel = new Ext.app.ViewModel({ data: { code: code !== null && code !== void 0 ? code : '', name: name !== null && name !== void 0 ? name : '', } }); var dlg = Ext.create('Ext.window.Window', { title: '保存', viewModel: viewModel, layout: { type: "vbox", pack: "start", align: "stretch" }, items: [ { xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0', bind: '{code}' }, { xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0', bind: '{name}' } ], fbar: [ { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: { click: function () { var code = viewModel.get('code'); var name = viewModel.get('name'); resolve({ code: code, name: name }); dlg.close(); } } }, { xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: { click: function () { dlg.close(); } } }, ] }); dlg.show(); }); }; return WidgetDesign; }(Scope)); //# sourceMappingURL=WhLayoutDesign.js.map // init() var Workbench = /** @class */ (function (_super) { __extends(Workbench, _super); // activeModulePage: ModulePage = null function Workbench() { var _this = _super.call(this, { model: model, vjson: vjson }) || this; _this.name = "MainWindow"; _this.modules = []; _this.yvgridDesign = null; return _this; } Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) { if (newCard) { this.viewModel.set('leftTabTitle', newCard.tooltip); } else { this.viewModel.set('leftTabTitle', '未选中'); } }; Object.defineProperty(Workbench.prototype, "activeModulePage", { get: function () { var _a; return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined; }, enumerable: true, configurable: true }); Workbench.prototype.documentKeydown = function (event) { if (event.ctrlKey || event.metaKey) { if (event.key.toLowerCase() === 's') { eventBus.publish(EventType.SaveCall, {}); event.stopPropagation(); event.preventDefault(); } else if (event.key.toLowerCase() === 'z') { if (event.shiftKey) { eventBus.publish(EventType.Redo, {}); event.stopPropagation(); event.preventDefault(); } else { eventBus.publish(EventType.Undo, {}); event.stopPropagation(); event.preventDefault(); } } } }; Workbench.prototype.onLoad = function () { var _this = this; window["tt"] = this.refs['tt']; window["vm"] = this.viewModel; $('#loading').remove(); setMainWindow(this); setStatusbar(this.down('statusbar')); document.addEventListener('keydown', this.documentKeydown.bind(this)); var currentProject = getCurrentProject(); this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")"); // handles.fileTree.reload() eventBus.subscribe(EventType.ModuleOpen, function (rawData) { _this.showModule(rawData); }); eventBus.subscribe(EventType.Undo, function () { _this.onUndo(); }); eventBus.subscribe(EventType.Redo, function () { _this.onRedo(); }); eventBus.subscribe(EventType.Cut, function (_a) { var a = _a.a, b = _a.b, c = _a.c, d = _a.d; _this.onCut(a, b, c, d); }); eventBus.subscribe(EventType.Copy, function (_a) { var a = _a.a, b = _a.b, c = _a.c, d = _a.d; _this.onCopy(a, b, c, d); }); eventBus.subscribe(EventType.Paste, function (_a) { var a = _a.a, b = _a.b, c = _a.c, d = _a.d; _this.onPaste(a, b, c, d); }); eventBus.subscribe(EventType.SelectAll, function () { _this.onSelectAll(); }); eventBus.subscribe(EventType.SelectAll, function () { _this.onSelectAll(); }); eventBus.subscribe(EventType.RunCheckModule, function () { _this.runCheckModule(); }); eventBus.subscribe(EventType.StopCheckModule, function () { _this.stopCheckModule(); }); eventBus.subscribe(EventType.ComponentContextmenu, function (args) { _this.onCompoentContextMenu(args); }); this.runCheckModule(); }; Workbench.prototype.onCompoentContextMenu = function (args) { var _this = this; if (!this.yvgridDesign) { this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId); this.yvgridDesign.showDialog(null, {}, {}); var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign); this.yvgridDesign.onDestroy = function () { fn_1(); _this.yvgridDesign = null; }; } }; Workbench.prototype.runCheckModule = function () { var _this = this; if (this.checkTimer) { return; } this.checkTimer = setInterval(function () { var _a; if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) { _this.activeModulePage.check(); } }, 5000); }; Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) { var dlg = new WidgetDesign(widgetPath, widgetName); dlg.showPage({ id: 'widget_' + widgetPath, path: 'widget_' + widgetPath, }, { data: { title: widgetPath ? '检索框:' + widgetName : '新建检索框', } }); dlg.dialogSuccess = successCallback; }; Workbench.prototype.stopCheckModule = function () { clearInterval(this.checkTimer); this.checkTimer = null; }; Workbench.prototype.showDataSync = function () { var ins = new DbSync(); ins.showPage({ id: 'db_sync__', path: 'db_sync__', }, { data: {} }); }; /** * 打开一个项目 */ Workbench.prototype.openProject = function (project) { setCurrentProject(project); this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")"); handles$1.fileTree.reload(); }; /** * 打开模板开发面板 */ Workbench.prototype.showTemplateDev = function () { var ins = new TemplateDev(); ins.showPage({ id: 'template_dev__', path: 'template_dev__', }, { data: {} }); }; Workbench.prototype.openScope = function () { }; /** * 显示字段域管理器 */ Workbench.prototype.showColumnDomain = function () { var instance = new DbDomain(); instance.showPage({ id: 'domain__', path: 'domain__', }, { data: {} }); }; /** * 显示性能统计 */ Workbench.prototype.showPerform = function () { // const instance = new PerformStats() // instance.showPage({ // id: 'perform__', // path: 'perform__', // // }, { // data: {} // }) }; /** * 显示数据库代码模板库 */ Workbench.prototype.showDbCodeTemplate = function () { // const instance = new DbCodeTemplate() // instance.showPage({ // id: 'dbcode__', // path: 'dbcode__', // // }, { // data: {} // }) }; /** * 显示数据库代码模板库 */ Workbench.prototype.showReport = function (report_id, report_name, success) { var instance = new ReportDesign(); instance.showPage({ id: 'report_' + report_id, path: 'report_' + report_id, }, { data: { report_id: report_id, report_name: report_name, } }); instance.dialogSuccess = success; }; /** * 显示报表 */ Workbench.prototype.showReportPreview = function (report_id, instance) { instance.showPage({ id: 'REPORT__' + report_id, path: 'REPORT__' + report_id, }, { data: { report_id: report_id, } }); var reportName = instance.viewModel.get('report_name'); instance.viewModel.set('report_name', '[预览]-' + reportName); }; /** * 显示运维页面 */ Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) { // const instance = new DevOpsTerminal() // instance.showPage({ // id: 'ops_' + opsId, // path: 'ops_' + opsId, // // }, { // data: { // opsId: opsId, // name: name, // } // }) // instance.dialogSuccess = success }; /** * 显示表结构 * tableName 为空的情况就是新建表,否则就是要编辑的表 * columnName 可以为空 */ Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) { var id = 'tableColumn_' + tableName; var isCreateTable = false; // /ROOT/schema$public/schema$public$bas_location_group_rel var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName; if (!tableName) { id = _$2.uniqueId('new_table'); tableName = id; isCreateTable = true; } var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate); instance.showPage({ id: id, path: id, locatPath: locatPath }, { data: { tableName: tableName, columnName: columnName } }); }; /** * 打开某个模块 * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn */ Workbench.prototype.showModule = function (rawData) { var id = rawData.id, path = rawData.path; var separator = '/'; var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; }); var module = this.modules[idx]; var pageId = path.replaceAll('/', '_'); console.log('open module', module); var instance = new ModulePage(id, module); eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance })); instance.showPage({ id: 'module_' + pageId, path: path, title: module.name }, { data: {} }); }; Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) { var bpmnDesign = new BpmnDesign(); bpmnDesign.showPage({}, { data: { absolutePath: absolutePath, id: id, text: text } }); }; Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) { var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout'); var layoutDesign = new WidgetDesign$1(layoutCode, layoutName); layoutDesign.showPage({ id: id, path: id, }, { data: {} }); }; Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) { var _a; // this.activeModulePage = newCard.yvanScope handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId; handles$1.property.moduleId = newCard.yvanScope.moduleId; // handles.dbTree.moduleId = newCard.yvanScope.moduleId // handles.dictTree.moduleId = newCard.yvanScope.moduleId // handles.fileTree.moduleId = newCard.yvanScope.moduleId // handles.statusbar.moduleId = newCard.yvanScope.moduleId eventBus.publish(EventType.MainTabChange, { moduleId: newCard.yvanScope.moduleId, oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId, from: this.name }); }; Workbench.prototype.onUndo = function () { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {}); }; Workbench.prototype.onRedo = function () { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {}); }; Workbench.prototype.onCut = function (a, b, c, d) { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {}); }; Workbench.prototype.onCopy = function (a, b, c, d) { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {}); }; Workbench.prototype.onPaste = function (a, b, c, d) { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {}); }; Workbench.prototype.onSelectAll = function () { var _a; (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {}); }; return Workbench; }(Scope)); //# sourceMappingURL=Workbench.js.map (function (FuncDomain) { FuncDomain["SCOPE"] = "scope"; FuncDomain["SYSTEM"] = "system"; })(exports.FuncDomain || (exports.FuncDomain = {})); (function (BizMode) { //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑' BizMode[BizMode["query"] = 1] = "query"; BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit"; BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly"; BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly"; })(exports.BizMode || (exports.BizMode = {})); (function (BizFormat) { // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage BizFormat[BizFormat["button"] = 1] = "button"; BizFormat[BizFormat["progress"] = 2] = "progress"; BizFormat[BizFormat["date"] = 3] = "date"; BizFormat[BizFormat["datetime"] = 4] = "datetime"; BizFormat[BizFormat["percentage"] = 5] = "percentage"; })(exports.BizFormat || (exports.BizFormat = {})); (function (BizUnique) { // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一 BizUnique[BizUnique["u_a"] = 1] = "u_a"; BizUnique[BizUnique["u_wh"] = 2] = "u_wh"; BizUnique[BizUnique["u_ow"] = 3] = "u_ow"; BizUnique[BizUnique["u_pj"] = 4] = "u_pj"; BizUnique[BizUnique["u_od"] = 5] = "u_od"; BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj"; })(exports.BizUnique || (exports.BizUnique = {})); var ScopeEngine = /** @class */ (function () { function ScopeEngine() { } ScopeEngine.getBizFile = function (director) { return new Promise(function (resolve, reject) { debugger; }); }; ScopeEngine.buildScopeFromBillFile = function (billFile) { return new Promise(function (resolve, reject) { var requireArr = []; var requireKeyArr = []; _$2.forOwn(billFile.domains, function (v, k) { requireArr.push(v.domain); requireKeyArr.push(k); if (v.layout) { requireArr.push(v.layout); requireKeyArr.push(k + "_layout"); } }); requireArr.push(billFile.layout); requireKeyArr.push("layout"); requireArr.push(billFile.converter); requireKeyArr.push("converter"); // @ts-ignore require(requireArr, function () { var requireReArr = []; for (var _i = 0; _i < arguments.length; _i++) { requireReArr[_i] = arguments[_i]; } if (requireReArr.length <= 0) { reject(new Error("没有加载到相关的文件!")); } var domains = {}; for (var i = 0; i < requireReArr.length - 2; i++) { if (requireKeyArr[i].endsWith("_layout")) { var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout")); domains[key_d].layout = requireReArr[i].default; } else { domains[requireKeyArr[i]] = requireReArr[i].default; domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type; domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode; } } var bizFile = { bill: billFile, domains: domains, layout: requireReArr[requireReArr.length - 2].default, converter: requireReArr[requireReArr.length - 1].default, }; var scope = ScopeEngine.buildScopeFromBizFile(bizFile); scope.billSetting = bizFile; resolve(scope); }); }); }; ScopeEngine.buildScopeFromPath = function (path) { return new Promise(function (resolve, reject) { // @ts-ignore require([path], function (bill) { bill = bill.default; ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) { resolve(scope); }).catch(function (e) { reject(e); }); }); }); }; ScopeEngine.buildScopeFromBizFile = function (bizFile) { var controller = {}; var vjson = { layout: 'fit', title: bizFile.bill.name, items: [] }; var model = {}; if (bizFile.layout.layout === "fit") { vjson.items = bizFile.layout.items; } else if (bizFile.layout.layout === "border") { vjson.items = [bizFile.layout]; } var domainsVjson = {}; _$2.forOwn(bizFile.domains, function (v, k) { var domainVjson = null; var buttons = bizFile.domains[k].buttons; if (bizFile.bill.domains[k].mode === "form") { domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k); if (Array.isArray(buttons) && buttons.length > 0) { if (bizFile.bill.domains[k].type === "header") { vjson.tbar = { xtype: 'toolbar', items: ScopeEngine.buildButton(controller, buttons) }; } else { domainVjson.items.push({ xtype: "cols", items: ScopeEngine.buildButton(controller, buttons) }); } } } else if (bizFile.bill.domains[k].mode === "table") { domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k); if (Array.isArray(buttons) && buttons.length > 0) { if (bizFile.bill.domains[k].type === "header") { vjson.tbar = { xtype: 'toolbar', items: ScopeEngine.buildButton(controller, buttons) }; } else { domainVjson.tbar = { xtype: 'toolbar', items: ScopeEngine.buildButton(controller, buttons) }; } } } if (domainVjson) { domainsVjson[k] = domainVjson; } }); ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson); var scope = new Scope({ model: model, vjson: vjson }); scope['bill_define'] = bizFile; _$2.merge(scope, controller); console.log('bill_define', vjson, scope, scope['bill_define']); return scope; }; ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) { var fieldGroups = {}; for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) { var field = bizFile.domains[domainKey].fields[i]; var item = { sort: field.form_sort }; item.xtype = field.xtype; item.fieldLabel = field.column_desc; item.bind = { value: "{" + domainKey + "." + field.column_name + "}", }; _$2.set(model, "data." + domainKey + "." + field.column_name, null); // if (field.disabled !== "true" && field.disabled !== "false") { // item.bind.disabled = eval(field.disabled) // } else { // item.disabled = (field.disabled === "true") // } // if (field.readonly !== "true" && field.readonly !== "false") { // item.bind.disabled = eval(field.readonly) // } else { // item.readonly = (field.readonly === "true") // } // if (field.required !== "true" && field.required !== "false") { // item.bind.required = eval(field.required) // } else { // item.required = (field.required === "true") // } // if (field.hide !== "true" && field.hide !== "false") { // item.bind.hidden = eval(field.hide) // } else { // item.hidden = (field.hide === "true") // } // item.flex = field. if (field.dict) { item.fix = eval(field.dict); } // _.set(formModel, "", "") item.field = field; if (field.form_group) { if (!fieldGroups.hasOwnProperty(field.form_group)) { fieldGroups[field.form_group] = [item]; } else { fieldGroups[field.form_group].push(item); } } } var formVjson = { xtype: "form", title: bizFile.domains[domainKey].name, items: [] }; _$2.forOwn(fieldGroups, function (fieldGroup, k) { var items = ScopeEngine.buildFieldSet(fieldGroup); if (items) { var fieldsetVjson = { xtype: "fieldset", title: k, items: items }; formVjson.items.push(fieldsetVjson); } }); return formVjson; }; ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) { // const vjson = { xtype: "grid", items: []} var gridVjson = { xtype: "yvgrid", columns: [], split: true, reference: domainKey, listeners: { itemdblclick: function () { }, }, }; for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) { var field = bizFile.domains[domainKey].fields[i]; gridVjson.columns.push({ dataIndex: field.column_name, header: field.column_desc, }); } return gridVjson; }; ScopeEngine.buildFieldSet = function (fieldGroup) { var colGroups = [{ xtype: "cols", items: [] }]; var colGroup = colGroups[0]; _$2.sortBy(fieldGroup, function (item) { return item.sort; }); for (var i = 0; i < fieldGroup.length; i++) { var field = fieldGroup[i]; if (field.field.form_newline === "true") { if (colGroup.items.length > 0) { colGroup = { xtype: "cols", items: [field] }; colGroups.push(colGroup); } } else { colGroup.items.push(field); } delete field.field; } return colGroups; }; ScopeEngine.buildButton = function (controller, buttons) { var buttonsVjson = []; var _loop_1 = function (i) { var item = buttons[i]; var button = { xtype: "button", text: item.btn_name, iconCls: item.icon }; if (item.hidden === "true" || item.hidden === "false") { button.hidden = (item.hidden === "true"); } if (item.listeners) { var listeners_1 = {}; _$2.forOwn(item.listeners, function (v, k) { if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) { listeners_1[k] = v; } else { try { listeners_1[k] = eval(v); } catch (e) { throw e; } } }); button.listeners = listeners_1; } buttonsVjson.push(button); }; for (var i = 0; i < buttons.length; i++) { _loop_1(i); } return buttonsVjson; }; ScopeEngine.buildListeners = function (controller, item) { if (!item.hasOwnProperty("listeners")) { return; } _$2.forOwn(item.listeners, function (v, k) { if (v && typeof v === "string") { if (v.indexOf(".") > -1) { var strArr = v.split("."); if (strArr.length != 2) { console.error(item.listeners, "语法解析错误,请检查!"); } var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1]; switch (funcDomain) { case exports.FuncDomain.SCOPE: controller[k] = findCustFunc(item, k); break; case exports.FuncDomain.SYSTEM: break; default: throw new Error("错误的函数域定义"); } } else { var func = eval(v); if (typeof func === 'function') { controller[k] = func; } throw new Error("解析自定义函数出错"); } } }); var findCustFunc = function (item, funcName) { if (!item.hasOwnProperty("funcs") || !item[funcName]) { throw new Error("没有找到相关的函数定义"); } var func = eval(item[funcName]); if (typeof func === 'function') { return func; } throw new Error("解析自定义函数出错"); }; }; /** * 只检索 items 的模式,深度遍历 vjson */ ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) { if (Array.isArray(vjson)) { for (var i = 0; i < vjson.length; i++) { ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson); } } else { _$2.forOwn(vjson, function (v, k) { if (k !== "domain") { if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") { ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson); } } else { delete vjson.domain; _$2.merge(vjson, domainsVjson[v]); } }); } }; return ScopeEngine; }()); //# sourceMappingURL=ScopeEngine.js.map function initComponent () { var ct = Ext.Component.prototype.constructor; Ext.Component.override({ constructor: function (config) { var _a, _b; if (!isDesignMode(this, config)) { var me_1 = this; // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON _$2.each(baseConfigProcessList, function (process) { process.call(me_1, me_1, config); }); } if (config) { if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) { config.i18nPath = config.$initParent.i18nPath; } if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) { var setTitle_1 = config.$initParent.setTitle; var handel_1 = config.$initParent; config.$initParent.setTitle = function (title) { var t = { title: title }; var WMSTranslate = window["WMSTranslate"]; if (WMSTranslate) { if (typeof window['viewTranslate'] === 'function') { window['viewTranslate'](t, title, "title"); } } setTitle_1.call(handel_1, t.title); }.bind(config.$initParent); } var WMSTranslate = window["WMSTranslate"]; if (WMSTranslate) { if (typeof window['viewTranslate'] === 'function') { window['viewTranslate'](config, config.text, "text"); window['viewTranslate'](config, config.title, "title"); window['viewTranslate'](config, config.header, "header"); window['viewTranslate'](config, config.fieldLabel, "fieldLabel"); window['viewTranslate'](config, config.emptyText, "emptyText"); } } } ct.call(this, config); } }); var _initComponent = Ext.picker.Date.prototype.initComponent; Ext.picker.Date.override({ initComponent: function () { var me = this; me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date()); _initComponent.call(me); }, selectToday: function () { var me = this, btn = me.todayBtn, handler = me.handler; if (btn && !btn.disabled) { me.setValue(Ext.Date.clearTime(syncDate(new Date()))); me.fireEvent('select', me, me.value); if (handler) { Ext.callback(handler, me.scope, [me, me.value], null, me, me); } me.onSelect(); } return me; }, }); } //# sourceMappingURL=component.js.map function initMainTab () { Ext.define('Yvan.MainTab', { extend: 'Ext.tab.Panel', xtype: 'maintab', plugins: Ext.create('Ext.ux.TabCloseMenu', { closeTabText: '关闭', closeOthersTabsText: '关闭其他', closeAllTabsText: '关闭所有' }), constructor: function (config) { var me = this; var newConfig = _$2.defaultsDeep({ // 强制属性 }, config); this.superclass.constructor.call(me, newConfig); }, initComponent: function () { var me = this; this.on({ tabchange: function (tabPanel, newCard, oldCard, eOpts) { _$2.defer(function () { me.changeHash(newCard.id); window['cp'] = newCard.yvanScope; }); $$2(window).trigger('tabChange', { tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts }); }, afterrender: function () { _$2.defer(function () { me.tryRestoryPage(); }); } }); this.superclass.initComponent.call(me); }, tryRestoryPage: function () { var me = this; var hash = '' + window.location.hash; if (hash && hash.indexOf('page=') > 0) { if (hash.startsWith('#')) { hash = hash.substr(1); } if (hash) { var page = Qs.parse(hash).page; if (page) { // this.openScope(page) me.fireEvent('restorypage', page); } } } }, changeHash: function (id) { window.location.hash = Qs.stringify({ page: id }); }, /** * 添加一个业务模块实例到选项卡 * @param scopeInstance 业务对象实例 * @param config ExtJS配置对象 * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工 */ addScope: function (scopeInstance, config, panelInitCallback) { scopeInstance.topScope = scopeInstance; var me = this; if (config.path) { for (var i = 0; i < this.items.items.length; i++) { // 找到当前 tabs 里有没有已经打开过 var tab = this.items.items[i]; if (_$2.isEqual(tab.path, config.path)) { // 激活 this.setActiveTab(tab); return tab; } } } var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config)); if (typeof panelInitCallback === 'function') { panelInitCallback(newPanel); } // 添加业务模块 var newTab = this.add(newPanel); this.setActiveTab(newTab); newTab.on({ destroy: function (sender) { me.changeHash(''); delete window['cp']; } }); return newTab; } }); } //# sourceMappingURL=MainTab.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 (isDesignMode(config, undefined) && dragType) { if (typeof config === 'object') { 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') { _$2.extend(config, { cls: [config.cls, 'yvan_design', cc] }); } else if (_$2.isArray(config.cls)) { _$2.extend(config, { cls: __spread(config.cls, ['yvan_design', cc]) }); } else { _$2.extend(config, { cls: ['yvan_design', cc] }); } } return config; } //# sourceMappingURL=base.js.map function initPanel () { /** * */ var ct = Ext.panel.Panel.prototype.constructor; Ext.panel.Panel.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel); ct.call(this, newConfig); } }); var ss = Ext.form.FieldContainer.prototype; Ext.form.FieldContainer.override({ config: __assign({}, fieldContainer) }); } //# sourceMappingURL=panel.js.map function initGridColumn () { var ct = Ext.grid.column.Column.prototype.constructor; Ext.grid.column.Column.override({ constructor: function (config) { var scope = lookupScope(config.$initParent.$initParent); var newConfig = _$2.defaults({}, config, column); if (typeof newConfig.summaryRenderer === 'string') { newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer); if (typeof newConfig.summaryRenderer === 'function') { newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope); } } if (config.formatter === 'datetime') { newConfig.fix = ['system.formatDate()']; delete newConfig.formatter; } // 在 grid.constructor 已经转换过了 // if (typeof newConfig.renderer === 'string') { // newConfig.renderer = lookupFn(scope, config.renderer) // if (typeof newConfig.renderer === 'function') { // newConfig.renderer = newConfig.renderer.bind(scope) // } // } ct.call(this, newConfig); } }); var ctAction = Ext.grid.column.Action.prototype.constructor; Ext.grid.column.Action.override({ constructor: function (config) { var scope = lookupScope(config.$initParent.$initParent); _$2.forEach(config.items, function (item) { if (typeof item.handler === 'string') { item.handler = lookupFn(scope, item.handler); if (typeof item.handler === 'function') { item.handler = item.handler.bind(scope); } } }); ctAction.call(this, config); } }); var ck = Ext.grid.column.Check.prototype.constructor; Ext.grid.column.Check.override({ constructor: function (config) { _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) { var grid = sender.view.grid.ownerGrid; var column = grid.getColumns()[sender.fullColumnIndex]; var context = { event: e, column: column, field: sender.dataIndex, value: checked, record: record, rowIdx: rowIndex }; grid.fireEvent('editfinish', grid, sender, context, eOpts); }); ck.call(this, config); } }); // 227573 // const {onTitleElClick} = Ext.grid.column.Column.prototype // Ext.define('Yvan.ColumnOverride', { // override: 'Ext.grid.column.Column', // // config: { // enableSortOnClick: false, // }, // // // /**@Overrides*/ // onTitleElClick: function (e, t, sortOnClick) { // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]); // if (!$(e.target).is('.x-column-header-trigger')) { // // 不是点击菜单的情况下,让列自适应宽度 // this.autoSize() // } // return onTitleElClick.call(this, e, t, false) // } // }); } //# sourceMappingURL=gridcolumn.js.map var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i; /** * 判断目标字符串与关键字是否重叠 * @param target 目标字符串 * @param keyword 搜索关键字 */ function pinyinMatch(target, keyword) { if (typeof target != 'string' || typeof keyword != 'string') { return false; } if (!keyword || !target) { return false; } var pyzh = _$2.toLower(window['getFirstPinyin2'](target)); keyword = _$2.toLower(keyword); var pos1 = _$2.toLower(target).indexOf(keyword); if (pos1 >= 0) { return true; } var len = _$2.intersection(keyword.split('')).length; if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) { return true; } return false; } /** * 对某个表达式进行求值 * a:{query.a},b:{query.b} -> a:aValue,b:bValue * * @example * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}") * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001" * * @param data 数据环境对象 * @param express 表达式对象 */ function calcExpress(data, express) { var result = express; if (SIMPLE_RE.test(express)) { // '{foo}' 简单表达式 var path = express.substring(1, express.length - 1); var ret = _$2.get(data, path); return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret; } while (true) { var mlist = result.match(/{(.*?)}/); if (!mlist) { break; } var pathC = mlist[0]; // {query.a} var path = mlist[1]; // query.a var value = _$2.get(data, path); result = result.replaceAll(pathC, value || ''); } return result; } /** * 对个对象进行表达式求值,不用回调 * @example * calcObjectFlat({query:{a:'aValue',b1:'b1Value',b2:'b2Value',d1:1,d2:2}}, { a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}'] }) * * { * a: '{query.a}', * b: { * b1: '{query.b1}', * b2: '{query.b2}', * }, * c: 'aa', * d: [ * '{query.d1}', * '{query.d2}' * ] * } * * 计算结果为 * { * a: 'aValue', * b: { * b1: 'b1Value', * b2: 'b2Value' * }, * c: 'aa' * d: [ * '1', * '2' * ] * } * * @param data * @param paramObject */ function calcObjectFlat(data, paramObject) { var result = _$2.cloneDeep(paramObject); if (typeof paramObject === 'string') { return calcExpress(data, paramObject); } var trav = function (param) { _$2.forOwn(param, function (value, key) { if (_$2.isPlainObject(value)) { // 深度递归,对子对象进行求解 trav(value); } else if (_$2.isString(value)) { // 字符串直接用 calcExpress 表达式求解 param[key] = calcExpress(data, param[key]); } else if (_$2.isArray(value)) { // 数组求解 _$2.each(value, function (v, idx) { value[idx] = calcExpress(data, v); }); } }); }; trav(result); return result; } /** * 合併 data 到當前的 ViewModel 對象 */ function mergeViewModel(viewModel, propertyName, data, isFlat) { var newRow = {}; if (isFlat == false) { newRow = data; } else { flatObject(newRow, '', data); } if (!propertyName) { _$2.forOwn(newRow, function (value, key) { viewModel.set(key, value); }); } else { _$2.forOwn(newRow, function (value, key) { viewModel.set(propertyName + "." + key, value); }); } } /** * 转换内联结构的行,到平面结构 * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' } * * @param array * @param flatOption * @return {[]} */ function flatRow(array) { var ret = []; _$2.forEach(array, function (row) { var newRow = {}; flatObject(newRow, '', row); ret.push(newRow); }); return ret; } function flatObject(parentObj, parentProp, obj) { _$2.forOwn(obj, function (value, key) { var fullKey = parentProp ? parentProp + '_' + key : key; if (_$2.isArray(value)) { parentObj[fullKey] = _$2.map(value, function (row) { var newRow = {}; flatObject(newRow, '', row); return newRow; }); } else { if (typeof value === 'object') { flatObject(parentObj, fullKey, value); } else { parentObj[fullKey] = value; } } }); } /** * 替换内部结构中,所有 N/A */ function replaceNA(obj) { if (obj === 'N/A') { return ''; } if (_$2.isArray(obj)) { _$2.forEach(obj, function (value, idx) { if (value === 'N/A') { obj[idx] = ''; } else { replaceNA(value); } }); } else if (_$2.isPlainObject(obj)) { _$2.forOwn(obj, function (value, key) { if (value === 'N/A') { obj[key] = ''; } else { replaceNA(value); } }); } } function deepTravJson(obj, resolver) { if (_$2.isArray(obj)) { _$2.forEach(obj, function (value, idx) { if (typeof value === 'string') { resolver(obj, value, idx); } else { deepTravJson(value, resolver); } }); } else if (_$2.isPlainObject(obj)) { _$2.forOwn(obj, function (value, key) { if (typeof value === 'string') { resolver(obj, value, key); } else { deepTravJson(value, resolver); } }); } } /** * 根据表达式进入写值 * express="{query.a}" 写值就是 viewModel.set('query.a', value) * express="test-{query.a}" 写值就会失败 * * @example * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111") * 写值成功 * * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111") * 写值失败 * * @param viewModel VM对象 * @param express 表达式对象 * @param value 目标值 */ function tryWriteByExpress(viewModel, express, value) { if (SIMPLE_RE.test(express)) { // '{foo}' 简单表达式 express = express.substring(1, express.length - 1); viewModel.set(express, value); } } /** * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法 * @example * tryWriteObject({ a:'{query.a}', b:{b1:'{query.b1}', b2:'{query.b2}'},c:'aa',d:['{query.d1}','{query.d2}']}, {a:'aValue', b:{b1:'b1Value', b2:'b2Value'}, c:'aa', d:[1,2]}) * * expressObject: * { * a: '{query.a}', * b: { * b1: '{query.b1}', * b2: '{query.b2}', * }, * c: 'aa', * d: [ * '{query.a}', * '{query.b2}' * ] * } * * valueObject: * { * a: 'aValue', * b: { * b1: 'b1Value', * b2: 'b2Value' * }, * c: 'aa' * c: [ * 'aValue', * 'b2Value' * ] * } * * 系统会尝试回写 * viewModel.set('query.a', 'aValue') * viewModel.set('query.b1', 'b1Value') * viewModel.set('query.b2', 'b2Value') * * @param expressObject 含表达式的对象 * @param valueObject 表达式计算完成之后的结果对象 * @param writeFn 写入的方法 (path, value)=>void */ function tryWriteObject(expressObject, valueObject, writeFn) { var trav = function (pathPrefix) { var parent = expressObject; if (_$2.size(pathPrefix) > 1) { parent = _$2.get(parent, pathPrefix.substring(1)); } _$2.forOwn(parent, function (value, key) { if (_$2.isPlainObject(value)) { // 深度递归,对子对象进行求解 trav(pathPrefix + "." + key); } else if (_$2.isString(value)) { // 字符串直接用 calcExpress 表达式求解 if (SIMPLE_RE.test(value)) { // If we have '{foo}' alone it is a literal 简单表达式 var targetPath = value.substring(1, value.length - 1); var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1)); if (!writeFn) { console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')"); } else { writeFn(targetPath, targetValue); } } } else if (_$2.isArray(value)) { _$2.each(value, function (v, idx) { if (SIMPLE_RE.test(v)) { var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]"; var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]"); if (!writeFn) { console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')"); } else { writeFn(targetPath, targetValue); } } }); } }); }; trav(""); } /** * 尝试去掉变量两边括号 * {a} => a * a => a */ function tryVarSimple(value) { if (SIMPLE_RE.test(value)) { // If we have '{foo}' alone it is a literal 简单表达式 return value.substring(1, value.length - 1); } return value; } /** * 对多个表达式进行求值. 异步回调的方式返回 * { * a: 1, * b: '{someBind}', * c: ['a', 'b', 'c'], * d: ['a', 'b', '{someBind}'], * e: { * y: 1, * z: 2 * }, * f: { * y: 1, * z: '{someBind}' * } * } * * // Will produce * { * b: value, * d: ['a', 'b', value], * f: { * y: 1, * z: value * } * } * @param viewModel scope.viewModel对象 * @param paramObject 求值对象 */ function calcObject(viewModel, paramObject) { // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true}) return new Promise(function (resolve) { var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) { schedule.destroy(); // 从 Ext.data.Model 对象转换为 js-object 对象 ret = toPlainObject(ret); resolve(ret); }, viewModel, { single: true }); }); } /** * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined) * @param config 组件构造函数传入的 config 配置文件 */ function getParentGrid(config) { var _a; return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid; } /** * 解析 * { * condition: "{skuId}", * errorMsg: "无法编辑", * notice: 'msg' * } */ function tryEnable(data, enableSetting) { if (!enableSetting) { // 没有这一段配置,可以编辑 return true; } var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice; if (!evalFunction(data, condition)) { // 没有达成 condition 条件 // 计算 msg 消息内容 var msgContent = calcExpress(data, errorMsg); if (msgContent) { if (!notice || notice === 'msg') { // 进行提示 msg$1(msgContent); } } return false; } return true; } /** * 动态的为 combo 或 columns.combo 设置下拉框的值 * @param sender 目标对象 * @param config 目标对象的配置(在构造函数之前也可以) * @param getDictFn 获取字典的方法 * @param bizKey 传入字典的参数 * @param multiValueSeparator 多个字典值的分割符号 */ function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) { if (multiValueSeparator === void 0) { multiValueSeparator = ""; } // sender 和 config为空的时候获取值、 if (_$2.isArray(getDictFn)) { // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法 var realArray_1 = getDictFn; getDictFn = function () { return realArray_1; }; } if (!sender) { return new Promise(function (resolve, reject) { getDictFn(bizKey, function (r) { resolve({ config: config, r: r }); }); }); } if (sender.xtype === 'combotree') { getDictFn(bizKey, function (r) { if (sender.store) { // 异步回传 sender.setStore(new Ext.data.TreeStore({ root: r })); } else { // 同步回传 config.store = new Ext.data.TreeStore({ root: r }); } }); return; } else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') { getDictFn(bizKey, function (r) { var _a, _b; if (sender.store) { // 异步回传 sender.setStore(new Ext.data.Store(r)); // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下 // 否则在 forceSelection 的模式下。displayField 不会强制做变更 var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue(); if (typeof realValue !== 'undefined') { sender.setValue(realValue); } } else { // 同步回传 config.store = new Ext.data.Store(r); } }); return; } else if (sender.xtype === 'gridcolumn') { var grid = getParentGrid(config); var editor_1 = config.editor, renderer = config.renderer; getDictFn(bizKey, function (r) { if (sender.store) { // 已经渲染出来了, 用方法进行修改 var editor_2 = sender.getEditor(); if (editor_2 && editor_2.xtype === 'combo') { var valueField_1 = r.field[0]; var displayField_1 = r.field[1]; editor_2.valueField = valueField_1; editor_2.setDisplayField(displayField_1); editor_2.setStore(new Ext.data.Store(r)); } console.log('setFilter', sender, r.data); if (!sender.disableListFilter) { sender.setFilter({ type: 'list', options: _$2.map(r.data, function (r) { return ({ id: '' + r.id, text: r.text, }); }) }); } } else { // 没有渲染之前,修改 config 即可 if (editor_1 && editor_1.xtype === 'combo') { // 带编辑模式 editor_1.store = new Ext.data.Store(r); } console.log('setFilter', sender, r.data); if (!sender.disableListFilter) { config.filter = { type: 'list', options: _$2.map(r.data, function (r) { return ({ id: '' + r.id, text: r.text, }); }) }; } } // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值) var renderer = function (value, metaData) { if (metaData === void 0) { metaData = false; } if (!value && value != 0) { return ''; } var valueField = r.field[metaData === true ? 1 : 0]; var displayField = r.field[metaData === true ? 0 : 1]; var separator = multiValueSeparator; if (separator) { var arr = value.split(separator); var displayValue_1 = ""; var _loop_1 = function (i) { var itv = arr[i]; if (i > 0) { displayValue_1 += separator; } _$2.each(r.data, function (row) { // 从 valueField 找到要显示的 displayField if (row[valueField] == itv) { displayValue_1 += row[displayField]; return false; } else { if (i >= r.data.length - 1) { displayValue_1 += itv; } } }); }; for (var i = 0; i < arr.length; i++) { _loop_1(i); } return displayValue_1; } _$2.each(r.data, function (row) { // 从 valueField 找到要显示的 displayField if (row[valueField] == value) { value = row[displayField]; return false; } }); return value; }; var dictForExcel = {}; var valueField = r.field[0]; var displayField = r.field[1]; _$2.each(r.data, function (row) { // 从 valueField 找到要显示的 displayField var key = row[valueField]; if (key != '' && typeof key != "undefined" && key != null) { dictForExcel[key] = row[displayField]; } }); if (sender.rendered) { // 已经渲染出来了, 对列进行渲染 sender.renderer = renderer; sender.dictForExcel = dictForExcel; sender.getView().refresh(); } else { sender.renderer = renderer; sender.dictForExcel = dictForExcel; config.renderer = renderer; config.dictForExcel = dictForExcel; } }); return; } throw new TypeError("无法识别的组件类型"); } /** * 调用服务器 Ajax */ function invokeServer$1(url) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } // @ts-ignore return ajax.func({ url: url, method: 'invoke', args: args }); } function clearViewModelValues(viewModel, propertyName) { if (!propertyName) { var dd_1 = viewModel.getData(); _$2.forOwn(dd_1, function (value, key) { viewModel.set(key, ''); }); return; } var dd = _$2.get(viewModel.getData(), propertyName); _$2.forOwn(dd, function (value, key) { viewModel.set(propertyName + '.' + key, ''); }); } function reloadGrid(scope, gridRefName) { var _a; (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload(); } /** * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象 */ function toPlainObject(obj) { if (obj.isModel) { obj = obj.data; } _$2.forOwn(obj, function (v, k) { // Ext.data.Model.constructor if (!v) { return; } if (v.isModel) { v = v.data; } if (typeof v === 'object') { obj[k] = toPlainObject(v); } else { obj[k] = v; } }); return obj; } function confirm(msg, sender) { return new Promise(function (resolve) { var _a, _b; var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope; var t = { msg: msg }; var WMSTranslate = window["WMSTranslate"]; if (WMSTranslate) { if (typeof window['viewTranslate'] === 'function') { window['viewTranslate'](t, msg, "msg"); } } var config = { title: '请确认', modal: true, animateTarget: sender, // resizable: false, // constrainHeader: true, // constrain: true, // constrainTo: scope._handle?.el?.dom || Ext.getBody(), layout: { type: 'hbox', pack: 'start', align: 'stretch' }, items: [ { html: '', border: false, }, { flex: 1, border: false, html: "
" + _$2.escape(t.msg) + "
" } ], buttons: [ { xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle', handler: function () { resolve(); win.close(); } }, { xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off', handler: function () { win.close(); } } ], keyMapEnabled: true, keyMap: { ENTER: function () { resolve(); win.close(); } } }; if (scope === null || scope === void 0 ? void 0 : scope._handle) { config.constrain = true; } var win = new Ext.Window(config); if (scope === null || scope === void 0 ? void 0 : scope._handle) { (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win); } win.show(); }); } /** * 任何符号字符串都替换成下换线 */ function normId(value) { return _$2.replace(value, /[^\w]/g, '_'); } /** * * @param sender * @param propertyName * @param gridRefName */ function clearViewModelReloadGrid(sender, propertyName, gridRefName) { var _a, _b; var scope = lookupScope(sender); clearViewModelValues(scope.viewModel, propertyName); if (!gridRefName) { (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload(); } else { (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload(); } } var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) { if ([10, 13, 20, 40].includes(event.keyCode)) { // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值 var value = _$2.trim(sender.rawValue); raiseClick(eOpts.handle); } }, 150); function saveGridRow(grid1) { var _a; var config = grid1.config; var scope = lookupScope(grid1); var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {}; saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues); // "表格保存"的相关配置 var dbSaveConfig = { columns: [], dbTableName: _$2.get(config, 'behavior.dbTableName'), saveRowValues: saveRowValues, path: scope.originalVjson.__custom_path, }; var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err; if (err) { // 如果有异常就不保存 return; } // 构建"表格保存"的相关配置 for (var i = 0; i < config.columns.length; i++) { var c = config.columns[i]; var v = { dataIndex: c.dataIndex, header: c.header, dbColumn: c.dbColumn, serverCreateValue: c.serverCreateValue, dbIsDeleteKey: c.dbIsDeleteKey, dbIsUpdateKey: c.dbIsUpdateKey, dbUpdateEnable: c.dbUpdateEnable, serverValueConvert: c.dbUpdateEnable, }; if (c.editor) { v.editor = { xtype: c.editor.xtype, required: c.editor.required, }; } dbSaveConfig.columns.push(v); } // 进行业务上的逻辑校验 var hasError = false; _$2.forEach(rows, function (row, i) { for (var i_1 = 0; i_1 < config.columns.length; i_1++) { var c = config.columns[i_1]; var value = row[c.dataIndex]; if (_$2.get(c, 'editor.required') === true && isEmpty(value)) { msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!"); hasError = true; return false; } if (c.xtype === 'checkcolumn') { if (value === false && typeof c.uncheckedValue !== 'undefined') { row[c.dataIndex] = c.uncheckedValue; } if (value === true && typeof c.checkedValue !== 'undefined') { row[c.dataIndex] = c.checkedValue; } } } }); if (hasError) { return; } // 设置当前界面为 "保存中..." 状态 grid1.setLoading(true); invokeServer$1('/Dev@batchSave', { newRows: newRows, modifyRows: modifyRows, removeRecords: removeRecords, config: dbSaveConfig, }).then(function (res) { // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置) msg$1(res.msg); grid1.reload(); }).catch(function (e) { console.error(e); showErrorDialog$1(_$2.toString(e)); }).finally(function () { // 无论正常异常,关闭 "保存中..." 状态 grid1.setLoading(false); }); } function insertGridRow(grid1) { var config = grid1.config; var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert'); var insertRow = {}; _$2.forEach(config.columns, function (c) { var fn = c.createValue; if (_$2.startsWith(fn, 'scope.') || _$2.startsWith(fn, 'system.')) { var scope = lookupScope(grid1); var fn2 = lookupFn(scope, fn, c); if (_$2.isFunction(fn2)) { var newValue = fn2(); if (!_$2.isUndefined(newValue)) { insertRow[c.dataIndex] = newValue; } } } else if (_$2.isString(fn) && fn) { insertRow[c.dataIndex] = fn; } }); grid1.appendEditRow(insertRow, focusColumnAfterInsert); } function commitMe(sender) { var window = sender.up('window'); var scope = lookupScope(sender); if (typeof scope['commit'] === 'function') { scope['commit']().then(function (res) { window.close(); }); } } function removeGridRow(grid1) { var _a; var config = grid1.config; var rows = []; if (grid1.selModel.selType === "rowmodel") { rows.push(grid1.selection); } else { (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) { rows.push(r); }); } if (rows.length > 1) { var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm'); if (_$2.isUndefined(batchRemoveConfirm)) { //不需要提示 _$2.forEach(rows, function (r) { grid1.getStore().remove(r); }); } else { var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length); confirm(tip).then(function () { _$2.forEach(rows, function (r) { grid1.getStore().remove(r); }); }); } } else if (rows.length === 1) { var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm'); if (_$2.isUndefined(singleRemoveConfirm)) { //不需要提示 grid1.getStore().remove(rows[0]); } else { var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length); _$2.forEach(config.columns, function (c) { tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex)); }); confirm(tip_1).then(function () { grid1.getStore().remove(rows[0]); }); } } else { msg$1('请选择要删除的数据!'); } } function moveUpGridRow(grid) { grid.rowMoveUp(); } function moveDownGridRow(grid) { grid.rowMoveDown(); } var SystemEventFu = /** @class */ (function () { function SystemEventFu() { } SystemEventFu.prototype.moveUpGridRow = function () { return function (sender) { var grid1 = sender.up('yvgrid'); moveUpGridRow(grid1); }; }; SystemEventFu.prototype.commitMe = function () { return function (sender) { commitMe(sender); }; }; SystemEventFu.prototype.moveDownGridRow = function () { return function (sender) { var grid1 = sender.up('yvgrid'); moveDownGridRow(grid1); }; }; SystemEventFu.prototype.saveGridRow = function () { return function (sender) { var grid1 = sender.up('yvgrid'); saveGridRow(grid1); }; }; SystemEventFu.prototype.insertGridRow = function () { return function (sender) { var grid1 = sender.up('yvgrid'); insertGridRow(grid1); }; }; SystemEventFu.prototype.removeGridRow = function () { return function (sender) { var grid1 = sender.up('yvgrid'); removeGridRow(grid1); }; }; SystemEventFu.prototype.enterToClick = function (btnReferenceName) { return function (sender, config) { if (!config.listeners) { config.listeners = {}; } config.listeners.afterrender = function (sender) { var scope = lookupScope(sender); // $(sender.el.dom).on('keydown', (e) => { // const xtype = Ext.fly(e.target).component.xtype // if (xtype === 'textfield' && e.keyCode === 13) { // Ext.defer(() => { // raiseClick(scope.refs[btnReferenceName]) // }) // e.preventDefault() // e.stopPropagation() // return false // } // }) $(sender.el.dom).on('keyup', function (e) { var tt = Ext.fly(e.target).component; var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype; if ((xtype !== 'textfield' && xtype !== 'numberfield') || ![10, 13, 20, 40].includes(e.keyCode)) { return; } e.preventDefault(); e.stopPropagation(); keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] }); return; }); }; }; }; SystemEventFu.prototype.confirm = function (text, fn) { return function (sender) { var scope = lookupScope(sender); var msg = calcExpress(scope.viewModel.data, text); confirm(msg, sender).then(function () { fn.call(scope, sender); }); }; }; SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) { return function (sender) { var scope = lookupScope(sender); var grid = scope.refs[gridRefName]; if (grid) { var records = grid.getSelectionModel().getLastSelected(); grid.store.remove(records); } }; }; SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam, //可以是 scope.XX / system.XX / string / lookup表达式 writeTarget) { return function (sender) { if (!invokeUrl) { return; } var scope = lookupScope(sender); scope.setLoading(true); var data = scope.viewModel.data; if (invokeParam) { data = calcObjectFlat(data, invokeParam); } invokeServer$1(invokeUrl, data).then(function (res) { if (res.success) { if (typeof writeTarget === "string") { _$2.forOwn(res.data, function (v, k) { scope.viewModel.set(writeTarget + "." + k, v); }); } else if (typeof writeTarget === 'function') { writeTarget.call(scope, res.data); } else if (typeof writeTarget === 'object') { var ret = calcObjectFlat(res.data, writeTarget); _$2.forOwn(ret, function (v, k) { scope.viewModel.set(k, v); }); } } else { showErrorDialog$1(res.msg || '未知错误', sender); } }).catch(function (e) { var _a, _b; var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg; showErrorDialog$1(msg || e.toString(), sender); }).finally(function () { scope.setLoading(false); }); }; }; SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) { return function (sender) { var scope = lookupScope(sender); scope.setLoading(true); var data = scope.viewModel.data; if (arg0) { data = calcObjectFlat(data, arg0); } invokeServer$1(groovyUrl, data).then(function (res) { if (res.success) { if (res.msg) { msg(res.msg); } if (typeof successCallback === 'function') { successCallback.call(scope, sender, res.data); } } else { showErrorDialog$1(res.msg || '未知错误', sender); } }).catch(function (e) { var _a, _b; var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg; showErrorDialog$1(msg || e.toString(), sender); }).finally(function () { scope.setLoading(false); }); }; }; SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) { return function (sender) { var scope = lookupScope(sender); var form = scope.down('form'); if (form) { // 如果下级有表单,就做表单校验 var valid = form.isValid(); if (!valid) { return; } } scope.setLoading(true); var data = scope.viewModel.data; if (arg0) { data = calcObjectFlat(data, arg0); } invokeServer$1(groovyUrl, data).then(function (res) { if (res.success) { if (res.msg) { msg(res.msg); } scope.dialogSuccess(res); } else { showErrorDialog$1(res.msg || '未知错误', sender); } }).catch(function (e) { var _a, _b; var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg; showErrorDialog$1(msg || e.toString(), sender); }).finally(function () { scope.setLoading(false); }); }; }; SystemEventFu.prototype.dialogSuccess = function (lookupObject) { return function (sender) { var scope = lookupScope(sender); if (lookupObject) { scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject)); } else { scope.dialogSuccess(); } }; }; SystemEventFu.prototype.clearViewModelValues = function (propertyName) { return function (sender) { var scope = lookupScope(sender); clearViewModelValues(scope.viewModel, propertyName); }; }; SystemEventFu.prototype.getGrid = function (url) { return function (sender, config) { if (config.xtype == "combogridmulti") { // @ts-ignore require([url], function (grid) { _$2.forOwn(grid.default, function (v, k) { sender[k] = v; sender.config[k] = v; if (sender.rendered) { // 已经渲染出来了,重新调用 reload 强制刷新 sender.reload(); } }); }); } else { // @ts-ignore require([url], function (grid) { sender.grid = grid.default; config.grid = grid.default; }); } }; }; SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) { return function (sender) { clearViewModelReloadGrid(sender, propertyName, gridRefName); }; }; SystemEventFu.prototype.reloadGrid = function (gridRefName) { return function (sender) { var _a, _b; var scope = lookupScope(sender); if (!gridRefName) { (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload(); } else { (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload(); } }; }; SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) { return function (sender) { var scope = lookupScope(sender); var data = scope.viewModel.data; var param = calcObjectFlat(data, lookupForData); // @ts-ignore require([url], function (module) { var ScopeClass = module.default; var scope = new ScopeClass(); scope.success = successCallback; scope.showDialog(sender, {}, { data: param }); }); }; }; SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) { return function (sender, queryValue) { showWidget(widgetUrl, lookup, sender, queryValue); }; }; SystemEventFu.prototype.clearViewModelByLookup = function (lookup) { return function (sender) { clearViewModelByLookup(sender, lookup); }; }; SystemEventFu.prototype.closeMe = function (callBack) { return function (sender) { var scope = lookupScope(sender); scope.close(); if (callBack) { callBack.call(sender); } }; }; // 未完成 SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) { return function (sender) { var scope = lookupScope(sender); var data = scope.viewModel.data; var billSetting = scope.billSetting; var param = calcObjectFlat(data, lookupForData); return new Promise(function (resolve, reject) { var sf = function (scope) { scope.success = function (dlgScope, dlgSender, reData) { }; scope.showDialog(sender, {}, { data: param }); }; // @ts-ignore require([url], function (module) { // 业务描述文件 if (url.endsWith(".bill")) { ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) { sf(scope); }); } else { //原生yvanui文件 var ScopeClass = module.default; var scope_1 = new ScopeClass(); sf(scope_1); } }); }); }; }; __decorate([ Lib({ title: '为某个表格,上移行', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "moveUpGridRow", null); __decorate([ Lib({ title: '为某个表格,上移行', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "commitMe", null); __decorate([ Lib({ title: '为某个表格,下移行', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "moveDownGridRow", null); __decorate([ Lib({ title: '为某个表格,批量保存至数据库', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "saveGridRow", null); __decorate([ Lib({ title: '为某个表格插入数据行', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "insertGridRow", null); __decorate([ Lib({ title: '为某个表格删除所选数据行', author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "removeGridRow", null); __decorate([ Lib({ title: '按下回车键之后默认是否按下某个按钮', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '字典', }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "enterToClick", null); __decorate([ Lib({ title: '弹出确认对话框,回答 YES 之后调用某方法', author: '罗一帆', createAt: '2021-07-06', updateAt: '2021-07-06', type: 'system', category: '对话框', }), __param(0, LibParam('对话框的确认文字', 'string')), __param(1, LibParam('确认之后的调用的方法', 'event')), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "confirm", null); __decorate([ Lib({ title: '删除表格当前的选中行(前端删除)', author: '罗一帆', createAt: '2021-07-08', updateAt: '2021-07-08', type: 'system', category: '表格', }), __param(0, LibParam('表格引用名', 'refs')), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "gridRemoveCurrentRow", null); __decorate([ Lib({ title: '查询表单,如果 url 为空值,就取消查询', author: '罗一帆', createAt: '2021-07-06', updateAt: '2021-07-06', type: 'system', category: '表单', }), __param(0, LibParam('后端服务路径', 'string')), __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)), __param(2, LibParam('提交成功后的回调', 'viewModel', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "loadForm", null); __decorate([ Lib({ title: '提交(不做校验、不关闭窗体)', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('后端服务路径', 'string')), __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)), __param(2, LibParam('提交成功后的回调', 'event', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "commit", null); __decorate([ Lib({ title: '提交表单', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('后端服务路径', 'string')), __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "formCommit", null); __decorate([ Lib({ title: '对话框成功回调', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '对话框', }), __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "dialogSuccess", null); __decorate([ Lib({ title: '清空 viewModel 某个属性', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('属性路径', 'viewModel', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "clearViewModelValues", null); __decorate([ Lib({ title: '从其他资源获取表格设置', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('定义文件', 'module')), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "getGrid", null); __decorate([ Lib({ title: '清空 viewModel 某个属性,并刷新表格', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('清空的属性', 'viewModel')), __param(1, LibParam('要刷新的表格', 'refs', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "clearViewModelReloadGrid", null); __decorate([ Lib({ title: '刷新表格', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '表单', }), __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "reloadGrid", null); __decorate([ Lib({ title: '显示对话框', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '对话框', }), __param(0, LibParam('业务模块名', 'module')), __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)), __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "showDialog", null); __decorate([ Lib({ title: '弹出查找框(不借助 search)', author: '罗一帆', createAt: '2021-07-02', updateAt: '2021-07-02', type: 'system', category: '对话框', }), __param(0, LibParam('模块名 (WidgetDialog)', 'module')), __param(1, LibParam('lookup 映射关系', 'lookup', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "showWidget", null); __decorate([ Lib({ title: '根据 lookup 清空 viewModel', author: '罗一帆', createAt: '2021-07-05', updateAt: '2021-07-05', type: 'system', category: '表单', }), __param(0, LibParam('设值表达式', 'lookup')), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "clearViewModelByLookup", null); __decorate([ Lib({ title: '关闭对话框', author: '罗一帆', createAt: '2021-07-05', updateAt: '2021-07-05', type: 'system', category: '对话框', }), __param(0, LibParam('对话框的返回值回调', 'event', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "closeMe", null); __decorate([ Lib({ title: '打开对话框并返回数据', author: '余亮', createAt: '2022-07-07', updateAt: '2022-07-07', type: 'system', category: '对话框', }), __param(0, LibParam('业务模块名', 'module')), __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)), __param(2, LibParam('结果映射关系', 'string', true)), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Object]), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "showDialogAndFillData", null); return SystemEventFu; }()); /** * 清空 viewmodel 里下属的所有属性 * @param viewModel VM对象 * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式 * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"] */ function clearViewModel(viewModel, propertyKey, ignoreProps) { var data = viewModel.data; if (propertyKey) { data = _$2.get(data, propertyKey); } _$2.forOwn(data, function (value, key) { var targetKey = propertyKey ? propertyKey + "." + key : key; if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) { return; } viewModel.set(targetKey, ''); }); } function clearViewModelByLookup(sender, lookup) { if (_$2.isPlainObject(lookup)) { var parentScope_1 = lookupScope(sender); _$2.forOwn(lookup, function (value, key) { if (SIMPLE_RE.test(value)) { // '{foo}' 简单表达式 var path = value.substring(1, value.length - 1); if (path !== 'queryValue') { parentScope_1.viewModel.set(path, ''); } } }); } } function showWidget(widgetUrl, lookup, sender, queryValue, vjson) { if (vjson === void 0) { vjson = {}; } var parentScope = lookupScope(sender); var me = sender; // @ts-ignore require([widgetUrl], function (widgetScope) { var WidgetScopeClass = widgetScope.default; widgetScope = new WidgetScopeClass(); // 传递进 widget.model 的数据 var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup); widgetScope.parentScope = parentScope; widgetScope.searchWidgetSuccess = function (data) { if (typeof lookup === 'string') { // lookup 是字符串的情况下,就是取某个列作为 value 值 me.setValue(data[lookup]); return; } /** * lookup: { * // 扩展到 viewModel 的值做更改 * WH_CODE: "{queryValue}", * WH_NAME: "{query.WH_NAME}", * } */ if (_$2.isPlainObject(lookup)) { var parentScope_2 = lookupScope(sender); tryWriteObject(lookup, data, function (path, value) { if (path === 'queryValue') { me.setValue(value); } else { parentScope_2.viewModel.set(path, value); } }); } return true; }; widgetScope.showDialog(sender, vjson, { data: widgetDialogData }); }); } /** * 停止事件的默认行为 * @param e */ function stopEvent(e) { e.preventDefault(); e.stopPropagation(); // @ts-ignore window.event.cancelBubble = true; e.returnValue = false; e.cancelBubble = true; } /** * 屏幕中央显示一个黑框提示 */ function msg$1(content) { msg(content); } /** * 错误对话框的强提醒 */ function showErrorDialog$1(msg, sender) { showErrorDialog(msg, sender); } /** * 错误对话框的强提醒 */ function showInfoDialog(msg, sender) { showInfoDialogSimple(msg, sender); } /** * 错误对话框的强提醒 */ function prompt$2(message, defaultValue, multiLine) { if (defaultValue === void 0) { defaultValue = ""; } if (multiLine === void 0) { multiLine = false; } return prompt$1(message, defaultValue, multiLine); } /** * 用于计算 express 表达式 */ function evalFunction(data, express) { var keys = []; var values = []; _$2.forOwn(data, function (value, key) { var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i); if (match) { key = key.substring(0, match.index); } keys.push(key); values.push(value); }); var func = Function.apply(void 0, __spread(keys, ['return ' + express])); try { return func.apply(void 0, __spread(values)); } catch (e) { return; } } /** * 获取表格编辑的行数据 */ function getGridEditRows(grid) { return grid.getGridEditRows(); } var SystemLib = /*#__PURE__*/Object.freeze({ __proto__: null, SIMPLE_RE: SIMPLE_RE, pinyinMatch: pinyinMatch, calcExpress: calcExpress, calcObjectFlat: calcObjectFlat, mergeViewModel: mergeViewModel, flatRow: flatRow, replaceNA: replaceNA, deepTravJson: deepTravJson, tryWriteByExpress: tryWriteByExpress, tryWriteObject: tryWriteObject, tryVarSimple: tryVarSimple, calcObject: calcObject, getParentGrid: getParentGrid, tryEnable: tryEnable, setComboStore: setComboStore, invokeServer: invokeServer$1, clearViewModelValues: clearViewModelValues, reloadGrid: reloadGrid, toPlainObject: toPlainObject, confirm: confirm, normId: normId, clearViewModelReloadGrid: clearViewModelReloadGrid, saveGridRow: saveGridRow, insertGridRow: insertGridRow, commitMe: commitMe, removeGridRow: removeGridRow, moveUpGridRow: moveUpGridRow, moveDownGridRow: moveDownGridRow, SystemEventFu: SystemEventFu, clearViewModel: clearViewModel, clearViewModelByLookup: clearViewModelByLookup, showWidget: showWidget, stopEvent: stopEvent, msg: msg$1, showErrorDialog: showErrorDialog$1, showInfoDialog: showInfoDialog, prompt: prompt$2, evalFunction: evalFunction, getGridEditRows: getGridEditRows }); function initTree () { Ext.define('Yvan.Tree', { extend: 'Ext.tree.Panel', alias: 'widget.yvtree', xtype: 'yvtree', constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制性属性 }, baseConfig(config, 'row-item'), config, tree); _$2.assign(newConfig, { tbar: [ { xtype: 'textfield', // triggerCls: 'x-form-clear-trigger', flex: 1, emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: function (sender) { var tree = sender.up("treepanel"); tree.filterByText(this.getRawValue()); }, keyup: function (sender, e) { var tree = sender.up("treepanel"); if (e.ESC === e.getKey()) { sender.setValue(''); tree.filterByText(''); } } } }, ], }); if (!newConfig.hideRefresh) { newConfig.tbar.push({ xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新', listeners: { click: function (sender) { var scope = sender.up("yvtree"); scope.reload(); } } }); } if (!newConfig.hideExpand) { newConfig.tbar.push({ xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开', listeners: { click: function (sender) { var scope = sender.up("yvtree"); scope.expandAll(); } } }); } if (!newConfig.hideCollapse) { newConfig.tbar.push({ xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起', listeners: { click: function (sender) { var scope = sender.up("yvtree"); scope.collapseAll(); } } }); } this.superclass.constructor.call(this, newConfig); }, /** * 在根节点上增加一个节点,会触发 addNode 事件 * @param props */ addRoot: function (props) { var me = this; var tableNode = me.getRootNode(); var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({})); if (_$2.isFunction(props)) { props = props.call(this, parent); } _$2.forOwn(props, function (value, key) { fieldNode.set(key, value); }); var node = tableNode.appendChild(fieldNode); me.ensureVisible(node); me.setSelection(node); me.fireEvent('addNode', me, { parent: tableNode, node: node, }); }, addLast: function (props) { var me = this; var sel = me.selModel.getSelection(); if (!sel || sel.length <= 0) { msg('请选择一个要添加的同级节点路径'); return; } var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode(); var fieldNode = parent.createNode(new Ext.data.NodeInterface({})); if (_$2.isFunction(props)) { props = props.call(this, parent); } _$2.forOwn(props, function (value, key) { fieldNode.set(key, value); }); var node = parent.appendChild(fieldNode); me.ensureVisible(node); me.setSelection(node); me.fireEvent('addNode', me, { parent: parent, node: node, }); }, addChildren: function (props) { var me = this; var sel = me.selModel.getSelection(); if (!sel || sel.length <= 0) { msg('请选择一个要添加子节点的路径'); return; } var parent = sel[0]; if (_$2.isFunction(props)) { props = props.call(this, parent); } var fieldNode = parent.createNode(new Ext.data.NodeInterface({})); _$2.forOwn(props, function (value, key) { fieldNode.set(key, value); }); var node = parent.appendChild(fieldNode); parent.expand(); me.ensureVisible(node); me.setSelection(node); me.fireEvent('addNode', me, { parent: parent, node: node, }); }, initComponent: function () { var me = this; var config = me.config; var scope = lookupScope(this); if (!isDesignMode(scope, config)) { // 转换 dataSource 属性 convertDataSource(me, scope, config); } this.superclass.initComponent.call(this); this.on({ afterrender: function (sender) { var me = this; var config = this.config; var dataSource = config.dataSource; if (config.autoLoad) { if (config.dataSourceCallbackFn) { me.reload(); } else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') { me.reload(); } } } }); }, _setDataReal: function (value) { var me = this; // me.setStore(new Ext.data.TreeStore({ // root: { // expanded: true, // // children: value // children: [ // { // id: '1', text: 'A', // children: [ // {id: '1', text: 'A',}, // {id: '2', text: 'B'}, // ] // }, // {id: '2', text: 'B'}, // ] // } // })) me.store.setRoot({ expanded: true, children: value }); // me.store = new Ext.data.TreeStore({ // root: { // expanded: true, // // children: value // children: [ // { // id: '1', text: 'A', // children: [ // {id: '1', text: 'A',}, // {id: '2', text: 'B'}, // ] // }, // {id: '2', text: 'B'}, // ] // } // }) }, /** * 重新载入数据(重新计算参数) */ reload: function (reloadParams) { if (reloadParams === void 0) { reloadParams = {}; } var me = this; var config = me.config; if (config.dataSourceCallbackFn) { // 函数请求刷新 var scope_1 = lookupScope(this); // me.setLoading(true) config.dataSourceCallbackFn.call(scope_1, me, { successCallback: function (value) { me._setDataReal(value); // me.setLoading(false) me.fireEvent('dataLoadComplete', me, true, value); }, failCallback: function (error) { // me.setLoading(false) me.fireEvent('dataLoadComplete', me, false, error); } }); return; } var scope = lookupScope(me); var dataSource = config.dataSource; if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) { var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params)); me.setLoading(true); invokeServer$1(dataSource.url, params) .then(function (res) { me._setDataReal(res.data); me.fireEvent('dataLoadComplete', me, res); }) .finally(function () { me.setLoading(false); }); } }, filterByText: function (text) { this._filterText = text; this._filterBy(this, text, 'text'); }, _filterBy: _$2.debounce(function (me, text, by) { var view = me.getView(); me.store.clearFilter(); if (!me._filterText) { // 没有筛选内容,还原状态 var selections = me.getSelection(); var selectionPaths_1 = []; _$2.forEach(me.getSelection(), function (item) { selectionPaths_1.push(item.getPath()); }); me.collapseAll(); _$2.forEach(selectionPaths_1, function (path) { me.expandPath(path); }); me.setSelection(selections); return; } // 递归查找所有需要可见的节点 id 数组 var nodesAndParents = []; var expandPaths = []; me.getRootNode().cascadeBy(function (tree, view) { var currNode = this; currNode.collapse(); if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) { // 展开到匹配的路径 // me.expandPath(currNode.getPath()); expandPaths.push(currNode.getPath()); // 沿途父节点全部设定为可见 while (currNode.parentNode) { nodesAndParents.push(currNode.id); currNode = currNode.parentNode; } } }, null, [me, view]); me.store.filterBy(function (r) { return Ext.Array.contains(nodesAndParents, r.get('id')); }); _$2.forEach(expandPaths, function (path) { me.expandPath(path); }); }, 1000), }); } function convertDataSource(sender, scope, newConfig) { if (typeof newConfig.store !== 'undefined') { // 有 store 属性的情况下,不做任何事 return; } if (typeof newConfig.dataSource === 'undefined') { // 没有定义 dataSource 的情况下,不做任何事 return; } var dataSource = newConfig.dataSource; if (typeof dataSource === 'string') { // dataSource 是字符串的情况下,找到成员函数 dataSource = lookupFn(scope, dataSource); } if (typeof dataSource === 'function') { // dataSource 是函数的情况下,在 afterrender 之后进行回调 newConfig.store = new Ext.data.TreeStore({ root: { expanded: true, children: [] } }); newConfig.dataSourceCallbackFn = dataSource; return; } // throw new TypeError('无法识别的调用方法') } //# sourceMappingURL=yvtree.js.map /** * 构建一个 grid 支持的 dataSource */ function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) { if (reloadParams === void 0) { reloadParams = {}; } if (isExcelExport === void 0) { isExcelExport = false; } if (excelExportCallBack === void 0) { excelExportCallBack = null; } var _a; var me = grid; var params = calcObjectFlat(scope.viewModel.data, dataSource.params); var storeOption = {}; if (dataSource.method === 'invoke' || dataSource.sqlId) { if (dataSource.sqlId) { dataSource.method = 'invoke'; dataSource.url = '/Dev@executeSQL'; if (_$2.startsWith(dataSource.sqlId, '@')) { // sqlId 是 @ 开头,代表直接带中文名 var scope_1 = lookupScope(grid); params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path')); params.sqlId = dataSource.sqlId.substring(1); } else { // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名 var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1]; params.path = path; params.sqlId = sqlId; } params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true; } var fields_1 = []; _$2.forEach(grid.columns, function (col) { var c = {}; if (col.dataIndex) { c.name = col.dataIndex; fields_1.push(c); } if (col.dataType) { c.type = col.dataType; } }); // 默认支持 gridInvoke var extraParams = _$2.defaultsDeep({}, reloadParams, params); //@ts-ignore storeOption = { fields: fields_1, remoteSort: config.remoteSort, remoteFilter: config.remoteFilter, autoLoad: true, pageSize: me.store.pageSize || config.pageSize, proxy: { type: 'jsonAjax', $owner: me, url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }), extraParams: extraParams, reader: { type: 'json', rootProperty: 'data', totalProperty: 'pagination.total', successProperty: 'success', messageProperty: 'msg', transform: function (data) { if (typeof window['ajaxProcess'] === 'function') { window['ajaxProcess'](data); } if (typeof window['apiTranslate'] === 'function') { window['apiTranslate'](data, dataSource.url); } if (typeof grid._transform === 'function') { // 系统转换函数 grid._transform(data.data); } if (grid.dataTransform) { if (typeof grid.dataTransform === 'string') { grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform); } return grid.dataTransform.call(scope, grid, data); } return data; } } }, listeners: { load: function (store, records, successful, operation) { var _a, _b, _c; var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson; if (rep.pagination) { grid.dbInfo = rep.pagination.dbInfo; grid.exportDataSql = rep.pagination.exportDataSql; grid.exportDataSqlParams = rep.pagination.exportDataSqlParams; } me.exportExcelTotal = ((_b = rep === null || rep === void 0 ? void 0 : rep.pagination) === null || _b === void 0 ? void 0 : _b.total) || ((_c = rep === null || rep === void 0 ? void 0 : rep.data) === null || _c === void 0 ? void 0 : _c.length) || 0; if (isExcelExport) { if (typeof excelExportCallBack === 'function') { excelExportCallBack(rep); } else if (excelExportCallBack) { console.error("导出回调方法错误!"); } me.fireEvent('excelDataLoadComplete', me, successful, records); } else { if (_$2.get(config, 'behavior.autoSelectFirst')) { // 自动选中第一行 var data = grid.getStore().data; if (data.length > 0) { grid.setSelection(data.items[0]); } } me.fireEvent('dataLoadComplete', me, successful, records); } } } }; } else if (exports.apiConvert) { // 外部扩展的 apiConvert //@ts-ignore storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack); } else { throw new TypeError("不支持的 API 请求方式"); } if (isExcelExport) { var excelStore = new Ext.data.Store(storeOption); excelStore.load(); } else { if (me.groupField) { console.log('groupField', storeOption.groupField); storeOption.groupField = me.groupField; } me.setStore(new Ext.data.Store(storeOption)); } } function initStores () { Ext.define('Yvan.JsonAjaxProxy', { extend: 'Ext.data.proxy.Ajax', alias: 'proxy.jsonAjax', actionMethods: { create: "POST", read: "POST", update: "POST", destroy: "POST" }, timeout: storeAjax.timeout, buildRequest: function (operation) { // 参考源码 ext-all-debug.js:71468 method:buildRequest var me = this; var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner var scope = lookupScope($owner); var gridParam = me.getParams(operation); var customParam = {}; // 提取 srot 元素 if (gridParam.sort) { var sort = JSON.parse(gridParam.sort); // 字符串 [{"property":"BRANCHID","direction":"ASC"}] // 转换为对象 [{colId: "BRANCHID", sort: "asc"}] customParam.sortModel = []; _$2.forEach(sort, function (s) { customParam.sortModel.push({ colId: s.property, sort: _$2.toLower(s.direction) }); }); delete gridParam.sort; } // 提取筛选元素 if (gridParam.filter) { var filter = JSON.parse(gridParam.filter); console.log('gridParam.filter', gridParam.filter); // "[{"operator":"like","value":"1","property":"id"}]" // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}} customParam.filterModel = {}; _$2.forEach(filter, function (s) { var newFilterItem = {}; if (s.operator === 'like') { newFilterItem.filterType = 'text'; newFilterItem.type = 'contains'; newFilterItem.filter = s.value; } else { // 无法识别的筛选类型 newFilterItem.filterType = 'dict'; newFilterItem.type = 'in'; newFilterItem.filter = s.value; } customParam.filterModel[s.property] = newFilterItem; }); delete gridParam.filter; } // 被 grid.constructor 作为方法存在 var extraParams = _$2.cloneDeep(me.getExtraParams()); var params = _$2.defaultsDeep(gridParam, extraParams); // var request = this.superclass.buildRequest.apply(this, arguments); var request = new Ext.data.Request({ params: {}, action: operation.getAction(), records: operation.getRecords(), url: me.buildUrl(), jsonData: __assign({ args: [ params ] }, customParam), proxy: me }); operation.setRequest(request); return request; }, afterRequest: function (req, res) { // Extend.afterExtRequest(req, res) } }); Ext.define('Ext.ux.data.MyReader', { extend: 'Ext.data.reader.Json', xtype: 'yvgridreader', useSimpleAccessors: false, }); } //# sourceMappingURL=stores.js.map function initBehaviorEdit(config) { var _a, _b, _c; var dbTableName = _$2.get(config, 'behavior.dbTableName'); var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {}; var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {}; var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {}; if (dbTableName) { // 生成增删查改 var tbar = [ __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: { click: 'system.saveGridRow()' }, bind: { disabled: '{!' + config.reference + '.ischanged}' } }, saveButtonConfig), '-', __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'system.insertGridRow()' } }, addButtonConfig), __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: { click: 'system.removeGridRow()' } }, deleteButtonConfig), ]; if (_$2.isArray(config.tbar)) { config.tbar = __spread(tbar, [ '-' ], config.tbar); } else if (_$2.isPlainObject(config.tbar)) { config.tbar = { border: false, layout: { type: 'vbox', align: 'stretch' }, items: [ { xtype: 'toolbar', border: false, items: tbar }, config.tbar, ] }; } else if (_$2.isUndefined(config.tbar)) { config.tbar = tbar; } else { console.error("can't build tbar property!", config.tbar); } } } //# sourceMappingURL=grid_behavior.js.map function initGridDialog(config) { var detailDialog = _$2.get(config, 'detailDialog'); var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig'); if (_$2.isPlainObject(detailDialog)) { var tbar = [ __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: { click: 'system.showGridRowDetail()', }, bind: { disabled: '{!' + config.reference + '.selection}' } }, detailButtonConfig) ]; if (_$2.isArray(config.tbar)) { config.tbar = __spread(config.tbar, [ '-' ], tbar); } else if (_$2.isPlainObject(config.tbar)) { if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') { config.tbar.items = __spread(config.tbar.items); var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; }); if (!toolbar) { config.tbar.items = __spread(config.tbar.items, [ { xtype: 'toolbar', border: false, items: tbar }, ]); } else { toolbar.items = __spread(toolbar.items, [ '-' ], tbar); } } else { config.tbar = { border: false, layout: { type: 'vbox', align: 'stretch' }, items: [ { xtype: 'toolbar', border: false, items: tbar }, config.tbar, ] }; } } else if (_$2.isUndefined(config.tbar)) { config.tbar = tbar; } else { console.error("can't build tbar property!", config.tbar); } } } var SystemEventFu$1 = /** @class */ (function () { function SystemEventFu() { } SystemEventFu.prototype.showGridRowDetail = function () { return function (sender) { var grid1 = sender.up('yvgrid'); showGridRowDetail(grid1); }; }; __decorate([ Lib({ title: '为某个表格所选数据行, 显示其对话框', author: '罗一帆', createAt: '2022-07-27', updateAt: '2022-07-27', type: 'system', category: '表格', }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], SystemEventFu.prototype, "showGridRowDetail", null); return SystemEventFu; }()); function showGridRowDetail(grid1, isEdit) { if (isEdit === void 0) { isEdit = true; } var _a, _b, _c; if (!grid1.selection) { msg$1('请选中要展示的数据行!'); return; } var record = grid1.selection; if (_$2.isArray(record)) { record = record[0]; } if (!record) { msg$1('请选中要展示的数据行!'); return; } var config = grid1._originVJson; var detailDialog = config.detailDialog; var vjson = {}; var parentScope = lookupScope(grid1); var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path'); var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version'); _$2.defaultsDeep(vjson, { // 强制属性 layout: 'fit', __custom_path: __custom_path, __custom_version: __custom_version, fbar: __spread([ { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } }, { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } } ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])), items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [], }, detailDialog, { // 默认属性 width: 800, height: 450, bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})), }); if (_$2.isPlainObject(detailDialog.tabpanel)) { var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel)); vjson.items.push(tabpanel); if (tabpanel) { // 有多个选项卡,按每个选项卡进行过滤 _$2.forEach(tabpanel.items, function (tab) { var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; }); if (tabColumns.length > 0) { var tabVjson = buildForm(tabColumns, undefined, detailDialog); _$2.extend(tab, tabVjson); } }); } } else { vjson.items.push(buildForm(config.columns, undefined, detailDialog)); } var model = { data: { _edit: isEdit, _editType: isEdit ? '编辑' : '添加', } }; _$2.forOwn(record.data, function (value, key) { if (key === 'id') { // 忽略 ID 属性 return; } if (_$2.startsWith(key, '_')) { // 忽略 _ 开头的所有属性 return; } model.data[key] = value; }); console.log(vjson); var scope = new Scope({ vjson: vjson, model: model, }); //@ts-ignore scope.commit = function () { return new Promise(function (resolve) { _$2.forOwn(scope.viewModel.data, function (value, key) { if (_$2.startsWith(key, '_')) { // _origin 等属性可以被忽略 return; } if (key === 'id') { // id 属性被忽略 return; } record.set(key, value); }); resolve(); }); }; scope.showDialog(grid1, {}, {}); } function buildForm(columns, tabpanel, detailDialog) { var vjson = __assign({ border: false, layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, scrollable: true, items: [] }, detailDialog.form); var emptyFieldset = []; var fieldsetList = []; columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; }); _$2.forEach(columns, function (c) { var fieldset = _$2.get(c, 'form.fieldset'); if (fieldset) { var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; }); if (idx < 0) { fieldsetList.push({ fieldset: fieldset, columns: [c] }); } else { fieldsetList[idx].columns.push(c); } } else { emptyFieldset.push(c); } }); _$2.forEach(fieldsetList, function (fs) { var fieldSetVjson = { xtype: 'fieldset', title: fs.fieldset, items: [] }; buildFieldItems(fieldSetVjson.items, fs.columns); vjson.items.push(fieldSetVjson); }); buildFieldItems(vjson.items, emptyFieldset); return vjson; } // 构建字段组 function buildFieldItems(items, columns) { var _a, _b, _c, _d, _e; var row = { xtype: 'cols', items: [] }; for (var i = 0; i < columns.length; i++) { var column = columns[i]; if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) { delete row.xtype; row.layout = column.form.rowlayout; } if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) { row.items.push({ border: false, flex: column.form.prefix }); } var fieldVjson = buildField(column, row.items.length); if (!fieldVjson) { continue; } row.items.push(fieldVjson); if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) { row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix }); } if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) { items.push(row); row = { xtype: 'cols', items: [] }; } } if (row.items.length > 0) { items.push(row); } } // 构建字段 function buildField(column, colIdx) { var ret; if (column.xtype === 'checkcolumn') { ret = _$2.defaultsDeep({ xtype: 'checkbox', uncheckedValue: column.uncheckedValue, checkedValue: column.checkedValue, boxLabel: column.header, bind: { value: '{' + column.dataIndex + '}' } }, column.form); if (colIdx == 0) { // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth ret.margin = '0 0 0 85'; } } else { ret = _$2.defaultsDeep({}, column.form, column.editor, { fieldLabel: column.header, bind: { value: '{' + column.dataIndex + '}' }, }); } if (!ret.xtype) { return; } if (!ret.dict && ret.xtype === 'combo') { ret.dict = column.dict; } // 删除辅助属性 delete ret.order; delete ret.wrap; return ret; } //# sourceMappingURL=grid_dialog.js.map var model$c = { data: {} }; //# sourceMappingURL=GridColumnCustom.model.js.map var vjson$c = { title: '自定义表格属性', layout: 'fit', width: 980, height: 500, fbar: [ { xtype: "button", text: "保存", iconCls: 'x-fa fa-save', listeners: { click: 'scope.commit', } }, { xtype: "button", text: "关闭", iconCls: 'x-fa fa-times', listeners: { click: 'system.closeMe()', } }, ], items: [ { region: 'center', xtype: 'tabpanel', items: [ { title: '基本信息', reference: 'basic', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, scrollable: true, items: [ { xtype: 'cols', items: [ { fieldLabel: '路径', bind: { value: '{__custom_path}' }, xtype: 'textfield', flex: 2, }, { fieldLabel: '版本', bind: { value: '{__custom_version}' }, xtype: 'textfield', }, ] }, { xtype: 'cols', items: [ { fieldLabel: '配置点', bind: { value: '{__custom_point}' }, xtype: 'textfield', }, { fieldLabel: 'reference', bind: { value: '{reference}' }, xtype: 'textfield', }, { fieldLabel: '编辑模式', bind: { value: '{_mode}' }, xtype: 'combo', dict: 'GRID_MODE', }, ] }, { layout: 'hbox', defaults: { margin: '0 0 0 15', }, items: [ { boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox', bind: { value: "{hideFootbar}" } }, { boxLabel: '隐藏刷新', xtype: 'checkbox', bind: { value: "{hideRefresh}" } }, { boxLabel: '隐藏导出', xtype: 'checkbox', bind: { value: "{hideExport}" } }, { boxLabel: '隐藏自动调宽', xtype: 'checkbox', bind: { value: "{hideAutoSize}" } }, { boxLabel: '隐藏清空筛选', xtype: 'checkbox', bind: { value: "{hideClearFilter}" } }, { boxLabel: '隐藏保存布局', xtype: 'checkbox', bind: { value: "{hideSaveGridUIConfig}" } }, { boxLabel: '隐藏重置布局', xtype: 'checkbox', bind: { value: "{hideClearGridUIConfig}" } }, ] }, { layout: 'hbox', defaults: { margin: '0 0 0 15', }, items: [ { boxLabel: '自动载入数据源', xtype: 'checkbox', bind: { value: '{autoLoad}' }, margin: '0 0 0 85', }, { boxLabel: '分页模式', xtype: 'checkbox', bind: { value: '{pagination}' }, }, { boxLabel: '显示行序号', xtype: 'checkbox', bind: { value: '{show_rownum}' }, }, { boxLabel: '后端排序', xtype: 'checkbox', bind: { value: "{remoteSort}" } }, { boxLabel: '后端过滤', xtype: 'checkbox', bind: { value: "{remoteFilter}" } }, { boxLabel: '隐藏', xtype: 'checkbox', bind: { value: "{hidden}" } }, ] }, { layout: 'hbox', defaults: { margin: '0 0 0 15', }, items: [ { boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85', bind: { value: "{enableColumnHide}" } }, { boxLabel: '用户拖拽字段', xtype: 'checkbox', bind: { value: "{enableColumnMove}" } }, { boxLabel: '自定义筛选', xtype: 'checkbox', bind: { value: "{gridfilters}" } }, { boxLabel: '用户拖拽字段宽度', xtype: 'checkbox', bind: { value: "{enableColumnResize}" } }, { boxLabel: '点击列头排序', xtype: 'checkbox', bind: { value: "{sortOnClick}" } }, ] }, { xtype: 'cols', items: [ { fieldLabel: 'dbTableName', labelWidth: 110, bind: { value: '{behavior.dbTableName}' }, xtype: 'textfield', }, { fieldLabel: 'theid', bind: { value: '{theid}' }, xtype: 'textfield', }, { fieldLabel: '添加行聚焦', bind: { value: '{behavior.focusColumnAfterInsert}' }, xtype: 'textfield', }, ] }, { xtype: 'cols', items: [ { fieldLabel: '批量删除提示', labelWidth: 110, bind: { value: '{behavior.batchRemoveConfirm}' }, xtype: 'textfield', }, { fieldLabel: '删除提示', bind: { value: '{behavior.singleRemoveConfirm}' }, xtype: 'textfield', }, { fieldLabel: '触发刷新', labelWidth: 110, bind: { value: '{behavior.selectToReload}' }, xtype: 'textfield', }, ] }, ] }, { title: '字段', reference: 'grid1', xtype: 'yvgrid', pagination: false, _mode: 'edit', listeners: { buttonclick: 'scope.grid1Buttonclick', }, hideFootbar: true, tbar: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addField' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeField' } }, '-', { xtype: 'button', text: '自动分析', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcField' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUp' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDown' } }, ], store: {}, columns: [ { dataIndex: 'dataIndex', header: "字段名", width: 140, editor: { xtype: 'textfield' } }, { dataIndex: 'dbColumn', header: "数据库字段", width: 140, editor: { xtype: 'textfield' } }, { dataIndex: 'header', header: '中文', width: 140, editor: { xtype: 'textfield' } }, { dataIndex: 'dict', header: '字典', width: 110, editor: { xtype: 'combogrid' } }, { dataIndex: 'editor_widget', header: '下拉表', width: 110, editor: { xtype: 'combogrid' }, hidden: true, }, { dataIndex: 'width', header: '宽度', width: 80, editor: { xtype: 'numberfield' }, hidden: true, }, { dataIndex: 'editor_xtype', header: '编辑器', width: 170, editor: { xtype: 'combo' }, dict: 'GRID_XTYPE' }, { dataIndex: 'serverCreateValue', header: '服务端创建值', editor: { xtype: 'textfield' }, }, { dataIndex: 'createValue', text: '客户端新创建值', editor: { xtype: 'textfield' }, }, { dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, }, { dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, }, { dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, }, { dataIndex: 'formatter', header: '格式化', width: 110, editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true, }, { dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, hidden: true, }, { dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, hidden: true, }, { dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, hidden: true, }, { dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, }, { dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, hidden: true, }, { dataIndex: 'form_order', text: '对话框序号', editor: { xtype: 'numberfield' }, }, { dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, }, { dataIndex: 'form_xtype', text: '对话框编辑器', editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true, }, { dataIndex: 'form_fieldset', text: '对话框字段组', editor: { xtype: 'textfield' }, hidden: true, }, { dataIndex: 'form_tab', text: '对话框选项卡', editor: { xtype: 'textfield' }, hidden: true, }, { dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60, resizable: false, sortable: false, menuDisabled: true, checkedValue: true, uncheckedValue: false, hidden: true, }, ], }, { title: 'SQL和查询条件', reference: 'sql', layout: 'border', border: false, items: [ { region: 'north', height: 200, border: false, split: true, xtype: 'yvgrid', reference: 'gridCondition', pagination: false, hideFootbar: true, _mode: 'edit', listeners: { buttonclick: 'scope.conditionButtonclick', }, store: {}, tbar: { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '添加条件', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addCondition' } }, { xtype: 'button', text: '删除条件', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeCondition' } }, '-', { xtype: 'button', text: '自动分析条件变量', iconCls: 'x-fa fa-code-fork', listeners: { click: 'scope.calcCondition' } }, { xtype: 'button', text: '上移', iconCls: 'x-fa fa-arrow-up', listeners: { click: 'scope.moveUpCondition' } }, { xtype: 'button', text: '下移', iconCls: 'x-fa fa-arrow-down', listeners: { click: 'scope.moveDownCondition' } }, ] }, columns: [ { text: '条件变量', dataIndex: 'param_name', width: 140, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '中文标题', dataIndex: 'fieldLabel', width: 120, sortable: false, menuDisabled: true, editor: { selectOnFocus: true }, }, { text: '编辑类型', dataIndex: 'xtype', width: 80, sortable: false, menuDisabled: true, editor: { xtype: 'combo', typeAhead: true, triggerAction: 'all', selectOnFocus: true, store: [ ['textfield', 'textfield'], ['combo', 'combo'], ['datefield', 'datefield'], ['datetimefield', 'datetimefield'], ['numberfield', 'numberfield'], ['multiplesearch', 'multiplesearch'], ] } }, { text: '权重', dataIndex: 'conditionFieldFlex', align: 'right', width: 60, sortable: false, menuDisabled: true, editor: { xtype: 'numberfield', selectOnFocus: false, minValue: 0, maxValue: 10 }, }, { text: '字典', dataIndex: 'conditionFieldDict', width: 160, sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, { xtype: 'checkcolumn', dataIndex: "conditionFieldWrap", header: "换行", width: 65, sortable: false, menuDisabled: true, }, { text: '扩展参数', dataIndex: 'conditionFieldExtend', sortable: false, menuDisabled: true, editor: { selectOnFocus: false }, }, ] }, { region: 'center', xtype: 'sqleditor', layout: 'fit', reference: 'sqlEditor', split: true, }, ] }, { title: '详情对话框', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, scrollable: true, items: [ { xtype: 'cols', items: [ { fieldLabel: '对话框标题', bind: { value: '{detailDialog.title}' }, xtype: 'textfield', flex: 2, }, { fieldLabel: '宽度', bind: { value: '{detailDialog.width}' }, xtype: 'numberfield', }, { fieldLabel: '高度', bind: { value: '{detailDialog.height}' }, xtype: 'numberfield', }, ] }, ] }, { title: '界面源码', xtype: 'jseditor', reference: 'jseditor' } ] } ] }; //# sourceMappingURL=GridColumnCustom.view.js.map var GridColumnCustom = /** @class */ (function (_super) { __extends(GridColumnCustom, _super); function GridColumnCustom() { return _super.call(this, { model: model$c, vjson: vjson$c }) || this; } GridColumnCustom.prototype.commit = function () { }; GridColumnCustom.prototype.grid1Buttonclick = function () { }; GridColumnCustom.prototype.conditionButtonclick = function () { }; GridColumnCustom.prototype.addField = function () { }; GridColumnCustom.prototype.removeField = function () { }; GridColumnCustom.prototype.calcField = function () { }; GridColumnCustom.prototype.moveUp = function () { }; GridColumnCustom.prototype.moveDown = function () { }; GridColumnCustom.prototype.addCondition = function () { }; GridColumnCustom.prototype.removeCondition = function () { }; GridColumnCustom.prototype.calcCondition = function () { }; GridColumnCustom.prototype.moveUpCondition = function () { }; GridColumnCustom.prototype.moveDownCondition = function () { }; return GridColumnCustom; }(Scope)); //# sourceMappingURL=GridColumnCustom.js.map function initGridCode(grid, newConfig, buttons) { if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) { buttons.push({ xtype: 'button', tooltip: '定义表格属性', iconCls: 'x-fa fa-codepen', handler: function (btn) { var customWindow = new GridColumnCustom(); customWindow.showDialog(btn, {}, {}); } }); buttons.push({ xtype: 'button', tooltip: '定义表格数据源', iconCls: 'x-fa fa-database', handler: function () { // showCustomGridDataSource(grid) } }); } } //# sourceMappingURL=grid_code.js.map window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData"; var hexToString = function (hex) { var arr = hex.split(""); var out = ""; for (var i = 0; i < arr.length / 2; i++) { var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1]; // @ts-ignore var charValue = String.fromCharCode(tmp); out += charValue; } return out; }; var defaultGrid = grid; function initGrid () { Ext.define('Yvan.Grid', { extend: 'Ext.grid.Panel', xtype: 'yvgrid', __suspendReload: false, _originVJson: {}, constructor: function (config) { var _this = this; var _a, _b, _c, _d, _e, _f; var me = this; var dataSource = config.dataSource; var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope); me._originVJson = config; if (!isDesignMode(scope, config)) { this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config); if (Array.isArray(config.columns) && config.columns.length > 0) { var cacheData = this.getColumnConfigCache(); if (Array.isArray(cacheData) && cacheData.length > 0) { var newColumns = []; for (var j = 0; j < cacheData.length; j++) { var itData = cacheData[j]; for (var i = 0; i < config.columns.length; i++) { var column = config.columns[i]; if (itData.dataIndex === column.dataIndex) { if (itData.width) { column.width = itData.width; } column.hidden = itData.hidden; column.locked = itData.locked; newColumns.push(column); break; } } } config.columns = newColumns; } } } var newConfig = _$2.defaultsDeep({ // 强制性属性 bug. // lock 属性会造成 Cannot read properties of undefined (reading 'els') // enableLocking: false, // syncRowHeight: false, }, baseConfig(config, 'row-item'), config, grid); // 在面板上的组件 // const scope = newConfig.$initParent?.yvanScope || // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope || // config.$vmParent?.yvanScope || // newConfig.$vmParent?._parent?.yvanScope; var buttons = []; var getRowClass = newConfig.getRowClass; if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") || _$2.startsWith(getRowClass, "system."))) { var fn = lookupFn(scope, getRowClass); _$2.set(newConfig, 'viewConfig.getRowClass', fn); } if (!newConfig.hideExport) { buttons.push({ xtype: 'button', tooltip: '导出Excel', iconCls: 'x-fa fa-download', listeners: { click: this.exportExcel }, }); } if (!newConfig.hideAutoSize) { buttons.push({ xtype: 'button', iconCls: 'x-fa fa-text-width', tooltip: '自适应宽度', listeners: { click: this.autoSizeColumns } }); } if (!newConfig.hideClearFilter) { buttons.push({ xtype: 'button', tooltip: '清空筛选', iconCls: 'x-fa fa-filter', handler: this.clearFilter }); } if (!newConfig.hideSaveGridUIConfig) { buttons.push({ xtype: 'button', tooltip: '保存布局', iconCls: 'x-fa fa-cogs', handler: this.saveGridUIConfig }); } if (!newConfig.hideClearGridUIConfig) { buttons.push({ xtype: 'button', tooltip: '还原布局', iconCls: 'x-fa fa-reply-all', handler: this.clearGridUIConfig }); } initGridCode(me, newConfig, buttons); if (!newConfig.hideFootbar) { if (newConfig.pagination) { newConfig.bbar = new Ext.PagingToolbar({ // pageSize: newConfig.pageSize, 这个值是无效的 displayInfo: true, store: this.store, emptyMsg: '没有记录', cls: 'grid-bbar', items: __spread([ { xtype: 'combobox', tooltip: '分页', queryMode: 'local', editable: false, allowBlank: true, labelAlign: 'right', width: 90, // labelWidth: 30, listConfig: { minWidth: null }, value: 50, valueField: undefined, displayField: undefined, hideClear: true, store: newConfig.pageSizeOption, listeners: { change: function (sender, nv, ov) { _this.store.pageSize = nv; _this.store.loadPage(1); } } } ], buttons), doRefresh: function () { me.reload(); } }); } else { newConfig.bbar = { xtype: 'toolbar', overflowHandler: 'menu', cls: 'grid-bbar', items: __spread([ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', handler: function () { _this.reload(); } }, '-' ], buttons) }; if (newConfig.hideRefresh) { newConfig.bbar.items.splice(0, 1); } } } if (_$2.isArray(newConfig.condition)) { // 带查询条件 var conditionRows_1 = []; var newRow_1 = false; var currentRow_1 = { xtype: 'cols', items: [], }; conditionRows_1.push(currentRow_1); _$2.forEach(newConfig.condition, function (item) { var _a; if (newRow_1) { currentRow_1 = { xtype: 'cols', items: [], }; conditionRows_1.push(currentRow_1); } var vj = _$2.cloneDeep(item); if (vj.xtype) { if (item.xtype === 'combo' && item.dict) { vj.fix = ['system.getDict("' + item.dict + '")']; } if (item.xtype === 'datetimefield') { _$2.defer(function () { //@ts-ignore scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss')); }); } else if (item.xtype === 'datefield') { _$2.defer(function () { //@ts-ignore scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD')); }); } else { scope.viewModel.set(item.param_name, ''); } } else { // 没有组件类型,是个空占位符 vj.border = false; } if (item.param_name) { vj.bind = { value: '{' + item.param_name + '}' }; _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}'); _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}'); } newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false; currentRow_1.items.push(vj); }); newConfig.tbar = { xtype: 'form', border: false, items: conditionRows_1, defaults: { margin: '8 0 8 0' }, }; console.log('newConfig', newConfig); } _$2.each(newConfig.columns, function (c) { var renderer = c.renderer, formatter = c.formatter; if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") || _$2.startsWith(renderer, "system."))) { if (newConfig.$initParent) { if (scope) { var rendererFn = lookupFn(scope, renderer); c.renderer = rendererFn.bind(scope); } } } if (c.dict) { c.fix = ['system.getDict("' + c.dict + '")']; if (c.editor && c.editor.xtype === 'combo') { c.editor.fix = ['system.getDict("' + c.dict + '")']; c.editor.typeAhead = true; c.editor.triggerAction = 'all'; c.editor.selectOnFocus = false; c.editor.listConfig = { minWidth: 200 }; } } if (formatter === 'button') { c.tdCls = 'td-btn'; if (!c.listeners) { c.listeners = {}; } c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) { if ($(event.target).is('input')) { me.fireEvent('buttonclick', me, this, record); } }; } else if (formatter === 'percentRenderer') { c.tdCls = 'td-percent'; } }); if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') { // 强制为编辑模式 newConfig.selModel = { type: 'spreadsheet', columnSelect: true, pruneRemoved: false, extensible: 'y' }; newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true }); if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') { _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2); } else { _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1); } } else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') { // 强制为勾选模式 newConfig.selModel = { type: 'checkboxmodel', mode: 'MULTI', }; } else if (newConfig._mode === 'checkonly') { newConfig.selModel = { type: 'checkboxmodel', mode: 'MULTI', checkOnly: true, }; } else if (newConfig._mode === 'select') { // 强制为选择模式 newConfig.selModel = { selType: 'rowmodel', mode: 'SINGLE', }; if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') { _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2); } } initBehaviorEdit(newConfig); initGridDialog(newConfig); this.superclass.constructor.call(this, newConfig); this.store.pageSize = newConfig.pageSize; }, setData: function (value) { var me = this; me._setDataReal(value); }, /** * 添加行,并进入编辑状态 * @param record 新行的属性集 * @param editRowCol 要编辑的列序号,或 dataIndex 的名称 */ appendEditRow: function (record, editRowCol) { var records = this.getStore().add(record); var recNew = records[0]; this.setSelection(records); if (typeof editRowCol === 'string' && editRowCol) { editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; }); } if (typeof editRowCol === 'number') { var ce = this.findPlugin('cellediting'); this.editingPlugin = ce; ce.startEdit(recNew, editRowCol); } }, beginEdit: function (record, editRowCol) { if (typeof record === 'number') { record = this.store.data.getAt(record); } if (record.isEntity === true) { this.setSelection([record]); if (typeof editRowCol === 'string' && editRowCol) { editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; }); } if (typeof editRowCol === 'number') { var ce = this.findPlugin('cellediting'); this.editingPlugin = ce; ce.startEdit(record, editRowCol); } } }, /** * 移除行 * @param record 如果记录传空,就是当前选中的行 */ removeEditRow: function (record) { if (!record) { record = this.selection; } if (!record) { msg('请选中要删除的行'); return; } this.getStore().remove(record); }, /** * 获取全部原始数据 */ getDataRows: function () { return this.getStore().data.items.map(function (r) { return r.data; }); }, /** * 获取全部原始数据, 不带 id/ 不带 origin */ getDataRowsOnlyData: function () { return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) { delete r.id; delete r._origin; return r; }); }, rowMoveUp: function () { var grid = this; if (!grid.selection) { msg('无法对多行进行移动'); return; } var record = grid.selection; if (_$2.isArray(record)) { record = record[0]; } if (!record) { msg('无法对多行进行移动'); return; } // const records = grid.selModel.getSelection() // if (records.length !== 1) { // msg('无法对多行进行移动') // return // } // // const [record] = records var index = grid.store.indexOf(record); if (index > 0) { grid.store.removeAt(index); grid.store.insert(index - 1, record); grid.getView().refresh(); grid.selModel.select([record]); } }, rowMoveDown: function () { var grid = this; // const records = grid.selModel.getSelection() // if (records.length !== 1) { // msg('无法对多行进行移动') // return // } if (!grid.selection) { msg('无法对多行进行移动'); return; } var record = grid.selection; if (_$2.isArray(record)) { record = record[0]; } if (!record) { msg('无法对多行进行移动'); return; } var index = grid.store.indexOf(record); if (index < grid.store.getCount() - 1) { grid.store.removeAt(index); grid.store.insert(index + 1, record); grid.getView().refresh(); grid.selModel.select([record]); } }, getEditRecord: function () { var _a, _b; var me = this; var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin; var rowIdx = (_b = (_a = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.rowIdx; var record; if (typeof rowIdx === 'undefined') { record = me.getSelectionModel().getLastSelected(); } else { record = me.store.getAt(rowIdx); } return record; }, getEditRow: function () { var _a; var me = this; return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data; }, setEditRow: function (rowValues) { var me = this; var record = me.getEditRecord(); if (record) { _$2.forOwn(rowValues, function (v, k) { record.set(k, v); }); } }, _transform: function (data) { // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值 _$2.forEach(data, function (row) { row._origin = _$2.clone(row); }); }, _setDataReal: function (value) { var me = this; this._transform(value); var storeOpt = { fields: getFileds(this), data: value, }; if (this.groupField) { storeOpt.groupField = this.groupField; } var store = new Ext.data.Store(storeOpt); me.setStore(store); }, setStore: function (store) { var me = this; if (_$2.isArray(store)) { var value = store; this._transform(value); var storeOpt = { fields: getFileds(this), data: value, }; if (this.groupField) { storeOpt.groupField = this.groupField; } store = new Ext.data.Store(storeOpt); } me.superclass.setStore.call(this, store); var reference = this.reference; if (reference) { var scope = lookupScope(this); scope.viewModel.set(reference + '.ischanged', false); scope.viewModel.set(reference + '.theid', null); scope.viewModel.set(reference + '.theid2', null); scope.viewModel.set(reference + '.theid3', null); } if (store) { store.on({ add: function (store, records, index, eOpts) { me._raiseChange(store, 'add'); }, remove: function (store, records, index, isMove, eOpts) { me._raiseChange(store, 'remove'); }, datachanged: function (sender, opt) { me._raiseChange(store, 'datachanged'); } }); } }, _raiseChange: function (store, type) { var _a, _b; var reference = this.reference; if (reference && store) { var ischanged = false; if (store.getModifiedRecords().length > 0 || store.getNewRecords().length > 0 || store.getRemovedRecords().length > 0) { ischanged = true; } else { ischanged = false; } (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged); } }, /** * 轻量级刷新 */ refreshData: function () { var store = this.getStore(); if (store) { store.reload(); } }, /** * 为表格强制设置焦点 * @param seq 顺序号 */ focusRow: function (seq) { this.setSelection(this.store.getAt(seq)); this.getView().focusRow(seq); }, /** * 重新载入数据(重新计算参数) */ reload: function (reloadParams) { if (reloadParams === void 0) { reloadParams = {}; } var me = this; var config = me.config; if (config.dataSourceCallbackFn) { // 函数请求刷新 var scope_1 = lookupScope(this); _$2.defer(function () { me.setLoading(true); }); config.dataSourceCallbackFn.call(scope_1, me, { successCallback: function (value) { me._setDataReal(value); _$2.defer(function () { me.setLoading(false); }); // 自动选中第一行 var data = me.getStore().data; if (data.length > 0) { me.setSelection(data.items[0]); } me.fireEvent('dataLoadComplete', me, true, value); }, failCallback: function (error) { _$2.defer(function () { me.setLoading(false); }); me.fireEvent('dataLoadComplete', me, false, error); } }); return; } // if (this.store) { // this.store.reload({aaaa: 1, bbbb: 2}) // } var dataSource = config.dataSource; var scope = lookupScope(me); if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) { gridInvokeBuild(scope, me, config, dataSource, reloadParams); } }, exportCurrentExcelClick: function () { var _a; var me = this; var config = me.config; var scope = lookupScope(me); var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-"); if (excelFileName.endsWith(".xlsx")) { excelFileName = excelFileName.split(".xlsx")[0]; } excelFileName += ".xlsx"; var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }); var excelData = me.makeExcelData(rowsAll); LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx'); }, exportExcelClick: function (excelExportParams) { var me = this; var config = me.config; excelExportParams.isExcelExport = true; var scope = lookupScope(me); var dataSource = config.dataSource; scope.setLoading(true); var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-"); gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) { var _a, _b, _c, _d; var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1; var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize; var total = parseInt((_c = responseData.pagination) === null || _c === void 0 ? void 0 : _c.total) || ((_d = responseData.data) === null || _d === void 0 ? void 0 : _d.length) || 0; me.exportExcelCurrentPage = page; me.exportExcelPageSize = size; me.exportExcelTotal = total; if (excelFileName.endsWith(".xlsx")) { excelFileName = excelFileName.split(".xlsx")[0]; } excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)"; excelFileName += ".xlsx"; var excelData = me.makeExcelData(responseData.data); LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx'); if (page < total / size) { page++; me.exportExcelCurrentPage = page; } scope.setLoading(false); }); }, exportBigExcelClick: function () { var _a; var me = this; if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) { showErrorDialog('当前表格不支持大批量导出'); return; } var config = me.config; var scope = lookupScope(me); var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-"); var head = []; var dict = {}; _$2.forEach(me.columns, function (column) { if (column.isHidden()) return; if (!column.dataIndex) return; if (!column.text) return; head.push({ field: column.dataIndex, name: column.text }); if (column.dictForExcel) { dict[column.dataIndex] = column.dictForExcel; } }); // 判断是否需要解密 if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) { me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl); me.dbInfo.password = hexToString(me.dbInfo.password); me.dbInfo.username = hexToString(me.dbInfo.username); } scope.setLoading(true); Ext.Ajax.request({ timeout: 15000, url: window["EXPORT_DATA_HOST"], method: "POST", jsonData: { file: excelFileName, dbInfo: me.dbInfo, exportDataSql: me.exportDataSql, exportDataSqlParams: me.exportDataSqlParams, head: head, dict: dict, }, }).then(function () { scope.setLoading(false); msg('请求成功'); }).catch(function () { scope.setLoading(false); showErrorDialog('请求失败,请确认是否已安装客户端'); }); }, makeExcelData: function (jsonData) { var me = this; me.fireEvent('onExcelDataLoadCompleted', me, jsonData); if (!Array.isArray(jsonData) || jsonData.length === 0) { return; } var data = []; // 获取表格的列定义 var headerTextArr = []; var headers = []; for (var i = 0; i < me.headerCt.getGridColumns().length; i++) { var header = me.headerCt.getGridColumns()[i]; if (!header.isHidden()) { var textStr = _$2.trim(header.text); var dataIndexStr = _$2.trim(header.dataIndex); if (dataIndexStr) { if (textStr === '') { headerTextArr.push(dataIndexStr); } else { headerTextArr.push(textStr); } headers.push(header); } } } if (headers.length === 0) { return; } data.push(headerTextArr); for (var i = 0; i < jsonData.length; i++) { var dataRow = jsonData[i]; var row = []; for (var j = 0; j < headers.length; j++) { var key = headers[j].dataIndex; var value = dataRow[key]; if (!value && value !== 0) { value = ''; } var oValue = value; // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下 if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) { try { value = headers[j].renderer(value); if (!value && value !== 0) { value = oValue; } } catch (e) { value = oValue; } } row.push(value); } data.push(row); } return data; }, initComponent: function () { var _this = this; var _a; var me = this; var config = me.config; var scope = lookupScope(this); if (isDesignMode(scope, config)) { this.superclass.initComponent.call(this); return; } // 转换 dataSource 属性 convertDataSource$1(me, scope, config); this.on({ afterrender: function (sender) { var me = this; var config = this.config; var dataSource = config.dataSource; if (config.autoLoad) { if (config.dataSourceCallbackFn) { me.reload(); } else if (_$2.isPlainObject(dataSource)) { me.reload(); } } if (config.contextMenu === true && _$2.isArray(config.tbar)) { var vm = this.lookupViewModel(); this.contextMenu = this.add(new Ext.menu.Menu({ viewModel: vm, items: _$2.map(config.tbar, function (item) { var menuItem = __assign({}, item); if (menuItem.xtype === 'button') { delete menuItem.xtype; } return menuItem; }) })); } else if (_$2.isPlainObject(config.contextMenu)) { this.contextMenu = this.add(config.contextMenu); } var $dom = $(sender.el.dom); $dom.on('keydown', function (e) { me.fireEvent('keydown', me, e); }).on('keyup', function (e) { me.fireEvent('keyup', me, e); }); // 默认显示提示 if (this.cellTip) { this.tip = Ext.create('Ext.tip.ToolTip', { target: this.el, delegate: '.x-grid-cell-inner', trackMouse: true, ancor: 'top', style: 'background-color: #0D6EFD;', listeners: { beforeshow: function (tip) { var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent); if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) { return false; } tip.update(tipText); } } }); } }, itemcontextmenu: function (view, rec, node, index, e) { if (this.contextMenu) { e.stopEvent(); this.contextMenu.show().setLocalXY(e.getXY()); return false; } }, // columnmove(sender, column, fromIndex, toIndex, eOpts) { // this.setColumnConfigCache() // }, // columnhide(sender, column, eOpts) { // this.setColumnConfigCache() // }, // columnshow(sender, column, eOpts) { // this.setColumnConfigCache() // }, // columnresize(sender, column, width, eOpts) { // this.setColumnConfigCache() // }, destory: function () { }, selectionchange: function (sender, param) { var record = undefined; if (_$2.isArray(param)) { record = param[0]; } else if (_$2.isObject(param)) { record = _$2.get(param, 'endCell.record'); } itemselectFun(this, sender, record); }, itemclick: function (sender, record) { itemselectFun(this, sender, record); }, show: function (sender) { if (sender.__suspendReload) { sender.__suspendReload = false; sender.reload(); } } }); _$2.defer(function () { var ce = _this.findPlugin('cellediting'); ce.on({ beforeedit: function (editor, context, eOpts) { me.fireEvent('editbefore', me, editor, context, eOpts); }, canceledit: function (editor, context, eOpts) { me.fireEvent('editcancel', me, editor, context, eOpts); }, edit: function (editor, context, eOpts) { me.fireEvent('editfinish', me, editor, context, eOpts); }, validateedit: function (editor, context, eOpts) { me.fireEvent('editvalidate', me, editor, context, eOpts); }, }); }); var itemselectFun = _$2.debounce(function (me, sender, record) { var reference = me.reference; var scope = lookupScope(me); var theid = _$2.get(config, 'behavior.theid'); if (theid && reference) { if (!record) { scope.viewModel.set(reference + '.theid', null); } else { scope.viewModel.set(reference + '.theid', record.get(theid)); } } var theid2 = _$2.get(config, 'behavior.theid2'); if (theid2 && reference) { if (!record) { scope.viewModel.set(reference + '.theid2', null); } else { scope.viewModel.set(reference + '.theid2', record.get(theid2)); } } var theid3 = _$2.get(config, 'behavior.theid3'); if (theid3 && reference) { if (!record) { scope.viewModel.set(reference + '.theid3', null); } else { scope.viewModel.set(reference + '.theid3', record.get(theid3)); } } me.fireEvent('itemselect', sender, record); }, 50); if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) { // 为 stores.proxy.buildRequest 做准备 this.store.proxy.$owner = this; } var selectToReload = _$2.get(config, 'behavior.selectToReload'); if (selectToReload) { // 点击后触发某个目标表格刷新 this.on({ itemselect: function (sender) { if (_$2.isArray(selectToReload)) { _$2.forEach(selectToReload, function (ref) { if (ref) { var ctlTarget = scope.refs[ref]; if (ctlTarget && typeof ctlTarget.reload === 'function') { if (ctlTarget.isVisible()) { ctlTarget.reload(); } else { ctlTarget.__suspendReload = true; } } } }); } else if (_$2.isString(selectToReload)) { var ctlTarget = scope.refs[selectToReload]; if (ctlTarget && typeof ctlTarget.reload === 'function') { ctlTarget.reload(); } } } }); } this.superclass.initComponent.call(this); }, // 生成列自定义的缓存key makeColumnConfigCacheKey: function (config) { var _a, _b, _c, _d, _e, _f; var scope = ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.yvanScope) || ((_c = (_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.lookupReferenceHolder()) === null || _c === void 0 ? void 0 : _c.yvanScope) || ((_d = config.$vmParent) === null || _d === void 0 ? void 0 : _d.yvanScope) || ((_f = (_e = config.$vmParent) === null || _e === void 0 ? void 0 : _e._parent) === null || _f === void 0 ? void 0 : _f.yvanScope); var key = "gridColumnCache-" + scope.scopeKey + "-"; if (config.reference) { key += config.reference; } else { var subKey = ""; for (var i = 0; i < config.columns.length; i++) { var column = config.columns[i]; if (column.dataIndex) { subKey += column.dataIndex; } } key += subKey; } return key; }, getColumnConfigCache: function () { var key = this.columnConfigCacheKey; var dataStr = localStorage.getItem(key); if (dataStr) { return JSON.parse(dataStr); } return ""; }, setColumnConfigCache: function () { var key = this.columnConfigCacheKey; var cacheData = []; var columns = this.headerCt.getGridColumns(); var index = 0; for (var i = 0; i < columns.length; i++) { var column = columns[i]; if (column.dataIndex) { cacheData.push({ dataIndex: column.dataIndex, width: column.width, hidden: column.hidden, locked: column.locked, index: index }); index++; } } localStorage.setItem(key, JSON.stringify(cacheData)); }, autoSizeColumns: function (sender) { var grid = sender ? sender.up('grid') : this; // const columns = grid.columns; // for (let i = 0; i < columns.length; i++) { // const column = columns[i]; // grid.getView().autoSizeColumn(column); // column.setWidth(column.getWidth() + 5); // } for (var i = 1; i < grid.headerCt.getColumnCount(); i++) { grid.headerCt.getGridColumns()[i].autoSize(i); grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15); } }, clearFilter: function (sender) { var grid = sender.up('grid'); grid.filters.clearFilters(); grid.getStore().sorters.removeAll(); // grid.getStore().reload() }, saveGridUIConfig: function (sender) { var grid = sender.up('grid'); grid.setColumnConfigCache(); msg('保存设置成功!'); }, clearGridUIConfig: function (sender) { var grid = sender.up('grid'); var key = grid.columnConfigCacheKey; localStorage.setItem(key, ""); msg('清空设置成功,重新打开后生效!'); }, setLoading: function (value) { if (value) { this.mask('读取中'); } else { this.unmask(); } }, exportExcel: function (sender) { var rect = sender.btnEl.dom.getBoundingClientRect(); var scope = lookupScope(this); var grid = sender.up('grid'); var menuItems = []; if (grid.dataSource.method === 'invoke' || grid.dataSource.sqlId) { menuItems.push({ text: '大批量导出 (需要客户端支持!)', iconCls: 'x-fa fa-download', listeners: { click: function (sender, value) { // @ts-ignore YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?') .then(function (res) { grid.exportBigExcelClick(); }); } } }); menuItems.push('-'); } menuItems.push({ text: '导出当前数据', iconCls: 'x-fa fa-download', listeners: { click: function (sender, value) { grid.exportCurrentExcelClick(); } } }, { xtype: "textfield", fieldLabel: '当前导出页', maskRe: /[0-9]/, value: grid.exportExcelCurrentPage, listeners: { render: function (sender) { grid.exportExcelCurrentPageCmp = sender; }, change: function (sender, value) { var v = parseInt(value); if (isNaN(v) || v === 0) { window['system'].msg("页码不能为0"); v = 1; sender.setValue(v); } var size = parseInt(grid.exportExcelPageSize); var total = parseInt(grid.exportExcelTotal); if (v > total / size) { v = parseInt(total / size + ""); } grid.exportExcelCurrentPage = v + ""; } } }, { xtype: "textfield", fieldLabel: '导出页大小', maskRe: /[0-9]/, value: grid.exportExcelPageSize, listeners: { render: function (sender) { grid.exportExcelPageSizeCmp = sender; }, change: function (sender, value) { var v = parseInt(value); if (isNaN(v) || v === 0) { window['system'].msg("导出页大小不能为0"); v = defaultGrid.exportExcelPageSize; sender.setValue(v); } if (v > 10000) { window['system'].msg("导出页大小不能大于10000"); v = 10000; sender.setValue(v); } var page = parseInt(grid.exportExcelCurrentPage); var total = parseInt(grid.exportExcelTotal); if (page > total / v) { page = parseInt(total / v + "") + 1; grid.exportExcelCurrentPageCmp.setValue(page); } grid.exportExcelPageSize = v + ""; } } }, { xtype: "textfield", fieldLabel: '总条数', value: grid.exportExcelTotal, readOnly: true }, { text: '导出', iconCls: 'x-fa fa-download', listeners: { click: function (sender, value) { grid.exportExcelClick({ exportExcelPageSize: grid.exportExcelPageSize, exportExcelCurrentPage: grid.exportExcelCurrentPage }); } } }); var treeMenu = new Ext.menu.Menu({ xtype: 'menu', floated: false, width: 300, docked: 'left', items: menuItems }); treeMenu.showAt(rect.left, rect.top - 120); // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) { // grid.headerCt.getGridColumns()[i].autoSize(i); // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15); // } }, /** * 获取表格编辑的行数据 */ getGridEditRows: function () { var grid = this; var store = grid.getStore(); var rows = []; var modifyRows = []; var newRows = []; var err = ""; var records = store.getModifiedRecords(); var newRecords = store.getNewRecords(); var removeRecords = []; _$2.forEach(store.getRemovedRecords(), function (row) { removeRecords.push(row.data); }); _$2.forEach(records, function (record) { var colums = grid.columns; var errFunc = undefined; _$2.forEach(colums, function (col) { var name = col.dataIndex; var value = record.data[name]; var colIndex = col.getIndex(); //获得列号 var rowIndex = store.indexOfId(record.id); //获得行号 var editor = col.getEditor(); //使用的编辑器 var tmpErrFunc = function () { var text = col.text || col.name; msg(text + ' 校验失败, 请确保输入的数据正确'); grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态 }; if (editor && !editor.allowBlank && isEmpty(value)) { errFunc = tmpErrFunc; return false; } if (editor && !isEmpty(value) && !editor.validateValue(value)) { errFunc = tmpErrFunc; return false; } }); if (typeof errFunc === 'function') { err = "1"; _$2.remove(rows, function (n) { return true; }); //@ts-ignore errFunc(); // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc) return false; } else { if (_$2.findIndex(newRecords, function (item) { return item === record; }) >= 0) { newRows.push(record.data); } else { modifyRows.push(record.data); } rows.push(record.data); } }); return { rows: rows, newRows: newRows, modifyRows: modifyRows, removeRecords: removeRecords, err: err }; } // reload() { // dataSourceReload(this) // }, }); } /** * 获取 columns 中所有的 dataIndex */ function getFileds(newConfig) { var fields = []; _$2.forEach(newConfig.columns, function (c) { if (c.dataIndex) { fields.push(c.dataIndex); } }); return fields; } function convertDataSource$1(sender, scope, newConfig) { if (typeof newConfig.store !== 'undefined') { // 有 store 属性的情况下,不做任何事 return; } if (typeof newConfig.dataSource === 'undefined') { // 没有定义 dataSource 的情况下,不做任何事 return; } if (_$2.isArray(newConfig.data)) { // 有 data 属性赋值的情况下 newConfig.store = { fields: getFileds(newConfig), data: newConfig.data }; delete newConfig.data; return; } var dataSource = newConfig.dataSource; if (typeof dataSource === 'string') { // dataSource 是字符串的情况下,找到成员函数 dataSource = lookupFn(scope, dataSource); } if (typeof dataSource === 'function') { // dataSource 是函数的情况下,在 afterrender 之后进行回调 newConfig.store = new Ext.data.Store({ fields: getFileds(newConfig), // data: [], autoLoad: true, proxy: { type: 'memory', data: [], } }); newConfig.dataSourceCallbackFn = dataSource; return; } // throw new TypeError('无法识别的调用方法') } //# sourceMappingURL=grid.js.map function initTextfield () { var cc = Ext.form.field.Text.prototype.constructor; var initComponent = Ext.form.field.Text.prototype.initComponent; Ext.form.field.Text.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 triggers: { clear: { weight: -1, cls: Ext.baseCSSPrefix + 'form-clear-trigger', hidden: true, handler: 'onClearClick', }, } }, baseConfig(config, 'col-item'), config, text); if (config === null || config === void 0 ? void 0 : config.nextFocus) { newConfig.enableKeyEvents = true; } cc.call(this, newConfig); }, /** * 清空所有值 */ onClearClick: function (sender, e) { var me = this; me.setValue(''); }, /** * 尝试获取下一个要获取焦点的控件 */ _raiseNextFocus: function (sender) { var config = sender.config; var scope = lookupScope(sender); if (typeof config.nextFocus === 'function') { config.nextFocus(sender); } else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) { if (_$2.startsWith(config.nextFocus, 'scope.')) { var fn = lookupFn(scope, config.nextFocus); if (typeof fn === 'function') { var nextCtlReference = fn(sender); if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) { var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference]; if (ctl) { if (typeof ctl.focus2 === 'function') { ctl.focus2(); } else { ctl.focus(); } } } } } else { var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus]; if (ctl) { if (typeof ctl.focus2 === 'function') { ctl.focus2(); } else { ctl.focus(); } } } } }, initComponent: function () { /** * 改变必填项之前加星号 */ if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) { // this.beforeLabelTextTpl = [ // '*' // ]; this.afterLabelTextTpl = [ '*' ]; } var me = this; this.on({ change: function (sender, newVal) { var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear; if (hideTrigger || disabled || readOnly || hideClear) { // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮 return; } var value = newVal; if (value) { me.getTrigger('clear').show(); me.updateLayout(); } else { me.getTrigger('clear').hide(); me.updateLayout(); } }, afterrender: function (sender) { var _this = this; var _a; if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) { sender.inputEl.dom.setAttribute('spellcheck', "false"); $$2(sender.inputEl.dom).on('click', function (e) { sender.fireEvent('click', _this, e); }); $$2(sender.inputEl.dom).on('keydown', function (e) { var _a, _b, _c, _d; // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑 if (e.code === "ArrowDown" || e.code === 'ArrowUp') { if (sender.isExpanded === true) { // 弹开下拉框的基础上,不干预上下选择 return; } if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') { var grid = sender.ownerCt.up('grid'); var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin; if (editingPlugin) { var rowIdx = (_c = (_b = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.rowIdx; var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column; if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') { // editingPlugin var targetRecord = void 0; if (e.code === 'ArrowDown') { targetRecord = grid.store.data.getAt(rowIdx + 1); } else { targetRecord = grid.store.data.getAt(rowIdx - 1); } if (targetRecord) { grid.setSelection([targetRecord]); editingPlugin.startEdit(targetRecord, column); } e.stopPropagation(); e.preventDefault(); } } } } }); } var config = sender.config; if (config.ff && config.ff > 0) { setTimeout(function () { if (typeof sender.focus2 === 'function') { sender.focus2(); } else { sender.focus(); } }, config.ff); } } }); var config = this.config; if (config === null || config === void 0 ? void 0 : config.nextFocus) { this.on({ keyup: function (sender, e) { if ([10, 13, 20, 40].includes(e.keyCode)) { sender._raiseNextFocus(sender); } } }); } var that = this; this.on({ keyup: function (sender, e, eOpts) { if (![10, 13, 20, 40].includes(e.keyCode)) { return; } that.keydown_fun_item(sender, e, eOpts); } }); initComponent.call(this); }, keydown_fun_item: _$2.debounce(function (sender, event, eOpts) { var that = sender; if ([10, 13, 20, 40].includes(event.keyCode)) { // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值 var value = _$2.trim(sender.rawValue); var r = that.fireEvent('scancode', that, value, event); if (r === 'OK') { // 停止事件的默认处理程序,停止事件的冒泡 // event.stopEvent(); event.preventDefault(); event.stopPropagation(); } } }, 100) }); } //# sourceMappingURL=textfield.js.map function initTbFill () { /** * */ var ct = Ext.toolbar.Fill.prototype.constructor; Ext.toolbar.Fill.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill); ct.call(this, newConfig); } }); } //# sourceMappingURL=tbfill.js.map function initTbSeparator () { /** * */ var ct = Ext.toolbar.Separator.prototype.constructor; Ext.toolbar.Separator.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator); ct.call(this, newConfig); } }); } //# sourceMappingURL=tbseparator.js.map function initToolbar () { /** * */ var ct = Ext.toolbar.Toolbar.prototype.constructor; Ext.toolbar.Toolbar.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制性属性 }, baseConfig(config, 'cols-container'), config, toolbar); ct.call(this, newConfig); } }); initTbFill(); initTbSeparator(); } //# sourceMappingURL=toolbar.js.map function initSplitter () { var ct = Ext.resizer.Splitter.prototype.constructor; Ext.resizer.Splitter.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter); ct.call(this, newConfig); } }); } //# sourceMappingURL=splitter.js.map /** * 通用 dataSource 解析, * Tree/Combo/Grid/PageList ... 都会从这里解析 */ function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) { var config = ctl.config; return new Promise(function (resolve, reject) { if (!config.dataSource) { // 没有设置数据源,直接置空 return Promise.resolve(); } var option = { extraParam: extraParam, _successCb: _successCb, successCallback: function (value) { if (typeof successCallback === "function") { successCallback(value); } else { ctl.setData(value); } ctl.fireEvent('dataLoadComplete', ctl, true, value); ctl.setLoading(false); resolve(value); }, failCallback: function (error) { if (typeof failCallback === "function") { failCallback(error); } ctl.fireEvent('dataLoadComplete', ctl, false); ctl.setLoading(false); reject(error); } }; // 请求前要求确认一下 var isCanceled = false; ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () { isCanceled = true; } }, option)); if (!isCanceled) { // 请求没有被取消 // 调用异步接口返回 Promise return _innerReload(ctl, option); } return reject(); }); } function _innerReload(ctl, option) { var config = ctl.config; ctl.setLoading(true); var scope = lookupScope(ctl); var dataSource = config.dataSource; if (typeof dataSource == 'string') { dataSource = lookupFn(scope, config.dataSource); } if (typeof dataSource === 'function') { // @ts-ignore dataSource.call(scope, ctl, option); return; } else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') { if (!ajax.func) { console.error("没有配置 ajax"); return; } var params_1 = {}; var sortModel = null; var filterModel = null; if (option.extraParam && option.extraParam.filterModel) { filterModel = option.extraParam.filterModel; } if (option.extraParam && option.extraParam.sortModel) { sortModel = option.extraParam.sortModel; } _$2.forOwn(option.extraParam, function (v, key) { if (key != "filterModel" && key != "sortModel") { if (typeof v === 'function') { params_1[key] = v(); } else { params_1[key] = v; } } }); var ds = dataSource; _$2.forOwn(ds.params, function (v, key) { if (typeof v === 'function') { params_1[key] = v(); } else { params_1[key] = v; } }); if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') { // @ts-ignore ajax.func({ method: dataSource.method, url: ds.url, data: params_1, filterModel: filterModel, sortModel: sortModel, }).then(function (res) { if (res.success) { option.successCallback(res.data); } else { option.failCallback(res.msg); } }).catch(function (e) { option.failCallback(e); }); } else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') { var ds_1 = ctl.dataSource; // @ts-ignore Extend.ajax.func({ url: ds_1.sqlId, data: params_1, db: ds_1.db, method: 'sql', filterModel: filterModel, sortModel: sortModel, }).then(function (res) { if (res.success) { option.successCallback(res.data); } else { option.failCallback(res.msg); } }).catch(function (e) { option.failCallback(e); }).finally(function () { ctl.loading = false; }); return; } else { console.error("非法的 dataSource", ctl.dataSource); debugger; throw new Error("非法的 dataSource"); } } } //# sourceMappingURL=DataSourceHelper.js.map function initCombo () { var cc = Ext.form.field.ComboBox.prototype.constructor; var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore; Ext.form.field.ComboBox.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制性属性 }, baseConfig(config, 'col-item'), config, combo); if (typeof config.dict === 'string') { window['yvanLib'].system.getDict(config.dict)(this, newConfig); } else if (typeof newConfig.store == 'undefined') { if (_$2.isArray(newConfig.data)) { // ExtJS 无法直接接受数组模式 newConfig.store = { fields: [newConfig.valueField, newConfig.displayField], data: newConfig.data }; delete newConfig.data; } else if (typeof newConfig.data !== 'object') { newConfig.store = { fields: [newConfig.valueField, newConfig.displayField], data: [] }; delete newConfig.data; } } cc.call(this, newConfig); }, setDict: function (bizKey) { window['yvanLib'].system.getDict(bizKey)(this, this.config); this.dict = bizKey; }, getDict: function () { return this.dict; }, setData: function (value) { if (!value) { return; } var config = value.config; if (!this.store) { this.store = new Ext.data.Store({ fields: [config.valueField, config.displayField], data: value }); } else { this.store.getProxy().setData(value); this.store.load(); } }, setLoading: function (value) { if (value) { if (!this.loadMask) { this.loadMask = new Ext.LoadMask(this, { msg: "loading..." }); } } else { if (this.loadMask) { this.loadMask.destroy(); delete this.loadMask; } } }, reload: function () { dataSourceReload(this); }, initComponent: function () { var that = this; var toggle = function (e) { var readOnly = that.readOnly, disabled = that.disabled; if (readOnly || disabled) { return; } if ($(e.target).is('.x-form-trigger')) { return; } // 点击后下拉 if (that.isExpanded) { that.collapse(); } else { that.expand(); that.doQuery(that.allQuery, true); } }; this.on({ afterrender: function (sender) { var config = this.config; if (config.dataSource && config.autoLoad) { dataSourceReload(this); } // 点击后下拉 $(this.el.dom).on('click', toggle.bind(this)); }, focusenter: function (sender, event, opt) { var _a; if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') { // 表格内编辑框,获取焦点后自动弹开 toggle.call(this, event); } }, destory: function () { $(this.el.dom).off('click', toggle.bind(this)); }, beforequery: function (context) { var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo; // console.log('beforequery', query) if (!forceAll && query) { combo.store.clearFilter(); combo.store.filterBy(function (record, id) { var text = record.get(combo.displayField); // 用拼音筛选的方式 return keywordFilter(query, text, id); }); combo.expand(); return false; } combo.store.clearFilter(); combo.expand(); return false; }, }); initComponent.call(this); }, focus2: function () { this.focus(); var that = this; _$2.defer(function () { if (that.isExpanded) { that.collapse(); } else { that.expand(); that.doQuery(that.allQuery, true); } }); } }); } //# sourceMappingURL=combo.js.map /** xtype: 'tagfield', displayField: 'show', valueField: 'id', queryMode: 'local', filterPickList: true, store: { fields: ['id', 'show'], data: [ {id: 0, show: 'Battlestar Galactica'}, {id: 1, show: 'Doctor Who'}, {id: 2, show: 'Farscape'}, {id: 3, show: 'Firefly'}, {id: 4, show: 'Star Trek'}, {id: 5, show: 'Star Wars: Christmas Special'} ] } */ function initTag () { var cc = Ext.form.field.Tag.prototype.constructor; var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore; Ext.form.field.Tag.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制性属性 }, baseConfig(config, 'col-item'), config, tagfield); if (typeof config.dict === 'string') { window['yvanLib'].system.getDict(config.dict)(this, newConfig); } else if (typeof newConfig.store == 'undefined') { if (_$2.isArray(newConfig.data)) { // ExtJS 无法直接接受数组模式 newConfig.store = { fields: [newConfig.valueField, newConfig.displayField], data: newConfig.data }; delete newConfig.data; } else if (typeof newConfig.data !== 'object') { newConfig.store = { fields: [newConfig.valueField, newConfig.displayField], data: [] }; delete newConfig.data; } } cc.call(this, newConfig); }, setDict: function (bizKey) { window['yvanLib'].system.getDict(bizKey)(this, this.config); this.dict = bizKey; }, getDict: function () { return this.dict; }, setData: function (value) { if (!value) { return; } var config = value.config; if (!this.store) { this.store = new Ext.data.Store({ fields: [config.valueField, config.displayField], data: value }); } else { this.store.getProxy().setData(value); this.store.load(); } }, setLoading: function (value) { if (value) { if (!this.loadMask) { this.loadMask = new Ext.LoadMask(this, { msg: "loading..." }); } } else { if (this.loadMask) { this.loadMask.destroy(); delete this.loadMask; } } }, reload: function () { dataSourceReload(this); }, initComponent: function () { var that = this; var toggle = function (e) { var readOnly = that.readOnly, disabled = that.disabled; if (readOnly || disabled) { return; } if ($(e.target).is('.x-form-trigger')) { return; } // 点击后下拉 if (that.isExpanded) { that.collapse(); } else { that.expand(); that.doQuery(that.allQuery, true); } }; this.on({ afterrender: function (sender) { var config = this.config; if (config.dataSource && config.autoLoad) { dataSourceReload(this); } // 点击后下拉 $(this.el.dom).on('click', toggle.bind(this)); }, focusenter: function (sender, event, opt) { var _a; if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') { // 表格内编辑框,获取焦点后自动弹开 toggle.call(this, event); } }, destory: function () { $(this.el.dom).off('click', toggle.bind(this)); }, }); initComponent.call(this); }, focus2: function () { this.focus(); var that = this; _$2.defer(function () { if (that.isExpanded) { that.collapse(); } else { that.expand(); that.doQuery(that.allQuery, true); } }); } }); } //# sourceMappingURL=tagfield.js.map function initComboGridMulti () { Ext.define('Yvan.LocalComboGrid', { extend: 'Ext.form.field.Picker', // extend: 'Yvan.PickerAlignCenter', xtype: 'combogridmulti', triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger', config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }), editable: false, initComponent: function () { this.on({ afterrender: function () { var config = this.config; if (config.dataSource && config.autoLoad) { dataSourceReload(this); } }, }); this.superclass.initComponent.apply(this, arguments); }, setStore: function (store) { this.store = store; var me = this; if (me.store) { if (me.picker) { me.picker.setStore(store); if (me.isExpanded) { me.collapse(); delete me.picker; me.expand(); } } this.onLoad(); me.mon(me.store, { scope: me, load: me.onLoad, update: me.onUpdate }); } }, reload: function () { dataSourceReload(this); }, setData: function (value) { var me = this; var config = me.config; if (!value) { return; } if (!this.store) { this.store = new Ext.data.Store({ fields: [config.valueField, config.displayField], data: value }); } else { this.store.getProxy().setData(value); this.store.load(); } this.onLoad(); }, createPicker: function () { var me = this; var picker = new Ext.grid.Panel(__assign(__assign({}, comboGridMultiPicker), { border: false, baseCls: Ext.baseCSSPrefix + 'boundlist', shrinkWrapDock: 2, store: me.store, floating: true, displayField: me.displayField, columns: me.columns, minHeight: me.minPickerHeight, maxHeight: me.maxPickerHeight, minWidth: me.minPickerWidth, manageHeight: false, shadow: false, scrollable: true, listeners: { scope: me, selectionchange: me.onSelectionChange, itemkeydown: me.onPickerKeyDown } })), view = picker.getView(); if (Ext.isIE9 && Ext.isStrict) { view.on({ scope: me, highlightitem: me.repaintPickerView, unhighlightitem: me.repaintPickerView, afteritemexpand: me.repaintPickerView, afteritemcollapse: me.repaintPickerView }); } return picker; }, repaintPickerView: function () { var style = this.picker.getView().getEl().dom.style; style.display = style.display; }, onSelectionChange: function (view, record, node, rowIndex, e) { this.selectItem(view, record); }, onPickerKeyDown: function (treeView, record, item, index, e) { var key = e.getKey(); if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) { this.selectItem(treeView, record); } }, selectItem: function (sender, record) { var me = this; var ids = []; _$2.forEach(me.picker.getSelection(), function (record) { ids.push(record.get(me.valueField)); }); me.fireEvent('select', me, record); me.setValue(ids.join(me.splitChar)); // me.collapse(); }, onExpand: function () { var me = this; var picker = this.picker; var value = this.value; if (!me.store) { msg('正在初始化数据,请稍后'); me.collapse(); return; } var vs = _$2.split(value, me.splitChar); var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; }); picker.setSelection(records); }, setValue: function (value) { var me = this; console.log('setValue', value); me.value = value; if (!me.store || me.store.loading) { // Called while the Store is loading. Ensure it is processed by the onLoad method. return me.mixins.field.setValue.call(me, value); // return me; } var vs = _$2.split(value, me.splitChar); var displayValues = []; _$2.forEach(vs, function (v) { var _a; var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; }); var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField); if (dv) { displayValues.push(dv); } else { displayValues.push(v); } }); // set the raw value to the record's display field if a record was found me.setRawValue(displayValues.join(me.splitChar)); return me.mixins.field.setValue.call(me, value); }, getSubmitValue: function () { return this.value; }, getValue: function () { return this.value; }, onLoad: function () { var value = this.value; if (value) { this.setValue(value); } }, onUpdate: function (store, rec, type, modifiedFieldNames) { var display = this.displayField; var me = this; if (type === 'edit' && modifiedFieldNames && Ext.Array.contains(modifiedFieldNames, display) && this.value === rec.getId()) { me.mixins.field.setValue.call(me, this.value); this.setRawValue(rec.get(display)); } } }); } //# sourceMappingURL=combogridmulti.js.map function initSearch () { Ext.define('Yvan.Search', { extend: 'Ext.form.field.Text', alias: 'widget.searchfield', xtype: 'searchfield', constructor: function (config) { var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 triggers: { clear: { weight: 0, cls: Ext.baseCSSPrefix + 'form-clear-trigger', hidden: true, handler: 'onClearClick', }, search: { weight: 1, cls: Ext.baseCSSPrefix + 'form-search-trigger', handler: 'onSearchClick' }, }, listeners: { blur: function (sender, e) { this.revertOnblur(); }, specialkey: function (sender, e) { var _a; var me = this; if (e.getKey() === e.ENTER) { me.onSearchClick(sender, {}, e); return; } invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e); }, afterrender: function (sender, e) { var _a; this.replaceRawInputEvent(); invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e); } }, }, baseConfig(config, 'col-item'), config, search); this.superclass.constructor.call(self, newConfig); }, revertOnblur: function () { this.setRawValue(this.lastValue); }, onSearchClick: function (sender, vv, e) { var me = this; var config = me.config; var widget = config.widget, vjson = config.vjson, lookup = config.lookup; if (e) { e.preventDefault(); e.stopPropagation(); } this.fireEvent('search', sender, e); if (!widget) { return; } showWidget(widget, lookup, sender, me.getRawValue(), vjson); }, replaceRawInputEvent: function () { var me = this; var $dom = $(me.inputEl.dom); $dom.on('input', function (e) { stopEvent(e); // console.log('has input', e) }); $dom.on('keyup', function (e) { if (e.key === "Enter") { me.onSearchClick(me, {}, e); return; } stopEvent(e); }); $dom.on('change', function (e) { 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); } }); } //# sourceMappingURL=search.js.map function initMultipleSearch () { Ext.define('Yvan.MultipleSearch', { extend: 'Ext.form.field.Text', xtype: 'multiplesearch', bindTargert: '', constructor: function (config) { var _a, _b, _c, _d; var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 triggers: { clear: { weight: 0, cls: Ext.baseCSSPrefix + 'form-clear-trigger', hidden: true, handler: 'onClearClick', } }, transformRawValue: function (o) { return o; }, listeners: { specialkey: function (sender, e) { var me = this; if (e.getKey() === e.ENTER) { me.fireEvent('search', me, e); } }, afterrender: function (sender, e) { var _a; this.replaceRawInputEvent(); invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, 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 = _$2.replace(vv, "{", ""); vv = _$2.replace(vv, "}", ""); this.bindTargert = vv; this.bindTargert = _$2.trim(this.bindTargert); }, setBindValue: function (arrValue) { if (this.bindTargert) { this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue); } }, replaceRawInputEvent: function () { var me = this; var $dom = $(me.inputEl.dom); $dom.on('input', function (e) { var _a, _b, _c, _d, _e, _f; if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) { var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value); if (!a.endsWith(",") && a.length > 0) { e.currentTarget.value = a + ","; } else { e.currentTarget.value = a; } } e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ","); var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(","); _$2.remove(arr, function (it) { return !it; }); me.setBindValue(arr); stopEvent(e); }); $dom.on('keyup', function (e) { me.fireEvent('keyup', me, e); // invokeMethod(me.config.listeners?.keyup, me, e) stopEvent(e); }); $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; // @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.currentTarget) === 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] = _$2.trim(arr[i]); } } _$2.remove(arr, function (it) { return !it; }); me.setBindValue(arr); 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); } }); } //# sourceMappingURL=multiplesearch.js.map function initDate () { var cc = Ext.form.field.Date.prototype.constructor; var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw; Ext.form.field.Date.override({ format: 'Y-m-d', altFormats: 'Y-m-d', constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, date); cc.call(this, newConfig); }, getValue: function () { var ov = getValue.call(this); var nv = Ext.util.Format.date(ov, 'Y-m-d'); // console.log('cc:', nv, ov) return nv; }, // focus2() { // const that = this // if (that.isExpanded) { // that.collapse() // // } else { // that.expand(); // } // _.defer(() => { // that.focus() // }) // }, initComponent: function () { this.on({ afterrender: function () { var config = this.config; // 日期框,不要默认弹出 // $(this.el.dom).on('click', toggle.bind(this)) }, destory: function () { // 日期框,不要默认弹出 // $(this.el.dom).off('click', toggle.bind(this)) }, change: { fn: function (sender) { if (sender.format === 'Y-m-d') { // 年月日格式 var value = sender.getRawValue(); if (/^\d{8}$/.test(value)) { // 8位数字,自动转换为 YYYY-MM-DD var newValue = [ value.substr(0, 4), value.substr(4, 2), value.substr(6, 2) ].join('-'); sender.setValue(newValue); } } }, } // focus: { // // 获得焦点后自动下拉 // fn(sender) { // sender.expand(); // this.doQuery(this.allQuery, true); // }, // }, }); initComponent.call(this); }, createInitialDate: function (value) { var minValue = this.minValue, maxValue = this.maxValue; value = value || syncDate(new Date()); if (minValue && minValue > value) { value = minValue; } else if (maxValue && maxValue < value) { value = maxValue; } return value; }, }); } //# sourceMappingURL=datefield.js.map function initDateTimePicker () { Ext.define('Yvan.DateTimePicker', { extend: 'Ext.picker.Date', alias: 'datetimepicker', alternateClassName: 'Ext.DateTimePicker', renderTpl: [ '', { firstInitial: function (value) { return Ext.picker.Date.prototype.getDayInitial(value); }, isEndOfWeek: function (value) { // convert from 1 based index to 0 based // by decrementing value once. value--; // eslint-disable-next-line vars-on-top var end = value % 7 === 0 && value !== 0; return end ? '' : ''; }, renderTodayBtn: function (values, out) { Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out); }, renderMonthBtn: function (values, out) { Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out); } } ], beforeRender: function () { var me = this, today = Ext.Date.format(syncDate(new Date()), me.format); this.superclass.beforeRender.call(this); function handleInput(extHandle, $input) { var $dom = $(extHandle.el.dom); // const $up = $dom.find('.x-form-spinner-up') // const $down = $dom.find('.x-form-spinner-down') // debugger // $up.on('mousedown', () => { // debugger // }); // $up.on('click', () => { // debugger // }); extHandle.on('click', function (sender) { var hideBak = me.hide; me.hide = Ext.emptyFn; extHandle.focus(); me.hide = hideBak; }); var changeValue = function (delta) { if (_$2.trim(extHandle.getValue()) === '') { extHandle.setValue(extHandle.minValue); } else { var v = parseInt('' + extHandle.getValue()); if (v + delta > extHandle.maxValue) { extHandle.setValue(extHandle.minValue); } else if (v + delta < extHandle.minValue) { extHandle.setValue(extHandle.maxValue); } else { extHandle.setValue(v + delta); } } }; $input.on('mousewheel', function (e) { e.stopPropagation(); var event = e.originalEvent; var eventDelta = event.wheelDelta || -event.deltaY + 40; // if (event.wheelDelta) { // delta = event.wheelDelta / 120; // } else if (event.detail) { // delta = -event.detail / 3; // } var zoomSize = Math.ceil(eventDelta / 120); changeValue(zoomSize); // console.log('delta', delta) // $input.focus() }); } me.input1 = Ext.create('Ext.form.field.Number', { minValue: 0, maxValue: 23, flex: 1, enableKeyEvents: true, fieldLabel: '时', labelWidth: 20, hideLabel: true, spinDownEnabled: false, spinUpEnabled: false, style: { marginLeft: '5px', }, listeners: { afterrender: function (sender) { var $input = $(sender.inputEl.dom); handleInput(me.input1, $input); }, change: function (sender, e) { if (me.getValue()) { me.value.setHours(sender.getValue()); } }, } }); me.input2 = Ext.create('Ext.form.field.Number', { minValue: 0, maxValue: 59, flex: 1, enableKeyEvents: true, fieldLabel: ' ', hideLabel: false, labelWidth: 8, spinDownEnabled: false, spinUpEnabled: false, listeners: { afterrender: function (sender) { var $input = $(sender.inputEl.dom); handleInput(me.input2, $input); }, change: function (sender, e) { if (me.getValue()) { me.value.setMinutes(sender.getValue()); } }, } }); me.input3 = Ext.create('Ext.form.field.Number', { minValue: 0, maxValue: 59, flex: 1, enableKeyEvents: true, fieldLabel: ' ', hideLabel: false, labelWidth: 8, spinDownEnabled: false, spinUpEnabled: false, style: { marginRight: '5px', }, listeners: { afterrender: function (sender) { var $input = $(sender.inputEl.dom); handleInput(me.input3, $input); }, change: function (sender, e) { if (me.getValue()) { me.value.setSeconds(sender.getValue()); } }, } }); me.confirmBtn = new Ext.button.Button({ text: '确认', handler: me.confirmClick, scope: me }); me.tdBtn = new Ext.button.Button({ text: '现在', handler: me.selectToday, scope: me }); me.todayBtn = Ext.create('Ext.container.Container', { layout: 'anchor', border: false, defaults: { border: false, anchor: '100%', margin: '0 0 5 0', }, items: [ { layout: 'hbox', items: [ me.input1, me.input2, me.input3, ] }, { layout: 'hbox', items: [ me.confirmBtn, me.tdBtn, ] } ] }); }, // finishRenderChildren() { // var me = this; // // this.superclass.finishRenderChildren.call(this); // //* // me.input1.finishRender(); // me.input2.finishRender(); // me.input3.finishRender(); // // // me.tdBtn.finishRender(); // me.confirmBtn.finishRender(); // }, setValue: function (value) { //this.value = Ext.Date.clearTime(value, true); this.value = value; this.input1.setValue(this.value.getHours()); this.input2.setValue(this.value.getMinutes()); this.input3.setValue(this.value.getSeconds()); return this.update(this.value); }, selectDate: function (value) { if (this.showTime) { value.setHours(this.input1.getValue()); value.setMinutes(this.input2.getValue()); value.setSeconds(this.input3.getValue()); } this.value = value; return this.update(this.value); }, setDisabledStatus: function (disabled) { var me = this; debugger; // me.callParent(); if (me.showTime) { me.confirmBtn.setDisabled(disabled); } if (me.isShowFooter()) { me.footerContainer.setDisabled(disabled); } }, handleDateClick: function (e, t) { var me = this, handler = me.handler; // e.stopEvent(); if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) { me.doCancelFocus = me.focusOnSelect === false; me.selectDate(new Date(t.dateValue)); delete me.doCancelFocus; /* 有时间输入时单击事件不退出选择,只移动光标 */ if (me.showTime) { return; } me.fireEvent('select', me, me.value); if (handler) { handler.call(me.scope || me, me, me.value); } me.onSelect(); } }, selectToday: function () { var me = this, btn = me.todayBtn, handler = me.handler; if (btn && !btn.disabled) { me.value = syncDate(new Date()); me.update(me.value); me.fireEvent('select', me, me.value); if (handler) { handler.call(me.scope || me, me, me.value); } me.onSelect(); me.hide(); } return me; }, confirmClick: function () { var me = this, btn = me.confirmBtn, handler = me.handler; if (btn && !btn.disabled) { me.fireEvent('select', me, me.value); if (handler) { handler.call(me.scope || me, me, me.value); } me.onSelect(); me.hide(); } return me; }, selectedUpdate: function (date) { var me = this, //t = date.getTime(), t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell; cells.removeCls(cls); for (c = 0; c < cLen; c++) { cell = Ext.fly(cellItems[c]); if (cell.dom.firstChild.dateValue == t) { me.fireEvent('highlightitem', me, cell); cell.addCls(cls); if (me.isVisible() && !me.doCancelFocus) { Ext.fly(cell.dom.firstChild).focus(50); } break; } } }, // private, inherit docs beforeDestroy: function () { var me = this; if (me.rendered) { Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn); } me.superclass.beforeDestroy.call(this); } }); } //# sourceMappingURL=datetimepicker.js.map function initDateTime () { Ext.define('Yvan.DateTimeField', { extend: 'Ext.form.field.Date', xtype: 'datetimefield', alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'], triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger', showTime: true, format: "Y-m-d H:i:s", constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, date); this.superclass.constructor.call(this, newConfig); }, initComponent: function () { this.superclass.initComponent.call(this); var setInitValue = function () { var value = this.getRawValue(); if (!value) { // 没填内容的时候,自动设置当前时间 this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format)); } }; this.on({ afterrender: function () { var config = this.config; // 日期框,不要默认弹出 $(this.el.dom).on('click', setInitValue.bind(this)); }, destory: function () { // 日期框,不要默认弹出 $(this.el.dom).off('click', setInitValue.bind(this)); }, change: { fn: function (sender) { if (sender.format === "Y-m-d H:i:s") { // 年月日格式 var value = sender.getRawValue(); if (/^\d{14}$/.test(value)) { // 8位数字,自动转换为 YYYY-MM-DD var newValue = [ value.substr(0, 4), '-', value.substr(4, 2), '-', value.substr(6, 2), ' ', value.substr(8, 2), ':', value.substr(10, 2), ':', value.substr(12, 2) ].join(''); sender.setValue(newValue); } } }, } }); }, getValue: function () { var ov = this.getRawValue(); //this.superclass.getValue.call(this) var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s'); // console.log('cc:', nv, ov) return nv; }, onExpand: function () { var strValue = this.getValue(); var value; if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) { value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)), parseInt(strValue.substr(11, 2)), parseInt(strValue.substr(14, 2)), parseInt(strValue.substr(17, 2))); } else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) { value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2))); } else { value = syncDate(new Date()); } this.picker.setValue(value); }, createPicker: function () { var me = this, format = Ext.String.format; //@ts-ignore return new Yvan.DateTimePicker({ pickerField: me, ownerCt: me.ownerCt, renderTo: document.body, floating: true, hidden: true, focusOnShow: true, minDate: me.minValue, maxDate: me.maxValue, disabledDatesRE: me.disabledDatesRE, disabledDatesText: me.disabledDatesText, disabledDays: me.disabledDays, disabledDaysText: me.disabledDaysText, format: me.format, showToday: me.showToday, showTime: me.showTime, startDay: me.startDay, minText: format(me.minText, me.formatDate(me.minValue)), maxText: format(me.maxText, me.formatDate(me.maxValue)), listeners: { scope: me, select: me.onSelect }, keyNavConfig: { esc: function () { me.collapse(); } } }); }, }); } //# sourceMappingURL=datetimefield.js.map function initNumber () { var cc = Ext.form.field.Number.prototype.constructor; var initComponent = Ext.form.field.Number.prototype.initComponent; Ext.form.field.Number.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, numberfield); cc.call(this, newConfig); }, initComponent: function () { this.on({ afterrender: function (sender) { var _this = this; var _a; if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) { sender.inputEl.dom.setAttribute('spellcheck', "false"); $$2(sender.inputEl.dom).on('click', function (e) { sender.fireEvent('click', _this, e); }); } } }); initComponent.call(this); }, }); } //# sourceMappingURL=numberfield.js.map function initCheckbox () { var cc = Ext.form.field.Checkbox.prototype.constructor; var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue; Ext.form.field.Checkbox.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, checkbox); cc.call(this, newConfig); }, getValue: function () { var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue; var ov = getValue.call(this); // const ov = this.getRawValue() return (ov ? checkedValue : uncheckedValue); }, setValue: function (nv) { var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue; var value; if (nv === checkedValue) { value = true; } else if (nv === uncheckedValue) { value = false; } else { value = !!nv; } // me.setRawValue(value) // me.checked = value // return me.mixins.field.setValue.call(me, value); setValue.call(this, value); }, updateCheckedCls: function (checked) { var me = this; var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue; checked = checked != null ? checked : me.getValue(); if (checked === uncheckedValue) { checked = false; } else if (checked === checkedValue) { checked = true; } me[checked ? 'addCls' : 'removeCls'](me.checkedCls); }, initComponent: function () { initComponent.call(this); }, }); } //# sourceMappingURL=checkbox.js.map function initCheckboxGroup () { var cc = Ext.form.CheckboxGroup.prototype.constructor; var initComponent = Ext.form.CheckboxGroup.prototype.initComponent; Ext.form.CheckboxGroup.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, checkboxgroup); cc.call(this, newConfig); }, initComponent: function () { initComponent.call(this); }, }); } //# sourceMappingURL=checkboxgroup.js.map function initRadio () { var cc = Ext.form.field.Radio.prototype.constructor; var initComponent = Ext.form.field.Radio.prototype.initComponent; Ext.form.field.Radio.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, radio); cc.call(this, newConfig); }, initComponent: function () { initComponent.call(this); }, }); } //# sourceMappingURL=radio.js.map function initRadioGroup () { var cc = Ext.form.RadioGroup.prototype.constructor; var initComponent = Ext.form.RadioGroup.prototype.initComponent; Ext.form.RadioGroup.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({ // 强制属性 }, baseConfig(config, 'col-item'), config, radiogroup); cc.call(this, newConfig); }, initComponent: function () { initComponent.call(this); }, }); } //# sourceMappingURL=radiogroup.js.map function initFieldset () { /** * */ var ct = Ext.form.FieldSet.prototype.constructor; Ext.form.FieldSet.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet); ct.call(this, newConfig); } }); } //# sourceMappingURL=fieldset.js.map function initCombotree () { Ext.define('Yvan.ComboTree', { extend: 'Ext.form.field.Picker', xtype: 'combotree', triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger', config: { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true, }, editable: false, setStore: function (store) { this.store = store; var me = this; if (me.store) { if (me.picker) { me.picker.setStore(store); if (me.isExpanded) { me.collapse(); delete me.picker; me.expand(); } } this.onLoad(); me.mon(me.store, { scope: me, load: me.onLoad, update: me.onUpdate }); } }, createPicker: function () { var me = this; var picker = new Ext.tree.Panel({ border: false, baseCls: Ext.baseCSSPrefix + 'boundlist', shrinkWrapDock: 2, store: me.store, floating: true, rootVisible: me.rootVisible, displayField: me.displayField, columns: me.columns, minHeight: me.minPickerHeight, maxHeight: me.maxPickerHeight, minWidth: me.minPickerWidth, manageHeight: false, shadow: false, scrollable: true, // modal: true, // constrain: true, // constrainTo: topScope._handle.el.dom, // renderTo: topScope._handle.el.dom, // alignTarget: topScope._handle, listeners: { scope: me, itemclick: me.onItemClick, itemkeydown: me.onPickerKeyDown } }), view = picker.getView(); if (Ext.isIE9 && Ext.isStrict) { view.on({ scope: me, highlightitem: me.repaintPickerView, unhighlightitem: me.repaintPickerView, afteritemexpand: me.repaintPickerView, afteritemcollapse: me.repaintPickerView }); } return picker; }, repaintPickerView: function () { var style = this.picker.getView().getEl().dom.style; style.display = style.display; }, onItemClick: function (view, record, node, rowIndex, e) { this.selectItem(view, record); }, onPickerKeyDown: function (treeView, record, item, index, e) { var key = e.getKey(); if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) { this.selectItem(treeView, record); } }, selectItem: function (sender, record) { var me = this; me.setValue(record.getId()); me.fireEvent('select', me, record); me.collapse(); }, onExpand: function () { var picker = this.picker; var store = picker.store; var value = this.value; var node; if (value) { node = store.getNodeById(value); } if (!node) { node = store.getRoot(); } picker.ensureVisible(node, { select: true, focus: true }); }, setValue: function (value) { var me = this; console.log('setValue', value); me.value = value; if (!me.store || me.store.loading) { // Called while the Store is loading. Ensure it is processed by the onLoad method. return me.mixins.field.setValue.call(me, value); // return me; } var record = value ? me.store.getNodeById(value) : me.store.getRoot(); if (value === undefined) { record = me.store.getRoot(); console.log('setValue', record.getId()); me.value = record.getId(); return me.mixins.field.setValue.call(me, value); } else { record = me.store.getNodeById(value); } // set the raw value to the record's display field if a record was found me.setRawValue(record ? record.get(me.displayField) : ''); return me.mixins.field.setValue.call(me, value); }, getSubmitValue: function () { return this.value; }, getValue: function () { return this.value; }, onLoad: function () { var value = this.value; if (value) { this.setValue(value); } }, onUpdate: function (store, rec, type, modifiedFieldNames) { var display = this.displayField; var me = this; if (type === 'edit' && modifiedFieldNames && Ext.Array.contains(modifiedFieldNames, display) && this.value === rec.getId()) { me.mixins.field.setValue.call(me, this.value); this.setRawValue(rec.get(display)); } } }); } //# sourceMappingURL=combotree.js.map function initPickerPlus () { Ext.define('Yvan.PickerAlignCenter', { extend: 'Ext.form.field.Picker', /** * Performs the alignment on the picker using the class defaults * @private */ doAlign: function () { // 不要挪动就好 }, }); } //# sourceMappingURL=pickerplus.js.map function initCombogrid () { Ext.define('Yvan.ComboGrid', { extend: 'Ext.form.field.Picker', // extend: 'Yvan.PickerAlignCenter', xtype: 'combogrid', triggerCls: Ext.baseCSSPrefix + 'form-search-trigger', triggers: { clear: { weight: 0, cls: Ext.baseCSSPrefix + 'form-clear-trigger', hidden: true, handler: 'onClearClick', }, }, config: __assign({}, comboGrid), editable: true, _superBlur: false, allowCustomInput: false, pressEnterPopup: true, initComponent: function () { var that = this; var scope = lookupScope(that); var config = that.config; if (isDesignMode(scope, config)) { this.superclass.initComponent.call(this, arguments); return; } this.on({ blur: function (sender, e) { if (this._superBlur) { // 挂起时不恢复内容 return; } // 离开焦点时,恢复原来的值 sender.setRawValue(sender.value); }, afterrender: function (sender) { var $dom = $(sender.inputEl.dom); that.scope = lookupScope(sender); if (sender.column) { // 列模式,拦截 keydown $dom.on('keydown', function (e) { if (isChartEvent(e) && !that.tryEnable()) { // 没有达成 editEnable 条件,不用响应 stopEvent(e); return; } if (that.pressEnterPopup !== false && e.key === 'Enter') { stopEvent(e); that.onTriggerClick(that, that.getPickerTrigger(), e); return; } }); } else { // 常规模式,拦截 keyup $dom.on('keyup', function (e) { if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') { return; } if (isChartEvent(e) && !that.tryEnable()) { // 没有达成 editEnable 条件,不用响应 stopEvent(e); return; } if (that.pressEnterPopup !== false && e.key === 'Enter') { stopEvent(e); that.onTriggerClick(that, that.getPickerTrigger(), e); return; } if (!that.allowCustomInput) { // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中 stopEvent(e); } }); $dom.on('change', function (e) { // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效 // if (that.isExpanded) { // that.filterChange(that, e.target.value) // } stopEvent(e); }); } $dom.on('input', function (e) { stopEvent(e); }); }, }); this.superclass.initComponent.apply(this, arguments); }, createPicker: function () { var me = this; var cfg = { layout: 'fit', border: 0, // border: 5, style: { // borderColor: 'black', // borderWidth: '5px', // borderStyle: 'solid', boxShadow: '0px 2px 5px rgba(0,0,0,.5)' }, shadow: 'side', shadowOffset: 100, baseCls: Ext.baseCSSPrefix + 'boundlist', shrinkWrapDock: 2, floating: true, width: me.pickerWidth, height: me.pickerHeight, minWidth: me.pickerWidth, minHeight: me.pickerHeight, maxWidth: me.pickerWidth, maxHeight: me.pickerHeight, items: [ __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: { xtype: 'toolbar', items: [ { xtype: 'textfield', fieldLabel: '筛选' }, { xtype: 'button', text: '查询', iconCls: 'x-fa fa-search', cssType: 'primary', listeners: { click: function () { me.reloadGrid(); } } }, ] }, autoLoad: false, listeners: { afterrender: function (grid) { me.grid = grid; grid.focus(); grid.on({ rowdblclick: function (sender, row) { me.selectItem(row); }, dataLoadComplete: function (sender) { _$2.defer(function () { me.setFocus(); }); }, keydown: function (sender, e) { if (me.column) { // 列模式,拦截 keydown me.processKey(e); } }, keyup: function (sender, e) { if (!me.column) { // 常规模式,拦截 keyup me.processKey(e); } } }); }, } }) ] }; // @ts-ignore var picker = new Ext.container.Container(cfg); return picker; }, setFocus: function () { if (this.grid.store.getCount() > 0) { this.grid.focusRow(0); } }, processKey: function (e) { if (this.pressEnterPopup !== false && e.key === 'Enter') { this.selectItem(this.grid.selection); stopEvent(e); } else if (e.key === 'Escape') { this.collapse(); } }, repaintPickerView: function () { var style = this.picker.getView().getEl().dom.style; style.display = style.display; }, onItemClick: function (view, record, node, rowIndex, e) { this.selectItem(record); }, onPickerKeyDown: function (treeView, record, item, index, e) { var key = e.getKey(); if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) { this.selectItem(record); } }, filterChange: _$2.debounce(function (sender, value) { sender.onExpand(); }, 1000), selectItem: function (record) { var me = this; var lookup = this.lookup; var scope = lookupScope(this); me.fireEvent('select', me, record); if (record.isModel) { record = record.data; } tryWriteObject(lookup, record, function (path, value) { me._lookupSet(path, value); }); // lookup // fromColumn: 'toTarget' // fromColumn: 'toTarget' // fromColumn: 'toTarget' _$2.forOwn(lookup, function (toTarget, fromColumn) { var value = _$2.get(record, fromColumn); me._lookupSet(toTarget, value); }); // 选定之后不能做清空 // const {lookupClearOnChange} = me // if (_.isArray(lookupClearOnChange)) { // _.each(lookupClearOnChange, item => { // me._lookupSet(item, '') // }) // } me.collapse(); // 触发 _raiseNextFocus me._raiseNextFocus(me); }, onExpand: function () { // 展开时,根据 lookup 带入查询参数 var expressData = this.getExpressData(); var txtField = this.grid.down('toolbar').down('textfield'); txtField.setValue(expressData.queryValue); this.reloadGrid(); }, reloadGrid: function () { // 展开时,根据 lookup 带入查询参数 var expressData = this.getExpressData(); var reloadParam = calcObjectFlat(expressData, this.param) || {}; var txtField = this.grid.down('toolbar').down('textfield'); // 每个 combogrid 默认带上 __queryValue 属性 reloadParam["__queryValue"] = txtField.getValue(); this.grid.reload(reloadParam); }, onTriggerClick: function (sender) { var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid; if (!grid) { msg('正在初始化,请稍后'); return; } if (!this.tryEnable()) { // 没有达成 editEnable 条件,不用弹出 return; } if (isExpanded || readOnly || disabled) { // 已弹出、只读、禁用状态下,不允许弹出 return; } this._superBlur = true; this.superclass.onTriggerClick.apply(this, arguments); this._superBlur = false; }, onCollapse: function () { // 每次收回时,删除下拉组件 // delete this.picker }, /** * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内 */ setValue: function (value) { var me = this; // 设值用户看到的表面内容 this.setRawValue(value); // 设值 setValue 调用链,正常触发 change 事件等 return me.mixins.field.setValue.call(me, value); }, _lookupSet: function (path, value) { var me = this; path = tryVarSimple(path); if (me.column) { // 判断写入目标,是否与自己绑定的属性相等 if (path === 'queryValue' || me.column.dataIndex === path) { me.setValue(value); } // 列模式下,写当前编辑行 var parentRecord = me._lookupEditorRecord(); if (parentRecord) { // Ext.data.Record / Ext.data.Model parentRecord.set(path, value); } else { debugger; } } else { // 常规模式下,写 viewModel me.scope.viewModel.set(path, value); } }, _lookupGrid: function () { return this.column.up('grid'); }, _lookupEditorRecord: function () { var _a, _b, _c, _d; // parentGrid.getSelectionModel().getLastSelected() var grid = this._lookupGrid(); var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin; if (!editingPlugin) { return grid.getSelectionModel().getLastSelected(); } var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx; if (_$2.isNumber(rowIdx)) { return grid.store.getAt(rowIdx); } else { return grid.getSelectionModel().getLastSelected(); } }, onChange: function (newVal, oldVal) { var me = this; var value = newVal; var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear; if (hideTrigger || disabled || readOnly || hideClear) { // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮 return; } if (value) { me.getTrigger('clear').show(); me.updateLayout(); } else { me.getTrigger('clear').hide(); me.updateLayout(); } }, /** * 得到能用于 express 表达式计算的上下文数据 */ getExpressData: function () { var queryValue = this.getRawValue(); if (!queryValue) { // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框 queryValue = this.getPicker().down('textfield').getRawValue(); } if (this.column) { // 列模式, 准备好判断 editEnable 表达式用的数据 var parentRecord = this._lookupEditorRecord(); if (!parentRecord) { debugger; } return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue }); } else { // 编辑模式,准备好判断用的数据 return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue }); } }, tryEnable: function () { return tryEnable(this.getExpressData(), this.editEnable); }, /** * 清空所有值 */ onClearClick: function (sender, e) { var me = this; var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange; me.fireEvent('clear', sender, e); me.setValue(''); _$2.forOwn(lookup, function (toTarget, fromColumn) { me._lookupSet(toTarget, ''); }); _$2.each(lookupClearOnChange, function (item) { me._lookupSet(item, ''); }); } }); } //# sourceMappingURL=combogrid.js.map function initContainer () { var cc = Ext.container.Container.prototype.constructor; //const {initComponent} = Ext.container.Container.prototype Ext.container.Container.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config); cc.call(this, newConfig); }, }); } //# sourceMappingURL=container.js.map function initRows () { Ext.define('Yvan.Rows', { extend: 'Ext.container.Container', xtype: 'rows', constructor: function (config) { var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 layout: 'anchor', border: false, defaults: { border: false, anchor: '100%', margin: '0 0 5 0', }, }, baseConfig(config, 'rows-container'), config, rows); this.superclass.constructor.call(self, newConfig); }, }); } //# sourceMappingURL=rows.js.map function initForm () { var ct = Ext.form.Panel.prototype.constructor; Ext.form.Panel.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form); ct.call(this, newConfig); } }); } //# sourceMappingURL=form.js.map function initCols () { Ext.define('Yvan.Cols', { extend: 'Ext.container.Container', xtype: 'cols', constructor: function (config) { var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 layout: 'hbox', minHeight: config.designMode ? 32 : 0 }, baseConfig(config, 'cols-container'), config, cols); this.superclass.constructor.call(self, newConfig); }, }); } //# sourceMappingURL=cols.js.map function initButton () { /** * */ var ct = Ext.button.Button.prototype.constructor; Ext.button.Button.override({ constructor: function (config) { var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button); ct.call(this, newConfig); }, setLoading: function (value) { if (value) { if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') { this._originIconCls = this.iconCls; } this.setIconCls('x-fa fa-spinner fa-spin fa-fw'); this.setDisabled(true); } else { this.setIconCls(this._originIconCls); this.setDisabled(false); } } }); } //# sourceMappingURL=button.js.map function initIframe () { Ext.define('Ext.ux.IFrame', { extend: 'Ext.Component', alias: 'widget.uxiframe', loadMask: 'Loading...', src: 'about:blank', renderTpl: [ '' ], childEls: ['iframeEl'], initComponent: function () { this.superclass.initComponent.call(this); this.superclass.initEvents.call(this); this.frameName = this.frameName || this.id + '-frame'; }, initEvents: function () { var me = this; this.superclass.initEvents.call(this); me.iframeEl.on('load', me.onLoad, me); }, initRenderData: function () { return Ext.apply(this.superclass.initRenderData.call(this), { src: this.src, frameName: this.frameName }); }, getBody: function () { var doc = this.getDoc(); return doc.body || doc.documentElement; }, getDoc: function () { try { return this.getWin().document; } catch (ex) { return null; } }, getWin: function () { var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name]; return win; }, getFrame: function () { var me = this; return me.iframeEl.dom; }, onLoad: function () { var me = this, doc = me.getDoc(); if (doc) { this.el.unmask(); this.fireEvent('load', this); } else if (me.src) { this.el.unmask(); this.fireEvent('error', this); } }, load: function (src) { var me = this, text = me.loadMask, frame = me.getFrame(); if (me.fireEvent('beforeload', me, src) !== false) { if (text && me.el) { me.el.mask(text); } frame.src = me.src = (src || me.src); } } }); } //# sourceMappingURL=iframe.js.map /** * 属性: * - autoLoad: true * - dataSource: '' * 方法: * - handleZoomBig * - handleZoomSmall * - handleZoomReset * - openDiagram * - getBpmn * - getBpmnCanvas * - getBpmnOverlays * - getBpmnZoomScroll * 事件: * - initFinish * - failed * - success * - itemHover * - itemOut * - itemClick * - itemDblclick * - itemMousedown * - itemMouseup */ function initBpmn () { Ext.define('Yvan.Bpmn', { // extend: 'Ext.container.Container', extend: 'Ext.panel.Panel', alias: 'widget.bpmn', xtype: 'bpmn', constructor: function (config) { var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 }, baseConfig(config, 'row-item'), config, bpmn); if (!newConfig.hideToolbar) { newConfig.tbar = []; newConfig.tbar.push({ xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新', listeners: { click: function (sender) { self.reload(); } } }); newConfig.tbar.push({ xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus", listeners: { click: function (sender) { self.handleZoomBig(); } }, }); newConfig.tbar.push({ xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus", listeners: { click: function (sender) { self.handleZoomSmall(); } }, }); newConfig.tbar.push({ xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply", listeners: { click: function (sender) { self.handleZoomReset(); } }, }); } this.superclass.constructor.call(self, newConfig); }, initComponent: function () { var _this = this; var me = this; var config = me.config; var scope = lookupScope(this); if (!isDesignMode(scope, config)) { //@ts-ignore require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) { console.log('BpNavigated', me, BpNavigated); var dom = me.el.dom; var $dom = $(dom); var $container = $dom.find('.x-autocontainer-innerCt'); var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig)); _this._bpmn = bpmn; if (_this.autoLoad) { _this.reload(); } _this.fireEvent('initFinish', _this); var eventBus = bpmn.get('eventBus'); eventBus.on('element.hover', function (e) { // this.fireEvent('itemHover', this, e); }); eventBus.on('element.out', function (e) { _this.fireEvent('itemOut', _this, e); }); eventBus.on('element.click', function (e) { _this.fireEvent('itemClick', _this, e); }); eventBus.on('element.dblclick', function (e) { _this.fireEvent('itemDblclick', _this, e); }); eventBus.on('element.mousedown', function (e) { _this.fireEvent('itemMousedown', _this, e); }); eventBus.on('element.mouseup', function (e) { _this.fireEvent('itemMouseup', _this, e); }); }); } this.superclass.initComponent.call(this); this.on({ afterrender: function (sender) { } }); }, /** * 重新载入 */ reload: function () { var _this = this; var _a; if (typeof this.dataSource === 'string' && this.dataSource) { var scope = lookupScope(this); var fn = lookupFn(scope, this.dataSource); (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) { _this.openDiagram(res.data); }); } }, /** * 获取bpmn */ getBpmn: function () { return this._bpmn; }, getBpmnCanvas: function () { var _a; return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas'); }, getBpmnOverlays: function () { var _a; return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays'); }, getBpmnZoomScroll: function () { var _a; return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll'); }, handleZoomBig: function () { var _a; (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1); }, handleZoomSmall: function () { var _a; (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1); }, handleZoomReset: function () { var _a; (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset(); }, openDiagram: function (diagram) { var _this = this; if (!this.getBpmn()) { return; } this.getBpmn().importXML(diagram, function (err) { if (err) { // YvEventDispatch(this.onFailed, this, undefined); _this.fireEvent('failed', _this, err); return console.error('could not import BPMN 2.0 diagram', err); } // zoom to fit full viewport _this.getBpmnCanvas().zoom('fit-viewport'); _this.fireEvent('success', _this); }); }, }); } //# sourceMappingURL=bpmn.js.map function initSqlComplex () { Ext.define('Yvan.SqlComplex', { extend: 'Ext.panel.Panel', xtype: 'sqlcomplex', alias: 'widget.sqlcomplex', getSqlExpress: function () { }, constructor: function (config) { var reference = config.reference; var me = this; var newConfig = __assign(__assign({}, config), { layout: 'border', items: [ { region: 'west', width: 280, border: false, split: true, reference: reference + '_tree', xtype: 'yvtree', hideRefresh: true, hideExpand: true, hideCollapse: true, listeners: { itemdblclick: function (sender, record, item, index, e) { var field = record.get('field'); var defaultValue = record.get('defaultValue'); if (!field) { return; } var tabExpress = me.down('tabpanel'); var sqleditor = me.down('sqleditor'); var expressGrid = me.down('yvgrid'); if (tabExpress.getActiveTab().key !== 'grid') { // SQL 模式 sqleditor.insertText(field + '='); } else { // 表格模式 expressGrid.appendEditRow({ field: field, operator: '=', value: defaultValue, remark: '', }); _$2.defer(function () { gridChanged(me, expressGrid); }); } } }, }, { region: 'center', xtype: 'tabpanel', reference: reference + '_tab', tabPosition: 'bottom', listeners: { afterrender: function (sender) { var scope = lookupScope(me); var value = scope.viewModel.get(me.config.bindValue); // sql 转换为 grid try { var list_1 = parseSqlToGrid(value); _$2.defer(function () { var grid = me.down('yvgrid'); grid.setData(list_1); }); } catch (e) { console.error(e); msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!'); var tabSql = sender.down('sqleditor'); sender.setActiveTab(tabSql); } }, beforetabchange: function (sender, newCard, oldCard, eOpts) { var scope = lookupScope(me); var value = scope.viewModel.get(me.config.bindValue); if (newCard.key === 'grid') { // sql 转换为 grid try { var list_2 = parseSqlToGrid(value); _$2.defer(function () { var grid = me.down('yvgrid'); grid.setData(list_2); }); return true; } catch (e) { msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法'); console.error(e); return false; } } else if (newCard.key === 'sql') { // grid 转换为 sql _$2.defer(function () { var editor = me.down('sqleditor'); editor.setValue(value); }); return true; } } }, items: [ { title: '表格模式', key: 'grid', xtype: 'yvgrid', _mode: 'select', reference: reference + '_grid', hideFootbar: true, pagination: false, tbar: [ { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', bind: { disabled: '{!' + reference + '_grid.selection}', }, listeners: { click: function (sender) { var grid = sender.up('yvgrid'); removeGridRow(grid); gridChanged(me, grid); } }, }, ], store: {}, listeners: { editfinish: function (sender) { gridChanged(me, sender); }, }, columns: [ { dataIndex: 'field', header: '字段', sortable: false, menuDisabled: true, width: 190, renderer: function (value, context, record, rowIdx, colIdx, store, view) { var column = context.column; var propertyConfig = me.config.propertyConfig; // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值 var field = record.get('field'); if (field) { var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; }); if (idx >= 0) { var meta = propertyConfig[idx]; return meta.text; } } return value; } }, { dataIndex: 'operator', header: '运算符', sortable: false, menuDisabled: true, dict: 'operator', width: 65, editor: { xtype: 'combo' }, }, { dataIndex: 'value', header: '值', sortable: false, menuDisabled: true, flex: 1, getEditor: function (record) { var column = this; var grid = _$2.get(column, 'ownerCt.grid.ownerGrid'); var propertyConfig = me.config.propertyConfig; var field = record.get('field'); if (!field) { // 没有填 propertyName return; } var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; }); if (idx < 0) { console.error('没有找到 field=' + field + ". propertyConfig"); return; } var meta = propertyConfig[idx]; if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') { return new Ext.grid.CellEditor({ field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' }) }); } return new Ext.grid.CellEditor({ field: __assign({ dict: meta.dict }, meta.editor) }); }, renderer: function (valueList, context, record, rowIdx, colIdx, store, view) { var column = context.column; var grid = _$2.get(view, 'ownerGrid'); var propertyConfig = me.config.propertyConfig; // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值 var field = record.get('field'); if (field) { var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; }); if (idx >= 0) { var meta = propertyConfig[idx]; var dictName = _$2.get(meta, 'dict'); if (dictName && window['DICT_CACHE'][dictName]) { var dict_1 = window['DICT_CACHE'][dictName]; var valueText_1 = []; _$2.forEach(_$2.split(valueList, ','), function (value) { var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); }); if (idxKv >= 0) { valueText_1.push(dict_1[idxKv].text); } else { valueText_1.push(value); } }); return valueText_1.join(','); } } } return valueList; }, }, ] }, { title: 'SQL模式', key: 'sql', xtype: 'sqleditor', reference: reference + '_sql', listeners: { change: function (sender) { var scope = lookupScope(me); // 保存 editor 写入的值 scope.viewModel.set(me.config.bindValue, sender.getValue()); } } }, ] } ] }); this.superclass.constructor.call(this, newConfig); }, initComponent: function () { // 货位条件树 var me = this; me.superclass.initComponent.apply(this, arguments); var tree = this.down('yvtree'); var config = me.config; tree.setRootNode(buildConfigTree(config.propertyConfig)); }, }); function gridChanged(me, grid) { var data = grid.getDataRows(); var propertyConfig = me.config.propertyConfig; var bindValue = me.config.bindValue; var scope = lookupScope(me); var sql = parseGridToSql(data); scope.viewModel.set(bindValue, sql); } /** * 用于从 propertyConfig 解析出树形结构 * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', }, * -> * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true}, */ function buildConfigTree(propertyConfig) { var root = { expanded: true, leaf: false, children: [] }; var categoryObj = {}; var cfgList = propertyConfig; _$2.forEach(cfgList, function (cfg) { var cateNode = categoryObj[cfg.category]; if (!cateNode) { cateNode = { text: cfg.category, expanded: true, leaf: false, children: [] }; categoryObj[cfg.category] = cateNode; root.children.push(cateNode); } cateNode.children.push({ text: cfg.text, field: cfg.field, operator: cfg.operator, defaultValue: cfg.defaultValue, leaf: true, }); }); return root; } /** * 将表格变成 SQL where语句 [ * {field: 'f1', value: 1, operator: '='} * {field: 'f2', value: 2, operator: '='} * {field: 'f3', value: '3', operator: '>='} * {field: 'f4', value: 4, operator: '='} * ] * -> * f1=v1 and f2=v2 */ function parseGridToSql(list) { var sqls = []; _$2.forEach(list, function (i) { var _a; if (i.operator === 'in') { sqls.push(i.field + ' in (' + (i.value) + ')'); } else if (i.operator === 'notIn') { sqls.push(i.field + ' not in (' + (i.value) + ')'); } else { sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0)); } }); return sqls.join(' AND '); } /** * 将 SQL 语句的 where 片段变成表格 * @param sql f1=1 and f2=2 and f3>="3" and f4=4 * @return [ {field: 'f1', value: 1, operator: '='} {field: 'f2', value: 2, operator: '='} {field: 'f3', value: '3', operator: '>='} {field: 'f4', value: 4, operator: '='} ] */ function parseSqlToGrid(sql) { if (!sql || !_$2.trim(sql)) { return []; } var parser = new window['NodeSQLParser'].Parser(); var ast = parser.astify('select * from dual where ' + sql); var ret = []; exp(ast.where, ret); return ret; } function exp(ast, ret) { if (ast.type === 'binary_expr') { if (_$2.toUpper(ast.operator) === 'AND') { if (ast.left.type === 'binary_expr') { exp(ast.left, ret); } if (ast.right.type === 'binary_expr') { exp(ast.right, ret); } } else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) { if (ast.left.type === 'column_ref') { if (ast.right.type === 'number' || ast.right.type === 'single_quote_string' || ast.right.type === 'double_quote_string') { // 具体值相等 ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator }); } else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN') && ast.right.type === 'expr_list') { // in / not in var valueList_1 = []; _$2.forEach(ast.right.value, function (item) { valueList_1.push(item.value); }); var operator = void 0; if (_$2.toUpper(ast.operator) === 'IN') { operator = 'in'; } else if (_$2.toUpper(ast.operator) === 'NOT IN') { operator = 'notIn'; } ret.push({ field: ast.left.column, value: valueList_1.join(','), operator: operator }); } else { throw new Error('ast.right must is value.'); } } else { throw new Error('ast.left must is column_ref.'); } } else { // 必须用 AND 条件符匹配 throw new Error('ast.operator must is "AND / =".'); } } else { throw new Error('ast.type must is "binary_expr".'); } } /** * json5.stringify( new NodeSQLParser.Parser().astify("").where) * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3 { type: 'binary_expr', operator: 'AND', left: { type: 'binary_expr', operator: 'AND', left: { type: 'binary_expr', operator: 'AND', left: { type: 'binary_expr', operator: 'AND', left: { type: 'binary_expr', operator: '=', left: { type: 'column_ref', table: null, column: 'f1' }, right: { type: 'number', value: 1 } }, right: { type: 'binary_expr', operator: '=', left: { type: 'column_ref', table: null, column: 'f2' }, right: { type: 'number', value: 2 } } }, right: { type: 'binary_expr', operator: '=', left: { type: 'column_ref', table: null, column: 'f3' }, right: { type: 'single_quote_string', value: '3' } } }, right: { type: 'binary_expr', operator: '>=', left: { type: 'column_ref', table: null, column: 'f4' }, right: { type: 'number', value: 4 } } }, right: { type: 'binary_expr', operator: '<', left: { type: 'column_ref', table: null, column: 'f4' }, right: { type: 'number', value: 3 } } } * */ } //# sourceMappingURL=SqlComplex.js.map function initParamComplex () { Ext.define('Yvan.ParamComplex', { extend: 'Ext.panel.Panel', xtype: 'paramcomplex', alias: 'widget.paramcomplex', getSqlExpress: function () { }, constructor: function (config) { var reference = config.reference; var me = this; var newConfig = __assign(__assign({}, config), { layout: 'border', items: [ { region: 'west', width: 280, border: false, split: true, reference: reference + '_tree', xtype: 'yvtree', hideRefresh: true, hideExpand: true, hideCollapse: true, listeners: { itemdblclick: function (sender, record, item, index, e) { var field = record.get('field'); var defaultValue = record.get('defaultValue'); if (!field) { return; } var tabExpress = me.down('tabpanel'); var sqleditor = me.down('sqleditor'); var expressGrid = me.down('yvgrid'); if (tabExpress.getActiveTab().key !== 'grid') { // SQL 模式 sqleditor.insertText(field + '='); } else { // 表格模式 expressGrid.appendEditRow({ field: field, operator: '=', value: defaultValue, remark: '', }); _$2.defer(function () { gridChanged(me, expressGrid); }); } } }, }, { region: 'center', xtype: 'tabpanel', reference: reference + '_tab', tabPosition: 'bottom', listeners: { afterrender: function (sender) { var scope = lookupScope(me); var value = scope.viewModel.get(me.config.bindValue); // sql 转换为 grid try { var list_1 = parseParamToGrid(value); _$2.defer(function () { var grid = me.down('yvgrid'); grid.setData(list_1); }); } catch (e) { console.error(e); msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!'); var tabSql = sender.down('sqleditor'); sender.setActiveTab(tabSql); } }, beforetabchange: function (sender, newCard, oldCard, eOpts) { var scope = lookupScope(me); var value = scope.viewModel.get(me.config.bindValue); if (newCard.key === 'grid') { // sql 转换为 grid try { var list_2 = parseParamToGrid(value); _$2.defer(function () { var grid = me.down('yvgrid'); grid.setData(list_2); }); return true; } catch (e) { msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法'); console.error(e); return false; } } else if (newCard.key === 'sql') { // grid 转换为 sql _$2.defer(function () { var editor = me.down('sqleditor'); editor.setValue(value); }); return true; } } }, items: [ { title: '表格模式', key: 'grid', xtype: 'yvgrid', _mode: 'select', reference: reference + '_grid', hideFootbar: true, pagination: false, tbar: [ { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', bind: { disabled: '{!' + reference + '_grid.selection}', }, listeners: { click: function (sender) { var grid = sender.up('yvgrid'); removeGridRow(grid); gridChanged(me, grid); } }, }, ], store: {}, listeners: { editfinish: function (sender) { gridChanged(me, sender); }, }, columns: [ { dataIndex: 'field', header: '字段', sortable: false, menuDisabled: true, width: 190, renderer: function (value, context, record, rowIdx, colIdx, store, view) { var column = context.column; var propertyConfig = me.config.propertyConfig; // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值 var field = record.get('field'); if (field) { var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; }); if (idx >= 0) { var meta = propertyConfig[idx]; return meta.text; } } return value; } }, { dataIndex: 'value', header: '值', sortable: false, menuDisabled: true, flex: 1, getEditor: function (record) { var column = this; var grid = _$2.get(column, 'ownerCt.grid.ownerGrid'); var propertyConfig = me.config.propertyConfig; var field = record.get('field'); if (!field) { // 没有填 propertyName return; } var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; }); if (idx < 0) { console.error('没有找到 field=' + field + ". propertyConfig"); return; } var meta = propertyConfig[idx]; if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') { return new Ext.grid.CellEditor({ field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' }) }); } return new Ext.grid.CellEditor({ field: __assign({ dict: meta.dict }, meta.editor) }); }, renderer: function (valueList, context, record, rowIdx, colIdx, store, view) { var column = context.column; var grid = _$2.get(view, 'ownerGrid'); var propertyConfig = me.config.propertyConfig; // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值 var field = record.get('field'); if (field) { var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; }); if (idx >= 0) { var meta = propertyConfig[idx]; var dictName = _$2.get(meta, 'dict'); if (dictName && window['DICT_CACHE'][dictName]) { var dict_1 = window['DICT_CACHE'][dictName]; var valueText_1 = []; _$2.forEach(_$2.split(valueList, ','), function (value) { var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); }); if (idxKv >= 0) { valueText_1.push(dict_1[idxKv].text); } else { valueText_1.push(value); } }); return valueText_1.join(','); } } } return valueList; }, }, ] }, { title: '文本模式', key: 'sql', xtype: 'sqleditor', reference: reference + '_sql', listeners: { change: function (sender) { var scope = lookupScope(me); // 保存 editor 写入的值 scope.viewModel.set(me.config.bindValue, sender.getValue()); } } }, ] } ] }); this.superclass.constructor.call(this, newConfig); }, initComponent: function () { // 货位条件树 var me = this; me.superclass.initComponent.apply(this, arguments); var tree = this.down('yvtree'); var config = me.config; tree.setRootNode(buildConfigTree(config.propertyConfig)); }, }); function gridChanged(me, grid) { var data = grid.getDataRows(); var propertyConfig = me.config.propertyConfig; var bindValue = me.config.bindValue; var scope = lookupScope(me); var sql = parseGridToParam(data); scope.viewModel.set(bindValue, sql); } /** * 用于从 propertyConfig 解析出树形结构 * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', }, * -> * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true}, */ function buildConfigTree(propertyConfig) { var root = { expanded: true, leaf: false, children: [] }; var categoryObj = {}; var cfgList = propertyConfig; _$2.forEach(cfgList, function (cfg) { var cateNode = categoryObj[cfg.category]; if (!cateNode) { cateNode = { text: cfg.category, expanded: true, leaf: false, children: [] }; categoryObj[cfg.category] = cateNode; root.children.push(cateNode); } cateNode.children.push({ text: cfg.text, field: cfg.field, operator: cfg.operator, defaultValue: cfg.defaultValue, leaf: true, }); }); return root; } /** * 将表格变成参数语句 [ * {field: 'f1', value: 1} * {field: 'f2', value: 2} * {field: 'f3', value: '3'} * {field: 'f4', value: 4} * ] * -> * f1=v1, f2=v2 */ function parseGridToParam(list) { var sqls = []; _$2.forEach(list, function (i) { sqls.push(i.field + '=' + (i.value)); }); return sqls.join('; '); } /** * 将 分号分割的的参数设置 变成表格 * @param param a=1; b=2; c='3' * @return [ {field: 'a', value: 1} {field: 'b', value: 2} {field: 'c', value: '3'} ] */ function parseParamToGrid(param) { if (!param || !_$2.trim(param)) { return []; } var ret = []; var sp = _$2.split(param, ';'); _$2.forEach(sp, function (v) { var vi = _$2.indexOf(v, '='); var field = _$2.trim(v.substr(0, vi)); var value = eval(v.substr(vi + 1)); ret.push({ field: field, value: value }); }); return ret; } } //# sourceMappingURL=ParamComplex.js.map function initSqlEditor () { Ext.define('com.yvan.studio.SqlEditor', { extend: 'Ext.panel.Panel', alias: 'widget.sqleditor', xtype: 'sqleditor', layout: 'fit', border: false, html: "
", config: { value: '' }, codeChange: undefined, isChangeFromOuter: false, setCode: function (value) { var _this = this; this.code = value; this.value = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, getCode: function () { return this.getValue(); }, updateOptions: function (options) { if (this.editor && options) { this.editor.updateOptions(options); } }, getValue: function () { if (!this.editor) { return this.code; } return this.editor.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, insertText: function (text) { var editor = this.editor; var position = editor.getPosition(); editor.executeEdits('', [ { range: { startLineNumber: position.lineNumber, startColumn: position.column, endLineNumber: position.lineNumber, endColumn: position.column }, text: text } ]); }, setValue: function (value, fromEditor) { this.setCode(value); var me = this; if (me.value === value) { // 值相等,不需要变化 return; } if (fromEditor !== true && me.editor) { // 不是来源于编辑器的变化,才设置编辑器的值 me.editor.setValue(value); } // 通知mixins setValue me.value = value; me.fireEvent('change', value); }, initComponent: function () { var that = this; this.superclass.initComponent.call(this); that.on({ resize: function () { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_2($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); } }); function attach_2(element, opts) { if (!window['monaco']) { return; } var monaco = window['monaco']; return new Promise(function (resolve) { var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: { enabled: false } })); // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () { // const sql = editor.getValue() // if (_.trim(sql).length > 0) { // editor.setValue(format(sql, { // indent: ' ', // uppercase: true, // })) // } // }) editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } } //# sourceMappingURL=SqlEditor.js.map function initJsonEditor () { Ext.define('com.yvan.studio.JsonEditor', { extend: 'Ext.panel.Panel', alias: 'widget.jsoneditor', xtype: 'jsoneditor', layout: 'fit', border: false, html: "
", autoFocusMethod: true, autoFocusStartLine: 0, autoFocusStartColumn: 0, codeChange: undefined, funcArr: [], modulePage: null, isChangeFromOuter: false, name: "", /** * 设置代码 */ setCode: function (value) { var _this = this; this.code = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, updateOptions: function (options) { if (this.editor && options) { this.editor.updateOptions(options); } }, setLanguage: function (lang) { if (!window['monaco']) { return; } var monaco = window['monaco']; if (this.editor && lang) { monaco.editor.setModelLanguage(this.editor.getModel(), lang); } }, getCode: function () { var _a; return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, initComponent: function () { var that = this; this.superclass.initComponent.apply(this, arguments); this.on({ resize: function (sender, width, height) { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_116($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); }, }); function attach_116(element, opts) { if (!window['monaco']) { return; } var monaco = window['monaco']; return new Promise(function (resolve) { var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: { enabled: false } })); editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } } //# sourceMappingURL=JsonEditor.js.map function initJsEditor () { Ext.define('com.yvan.studio.JsEditor', { extend: 'Ext.panel.Panel', alias: 'widget.jseditor', xtype: 'jseditor', layout: 'fit', border: false, html: "
", autoFocusMethod: true, autoFocusStartLine: 0, autoFocusStartColumn: 0, codeChange: undefined, funcArr: [], modulePage: null, isChangeFromOuter: false, name: "", /** * 设置代码 */ setCode: function (value) { var _this = this; this.code = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); if (_this.name === "controllerEditor") { _this.funcArr = _this.getAllFunction(); } } }); }, getCode: function () { var _a; if (!this.editor) { return this.code; } return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, initComponent: function () { var that = this; this.superclass.initComponent.apply(this, arguments); this.on({ resize: function (sender, width, height) { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function () { var $dom = $(that.el.dom).find('.editor'); attach_1($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); }, getAllFunction: function () { var funcArr = []; var ast = window['YvanUI'].recast.parse(this.code); if (ast && ast.program && ast.program.body) { if (Array.isArray(ast.program.body)) { for (var i = 0; i < ast.program.body.length; i++) { var m = ast.program.body[i]; if (m.type === "ExportDefaultDeclaration") { if (m.declaration.type === "ClassDeclaration") { if (m.declaration.body.type === "ClassBody") { if (Array.isArray(m.declaration.body.body)) { for (var j = 0; j < m.declaration.body.body.length; j++) { var ob = m.declaration.body.body[j]; if (ob.type === "MethodDefinition" && ob.kind === "method") { var funcItem = { name: ob.key.name, args: [] }; if (Array.isArray(ob.value.params)) { for (var k = 0; k < ob.value.params.length; k++) { var p = ob.value.params[k]; funcItem.args.push(p.name); } } funcArr.push(funcItem); } } } } } } } } } return funcArr; } }); var isInited = false; function attach_1(element, opts) { if (!window['monaco']) { return; } var monaco = window['monaco']; return new Promise(function (resolve) { if (!isInited) { isInited = true; monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({ noSemanticValidation: true, noSyntaxValidation: false }); // compiler options monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ target: monaco.languages.typescript.ScriptTarget.ES2016, allowNonTsExtensions: true, }); // extra libraries var libSource = [ 'declare class Facts {', ' /**', ' * Returns the next fact', ' */', ' static next():string', ' static next222():string', '}', "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ", "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n " ].join('\n'); var libUri = 'file:///index.d.ts'; monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri); // When resolving definitions and references, the editor will try to use created models. // Creating a model for the library allows "peek definition/references" commands to work with the library. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri)); } var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' })); resolve(editor); }); } } //# sourceMappingURL=JsEditor.js.map function initClipboard () { var cc = Ext.grid.plugin.Clipboard.prototype.constructor; var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent; Ext.grid.plugin.Clipboard.override({ getCellData: function (format, erase) { var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view; if (selection) { selection.eachCell(function (cellContext) { column = cellContext.column; view = cellContext.column.getView(); record = cellContext.record; // Do not copy the check column or row numberer column if (column.ignoreExport && column.xtype !== "checkcolumn") { return; } if (lastRecord !== record) { lastRecord = record; ret.push(row = []); } dataIndex = column.dataIndex; // 记录原始数据 var rData = record.data[dataIndex]; if (isRaw) { data = record.data[dataIndex]; } else { // Try to access the view node. viewNode = view.all.item(cellContext.rowIdx); // If we could not, it's because it's outside of the rendered block - // recreate it. if (!viewNode) { viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx)); } cell = viewNode.dom.querySelector(column.getCellInnerSelector()); data = cell.innerHTML; if (isText) { data = Ext.util.Format.stripTags(data); } // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值 data = data || rData; } row.push(data); if (erase && dataIndex) { record.set(dataIndex, null); } }); } // See decode() comment below return Ext.util.TSV.encode(ret, undefined, null); }, getCells: function (format, erase) { var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row; if (selection) { selection.eachCell(function (cellContext) { record = cellContext.record; if (lastRecord !== record) { lastRecord = record; ret.push(row = { model: record.self, fields: [] }); } dataIndex = cellContext.column.dataIndex; row.fields.push({ name: dataIndex, value: record.data[dataIndex] }); if (erase && dataIndex) { record.set(dataIndex, null); } }); } return ret; }, getTextData: function (format, erase) { return this.getCellData(format, erase); }, putCellData: function (data, format) { var _a; var values = Ext.util.TSV.decode(data, undefined, null), row, recCount = values.length, colCount = recCount ? values[0].length : 0, sourceRowIdx, sourceColIdx, view = this.getCmp().getView(), maxRowIdx = view.dataSource.getCount() - 1, maxColIdx = view.getVisibleColumnManager().getColumns().length - 1, selModel = view.getSelectionModel(), selected = selModel.getSelected(), navModel = view.getNavigationModel(), destination = selected.startCell || navModel.getPosition(), dataIndex, destinationStartColumn, dataObject = {}; // If the view is not focused, use the first cell of the selection as the destination. if (!destination && selected) { selected.eachCell(function (c) { destination = c; return false; }); } if (destination) { // Create a new Context based upon the outermost View. // NavigationModel works on local views. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid. // At that point, we can use navModel.getPosition() destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column); } else { destination = new Ext.grid.CellContext(view).setPosition(0, 0); } destinationStartColumn = destination.colIdx; for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) { row = values[sourceRowIdx]; // Collect new values in dataObject for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) { if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") { continue; } dataIndex = destination.column.dataIndex; var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype; if (dataIndex) { switch (format) { // Raw field values case 'raw': dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx]; break; // Textual data with HTML tags stripped case 'text': { if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) { // 获取字典原始的value dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true); } else { dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx]; } break; } } } // If we are at the end of the destination row, break the column loop. if (destination.colIdx === maxColIdx) { break; } destination.setColumn(destination.colIdx + 1); } // Update the record in one go. destination.record.set(dataObject); // If we are at the end of the destination store, break the row loop. if (destination.rowIdx === maxRowIdx) { break; } // Jump to next row in destination destination.setPosition(destination.rowIdx + 1, destinationStartColumn); } }, putTextData: function (data, format) { var _a, _b, _c; var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected(); // 根据复制的行数自动添加新的行 var dataLength = ((_c = (_b = (_a = this.cmp.getStore()) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.length) || 0; if (selected.startCell.rowIdx + values.length >= dataLength) { for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) { this.cmp.getStore().add({}); } } this.putCellData(data, format); }, }); } //# sourceMappingURL=clipboard.js.map function initDict () { var DICT_CACHE = window['DICT_CACHE']; if (!DICT_CACHE) { DICT_CACHE = {}; window['DICT_CACHE'] = DICT_CACHE; } DICT_CACHE.XTYPE = [ { id: 'datefield', text: '日期' }, { id: 'datetimefield', text: '日期时间' }, { id: 'textfield', text: '文本' }, { id: 'numberfield', text: '数字' }, { id: 'combo', text: '下拉框' }, ]; DICT_CACHE.operator = [ { id: '=', text: '=' }, { id: '>', text: '>' }, { id: '<', text: '<' }, { id: '>=', text: '>=' }, { id: '<=', text: '<=' }, { id: 'in', text: 'in' }, { id: 'notIn', text: 'notIn' }, ]; DICT_CACHE.GRID_MODE = [ { id: 'edit1', text: '单机编辑模式' }, { id: 'edit2', text: '双击编辑模式' }, { id: 'checkbox', text: '勾选' }, { id: 'checkonly', text: '只勾选' }, { id: 'select', text: '行选择模式' }, ]; DICT_CACHE.BOTH_SELECT = [ { id: 'N/A', text: '<无>' }, { id: 'textfield', text: '文本' }, { id: 'numberfield', text: '数字框' }, { id: 'datefield', text: '日期' }, { id: 'datetimefield', text: '日期时间' }, { id: 'combo', text: '下拉框' }, { id: 'combogrid', text: '下拉表' }, { id: 'checkbox', text: '勾选' }, ]; DICT_CACHE.ROW_LAYOUT = [ { id: 'flex', text: '按权重摆放' }, { id: 'hbox', text: '按宽度摆放' }, ]; DICT_CACHE.GRID_XTYPE = [ { id: 'N/A', text: '<无>' }, { id: 'textfield', text: '文本-textfield' }, { id: 'numberfield', text: '数字框-numberfield' }, { id: 'datefield', text: '日期-datefield' }, { id: 'datetimefield', text: '日期时间-datetimefield' }, { id: 'combo', text: '下拉框-combo' }, { id: 'combogrid', text: '下拉表-combogrid' }, { id: 'checkbox', text: '勾选-checkbox' }, ]; DICT_CACHE.FORM_XTYPE = [ { id: 'N/A', text: '<无>' }, { id: 'textfield', text: '文本-textfield' }, { id: 'numberfield', text: '数字框-numberfield' }, { id: 'datefield', text: '日期-datefield' }, { id: 'datetimefield', text: '日期时间-datetimefield' }, { id: 'combo', text: '下拉框-combo' }, { id: 'combogrid', text: '下拉表-combogrid' }, { id: 'checkbox', text: '勾选-checkbox' }, { id: 'multiplesearch', text: '多段文本-multiplesearch' }, ]; DICT_CACHE.GRID_FORMATTER = [ { id: 'N/A', text: '默认' }, { id: 'rownum', text: '序号-rownum' }, { id: 'button', text: '按钮-button' }, { id: 'checkbox', text: '勾选-checkbox' }, { id: 'progres', text: '进度条-progres' }, ]; } //# sourceMappingURL=dict.js.map function initDesigner () { Ext.define('com.yvan.studio.designer', { extend: 'Ext.panel.Panel', alias: 'widget.designer', xtype: 'designer', layout: 'fit', items: [], constructor: function (config) { var self = this; var newConfig = _$2.defaultsDeep({ // 强制性属性 }, config); this.superclass.constructor.call(self, newConfig); }, initComponent: function () { var me = this; me.on({ afterrender: function () { } }); this.superclass.initComponent.call(me); } }); } //# sourceMappingURL=designer.js.map var FixClass = /** @class */ (function () { function FixClass() { } FixClass.prototype.fix = function (me, config) { var _this = this; if (isDesignMode(me, config)) { return; } if (!config) { return; } var fix = config.fix; if (!fix) { return; } delete config.fix; // 这里有个 bug // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况 // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me) var scope; if (config.$initParent) { // 在面板上的组件 scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me) } else if (config.column) { // 在列上的组件 scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me) } if (_$2.isArray(fix)) { _$2.each(fix, function (f) { var fn = lookupFn(scope, f); fn.call(_this, me, config); }); } else if (_$2.isString(fix)) { var fn = lookupFn(scope, fix); fn.call(this, me, config); } }; __decorate([ baseConfigProcess(), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", void 0) ], FixClass.prototype, "fix", null); return FixClass; }()); //# sourceMappingURL=fix.js.map function init$1() { // 引入 filters 过滤插件 Ext.require([ 'Ext.grid.filters.Filters' ]); // 启用 tooltip 快捷提示 Ext.QuickTips.init(); // 定义日期格式化方法 if (Ext.util && Ext.util.Format) { Ext.apply(Ext.util.Format, { dateFormat: 'Y-m-d' }); } Ext.form.field.Display.override({ cls: 'yvan-display-field', labelAlign: 'right' }); Ext.define("Ext.locale.zh_CN.picker.Date", { override: "Ext.picker.Date", format: "Y-m-d", }); Ext.define("Ext.locale.zh_CN.form.field.Date", { override: "Ext.form.field.Date", format: "Y-m-d", }); Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", { override: "Ext.grid.PropertyColumnModel", format: "Y-m-d", }); Ext.define("Ext.locale.zh_CN.view.AbstractView", { override: "Ext.view.AbstractView", loadingText: "读取中..." }); Ext.LoadMask.prototype.msg = '请稍后...'; Ext.define("Ext.locale.zh_CN.grid.header.Container", { override: "Ext.grid.header.Container", sortClearText: '不排序', sortAscText: "正序", sortDescText: "倒序", lockText: "锁定列", unlockText: "解除锁定", columnsText: "字段隐藏" }); Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", { override: "Ext.grid.filters.filter.Date", fields: { lt: { text: '之前' }, gt: { text: '之后' }, eq: { text: '相等' }, }, // Defaults to Ext.Date.defaultFormat dateFormat: null }); // Ext.grid.locking.Lockable.prototype.unlockText = '解锁' // Ext.grid.locking.Lockable.prototype.lockText = '锁定' // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤" Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", { override: "Ext.grid.locking.Lockable", lockText: "锁定", unlockText: '解锁', }); Ext.define("Ext.locale.zh_CN.grid.filters.Filters", { override: "Ext.grid.filters.Filters", menuFilterText: "过滤" }); Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", { override: "Ext.grid.filters.filter.Boolean", yesText: "已钩选", noText: "未勾选" }); Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", { override: "Ext.grid.filters.filter.String", emptyText: "输入过滤文本..." }); Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", { override: "Ext.grid.filters.filter.Number", emptyText: "输入数字..." }); Ext.define("Ext.locale.zh_CN.toolbar.Paging", { override: "Ext.PagingToolbar", beforePageText: "第", // update afterPageText: "/ {0} 页", // update firstText: "第一页", prevText: "上一页", // update nextText: "下一页", lastText: "最后页", refreshText: "刷新", displayMsg: "总共 {2} 条", // update emptyMsg: '没有数据' }); /** * 改变事件的获取方式. * 具体见: ext-all-debug.js:23216 addListener * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener */ var _doAddListener = Ext.mixin.Observable.prototype.doAddListener; Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) { if (typeof fn === 'string' && (_$2.startsWith(fn, 'scope.') || _$2.startsWith(fn, 'system.') || _$2.startsWith(fn, 'format.'))) { scope = lookupScope(this); if (isDesignMode(scope, undefined)) { fn = Ext.emptyFn; } else { // console.log('doAddListener', ename, fn, scope, options, order, caller, manager) // const vm = this.lookupViewModel() // if (vm && vm.yvanScope) { // scope = vm.yvanScope // fn = scope[fn.substr('scope.'.length)] // } fn = lookupFn(scope, fn, this); } } _doAddListener.call(this, ename, fn, scope, options, order, caller, manager); }; // 将 SystemLib 扩展到 window.system 下 if (!window['system']) { window['system'] = {}; } _$2.extend(window['system'], SystemLib); _$2.extend(window['system'], { showGridRowDetail: showGridRowDetail }); Ext.apply(Ext.util.Format, { // 百分比 percentRenderer: function (v, rd, model) { if (!v) { v = 0; } if (typeof v === 'string') { v = parseInt(v); } var valueString = v.toFixed(2); var valueFixed = v > 100 ? 100 : v; valueFixed = valueFixed < 0 ? 0 : valueFixed; var cls = ''; if (v < 90) { cls = 'danger'; } else if (v < 100) { cls = 'warning'; } else { cls = 'success'; } return Ext.String .format( // '
' // + '
' // + '
{0}%
' // + '
' // + '
', valueString, valueFixed, cls); '
{0}%
{4}%
', valueString, cls, valueFixed, ((100 / valueFixed) * 100), valueString); // .format( // '
' // + '
' // + '
{0}%
' // + '
' // + '
', v, valueFixed, valueString); }, //button button: function (v, rd, model) { return ""; } }); initComponent(); initPanel(); initGridColumn(); initTree(); initGrid(); initMainTab(); initTextfield(); initCombo(); initTag(); initContainer(); initRows(); initCols(); initForm(); initToolbar(); initSplitter(); initButton(); initStores(); initSearch(); initMultipleSearch(); initDate(); initDateTimePicker(); initDateTime(); initNumber(); initCheckbox(); initCheckboxGroup(); initRadio(); initRadioGroup(); initFieldset(); initCombotree(); initPickerPlus(); initCombogrid(); initComboGridMulti(); initIframe(); initBpmn(); initSqlEditor(); initJsonEditor(); initJsEditor(); initClipboard(); initSqlComplex(); initParamComplex(); initDict(); initDesigner(); } //# sourceMappingURL=init.js.map /** * 创建一个 Ajax 客户端 */ function createAjax(createOption) { if (createOption.baseUrl) { axios__default.defaults.baseURL = createOption.baseUrl; axios__default.defaults.timeout = createOption.timeout; storeAjax.timeout = createOption.timeout; axios__default.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 = Qs.stringify(option.data); break; case 'put': case 'patch': case 'delete': ax.method = option.method; ax.headers = option.headers; ax.params = option.param; ax.data = Qs.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-file': //TODO 刘壮. 上传文件 var forms = new FormData(); ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers); _$2.forOwn(option.data, function (value, key) { if (key === 'files') { var i_1 = 0; _$2.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__default(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 }; if (typeof window['apiTranslate'] === 'function') { window['apiTranslate'](apiResult.rawData, option.url); } resolver(apiResult); }).catch(function (reason) { reject(reason); }); }); }; } function downLoad(downLoadUrl, filename, data, header, isJson) { if (isJson === void 0) { isJson = false; } var YvanUI = _$2.get(window, 'YvanUI'); YvanUI.loading(); var createObjectURL = function (object) { return (window.URL) ? window.URL.createObjectURL(object) : _$2.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 ? Qs.stringify(data) : ''; xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); } // if (header) { _$2.forOwn(header, function (v, k) { xhr.setRequestHeader(k, v); }); } xhr.onload = function (e) { if (this.status === 200) { var blob = this.response; if (_$2.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 function readExcel(file) { return new Promise(function (resolve, reject) { if (!file) { reject("文件读取失败!!!"); return; } var reader = new FileReader(); reader.onload = function (e) { if (e.target) { var data = e.target.result; var workbook = XLSX.read(data, { type: 'binary' }); resolve(workbook); } else { reject("文件读取失败!!!"); } }; try { reader.readAsBinaryString(file); } catch (e) { reject(e); } }); } function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) { if (dataStartRow === void 0) { dataStartRow = 2; } if (titleRowNumber === void 0) { titleRowNumber = 1; } if (rowValidate === void 0) { rowValidate = undefined; } if (otherValidate === void 0) { otherValidate = undefined; } if (fieldValidate === void 0) { fieldValidate = undefined; } return new Promise(function (resolve, reject) { var promiseArr = []; for (var i = 0; i < columnsSet.length; i++) { var fix = columnsSet[i].fix; if (_$2.isArray(fix) && fix.length > 0) { var ss = fix[0].toLowerCase(); if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) { columnsSet[i].importFormatter = function (vdata) { // @ts-ignore return window.moment(vdata.ov) - 0; }; } else { var fn = lookupFn(topScope, fix[0]); promiseArr.push(fn(null, columnsSet[i])); delete columnsSet[i].fix; } } else if (_$2.isString(fix)) { var ss = fix.toLowerCase(); if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) { columnsSet[i].importFormatter = function (vdata) { // @ts-ignore return window.moment(vdata.ov) - 0; }; } else { var fn = lookupFn(topScope, fix); promiseArr.push(fn(null, columnsSet[i])); delete columnsSet[i].fix; } } } var read = function () { readExcel(file).then(function (workbook) { var sheetNames = workbook.SheetNames; // 工作表名称集合 var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet var titleRowValue = []; var titleRowKey = []; var needLoop = false; // 是否需要迭代 var columns = []; if (worksheet && worksheet["!ref"]) { var t = worksheet["!ref"]; var tempArr = t.split(':'); if (tempArr.length >= 2) { var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, ""); // 选取title的行,删除之前的行 if (titleRowNumber > firstRowNumber) { for (var i = firstRowNumber; i < titleRowNumber; i++) { for (var key in worksheet) { if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) { delete worksheet[key]; } } } var fc = tempArr[0].replace(/[^a-z]/ig, ""); firstRowNumber = titleRowNumber + ''; worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1]; } var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, ""); // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0]; // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0]; for (var key in worksheet) { if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) { titleRowKey.push(key); titleRowValue.push(worksheet[key].v); } } if (columnsSet && columnsSet.length > 0) { var length = columnsSet.length; length = length <= titleRowKey.length ? length : titleRowKey.length; for (var i = 0; i < length; i++) { var vk = titleRowKey[i]; var item = columnsSet[i]; var column = {}; if (typeof item === 'string') { column.dataIndex = item; column.header = worksheet[vk].v; worksheet[vk] = { t: "s", v: item, h: item, w: item }; } else if (typeof item.dataIndex === "string") { column.dataIndex = item.dataIndex; column.header = worksheet[vk].v; worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex }; if (typeof item.validate === "function") { column.validate = item.validate; needLoop = true; } if (typeof item.importFormatter === "function") { column.importFormatter = item.importFormatter; needLoop = true; } if ((item.data instanceof Array && item.data.length > 0) || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) { column.data = item.data; needLoop = true; } } columns.push(column); } } } } if (fieldValidate && typeof fieldValidate === "function") { if (fieldValidate(columns, titleRowValue) !== true) { reject("fields validate error"); return; } } var allData = XLSX.utils.sheet_to_json(worksheet); var okData = [], errorData = [], errorMsgData = []; var needItemLoop = needLoop; if (rowValidate && typeof rowValidate === "function") { needLoop = true; } if (needLoop === true) { for (var index = 0; index < allData.length; index++) { var row = allData[index]; var rowNumber = dataStartRow + index; row.__importID__ = rowNumber; var isRowOk = true; if (needItemLoop) { var _loop_1 = function (num) { var column = columns[num]; var ov = row[column.dataIndex]; var nv = ov; var hasError = false; var rowNumber_1 = dataStartRow + index; var ei = { errorId: rowNumber_1 + '_' + column.dataIndex, importID: rowNumber_1, dataIndex: column.dataIndex, header: column.header, value: ov, errormessage: "" }; // 格式化 if (column.data instanceof Array) { nv = undefined; ei.errormessage = "字典匹配失败"; _$2.forEach(column.data, function (v, index) { if (v.text === ov) { nv = v.id; return; } }); } else if (_$2.isPlainObject(column.data)) { nv = undefined; ei.errormessage = "字典匹配失败"; _$2.forEach(column.data, function (value, key) { if (value === ov) { nv = key; return; } }); } if (typeof column.importFormatter === 'function') { var vdata = { column: column, ov: ov, nv: nv, rowIndex: index, data: row, rowDatas: allData }; nv = undefined; ei.errormessage = "格式化失败"; nv = column.importFormatter(vdata); } if (!nv && nv != 0) { hasError = true; } else { row[column.dataIndex] = nv; ei.errormessage = ""; } // 校验 if (typeof column.validate === 'function') { var vdata = { column: column, ov: ov, nv: nv, rowIndex: index, data: row, rowDatas: allData }; var errormessage = column.validate(vdata); if (errormessage === true) ; else { hasError = true; ei.errormessage = ei.errormessage + "/" + errormessage; } } if (hasError === true) { isRowOk = false; errorMsgData.push(ei); } }; for (var num = 0; num < columns.length; num++) { _loop_1(num); } } if (rowValidate && typeof rowValidate === "function") { var errormessage = rowValidate({ columns: columns, data: row, rowIndex: index, rowDatas: allData }); if (errormessage === true) ; else { isRowOk = false; var ei = { errorId: rowNumber + '', dataIndex: "row", header: "数据行", value: "当前行的数据", importID: rowNumber, errormessage: errormessage }; errorMsgData.push(ei); } } row.__hasError__ = !isRowOk; if (isRowOk === true) { okData.push(row); } else { errorData.push(row); } } } else { // 添加数据的唯一标识 for (var index = 0; index < allData.length; index++) { var row = allData[index]; var rowNumber = dataStartRow + index; row.__importID__ = rowNumber; row.__hasError__ = false; } okData = allData; } if (otherValidate && typeof otherValidate === "function") { otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve); } else { resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }); } // clearLoading() }).catch(function (e) { reject(e); }); }; if (promiseArr.length > 0) { Promise.all(promiseArr).then(function (resArr) { for (var i = 0; i < resArr.length; i++) { var tmp = resArr[i]; tmp.config.data = []; if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) { if (tmp.r.field.length > 1) { var keyKey = tmp.r.field[0]; var valueKey = tmp.r.field[1]; for (var j = 0; j < tmp.r.data.length; j++) { var it = tmp.r.data[j]; var newIt = {}; newIt.id = it[keyKey]; newIt.text = it[valueKey]; tmp.config.data.push(newIt); } } } } read(); }); } else { setTimeout(read, 50); } }); } //# sourceMappingURL=xlsx.js.map var ExcelImportDialog = /** @class */ (function (_super) { __extends(ExcelImportDialog, _super); function ExcelImportDialog(option) { var _this = this; var vjson = vjsonFunc(option); _this = _super.call(this, { model: model$d, vjson: vjson }) || this; _this.importExcelOption = option; return _this; } ExcelImportDialog.prototype.onLoad = function () { _super.prototype.onLoad.call(this); }; ExcelImportDialog.prototype.fileChange = function (sender) { var _this = this; var file = sender.fileInputEl.dom.files[0]; // const senderScope = lookupScope(sender) var topScope = this.topScope; var rowValidate = this.importExcelOption.rowValidate; if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') { rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope); } var afterClientValidate = this.importExcelOption.afterClientValidate; if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') { afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope); } var fieldValidate = this.importExcelOption.fieldValidate; if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') { fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope); } this.setLoading(true); readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) { _this.importData = res; _this.refs.dataGrid.setData(res.allData); _this.viewModel.set("dataCount", res.allData.length); _this.refs.errGrid.setData(res.errorMsgData); _this.viewModel.set("errMsgCount", res.errorMsgData.length); }).catch(function (e) { _this.importData = null; _this.refs.dataGrid.setData(); _this.refs.errGrid.setData(); msg(e.toString()); }).finally(function () { _this.setLoading(false); }); }; ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) { if (record.get('__hasError__')) { return "x-grid-record-bg-red"; } }; ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) { return "x-grid-record-bg-red"; }; ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) { var _a; var id = record.data.__importID__; var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex; var selectRecord = null; var dataIndex = -1; var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }); for (var i = 0; i < rows.length; i++) { if (rows[i].importID === id) { selectRecord = this.refs.errGrid.getStore().getAt(i); dataIndex = i; } if (rows[i].errorId === id + "_" + subId) { selectRecord = this.refs.errGrid.getStore().getAt(i); dataIndex = i; break; } } if (selectRecord) { this.refs.errGrid.ensureVisible(selectRecord); this.refs.errGrid.selModel.select(dataIndex); // this.refs.errGrid.reload() } }; ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) { var _a; var id = record.data.importID; var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }); var selectRecord = null; var dataIndex = -1; for (var i = 0; i < rows.length; i++) { if (rows[i].__importID__ === id) { selectRecord = this.refs.dataGrid.getStore().getAt(i); dataIndex = i; break; } } if (selectRecord) { this.refs.dataGrid.ensureVisible(selectRecord); this.refs.dataGrid.selModel.select(dataIndex); // this.refs.dataGrid.reload() } }; ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) { this.viewModel.set("dataType", newValue); if (this.importData) { this.refs.dataGrid.setData(this.importData[newValue]); this.viewModel.set("dataCount", this.importData[newValue].length); } }; ExcelImportDialog.prototype.downloadTemplate = function (sender) { if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) { window.location.href = this.importExcelOption.dowLoadUrl; return; } var xt = []; _$2.forEach(this.importExcelOption.columns, function (v) { xt.push(v.header); }); var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称 if (filename.endsWith(".xlsx")) { filename = filename.split(".xlsx")[0]; } filename = filename + ".xlsx"; var ws_name = "Sheet1"; //Excel第一个sheet的名称 var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]); XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄 XLSX.writeFile(wb, filename); //导出Excel }; ExcelImportDialog.prototype.getData = function (sender) { _$2.each(this.importData.okData, function (item) { delete item.id; delete item.__hasError__; delete item.__importID__; delete item._origin; }); _$2.each(this.importData.allData, function (item) { delete item.id; delete item.__hasError__; delete item.__importID__; delete item._origin; }); _$2.each(this.importData.errorData, function (item) { delete item.id; delete item.__hasError__; delete item.__importID__; delete item._origin; }); this.dialogSuccess(this.importData); }; return ExcelImportDialog; }(Scope)); var model$d = { data: { dataType: "all", errMsgCount: 0, dataCount: 0 } }; var vjsonFunc = function (option) { return { title: option.title || 'excel导入', layout: 'fit', items: [ { layout: 'border', tbar: { xtype: "form", items: [ { xtype: "cols", items: [ { xtype: "filefield", fieldLabel: 'excel文件', buttonText: '请选择excel文件', accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel", flex: 3, listeners: { change: "scope.fileChange" } }, { xtype: "button", iconCls: "x-fa fa-download", text: "下载模版", listeners: { click: "scope.downloadTemplate" } }, { xtype: 'container', border: false, layout: 'hbox', }, { xtype: "button", iconCls: "x-fa fa-upload", text: option.tQButtonText || "提取数据", listeners: { click: "scope.getData" } } ] }, ] }, items: [ { tbar: { xtype: "toolbar", title: "导入的数据", items: [{ xtype: 'label', html: '导入的数据', }, { xtype: 'radiogroup', items: [ { boxLabel: '所有数据', checked: true, inputValue: 'allData', }, { boxLabel: '正确数据', inputValue: 'okData', }, { boxLabel: '错误数据', inputValue: 'errorData', } ], listeners: { change: 'scope.filterData', }, }, { xtype: "textfield", readOnly: true, fieldLabel: "条目数", bind: "{dataCount}" }] }, xtype: 'yvgrid', reference: 'dataGrid', layout: 'fit', pagination: false, // pageSize: 50, getRowClass: 'scope.getDataGridRowRecord', columns: option.columns, region: 'center', split: true, listeners: { cellclick: "scope.dataGridClick", }, selModel: { // type: 'rowmodel', mode: 'SINGLE', }, }, { tbar: { xtype: "toolbar", items: [ { xtype: 'label', html: '错误信息', }, { xtype: "textfield", readOnly: true, fieldLabel: "条目数", bind: "{errMsgCount}" } ] }, xtype: 'yvgrid', reference: 'errGrid', layout: 'fit', pagination: false, getRowClass: 'scope.getErrGridRowRecord', height: "40%", columns: [ { dataIndex: "errorId", header: "ID", hidden: true }, { dataIndex: "importID", header: "行号", width: 80 }, { dataIndex: "errormessage", header: "错误信息", width: 200 }, { dataIndex: "value", header: "值", width: 120 }, { dataIndex: "header", header: "字段名", width: 120 }, { dataIndex: "dataIndex", header: "字段", width: 120 } ], region: 'south', split: true, listeners: { itemclick: "scope.errGridClick" }, selModel: { // type: 'rowmodel', mode: 'SINGLE', }, }, ], }, ], referenceHolder: true, }; }; //# sourceMappingURL=ExcelImportDialog.js.map function buildReportScope(config, reportId, invokeServerFn, getDictFnName) { var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report; var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn); ret.report_id = reportId; ret.report = report; return ret; } function buildVjson$1(config, invokeServerFn, getDictFnName) { var e_1, _a, e_2, _b; var model = { data: { report_name: config.report_name, query: {}, sum: {}, } }; var json5 = window['YvanUI'].json5; var report = config.report ? json5.parse(config.report) : {}; var conditionRows = []; var sumRows = []; model.data.has_sum = _$2.size(report.summary) > 0; // query 查询条件 var newRow = false; var currentRow = { xtype: 'cols', items: [], }; conditionRows.push(currentRow); _$2.forEach(report.query, function (item) { if (newRow) { currentRow = { xtype: 'cols', items: [], }; conditionRows.push(currentRow); } var vj = json5.parse(item.conditionFieldExtend); if (item.conditionFieldXtype) { vj.xtype = item.conditionFieldXtype; if (item.conditionFieldXtype === 'combo') { vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")']; } if (item.conditionFieldXtype === 'datetimefield') { //@ts-ignore _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss')); } else if (item.conditionFieldXtype === 'datefield') { //@ts-ignore _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD')); } else { model.data.query[item.conditionFieldBind] = ''; } } else { // 没有组件类型,是个空占位符 vj.border = false; } if (item.conditionFieldBind) { vj.bind = { value: '{query.' + item.conditionFieldBind + '}' }; } if (item.conditionFieldFlex) { vj.flex = item.conditionFieldFlex; } if (item.conditionFieldXtype) { vj.fieldLabel = item.conditionFieldLabel; } if (item.fieldLabel) { vj.fieldLabel = item.fieldLabel; } newRow = item.conditionFieldWrap || false; currentRow.items.push(vj); }); if (currentRow) { currentRow.margin = '10 0 10 0'; } // sum 汇总条件 newRow = true; try { for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) { var item = _d.value; if (newRow) { currentRow = { xtype: 'cols', defaultType: 'displayfield', defaults: { labelWidth: 70, }, items: [] }; sumRows.push(currentRow); } var vj = __assign({}, json5.parse(item.sumFieldExtend)); if (item.sumFieldBind) { vj.bind = '{sum.' + item.sumFieldBind + '}'; model.data.sum[item.sumFieldBind] = ''; } else { // 没有组件类型,是个空占位符 vj.border = false; } if (item.sumFieldFlex) { vj.flex = item.sumFieldFlex; } if (item.sumFieldLabel) { vj.fieldLabel = item.sumFieldLabel; } // sumFieldBind: "zs" // sumFieldExtend: "{}" // sumFieldFlex: 1 // sumFieldLabel: "总数" // sumFieldWrap: false newRow = item.sumFieldWrap || false; currentRow.items.push(vj); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } if (currentRow) { currentRow.margin = '10 0 10 0'; } // column 结果字段 var columns = []; try { for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) { var item = _f.value; var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend)); if (item.xtype) { if (item.xtype == 'checkbox') { vj.xtype = 'checkcolumn'; vj.disabled = true; } else { vj.xtype = item.xtype; } } if (item.dataType) { vj.dataType = item.dataType; } if (item.align) { vj.align = item.align; } if (item.width) { vj.width = item.width; } if (item.dict) { vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")']; } columns.push(vj); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_f && !_f.done && (_b = _e.return)) _b.call(_e); } finally { if (e_2) throw e_2.error; } } var vjson = { bind: { title: '{report_name}', }, layout: 'fit', referenceHolder: true, items: [ { layout: 'border', border: false, items: [ { region: 'north', border: false, tbar: { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '查询', reference: 'btnSearch', iconCls: 'x-fa fa-search', listeners: { click: 'scope.reload', }, }, { xtype: 'button', text: '关闭', iconCls: 'x-fa fa-times', listeners: { click: 'system.closeMe()', }, }, ], }, defaults: { margin: '8 0 0 0' }, items: __spread(conditionRows, sumRows), fix: ['system.enterToClick("btnSearch")'], }, __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: { method: 'invoke', url: '/report/Report@execute', params: { dataSource: report.dataSource, pagination: report.grid.pagination || true, report_id: config.report_id, query: '{query}', }, }, columns: columns }, report.grid), ], }, ], }; return { model: model, vjson: vjson, report: report }; } var ReportScope = /** @class */ (function (_super) { __extends(ReportScope, _super); function ReportScope(_a, invokeServerFn) { var model = _a.model, vjson = _a.vjson; var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this; _this.invokeServerFn = invokeServerFn; return _this; } ReportScope.prototype.onLoad = function () { // this.reload() }; ReportScope.prototype.reload = function () { var _this = this; // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum if (this.viewModel.get('has_sum')) { this.invokeServerFn('/report/Report@executeSum', { dataSource: this.report.dataSource, report_id: this.report_id, query: this.viewModel.get('query'), }).then(function (res) { if (!res.success) { showErrorDialog$1(res.msg); } else { window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false); } }); } this.refs.grid1.reload(); }; return ReportScope; }(Scope)); //# sourceMappingURL=Report.js.map var model$e = { data: { form: { resource_parent: '', resource_name: '', resource_icon: '', scope_url: '', scope_params: '', resource_order: '', permission_code: '', }, } }; //# sourceMappingURL=RegisterModule.model.js.map var vjson$d = { title: '注册模块', layout: 'fit', width: "40%", height: "50%", fbar: { xtype: 'toolbar', items: [ { xtype: "button", text: "确定", iconCls: 'x-fa fa-check', listeners: { click: 'scope.saveNode', } }, { xtype: "button", text: "关闭", iconCls: 'x-fa fa-times', listeners: { click: 'system.closeMe()', } }, ] }, items: [ { layout: 'border', items: [ { region: 'west', layout: 'fit', xtype: 'tabpanel', reference: 'tabs', width: "50%", split: true, listeners: { tabchange: 'scope.tabchange', }, items: [ { region: 'center', layout: 'fit', title: 'PC菜单', key: "1", items: [ { xtype: 'treepanel', layout: 'fit', region: 'west', rootVisible: false, useArrows: true, reference: 'tree1', listeners: { itemclick: "scope.tree1NodeClick", } }, ] }, { region: 'center', layout: 'fit', title: 'PDA菜单', key: "2", items: [ { xtype: 'treepanel', layout: 'fit', region: 'west', reference: 'tree2', rootVisible: false, useArrows: true, listeners: { itemclick: "scope.tree1NodeClick", } }, ] }, ] }, { region: 'center', xtype: 'form', margin: '0 0 0 0', split: true, width: '50%', items: [ { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '上级资源ID', bind: { readOnly: true, disabled: true, value: '{form.resource_parent}' }, }, ], }, { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '资源名称', bind: { value: '{form.resource_name}' }, allowBlank: false, }, ], }, { xtype: 'cols', items: [ { xtype: 'numberfield', fieldLabel: '资源排序', bind: { value: '{form.resource_order}' }, allowBlank: false, }, ], }, { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '功能URL', bind: { disabled: true, value: '{form.scope_url}' }, }, ] }, { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '权限编码', bind: { value: '{form.permission_code}' } }, ], }, { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '功能参数', bind: { value: '{form.scope_params}' } }, ], }, ], }, ], }, ], referenceHolder: true, }; //# sourceMappingURL=RegisterModule.view.js.map var RegisterModule = /** @class */ (function (_super) { __extends(RegisterModule, _super); function RegisterModule() { return _super.call(this, { model: model$e, vjson: vjson$d }) || this; } RegisterModule.prototype.onLoad = function () { this.reloadTree("PC"); }; RegisterModule.prototype.tabchange = function (a, b, c, d) { var currTabKey = b.key; if (currTabKey === '1') { this.viewModel.set('form', ''); this.reloadTree("PC"); } else { this.viewModel.set('form', ''); this.reloadTree("PDA"); } }; RegisterModule.prototype.reloadTree = function (type) { var _this = this; if ("PC" === type) { this.setLoading(true); getMenuTree({ type: "PC" }).then(function (res) { if (res.success) { _this.refs.tree1.store.setRootNode({ expanded: true, children: res.data }); } }).finally(function () { _this.setLoading(false); }); } else { this.setLoading(true); getMenuTree({ type: "PDA" }).then(function (res) { if (res.success) { _this.refs.tree2.store.setRoot({ expanded: true, children: res.data }); } }).finally(function () { _this.setLoading(false); }); } }; RegisterModule.prototype.tree1NodeClick = function (tree, node) { var id = _$2.split(node.data.id, '_')[1]; if (!id) { return; } this.viewModel.set('form.resource_parent', id); }; RegisterModule.prototype.saveNode = function () { var _this = this; var tabKey = this.refs.tabs.activeTab.key; // 检验菜单数据 var param = this.viewModel.get('form'); if (!param.resource_parent) { msg('请选择一个父节点'); return; } if (!param.resource_name) { msg('资源名称不能为空'); return; } if (!param.scope_url) { msg('功能URL不能为空'); return; } var type; if (tabKey === '1') { type = 'PC'; } else { type = 'PDA'; } this.setLoading(true); registerResource(__assign(__assign({}, param), { type: type })).then(function (res) { if (res.success) { msg("注册成功"); _this.close(); } }).finally(function () { _this.setLoading(false); }); }; return RegisterModule; }(Scope)); //# sourceMappingURL=RegisterModule.js.map var model$f = { data: { title: "模板选择", // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询 moduleType: 1, // 当前模块包路径 "com/galaxis/wms/bas/area" packagePath: "", // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area" fileSavePath: "", // 模块名称 "Dict" moduleName: "NewModule", // 页面标题 "字典维护" pageTitle: "新模块", // 单表查询 singleTable: { sql: "select * from bas_dict", // 新增或者删除所用的表 tableName: "", // 是否分页查询 pagination: true, // 是否需要删除 delete: true, // 删除条件字段 deleteWhereColumn: "", // 删除提示语 deleteTips: "确定要删除?", // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑; editType: 2, }, singleTableView: { tableNameList: [ // { value: "aaa"}, ], columnList: [ // { value: "aaa"}, ], } } }; //# sourceMappingURL=CreateModule.model.js.map var vjson$e = { bind: { title: '新建模块-{title}', }, width: "55%", height: "60%", minWidth: 500, minHeight: 400, modal: true, frame: true, layout: 'card', bbar: [ '->', { itemId: 'card-prev', text: '« 上一步', disabled: true, listeners: { click: 'scope.showPrevious', }, }, { itemId: 'card-next', text: '下一步 »', listeners: { click: 'scope.showNext', }, }, { itemId: 'card-finish', text: '立刻执行', iconCls: 'x-fa fa-flash', hidden: true, listeners: { click: 'scope.finish', }, }, ], items: [ { vtitle: '模板选择', reference: 'templateSelection', layout: { type: 'hbox', pack: 'start', align: 'stretch' }, listeners: { cardEnter: 'scope.templateEnter', cardLevel: 'scope.templateLevel' }, items: [ { width: 150, xtype: 'form', border: false, layout: { type: 'vbox', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { xtype: 'radiogroup', bind: { value: '{moduleType}' }, layout: 'vbox', defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { boxLabel: '单表查询', inputValue: 1 }, { boxLabel: '主/明细查询', inputValue: 2 }, { boxLabel: '树/明细查询', inputValue: 3 }, { boxLabel: '卡片表单', inputValue: 4 }, { boxLabel: '主/详情查询', inputValue: 5 }, ] }, ] }, { flex: 1, region: 'center', xtype: "panel", border: false, frame: true, padding: "4px 8px", html: "描述...", } ] }, { vtitle: '模块名称', reference: 'moduleName', layout: 'fit', listeners: { cardEnter: 'scope.moduleEnter', cardLevel: 'scope.moduleLevel' }, items: [ { xtype: 'form', border: false, layout: { type: 'vbox', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { xtype: 'textfield', fieldLabel: '包路径', allowBlank: false, bind: { value: '{packagePath}' }, }, { xtype: 'textfield', fieldLabel: '文件路径', allowBlank: false, bind: { value: '{fileSavePath}' }, }, { xtype: 'textfield', fieldLabel: '模块名', allowBlank: false, bind: { value: '{moduleName}' }, }, { xtype: 'textfield', fieldLabel: '菜单名', allowBlank: false, bind: { value: '{pageTitle}' }, }, ] }, ] }, { vtitle: '确认结果', reference: 'confirmResult', layout: 'fit', listeners: { cardEnter: 'scope.optionEnter', cardLevel: 'scope.optionLevel', }, items: [ { xtype: 'jsoneditor', reference: 'jsoneditor' } ] }, // ---------------------------------------------------------------------------------- 单表查询 { vtitle: '查询SQL', reference: 'singleTable_1', layout: 'fit', listeners: { cardEnter: 'scope.editorEnter', cardLevel: 'scope.editorLevel' }, items: [ { xtype: 'sqleditor', } ], }, { vtitle: '字段选项', reference: 'singleTable_2', layout: 'fit', listeners: { cardEnter: 'scope.columnEnter', cardLevel: 'scope.columnLevel', }, items: [ { xtype: 'yvgrid', border: false, selModel: { type: 'spreadsheet', columnSelect: true, pruneRemoved: false, extensible: 'y' }, plugins: { clipboard: true, selectionreplicator: true }, reference: 'grid1', idField: 'column_name', hideFootbar: true, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'scope.addField' } }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'scope.removeField' } }, { xtype: 'button', text: '分析SQL', iconCls: 'x-fa fa-refresh', listeners: { click: 'scope.parseSQL' } }, ] }, columns: [ { text: '字段名', dataIndex: 'column_name', sortable: false, menuDisabled: true, width: 150, editor: { allowBlank: true, selectOnFocus: false, } }, { text: '字段中文', dataIndex: 'column_comment', width: 150, sortable: false, menuDisabled: true, editor: { allowBlank: true, selectOnFocus: false, } }, { dataIndex: "column_useto", // fix: ['system.getDict("column_useto")'], header: "用途", editor: { xtype: 'combo', allowBlank: false, }, }, { text: '主键', dataIndex: 'is_primary_key', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 48, resizable: false, }, { text: '必填', dataIndex: 'not_null', xtype: 'checkcolumn', sortable: false, menuDisabled: true, width: 48, resizable: false, }, { text: '长度', dataIndex: 'column_size', sortable: false, menuDisabled: true, xtype: 'numbercolumn', format: '0', editor: { allowBlank: true, selectOnFocus: true } }, { text: '字典', dataIndex: 'column_dict', sortable: false, menuDisabled: true, width: 200, editor: { allowBlank: true, } }, { text: 'UI组件', dataIndex: 'column_ui', sortable: false, menuDisabled: true, // fix: ['system.getDict("column_ui")'], width: 150, editor: { xtype: 'combo', allowBlank: true, } }, { dataIndex: 'data_type', hidden: true, }, ] } ], }, { vtitle: '其他选项', reference: 'singleTable_3', isEnd: true, listeners: { cardEnter: 'scope.extendEnter', cardLevel: 'scope.extendLevel', }, layout: 'fit', items: [ { xtype: 'form', border: false, layout: { type: 'vbox', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { xtype: 'checkbox', fieldLabel: '需要分页', labelWidth: 100, bind: { value: '{singleTable.pagination}', }, }, { xtype: 'combobox', fieldLabel: '操作数据库表', labelWidth: 100, publishes: 'singleTable.tableName', displayField: 'value', valueField: 'value', bind: { data: '{singleTableView.tableNameList}', value: '{singleTable.tableName}', }, }, { xtype: 'checkboxfield', fieldLabel: '需要删除', labelWidth: 100, bind: { value: '{singleTable.delete}', }, }, { xtype: 'combobox', fieldLabel: '删除条件字段', labelWidth: 100, publishes: 'singleTable.deleteWhereColumn', displayField: 'value', valueField: 'value', bind: { data: '{singleTableView.columnList}', hidden: '{!singleTable.delete}', value: '{singleTable.deleteWhereColumn}', }, }, { xtype: 'textfield', fieldLabel: '删除提示语句', labelWidth: 100, bind: { hidden: '{!singleTable.delete}', value: '{singleTable.deleteTips}', }, }, { fieldLabel: '新增与编辑', labelWidth: 100, xtype: 'radiogroup', bind: { value: '{singleTable.editType}' }, layout: 'vbox', defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { boxLabel: '不要新增和编辑', inputValue: 1 }, { boxLabel: '表格内新增/编辑', inputValue: 2 }, { boxLabel: '对话框新增/编辑', inputValue: 3 }, ] }, ] } ] }, // ---------------------------------------------------------------------------------- 主/明细查询 { vtitle: '主表查询SQL', reference: 'mainDetailTable_1', layout: 'fit', listeners: {}, items: [], }, { vtitle: '主表字段选项', reference: 'mainDetailTable_2', layout: 'fit', listeners: {}, items: [], }, { vtitle: '主表其他选项', reference: 'mainDetailTable_3', layout: 'fit', listeners: {}, items: [], }, { vtitle: '子表查询SQL', reference: 'mainDetailTable_4', layout: 'fit', listeners: {}, items: [], }, { vtitle: '子表字段选项', reference: 'mainDetailTable_5', layout: 'fit', listeners: {}, items: [], }, { vtitle: '子表其他选项', reference: 'mainDetailTable_6', isEnd: true, layout: 'fit', listeners: {}, items: [], }, // ---------------------------------------------------------------------------------- 树/明细查询 // ---------------------------------------------------------------------------------- 卡片表单 { vtitle: '表单字段', reference: 'cardForm_1', layout: 'fit', listeners: {}, items: [], }, { vtitle: '表单初始化', reference: 'cardForm_2', isEnd: true, layout: 'fit', listeners: {}, items: [], }, ] }; //# sourceMappingURL=CreateModule.view.js.map // noinspection TypeScriptCheckImport function getSingleTableData(origin) { return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) { var _a, _b, _c; var data = { pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true, package: _$2.replace(origin.packagePath, /\//g, "."), groovyClass: origin.moduleName, qClass: queryDslInfo.qClass, qClassTable: queryDslInfo.qClassTable, queryColumns: [], insertColumns: [], updateColumns: [], updateWheres: [], deleteWheres: [], gridColumns: [], sql: origin.sql, pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块", addButton: origin.editType !== 1, saveButton: origin.editType === 2, deleteButton: true, deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?", invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName, fileSavePath: origin.fileSavePath, }; origin.columnList.forEach(function (column) { var column_name = column.column_name, column_comment = column.column_comment, is_primary_key = column.is_primary_key, column_dict = column.column_dict, column_ui = column.column_ui; var query = origin.queryColumns.indexOf(column_name) >= 0; var insert = origin.insertColumns.indexOf(column_name) >= 0; var update = origin.updateColumns.indexOf(column_name) >= 0; var grid = origin.gridColumns.indexOf(column_name) >= 0; var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; }); var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod; if (query) { data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui }); } if (insert) { data.insertColumns.push({ qClassField: qClassField, paramField: column_name }); } if (update) { data.updateColumns.push({ qClassField: qClassField, paramField: column_name }); } if (grid) { var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined }; if (column_dict) { gridColumn.fix = { dictName: column_dict }; } if (origin.editType == 2 && (insert || update)) { gridColumn.editor = { xtype: column_ui, fix: undefined }; if (column_dict) { gridColumn.editor.fix = { dictName: column_dict }; } } data.gridColumns.push(gridColumn); } if (is_primary_key) { data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name }); data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name }); } }); return data; }); } // noinspection HttpUrlsUsage var urlPrefix = "/static/studio-template/single_table"; function generateCode(data) { return Promise.all([ request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }), request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }), request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }), request.get(urlPrefix + "/view.hbs", { responseType: 'text' }), request.get(urlPrefix + "/model.hbs", { responseType: 'text' }), ]).then(function (values) { var groovy = handlebars.compile(values[0]); var mybatis = handlebars.compile(values[1]); var controller = handlebars.compile(values[2]); var view = handlebars.compile(values[3]); var model = handlebars.compile(values[4]); var code = { groovy: groovy(data), mybatis: mybatis(data), controller: controller(data), view: view(data), model: model(data), }; return code; }); } //# sourceMappingURL=SingleTableCodegen.js.map var CreateModule = /** @class */ (function (_super) { __extends(CreateModule, _super); function CreateModule() { var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this; _this.columns = []; return _this; } CreateModule.prototype.onLoad = function () { this.refs.grid1.setData([]); }; CreateModule.prototype.addField = function () { this.refs.grid1.appendEditRow({ column_name: '', column_comment: '', is_primary_key: false, not_null: true, column_domain: '', data_type: '', column_size: 0, decimal_digits: 0, default_value: '', column_dict: '', column_ui: '', column_note: '', }, 0); }; CreateModule.prototype.removeField = function () { var _this = this; var rows = []; this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _$2.forEach(rows, function (r) { _this.refs.grid1.getStore().remove(r); }); }; CreateModule.prototype.parseSQL = function (sender) { var _this = this; var sql = this.viewModel.get('singleTable.sql'); sender.up('window').setLoading(true); instance$1.reloadIfNeedPromise(undefined).then(function (res) { parseSqlApi(sql).then(function (parseResult) { if (!parseResult.success) { msg(parseResult.msg); return; } var tableNameList = []; var columnList = []; var singleTableTableName; var singleTableDeleteWhereColumn; _this.refs.grid1.setData([]); var rows = _this.refs.grid1.getDataRows(); _$2.forEach(parseResult.data, function (parseRetColumn) { var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName; if (!columnName || _$2.indexOf(columnName, '?') >= 0) { return; } if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0) tableNameList.push({ value: tableName }); if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0) columnList.push({ value: columnName }); if (!singleTableTableName) singleTableTableName = tableName; if (!singleTableDeleteWhereColumn) singleTableDeleteWhereColumn = columnName; // 已经加过这个列了 var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; }); if (rowExists) { return; } var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName); if (columnRow) { _this.refs.grid1.appendEditRow({ table_name: tableName, column_name: columnRow.column_name, column_comment: columnRow.column_comment, column_useto: 2, is_primary_key: columnRow.is_primary_key, not_null: columnRow.not_null, column_size: columnRow.column_size, column_dict: columnRow.column_dict, column_ui: columnRow.column_ui, data_type: columnRow.data_type, }); if (columnRow.is_primary_key) singleTableDeleteWhereColumn = columnName; } else { _this.refs.grid1.appendEditRow({ table_name: tableName, column_name: columnName, column_useto: 2, }); } }); _this.viewModel.set("singleTableView.columnList", columnList); _this.viewModel.set("singleTableView.tableNameList", tableNameList); _this.viewModel.set("singleTable.tableName", singleTableTableName); _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn); }).finally(function () { sender.up('window').setLoading(false); }); }).catch(function () { sender.up('window').setLoading(false); }); }; CreateModule.prototype.templateEnter = function (sender) { }; CreateModule.prototype.templateLevel = function (sender, opt) { if (!this.viewModel.get('moduleType')) { msg('请选择模板类型'); opt.cancel = true; return; } }; CreateModule.prototype.moduleEnter = function (sender) { }; CreateModule.prototype.moduleLevel = function (sender, opt) { if (!sender.down('form').isValid()) { opt.cancel = true; return; } }; CreateModule.prototype.editorEnter = function (sender) { var editor = sender.down('sqleditor'); editor.setValue(this.viewModel.get('singleTable.sql')); }; CreateModule.prototype.editorLevel = function (sender, opt) { var editor = sender.down('sqleditor'); var sql = editor.getValue(); if (!sql) { msg('查询SQL语句必填'); opt.cancel = true; return; } this.viewModel.set('singleTable.sql', sql); }; CreateModule.prototype.columnEnter = function (sender) { }; CreateModule.prototype.columnLevel = function (sender, opt) { }; CreateModule.prototype.extendEnter = function (sender) { }; CreateModule.prototype.extendLevel = function (sender, opt) { }; // 确认结果 - Enter CreateModule.prototype.optionEnter = function (sender) { var _this = this; // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单; var moduleType = this.viewModel.get("moduleType"); var data = this.viewModel.getData(); var code = ""; var origin = {}; if (moduleType === 1) { var singleTable = data.singleTable; var editColumns = this.refs.grid1.getDataRows(); origin.moduleType = data.moduleType; origin.packagePath = data.packagePath; origin.fileSavePath = data.fileSavePath; origin.moduleName = data.moduleName; origin.pageTitle = data.pageTitle; if (singleTable) { origin.sql = singleTable.sql; origin.tableName = singleTable.tableName; origin.pagination = singleTable.pagination; origin.delete = singleTable.delete; origin.deleteWhereColumn = singleTable.deleteWhereColumn; origin.deleteTips = singleTable.deleteTips; origin.editType = singleTable.editType; } origin.columnList = []; origin.queryColumns = []; origin.insertColumns = []; origin.updateColumns = []; origin.gridColumns = []; editColumns.forEach(function (column) { var row = { table_name: column.table_name, column_name: column.column_name, column_comment: column.column_comment, is_primary_key: column.is_primary_key, not_null: column.not_null, column_size: column.column_size, column_dict: column.column_dict, column_ui: column.column_ui, data_type: column.data_type, column_type: column.column_type, }; origin.columnList.push(row); // 1:查询条件; 2:查询结果; 3:条件+结果; var column_name = column.column_name, column_useto = column.column_useto; switch (column_useto) { case 1: origin.queryColumns.push(column_name); break; case 2: origin.gridColumns.push(column_name); break; case 3: origin.queryColumns.push(column_name); origin.gridColumns.push(column_name); break; } origin.insertColumns.push(column_name); origin.updateColumns.push(column_name); }); } this.setLoading(true); getSingleTableData(origin).then(function (data) { code = JSON.stringify(data, null, 4); window['lastTemplateData'] = code; var editor = _this.refs.jsoneditor; editor.setCode(code); }).finally(function () { return _this.setLoading(false); }); }; // 确认结果 - Level CreateModule.prototype.optionLevel = function (sender, opt) { }; // 上一步 CreateModule.prototype.showPrevious = function () { this.doCardNavigation(false); }; // 下一步 CreateModule.prototype.showNext = function () { this.doCardNavigation(true, true); }; CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) { if (isNext === void 0) { isNext = true; } if (isCancelable === void 0) { isCancelable = false; } var layout = this._handle.getLayout(); var activeItem = layout.activeItem; var reference = activeItem.reference, isEnd = activeItem.isEnd; if (isNext) this.prevCard = reference; var activeCard; if (reference === "templateSelection") { if (isNext) { activeCard = this.refs['moduleName']; } } else if (reference === "moduleName") { if (isNext) { // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单; var moduleType = this.viewModel.get("moduleType"); switch (moduleType) { case 1: activeCard = this.refs['singleTable_1']; break; case 2: activeCard = this.refs['mainDetailTable_1']; break; case 3: // activeCard = break; case 4: activeCard = this.refs['cardForm_1']; break; } } else { activeCard = this.refs['templateSelection']; } } else if (reference === "confirmResult") { if (!isNext) { activeCard = this.refs[this.prevCard]; } } else { var name = reference.split('_')[0]; var idx = parseInt(reference.split('_')[1], 10); if (isNext) { if (isEnd) { activeCard = this.refs['confirmResult']; } else { idx += 1; } } else { idx -= 1; } if (idx <= 0) { activeCard = this.refs['moduleName']; } else if (!activeCard) { activeCard = this.refs[name + "_" + idx]; } } // 按钮状态 this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']); this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']); this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']); // 设置下一页显示 if (activeCard) { var optCancel = { cancel: false }; // 发出 cardLevel 事件 layout.activeItem.fireEvent('cardLevel', activeItem, optCancel); if (isCancelable && optCancel.cancel) { // 取消了 return; } layout.setActiveItem(activeCard); this.viewModel.set('title', layout.activeItem.vtitle); layout.activeItem.fireEvent('cardEnter', layout.activeItem); } }; // 立刻执行 CreateModule.prototype.finish = function (sender) { var _this = this; var parent = sender.up('window'); var editor = this.refs.jsoneditor; var data = JSON.parse(editor.getCode()); // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单; var moduleType = this.viewModel.get("moduleType"); if (moduleType === 1) { this.setLoading(true); generateCode(data).then(function (code) { console.log("===> ", code); _this.setLoading(true); saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass })) .then(function () { msg("创建成功!"); parent.close(); handles$1.fileTree.reload(); }).finally(function () { return _this.setLoading(false); }); }).finally(function () { return _this.setLoading(false); }); } }; return CreateModule; }(Scope)); //# sourceMappingURL=CreateModule.js.map function getModuleId(path) { var separator = "/"; var sps = path.split(separator); var joinSps = sps.join('$'); if (!joinSps) { return "ROOT"; } return joinSps; } /** * Module数据转换成Tree数据 */ function modulesToTreeData(modules) { var separator = "/"; var treeNodeMap = new Map(); var root = { type: "Dir", path: "", expanded: true, leaf: false, children: [], }; root.id = getModuleId(root.path); treeNodeMap.set(root.path, root); modules.forEach(function (module) { var _a; var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; }); if (paths.length <= 0) return; var path = []; var parent = root; paths.forEach(function (dirName, idx) { var parentPath = path.join(separator); parent = treeNodeMap.get(parentPath); path.push(dirName); var currentPath = path.join(separator); var child = treeNodeMap.get(currentPath); if (child == null) { // 获取当前path 绝对路径 var indexLength = module.absolutePath.indexOf(currentPath); var currentAbsolutePath = ""; if (indexLength > 0) { currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath; } child = { type: "Dir", path: currentPath, absolutePath: currentAbsolutePath, leaf: false, children: [], text: dirName }; child.id = getModuleId(child.path); parent.children.push(child); treeNodeMap.set(child.path, child); } if ((idx + 1) === paths.length && module.name && module.jsControllerFile) { var leaf = { type: "Module", path: module.path + separator + module.name, absolutePath: module.absolutePath, leaf: true, text: module.name, module: module, }; leaf.id = getModuleId(leaf.path); child.children.push(leaf); treeNodeMap.set(leaf.path, leaf); } }); }); // 排序处理 treeNodeMap.forEach(function (module) { if (module.children) { var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; }); module.children.length = 0; children.forEach(function (item) { return module.children.push(item); }); } }); return root; } function showDialog(sender, option) { var _a, _b; var win = new Ext.Window({ autoDestroy: true, title: option.title, width: (_a = option.width) !== null && _a !== void 0 ? _a : 400, height: (_b = option.height) !== null && _b !== void 0 ? _b : 300, resizable: false, closable: true, modal: true, maximizable: false, minimizable: false, // constrainHeader: true, constrain: true, layout: 'fit', animateTarget: sender, buttonAlign: 'center', items: [ { xtype: "form", layout: "hbox", margin: '10px 20px', border: 0, items: option.items } ], //窗口按钮 fbar: [ { xtype: 'button', text: '保存', handler: function (btn) { //窗口获取表单 var form = win.down('form'); var vaildSuccess = form.isValid(); if (!vaildSuccess) { return; } option.submitFunc(form); } }, { xtype: 'button', text: '取消', handler: function (btn) { //窗口关闭 btn.up('window').close(); } } ], }); win.show(); } function showCreateFolderWin(sender, parentPath) { showDialog(sender, { title: '新建文件夹', height: 150, items: [ { xtype: "textfield", name: "filename", fieldLabel: "文件夹名称", allowBlank: false, selectOnFocus: true, regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/, regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号", labelWidth: 80, width: "100%", listeners: { afterrender: function (sender) { _$2.defer(function () { sender.focus(); }); } } }, ], submitFunc: function (form) { var filename = form.down('textfield[name="filename"]').getValue(); createFolder(parentPath, filename).then(function (res) { if (res.success) { msg$1('创建成功'); handles$1.fileTree.reload(); form.up('window').close(); } else { showErrorDialog$1(res.msg); } }).catch(function (e) { showErrorDialog$1(e.responseJSON.msg); }); } }); } function showCreateModuleCrudWin(sender, path, absolutePath) { var dlg = new CreateModule(); dlg.showDialog(sender, {}, { data: { packagePath: path, fileSavePath: absolutePath, } }); } function registerModule$1(sender, path, name, icon) { // 前缀 com/galaxis/wms 写死了 var dlg = new RegisterModule(); dlg.showDialog(sender, {}, { data: { form: { scope_url: path.replace("com/galaxis/wms", "."), resource_name: name, resource_icon: icon, } } }); } function showCreateEmptyModule(sender, path) { var win = new Ext.Window({ autoDestroy: true, title: "新建空模块", width: 400, height: 150, resizable: true, closable: true, maximizable: true, minimizable: true, plain: true, // constrainHeader: true, constrain: true, layout: 'fit', animateTarget: sender, buttonAlign: 'center', items: [ { xtype: "form", layout: "hbox", margin: '10px 20px', border: 0, items: [ { flex: 1, layout: 'vbox', items: [ { xtype: "textfield", name: "filename", fieldLabel: "模块名", flex: 1, allowBlank: false, regex: /^[a-zA-Z][a-zA-Z0-9]*$/, regexText: "文件名只能以英文字母开头,且只包含英文字母、数字", labelWidth: 50, width: "100%", }, ] }, ] } ], //窗口按钮 buttons: [ { xtype: 'button', text: '保存', handler: function (btn) { //窗口获取表单 var form = win.down('form'); var vaildSuccess = form.isValid(); if (!vaildSuccess) { return; } var filename = form.down('textfield[name="filename"]').getValue(); createEmptyModule(path, filename).then(function (res) { if (res.success) { Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' }); handles$1.fileTree.reload(); win.close(); } else { Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' }); } }).catch(function (e) { Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' }); }); } }, { xtype: 'button', text: '取消', handler: function (btn) { //窗口关闭 win.close(); } } ] }); win.show(); } //# sourceMappingURL=FileHelp.js.map function initFileTree () { Ext.define('com.yvan.studio.FileTree', { extend: 'com.yvan.studio.StateTree', xtype: 'filetree', tooltip: '文件', iconCls: 'x-fa fa-file', rootVisible: false, useArrows: true, colspan: 2, lines: true, reference: 'filetree', multiSelect: true, getStateFilename: function () { return getCurrentProject().uuid + "/filetree.json"; }, openNode: function () { var selection = this.getSelection(); var _a = __read(selection, 1), record = _a[0]; if (!record) { return; } var raw = record.raw; if (raw.type === 'Dir') { return; } if (raw.type === "Module" && raw.module) { eventBus.publish(EventType.ModuleOpen, raw); } }, openInIdea: function () { var _a = __read(this.getSelection(), 1), record = _a[0]; if (record) { var data = record.data; if (data.type === "Module") { if (data.module.groovyFile && data.module.groovyFile.exists) { native.openInIdea(data.module.groovyFile.absolutePath); } else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) { native.openInIdea(data.module.jsControllerFile.absolutePath); } else if (data.module.jsViewFile && data.module.jsViewFile.exists) { native.openInIdea(data.module.jsViewFile.absolutePath); } return; } msg$1('只有文件、模块类型才能在 IDEA 中打开.'); } }, deleteSelection: function () { var selection = this.getSelection(); var pathList = []; _.forEach(selection, function (item) { if (item.data.type === "Dir") { pathList.push({ path: item.data.path, isFolder: true }); } else { pathList.push({ path: item.data.path, isFolder: false }); } }); { return; } // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?' // // Ext.Msg.confirm('提示', title, (btn) => { // if (btn === 'yes') { // deleteFileOrFolder(raw.path, title, true) // } // }) // const title = '您确定要删除(' + raw.path + ')吗?' // deleteFileOrFolder(raw.path, title, false) }, listeners: { itemverify: function () { this.openNode(); }, afterrender: function (me) { console.log('filetree_afterrender', 'reloadIfNeed'); moduleStore.registe(me.subscribeModule.bind(this)); moduleStore.reloadIfNeed("PC"); }, destroy: function (me) { console.log('filetree_destroy'); moduleStore.unregiste(me.subscribeModule.bind(this)); }, itemcontextmenu: function (sender, node, element, idx, e) { e.preventDefault(); var raw = node.raw; var option = {}; if (raw.type === 'Dir') { // 文件夹右键 option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '新建空模块', iconCls: 'x-fa fa-plus-circle', handler: function (sender) { showCreateEmptyModule(sender, raw.path); } }, { text: '新建模块', iconCls: 'x-fa fa-plus-circle', handler: function (sender) { showCreateModuleCrudWin(sender, raw.path, raw.absolutePath); } }, '-', { text: '新建文件夹', iconCls: 'x-fa fa-folder-o', handler: function (sender) { var parentPath = raw.path; showCreateFolderWin(sender, parentPath); } }, { text: '复制路径', iconCls: 'x-fa fa-external-link', handler: function (sender) { native.clipboardSet(raw.path); } }, ] }; } else { // 文件右键 option = { shadow: 'frame', allowOtherMenus: true, items: [ // { // text: '重命名', // iconCls: 'x-fa fa-terminal', // handler(sender) { // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/ // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字" // showRenameWin(sender, raw.path, raw.text, regex, regexText, false) // } // }, // { // text: '另存为', // iconCls: 'x-fa fa-exchange', // handler(sender) { // console.error('没做') // } // }, { text: '复制路径', iconCls: 'x-fa fa-external-link', handler: function (sender) { native.clipboardSet(raw.path); } }, '-', { text: '注册模块', iconCls: 'x-fa fa-sign-in', handler: function (sender) { registerModule$1(sender, raw.path); } }, ] }; } var treeMenu = new Ext.menu.Menu(option); treeMenu.showAt(e.getXY()); }, }, tbar: [ { xtype: 'button', iconCls: 'x-fa fa-crosshairs', tooltip: '选中当前打开的文件', handler: function (sender) { msg$1('没做'); } }, { xtype: 'button', iconCls: 'x-fa fa-link', tooltip: '在IDEA中打开', handler: function (sender) { var scope = sender.up("filetree"); scope.openInIdea(); } }, { xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新', handler: function (sender) { var scope = sender.up("filetree"); scope.reload(); } }, { xtype: 'button', iconCls: 'x-fa fa-percent', tooltip: '监控', handler: function (sender) { // handles.mainWindow.showPerform() } }, ], initComponent: function () { setFileTree(this); this.superclass.initComponent.apply(this, arguments); // super.initComponent.apply(this, arguments) }, subscribeModule: function (res) { if (typeof res === 'object') { var rootNode = modulesToTreeData(res.data); this.setRootNode(rootNode); this.restoreState(); handles$1.mainWindow.modules = res.data; } else if (typeof res === 'boolean') { this.setLoading(res); } }, reload: function () { console.log('filetree_reloadForce'); moduleStore.reloadForce("PC").then(function (res) { }); } }); } //# sourceMappingURL=FileTree.js.map function initDbTree () { var define = { extend: 'com.yvan.studio.StateTree', xtype: 'dbtree', tooltip: '数据库', iconCls: 'x-fa fa-database', rootVisible: false, useArrows: true, reference: 'dbtree', multiSelect: true, getStateFilename: function () { return getCurrentProject().uuid + "/dbtree.json"; }, tbar: [ { xtype: 'button', iconCls: 'x-fa fa-crosshairs', tooltip: '选中当前打开的表', handler: function (sender) { var _a; // 获取当前选中的活动标签 tableColumn_bas_car var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath; if (!locatPath) { return; } handles$1.dbTree.selectPath(locatPath); } }, { xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新', handler: function (sender) { handles$1.dbTree.reload(); } }, { xtype: 'button', iconCls: 'x-fa fa-cloud-download', tooltip: '重新拉取生成元数据(耗时很长!)', handler: function (sender) { handles$1.dbTree.dbToMetaAndReload(sender); } }, // { // xtype: 'button', // iconCls: 'x-fa fa-files-o', // tooltip: '数据同步', // handler(sender) { // // } // }, { xtype: 'button', iconCls: 'x-fa fa-exchange', tooltip: '数据结构同步', handler: function (sender) { // handles.mainWindow.showDataSync(sender) } }, { xtype: 'button', iconCls: 'x-fa fa-window-maximize', tooltip: 'SQL查询分析器', handler: function (sender) { // handles.mainWindow.showDbCodeTemplate(sender) } }, { xtype: 'button', iconCls: 'x-fa fa-cubes', tooltip: '数据域管理', handler: function (sender) { // handles.mainWindow.showColumnDomain() } }, { xtype: 'button', iconCls: 'x-fa fa-edit', tooltip: '修改结构', handler: function (sender) { var tree = sender.up("treepanel"); var selection = tree.getSelection(); var _a = __read(selection, 1), node = _a[0]; if (!node) { msg$1('请选择一个表'); return; } var raw = node.data.raw; if (node.get('type') === 'table') ; else if (node.get('type') === 'column') ; } }, ], listeners: { afterrender: function (me) { setDbTree(this); // 找管理器订阅刷新的事件 instance$1.registe(this.refreshData.bind(this)); instance$1.reloadIfNeed(undefined); }, destory: function (me) { setDbTree(undefined); instance$1.unregiste(this.refreshData.bind(this)); }, itemcontextmenu: function (sender, node, element, idx, e) { var _this = this; e.preventDefault(); var option = {}; var raw = node.raw.raw; if (node.get('type') === 'column') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '设计结构', iconCls: 'x-fa fa-edit', handler: function (sender) { handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false); } }, ] }; } else if (node.get('type') === 'table') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '新建', iconCls: 'x-fa fa-plus', handler: function (sender) { handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true); } }, { text: '设计结构', iconCls: 'x-fa fa-edit', handler: function (sender) { handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false); } }, { text: '重命名', iconCls: 'x-fa fa-pencil', handler: function (sender) { _this.renameTable(sender, node.data.raw); } }, '-', { text: '删除', iconCls: 'x-fa fa-minus', handler: function (sender) { _this.removeTable(sender, node.data.raw); } }, ] }; } var treeMenu = new Ext.menu.Menu(option); treeMenu.showAt(e.getXY()); } }, // DbTreeStore 刷新时,会回调到这个方法 refreshData: function (isLoadingState) { var me = this; if (typeof isLoadingState === 'boolean') { me.setLoading(isLoadingState); return; } var rootNode = getDbTree(instance$1.apiResponse); me.setRootNode(rootNode); this.restoreState(); }, renameTable: function (sender, tableRow) { window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) { renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) { if (!res.data) return; var window = Ext.create('Ext.window.Window', { title: 'SQL 预览', height: 400, width: 600, modal: true, animateTarget: sender, maximizable: true, layout: 'fit', items: { xtype: 'sqleditor', value: res.data, }, buttons: [ { xtype: 'button', text: '执行', iconCls: 'x-fa fa-save', handler: function (sender) { var editor = sender.up('window').down('sqleditor'); var ddl = editor.getValue(); window.setLoading(true); instance$1.pushToDbCommit({ schema_name: tableRow.schema_name, table_name: name, old_table_name: tableRow.table_name, ddl: ddl, }).then(function () { handles$1.dbTree.reload(); window.close(); }).finally(function () { return window.setLoading(false); }); }, }, { xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', handler: function () { window.close(); } }, ] }).show(); }); }); }, removeTable: function (sender, tableRow) { dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) { if (!res.data) return; var window = Ext.create('Ext.window.Window', { title: 'SQL 预览', height: 400, width: 600, modal: true, animateTarget: sender, maximizable: true, layout: 'fit', items: { xtype: 'sqleditor', value: res.data, }, buttons: [ { xtype: 'button', text: '执行', iconCls: 'x-fa fa-save', handler: function (sender) { var editor = sender.up('window').down('sqleditor'); var ddl = editor.getValue(); window.setLoading(true); instance$1.pushToDbCommit({ schema_name: tableRow.schema_name, table_name: tableRow.table_name, ddl: ddl }) .then(function () { handles$1.dbTree.reload(); window.close(); }).finally(function () { return window.setLoading(false); }); } }, { xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', handler: function () { window.close(); } } ] }).show(); }); }, // hideHeaders: true, // columns: [ // { // xtype: 'treecolumn', // text: '名称', // dataIndex: 'text', // flex: 2, // }, { // text: '描述', // dataIndex: 'comment', // flex: 1, // } // ], reload: function () { // 强制刷新 DbManager instance$1.reloadForce(undefined); }, dbToMetaAndReload: function () { // 从数据库结构重新生成元数据 instance$1.dbToMetaAndReload(); } }; Ext.define('com.yvan.studio.DbTree', define); } /** * 将数据构建成 dbTree 需要的格式 */ function getDbTree(apiResponse) { var rootNode = { children: [], expanded: true, id: "ROOT", leaf: false, }; _$2.forEach(apiResponse, function (schemaRow) { var schemaNode = { id: 'schema$' + schemaRow.schema_name, type: "schema", expanded: true, leaf: false, iconCls: 'x-fa fa-th-large ', text: schemaRow.schema_name, raw: __assign({}, schemaRow), children: [], }; delete schemaNode.raw.table_list; rootNode.children.push(schemaNode); _$2.forEach(schemaRow.table_list, function (tableRow) { var _a; var tableNode = { id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name, text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")", comment: tableRow.description, type: "table", iconCls: 'x-fa fa-table', expanded: false, leaf: false, children: [], raw: __assign({}, tableRow) }; delete tableNode.raw.column_list; schemaNode.children.push(tableNode); _$2.forEach(tableRow.column_list, function (columnRow) { var _a; var iconCls = 'x-fa fa-square-o'; if (columnRow.is_primary_key) { iconCls = 'x-fa fa-key'; } else if (columnRow.not_null) { iconCls = 'x-fa fa-check-square'; } var columnNode = { id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name, type: "column", text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")", comment: columnRow.column_comment, leaf: true, iconCls: iconCls, raw: __assign({}, columnRow) }; tableNode.children.push(columnNode); }); // column }); // table }); // schema return rootNode; } //# sourceMappingURL=DbTree.js.map var ReportGridController = /** @class */ (function () { function ReportGridController() { } ReportGridController.prototype.onLoad = function (sender) { this.reload(); setReport(this); }; ReportGridController.prototype.showSingle = function (sender) { var _this = this; var _a = __read(this.getView().getSelection(), 1), record = _a[0]; if (record) { handles.mainWindow.showFormSingle(record.data, function () { _this.reload(); }); } }; ReportGridController.prototype.filterChanged = function (sender, value) { console.log('filterChange', sender, value); this.view.store.clearFilter(); if (value) { this.view.store.filterBy(function (record) { var code = _.lowerCase(record.get('report_name')); var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code)); return (code.includes(value) || dict_desc_py.includes(value)); }); } }; ReportGridController.prototype.onClearClick = function () { var _a, _b; (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue(''); }; ReportGridController.prototype.reload = function () { var me = this; me.getView().setLoading(true); reportListApi().then(function (res) { _.forEach(res.data, function (r) { r.report_enable = r.report_enable === 1; }); me.getView().setStore(new Ext.data.Store({ fields: ['report_id', 'report_name', 'report_enable'], data: res.data, })); }).finally(function () { me.getView().setLoading(false); }); }; ReportGridController.prototype.reportAdd = function () { var _this = this; prompt$2('请输入报表名称').then(function (name) { createReportApi(name).then(function (res) { if (res.success) { msg$1('添加成功'); handles.mainWindow.showReport(res.data, name, function () { _this.reload(); }); } _this.reload(); }); }); }; ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) { e.preventDefault(); var me = sender.up('grid').ownerGrid.getController(); var option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '添加', iconCls: 'x-fa fa-plus-circle', handler: function (sender) { me.reportAdd(); } }, { text: '编辑', iconCls: 'x-fa fa-edit', handler: function (sender) { me.reportEdit(); } }, { text: '删除', iconCls: 'x-fa fa-minus-circle', handler: function (sender) { me.reportRemove(); } }, '-', { text: '注册(至菜单)', iconCls: 'x-fa fa-sign-in', handler: function (sender) { me.reportRegiste(sender); } }, { text: '卸载', iconCls: 'x-fa fa-sign-out', handler: function (sender) { console.error('没做'); } }, ] }; var treeMenu = new Ext.menu.Menu(option); treeMenu.showAt(e.getXY()); }; ReportGridController.prototype.reportRegiste = function (sender) { var _a = __read(this.getView().getSelection(), 1), record = _a[0]; if (record) { var reportName = record.get('report_name'); var reportId = record.get('report_id'); registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search'); } }; ReportGridController.prototype.reportRemove = function () { var _this = this; var _a = __read(this.getView().getSelection(), 1), record = _a[0]; if (record) { var reportName = record.get('report_name'); var reportId_1 = record.get('report_id'); YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () { delReportApi(reportId_1).then(function (res) { if (res.success) { msg$1('删除成功'); _this.reload(); } }); }); } }; ReportGridController.prototype.reportEdit = function () { var _this = this; var _a = __read(this.getView().getSelection(), 1), record = _a[0]; if (record) { var reportName = record.get('report_name'); var reportId = record.get('report_id'); handles.mainWindow.showReport(reportId, reportName, function () { _this.reload(); }); } }; ReportGridController.prototype.onDblClick = function (sender) { this.reportEdit(); }; return ReportGridController; }()); //# sourceMappingURL=ReportGridController.js.map function initReportGrid () { var controller = new ReportGridController(); Ext.define('com.yvan.studio.ReportGrid', { extend: 'Ext.grid.Panel', xtype: 'reportGrid', controller: controller, scope: controller, referenceHolder: true, tooltip: '查询报表', iconCls: 'x-fa fa-bar-chart', useArrows: true, reference: 'reportgrid', selModel: { type: 'rowmodel', mode: 'SINGLE', }, listeners: { itemdblclick: 'onDblClick', afterrender: 'onLoad', }, viewConfig: { enableTextSelection: true, listeners: { itemcontextmenu: 'onGridContextMenu', }, }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', tooltip: '测试', iconCls: 'x-fa fa-bars', listeners: { click: 'showSingle' } }, { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, { xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'reportAdd' } }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'reportRemove' } }, { xtype: 'textfield', flex: 1, reference: "txtFilter", emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: { fn: 'filterChanged', buffer: 50 } } }, ] }, columns: [ { text: 'ID', dataIndex: 'report_id', hidden: true, }, { text: '报表名称', dataIndex: 'report_name', flex: 1, }, ] }); } //# sourceMappingURL=ReportGrid.js.map /** 所有变量类型 */ var TypeEnum; (function (TypeEnum) { TypeEnum["string"] = "string"; TypeEnum["number"] = "number"; TypeEnum["object"] = "object"; TypeEnum["array"] = "array"; TypeEnum["function"] = "function"; TypeEnum["null"] = "null"; TypeEnum["boolean"] = "boolean"; TypeEnum["symbol"] = "symbol"; TypeEnum["json"] = "json"; TypeEnum["math"] = "math"; TypeEnum["regexp"] = "regexp"; TypeEnum["date"] = "date"; TypeEnum["undefined"] = "undefined"; TypeEnum["nan"] = "nan"; TypeEnum["reactNode"] = "react_node"; })(TypeEnum || (TypeEnum = {})); /** * 判断对象类型 * @param object 对象 */ var variableTypeOf = function (object) { var typeStr = Object.prototype.toString.call(object); var typeName; switch (("" + typeStr).toLowerCase()) { case '[object string]': typeName = TypeEnum.string; break; case '[object number]': if (Number.isNaN(object)) { return TypeEnum.nan; } typeName = TypeEnum.number; break; case '[object object]': if (object.$$typeof && object.props) { var type = variableTypeOf(object.$$typeof); if (type === TypeEnum.symbol || type === TypeEnum.reactNode) { return TypeEnum.reactNode; } } typeName = TypeEnum.object; break; case '[object array]': typeName = TypeEnum.array; break; case '[object function]': typeName = TypeEnum.function; break; case '[object null]': typeName = TypeEnum.null; break; case '[object boolean]': typeName = TypeEnum.boolean; break; case '[object date]': typeName = TypeEnum.date; break; // 不常用 case '[object symbol]': typeName = TypeEnum.symbol; break; case '[object json]': typeName = TypeEnum.json; break; case '[object math]': typeName = TypeEnum.math; break; case '[object regexp]': typeName = TypeEnum.regexp; break; // 貌似不会走的分支 case '[object undefined]': typeName = TypeEnum.undefined; break; // 无法识别 default: if (object === undefined) { return TypeEnum.undefined; } console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase()); typeName = TypeEnum.object; } return typeName; }; //# sourceMappingURL=typeof.js.map function initGroovyEditor () { Ext.define('com.yvan.studio.GroovyEditor', { extend: 'Ext.panel.Panel', alias: 'widget.groovyeditor', xtype: 'groovyeditor', layout: 'fit', border: false, html: "
", config: { value: '' }, codeChange: undefined, isChangeFromOuter: false, getCode: function () { if (this.editor) { return this.editor.getValue(); } else { return this.code; } }, setCode: function (value) { var _this = this; this.code = value; this.value = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, getValue: function () { return this.value; }, setValue: function (value, fromEditor) { var me = this; if (me.value === value) { // 值相等,不需要变化 return; } if (fromEditor !== true && me.editor) { // 不是来源于编辑器的变化,才设置编辑器的值 me.editor.setValue(value); } // 通知mixins setValue me.value = value; me.fireEvent('change', value); }, initComponent: function () { var that = this; this.superclass.initComponent.call(this, arguments); that.on({ resize: function () { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_3($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); } }); } function attach_3(element, opts) { return new Promise(function (resolve) { var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: { enabled: false } })); editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } //# sourceMappingURL=GroovyEditor.js.map function initJsEditor$1 () { Ext.define('com.yvan.studio.JsEditor', { extend: 'Ext.panel.Panel', alias: 'widget.jseditor', xtype: 'jseditor', layout: 'fit', border: false, html: "
", autoFocusMethod: true, autoFocusStartLine: 0, autoFocusStartColumn: 0, codeChange: undefined, funcArr: [], modulePage: null, isChangeFromOuter: false, name: "", /** * 设置代码 */ setCode: function (value) { var _this = this; this.code = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); if (_this.name === "controllerEditor") { _this.funcArr = _this.getAllFunction(); } } }); }, getCode: function () { var _a; if (!this.editor) { return this.code; } return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, initComponent: function () { var that = this; this.superclass.initComponent.apply(this, arguments); this.on({ resize: function (sender, width, height) { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function () { var $dom = $(that.el.dom).find('.editor'); attach_1($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); }, getAllFunction: function () { var funcArr = []; var ast = window['YvanUI'].recast.parse(this.code); if (ast && ast.program && ast.program.body) { if (Array.isArray(ast.program.body)) { for (var i = 0; i < ast.program.body.length; i++) { var m = ast.program.body[i]; if (m.type === "ExportDefaultDeclaration") { if (m.declaration.type === "ClassDeclaration") { if (m.declaration.body.type === "ClassBody") { if (Array.isArray(m.declaration.body.body)) { for (var j = 0; j < m.declaration.body.body.length; j++) { var ob = m.declaration.body.body[j]; if (ob.type === "MethodDefinition" && ob.kind === "method") { var funcItem = { name: ob.key.name, args: [] }; if (Array.isArray(ob.value.params)) { for (var k = 0; k < ob.value.params.length; k++) { var p = ob.value.params[k]; funcItem.args.push(p.name); } } funcArr.push(funcItem); } } } } } } } } } return funcArr; } }); } var isInited = false; function attach_1(element, opts) { return new Promise(function (resolve) { var monaco = window['monaco']; if (!isInited) { isInited = true; monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({ noSemanticValidation: true, noSyntaxValidation: false }); // compiler options monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ target: monaco.languages.typescript.ScriptTarget.ES2016, allowNonTsExtensions: true, }); // extra libraries var libSource = [ 'declare class Facts {', ' /**', ' * Returns the next fact', ' */', ' static next():string', ' static next222():string', '}', "\n declare namespace WotuUI {\n export class Text {\n label: string\n }\n\n export function wrapText(n1: string): Text\n export function render(element:HTMLElement, vjson:any): void\n }\n ", "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n " ].join('\n'); var libUri = 'file:///index.d.ts'; monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri); // When resolving definitions and references, the editor will try to use created models. // Creating a model for the library allows "peek definition/references" commands to work with the library. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri)); } var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' })); resolve(editor); }); } //# sourceMappingURL=JsEditor.js.map function initJsonEditor$1 () { Ext.define('com.yvan.studio.JsonEditor', { extend: 'Ext.panel.Panel', alias: 'widget.jsoneditor', xtype: 'jsoneditor', layout: 'fit', border: false, html: "
", autoFocusMethod: true, autoFocusStartLine: 0, autoFocusStartColumn: 0, codeChange: undefined, funcArr: [], modulePage: null, isChangeFromOuter: false, name: "", /** * 设置代码 */ setCode: function (value) { var _this = this; this.code = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, updateOptions: function (options) { if (this.editor && options) { this.editor.updateOptions(options); } }, setLanguage: function (lang) { if (this.editor && lang) { window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang); } }, getCode: function () { var _a; return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, initComponent: function () { var that = this; this.superclass.initComponent.apply(this, arguments); this.on({ resize: function (sender, width, height) { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_116($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); }, }); } function attach_116(element, opts) { return new Promise(function (resolve) { var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: { enabled: false } })); editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } //# sourceMappingURL=JsonEditor.js.map function initSqlEditor$1 () { Ext.define('com.yvan.studio.SqlEditor', { extend: 'Ext.panel.Panel', alias: 'widget.sqleditor', xtype: 'sqleditor', layout: 'fit', border: false, html: "
", config: { value: '' }, codeChange: undefined, isChangeFromOuter: false, setCode: function (value) { var _this = this; this.code = value; this.value = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, getCode: function () { return this.getValue(); }, updateOptions: function (options) { if (this.editor && options) { this.editor.updateOptions(options); } }, getValue: function () { if (!this.editor) { return this.code; } return this.editor.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, setValue: function (value, fromEditor) { this.setCode(value); var me = this; if (me.value === value) { // 值相等,不需要变化 return; } if (fromEditor !== true && me.editor) { // 不是来源于编辑器的变化,才设置编辑器的值 me.editor.setValue(value); } // 通知mixins setValue me.value = value; me.fireEvent('change', value); }, initComponent: function () { var that = this; this.superclass.initComponent.call(this); that.on({ resize: function () { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_2($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof that.codeChange === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); } }); } function attach_2(element, opts) { return new Promise(function (resolve) { var monaco = window['monaco']; var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: { enabled: false } })); editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () { // const sql = editor.getValue() // if (_.trim(sql).length > 0) { // editor.setValue(format(sql, { // indent: ' ', // uppercase: true, // })) // } msg$1('没做'); }); editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } //# sourceMappingURL=SqlEditor.js.map function initTemplateEditor () { Ext.define('com.yvan.studio.TemplateEditor', { extend: 'Ext.panel.Panel', alias: 'widget.templateeditor', xtype: 'templateeditor', layout: 'fit', border: false, html: "
", autoFocusMethod: true, autoFocusStartLine: 0, autoFocusStartColumn: 0, codeChange: undefined, funcArr: [], modulePage: null, isChangeFromOuter: false, name: "", /** * 设置代码 */ setCode: function (value) { var _this = this; this.code = value; _$2.defer(function () { _this.isChangeFromOuter = true; if (_this.editor) { _this.editor.setValue(value); } }); }, getCode: function () { var _a; return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue(); }, applyPosition: function () { var _this = this; if (this.autoFocusMethod) { if (this.editor) { _$2.defer(function () { if (_this.autoFocusStartLine) { _this.editor.setPosition({ lineNumber: _this.autoFocusStartLine, column: _this.autoFocusStartColumn }); _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行 } _this.editor.focus(); }); delete this.autoFocusMethod; } } this.editor.layout(); }, initComponent: function () { var that = this; this.superclass.initComponent.apply(this, arguments); this.on({ resize: function (sender, width, height) { if (that.editor) { that.editor.layout(); } }, destory: function () { if (that.editor) { that.editor.dispose(); delete that.editor; } }, afterrender: function (sender) { var $dom = $(that.el.dom).find('.editor'); attach_117($dom[0], { value: that.code }).then(function (editor) { that.editor = editor; that.applyPosition(); that.editor.onDidChangeModelContent(function (e) { that.fireEvent('change', that.editor, e); if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) { that.codeChange(that.editor.getValue(), that.name, e); } that.isChangeFromOuter = false; }); }); } }); }, }); } function attach_117(element, opts) { return new Promise(function (resolve) { var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: { enabled: false } })); editor.onKeyUp(function (e) { // console.log(e) if ( /*e.code === 'Enter'||*/e.code === 'Quote') { editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {}); } }); resolve(editor); }); } //# sourceMappingURL=TemplateEditor.js.map var DictStore = /** @class */ (function (_super) { __extends(DictStore, _super); function DictStore() { return _super !== null && _super.apply(this, arguments) || this; } DictStore.prototype.getCacheKey = function (param) { return "dict_data.json"; }; DictStore.prototype.invokeApi = function (param) { return getDict(param); }; DictStore.prototype.getDicts = function () { return this.apiResponse.data.dict; }; DictStore.prototype.getDictCodes = function () { return new Promise(function (resolve) { // reloadIfNeedPromise().then(() => { // const result = [] // _.forEach(this.getDicts(), dictRow => { // result.push({ // id: dictRow.dict_code, // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')', // }) // }) // resolve(result) // }) }); }; DictStore.prototype.saveDict = function (param) { return saveDictApi(param); }; DictStore.prototype.saveDictItems = function (param) { return saveDictItemsApi(param); }; DictStore.prototype.getDictItemByDictcode = function (dict_code) { var results = []; _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) { if (dictItemRow.dict_code === dict_code) { results.push(_$2.clone(dictItemRow)); } }); return results; }; return DictStore; }(CacheStore)); var instance$2 = new DictStore(); //# sourceMappingURL=DictStore.js.map var DictTreeController = /** @class */ (function () { function DictTreeController() { this._saveStateFlag = true; } DictTreeController.prototype.dictSave = function () { var _this = this; // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err) var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err; if (err) { // 如果有异常就不保存 return; } // 进行业务上的逻辑校验,比如说必填校验等等 var hasError = false; _$2.forEach(rows, function (row, i) { if (isEmpty(row.dict_code)) { msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!"); hasError = true; return false; } }); if (hasError) { return; } // 设置当前界面为 "保存中..." 状态 this.view.setLoading(true); instance$2.saveDict({ newRows: newRows, modifyRows: modifyRows, removeRecords: removeRecords, }).then(function (res) { // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置) msg$1(res.msg); _this.reload(); }).finally(function () { // 无论正常异常,关闭 "保存中..." 状态 _this.view.setLoading(false); }); }; DictTreeController.prototype.dictItemSave = function () { var _this = this; var _a = __read(this.grid1.getSelection(), 1), record = _a[0]; var currentDictCode = undefined; if (record) { currentDictCode = record.get('dict_code'); } if (!currentDictCode) { msg$1('请选择一个字典'); return; } // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err) var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err; if (err) { // 如果有异常就不保存 return; } // 进行业务上的逻辑校验,比如说必填校验等等 var hasError = false; _$2.forEach(rows, function (row, i) { if (!row.dict_value && row.dict_value !== 0) { msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!"); hasError = true; return false; } }); if (hasError) { return; } // 设置当前界面为 "保存中..." 状态 this.view.setLoading(true); instance$2.saveDictItems({ // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交 newRows: newRows, modifyRows: modifyRows, removeRecords: removeRecords, dict_code: currentDictCode }).then(function (res) { // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置) msg$1(res.msg); _this.reload(); }).finally(function () { // 无论正常异常,关闭 "保存中..." 状态 _this.view.setLoading(false); }); }; DictTreeController.prototype.createDictEnum = function () { var _this = this; var _a = __read(this.grid1.getSelection(), 1), record = _a[0]; var currentDictCode = undefined; if (record) { currentDictCode = record.get('dict_code'); } if (!currentDictCode) { msg$1('请选择一个字典'); return; } // 设置当前界面为 "保存中..." 状态 this.view.setLoading(true); createDictEnum({ dictCode: currentDictCode }) .then(function () { return _this.reload(); }) .finally(function () { return _this.view.setLoading(false); }); }; DictTreeController.prototype.onLoad = function () { setDictTree(this); this.grid1 = this.view.lookupReference('grid1'); this.grid2 = this.view.lookupReference('grid2'); this.grid1.setData([]); this.grid2.setData([]); // this.grid1.columns[0].hide() this.grid2.columns[0].hide(); // 找管理器订阅刷新的事件 instance$2.registe(this.refreshData.bind(this)); // 非强制性刷新 DbManager instance$2.reloadIfNeed(undefined); }; DictTreeController.prototype.onDestory = function () { instance$2.unregiste(this.refreshData.bind(this)); }; // dictStore 刷新时,会回调到这个方法 DictTreeController.prototype.refreshData = function (isLoadingState) { var me = this; if (typeof isLoadingState === 'boolean') { me.view.setLoading(isLoadingState); return; } this.grid1.setData(instance$2.getDicts()); this.restoreState(); }; DictTreeController.prototype.grid1Selected = function (sender, record, event) { var _this = this; _$2.defer(function () { _this.saveState(); }); if (!record) { this.grid2.setData([]); return; } var dict_code = record.get('dict_code'); var data = instance$2.getDictItemByDictcode(dict_code); this.grid2.setData(data); }; DictTreeController.prototype.reload = function () { var _this = this; // 强制刷新 DbManager instance$2.reloadForce(undefined).then(function (res) { _this.search1(_this.getView().down('[emptyText=搜索过滤]')); }); }; DictTreeController.prototype.dictAdd = function () { this.grid1.appendEditRow({ _createFlag: true, dict_code: '', dict_desc: '', }, 0); }; DictTreeController.prototype.dictRemove = function () { this.grid1.removeEditRow(); }; DictTreeController.prototype.dictItemAdd = function () { var _a, _b; var dict_code = (_b = (_a = this.grid1.selection) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.dict_code; if (!dict_code) { msg$1('请先保存字典'); return; } this.grid2.appendEditRow({ dict_code: dict_code, dict_text: '', dict_value: '', }, 0); }; DictTreeController.prototype.dictItemRemove = function () { var _this = this; var rows = []; this.grid2.getSelectionModel().getSelected().eachRow(function (r) { rows.push(r); }); _$2.forEach(rows, function (r) { _this.grid2.getStore().remove(r); }); }; DictTreeController.prototype.clearSearch1 = function () { this.grid1.store.clearFilter(); }; DictTreeController.prototype.search1 = function (sender) { this.grid1.store.clearFilter(); this.getViewModel().set('grid1.selection', null); this.grid1.fireEvent('itemselect'); var value = _$2.lowerCase(sender.getRawValue()).trim(); if (!value) { return; } this.grid1.store.filterBy(function (record) { if (record.get('_createFlag')) { return true; } var dict_code = _$2.lowerCase(record.get('dict_code')); var dict_desc = _$2.lowerCase(record.get('dict_desc')); var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc)); return (dict_code.includes(value) || dict_desc.includes(value) || dict_desc_py.includes(value)); }); }; DictTreeController.prototype.clearSearch2 = function () { this.grid2.store.clearFilter(); }; DictTreeController.prototype.search2 = function (sender) { this.grid2.store.clearFilter(); var value = _$2.lowerCase(sender.getRawValue()).trim(); if (!value) { return; } this.grid2.store.filterBy(function (record) { var dict_text = _$2.lowerCase(record.get('dict_text')); var dict_value = _$2.lowerCase(record.get('dict_value')); var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text)); return (dict_text.includes(value) || dict_value === value || dict_text_py.includes(value)); }); }; DictTreeController.prototype.getStateFilename = function () { return getCurrentProject().uuid + "/dicttree.json"; }; DictTreeController.prototype.restoreState = function () { var _this = this; var grid = this.grid1; native.loadFile(this.getStateFilename(), function (content) { if (!content) return; var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize; _this._saveStateFlag = false; if (selection) { var idx = grid.store.findExact('dict_code', selection); if (idx >= 0) { var record = grid.store.getAt(idx); if (record) { grid.setSelection([record]); } } } if (scrollPosition && scrollSize) { var size = grid.scrollable.getSize(); if (size.x === scrollSize.x && size.y === scrollSize.y) { grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y); } } setTimeout(function () { _this._saveStateFlag = true; }, 200); }); }; DictTreeController.prototype.saveState = function () { if (!this._saveStateFlag) { return; } var _a = __read(this.grid1.getSelection(), 1), record = _a[0]; var selection = undefined; if (record) { selection = record.get('dict_code'); } var scrollPosition = this.grid1.scrollable.position; var scrollSize = this.grid1.scrollable.getSize(); native.saveFile(this.getStateFilename(), { selection: selection, scrollPosition: scrollPosition, scrollSize: scrollSize }); }; return DictTreeController; }()); //# sourceMappingURL=DictTreeController.js.map function initDict$1 () { var controller = new DictTreeController(); Ext.define('com.yvan.studio.DictTree', { extend: 'Ext.panel.Panel', xtype: 'dicttree', controller: controller, scope: controller, referenceHolder: true, tooltip: '字典', iconCls: 'x-fa fa-book', rootVisible: false, useArrows: true, reference: 'dicttree', layout: 'border', listeners: { afterrender: 'onLoad', destory: 'onDestory', }, items: [ { region: 'center', xtype: 'yvgrid', hideFootbar: true, reference: 'grid1', _mode: 'select', tbar: [ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, { xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'dictAdd' } }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', bind: { disabled: '{!grid1.selection}' }, listeners: { click: 'dictRemove' } }, { xtype: 'button', tooltip: '保存', iconCls: 'x-fa fa-save', bind: { disabled: '{!grid1.ischanged}' }, listeners: { click: 'dictSave' } }, { xtype: 'textfield', hideClear: true, triggers: { clear: { cls: 'x-form-clear-trigger', handler: 'clearSearch1' }, }, flex: 1, emptyText: '搜索过滤', enableKeyEvents: true, listeners: { keyup: { fn: 'search1', buffer: 50 } } }, ], listeners: { itemselect: 'grid1Selected', }, idField: 'dict_code', columns: [ { text: '字典编号', dataIndex: 'dict_code', menuDisabled: true, flex: 1, editor: { allowBlank: true, selectOnFocus: false } }, { text: '中文描述', dataIndex: 'dict_desc', menuDisabled: true, flex: 1, editor: { allowBlank: true, selectOnFocus: false } }, ] }, { region: 'south', height: '50%', xtype: 'yvgrid', hideFootbar: true, reference: 'grid2', split: true, _mode: 'edit1', listeners: {}, tbar: [ { xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', bind: { disabled: '{!grid1.selection}' }, listeners: { click: 'dictItemAdd' } }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', bind: { disabled: '{!grid1.selection}' }, listeners: { click: 'dictItemRemove' } }, { xtype: 'button', tooltip: '保存', iconCls: 'x-fa fa-save', bind: { disabled: '{!grid2.ischanged}' }, listeners: { click: 'dictItemSave' } }, { xtype: 'button', tooltip: '刷新代码', iconCls: 'x-fa fa-code', bind: { disabled: '{!grid1.selection}' }, listeners: { click: 'createDictEnum' } }, ], columns: [ { text: '字典项', dataIndex: 'dict_text', menuDisabled: true, flex: 1, editor: { allowBlank: true, selectOnFocus: false } }, { text: '字典值', dataIndex: 'dict_value', menuDisabled: true, flex: 1, dataType: 'int', editor: { xtype: 'numberfield', allowBlank: true, selectOnFocus: false } }, { text: '激活', dataIndex: 'is_enable', xtype: 'checkcolumn', menuDisabled: true, }, { text: '变量名', dataIndex: 'var_name', menuDisabled: true, flex: 1, editor: { allowBlank: true, selectOnFocus: false } }, ] } ] }); } //# sourceMappingURL=DictTree.js.map var model$g = { data: { form: { path: "", requestBody: "", responseBody: "", } } }; var vjson$f = { title: '接口信息', layout: 'fit', width: 800, height: 500, items: [ { xtype: 'form', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { xtype: 'textfield', fieldLabel: '接口路径', bind: { value: "{form.path}", }, }, { xtype: 'textareafield', // height: 150, flex: 2, fieldLabel: '请求数据', bind: { value: "{form.requestBody}", }, }, { xtype: 'textareafield', // height: 150, flex: 5, fieldLabel: '响应数据', bind: { value: "{form.responseBody}", }, }, ] } ] }; var ApiInfoDialog = /** @class */ (function (_super) { __extends(ApiInfoDialog, _super); function ApiInfoDialog() { return _super.call(this, { model: model$g, vjson: vjson$f }) || this; } return ApiInfoDialog; }(Scope)); //# sourceMappingURL=apiInfoDialog.js.map var model$h = { data: { query: { role_id: '', resource_id: '', }, form: {}, form2: { key: "", start_at: "", end_at: "", } } }; var vjson$g = { title: '接口信息', layout: 'fit', items: [ { layout: 'border', border: false, items: [ { region: 'center', layout: 'border', items: [ { region: 'north', bind: { title: '{form.title}', }, xtype: 'form', scrollable: true, layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '查询', iconCls: 'x-fa fa-search', listeners: { click: 'scope.requestLogs' }, }, { xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {}, }, { xtype: 'button', text: '禁用', iconCls: 'x-fa fa-stop-circle', bind: {}, listeners: {}, }, { xtype: 'button', text: '启用', iconCls: 'x-fa fa-play-circle', bind: {}, listeners: {}, }, ], }, items: [ { xtype: 'cols', defaults: { labelWidth: 120 }, items: [ { xtype: 'textfield', fieldLabel: 'URL', bind: { value: '{form.api_url}', }, readOnly: true, }, { xtype: 'textfield', fieldLabel: '名称', bind: { value: '{form.api_name}', }, readOnly: true, }, ], }, { xtype: 'cols', defaults: { labelWidth: 120 }, items: [ { xtype: 'textfield', fieldLabel: '实现类', bind: { value: '{form.api_class}', }, readOnly: true, }, { border: false, flex: 1 }, ] }, { xtype: 'cols', defaults: { labelWidth: 120 }, items: [ { xtype: 'textfield', fieldLabel: '超时时间', bind: { value: '{form.timeout}', }, readOnly: true, }, { border: false, flex: 1 }, ] }, { xtype: 'cols', defaults: { labelWidth: 120 }, items: [ { xtype: 'textfield', fieldLabel: 'Remote IP', bind: { value: '{form.remote_ip}', }, readOnly: true, }, { border: false, flex: 1 }, ] }, { xtype: 'cols', defaults: { labelWidth: 120 }, items: [ { xtype: 'textfield', fieldLabel: '解析表单', bind: { value: '{form.chandi}', }, readOnly: true, }, { border: false, flex: 1 }, ] }, ], }, { region: 'center', // title: 'Request', layout: 'border', items: [ { region: 'north', xtype: 'form', reference: 'form2', split: true, items: [ { xtype: 'cols', width: 700, items: [ { xtype: 'textfield', fieldLabel: '关键字', bind: { value: "{form2.key}" }, }, { xtype: 'datefield', fieldLabel: '开始时间', bind: { value: "{form2.start_at}" }, }, { xtype: 'datefield', fieldLabel: '结束时间', bind: { value: "{form2.end_at}" }, }, ] } ] }, { region: 'center', xtype: 'yvgrid', layout: 'fit', reference: 'grid1', pagination: true, autoLoad: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, dataSource: { method: 'invoke', url: '/sys/api/Api@requestLogs', params: { formData: '{form2}', path: '{form.api_url}', }, }, listeners: { rowdblclick: 'scope.showDialog', }, columns: [ { dataIndex: "@timestamp", header: "时间", width: 150 }, { dataIndex: "remoteIP", header: "RemoteIP", width: 150 }, { dataIndex: "cost", header: "耗时(毫秒)", width: 80 }, { dataIndex: "size", header: "大小", width: 80 }, { dataIndex: "path", header: "path", flex: 1 }, { dataIndex: "requestBody", header: "requestBody", hidden: true }, { dataIndex: "responseBody", header: "responseBody", hidden: true }, ] } ] }, ], }, ], }, ], referenceHolder: true, }; var Api = /** @class */ (function (_super) { __extends(Api, _super); function Api() { return _super.call(this, { model: model$h, vjson: vjson$g }) || this; } Api.prototype.onLoad = function () { _super.prototype.onLoad.call(this); this.requestLogs(); }; Api.prototype.selectList = function (sender, selected, eOpts) { this.viewModel.set("form", selected.data); if (selected.data.api_type === '1') { this.viewModel.set("form.title", selected.data.api_name + "-(接收)"); } else { this.viewModel.set("form.title", selected.data.api_name + "-(发送)"); } }; Api.prototype.methodDataLoadComplete = function (sender, success, records) { var sel = []; _$2.forEach(records, function (item) { if (item.data.flg === 'Y') { sel.push(item); } }); this.refs.methodGrid.selModel.select(sel); }; Api.prototype.saveAll = function () { var _this = this; var _a, _b, _c; var role_id = this.viewModel.get("query.role_id"); if (!role_id) { msg$1("请先选择一个角色"); return; } var wh_id = this.viewModel.get("form.wh_id"); if (!wh_id) { msg$1("请先选择一个仓库"); return; } var menus = this.refs.theTree.getChecked(); var rowsMenus = []; _$2.forEach(menus, function (m) { if (m.data.resource_id) { rowsMenus.push(m.data.resource_id); } }); var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; }); var methodsArry = (_c = (_b = this.refs.methodGrid.selModel.selected) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.map(function (r) { return r.data.resource_id; }); _$2.remove(mm, function (x) { return methodsArry.includes(x.resource_id); }); var rowsBtn = []; _$2.forEach(mm, function (m) { rowsBtn.push({ resource_id: m.resource_id }); }); this.setLoading(true); invokeServer$1('/sys/role/Role@saveAll', { wh_id: wh_id, role_id: role_id, rowsMenus: rowsMenus, rowsBtn: rowsBtn, }).then(function (res) { msg$1(res.msg); if (res.success) { _this.reloadTree(); // this.viewModel.set('query.role_id', '') _this.viewModel.set('query.resource_id', ''); _this.refs.methodGrid.reload(); } }).finally(function () { _this.setLoading(false); }); }; Api.prototype.editRoleSuccess = function (sender, data) { if (data.success) { this.refs.roleGrid.reload(); this.viewModel.set("query.JIAOS_ID", ""); this.reloadTree(); this.viewModel.set("query.CAID_ID", ""); this.refs.methodGrid.reload(); } }; Api.prototype.deleteRole = function (sender) { var _this = this; var role_id = this.viewModel.get("query.role_id"); if (!role_id) { msg$1("请先选择一个角色"); return; } Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) { if (btn === 'yes') { invokeServer$1('/sys/role/Role@deleteRole', { role_id: role_id, wh_id: window['whId'] }).then(function (res) { msg$1(res.msg); if (res.success) { _this.refs.roleGrid.reload(); _this.viewModel.set("query.role_id", ""); _this.reloadTree(); _this.refs.methodGrid.reload(); } }); } }); }; Api.prototype.reloadTree = function () { showErrorDialog$1('reloadTree 不存在'); }; Api.prototype.whChange = function (sender, value) { this.viewModel.set("form.wh_id", value); this.reloadTree(); this.refs.methodGrid.reload(); }; Api.prototype.requestLogs = function () { var path = this.viewModel.get("form.api_url"); if (!path) return; this.refs.grid1.reload(); }; Api.prototype.showDialog = function (sender) { var _a, _b; var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }); if (!rows || rows.length <= 0) return; var dialog = new ApiInfoDialog(); dialog.showDialog(null, {}, { data: { form: __assign({}, rows[0]) } }); }; return Api; }(Scope)); //# sourceMappingURL=ApiPage.js.map var Controller = /** @class */ (function () { function Controller() { } Controller.prototype.selectList = function (sender, selected, eOpts) { var _a, _b, _c, _d, _e, _f, _g, _h; // @ts-ignore var rows = (_b = (_a = this.getReferences()['roleGrid'].selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }); if (!rows || rows.length <= 0) return; var apiPage = new Api(); apiPage.showPage({ title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""), id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"), path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"), }, { data: { form: __assign({}, rows[0]) } }); }; return Controller; }()); var controller = new Controller(); function initApiTree () { Ext.define('com.yvan.studio.ApiGrid', { extend: 'Ext.Panel', xtype: 'apigrid', controller: controller, scope: controller, referenceHolder: true, layout: 'fit', items: [ { width: 400, split: true, xtype: 'yvgrid', reference: 'roleGrid', border: false, pagination: false, autoLoad: true, remoteFilter: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '新增', iconCls: 'x-fa fa-plus-circle', listeners: {}, }, { xtype: 'button', text: '删除', iconCls: 'x-fa fa-trash', bind: { disabled: '{roleGrid.selection==null}', }, listeners: {}, }, ], }, dataSource: { url: '/sys/api/Api@getApiList', method: 'invoke', params: {}, }, listeners: { itemdblclick: "selectList", }, columns: [ { dataIndex: 'api_name', header: '接口名称', filter: { type: 'string' }, flex: 1, }, ], }, ] }); } //# sourceMappingURL=ApiTree.js.map var model$i = { data: { iframeSrc: '' } }; var vjson$h = { layout: 'fit', border: false, iconCls: 'x-fa fa-newspaper-o', referenceHolder: true, items: [ { // title: 'view.design', xtype: 'uxiframe', layout: 'fit', // cls: 'module_page_iframe', reference: 'iframe', listeners: { afterrender: 'scope.iframeRender' } }, ] }; var Iframe = /** @class */ (function (_super) { __extends(Iframe, _super); function Iframe(path) { var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this; _this.path = ""; _this.path = path; return _this; } Iframe.prototype.iframeRender = function (sender) { var $dom = $(sender.el.dom).find('iframe'); var iframe = $dom[0]; iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL"; iframe.onload = function () { iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*'); }; }; return Iframe; }(Scope)); //# sourceMappingURL=Iframe.js.map var Controller$1 = /** @class */ (function () { function Controller() { } Controller.prototype.onDblClick = function (sender, record) { var data = record.raw; if (data.text === "运行报表") { this.openIframe("/xxl-job/index", "运行报表"); } else if (data.text === "任务管理") { this.openIframe("/xxl-job/jobinfo", "任务管理"); } else if (data.text === "调度日志") { this.openIframe("/xxl-job/joblog", "调度日志"); } else if (data.text === "执行器管理") { this.openIframe("/xxl-job/jobgroup", "执行器管理"); } }; Controller.prototype.openIframe = function (path, title) { var page = new Iframe(path); page.showPage({ title: title, id: 'xxljob__' + path.replaceAll("/", "_"), path: 'xxljob__' + path.replaceAll("/", "_"), }, {}); }; Controller.prototype.onLoad = function () { var me = this; me.getView().setRootNode({ expanded: true, leaf: false, children: [ { leaf: true, text: '运行报表' }, { leaf: true, text: '任务管理' }, { leaf: true, text: '调度日志' }, { leaf: true, text: '执行器管理' }, ] }); }; return Controller; }()); var controller$1 = new Controller$1(); function initTaskTree () { Ext.define('com.yvan.studio.TaskTree', { extend: 'Ext.tree.Panel', xtype: 'tasktree', controller: controller$1, scope: controller$1, reference: 'roleGrid', tooltip: '表单定义', iconCls: 'x-fa fa-bar-chart', useArrows: true, rootVisible: false, colspan: 2, lines: true, multiSelect: false, referenceHolder: true, // openNode() { // const selection = this.getSelection() // const [record] = selection // if (!record) { // return // } // // const {raw} = record; // if (raw.type === 'Dir') { // return // } // if (raw.type === "Module" && raw.module) { // // eventBus.publish(EventType.ModuleOpen, raw) // } // }, listeners: { itemdblclick: 'onDblClick', afterrender: "onLoad", }, }); } //# sourceMappingURL=TaskTree.js.map var model$j = { data: { form: { address: "", level: "", logger: "", message: "", nodeName: "", serverName: "", thread: "", whId: "", userId: "", } } }; var vjson$i = { title: '接口信息', layout: 'fit', width: 800, height: 600, items: [ { xtype: 'form', layout: { type: 'vbox', pack: 'start', align: 'stretch' }, defaults: { border: false, anchor: '100%', margin: '5', }, items: [ { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } }, { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } }, { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } }, { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } }, { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } }, { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } }, { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } }, // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}}, { xtype: 'textareafield', flex: 5, fieldLabel: '响应数据', bind: { value: "{form.message}", }, }, ] } ] }; var ApiInfoDialog$1 = /** @class */ (function (_super) { __extends(ApiInfoDialog, _super); function ApiInfoDialog() { return _super.call(this, { model: model$j, vjson: vjson$i }) || this; } return ApiInfoDialog; }(Scope)); //# sourceMappingURL=LogPageDialog.js.map var model$k = { data: { form2: {} } }; var vjson$j = { title: '日志查询', layout: 'fit', width: "70%", height: "80%", items: [ { region: 'center', xtype: 'yvgrid', layout: 'fit', reference: 'grid1', pagination: false, autoLoad: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, dataSource: { method: 'invoke', url: '/sys/api/Api@aroundLogs', params: { formData: '{form2}', }, }, listeners: { rowdblclick: 'scope.showDialog2', }, columns: [ { dataIndex: "@timestamp", header: "时间", width: 150 }, // {dataIndex: "nodeName", header: "nodeName", width: 80}, { dataIndex: "thread", header: "thread", width: 150 }, { dataIndex: "message", header: "message", flex: 1 }, ] } ] }; var AroundLog = /** @class */ (function (_super) { __extends(AroundLog, _super); function AroundLog() { return _super.call(this, { model: model$k, vjson: vjson$j }) || this; } AroundLog.prototype.onLoad = function () { _super.prototype.onLoad.call(this); this.queryLog(); }; AroundLog.prototype.queryLog = function () { this.refs.grid1.reload(); }; AroundLog.prototype.showDialog2 = function () { var _a, _b; var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }); if (!rows || rows.length <= 0) return; var dialog = new ApiInfoDialog$1(); dialog.showDialog(null, {}, { data: { form: __assign({}, rows[0]) } }); }; return AroundLog; }(Scope)); //# sourceMappingURL=AroundLog.js.map var model$l = { data: { form2: { key: "", start_at: "", end_at: "", } } }; var vjson$k = { title: '日志查询', layout: 'fit', tbar: { xtype: 'toolbar', items: [ { xtype: 'button', text: '刷新', listeners: { click: 'scope.queryLog' }, }, { xtype: 'button', text: '周围日志', bind: {}, listeners: { click: 'scope.aroundLogs' }, }, ], }, items: [ { region: 'center', xtype: 'yvgrid', layout: 'fit', reference: 'grid1', pagination: true, autoLoad: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, dataSource: { method: 'invoke', url: '/sys/api/Api@queryLog', params: { formData: '{form2}', path: '{form.api_url}', }, }, listeners: { rowdblclick: 'scope.showDialog', }, columns: [ { dataIndex: "@timestamp", header: "时间", width: 150 }, // {dataIndex: "nodeName", header: "nodeName", width: 80}, { dataIndex: "thread", header: "thread", width: 150 }, { dataIndex: "message", header: "message", flex: 1 }, ] } ] }; var LogPage = /** @class */ (function (_super) { __extends(LogPage, _super); function LogPage() { return _super.call(this, { model: model$l, vjson: vjson$k }) || this; } LogPage.prototype.onLoad = function () { _super.prototype.onLoad.call(this); this.queryLog(); }; LogPage.prototype.queryLog = function () { this.refs.grid1.reload(); }; LogPage.prototype.showDialog = function () { var _a, _b; var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }); if (!rows || rows.length <= 0) return; var dialog = new ApiInfoDialog$1(); dialog.showDialog(null, {}, { data: { form: __assign({}, rows[0]) } }); }; LogPage.prototype.aroundLogs = function () { var _a, _b; var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; }); if (!rows || rows.length <= 0) return; var dialog = new AroundLog(); dialog.showDialog(null, {}, { data: { form2: __assign({}, rows[0]) } }); }; return LogPage; }(Scope)); //# sourceMappingURL=LogPage.js.map var Controller$2 = /** @class */ (function () { function Controller() { } Controller.prototype.queryLog = function () { var form2 = this.getViewModel().get("form2"); var logPage = new LogPage(); logPage.showPage({}, { data: { form2: __assign({}, form2) } }); }; return Controller; }()); var controller$2 = new Controller$2(); function initLogsTree () { Ext.define('com.yvan.studio.LogsTree', { extend: 'Ext.panel.Panel', xtype: 'logstree', controller: controller$2, scope: controller$2, viewModel: { data: { form2: { key: "", start_at: "", end_at: "", } } }, reference: 'logstree', tooltip: '表单定义', iconCls: 'x-fa fa-bar-chart', useArrows: true, rootVisible: false, colspan: 2, lines: true, multiSelect: false, referenceHolder: true, items: [ { region: 'north', xtype: 'form', reference: 'form2', split: true, items: [ { xtype: 'textfield', fieldLabel: '关键字', bind: { value: "{form2.key}" }, }, { xtype: 'datefield', fieldLabel: '开始时间', bind: { value: "{form2.start_at}" }, }, { xtype: 'datefield', fieldLabel: '结束时间', bind: { value: "{form2.end_at}" }, }, ] }, { xtype: "cols", items: [ { xtype: "box", }, { xtype: "button", text: '查询', listeners: { click: 'queryLog' }, }, { xtype: "box", }, ] }, ], }); } //# sourceMappingURL=LogsTree.js.map var model$m = { data: { // opsId: "", // name: "", running: false, } }; //# sourceMappingURL=DevOpsTerminal.model.js.map var vjson$l = { bind: { title: '运维-{name}', }, layout: 'fit', items: [ { layout: 'border', items: [ { region: 'north', items: [ { xtype: 'toolbar', border: false, items: [ { xtype: 'button', text: '执行', iconCls: 'x-fa fa-play', bind: { hidden: "{running}", }, listeners: { click: 'scope.start' } }, { xtype: 'button', text: '停止', iconCls: 'x-fa fa-stop', bind: { hidden: "{!running}", }, listeners: { click: 'scope.stop' } }, ], }, ] }, { region: 'center', reference: 'terminal', xtype: 'terminal', }, ], }, ], }; //# sourceMappingURL=DevOpsTerminal.view.js.map var DevOpsTerminal = /** @class */ (function (_super) { __extends(DevOpsTerminal, _super); function DevOpsTerminal() { var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this; _this.websocket = undefined; return _this; } DevOpsTerminal.prototype.onLoad = function () { this.load(); }; DevOpsTerminal.prototype.onDestroy = function () { if (this.websocket) { this.websocket.close(); this.websocket = undefined; } }; DevOpsTerminal.prototype.load = function () { var _this = this; var opsId = this.viewModel.get('opsId'); this.setLoading(true); devOpsById(opsId).then(function (res) { _this.viewModel.set('devOps', res.data); }).finally(function () { _this.setLoading(false); }); }; DevOpsTerminal.prototype.start = function () { var me = this; var running = this.viewModel.get('running'); var devOps = this.viewModel.get('devOps'); if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl)) return; var devopsServer = "ws://122.9.140.63:9999"; this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304"); this.websocket.addEventListener('open', function () { me.viewModel.set('running', true); me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl })); }); this.websocket.addEventListener('message', function (event) { me.refs.terminal.write(event.data); }); this.websocket.addEventListener('close', function () { me.stop(); }); this.websocket.addEventListener('error', function () { me.stop(); }); }; DevOpsTerminal.prototype.stop = function () { if (this.websocket) { this.websocket.close(); this.websocket = undefined; } this.viewModel.set('running', false); }; return DevOpsTerminal; }(Scope)); //# sourceMappingURL=DevOpsTerminal.js.map var Controller$3 = /** @class */ (function () { function Controller() { } Controller.prototype.onLoad = function (sender) { this.reload(); }; Controller.prototype.reload = function () { var me = this; // @ts-ignore var view = me.getView(); view.setLoading(true); devOpsList().then(function (res) { view.setStore(new Ext.data.Store({ fields: ['ops_id', 'host', 'name'], data: res.data, })); }).finally(function () { view.setLoading(false); }); }; Controller.prototype.onDblClick = function (sender) { this.devOpsTerminal(); }; Controller.prototype.devOpsTerminal = function () { // @ts-ignore var view = this.getView(); var _a = __read(view.getSelection(), 1), record = _a[0]; if (record) { var name = record.get('name'); var opsId = record.get('ops_id'); var instance = new DevOpsTerminal(); instance.showPage({ id: 'ops_' + opsId, path: 'ops_' + opsId, }, { data: { opsId: opsId, name: name, } }); instance.dialogSuccess = function () { }; } }; return Controller; }()); var controller$3 = new Controller$3(); function initDevOpsTree () { Ext.define('com.yvan.studio.DevOpsGrid', { extend: 'Ext.grid.Panel', xtype: 'devopsgrid', controller: controller$3, scope: controller$3, referenceHolder: true, tooltip: '运维', iconCls: 'x-fa fa-terminal', useArrows: true, reference: 'devopsgrid', selModel: { type: 'rowmodel', mode: 'SINGLE', }, listeners: { afterrender: 'onLoad', itemdblclick: 'onDblClick', }, viewConfig: { // listeners: { // itemcontextmenu: 'onGridContextMenu', // }, }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, { xtype: 'textfield', flex: 1, emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: { fn: 'filterChanged', buffer: 50 } } }, ] }, columns: [ { text: 'ID', dataIndex: 'report_id', hidden: true, }, { text: '服务器', dataIndex: 'host', width: 100, menuDisabled: true, }, { text: '操作名称', dataIndex: 'name', flex: 1, menuDisabled: true, }, ] }); } //# sourceMappingURL=DevOpsTree.js.map function initTerminal () { Ext.define('com.yvan.studio.Terminal', { extend: 'Ext.panel.Panel', alias: 'widget.terminal', xtype: 'terminal', layout: 'fit', border: false, html: "
", config: {}, write: function (str) { if (this.term) { this.term.write(str); } }, initComponent: function () { var that = this; this.superclass.initComponent.call(this, arguments); that.on({ resize: function () { var _a; if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) { that.fitAddon.fit(); } }, destory: function () { if (that.term) { that.term.dispose(); delete that.term; } if (that.fitAddon) { that.fitAddon.dispose(); delete that.fitAddon; } }, afterrender: function (sender) { _.defer(function () { var $dom = $(that.el.dom).find('.terminal'); that.term = new xterm.Terminal({ // cursorBlink: false, // cursorStyle: 'bar', // block underline bar // enableBold: false, // bellStyle: "sound", fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas', // scrollback: 10000, // tabStopWidth: 4, disableStdin: true, theme: { // foreground: "#111", // background: "#fdfdfd", // background: "#fafafa", }, }); that.fitAddon = new xtermAddonFit.FitAddon(); that.term.loadAddon(that.fitAddon); that.term.open($dom[0]); that.fitAddon.fit(); // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ') }); } }); } }); } //# sourceMappingURL=Terminal.js.map var vjson$m = { title: '接口统计', layout: 'fit', items: [ { title: '接口统计', xtype: 'yvgrid', enableLocking: false, reference: 'grid1', pagination: false, selModel: { type: 'rowmodel', mode: 'SINGLE', }, tbar: { xtype: 'form', items: [ { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '搜索', listeners: { change: 'scope.requestFilterChange' } }, ] }, ] }, columns: [ { text: '地址', dataIndex: 'url', flex: 1 }, { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' }, { text: '次数', dataIndex: 'count', dataType: 'number' }, { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' }, { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' }, { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' }, { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' }, { text: '直方图', dataIndex: 'histogram', width: 180 }, ], leadingBufferZone: 8, trailingBufferZone: 8, viewConfig: { listeners: { expandbody: 'scope.onChildExpand' } }, listeners: { itemdblclick: 'scope.itemClick1' }, plugins: { rowwidget: { widget: { xtype: 'yvgrid', hideFootbar: true, selModel: { type: 'rowmodel', mode: 'SINGLE', }, listeners: { itemdblclick: 'scope.itemClick1' }, columns: [ { text: 'SQL', dataIndex: 'sql', flex: 1 }, { text: '次数', dataIndex: 'count', dataType: 'number' }, { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' }, { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' }, { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' }, { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' }, { text: '直方图', dataIndex: 'histogram', width: 180 }, ] } } } }, ] }; //# sourceMappingURL=InterfaceStatistics.view.js.map var model$n = { data: { count: 0, dataSourceName: '', sql: "", histogram: '', maxCost: 0, minCost: 0, avgCost: '', sumCost: 0, histogramInfos: [ // count: 1 // gteCost: 20 // ltCost: 50 // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = ?\norder by sys_resource.resource_order asc" // topN: [ // cost: 24 // occurrenceTime: "1648004895171" // sql: "select sys_resource.resource_id, sys_resource.resource_name, sys_resource.resource_parent, sys_resource.resource_type, sys_resource.resource_icon, sys_resource.scope_url, sys_resource.scope_params, sys_resource.resource_order, sys_resource.permission_code, sys_resource.is_user_relation, sys_resource.is_role_relation, sys_resource.is_enable, sys_resource.create_by, sys_resource.create_at, sys_resource.update_by, sys_resource.update_at\nfrom sys_resource sys_resource\nwhere sys_resource.resource_type = 3\norder by sys_resource.resource_order asc" // ] ] } }; //# sourceMappingURL=PerformDialog.model.js.map var vjson$n = { title: '性能统计详情', height: 400, width: 800, modal: true, layout: 'fit', items: [ { xtype: 'tabpanel', items: [ { title: '摘要', key: "1", layout: 'border', items: [ { region: 'north', border: false, defaults: { margin: '8 0 0 0' }, items: [ { xtype: 'cols', defaultType: 'displayfield', defaults: { labelWidth: 70, }, items: [ { fieldLabel: 'count', bind: { value: '{count}' } }, { fieldLabel: 'maxCost', bind: { value: '{maxCost}' } }, { fieldLabel: 'minCost', bind: { value: '{minCost}' } }, { fieldLabel: 'avgCost', bind: { value: '{avgCost}' } }, { fieldLabel: 'sumCost', bind: { value: '{sumCost}' } }, ] }, { xtype: 'cols', items: [ { flex: 5, border: false, items: [ { xtype: 'segmentedbutton', reference: 'histogram', allowToggle: false, border: false, items: [] } ] }, ] }, ], }, { region: 'center', xtype: 'sqleditor', reference: 'sqlEditor', }, ] }, { title: '直方图', key: "2", } ] } ] }; //# sourceMappingURL=PerformDialog.view.js.map var PerformDialog = /** @class */ (function (_super) { __extends(PerformDialog, _super); function PerformDialog() { return _super.call(this, { model: model$n, vjson: vjson$n }) || this; } PerformDialog.prototype.onLoad = function () { var _this = this; var sql = this.viewModel.get('sql'); var sql2 = sqlFormat.format(sql, { indent: ' ', uppercase: true, }); var histogramInfos = this.viewModel.get('histogramInfos'); var vs = _$2.map(histogramInfos, function (v) { if (v.ltCost > 2100000000) { return { text: "[" + v.gteCost + ", \u221E):" + v.count }; } return { text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count }; }); this.refs.sqlEditor.setCode(sql2); _$2.forEach(vs, function (v) { _this.refs.histogram.add(v); }); }; return PerformDialog; }(Scope)); //# sourceMappingURL=PerformDialog.js.map var model$o = { data: {} }; var PerformStats = /** @class */ (function (_super) { __extends(PerformStats, _super); function PerformStats() { var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this; _this.requestFilterChange = _.debounce(function (sender, value) { var store = _this.refs.grid1.store; store.clearFilter(); if (value) { store.filterBy(function (record, id) { var text = toString(record.get('url')); // 用拼音筛选的方式 return text.includes(value); }); } }, 100); return _this; } PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) { widget.setData(record.data.children); }; PerformStats.prototype.itemClick1 = function (sender, record) { console.log('itemClick1', record.data); new PerformDialog().showDialog(sender, {}, { data: record.data }); }; PerformStats.prototype.onLoad = function () { var _this = this; Promise.all([metricsRequestApi(), metricsJdbcApi()]) .then(function (_a) { var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1]; var resData = reqRes.data; var jdbcData = jdbcRes.data; _.forEach(jdbcData, function (item) { item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; }))); }); _.forEach(resData, function (item) { item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; }))); if (_.isArray(item.sqls)) { item.children = _.map(item.sqls, function (sql) { return _.find(jdbcData, function (r) { return r.sql === sql; }); }).filter(function (v) { return !!v; }); } item.jdbcCount = _.size(item.children); }); _this.refs.grid1.setData(resData); // this.refs.grid2.setData(jdbcData) }); }; return PerformStats; }(Scope)); //# sourceMappingURL=InterfaceStatistics.js.map var vjson$o = { title: '性能统计', layout: 'fit', items: [ { title: '数据库统计', xtype: 'yvgrid', enableLocking: false, reference: 'grid2', pagination: false, selModel: { type: 'rowmodel', mode: 'SINGLE', }, tbar: { xtype: 'form', items: [ { xtype: 'cols', items: [ { fieldLabel: '搜索', listeners: { change: 'scope.jdbcFilterChange' } }, ] }, ] }, listeners: { itemdblclick: 'scope.itemClick1' }, columns: [ { text: 'SQL', dataIndex: 'sql', flex: 1 }, { text: '次数', dataIndex: 'count', dataType: 'number' }, { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' }, { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' }, { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' }, { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' }, { text: '直方图', dataIndex: 'histogram', width: 180 }, ] }, ] }; //# sourceMappingURL=DatabaseStatistics.view.js.map var model$p = { data: {} }; var PerformStats$1 = /** @class */ (function (_super) { __extends(PerformStats, _super); function PerformStats() { var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this; _this.jdbcFilterChange = _.debounce(function (sender, value) { var store = _this.refs.grid2.store; store.clearFilter(); if (value) { store.filterBy(function (record, id) { var text = toString(record.get('sql')); // 用拼音筛选的方式 return text.includes(value); }); } }, 100); return _this; } PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) { widget.setData(record.data.children); }; PerformStats.prototype.itemClick1 = function (sender, record) { console.log('itemClick1', record.data); new PerformDialog().showDialog(sender, {}, { data: record.data }); }; PerformStats.prototype.onLoad = function () { var _this = this; Promise.all([metricsRequestApi(), metricsJdbcApi()]) .then(function (_a) { var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1]; var resData = reqRes.data; var jdbcData = jdbcRes.data; _.forEach(jdbcData, function (item) { item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; }))); }); _.forEach(resData, function (item) { item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; }))); if (_.isArray(item.sqls)) { item.children = _.map(item.sqls, function (sql) { return _.find(jdbcData, function (r) { return r.sql === sql; }); }).filter(function (v) { return !!v; }); } item.jdbcCount = _.size(item.children); }); _this.refs.grid2.setData(jdbcData); }); }; return PerformStats; }(Scope)); //# sourceMappingURL=DatabaseStatistics.js.map var Controller$4 = /** @class */ (function () { function Controller() { } Controller.prototype.onDblClick = function (sender, record) { var data = record.raw; if (data.text === "接口统计") { var page = new PerformStats(); page.showPage({ title: "接口统计", id: '_InterfaceStatistics', path: '_InterfaceStatistics', }, {}); } else if (data.text === "数据库统计") { var page = new PerformStats$1(); page.showPage({ title: "数据库统计", id: '_DatabaseStatistics', path: '_DatabaseStatistics', }, {}); } }; Controller.prototype.onLoad = function () { var me = this; //@ts-ignore var view = me.getView(); view.setRootNode({ expanded: true, leaf: false, children: [ { leaf: true, text: '接口统计' }, { leaf: true, text: '数据库统计' }, ] }); }; return Controller; }()); var controller$4 = new Controller$4(); function initMonitorTree () { Ext.define('com.yvan.studio.MonitorTree', { extend: 'Ext.tree.Panel', xtype: 'monitortree', controller: controller$4, scope: controller$4, reference: 'roleGrid', tooltip: '表单定义', iconCls: 'x-fa fa-bar-chart', useArrows: true, rootVisible: false, colspan: 2, lines: true, multiSelect: false, referenceHolder: true, // openNode() { // const selection = this.getSelection() // const [record] = selection // if (!record) { // return // } // // const {raw} = record; // if (raw.type === 'Dir') { // return // } // if (raw.type === "Module" && raw.module) { // // eventBus.publish(EventType.ModuleOpen, raw) // } // }, listeners: { itemdblclick: 'onDblClick', afterrender: "onLoad", }, }); } //# sourceMappingURL=MonitorTree.js.map var Controller$5 = /** @class */ (function () { function Controller() { } return Controller; }()); var controller$5 = new Controller$5(); function initHomeTree () { Ext.define('com.yvan.studio.HomeTree', { extend: 'Ext.Panel', xtype: 'hometree', controller: controller$5, scope: controller$5, referenceHolder: true, bodyCls: 'home', // layout: 'fit', tbar: { xtype: 'toolbar', items: [ { xtype: 'button', iconCls: 'x-fa fa-exchange', text: '数据结构同步', handler: function (sender) { handles$1.mainWindow.showDataSync(sender); } }, { xtype: 'button', iconCls: 'x-fa fa-cubes', text: '数据域管理', handler: function (sender) { handles$1.mainWindow.showColumnDomain(); } }, ], }, // items: [ // // ], layout: { type: 'vbox', pack: 'start', align: 'stretch', }, items: [ { html: '
功能模块:
1134
' }, { html: '
查询模块:
4
' }, { html: '
数据表格:
265
' }, { html: '
字段域:
17
' }, { html: '
检索窗口:
38
' }, { html: '
接口平台:
16
' }, { html: '
计划任务:
0
' }, { html: '
工作流:
4
' }, { html: '
字典:
162
' }, ], }); } //# sourceMappingURL=HomeTree.js.map var WidgetStore = /** @class */ (function (_super) { __extends(WidgetStore, _super); function WidgetStore() { return _super !== null && _super.apply(this, arguments) || this; } WidgetStore.prototype.getCacheKey = function (param) { return "widget_data.json"; }; /*invokeApi(param: any): Promise { return new Promise(resolve => { //@ts-ignore require(["../../widget/all"], function (res) { const widgetList = res.default resolve(widgetList) }) }) }*/ WidgetStore.prototype.invokeApi = function (param) { return widgetListApi(param); }; return WidgetStore; }(CacheStore)); var instance$3 = new WidgetStore(); //# sourceMappingURL=WidgetStore.js.map var WidgetGridController = /** @class */ (function () { function WidgetGridController() { } WidgetGridController.prototype.onLoad = function (sender) { var me = this; setWidget(me); instance$3.registe(me.reloadData.bind(this)); instance$3.reloadIfNeed(undefined); }; WidgetGridController.prototype.widgetAdd = function (sender) { var me = this; var win = new Ext.Window({ autoDestroy: true, title: "新建弹框", width: 400, height: 220, resizable: true, closable: true, maximizable: true, minimizable: true, plain: true, // constrainHeader: true, constrain: true, layout: 'fit', animateTarget: sender, buttonAlign: 'center', items: [ { xtype: "form", layout: "hbox", margin: '10px 20px', border: 0, items: [ { flex: 1, layout: 'vbox', items: [ { xtype: "textfield", name: "widgetcode", fieldLabel: "弹窗文件", flex: 1, allowBlank: false, regex: /^[a-zA-Z][a-zA-Z0-9]*$/, regexText: "编号名只能以英文字母开头,且只包含英文字母、数字", labelWidth: 80, width: "100%", }, { xtype: "textfield", name: "widgetname", fieldLabel: "弹窗名称", flex: 1, allowBlank: false, labelWidth: 80, width: "100%", }, ] }, ] } ], //窗口按钮 buttons: [ { xtype: 'button', text: '保存', handler: function (btn) { //窗口获取表单 var form = win.down('form'); var vaildSuccess = form.isValid(); if (!vaildSuccess) { return; } var title = form.down('textfield[name="widgetname"]').getValue(); var widgetPath = form.down('textfield[name="widgetcode"]').getValue(); saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) { if (res.success) { msg$1('添加成功'); // 添加 handles$1.mainWindow.showWidget(widgetPath, title, function () { me.reload(); }); win.close(); } }); } }, { xtype: 'button', text: '取消', handler: function (btn) { //窗口关闭 win.close(); } } ] }); win.show(); }; WidgetGridController.prototype.widgetRemove = function (sender) { var _this = this; //@ts-ignore var record = this.getView().selection.data; if (!record) { msg$1('请选择一行'); return; } var widgetPath = record.widget_path; Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) { if (btn === 'yes') { deleteWidget({ widgetPath: widgetPath }).then(function (res) { if (res.success) { msg$1(res.msg); _this.reload(); } }); } }); }; WidgetGridController.prototype.widgetEdit = function (record) { var _this = this; if (record) { var widgetPath = record.widget_path; var widgetName = record.widget_name; handles$1.mainWindow.showWidget(widgetPath, widgetName, function () { _this.reload(); }); } }; WidgetGridController.prototype.onDestory = function (sender) { var me = this; setWidget(undefined); instance$3.unregiste(me.reloadData.bind(this)); }; WidgetGridController.prototype.reloadData = function (res) { var me = this; //@ts-ignore var view = me.getView(); if (typeof res === 'object') { // const data = [] // _.forOwn(res, (v, k) => { // data.push({ // widget_path: k, // widget_name: v.title, // vjson : v // }) // }) view.setStore(new Ext.data.Store({ fields: ['widget_path', 'widget_name'], data: res.data, })); } else if (typeof res === 'boolean') { view.setLoading(res); } }; WidgetGridController.prototype.reload = function () { instance$3.reloadForce(undefined); }; WidgetGridController.prototype.filterChanged = function (sender, value) { //@ts-ignore this.view.store.clearFilter(); if (value) { //@ts-ignore this.view.store.filterBy(function (record) { var widget_path = record.get('widget_path'); var widget_name = record.get('widget_name'); return (window['system'].pinyinMatch(widget_name, value) || _$2.includes(_$2.toLower(widget_path), _$2.toLower(value))); }); } }; WidgetGridController.prototype.onClearClick = function () { var _a, _b; //@ts-ignore (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue(''); }; WidgetGridController.prototype.onDblClick = function (sender, record) { this.widgetEdit(record.data); }; return WidgetGridController; }()); //# sourceMappingURL=WidgetGridController.js.map function initWidget () { var controller = new WidgetGridController(); Ext.define('com.yvan.studio.WidgetGrid', { extend: 'Ext.grid.Panel', xtype: 'widgetgrid', controller: controller, scope: controller, referenceHolder: true, tooltip: '检索窗口', iconCls: 'x-fa fa-search', useArrows: true, reference: 'widgetgrid', selModel: { type: 'rowmodel', mode: 'SINGLE', }, listeners: { itemdblclick: 'onDblClick', afterrender: 'onLoad', destory: 'onDestory', }, viewConfig: { listeners: { itemcontextmenu: 'onGridContextMenu', }, }, tbar: [ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, { xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'widgetAdd' } }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'widgetRemove' } }, ], fbar: [ { xtype: 'textfield', flex: 1, reference: "txtFilter", emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: { fn: 'filterChanged', buffer: 50 } } }, ], columns: [ { text: '弹窗文件', dataIndex: 'widget_path', menuDisabled: true, flex: 1, }, { text: '弹窗名称', dataIndex: 'widget_name', menuDisabled: true, flex: 1, }, ] }); } //# sourceMappingURL=WidgetGrid.js.map var WhLayoutController = /** @class */ (function () { function WhLayoutController() { } WhLayoutController.prototype.onLoad = function (sender) { var _this = this; var me = this; setWhLayout(me); _$2.defer(function () { _this.reload(); }); }; WhLayoutController.prototype.reload = function () { //@ts-ignore var view = this.getView(); view.setLoading(true); loadWhLayoutAll().then(function (res) { view.setStore(new Ext.data.Store({ fields: ['layout_code', 'layout_name'], data: res.data, })); }).finally(function () { view.setLoading(false); }); }; WhLayoutController.prototype.add = function () { handles$1.mainWindow.showLayoutDesign(undefined, undefined); }; WhLayoutController.prototype.edit = function (data) { handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name); }; WhLayoutController.prototype.remove = function () { var _this = this; var _a; //@ts-ignore var view = this.getView(); var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data; if (!record) { msg$1('请选择一行数据'); return; } var layoutCode = record.layout_code; Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) { if (btn === 'yes') { deleteWhLayout({ layoutCode: layoutCode }).then(function (res) { if (res.success) { msg$1(res.msg); _this.reload(); } }); } }); }; WhLayoutController.prototype.onDblClick = function () { var _a; //@ts-ignore var view = this.getView(); var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data; if (!record) { msg$1('请选择一行数据'); return; } this.edit(record); }; WhLayoutController.prototype.filterChanged = function (sender, value) { //@ts-ignore this.view.store.clearFilter(); if (value) { //@ts-ignore this.view.store.filterBy(function (record) { var widget_path = record.get('widget_path'); var widget_name = record.get('widget_name'); return (window['system'].pinyinMatch(widget_name, value) || _$2.includes(_$2.toLower(widget_path), _$2.toLower(value))); }); } }; WhLayoutController.prototype.onClearClick = function () { var _a, _b; //@ts-ignore (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue(''); }; return WhLayoutController; }()); //# sourceMappingURL=WhLayoutController.js.map function initWhLayout () { var controller = new WhLayoutController(); Ext.define('com.yvan.studio.WhLayout', { extend: 'Ext.grid.Panel', xtype: 'whlayout', alias: 'widget.whlayout', controller: controller, scope: controller, referenceHolder: true, tooltip: '检索窗口', iconCls: 'x-fa fa-search', useArrows: true, reference: 'whlayout', selModel: { type: 'rowmodel', mode: 'SINGLE', }, listeners: { itemdblclick: 'onDblClick', afterrender: 'onLoad', destory: 'onDestory', }, viewConfig: { listeners: { itemcontextmenu: 'onGridContextMenu', }, }, tbar: [ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, { xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', listeners: { click: 'add' } }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'remove' } }, ], fbar: [ { xtype: 'textfield', flex: 1, reference: "txtFilter", emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: { fn: 'filterChanged', buffer: 50 } } }, ], columns: [ { text: '图编号', dataIndex: 'layout_code', menuDisabled: true, flex: 1, }, { text: '图名称', dataIndex: 'layout_name', menuDisabled: true, flex: 1, }, ] }); } //# sourceMappingURL=WhLayout.js.map var BpmnTreeController = /** @class */ (function () { function BpmnTreeController() { } BpmnTreeController.prototype.onLoad = function (sender) { this.reload(); }; BpmnTreeController.prototype.reload = function () { var me = this; me.getView().setLoading(true); exporerList().then(function (res) { // handles.mainWindow.modules = res.data // const rootNode = modulesToTreeData(res.data) var rootNode = res.data.tree; me.getView().setRootNode({ expanded: true, leaf: false, children: rootNode }); // const lastId = window.location.hash.substring(1); // file.selectPath(lastId) // if (lastId) { // const node = getModuleById(rootNode, lastId) // if (node) { // showDesign(node.id, node.path, node.text, node.module) // } // } // this.restoreState() }).finally(function () { me.getView().setLoading(false); }); }; BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) { var _this = this; e.preventDefault(); var raw = node.raw; //const me = sender.up("treepanel").scope var option; if (raw.exporerType === 1) ; else if (raw.exporerType === 21) { if (raw.type === 'Dir') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '添加', iconCls: 'x-fa fa-plus-circle', handler: function (sender) { var dirPath = raw.dirPath; handles$1.mainWindow.showFormSingle(dirPath, "", "", ""); } }, '-', { text: '新建文件夹', iconCls: 'x-fa fa-folder-o', handler: function (sender) { } } ] }; } else if (raw.type === 'Model') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '编辑', iconCls: 'x-fa fa-edit', handler: function (sender) { } }, { text: '删除', iconCls: 'x-fa fa-minus-circle', handler: function (sender) { } }, '-', { text: '注册(至菜单)', iconCls: 'x-fa fa-sign-in', handler: function (sender) { } }, { text: '新建文件夹', iconCls: 'x-fa fa-folder-o', handler: function (sender) { } } ] }; } } else if (raw.exporerType === 22) { if (raw.type === 'Dir') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '添加', iconCls: 'x-fa fa-plus-circle', handler: function (sender) { var dirPath = raw.dirPath; handles$1.mainWindow.showFormBill(); } }, '-', { text: '新建文件夹', iconCls: 'x-fa fa-folder-o', handler: function (sender) { } } ] }; } else if (raw.type === 'Model') { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '编辑', iconCls: 'x-fa fa-edit', handler: function (sender) { } }, { text: '删除', iconCls: 'x-fa fa-minus-circle', handler: function (sender) { } }, '-', { text: '注册(至菜单)', iconCls: 'x-fa fa-sign-in', handler: function (sender) { } }, { text: '新建文件夹', iconCls: 'x-fa fa-folder-o', handler: function (sender) { } } ] }; } } else if (raw.exporerType === 3) ; else if (raw.exporerType === 50) { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '新建流程', iconCls: 'x-fa fa-new', handler: function (sender) { _this.bpmnAdd(sender); } }, ] }; } else if (raw.exporerType === 51) { option = { shadow: 'frame', allowOtherMenus: true, items: [ { text: '新建流程', iconCls: 'x-fa fa-new', handler: function (sender) { _this.bpmnAdd(sender); } }, { text: '删除', iconCls: 'x-fa fa-minus-circle', handler: function (sender) { _this.bpmnDelete(sender, raw); } }, ] }; } else { throw Error('暂时不支持!'); } if (option) { var treeMenu = new Ext.menu.Menu(option); treeMenu.showAt(e.getXY()); } }; BpmnTreeController.prototype.bpmnAdd = function (sender) { var _this = this; prompt$2('输入工作流名称').then(function (name) { createBpmn("", name).then(function (res) { if (res.success) { msg$1('添加成功'); } _this.reload(); }); }); }; BpmnTreeController.prototype.bpmnDelete = function (sender, raw) { var _this = this; YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () { deleteBpmn(raw.absolutePath, raw.text).then(function (res) { if (res.success) { msg$1('添加成功'); } _this.reload(); }); }); }; BpmnTreeController.prototype.reportAdd = function (sender) { var _this = this; prompt$2('请输入报表名称').then(function (name) { createReportApi(name).then(function (res) { if (res.success) { msg$1('添加成功'); handles$1.mainWindow.showReport(res.data, name, function () { _this.reload(); }); } _this.reload(); }); }); }; BpmnTreeController.prototype.reportRegiste = function (sender, record) { if (record) { var reportName = record.get('report_name'); var reportId = record.get('report_id'); registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search'); } }; BpmnTreeController.prototype.reportRemove = function (sender, record) { var _this = this; if (record) { var reportName = record.get('report_name'); var reportId_1 = record.get('report_id'); YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () { delReportApi(reportId_1).then(function (res) { if (res.success) { msg$1('删除成功'); _this.reload(); } }); }); } }; BpmnTreeController.prototype.reportEdit = function (sender, record) { var _this = this; if (!record || record.type !== 'Module') { return; } var reportName = record.text; var reportId = record.target; handles$1.mainWindow.showReport(reportId, reportName, function () { _this.reload(); }); }; BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) { var data = record.raw; if (data.type !== 'Module' && data.type !== 'Dir') { return; } // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数 if (data.exporerType === 10) { // 表单 // this.reportEdit(sender, data) handles$1.mainWindow.showReport(); } else if (data.exporerType === 21) { handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id); } else if (data.exporerType === 22) { handles$1.mainWindow.showFormBill(); } else if (data.exporerType === 30) { handles$1.mainWindow.showWidgetDesign(); } else if (data.exporerType === 51) { handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text); } else { throw Error('暂时不支持!'); } }; return BpmnTreeController; }()); var controller$6 = new BpmnTreeController(); function initBpmnTree () { Ext.define('com.yvan.studio.BpmnTree', { extend: 'Ext.tree.Panel', //extend: 'com.yvan.studio.StateTree', xtype: 'bpmntree', controller: controller$6, scope: controller$6, tooltip: '表单定义', iconCls: 'x-fa fa-random', useArrows: true, rootVisible: false, colspan: 2, lines: true, multiSelect: true, reload: function () { this.controller.reload.call(this, arguments); }, openNode: function () { var selection = this.getSelection(); var _a = __read(selection, 1), record = _a[0]; if (!record) { return; } var raw = record.raw; if (raw.type === 'Dir') { return; } if (raw.type === "Module" && raw.module) ; }, listeners: { itemdblclick: 'onDblClick', afterrender: 'onLoad', // itemverify() { // this.openNode() // }, itemcontextmenu: 'onLisenContextMenu' }, tbar: { xtype: 'toolbar', items: [ { xtype: 'button', tooltip: '刷新', iconCls: 'x-fa fa-refresh', listeners: { click: 'reload' } }, /*{ xtype: 'button', tooltip: '添加', iconCls: 'x-fa fa-plus-circle', menu: [ { text: '类别', listeners: { click: 'classAdd' } }, { text: '查询', listeners: { click: 'reportAdd' } }, '-', { text: '单表定义', listeners: { click: 'singleTableAdd' } }, { text: '多表定义', listeners: { click: 'complexTableAdd' } }, { text: '查询窗口定义', listeners: { click: 'widgetAdd' } }, ], }, { xtype: 'button', tooltip: '删除', iconCls: 'x-fa fa-minus-circle', listeners: { click: 'reportRemove' } },*/ { xtype: 'textfield', flex: 1, reference: "txtFilter", emptyText: '搜索过滤', enableKeyEvents: true, listeners: { change: { fn: 'filterChanged', buffer: 50 } } }, ] }, }); } //# sourceMappingURL=BpmnTree.js.map function initToolBox () { Ext.define('com.yvan.studio.ToolBox', { extend: 'Ext.panel.Panel', xtype: 'toolbox', tooltip: '工具箱', layout: 'fit', html: '
', border: false, beforeRender: function () { console.log('beforeRender', this); }, afterRender: function () { var $dom = $(this.body.dom).children('div'); $dom.append(createComponent()); $dom.css("height", '100%'); // @ts-ignore $('#_toolbox_list').find('li').each(function () { var id = $(this).children(':first').attr('drag_id'); var node = _$2.find(codeLines, function (node) { return node.id === id; }); setDrag(this, node); }); } }); } function setDrag(el, node) { new Ext.drag.Source({ element: el, proxy: { type: 'placeholder', getElement: function (info) { var html = "
" + info.eventTarget.innerText + "
"; return Ext.getBody().createChild({ html: html }); } }, listeners: { dragmove: delegateDragmove.bind(getDesignInstance(), node), dragend: delegateDragend.bind(getDesignInstance(), node), }, sourceVjson: node.code, dragType: node.dragType }); } function createComponent() { var template = []; for (var i = 0; i < codeLines.length; i++) { var item = codeLines[i]; if (!item.dragHtml) { continue; } var $ele = $("
  • " + item.dragHtml + "
  • "); $ele.children(':first').attr('drag_id', item.id); $ele.children(':first').append("
    " + item.value + "
    "); template.push("
  • " + $ele.html() + "
  • "); } var html = "
      " + template.join('\n') + "
    "; return html; } var codeLines = [ { id: '$label', value: layoutOrXtypeNameMap.label + ' - label', icon: "fa fa-font", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'label', text: '文本' + _$2.uniqueId('_l') } }, { id: '$text', value: layoutOrXtypeNameMap.textfield + ' - textfield', icon: "fa fa-edit", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'textfield', fieldLabel: '输入框' + _$2.uniqueId('_e') } }, { id: '$textarea', value: layoutOrXtypeNameMap.textareafield + ' - textareafield', icon: "fa fa-edit", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'textareafield', fieldLabel: '输入框' + _$2.uniqueId('_e') } }, { id: '$number', value: layoutOrXtypeNameMap.numberfield + ' - numberfield', icon: "fa fa-edit", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'numberfield', fieldLabel: '数字框' + _$2.uniqueId('_n') } }, { id: '$combo', value: layoutOrXtypeNameMap.combo + ' - combo', icon: "fa fa-angle-double-down", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'combo', fieldLabel: '请选择', data: [ { id: 'id1', text: '选项1' }, { id: 'id2', text: '选项2' }, { id: 'id3', text: '选项3' }, ], } }, { id: '$datebox', value: layoutOrXtypeNameMap.datefield + ' - datefield', icon: "fa fa-calendar", dragType: "col-item", dragHtml: "
    ", code: { xtype: "datefield", fieldLabel: '日期', } }, { id: '$searchbox', value: layoutOrXtypeNameMap.searchfield + ' - searchfield', icon: "fa fa-search", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'searchfield', fieldLabel: '搜索框', } }, { id: '$combogrid', value: layoutOrXtypeNameMap.combogrid + ' - combogrid', icon: "fa fa-table", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'combogrid', fieldLabel: '下拉表' } }, { id: '$combotree', value: layoutOrXtypeNameMap.combotree + ' - combotree', icon: "fa fa-tree", dragType: "col-item", dragHtml: "
    ", code: { xtype: 'combotree', fieldLabel: '下拉树', displayField: 'text', rootVisible: false } }, { id: '$button', value: layoutOrXtypeNameMap.button + ' - button', icon: 'fa fa-sign-in', dragType: "col-item", dragHtml: "
    ", code: { text: '按钮', iconCls: 'x-fa fa-bars', xtype: 'button' } }, { id: '$checkbox', value: layoutOrXtypeNameMap.checkbox + ' - checkbox', icon: 'fa fa-check-square', dragType: "col-item", dragHtml: "
    ", code: { xtype: 'checkbox', boxLabel: '勾选框', hideLabel: true, margin: '0 0 0 15', flex: 0, } }, { id: '$checkboxgroup', value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup', icon: 'fa fa-check-square', dragType: "col-item", dragHtml: "
    ", code: { xtype: 'checkboxgroup', fieldLabel: '勾选组', items: [ { boxLabel: 'Item 1', name: 'rb', inputValue: '1' }, { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true }, { boxLabel: 'Item 3', name: 'rb', inputValue: '3' }, { boxLabel: 'Item 4', name: 'rb', inputValue: '4' }, { boxLabel: 'Item 5', name: 'rb', inputValue: '5' }, { boxLabel: 'Item 6', name: 'rb', inputValue: '6' } ] } }, { id: '$radio', value: layoutOrXtypeNameMap.radio + ' - radio', icon: 'fa fa-dot-circle-o', dragType: "col-item", dragHtml: "
    ", code: { xtype: "radio", fieldLabel: "请选择", } }, { id: '$radiogroup', value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup', icon: 'fa fa-dot-circle-o', dragType: "col-item", dragHtml: "
    ", code: { xtype: "radiogroup", fieldLabel: "请选择", items: [ { boxLabel: 'Item 1', name: 'rb', inputValue: '1' }, { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true }, { boxLabel: 'Item 3', name: 'rb', inputValue: '3' }, { boxLabel: 'Item 4', name: 'rb', inputValue: '4' }, { boxLabel: 'Item 5', name: 'rb', inputValue: '5' }, { boxLabel: 'Item 6', name: 'rb', inputValue: '6' } ] } }, { id: '$cols', value: layoutOrXtypeNameMap.cols + ' - cols', icon: 'fa fa-list-alt', dragType: "cols-container", dragHtml: "
    ", code: { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '输入框', }, ], } }, { id: '$container', value: layoutOrXtypeNameMap.container + ' - container', icon: 'fa fa-flag', dragType: "col-item", dragHtml: "
    ", code: { xtype: 'container', border: false, layout: 'hbox', } }, { id: '$fit', value: layoutOrXtypeNameMap.fit + ' - fit', icon: 'fa fa-flag', dragType: "rows-container", dragHtml: "
    ", code: { border: false, layout: 'fit', items: [ { xtype: 'container', border: false, layout: 'hbox', } ] } }, ]; // @ts-ignore // export default ToolBoxCmp //# sourceMappingURL=ToolBox.js.map var that = undefined; function initPropertyDesign () { Ext.define('com.yvan.studio.PropertyDesign', { extend: 'Ext.panel.Panel', xtype: 'propertydesign', name: "PropertyDesign", tooltip: '属性', iconCls: 'x-fa fa-newspaper-o', reference: 'propertygrid', layout: 'border', border: false, moduleId: null, currentComponentVJson: null, currentComponentPropertyEditSource: null, vjson: null, propertyHandle: null, moduleSubscribe: null, items: [ new Ext.grid.property.Grid({ sortableColumns: false, region: 'center', listeners: { propertychange: function (source, propName, value, oldValue, eOpts) { value = _.trim(value); var a = _.find(that.currentComponentPropertyEditSource, function (item) { return item.label === propName; }); if (a.type === 'listeners') { if (value) { if (that.currentComponentVJson.listeners) { that.currentComponentVJson.listeners[propName] = value; } else { var t = {}; t[propName] = value; that.currentComponentVJson.listeners = t; } } else { _.forOwn(that.currentComponentVJson.listeners, function (value1, key) { if (!value1) { delete that.currentComponentVJson.listeners[key]; } else if (key === propName) { delete that.currentComponentVJson.listeners[key]; } }); if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) { delete that.currentComponentVJson.listeners; } } moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson, from: that.name, ignoreRenderUI: true }); } else if (a.type === 'fix') { if (!value) { delete that.currentComponentVJson[propName]; } else { that.currentComponentVJson[propName] = value.split("\r\n"); } moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson, from: that.name, ignoreRenderUI: true }); } else if (a.type === 'bind') { var bind_1 = that.currentComponentVJson.bind; if (typeof bind_1 === 'string' && a.id === "value") { if (value) { that.currentComponentVJson.bind = value; } else { delete that.currentComponentVJson.bind; } } else { // 转成bind对象 if (typeof bind_1 === 'string') { bind_1 = that.currentComponentVJson.bind = { value: bind_1 }; } if (value) { if (bind_1) { bind_1[a.id] = value; } else { var t = {}; t[a.id] = value; that.currentComponentVJson.bind = t; } } else { _.forOwn(bind_1, function (value1, key) { if (!value1) { delete bind_1[key]; } else if (key === a.id) { delete bind_1[key]; } }); if (Object.keys(bind_1).length <= 0) { delete that.currentComponentVJson.bind; } } } moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson, from: that.name, ignoreRenderUI: true }); } else if (a.type === 'boolean') { if (!value) { delete that.currentComponentVJson[propName]; } else if (value === 'false') { that.currentComponentVJson[propName] = false; } else if (value === 'true') { that.currentComponentVJson[propName] = true; } else { that.currentComponentVJson[propName] = value; } moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson, from: that.name }); } else { that.currentComponentVJson[propName] = value; moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson, from: that.name }); } console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson); }, } }) ], listeners: { // afterrender() { // this.propertyHandle.setSource({ // "(name)": "My Object", // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type // "Available": false, // boolean type // "Version": .01, // decimal type // "Description": "A test object" // }); // } }, initComponent: function () { var _this = this; this.propertyHandle = this.items[0]; setPropertyPanel(this); that = this; eventBus.subscribe(EventType.SetVjson, function (_a) { var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.setVjson(moduleId, from, ignoreRenderUI); }); return this.superclass.initComponent.apply(this, arguments); }, setVjson: function (moduleId, from, ignoreRenderUI) { var _this = this; // if (this.moduleId === null && moduleId) { // this.moduleId = moduleId // } if (moduleId !== this.moduleId || from === this.name) { return; } var moduleObj = moduleStore.getModuleObject(this.moduleId); if (!moduleObj) { return; } this.vjson = moduleObj.moduleObj.vjson; this.setPropertyAndEventSource(); if (this.componentSelectionChangeSubscribe) { this.componentSelectionChangeSubscribe.cancel(); this.componentSelectionChangeSubscribe = null; } if (this.updateVjsonChangeSubscribe) { this.updateVjsonChangeSubscribe.cancel(); this.updateVjsonChangeSubscribe = null; } this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) { var id = _a.id, from = _a.from; _this.onComponentSelectionChange(id, from); }); this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) { var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; _this.updateVjson(vjson, from, ignoreRenderUI); }); var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId; this.onComponentSelectionChange(id, from); }, updateVjson: function (vjson, from, ignoreRenderUI) { if (!vjson || from === this.name) { return; } this.vjson = vjson; this.setPropertyAndEventSource(); var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId; this.onComponentSelectionChange(id, from); }, onComponentSelectionChange: function (id, from) { if (from !== this.name) { this.currentComponentVJson = findInCode(this.vjson, id); this.setPropertyAndEventSource(); } }, setPropertyAndEventSource: function () { var _this = this; this.propertyHandle.setSource({}); if (!this.currentComponentVJson) { return; } var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype; var v = xtype; // 选中的对象可能是组 if (!v) { if (_.has(this.currentComponentVJson, "cols")) { v = "cols"; } else if (_.has(this.currentComponentVJson, "rows")) { v = "rows"; } } var pd = YvanUI.PropertyDescriptionTable.get(v); if (!pd) { // 这个组件没有属性 this.propertyHandle.setSource({}); return; } var funcArr = this.getAllfuncs(); var createFuncEditor = function () { return new Ext.form.field.ComboBox({ // disabled: true, displayField: 'name', valueField: 'name', store: funcArr, }); }; // ====================== 属性 var elements = []; var caption = ['通用', '样式', '绑定', '特性', '事件']; _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) { var props = pd.getPropsByGroup(group); if (props.length <= 0) return; //没有这一组属性 // 显示 group 的中文名 elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) }); if (caption[i] === '绑定') { _.each(props, function (prop) { elements.push({ label: "_" + prop.name, type: "bind", id: prop.name, desc: prop.desc, editor: new Ext.form.field.Text() }); }); } else { _.each(props, function (prop) { if (_.isArray(prop.type)) { elements.push({ label: prop.name, type: "combo", options: prop.type, id: prop.name, desc: prop.desc }); return; } switch (prop.type) { case 'boolean': { elements.push({ label: prop.name, id: prop.name, desc: prop.desc, type: 'boolean', editor: new Ext.form.field.ComboBox({ displayField: 'text', valueField: 'id', store: new Ext.data.Store({ field: ['id', 'text'], data: [ { id: 'true', text: 'True' }, { id: 'false', text: 'False' }, ] }) }), }); break; } case 'number': { elements.push({ label: prop.name, type: "number", id: prop.name, isNum: true, desc: prop.desc, editor: new Ext.form.field.Number() }); break; } case 'string': { elements.push({ label: prop.name, type: "string", id: prop.name, desc: prop.desc, editor: new Ext.form.field.Text() }); break; } case 'listeners': { elements.push({ label: prop.name, type: "listeners", id: prop.name, desc: prop.desc, editor: createFuncEditor() }); break; } case 'fix': { elements.push({ label: prop.name, type: "fix", id: prop.name, desc: prop.desc, editor: new Ext.form.field.Text() }); break; } case 'object': { break; } // case 'dataSource' : { // break; // } case 'valid': { break; } default: elements.push({ label: prop.name, type: prop.type, id: prop.name, desc: prop.desc, editor: new Ext.form.field.Text({ disabled: true }) }); console.error('不支持的编辑类型', prop); } }); } }); this.currentComponentPropertyEditSource = elements; var panel1Source = {}; var panel1SourceConfig = {}; _.each(elements, function (item) { var _a; if (item.type === "listeners") { var listeners = _this.currentComponentVJson.listeners; panel1Source[item.label] = listeners ? listeners[item.label] : ''; } else if (item.type === "fix") { panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n"); } else if (item.type === "bind") { var bind = _this.currentComponentVJson.bind; if (typeof bind === 'string' && item.id === 'value') { panel1Source[item.label] = bind; } else { panel1Source[item.label] = bind ? bind[item.id] : ''; } } else { panel1Source[item.label] = _this.currentComponentVJson[item.label]; } panel1Source[item.label] = panel1Source[item.label] || ''; panel1SourceConfig[item.label] = { editor: item.editor }; }); this.propertyHandle.setSource(panel1Source, panel1SourceConfig); }, getAllfuncs: function () { var _a, _b; var arr = (_b = (_a = handles$1.mainWindow.activeModulePage.refs) === null || _a === void 0 ? void 0 : _a.controllerEditor) === null || _b === void 0 ? void 0 : _b.funcArr; var scopeFuncs = []; _.forEach(arr, function (item) { scopeFuncs.push({ name: "scope." + item.name }); }); return scopeFuncs; } }); } //# sourceMappingURL=PropertyDesign.js.map function initViewOutlineTree () { Ext.define('com.yvan.studio.ViewOutlineTree', { extend: 'Ext.tree.Panel', xtype: 'viewoutlinetree', name: "ViewOutlineTree", tooltip: '设计大纲', iconCls: 'x-fa fa-list', rootVisible: false, useArrows: true, allowDeselect: true, colspan: 2, lines: false, reference: 'viewoutlinetree', multiSelect: true, _saveStateFlag: true, keyMapEnabled: true, moduleId: null, vjson: null, columns: [ { xtype: 'treecolumn', text: '布局', dataIndex: 'layoutNameDesc', flex: 2, sortable: true }, { text: '组件', dataIndex: 'xtype', flex: 1, sortable: true, align: 'center', } ], listeners: { itemcontextmenu: function (sender, node, element, idx, e) { e.preventDefault(); this.rightClickTreeNode(sender, node, element, idx, e); }, select: function (sender, node, index, e) { moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name }); }, rowkeydown: function (sender, node, element, rowIndex, e, eOpts) { if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') { moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name }); } } }, initComponent: function () { var _this = this; setViewoutlinetree(this); eventBus.subscribe(EventType.SetVjson, function (_a) { var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; return _this.setVjson(moduleId, from, ignoreRenderUI); }); return this.superclass.initComponent.apply(this, arguments); }, clear: function () { this.setRootNode(null); }, onChangModule: function (moduleId, oldModuleId, from) { if (!moduleId || moduleId !== this.moduleId) { return; } if (moduleStore.getModuleObject(moduleId)) { this.setVjson(moduleId, from); } }, setVjson: function (moduleId, from, ignoreRenderUI) { var _this = this; if (!moduleId || moduleId !== this.moduleId || from === this.name) { return; } this.moduleId = moduleId; // if (from === this.name) { // return // } this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson; this.setTreeValue(); if (this.componentSelectionChangeSubscribe) { this.componentSelectionChangeSubscribe.cancel(); this.componentSelectionChangeSubscribe = null; } if (this.setVjsonChangeSubscribe) { this.setVjsonChangeSubscribe.cancel(); this.setVjsonChangeSubscribe = null; } this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) { var id = _a.id, from = _a.from; return _this.onComponentSelectionChange(id, from); }); this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) { var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI; return _this.setModuleVjson(vjson, from, ignoreRenderUI); }); }, setModuleVjson: function (vjson, from, ignoreRenderUI) { if (!vjson || from === this.name) { return; } this.vjson = vjson; this.setTreeValue(); var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId; if (id) { this.selectPath(id); } }, onComponentSelectionChange: function (id, from) { if (from !== this.name) { if (id) { this.selectPath(id); } else { this.setTreeValue(); } } }, setTreeValue: function () { var outlineVj = {}; _.forOwn(this.vjson, function (obj, key) { if (key !== 'viewModel' && key !== 'store') { outlineVj[key] = _.cloneDeep(obj); } }); getLayoutOutline(outlineVj); this.setRootNode(outlineVj); }, rightClickTreeNode: function (sender, node, element, idx, e) { var raw = node.data; var option = {}; // 右键 option = { shadow: 'frame', allowOtherMenus: true, items: [] }; var switchType = raw.layoutName; if (raw.layoutName === 'north' || raw.layoutName === 'south' || raw.layoutName === 'west' || raw.layoutName === 'east' || raw.layoutName === 'center' || raw.layoutName === 'tbar' || raw.layoutName === 'fbar') { switchType = raw.xtype || raw.layout; } var itemArr = []; var hasTbar = false, hasFbar = false, hasBody = false; if (raw.hasOwnProperty("children")) { _.forEach(raw.children, function (value) { if (value.layoutName === 'tbar') { hasTbar = true; } else if (value.layoutName === 'fbar') { hasFbar = true; } else { hasBody = true; } }); } switch (switchType) { case 'fit': if (!hasTbar) { itemArr.push('tbar'); } if (!hasFbar) { itemArr.push('fbar'); } if (!hasBody) { itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel'); } option.items = this.menuNew(itemArr, raw); break; case 'border': if (!hasTbar) { itemArr.push('tbar'); } if (!hasFbar) { itemArr.push('fbar'); } itemArr.push('cnsew'); option.items = this.menuNew(itemArr, raw); break; // case 'tbar': // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw) // break; // case 'fbar': // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw) // break; case 'tabpanel': if (!hasTbar) { itemArr.push('tbar'); } if (!hasFbar) { itemArr.push('fbar'); } itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel'); option.items = this.menuNew(itemArr, raw); break; case 'yvgrid': if (!hasTbar) { itemArr.push('tbar'); } option.items = this.menuNew(itemArr, raw); break; case 'tree': if (!hasTbar) { itemArr.push('tbar'); } if (!hasFbar) { itemArr.push('fbar'); } option.items = this.menuNew(itemArr, raw); break; case 'fieldset': option.items = this.menuNew(['form', 'fieldset', 'cols'], raw); break; case 'form': if (!hasTbar) { itemArr.push('tbar'); } if (!hasFbar) { itemArr.push('fbar'); } itemArr.push('form', 'fieldset', 'cols'); option.items = this.menuNew(itemArr, raw); break; case 'toolbar': itemArr.push('button', 'textfield', 'label', 'combo'); option.items = this.menuNew(itemArr, raw); break; // case 'fbar': // itemArr.push('button', 'textfield', 'label', 'combo') // option.items = this.menuNew(itemArr, raw) // break default: option.items = this.menuNew(itemArr, raw); break; } var treeMenu = new Ext.menu.Menu(option); treeMenu.showAt(e.getXY()); }, newItem: function (viewType, raw, region) { var itemVjson = {}; switch (viewType) { case 'fit': itemVjson.layout = 'fit'; itemVjson.items = []; break; case 'border': itemVjson.layout = 'border'; itemVjson.items = []; break; case 'toolbar': itemVjson.xtype = 'toolbar'; itemVjson.title = 'toolbar'; itemVjson.items = [ { xtype: 'button', text: 'button' } ]; break; case 'tabpanel': itemVjson.xtype = 'tabpanel'; itemVjson.layout = 'fit'; itemVjson.items = []; break; case 'yvgrid': itemVjson.xtype = 'yvgrid'; itemVjson.layout = 'fit'; itemVjson.pagination = false; itemVjson.columns = [ { dataIndex: "skuId", header: "SKU_ID", }, ]; break; case 'tree': itemVjson.xtype = 'treepanel'; itemVjson.layout = 'fit'; break; case 'fieldset': case 'form': itemVjson.xtype = viewType; itemVjson.title = viewType; itemVjson.items = [ { xtype: 'cols', items: [ { xtype: 'textfield', fieldLabel: '输入框' } ] } ]; break; case 'cols': itemVjson.xtype = 'cols'; itemVjson.items = [ { xtype: 'textfield', fieldLabel: '输入框' } ]; break; case 'button': itemVjson.xtype = 'button'; itemVjson.text = '按钮'; itemVjson.iconCls = 'x-fa fa-plus'; break; case 'textfield': itemVjson.xtype = 'textfield'; itemVjson.fieldLabel = '输入框'; break; case 'combo': itemVjson.xtype = 'combo'; itemVjson.fieldLabel = '下拉框'; break; case 'label': itemVjson.xtype = 'label'; itemVjson.text = '文本'; break; } var target = findInCode(this.vjson, raw.id); if (region) { if (region === 'tbar' || region === 'fbar') { target[region] = itemVjson; } else { itemVjson.region = region; itemVjson.split = true; if (region === 'north' || region === 'south') { itemVjson.height = '30%'; itemVjson.collapsible = true; } else if (region === 'west' || region === 'east') { itemVjson.width = '30%'; itemVjson.collapsible = true; } target.items.push(itemVjson); } } else { if (target.xtype === 'tabpanel') { itemVjson.title = prompt("请输入标题", _.uniqueId("未命名")); } target.items.push(itemVjson); } moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson }); }, menuNew: function (typeArr, raw, region) { var that = this; var reArr = []; typeArr.forEach(function (value) { if (value === 'cnsew') { reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw))); } else if (value === 'tbar' || value === 'fbar') { reArr.push(that.menuNewTFBar(value, raw)); } else { reArr.push({ text: '新建' + layoutOrXtypeNameMap[value], iconCls: 'x-fa fa-plus', handler: function (sender) { that.newItem(value, raw, region); } }); } reArr.push("-"); }); if (region) { reArr.pop(); return reArr; } reArr.push({ text: '高级属性', iconCls: 'x-fa fa-cog', handler: function (sender) { var vj = findInCode(that.vjson, raw.id); that.advancedSettingWindow(vj); } }, { text: '上移', iconCls: 'x-fa fa-trash', handler: function (sender) { that.moveCmp(raw.id, 'up'); } }, { text: '置顶', iconCls: 'x-fa fa-trash', handler: function (sender) { that.moveCmp(raw.id, 'top'); } }, { text: '置底', iconCls: 'x-fa fa-trash', handler: function (sender) { that.moveCmp(raw.id, 'bottom'); } }, { text: '下移', iconCls: 'x-fa fa-trash', handler: function (sender) { that.moveCmp(raw.id, 'down'); } }, { text: '删除', iconCls: 'x-fa fa-trash', handler: function (sender) { deletVjsonById(that.vjson, raw.id); moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson }); } }); return reArr; }, menuNewCNSEW: function (raw) { var that = this; var arr = ['center', 'north', 'south', 'west', 'east']; if (raw.hasOwnProperty("children")) { _.forEach(raw.children, function (value) { _.remove(arr, function (it) { return it === value.layoutName; }); }); } var reArr = []; arr.forEach(function (value) { reArr.push({ text: layoutOrXtypeNameMap[value], iconCls: 'x-fa fa-plus', menu: { showSeparator: true, items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value) } }); reArr.push("-"); }); reArr.pop(); return reArr; }, menuNewTFBar: function (barType, raw) { var that = this; var reObj = { text: layoutOrXtypeNameMap[barType], iconCls: 'x-fa fa-plus', menu: { showSeparator: true, items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType) } }; return reObj; }, moveCmp: function (id, moveType) { var arr = findArrayContainer(this.vjson, id); var index = _.findIndex(arr, function (v) { return v.id === id; }); if (index < 0) { return; } switch (moveType) { case 'up': if (index > 0) { var o = arr[index]; arr[index] = arr[index - 1]; arr[index - 1] = o; } else { return; } break; case 'down': if (index < arr.length - 1) { var o = arr[index]; arr[index] = arr[index + 1]; arr[index + 1] = o; } else { return; } break; case 'top': if (index > 0) { var o = arr[index]; arr[index] = arr[0]; arr[0] = o; } else { return; } break; case 'bottom': if (index < arr.length - 1) { var o = arr[index]; arr[index] = arr[arr.length - 1]; arr[arr.length - 1] = o; } else { return; } break; } moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson }); } }); } //# sourceMappingURL=ViewOutlineTree.js.map function init$2 () { window['native'] = native; native.init(); init(); instance.getAllDomain().finally(function () { }); initStateTree(); initDashboard(); initFileTree(); initDbTree(); initReportGrid(); initGroovyEditor(); initJsEditor$1(); initJsonEditor$1(); initSqlEditor$1(); initTemplateEditor(); initDict$1(); initBpmnTree(); initToolBox(); initPropertyDesign(); initViewOutlineTree(); initWidget(); initWhLayout(); initApiTree(); initTaskTree(); initLogsTree(); initDevOpsTree(); initTerminal(); initMonitorTree(); initHomeTree(); } //# sourceMappingURL=init.js.map var studio = { init: init$2, handles: handles$1, Workbench: Workbench }; //# sourceMappingURL=index.js.map exports.axios = axios; exports.qs = Qs; exports.lodash = _$2; exports.jquery = $$2; exports.moment = moment$1; exports.recast = recast; exports.XLSX = XLSX; exports.Defaults = Defaults; exports.ExcelImportDialog = ExcelImportDialog; exports.Lib = Lib; exports.LibParam = LibParam; exports.PropertyDescriptionTable = PropertyDescriptionTable; exports.ReportScope = ReportScope; exports.SIMPLE_RE = SIMPLE_RE; exports.Scope = Scope; exports.ScopeEngine = ScopeEngine; exports.SystemEventFu = SystemEventFu; exports.ajax = ajax; exports.baseConfigProcess = baseConfigProcess; exports.baseConfigProcessList = baseConfigProcessList; exports.buildPlus = buildPlus; exports.buildReportScope = buildReportScope; exports.calcExpress = calcExpress; exports.calcObject = calcObject; exports.calcObjectFlat = calcObjectFlat; exports.clearViewModel = clearViewModel; exports.clearViewModelByLookup = clearViewModelByLookup; exports.clearViewModelReloadGrid = clearViewModelReloadGrid; exports.clearViewModelValues = clearViewModelValues; exports.commitMe = commitMe; exports.confirm = confirm; exports.createAjax = createAjax; exports.createUUID = createUUID; exports.deepTravJson = deepTravJson; exports.downLoad = downLoad; exports.evalFunction = evalFunction; exports.extend = extend; exports.flatRow = flatRow; exports.getApiConvert = getApiConvert; exports.getGridEditRows = getGridEditRows; exports.getParentGrid = getParentGrid; exports.getPinyin = getPinyin; exports.getRegList = getRegList; exports.getRegParamList = getRegParamList; exports.getScopeOnCreate = getScopeOnCreate; exports.init = init$1; exports.insertGridRow = insertGridRow; exports.invokeServer = invokeServer$1; exports.isDesignMode = isDesignMode; exports.isEmpty = isEmpty; exports.json5 = dist; exports.keywordFilter = keywordFilter; exports.lookupFn = lookupFn; exports.lookupScope = lookupScope; exports.mergeViewModel = mergeViewModel; exports.moveDownGridRow = moveDownGridRow; exports.moveUpGridRow = moveUpGridRow; exports.msg = msg$1; exports.msgError = msgError; exports.normId = normId; exports.pinyinMatch = pinyinMatch; exports.prompt = prompt$2; exports.raiseClick = raiseClick; exports.reloadGrid = reloadGrid; exports.removeGridRow = removeGridRow; exports.replaceNA = replaceNA; exports.saveGridRow = saveGridRow; exports.serverInvokeUrlTransform = serverInvokeUrlTransform; exports.setComboStore = setComboStore; exports.showErrorDialog = showErrorDialog$1; exports.showInfoDialog = showInfoDialog; exports.showWidget = showWidget; exports.sqlUrlTransform = sqlUrlTransform; exports.stopEvent = stopEvent; exports.studio = studio; exports.toPlainObject = toPlainObject; exports.toString = toString; exports.tryEnable = tryEnable; exports.tryVarSimple = tryVarSimple; exports.tryWriteByExpress = tryWriteByExpress; exports.tryWriteObject = tryWriteObject; exports.watch = watch; Object.defineProperty(exports, '__esModule', { value: true }); }); //# sourceMappingURL=yvan-ext.js.map