@operato/data-grist 7.1.27 → 7.1.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/data-grist",
3
- "version": "7.1.27",
3
+ "version": "7.1.30",
4
4
  "description": "User interface for grid (desktop) and list (mobile)",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/index.js",
@@ -63,9 +63,9 @@
63
63
  "dependencies": {
64
64
  "@material/web": "^2.0.0",
65
65
  "@operato/headroom": "^7.1.1",
66
- "@operato/input": "^7.1.27",
67
- "@operato/p13n": "^7.1.27",
68
- "@operato/popup": "^7.1.27",
66
+ "@operato/input": "^7.1.30",
67
+ "@operato/p13n": "^7.1.30",
68
+ "@operato/popup": "^7.1.30",
69
69
  "@operato/pull-to-refresh": "^7.1.1",
70
70
  "@operato/styles": "^7.1.27",
71
71
  "@operato/time-calculator": "^7.1.1",
@@ -108,5 +108,5 @@
108
108
  "prettier --write"
109
109
  ]
110
110
  },
111
- "gitHead": "c1c3d738aa1f8462b2483cd1ebdfdfbe95d7e22a"
111
+ "gitHead": "863eb4937334eb66a3cd0e5dbea5c77bc1afc472"
112
112
  }
@@ -17,6 +17,20 @@ export const dataGridBodyStyle = css`
17
17
  background-color: var(--grid-record-odd-background-color);
18
18
  }
19
19
 
20
+ ox-grid-field[disabled] {
21
+ background-color: var(--grid-record-disabled-background-color, #eee);
22
+ color: var(--grid-record-disabled-color, var(--grid-record-color));
23
+ opacity: var(--grid-record-disabled-opacity, 1);
24
+ }
25
+ ox-grid-field[odd][disabled] {
26
+ background-color: var(
27
+ --grid-odd-record-disabled-background-color,
28
+ var(--grid-record-disabled-background-color, #eee)
29
+ );
30
+ color: var(--grid-odd-record-disabled-color, var(--grid-record-disabled-color, var(--grid-record-color)));
31
+ opacity: var(--grid-odd-record-disabled-opacity, var(--grid-record-disabled-opacity, 1));
32
+ }
33
+
20
34
  ox-grid-field[selected-row] {
21
35
  background-color: var(--grid-record-selected-background-color);
22
36
  color: var(--grid-record-selected-color);
@@ -203,6 +203,15 @@ export class DataGridField extends LitElement {
203
203
  }
204
204
  }
205
205
 
206
+ const disabled = this.column.record.disabled || false
207
+ if (!!disabled) {
208
+ // 비황성화 여부 표시
209
+ this.setAttribute('disabled', '')
210
+ } else {
211
+ // 비황성화 여부 제거
212
+ this.removeAttribute('disabled')
213
+ }
214
+
206
215
  const emphasized =
207
216
  this.column.record.classifier.call(this, this.record, this.rowIndex)?.emphasized || this.emphasized
208
217
 
@@ -59,17 +59,19 @@ export class OxRecordCreator extends LitElement {
59
59
  const columns = this.grist!.compiledConfig.columns
60
60
  const invalidFields: { field: string; reason: ValidationReason }[] = []
61
61
 
62
- columns.forEach(column => {
63
- if (
64
- column.record?.mandatory &&
65
- (record[column.name] === undefined || record[column.name] === null || record[column.name] === '')
66
- ) {
67
- invalidFields.push({
68
- field: column.name,
69
- reason: ValidationReason.MANDATORY
70
- })
71
- }
72
- })
62
+ columns
63
+ .filter(column => !column.hidden)
64
+ .forEach(column => {
65
+ if (
66
+ column.record?.mandatory &&
67
+ (record[column.name] === undefined || record[column.name] === null || record[column.name] === '')
68
+ ) {
69
+ invalidFields.push({
70
+ field: column.name,
71
+ reason: ValidationReason.MANDATORY
72
+ })
73
+ }
74
+ })
73
75
 
74
76
  return invalidFields
75
77
  }
@@ -145,13 +147,8 @@ export class OxRecordCreator extends LitElement {
145
147
  @ok=${async (e: Event) => {
146
148
  const view = e.currentTarget as RecordView
147
149
 
148
- // 레코드 밸리데이션 체크
149
150
  const invalidFields = await this.validateRecord(view.record)
150
151
  if (invalidFields.length > 0) {
151
- // const firstInvalidField = invalidFields[0];
152
- // if (firstInvalidField) {
153
- // view.setFocus(firstInvalidField.field)
154
- // }
155
152
  view.setFocusOnInvalid(invalidFields)
156
153
  return false
157
154
  }
@@ -209,25 +206,16 @@ export class OxRecordCreator extends LitElement {
209
206
  recordView.addEventListener('ok', async (e: Event) => {
210
207
  const view = e.currentTarget as RecordView
211
208
 
212
- // 레코드 밸리데이션 체크
213
209
  const invalidFields = await this.validateRecord(view.record)
214
210
  if (invalidFields.length > 0) {
215
- const firstInvalidField = invalidFields[0]
216
- if (firstInvalidField) {
217
- const fieldElement = view.renderRoot?.querySelector(`[name="${firstInvalidField}"]`)
218
- if (fieldElement) {
219
- ;(fieldElement as HTMLElement).focus()
220
- }
221
- }
211
+ view.setFocusOnInvalid(invalidFields)
222
212
  return false
223
213
  }
224
214
 
225
215
  if (await this.callback?.(view.record)) {
226
216
  popup.close()
227
217
  } else {
228
- // 밸리데이션 실패 시 처리
229
- console.error('레코드 밸리데이션 실패')
230
- // 여기에 사용자에게 오류 메시지를 표시하는 로직을 추가할 수 있습니다.
218
+ console.error('validation failed')
231
219
  }
232
220
  })
233
221
 
package/src/types.ts CHANGED
@@ -509,6 +509,7 @@ export type RecordConfig = {
509
509
  editor?: FieldEditor
510
510
  editable?: boolean | Function
511
511
  mandatory?: boolean
512
+ disabled?: boolean
512
513
  classifier: GristClassifier
513
514
  align?: 'left' | 'right' | 'center'
514
515
  options: any
@@ -810,4 +811,3 @@ export enum ValidationReason {
810
811
  RANGE = 'RANGE',
811
812
  UNIQUE = 'UNIQUE'
812
813
  }
813
-
@@ -141,7 +141,8 @@ const config = {
141
141
  editable: true,
142
142
  defaultValue: {
143
143
  name: 'now'
144
- }
144
+ },
145
+ disabled: true
145
146
  },
146
147
  filter: 'between',
147
148
  sortable: true,