@things-factory/biz-ui 4.3.99 → 4.3.105-alpha.0

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.
@@ -4,6 +4,7 @@ import _ from 'lodash'
4
4
 
5
5
  import gql from 'graphql-tag'
6
6
  import { css, html } from 'lit'
7
+ import isEmpty from 'lodash-es/isEmpty'
7
8
 
8
9
  import { getCodeByName } from '@things-factory/code-base'
9
10
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -91,7 +92,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
91
92
  await this._saveContactPoints(patches)
92
93
  history.back()
93
94
  } catch (e) {
94
- this.showToast(e)
95
+ this.showToast(e.message)
95
96
  }
96
97
  })
97
98
  }
@@ -138,6 +139,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
138
139
  ]
139
140
 
140
141
  this.config = {
142
+ pagination: { limit: 50, pages: [50, 100, 200, 500] },
141
143
  rows: {
142
144
  selectable: {
143
145
  multiple: true
@@ -157,7 +159,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
157
159
  width: 40,
158
160
  type: 'string'
159
161
  },
160
- header: i18next.t('field.contact_point_customer_name'),
162
+ header: `*${i18next.t('field.contact_point_customer_name')}`,
161
163
  width: 250
162
164
  },
163
165
  {
@@ -192,7 +194,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
192
194
  name: 'companyName',
193
195
  record: { editable: true },
194
196
  imex: {
195
- header: '*' + i18next.t('field.contact_point_other_company_name'),
197
+ header: i18next.t('field.contact_point_other_company_name'),
196
198
  key: 'companyName',
197
199
  width: 40,
198
200
  type: 'string'
@@ -217,7 +219,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
217
219
  type: 'string',
218
220
  name: 'email',
219
221
  record: { editable: true },
220
- imex: { header: '*' + i18next.t('field.contact_point_email'), key: 'email', width: 40, type: 'string' },
222
+ imex: { header: i18next.t('field.contact_point_email'), key: 'email', width: 40, type: 'string' },
221
223
  header: i18next.t('field.contact_point_email'),
222
224
  width: 120
223
225
  },
@@ -234,7 +236,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
234
236
  name: 'phone',
235
237
  record: { editable: true },
236
238
  imex: { header: '*' + i18next.t('field.contact_point_phone'), key: 'phone', width: 40, type: 'string' },
237
- header: i18next.t('field.contact_point_phone'),
239
+ header: '*' + i18next.t('field.contact_point_phone'),
238
240
  width: 120
239
241
  },
240
242
  {
@@ -242,7 +244,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
242
244
  name: 'accountNo',
243
245
  record: { editable: true },
244
246
  imex: {
245
- header: '*' + i18next.t('field.contact_point_account_no'),
247
+ header: i18next.t('field.contact_point_account_no'),
246
248
  key: 'accountNo',
247
249
  width: 40,
248
250
  type: 'string'
@@ -254,8 +256,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
254
256
  type: 'string',
255
257
  name: 'address',
256
258
  record: { editable: true },
257
- imex: { header: i18next.t('field.contact_point_company_address'), key: 'address', width: 40, type: 'string' },
258
- header: i18next.t('field.contact_point_company_address'),
259
+ imex: { header: '*' + i18next.t('field.contact_point_company_address'), key: 'address', width: 40, type: 'string' },
260
+ header: '*' + i18next.t('field.contact_point_company_address'),
259
261
  width: 300
260
262
  },
261
263
  {
@@ -300,7 +302,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
300
302
  name: 'billingAddress',
301
303
  record: { editable: true },
302
304
  imex: {
303
- header: '*' + i18next.t('field.contact_point_billing_address'),
305
+ header: i18next.t('field.contact_point_billing_address'),
304
306
  key: 'billingAddress',
305
307
  width: 40,
306
308
  type: 'string'
@@ -311,7 +313,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
311
313
  {
312
314
  name: 'type',
313
315
  record: { editable: true },
314
- header: i18next.t('field.contact_point_type'),
316
+ header: '*' + i18next.t('field.contact_point_type'),
315
317
  type: 'code',
316
318
  imex: {
317
319
  header: '*' + i18next.t('field.contact_point_type'),
@@ -431,6 +433,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
431
433
  return this.showToast(i18next.t('text.nothing_changed'))
432
434
  }
433
435
 
436
+ this._validate()
437
+
434
438
  const response = await client.mutate({
435
439
  mutation: gql`
436
440
  mutation updateMultipleContactPoint($patches: [ContactPointPatch!]!) {
@@ -448,7 +452,30 @@ export class ContactPointList extends localize(i18next)(PageView) {
448
452
  this.dataGrist.fetch()
449
453
  }
450
454
  } catch (error) {
451
- this.showToast(error)
455
+ this.showToast(error.message)
456
+ }
457
+ }
458
+
459
+ _validate() {
460
+ let errors = []
461
+
462
+ let data = this.dataGrist._data.records.map(itm => {
463
+ itm.error = false
464
+
465
+ if (isEmpty(itm.name) || '') {
466
+ itm.error = true
467
+ if (!errors.find(err => err.type == 'customerName')) errors.push({ type: 'customerName', value: 'customer name is required' })
468
+ }
469
+ return itm
470
+ })
471
+
472
+ if (errors.length > 0) {
473
+ this._data = {
474
+ ...this.dataGrist.dirtyData,
475
+ records: data
476
+ }
477
+
478
+ throw new Error(errors.map(itm => itm.value).join(', '))
452
479
  }
453
480
  }
454
481
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/biz-ui",
3
- "version": "4.3.99",
3
+ "version": "4.3.105-alpha.0",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,14 +24,14 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/biz-base": "^4.3.99",
28
- "@things-factory/code-base": "^4.3.99",
29
- "@things-factory/form-ui": "^4.3.99",
30
- "@things-factory/grist-ui": "^4.3.99",
31
- "@things-factory/i18n-base": "^4.3.99",
32
- "@things-factory/import-ui": "^4.3.99",
33
- "@things-factory/layout-base": "^4.3.99",
34
- "@things-factory/shell": "^4.3.99"
27
+ "@things-factory/biz-base": "^4.3.105-alpha.0",
28
+ "@things-factory/code-base": "^4.3.105-alpha.0",
29
+ "@things-factory/form-ui": "^4.3.105-alpha.0",
30
+ "@things-factory/grist-ui": "^4.3.105-alpha.0",
31
+ "@things-factory/i18n-base": "^4.3.105-alpha.0",
32
+ "@things-factory/import-ui": "^4.3.105-alpha.0",
33
+ "@things-factory/layout-base": "^4.3.105-alpha.0",
34
+ "@things-factory/shell": "^4.3.105-alpha.0"
35
35
  },
36
- "gitHead": "01f43a1b95b1573e8f2f3e134d950a0bbbe16324"
36
+ "gitHead": "3bf9a95c5f77324220346e5109880a171ee2a13d"
37
37
  }