acdr-ui/dist/dev/mp-weixin/uni_modules/lime-painter/components/common/relation.js.map

1 line
5.3 KiB
Plaintext

{"version":3,"file":"relation.js","sources":["../../../../../../../src/uni_modules/lime-painter/components/common/relation.js"],"sourcesContent":["const styles = (v ='') => v.split(';').filter(v => v && !/^[\\n\\s]+$/.test(v)).map(v => {\r\n\t\t\t\t\t\tconst key = v.slice(0, v.indexOf(':'))\r\n\t\t\t\t\t\tconst value = v.slice(v.indexOf(':')+1)\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\t[key\r\n\t\t\t\t\t\t\t\t.replace(/-([a-z])/g, function() { return arguments[1].toUpperCase()})\r\n\t\t\t\t\t\t\t\t.replace(/\\s+/g, '')\r\n\t\t\t\t\t\t\t]: value.replace(/^\\s+/, '').replace(/\\s+$/, '') || ''\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\nexport function parent(parent) {\r\n\treturn {\r\n\t\tprovide() {\r\n\t\t\treturn {\r\n\t\t\t\t[parent]: this\r\n\t\t\t}\r\n\t\t},\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tel: {\r\n\t\t\t\t\tid: null,\r\n\t\t\t\t\tcss: {},\r\n\t\t\t\t\tviews: []\r\n\t\t\t\t},\r\n\t\t\t}\r\n\t\t},\r\n\t\twatch: {\r\n\t\t\tcss: { \r\n\t\t\t\thandler(v) {\r\n\t\t\t\t\tif(this.canvasId) {\r\n\t\t\t\t\t\tthis.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {}\r\n\t\t\t\t\t\tthis.canvasWidth = this.el.css && this.el.css.width || this.canvasWidth\r\n\t\t\t\t\t\tthis.canvasHeight = this.el.css && this.el.css.height || this.canvasHeight\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\timmediate: true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\nexport function children(parent, options = {}) {\r\n\tconst indexKey = options.indexKey || 'index'\r\n\treturn {\r\n\t\tinject: {\r\n\t\t\t[parent]: {\r\n\t\t\t\tdefault: null\r\n\t\t\t}\r\n\t\t},\r\n\t\twatch: {\r\n\t\t\tel: {\r\n\t\t\t\thandler(v, o) {\r\n\t\t\t\t\tif(JSON.stringify(v) != JSON.stringify(o))\r\n\t\t\t\t\t\tthis.bindRelation()\r\n\t\t\t\t},\r\n\t\t\t\tdeep: true,\r\n\t\t\t\timmediate: true\r\n\t\t\t},\r\n\t\t\tsrc: {\r\n\t\t\t\thandler(v, o) {\r\n\t\t\t\t\tif(v != o)\r\n\t\t\t\t\t\tthis.bindRelation()\r\n\t\t\t\t},\r\n\t\t\t\timmediate: true\r\n\t\t\t},\r\n\t\t\ttext: {\r\n\t\t\t\thandler(v, o) {\r\n\t\t\t\t\tif(v != o) this.bindRelation()\r\n\t\t\t\t},\r\n\t\t\t\timmediate: true\r\n\t\t\t},\r\n\t\t\tcss: {\r\n\t\t\t\thandler(v, o) {\r\n\t\t\t\t\tif(v != o)\r\n\t\t\t\t\t\tthis.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {}\r\n\t\t\t\t},\r\n\t\t\t\timmediate: true\r\n\t\t\t},\r\n\t\t\treplace: {\r\n\t\t\t\thandler(v, o) {\r\n\t\t\t\t\tif(JSON.stringify(v) != JSON.stringify(o))\r\n\t\t\t\t\t\tthis.bindRelation()\r\n\t\t\t\t},\r\n\t\t\t\tdeep: true,\r\n\t\t\t\timmediate: true\r\n\t\t\t}\r\n\t\t},\r\n\t\tcreated() {\r\n\t\t\tif(!this._uid) {\r\n\t\t\t\tthis._uid = this._.uid\r\n\t\t\t}\r\n\t\t\tObject.defineProperty(this, 'parent', {\r\n\t\t\t\tget: () => this[parent] || [],\r\n\t\t\t})\r\n\t\t\tObject.defineProperty(this, 'index', {\r\n\t\t\t\tget: () => {\r\n\t\t\t\t\tthis.bindRelation();\r\n\t\t\t\t\tconst {parent: {el: {views=[]}={}}={}} = this\r\n\t\t\t\t\treturn views.indexOf(this.el)\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t\tthis.el.type = this.type\r\n\t\t\tif(this.uid) {\r\n\t\t\t\tthis.el.uid = this.uid\r\n\t\t\t}\r\n\t\t\tthis.bindRelation()\r\n\t\t},\r\n\t\t// #ifdef VUE3\r\n\t\tbeforeUnmount() {\r\n\t\t\tthis.removeEl()\r\n\t\t},\r\n\t\t// #endif\r\n\t\t// #ifdef VUE2\r\n\t\tbeforeDestroy() {\r\n\t\t\tthis.removeEl()\r\n\t\t},\r\n\t\t// #endif\r\n\t\tmethods: {\r\n\t\t\tremoveEl() {\r\n\t\t\t\tif (this.parent) {\r\n\t\t\t\t\tthis.parent.el.views = this.parent.el.views.filter(\r\n\t\t\t\t\t\t(item) => item._uid !== this._uid\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tbindRelation() {\r\n\t\t\t\tif(!this.el._uid) {\r\n\t\t\t\t\tthis.el._uid = this._uid \r\n\t\t\t\t}\r\n\t\t\t\tif(['text','qrcode'].includes(this.type)) {\r\n\t\t\t\t\tthis.el.text = this.$slots && this.$slots.default && this.$slots.default[0].text || `${this.text || ''}`.replace(/\\\\n/g, '\\n')\r\n\t\t\t\t}\r\n\t\t\t\tif(this.type == 'image') {\r\n\t\t\t\t\tthis.el.src = this.src\r\n\t\t\t\t}\r\n\t\t\t\tif (!this.parent) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tlet views = this.parent.el.views || [];\r\n\t\t\t\tif(views.indexOf(this.el) !== -1) {\r\n\t\t\t\t\tthis.parent.el.views = views.map(v => v._uid == this._uid ? this.el : v)\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.parent.el.views = [...views, this.el];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\tmounted() {\r\n\t\t\t// this.bindRelation()\r\n\t\t},\r\n\t}\r\n}"],"names":["v","parent"],"mappings":";;AAAA,MAAM,SAAS,CAAC,IAAG,OAAQ,EAAE,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