@visactor/vtable-editors 1.18.1 → 1.18.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/list-editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/list-editor.ts"],"names":[],"mappings":";;;AAKA,MAAa,UAAU;IAQrB,YAAY,YAA8B;QAP1C,eAAU,GAAW,OAAO,CAAC;QAQ3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,KAAa;QAEzB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC;QAE1C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;QAEvC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,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AAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,UAAU;IAEV,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,MAAmB;QACjC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC;IACjC,CAAC;CACF;AAzGD,gCAyGC","file":"list-editor.js","sourcesContent":["import type { EditContext, IEditor, Placement, RectProps } from './types';\nexport interface ListEditorConfig {\n values: string[];\n}\n\nexport class ListEditor implements IEditor {\n editorType: string = 'Input';\n input?: HTMLInputElement;\n editorConfig?: ListEditorConfig;\n container?: HTMLElement;\n element?: HTMLSelectElement;\n successCallback?: () => void;\n\n constructor(editorConfig: ListEditorConfig) {\n this.editorConfig = editorConfig;\n }\n\n createElement(value: string) {\n // create select tag\n const select = document.createElement('select');\n select.setAttribute('type', 'text');\n select.style.position = 'absolute';\n select.style.padding = '4px';\n select.style.width = '100%';\n select.style.boxSizing = 'border-box';\n select.style.backgroundColor = '#FFFFFF';\n select.style.borderRadius = '0px';\n select.style.border = '2px solid #d9d9d9';\n // #region 为了保证input在focus时,没有圆角\n select.addEventListener('focus', () => {\n select.style.borderColor = '#4A90E2';\n select.style.outline = 'none';\n });\n\n select.addEventListener('blur', () => {\n select.style.borderColor = '#d9d9d9';\n // input.style.boxShadow = 'none';\n });\n\n this.element = select;\n\n // create option tags\n const { values } = this.editorConfig;\n let opsStr = '';\n values.forEach(item => {\n opsStr +=\n item === value\n ? `<option value=\"${item}\" selected>${item}</option>`\n : `<option value=\"${item}\" >${item}</option>`;\n });\n select.innerHTML = opsStr;\n\n this.container.appendChild(select);\n // this._bindSelectChangeEvent();\n }\n\n _bindSelectChangeEvent() {\n this.element.addEventListener('change', () => {\n // this.successCallback();\n });\n }\n\n setValue(value: string) {\n // do nothing\n }\n\n getValue() {\n return this.element.value;\n }\n\n onStart({ container, value, referencePosition, endEdit }: EditContext) {\n this.container = container;\n this.successCallback = endEdit;\n\n this.createElement(value);\n\n if (value !== undefined && value !== null) {\n this.setValue(value);\n }\n if (referencePosition?.rect) {\n this.adjustPosition(referencePosition.rect);\n }\n this.element.focus();\n }\n\n adjustPosition(rect: RectProps) {\n //使border均分input位置rect的上下左右\n const borderWidth = 2;\n const top = rect.top - borderWidth / 2;\n const left = rect.left - borderWidth / 2;\n const width = rect.width + borderWidth;\n const height = rect.height + borderWidth;\n\n this.element.style.top = top + 'px';\n this.element.style.left = left + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n\n endEditing() {\n // do nothing\n }\n\n onEnd() {\n this.container.removeChild(this.element);\n }\n\n isEditorElement(target: HTMLElement) {\n return target === this.element;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/textArea-editor.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;IAOzB,YAAY,YAAmC;QAN/C,eAAU,GAAW,UAAU,CAAC;QAO9B,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;IACzC,CAAC;IAED,aAAa;;QACX,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAwB,CAAC;QACxE,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,EAAE;YAC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5B,MAAM,WAAW,GAAG,CAAC,CAAC;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,WAAW,GAAG,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,WAAW,GAAG,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,UAAU;IAEV,CAAC;IAED,KAAK;QAEH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,MAAmB;QACjC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC;IACjC,CAAC;CACF;AAzGD,wCAyGC","file":"textArea-editor.js","sourcesContent":["import type { EditContext, IEditor, RectProps } from './types';\n\nexport interface TextAreaEditorConfig {\n readonly?: boolean;\n}\n\nexport class TextAreaEditor implements IEditor {\n editorType: string = 'TextArea';\n editorConfig: TextAreaEditorConfig;\n container: HTMLElement;\n successCallback?: () => void;\n element?: HTMLTextAreaElement;\n\n constructor(editorConfig?: TextAreaEditorConfig) {\n this.editorConfig = editorConfig || {};\n }\n\n createElement() {\n const input = document.createElement('textArea') as HTMLTextAreaElement;\n if (this.editorConfig?.readonly) {\n input.setAttribute('readonly', `${this.editorConfig.readonly}`);\n }\n input.style.resize = 'none';\n input.style.position = 'absolute';\n input.style.padding = '4px';\n input.style.width = '100%';\n input.style.height = '100%';\n input.style.boxSizing = 'border-box';\n input.style.backgroundColor = '#FFFFFF';\n\n input.style.borderRadius = '0px';\n input.style.border = '2px solid #d9d9d9';\n\n // #region 为了保证input在focus时,没有圆角\n input.addEventListener('focus', () => {\n input.style.borderColor = '#4A90E2';\n input.style.outline = 'none';\n });\n\n input.addEventListener('blur', () => {\n input.style.borderColor = '#d9d9d9';\n // input.style.boxShadow = 'none';\n input.style.outline = 'none';\n });\n\n this.element = input;\n this.container.appendChild(input);\n\n // 监听键盘事件\n input.addEventListener('keydown', (e: KeyboardEvent) => {\n const _isSelectAll = e.key === 'a' && (e.ctrlKey || e.metaKey);\n const _isTextAreaNewLine = e.key === 'Enter' && e.shiftKey;\n if (_isSelectAll || _isTextAreaNewLine) {\n // 阻止冒泡 防止处理成表格全选事件\n e.stopPropagation();\n }\n });\n }\n\n setValue(value: string) {\n this.element.value = typeof value !== 'undefined' ? value : '';\n }\n\n getValue() {\n return this.element.value;\n }\n\n onStart({ value, referencePosition, container, endEdit }: EditContext<string>) {\n this.container = container;\n this.successCallback = endEdit;\n if (!this.element) {\n this.createElement();\n\n if (value !== undefined && value !== null) {\n this.setValue(value);\n }\n if (referencePosition?.rect) {\n this.adjustPosition(referencePosition.rect);\n }\n }\n this.element.focus();\n // do nothing\n }\n\n adjustPosition(rect: RectProps) {\n //使border均分input位置rect的上下左右\n const borderWidth = 2;\n const top = rect.top - borderWidth / 2;\n const left = rect.left - borderWidth / 2;\n const width = rect.width + borderWidth;\n const height = rect.height + borderWidth;\n\n this.element.style.top = top + 'px';\n this.element.style.left = left + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n\n endEditing() {\n // do nothing\n }\n\n onEnd() {\n // do nothing\n this.container.removeChild(this.element);\n this.element = undefined;\n }\n\n isEditorElement(target: HTMLElement) {\n return target === this.element;\n }\n}\n"]}
|
package/es/list-editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/list-editor.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,UAAU;IAQrB,YAAY,YAA8B;QAP1C,eAAU,GAAW,OAAO,CAAC;QAQ3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,KAAa;QAEzB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC;QAE1C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;QAEvC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/list-editor.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,UAAU;IAQrB,YAAY,YAA8B;QAP1C,eAAU,GAAW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M,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,UAAU;IAEV,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,MAAmB;QACjC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC;IACjC,CAAC;CACF","file":"list-editor.js","sourcesContent":["import type { EditContext, IEditor, Placement, RectProps } from './types';\nexport interface ListEditorConfig {\n values: string[];\n}\n\nexport class ListEditor implements IEditor {\n editorType: string = 'Input';\n input?: HTMLInputElement;\n editorConfig?: ListEditorConfig;\n container?: HTMLElement;\n element?: HTMLSelectElement;\n successCallback?: () => void;\n\n constructor(editorConfig: ListEditorConfig) {\n this.editorConfig = editorConfig;\n }\n\n createElement(value: string) {\n // create select tag\n const select = document.createElement('select');\n select.setAttribute('type', 'text');\n select.style.position = 'absolute';\n select.style.padding = '4px';\n select.style.width = '100%';\n select.style.boxSizing = 'border-box';\n select.style.backgroundColor = '#FFFFFF';\n select.style.borderRadius = '0px';\n select.style.border = '2px solid #d9d9d9';\n // #region 为了保证input在focus时,没有圆角\n select.addEventListener('focus', () => {\n select.style.borderColor = '#4A90E2';\n select.style.outline = 'none';\n });\n\n select.addEventListener('blur', () => {\n select.style.borderColor = '#d9d9d9';\n // input.style.boxShadow = 'none';\n });\n\n this.element = select;\n\n // create option tags\n const { values } = this.editorConfig;\n let opsStr = '';\n values.forEach(item => {\n opsStr +=\n item === value\n ? `<option value=\"${item}\" selected>${item}</option>`\n : `<option value=\"${item}\" >${item}</option>`;\n });\n select.innerHTML = opsStr;\n\n this.container.appendChild(select);\n // this._bindSelectChangeEvent();\n }\n\n _bindSelectChangeEvent() {\n this.element.addEventListener('change', () => {\n // this.successCallback();\n });\n }\n\n setValue(value: string) {\n // do nothing\n }\n\n getValue() {\n return this.element.value;\n }\n\n onStart({ container, value, referencePosition, endEdit }: EditContext) {\n this.container = container;\n this.successCallback = endEdit;\n\n this.createElement(value);\n\n if (value !== undefined && value !== null) {\n this.setValue(value);\n }\n if (referencePosition?.rect) {\n this.adjustPosition(referencePosition.rect);\n }\n this.element.focus();\n }\n\n adjustPosition(rect: RectProps) {\n //使border均分input位置rect的上下左右\n const borderWidth = 2;\n const top = rect.top - borderWidth / 2;\n const left = rect.left - borderWidth / 2;\n const width = rect.width + borderWidth;\n const height = rect.height + borderWidth;\n\n this.element.style.top = top + 'px';\n this.element.style.left = left + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n\n endEditing() {\n // do nothing\n }\n\n onEnd() {\n this.container.removeChild(this.element);\n }\n\n isEditorElement(target: HTMLElement) {\n return target === this.element;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/textArea-editor.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,cAAc;IAOzB,YAAY,YAAmC;QAN/C,eAAU,GAAW,UAAU,CAAC;QAO9B,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;IACzC,CAAC;IAED,aAAa;;QACX,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAwB,CAAC;QACxE,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,QAAQ,EAAE;YAC/B,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;SACjE;QACD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AAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,WAAW,GAAG,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,UAAU;IAEV,CAAC;IAED,KAAK;QAEH,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,MAAmB;QACjC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC;IACjC,CAAC;CACF","file":"textArea-editor.js","sourcesContent":["import type { EditContext, IEditor, RectProps } from './types';\n\nexport interface TextAreaEditorConfig {\n readonly?: boolean;\n}\n\nexport class TextAreaEditor implements IEditor {\n editorType: string = 'TextArea';\n editorConfig: TextAreaEditorConfig;\n container: HTMLElement;\n successCallback?: () => void;\n element?: HTMLTextAreaElement;\n\n constructor(editorConfig?: TextAreaEditorConfig) {\n this.editorConfig = editorConfig || {};\n }\n\n createElement() {\n const input = document.createElement('textArea') as HTMLTextAreaElement;\n if (this.editorConfig?.readonly) {\n input.setAttribute('readonly', `${this.editorConfig.readonly}`);\n }\n input.style.resize = 'none';\n input.style.position = 'absolute';\n input.style.padding = '4px';\n input.style.width = '100%';\n input.style.height = '100%';\n input.style.boxSizing = 'border-box';\n input.style.backgroundColor = '#FFFFFF';\n\n input.style.borderRadius = '0px';\n input.style.border = '2px solid #d9d9d9';\n\n // #region 为了保证input在focus时,没有圆角\n input.addEventListener('focus', () => {\n input.style.borderColor = '#4A90E2';\n input.style.outline = 'none';\n });\n\n input.addEventListener('blur', () => {\n input.style.borderColor = '#d9d9d9';\n // input.style.boxShadow = 'none';\n input.style.outline = 'none';\n });\n\n this.element = input;\n this.container.appendChild(input);\n\n // 监听键盘事件\n input.addEventListener('keydown', (e: KeyboardEvent) => {\n const _isSelectAll = e.key === 'a' && (e.ctrlKey || e.metaKey);\n const _isTextAreaNewLine = e.key === 'Enter' && e.shiftKey;\n if (_isSelectAll || _isTextAreaNewLine) {\n // 阻止冒泡 防止处理成表格全选事件\n e.stopPropagation();\n }\n });\n }\n\n setValue(value: string) {\n this.element.value = typeof value !== 'undefined' ? value : '';\n }\n\n getValue() {\n return this.element.value;\n }\n\n onStart({ value, referencePosition, container, endEdit }: EditContext<string>) {\n this.container = container;\n this.successCallback = endEdit;\n if (!this.element) {\n this.createElement();\n\n if (value !== undefined && value !== null) {\n this.setValue(value);\n }\n if (referencePosition?.rect) {\n this.adjustPosition(referencePosition.rect);\n }\n }\n this.element.focus();\n // do nothing\n }\n\n adjustPosition(rect: RectProps) {\n //使border均分input位置rect的上下左右\n const borderWidth = 2;\n const top = rect.top - borderWidth / 2;\n const left = rect.left - borderWidth / 2;\n const width = rect.width + borderWidth;\n const height = rect.height + borderWidth;\n\n this.element.style.top = top + 'px';\n this.element.style.left = left + 'px';\n this.element.style.width = width + 'px';\n this.element.style.height = height + 'px';\n }\n\n endEditing() {\n // do nothing\n }\n\n onEnd() {\n // do nothing\n this.container.removeChild(this.element);\n this.element = undefined;\n }\n\n isEditorElement(target: HTMLElement) {\n return target === this.element;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vtable-editors",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"ts-node": "10.9.0",
|
|
39
39
|
"tslib": "2.3.1",
|
|
40
40
|
"tslint": "5.12.1",
|
|
41
|
-
"@internal/bundler": "0.0.1",
|
|
42
41
|
"@internal/ts-config": "0.0.1",
|
|
42
|
+
"@internal/bundler": "0.0.1",
|
|
43
43
|
"@internal/eslint-config": "0.0.1"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|