@operato/data-grist 10.29.52 → 10.29.56
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/CHANGELOG.md +11 -0
- package/dist/src/data-card/data-card.js +5 -5
- package/dist/src/data-card/data-card.js.map +1 -1
- package/dist/src/data-grid/data-grid-body.d.ts +8 -0
- package/dist/src/data-grid/data-grid-body.js +44 -27
- package/dist/src/data-grid/data-grid-body.js.map +1 -1
- package/dist/src/data-grid/data-grid.d.ts +1 -1
- package/dist/src/data-grid/data-grid.js +3 -2
- package/dist/src/data-grid/data-grid.js.map +1 -1
- package/dist/src/data-grist.js +17 -17
- package/dist/src/data-grist.js.map +1 -1
- package/dist/src/data-list/data-list.js +5 -5
- package/dist/src/data-list/data-list.js.map +1 -1
- package/dist/src/data-manipulator.d.ts +16 -1
- package/dist/src/data-manipulator.js +57 -14
- package/dist/src/data-manipulator.js.map +1 -1
- package/dist/src/editors/ox-grist-editor-number.js +2 -7
- package/dist/src/editors/ox-grist-editor-number.js.map +1 -1
- package/dist/src/editors/ox-grist-editor.js +15 -13
- package/dist/src/editors/ox-grist-editor.js.map +1 -1
- package/dist/src/utils/field-value.d.ts +11 -0
- package/dist/src/utils/field-value.js +38 -0
- package/dist/src/utils/field-value.js.map +1 -0
- package/dist/test/data-integrity.test.d.ts +1 -0
- package/dist/test/data-integrity.test.js +145 -0
- package/dist/test/data-integrity.test.js.map +1 -0
- package/dist/test/edit-lifecycle.test.d.ts +2 -0
- package/dist/test/edit-lifecycle.test.js +270 -0
- package/dist/test/edit-lifecycle.test.js.map +1 -0
- package/dist/test/list-records.test.d.ts +1 -0
- package/dist/test/list-records.test.js +46 -0
- package/dist/test/list-records.test.js.map +1 -0
- package/dist/test/page-errors.d.ts +1 -0
- package/dist/test/page-errors.js +44 -0
- package/dist/test/page-errors.js.map +1 -0
- package/dist/test/paste-integrity.test.d.ts +1 -0
- package/dist/test/paste-integrity.test.js +163 -0
- package/dist/test/paste-integrity.test.js.map +1 -0
- package/dist/test/searchable-select.test.js +3 -2
- package/dist/test/searchable-select.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/data-integrity.test.ts +150 -0
- package/test/edit-lifecycle.test.ts +302 -0
- package/test/list-records.test.ts +58 -0
- package/test/page-errors.ts +43 -0
- package/test/paste-integrity.test.ts +168 -0
- package/test/searchable-select.test.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [10.29.56](https://github.com/hatiolab/operato/compare/v10.29.55...v10.29.56) (2026-10-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* **data-grist:** a list or card keeps its records when its config changes ([8c55d55](https://github.com/hatiolab/operato/commit/8c55d5537b5ca201f4a82737477319ce97dcc94d))
|
|
12
|
+
* **data-grist:** keep validated edits on the row they were typed into ([bcb5286](https://github.com/hatiolab/operato/commit/bcb5286d56bc6bf31890e178d8debec17ae8d313))
|
|
13
|
+
* **data-grist:** preserve field values and guard edit integrity ([3e7a4db](https://github.com/hatiolab/operato/commit/3e7a4db90ba199ca43e6e71979a055183090df85))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
### [10.29.52](https://github.com/hatiolab/operato/compare/v10.29.51...v10.29.52) (2026-10-25)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -207,10 +207,10 @@ let DataCard = class DataCard extends DataManipulator {
|
|
|
207
207
|
this._dropSide = null;
|
|
208
208
|
}
|
|
209
209
|
updated(changes) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
/*
|
|
211
|
+
* The records and their page come from the data alone. A config that arrives after the data (a personal
|
|
212
|
+
* config loads later) used to empty them until the next fetch.
|
|
213
|
+
*/
|
|
214
214
|
if (changes.has('data')) {
|
|
215
215
|
this._records = this.data.records;
|
|
216
216
|
this._total = this.data.total || 0;
|
|
@@ -222,7 +222,7 @@ let DataCard = class DataCard extends DataManipulator {
|
|
|
222
222
|
var { classifier, reorderable } = this.config.rows;
|
|
223
223
|
var records = this._records || [];
|
|
224
224
|
if (this.config && this.config.rows.appendable) {
|
|
225
|
-
records = [...records,
|
|
225
|
+
records = [...records, this.appendRecord];
|
|
226
226
|
}
|
|
227
227
|
return html `
|
|
228
228
|
${records.map((record, rowIndex) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-card.js","sourceRoot":"","sources":["../../../src/data-card/data-card.ts"],"names":[],"mappings":";AACA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,eAAe;IAAtC;;QAqJY,aAAQ,GAAkB,EAAE,CAAA;QAC5B,UAAK,GAAY,KAAK,CAAA;QAE/B,WAAM,GAAW,CAAC,CAAA;QAClB,WAAM,GAAW,EAAE,CAAA;QACnB,UAAK,GAAW,CAAC,CAAA;QAEzB,+FAA+F;QACvF,eAAU,GAAkB,IAAI,CAAA;QAChC,kBAAa,GAAkB,IAAI,CAAA;QACnC,cAAS,GAA8B,IAAI,CAAA;IAkRrD,CAAC;IAhRC,YAAY,CAAC,OAA6B;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CA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AC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAgB;AAGhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAA0B;AAEpC;IAAhB,KAAK,EAAE;0CAAqC;AAC5B;IAAhB,KAAK,EAAE;uCAA+B;AAtJ5B,QAAQ;IADpB,aAAa,CAAC,SAAS,CAAC;GACZ,QAAQ,CAibpB","sourcesContent":["import i18next from 'i18next'\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/list-state/ox-empty-note.js'\nimport './record-card.js'\n\nimport { PropertyValues, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { DataManipulator } from '../data-manipulator.js'\nimport { GristRecord } from '../types.js'\nimport { GridEmptyNote, renderEmptyNote } from '../empty-note-render.js'\n\n@customElement('ox-card')\nexport class DataCard extends DataManipulator {\n static styles = [\n css`\n :host {\n overflow-y: auto;\n padding: var(--spacing-medium);\n\n display: grid;\n /*\n 카드 한 장의 최소 폭. 화면마다 실리는 것이 다르므로 값을 밖에서 정할 수 있어야 한다 —\n 그림이 주인공인 목록(자산 카탈로그)은 좁게 여러 장을, 글이 많은 목록은 넓게 몇 장을 놓는다.\n 기본값은 지금까지의 값 그대로다.\n */\n grid-template-columns: repeat(auto-fill, minmax(var(--data-card-min-width, 300px), 1fr));\n /*\n grid-template-rows: min-content only ever sizes the *first* row track - every row after\n it is implicit, and an implicit track with no grid-auto-rows falls back to the browser's\n default auto sizing, which is a looser (max-content-leaning) measurement than\n min-content. With enough records to wrap past one row, that mismatch showed up as a real\n gap: row 1 sized tight at ~201px, rows 2+ sized to ~319px while the cards inside still only\n filled ~201px of it (operato-board's board-list, 2026-09-23 - 17 boards, 7 per row).\n grid-auto-rows repeats the same rule for every implicit row, so all rows size alike.\n */\n grid-template-rows: min-content;\n grid-auto-rows: min-content;\n grid-gap: var(--spacing-large);\n }\n\n [selected-row] {\n background-color: var(--grid-record-selected-background-color);\n }\n\n /*\n ── 맨 위로 가는 단추 ──────────────────────────────────────────────────\n 자리를 먹지 않는다(absolute). 기준 상자는 ox-grist 의 host 인데(그쪽이 position: relative),\n 그래서 **목록과 함께 스크롤되지 않고** 상자에 붙어 있다.\n\n 고친 것 둘.\n\n 1. 위가 아니라 **아래**다. 오른쪽 위는 머리말·검색·필터가 있는 자리여서 단추가 그것들과\n 겹쳤다. 맨 위로 보내는 단추는 사람이 아래에 있을 때만 나오므로 손이 있는 쪽에 둔다.\n 2. rgba(255,255,255,0.7) 이 박혀 있었다 — 어두운 테마에서 흰 알약이 떠 있고, 아이콘은\n --icon-size-large 라 알약보다 커 보였다. 테마 토큰으로 그리고 크기를 정한다.\n */\n #upward {\n --md-icon-size: 20px;\n position: absolute;\n bottom: var(--data-card-fab-position-vertical, var(--spacing-large));\n right: var(--data-card-fab-position-horizontal, var(--spacing-large));\n display: grid;\n place-items: center;\n width: 36px;\n height: 36px;\n box-sizing: border-box;\n color: var(--data-card-fab-color, var(--md-sys-color-on-surface-variant));\n background-color: var(--data-card-fab-background-color, var(--md-sys-color-surface-container-high));\n /* 떠 있는 단추의 모서리는 알약이다 — 담는 면(6px)이 아니라 그 자신의 격을 따른다 */\n border-radius: var(--md-sys-shape-corner-full, 50%);\n border: 1px solid var(--md-sys-color-outline-variant);\n box-shadow: var(--data-card-fab-shadow, 0 1px 3px rgba(0, 0, 0, 0.18));\n cursor: pointer;\n z-index: 9;\n }\n\n #upward:hover {\n color: var(--md-sys-color-on-secondary-container);\n background-color: var(--md-sys-color-secondary-container);\n }\n\n slot {\n width: 100%;\n }\n\n ox-empty-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n [card][emphasized-row],\n [card][emphasized-row][focused] {\n background-color: var(--grid-record-emphasized-background-color);\n color: var(--grid-record-emphasized-color);\n }\n\n /*\n 드래그 순서 바꾸기 (rows.reorderable) — board-list 의 board-tile-list.ts 에서 검증된 모양을\n 그대로 가져온다. 자리(placement)만 이 파일이 정하고, 지속(persist)은 소비자가 한다 — 그\n 경계는 위 types.ts RowsConfig.reorderable 문서에 있다.\n */\n [card][draggable='true'] {\n cursor: grab;\n transition:\n opacity 0.2s ease,\n transform 0.2s ease;\n }\n\n [card].dragging {\n opacity: 0.3;\n transform: scale(0.95);\n }\n\n [card].drop-before {\n border-left: 3px solid var(--md-sys-color-primary);\n }\n\n [card].drop-after {\n border-right: 3px solid var(--md-sys-color-primary);\n }\n\n [card].flip-moving {\n transition: transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);\n }\n\n @keyframes ox-card-drop-land {\n 0% {\n opacity: 0;\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n [card].flip-dropped-hidden {\n opacity: 0;\n }\n\n [card].flip-dropped {\n animation: ox-card-drop-land 0.5s cubic-bezier(0.22, 0.6, 0.36, 1);\n }\n\n @media screen and (max-width: 460px) {\n #setting {\n grid-template-columns: 1fr;\n grid-template-rows: 1fr 1fr;\n }\n }\n `\n ]\n\n @property({ type: Boolean }) empty?: boolean\n\n /** 비었을 때 무슨 말을 하나 — 판단은 data-grist 가 하고 여기서는 그리기만 한다. */\n @property({ type: Object }) emptyNote?: GridEmptyNote\n\n @state() private _records: GristRecord[] = []\n @state() private isTop: boolean = false\n\n private _total: number = 0\n private _limit: number = 20\n private _page: number = 1\n\n /* Drag-reorder state (`rows.reorderable`) - board-tile-list.ts's proven shape, generalized. */\n private _draggedId: string | null = null\n private _dropTargetId: string | null = null\n private _dropSide: 'before' | 'after' | null = null\n\n firstUpdated(changes: PropertyValues<this>) {\n this.isTop = true\n\n /* infinite scrolling */\n this.addEventListener('scroll', e => {\n const totalScrollHeight = this.scrollHeight\n const screenHeight = this.offsetHeight\n const currentScrollTop = this.scrollTop\n\n if (totalScrollHeight <= screenHeight + currentScrollTop + 1) {\n /* 마지막 페이지까지 계속 페이지를 증가시킨다. */\n var lastPage = Math.ceil(this._total / this._limit)\n\n if (this._page < lastPage) {\n this.dispatchEvent(new CustomEvent('attach-page', { bubbles: true, composed: true }))\n }\n }\n\n this.isTop = this.scrollTop == 0\n })\n\n this._wireReorder()\n }\n\n /*\n * `config.rows.reorderable` is read inside each handler, not at listener-registration time - the\n * listeners are cheap to hold and this sidesteps any question of whether `config` has already been\n * assigned by the time `firstUpdated` runs (it is a plain property set by the caller's template,\n * not guaranteed ordered against connection).\n */\n private _wireReorder() {\n this.renderRoot.addEventListener('dragstart', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (!target?.id) return\n\n this._draggedId = target.id\n target.classList.add('dragging')\n ;(e as DragEvent).dataTransfer!.effectAllowed = 'move'\n ;(e as DragEvent).dataTransfer?.setData('text/plain', target.id)\n })\n\n this.renderRoot.addEventListener('dragover', (e: Event) => {\n if (!this.config?.rows?.reorderable || !this._draggedId) return\n e.preventDefault()\n ;(e as DragEvent).dataTransfer!.dropEffect = 'move'\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (!target?.id || target.id === this._draggedId) return\n\n const targetRect = target.getBoundingClientRect()\n const mousePos = (e as DragEvent).clientX - targetRect.left\n const side = mousePos < targetRect.width / 2 ? 'before' : 'after'\n\n if (this._dropTargetId !== target.id || this._dropSide !== side) {\n this._clearDropIndicator()\n this._dropTargetId = target.id\n this._dropSide = side\n target.classList.add(side === 'before' ? 'drop-before' : 'drop-after')\n }\n })\n\n this.renderRoot.addEventListener('dragleave', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (target?.id === this._dropTargetId) {\n const related = (e as DragEvent).relatedTarget as HTMLElement | null\n if (!related || !target.contains(related)) {\n this._clearDropIndicator()\n }\n }\n })\n\n this.renderRoot.addEventListener('drop', (e: Event) => this._onDrop(e as DragEvent))\n\n this.renderRoot.addEventListener('dragend', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n this._clearDropIndicator()\n const target = (e.target as HTMLElement).closest('[card]')\n if (target) target.classList.remove('dragging')\n this._resetDragState()\n })\n }\n\n private _onDrop(e: DragEvent) {\n if (!this.config?.rows?.reorderable) return\n e.preventDefault()\n\n /* drop 이 먼저 계산한다 - dragleave 가 먼저 일어나 상태를 지울 수 있어서다. */\n const dropTarget = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n let dropTargetId = this._dropTargetId\n let dropSide = this._dropSide\n\n if (dropTarget?.id && dropTarget.id !== this._draggedId) {\n dropTargetId = dropTarget.id\n const rect = dropTarget.getBoundingClientRect()\n dropSide = e.clientX - rect.left < rect.width / 2 ? 'before' : 'after'\n }\n\n this._clearDropIndicator()\n\n const draggedEl = this._draggedId ? this.renderRoot.querySelector(`[card][id=\"${this._draggedId}\"]`) : null\n draggedEl?.classList.remove('dragging')\n\n if (!this._draggedId || !dropTargetId || this._draggedId === dropTargetId) {\n this._resetDragState()\n return\n }\n\n const records = [...this._records]\n const draggedIndex = records.findIndex(r => r.id === this._draggedId)\n if (draggedIndex === -1) {\n this._resetDragState()\n return\n }\n\n const draggedId = this._draggedId\n const [dragged] = records.splice(draggedIndex, 1)\n let targetIndex = records.findIndex(r => r.id === dropTargetId)\n if (dropSide === 'after') targetIndex++\n records.splice(targetIndex, 0, dragged)\n\n this._resetDragState()\n\n /* FLIP: 옮기기 전 자리를 먼저 잰다. */\n const cards = this.renderRoot.querySelectorAll('[card][id]')\n const firstPositions = new Map<string, DOMRect>()\n cards.forEach(card => firstPositions.set(card.id, card.getBoundingClientRect()))\n\n /* 낙관적 갱신 - 지속은 이 이벤트를 듣는 쪽의 몫이다(RowsConfig.reorderable 문서 참조). */\n this._records = records\n\n this.updateComplete.then(() => {\n const updatedCards = this.renderRoot.querySelectorAll('[card][id]')\n let droppedEl: HTMLElement | null = null\n\n updatedCards.forEach(card => {\n const first = firstPositions.get(card.id)\n if (!first) return\n\n const last = card.getBoundingClientRect()\n const dx = first.left - last.left\n const dy = first.top - last.top\n const el = card as HTMLElement\n\n if (card.id === draggedId) {\n /* 옮긴 카드는 다른 카드들이 밀리는 동안 숨겨 뒀다가 마지막에 착지시킨다. */\n el.classList.add('flip-dropped-hidden')\n droppedEl = el\n } else {\n if (dx === 0 && dy === 0) return\n\n el.style.transform = `translate(${dx}px, ${dy}px)`\n el.style.transition = 'none'\n\n requestAnimationFrame(() => {\n el.classList.add('flip-moving')\n el.style.transform = ''\n el.style.transition = ''\n\n el.addEventListener('transitionend', () => el.classList.remove('flip-moving'), { once: true })\n })\n }\n })\n\n const ids = records.map(r => r.id!)\n const dispatchReorder = () => {\n this.dispatchEvent(\n new CustomEvent('reorder', {\n bubbles: true,\n composed: true,\n detail: { ids, movedId: draggedId }\n })\n )\n }\n\n if (droppedEl) {\n setTimeout(() => {\n const el = droppedEl as HTMLElement\n el.classList.remove('flip-dropped-hidden')\n el.classList.add('flip-dropped')\n el.addEventListener(\n 'animationend',\n () => {\n el.classList.remove('flip-dropped')\n dispatchReorder()\n },\n { once: true }\n )\n }, 500)\n } else {\n dispatchReorder()\n }\n })\n }\n\n private _clearDropIndicator() {\n if (this._dropTargetId) {\n this.renderRoot.querySelector(`[card][id=\"${this._dropTargetId}\"]`)?.classList.remove('drop-before', 'drop-after')\n }\n this._dropTargetId = null\n this._dropSide = null\n }\n\n private _resetDragState() {\n this._draggedId = null\n this._dropTargetId = null\n this._dropSide = null\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('config')) {\n this._records = []\n this._page = 1\n }\n\n if (changes.has('data')) {\n this._records = this.data.records\n this._total = this.data.total || 0\n this._limit = this.data.limit || 20\n this._page = this.data.page || 0\n }\n }\n\n render() {\n var { classifier, reorderable } = this.config.rows\n var records = this._records || []\n\n if (this.config && this.config.rows.appendable) {\n records = [...records, { __dirty__: '+' }]\n }\n\n return html`\n ${records.map((record, rowIndex) => {\n var { emphasized } = classifier.call(null, record, rowIndex) || {}\n /* Only a real record can be dragged - the trailing `appendable` placeholder has no id. */\n var draggable = reorderable && record.id\n\n return html`\n <ox-record-card\n .config=${this.config}\n .data=${this.data}\n .record=${record}\n .rowIndex=${rowIndex}\n .emphasized=${emphasized}\n ?selected-row=${record['__selected__']}\n ?dirty=${record['__dirty__']}\n id=${record.id || nothing}\n draggable=${draggable ? 'true' : 'false'}\n card\n ></ox-record-card>\n `\n })}\n ${this.empty ? renderEmptyNote(this.emptyNote) : html``}\n ${this.isTop\n ? html``\n : html` <md-icon id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}\n `\n }\n\n gotoTop(e: Event) {\n this.scrollTop = 0\n\n e.stopPropagation()\n }\n\n get pullToRefreshTarget() {\n return this\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data-card.js","sourceRoot":"","sources":["../../../src/data-card/data-card.ts"],"names":[],"mappings":";AACA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,eAAe;IAAtC;;QAqJY,aAAQ,GAAkB,EAAE,CAAA;QAC5B,UAAK,GAAY,KAAK,CAAA;QAE/B,WAAM,GAAW,CAAC,CAAA;QAClB,WAAM,GAAW,EAAE,CAAA;QACnB,UAAK,GAAW,CAAC,CAAA;QAEzB,+FAA+F;QACvF,eAAU,GAAkB,IAAI,CAAA;QAChC,kBAAa,GAAkB,IAAI,CAAA;QACnC,cAAS,GAA8B,IAAI,CAAA;IAiRrD,CAAC;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,MAAM,EAAE,CAAC;2CAA0B;AAEpC;IAAhB,KAAK,EAAE;0CAAqC;AAC5B;IAAhB,KAAK,EAAE;uCAA+B;AAtJ5B,QAAQ;IADpB,aAAa,CAAC,SAAS,CAAC;GACZ,QAAQ,CAgbpB","sourcesContent":["import i18next from 'i18next'\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/list-state/ox-empty-note.js'\nimport './record-card.js'\n\nimport { PropertyValues, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { DataManipulator } from '../data-manipulator.js'\nimport { GristRecord } from '../types.js'\nimport { GridEmptyNote, renderEmptyNote } from '../empty-note-render.js'\n\n@customElement('ox-card')\nexport class DataCard extends DataManipulator {\n static styles = [\n css`\n :host {\n overflow-y: auto;\n padding: var(--spacing-medium);\n\n display: grid;\n /*\n 카드 한 장의 최소 폭. 화면마다 실리는 것이 다르므로 값을 밖에서 정할 수 있어야 한다 —\n 그림이 주인공인 목록(자산 카탈로그)은 좁게 여러 장을, 글이 많은 목록은 넓게 몇 장을 놓는다.\n 기본값은 지금까지의 값 그대로다.\n */\n grid-template-columns: repeat(auto-fill, minmax(var(--data-card-min-width, 300px), 1fr));\n /*\n grid-template-rows: min-content only ever sizes the *first* row track - every row after\n it is implicit, and an implicit track with no grid-auto-rows falls back to the browser's\n default auto sizing, which is a looser (max-content-leaning) measurement than\n min-content. With enough records to wrap past one row, that mismatch showed up as a real\n gap: row 1 sized tight at ~201px, rows 2+ sized to ~319px while the cards inside still only\n filled ~201px of it (operato-board's board-list, 2026-09-23 - 17 boards, 7 per row).\n grid-auto-rows repeats the same rule for every implicit row, so all rows size alike.\n */\n grid-template-rows: min-content;\n grid-auto-rows: min-content;\n grid-gap: var(--spacing-large);\n }\n\n [selected-row] {\n background-color: var(--grid-record-selected-background-color);\n }\n\n /*\n ── 맨 위로 가는 단추 ──────────────────────────────────────────────────\n 자리를 먹지 않는다(absolute). 기준 상자는 ox-grist 의 host 인데(그쪽이 position: relative),\n 그래서 **목록과 함께 스크롤되지 않고** 상자에 붙어 있다.\n\n 고친 것 둘.\n\n 1. 위가 아니라 **아래**다. 오른쪽 위는 머리말·검색·필터가 있는 자리여서 단추가 그것들과\n 겹쳤다. 맨 위로 보내는 단추는 사람이 아래에 있을 때만 나오므로 손이 있는 쪽에 둔다.\n 2. rgba(255,255,255,0.7) 이 박혀 있었다 — 어두운 테마에서 흰 알약이 떠 있고, 아이콘은\n --icon-size-large 라 알약보다 커 보였다. 테마 토큰으로 그리고 크기를 정한다.\n */\n #upward {\n --md-icon-size: 20px;\n position: absolute;\n bottom: var(--data-card-fab-position-vertical, var(--spacing-large));\n right: var(--data-card-fab-position-horizontal, var(--spacing-large));\n display: grid;\n place-items: center;\n width: 36px;\n height: 36px;\n box-sizing: border-box;\n color: var(--data-card-fab-color, var(--md-sys-color-on-surface-variant));\n background-color: var(--data-card-fab-background-color, var(--md-sys-color-surface-container-high));\n /* 떠 있는 단추의 모서리는 알약이다 — 담는 면(6px)이 아니라 그 자신의 격을 따른다 */\n border-radius: var(--md-sys-shape-corner-full, 50%);\n border: 1px solid var(--md-sys-color-outline-variant);\n box-shadow: var(--data-card-fab-shadow, 0 1px 3px rgba(0, 0, 0, 0.18));\n cursor: pointer;\n z-index: 9;\n }\n\n #upward:hover {\n color: var(--md-sys-color-on-secondary-container);\n background-color: var(--md-sys-color-secondary-container);\n }\n\n slot {\n width: 100%;\n }\n\n ox-empty-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n [card][emphasized-row],\n [card][emphasized-row][focused] {\n background-color: var(--grid-record-emphasized-background-color);\n color: var(--grid-record-emphasized-color);\n }\n\n /*\n 드래그 순서 바꾸기 (rows.reorderable) — board-list 의 board-tile-list.ts 에서 검증된 모양을\n 그대로 가져온다. 자리(placement)만 이 파일이 정하고, 지속(persist)은 소비자가 한다 — 그\n 경계는 위 types.ts RowsConfig.reorderable 문서에 있다.\n */\n [card][draggable='true'] {\n cursor: grab;\n transition:\n opacity 0.2s ease,\n transform 0.2s ease;\n }\n\n [card].dragging {\n opacity: 0.3;\n transform: scale(0.95);\n }\n\n [card].drop-before {\n border-left: 3px solid var(--md-sys-color-primary);\n }\n\n [card].drop-after {\n border-right: 3px solid var(--md-sys-color-primary);\n }\n\n [card].flip-moving {\n transition: transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);\n }\n\n @keyframes ox-card-drop-land {\n 0% {\n opacity: 0;\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n [card].flip-dropped-hidden {\n opacity: 0;\n }\n\n [card].flip-dropped {\n animation: ox-card-drop-land 0.5s cubic-bezier(0.22, 0.6, 0.36, 1);\n }\n\n @media screen and (max-width: 460px) {\n #setting {\n grid-template-columns: 1fr;\n grid-template-rows: 1fr 1fr;\n }\n }\n `\n ]\n\n @property({ type: Boolean }) empty?: boolean\n\n /** 비었을 때 무슨 말을 하나 — 판단은 data-grist 가 하고 여기서는 그리기만 한다. */\n @property({ type: Object }) emptyNote?: GridEmptyNote\n\n @state() private _records: GristRecord[] = []\n @state() private isTop: boolean = false\n\n private _total: number = 0\n private _limit: number = 20\n private _page: number = 1\n\n /* Drag-reorder state (`rows.reorderable`) - board-tile-list.ts's proven shape, generalized. */\n private _draggedId: string | null = null\n private _dropTargetId: string | null = null\n private _dropSide: 'before' | 'after' | null = null\n\n firstUpdated(changes: PropertyValues<this>) {\n this.isTop = true\n\n /* infinite scrolling */\n this.addEventListener('scroll', e => {\n const totalScrollHeight = this.scrollHeight\n const screenHeight = this.offsetHeight\n const currentScrollTop = this.scrollTop\n\n if (totalScrollHeight <= screenHeight + currentScrollTop + 1) {\n /* 마지막 페이지까지 계속 페이지를 증가시킨다. */\n var lastPage = Math.ceil(this._total / this._limit)\n\n if (this._page < lastPage) {\n this.dispatchEvent(new CustomEvent('attach-page', { bubbles: true, composed: true }))\n }\n }\n\n this.isTop = this.scrollTop == 0\n })\n\n this._wireReorder()\n }\n\n /*\n * `config.rows.reorderable` is read inside each handler, not at listener-registration time - the\n * listeners are cheap to hold and this sidesteps any question of whether `config` has already been\n * assigned by the time `firstUpdated` runs (it is a plain property set by the caller's template,\n * not guaranteed ordered against connection).\n */\n private _wireReorder() {\n this.renderRoot.addEventListener('dragstart', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (!target?.id) return\n\n this._draggedId = target.id\n target.classList.add('dragging')\n ;(e as DragEvent).dataTransfer!.effectAllowed = 'move'\n ;(e as DragEvent).dataTransfer?.setData('text/plain', target.id)\n })\n\n this.renderRoot.addEventListener('dragover', (e: Event) => {\n if (!this.config?.rows?.reorderable || !this._draggedId) return\n e.preventDefault()\n ;(e as DragEvent).dataTransfer!.dropEffect = 'move'\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (!target?.id || target.id === this._draggedId) return\n\n const targetRect = target.getBoundingClientRect()\n const mousePos = (e as DragEvent).clientX - targetRect.left\n const side = mousePos < targetRect.width / 2 ? 'before' : 'after'\n\n if (this._dropTargetId !== target.id || this._dropSide !== side) {\n this._clearDropIndicator()\n this._dropTargetId = target.id\n this._dropSide = side\n target.classList.add(side === 'before' ? 'drop-before' : 'drop-after')\n }\n })\n\n this.renderRoot.addEventListener('dragleave', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n const target = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n if (target?.id === this._dropTargetId) {\n const related = (e as DragEvent).relatedTarget as HTMLElement | null\n if (!related || !target.contains(related)) {\n this._clearDropIndicator()\n }\n }\n })\n\n this.renderRoot.addEventListener('drop', (e: Event) => this._onDrop(e as DragEvent))\n\n this.renderRoot.addEventListener('dragend', (e: Event) => {\n if (!this.config?.rows?.reorderable) return\n\n this._clearDropIndicator()\n const target = (e.target as HTMLElement).closest('[card]')\n if (target) target.classList.remove('dragging')\n this._resetDragState()\n })\n }\n\n private _onDrop(e: DragEvent) {\n if (!this.config?.rows?.reorderable) return\n e.preventDefault()\n\n /* drop 이 먼저 계산한다 - dragleave 가 먼저 일어나 상태를 지울 수 있어서다. */\n const dropTarget = (e.target as HTMLElement).closest('[card][id]') as HTMLElement | null\n let dropTargetId = this._dropTargetId\n let dropSide = this._dropSide\n\n if (dropTarget?.id && dropTarget.id !== this._draggedId) {\n dropTargetId = dropTarget.id\n const rect = dropTarget.getBoundingClientRect()\n dropSide = e.clientX - rect.left < rect.width / 2 ? 'before' : 'after'\n }\n\n this._clearDropIndicator()\n\n const draggedEl = this._draggedId ? this.renderRoot.querySelector(`[card][id=\"${this._draggedId}\"]`) : null\n draggedEl?.classList.remove('dragging')\n\n if (!this._draggedId || !dropTargetId || this._draggedId === dropTargetId) {\n this._resetDragState()\n return\n }\n\n const records = [...this._records]\n const draggedIndex = records.findIndex(r => r.id === this._draggedId)\n if (draggedIndex === -1) {\n this._resetDragState()\n return\n }\n\n const draggedId = this._draggedId\n const [dragged] = records.splice(draggedIndex, 1)\n let targetIndex = records.findIndex(r => r.id === dropTargetId)\n if (dropSide === 'after') targetIndex++\n records.splice(targetIndex, 0, dragged)\n\n this._resetDragState()\n\n /* FLIP: 옮기기 전 자리를 먼저 잰다. */\n const cards = this.renderRoot.querySelectorAll('[card][id]')\n const firstPositions = new Map<string, DOMRect>()\n cards.forEach(card => firstPositions.set(card.id, card.getBoundingClientRect()))\n\n /* 낙관적 갱신 - 지속은 이 이벤트를 듣는 쪽의 몫이다(RowsConfig.reorderable 문서 참조). */\n this._records = records\n\n this.updateComplete.then(() => {\n const updatedCards = this.renderRoot.querySelectorAll('[card][id]')\n let droppedEl: HTMLElement | null = null\n\n updatedCards.forEach(card => {\n const first = firstPositions.get(card.id)\n if (!first) return\n\n const last = card.getBoundingClientRect()\n const dx = first.left - last.left\n const dy = first.top - last.top\n const el = card as HTMLElement\n\n if (card.id === draggedId) {\n /* 옮긴 카드는 다른 카드들이 밀리는 동안 숨겨 뒀다가 마지막에 착지시킨다. */\n el.classList.add('flip-dropped-hidden')\n droppedEl = el\n } else {\n if (dx === 0 && dy === 0) return\n\n el.style.transform = `translate(${dx}px, ${dy}px)`\n el.style.transition = 'none'\n\n requestAnimationFrame(() => {\n el.classList.add('flip-moving')\n el.style.transform = ''\n el.style.transition = ''\n\n el.addEventListener('transitionend', () => el.classList.remove('flip-moving'), { once: true })\n })\n }\n })\n\n const ids = records.map(r => r.id!)\n const dispatchReorder = () => {\n this.dispatchEvent(\n new CustomEvent('reorder', {\n bubbles: true,\n composed: true,\n detail: { ids, movedId: draggedId }\n })\n )\n }\n\n if (droppedEl) {\n setTimeout(() => {\n const el = droppedEl as HTMLElement\n el.classList.remove('flip-dropped-hidden')\n el.classList.add('flip-dropped')\n el.addEventListener(\n 'animationend',\n () => {\n el.classList.remove('flip-dropped')\n dispatchReorder()\n },\n { once: true }\n )\n }, 500)\n } else {\n dispatchReorder()\n }\n })\n }\n\n private _clearDropIndicator() {\n if (this._dropTargetId) {\n this.renderRoot.querySelector(`[card][id=\"${this._dropTargetId}\"]`)?.classList.remove('drop-before', 'drop-after')\n }\n this._dropTargetId = null\n this._dropSide = null\n }\n\n private _resetDragState() {\n this._draggedId = null\n this._dropTargetId = null\n this._dropSide = null\n }\n\n updated(changes: PropertyValues<this>) {\n /*\n * The records and their page come from the data alone. A config that arrives after the data (a personal\n * config loads later) used to empty them until the next fetch.\n */\n if (changes.has('data')) {\n this._records = this.data.records\n this._total = this.data.total || 0\n this._limit = this.data.limit || 20\n this._page = this.data.page || 0\n }\n }\n\n render() {\n var { classifier, reorderable } = this.config.rows\n var records = this._records || []\n\n if (this.config && this.config.rows.appendable) {\n records = [...records, this.appendRecord]\n }\n\n return html`\n ${records.map((record, rowIndex) => {\n var { emphasized } = classifier.call(null, record, rowIndex) || {}\n /* Only a real record can be dragged - the trailing `appendable` placeholder has no id. */\n var draggable = reorderable && record.id\n\n return html`\n <ox-record-card\n .config=${this.config}\n .data=${this.data}\n .record=${record}\n .rowIndex=${rowIndex}\n .emphasized=${emphasized}\n ?selected-row=${record['__selected__']}\n ?dirty=${record['__dirty__']}\n id=${record.id || nothing}\n draggable=${draggable ? 'true' : 'false'}\n card\n ></ox-record-card>\n `\n })}\n ${this.empty ? renderEmptyNote(this.emptyNote) : html``}\n ${this.isTop\n ? html``\n : html` <md-icon id=\"upward\" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}\n `\n }\n\n gotoTop(e: Event) {\n this.scrollTop = 0\n\n e.stopPropagation()\n }\n\n get pullToRefreshTarget() {\n return this\n }\n}\n"]}
|
|
@@ -9,6 +9,8 @@ export declare class DataGridBody extends LitElement {
|
|
|
9
9
|
config: GristConfig;
|
|
10
10
|
columns: ColumnConfig[];
|
|
11
11
|
data: GristData;
|
|
12
|
+
/** The empty row shown after the records when rows can be appended - the grid's own (`DataManipulator.appendRecord`). */
|
|
13
|
+
appendRecord: GristRecord;
|
|
12
14
|
focused: {
|
|
13
15
|
row: number;
|
|
14
16
|
column: number;
|
|
@@ -88,6 +90,12 @@ export declare class DataGridBody extends LitElement {
|
|
|
88
90
|
} | undefined;
|
|
89
91
|
copy(): Promise<void>;
|
|
90
92
|
paste(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* The rows a paste of `count` rows from `row` writes to, settled before any cell is applied - applying one can add
|
|
95
|
+
* a row. Rows past the end are new rows, the append row first, and only where rows can be appended. A new row joins
|
|
96
|
+
* the records with its first applied cell, so cells that are blank, read-only or rejected add no empty row.
|
|
97
|
+
*/
|
|
98
|
+
private pasteTargets;
|
|
91
99
|
setSelectBlock(start?: DataGridField, end?: DataGridField): void;
|
|
92
100
|
buildAccumulatorRecord(): GristRecord;
|
|
93
101
|
/**
|
|
@@ -5,11 +5,11 @@ import { css, html, LitElement, nothing } from 'lit';
|
|
|
5
5
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
7
|
import debounce from 'lodash-es/debounce.js';
|
|
8
|
-
import isEmpty from 'lodash-es/isEmpty.js';
|
|
9
8
|
import { i18next } from '@operato/i18n';
|
|
10
|
-
import { sleep,
|
|
9
|
+
import { sleep, closestElement } from '@operato/utils';
|
|
11
10
|
import { ZERO_CONFIG, ZERO_DATA } from '../configure/zero-config.js';
|
|
12
11
|
import { RecordViewHandler } from '../record-view/record-view-handler.js';
|
|
12
|
+
import { blankFieldValue, hasFieldValue, parseNumericField, parseClipboardNumber } from '../utils/field-value.js';
|
|
13
13
|
import { columnText } from '../utils/column-text.js';
|
|
14
14
|
// import { supportsPassive } from '../utils/index.js'
|
|
15
15
|
import { dataGridBodyStyle } from './data-grid-body-style.js';
|
|
@@ -92,6 +92,8 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
92
92
|
this.config = ZERO_CONFIG;
|
|
93
93
|
this.columns = [];
|
|
94
94
|
this.data = ZERO_DATA;
|
|
95
|
+
/** The empty row shown after the records when rows can be appended - the grid's own (`DataManipulator.appendRecord`). */
|
|
96
|
+
this.appendRecord = { __dirty__: '+' };
|
|
95
97
|
this.focused = ZERO_FOCUS;
|
|
96
98
|
/**
|
|
97
99
|
* Where this body's first row sits in the whole table, counting from 1.
|
|
@@ -151,7 +153,7 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
151
153
|
* -- if (focusedRow == records.length)
|
|
152
154
|
*/
|
|
153
155
|
if (appendable) {
|
|
154
|
-
records = [...records,
|
|
156
|
+
records = [...records, this.appendRecord];
|
|
155
157
|
}
|
|
156
158
|
if (accumulator) {
|
|
157
159
|
var accumRecord = this.buildAccumulatorRecord();
|
|
@@ -832,7 +834,6 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
832
834
|
tgtRows = Math.abs(end.rowIndex - start.rowIndex) + 1;
|
|
833
835
|
tgtCols = Math.abs(end.columnIndex - start.columnIndex) + 1;
|
|
834
836
|
}
|
|
835
|
-
const { records } = this.data;
|
|
836
837
|
const columns = this.columns.filter(column => !column.hidden);
|
|
837
838
|
if (type === 'text/html') {
|
|
838
839
|
const div = document.createElement('div');
|
|
@@ -861,11 +862,9 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
861
862
|
const srcCols = Math.max(...trs.map(tr => tr.querySelectorAll('td').length));
|
|
862
863
|
const repeatR = srcRows > 0 && tgtRows % srcRows === 0 ? tgtRows / srcRows : 1;
|
|
863
864
|
const repeatC = srcCols > 0 && tgtCols % srcCols === 0 ? tgtCols / srcCols : 1;
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
records.push(targetRecord);
|
|
868
|
-
}
|
|
865
|
+
const targets = this.pasteTargets(row, srcRows * repeatR);
|
|
866
|
+
for (let rowIndex = 0; rowIndex < targets.length; rowIndex++) {
|
|
867
|
+
var targetRecord = targets[rowIndex];
|
|
869
868
|
const cells = trs[rowIndex % srcRows].querySelectorAll('td');
|
|
870
869
|
for (let columnIndex = 0; columnIndex < srcCols * repeatC; columnIndex++) {
|
|
871
870
|
const item = cells[columnIndex % srcCols];
|
|
@@ -881,17 +880,15 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
881
880
|
type = type.includes('object') ? 'object' : type; // 오브젝트 타입 예외처리
|
|
882
881
|
let { editable } = targetColumn.record;
|
|
883
882
|
if (typeof editable === 'function') {
|
|
884
|
-
editable = editable.call(this, value, targetColumn, targetRecord, row, this);
|
|
883
|
+
editable = editable.call(this, value, targetColumn, targetRecord, row + rowIndex, this);
|
|
885
884
|
}
|
|
886
|
-
if (value) {
|
|
885
|
+
if (String(value).trim()) {
|
|
887
886
|
switch (type) {
|
|
888
887
|
case 'object':
|
|
889
888
|
// 오브젝트가 전부 빈값이면 ''로 치환
|
|
890
889
|
try {
|
|
891
890
|
value = JSON.parse(value || '{}');
|
|
892
|
-
value =
|
|
893
|
-
? null
|
|
894
|
-
: value;
|
|
891
|
+
value = hasFieldValue(value) ? value : null;
|
|
895
892
|
}
|
|
896
893
|
catch (err) {
|
|
897
894
|
value = null;
|
|
@@ -913,7 +910,7 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
913
910
|
case 'float':
|
|
914
911
|
case 'integer':
|
|
915
912
|
case 'progress':
|
|
916
|
-
value =
|
|
913
|
+
value = parseClipboardNumber(String(value), type);
|
|
917
914
|
break;
|
|
918
915
|
case 'string':
|
|
919
916
|
try {
|
|
@@ -950,8 +947,7 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
950
947
|
}
|
|
951
948
|
}
|
|
952
949
|
else {
|
|
953
|
-
|
|
954
|
-
value = targetRecord.id ? null : undefined;
|
|
950
|
+
value = blankFieldValue(targetRecord);
|
|
955
951
|
}
|
|
956
952
|
if (targetColumn && !targetColumn.gutterName && editable) {
|
|
957
953
|
this.dispatchEvent(new CustomEvent('field-change', {
|
|
@@ -986,12 +982,10 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
986
982
|
const srcCols = Math.max(...tsvRows.map(r => r.length));
|
|
987
983
|
const repeatR = srcRows > 0 && tgtRows % srcRows === 0 ? tgtRows / srcRows : 1;
|
|
988
984
|
const repeatC = srcCols > 0 && tgtCols % srcCols === 0 ? tgtCols / srcCols : 1;
|
|
989
|
-
|
|
985
|
+
const targets = this.pasteTargets(row, srcRows * repeatR);
|
|
986
|
+
for (let rowOffset = 0; rowOffset < targets.length; rowOffset++) {
|
|
990
987
|
const targetRowIndex = row + rowOffset;
|
|
991
|
-
var targetRecord =
|
|
992
|
-
if (targetRowIndex >= records.length) {
|
|
993
|
-
records.push(targetRecord);
|
|
994
|
-
}
|
|
988
|
+
var targetRecord = targets[rowOffset];
|
|
995
989
|
const tsvCells = tsvRows[rowOffset % srcRows];
|
|
996
990
|
for (let colOffset = 0; colOffset < srcCols * repeatC; colOffset++) {
|
|
997
991
|
const cellValue = (_b = tsvCells[colOffset % srcCols]) !== null && _b !== void 0 ? _b : ''; /* ragged row 방어 */
|
|
@@ -1004,11 +998,17 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
1004
998
|
}
|
|
1005
999
|
if (editable) {
|
|
1006
1000
|
/* select 타입: 붙여넣은 텍스트를 옵션의 display/value와 매칭하여 value로 변환 */
|
|
1007
|
-
|
|
1008
|
-
let resolvedValue =
|
|
1009
|
-
if (targetColumn.type === 'select' &&
|
|
1001
|
+
const blank = !cellValue.trim();
|
|
1002
|
+
let resolvedValue = blank ? blankFieldValue(targetRecord) : cellValue;
|
|
1003
|
+
if (targetColumn.type === 'select' && !blank) {
|
|
1010
1004
|
resolvedValue = resolveSelectPasteValue(cellValue, targetColumn, targetRecord);
|
|
1011
1005
|
}
|
|
1006
|
+
if (!blank && ['number', 'float', 'integer', 'progress'].includes(targetColumn.type)) {
|
|
1007
|
+
resolvedValue = parseClipboardNumber(cellValue, targetColumn.type);
|
|
1008
|
+
}
|
|
1009
|
+
else if (!blank && ['boolean', 'checkbox'].includes(targetColumn.type)) {
|
|
1010
|
+
resolvedValue = /true/i.test(cellValue);
|
|
1011
|
+
}
|
|
1012
1012
|
this.dispatchEvent(new CustomEvent('field-change', {
|
|
1013
1013
|
bubbles: true,
|
|
1014
1014
|
composed: true,
|
|
@@ -1033,6 +1033,20 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
1033
1033
|
this.focus();
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* The rows a paste of `count` rows from `row` writes to, settled before any cell is applied - applying one can add
|
|
1038
|
+
* a row. Rows past the end are new rows, the append row first, and only where rows can be appended. A new row joins
|
|
1039
|
+
* the records with its first applied cell, so cells that are blank, read-only or rejected add no empty row.
|
|
1040
|
+
*/
|
|
1041
|
+
pasteTargets(row, count) {
|
|
1042
|
+
const { records } = this.data;
|
|
1043
|
+
const end = this.config.rows.appendable ? row + count : Math.min(row + count, records.length);
|
|
1044
|
+
const targets = [];
|
|
1045
|
+
for (let index = row; index < end; index++) {
|
|
1046
|
+
targets.push(records[index] || (index === records.length ? this.appendRecord : { __dirty__: '+' }));
|
|
1047
|
+
}
|
|
1048
|
+
return targets;
|
|
1049
|
+
}
|
|
1036
1050
|
setSelectBlock(start, end) {
|
|
1037
1051
|
var _a;
|
|
1038
1052
|
if ((start === null || start === void 0 ? void 0 : start.columnIndex) == -1) {
|
|
@@ -1104,7 +1118,7 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
1104
1118
|
const col = columns[column];
|
|
1105
1119
|
if (!col || col.gutterName)
|
|
1106
1120
|
return;
|
|
1107
|
-
const record = this.data.records[row] ||
|
|
1121
|
+
const record = this.data.records[row] || this.appendRecord;
|
|
1108
1122
|
let { editable } = col.record;
|
|
1109
1123
|
if (typeof editable === 'function') {
|
|
1110
1124
|
editable = editable.call(this, record[col.name], col, record, row, this);
|
|
@@ -1118,7 +1132,7 @@ let DataGridBody = class DataGridBody extends LitElement {
|
|
|
1118
1132
|
case 'float':
|
|
1119
1133
|
case 'integer':
|
|
1120
1134
|
case 'progress':
|
|
1121
|
-
value =
|
|
1135
|
+
value = parseNumericField(text, col.type);
|
|
1122
1136
|
if (value === null)
|
|
1123
1137
|
return;
|
|
1124
1138
|
break;
|
|
@@ -1275,6 +1289,9 @@ __decorate([
|
|
|
1275
1289
|
__decorate([
|
|
1276
1290
|
property({ type: Object })
|
|
1277
1291
|
], DataGridBody.prototype, "data", void 0);
|
|
1292
|
+
__decorate([
|
|
1293
|
+
property({ type: Object })
|
|
1294
|
+
], DataGridBody.prototype, "appendRecord", void 0);
|
|
1278
1295
|
__decorate([
|
|
1279
1296
|
property({ type: Object })
|
|
1280
1297
|
], DataGridBody.prototype, "focused", void 0);
|