@nocobase/plugin-snapshot-field 0.9.2-alpha.2 → 0.9.2-alpha.3

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.
@@ -42,7 +42,7 @@ const onTargetFieldChange = field => {
42
42
  if (!targetField) return;
43
43
  !targetField.getState().disabled && targetField.setValue([]);
44
44
  };
45
- function makeFieldsPathOptions(fields, appends = []) {
45
+ function MakeFieldsPathOptions(fields, appends = []) {
46
46
  const _useCollectionManager = (0, _client().useCollectionManager)(),
47
47
  getCollection = _useCollectionManager.getCollection;
48
48
  const options = [];
@@ -56,7 +56,7 @@ function makeFieldsPathOptions(fields, appends = []) {
56
56
  options.push({
57
57
  label: (_field$uiSchema$title = (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) !== null && _field$uiSchema$title !== void 0 ? _field$uiSchema$title : field.name,
58
58
  value: field.name,
59
- children: makeFieldsPathOptions(nextCollection.fields, nextAppends)
59
+ children: MakeFieldsPathOptions(nextCollection.fields, nextAppends)
60
60
  });
61
61
  }
62
62
  } else {
@@ -142,7 +142,7 @@ const snapshot = {
142
142
  getCollection = _useCollectionManager2.getCollection;
143
143
  const _getCollection = getCollection(targetCollection),
144
144
  fields = _getCollection.fields;
145
- const result = makeFieldsPathOptions(fields, appends);
145
+ const result = MakeFieldsPathOptions(fields, appends);
146
146
  return [{
147
147
  label: `{{t('Snapshot data', { ns: '${_locale.NAMESPACE}' })}}`,
148
148
  value: 'data',
@@ -12,7 +12,7 @@ var _default = {
12
12
  'Allow linking to multiple records': 'Permitir vinculação a vários registros',
13
13
  'When adding a new record, create a snapshot for its relational record and save in the current record. The snapshot is not updated when the record is subsequently updated.': 'Ao adicionar um novo registro, crie uma imagem instantânea para o registro relacionado e salve no registro atual. A imagem instantânea não é atualizada quando o registro é posteriormente atualizado.',
14
14
  'The association field to snapshot': 'O campo de associação para criar imagem instantânea',
15
- "Snapshot the snapshot's association fields": "Criar imagem instantânea para os campos de associação da imagem instantânea",
15
+ "Snapshot the snapshot's association fields": 'Criar imagem instantânea para os campos de associação da imagem instantânea',
16
16
  'Please select': 'Por favor, selecione'
17
17
  };
18
18
  exports.default = _default;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-snapshot-field",
3
- "version": "0.9.2-alpha.2",
3
+ "version": "0.9.2-alpha.3",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
7
7
  "types": "./lib/index.d.ts",
8
8
  "devDependencies": {
9
- "@nocobase/server": "0.9.2-alpha.2",
10
- "@nocobase/test": "0.9.2-alpha.2"
9
+ "@nocobase/server": "0.9.2-alpha.3",
10
+ "@nocobase/test": "0.9.2-alpha.3"
11
11
  },
12
- "gitHead": "1a0de6908b2b1854bdf434fcafa8909cb65bb8a3"
12
+ "gitHead": "b6b5f9372202d942c97d2d90a4197e060db05124"
13
13
  }
@@ -3,7 +3,7 @@ import {
3
3
  CollectionManagerProvider,
4
4
  registerField,
5
5
  SchemaComponentOptions,
6
- SchemaInitializerProvider
6
+ SchemaInitializerProvider,
7
7
  } from '@nocobase/client';
8
8
  import React, { useEffect } from 'react';
9
9
  import { AppendsTreeSelect } from './components/AppendsTreeSelect';
@@ -26,7 +26,7 @@ const onTargetFieldChange = (field: Field) => {
26
26
  !targetField.getState().disabled && targetField.setValue([]);
27
27
  };
28
28
 
29
- function makeFieldsPathOptions(fields, appends = []) {
29
+ function MakeFieldsPathOptions(fields, appends = []) {
30
30
  const { getCollection } = useCollectionManager();
31
31
  const options = [];
32
32
  fields.forEach((field) => {
@@ -41,7 +41,7 @@ function makeFieldsPathOptions(fields, appends = []) {
41
41
  options.push({
42
42
  label: field.uiSchema?.title ?? field.name,
43
43
  value: field.name,
44
- children: makeFieldsPathOptions(nextCollection.fields, nextAppends),
44
+ children: MakeFieldsPathOptions(nextCollection.fields, nextAppends),
45
45
  });
46
46
  }
47
47
  } else {
@@ -120,7 +120,7 @@ export const snapshot: IField = {
120
120
  const { getCollection } = useCollectionManager();
121
121
  const { fields } = getCollection(targetCollection);
122
122
 
123
- const result = makeFieldsPathOptions(fields, appends);
123
+ const result = MakeFieldsPathOptions(fields, appends);
124
124
 
125
125
  return [
126
126
  {
@@ -1,7 +1,6 @@
1
1
  import { i18n } from '@nocobase/client';
2
2
  import { useTranslation } from 'react-i18next';
3
3
 
4
-
5
4
  export const NAMESPACE = 'snapshot-field';
6
5
 
7
6
  // i18n.addResources('zh-CN', NAMESPACE, zhCN);
@@ -5,8 +5,9 @@ export default {
5
5
  'Add block': 'Adicionar bloco',
6
6
  'Allow linking to multiple records': 'Permitir vinculação a vários registros',
7
7
  'When adding a new record, create a snapshot for its relational record and save in the current record. The snapshot is not updated when the record is subsequently updated.':
8
- 'Ao adicionar um novo registro, crie uma imagem instantânea para o registro relacionado e salve no registro atual. A imagem instantânea não é atualizada quando o registro é posteriormente atualizado.',
8
+ 'Ao adicionar um novo registro, crie uma imagem instantânea para o registro relacionado e salve no registro atual. A imagem instantânea não é atualizada quando o registro é posteriormente atualizado.',
9
9
  'The association field to snapshot': 'O campo de associação para criar imagem instantânea',
10
- "Snapshot the snapshot's association fields": "Criar imagem instantânea para os campos de associação da imagem instantânea",
10
+ "Snapshot the snapshot's association fields":
11
+ 'Criar imagem instantânea para os campos de associação da imagem instantânea',
11
12
  'Please select': 'Por favor, selecione',
12
13
  };
@@ -31,12 +31,15 @@ export class SnapshotField extends Field {
31
31
  data = data.toJSON();
32
32
  }
33
33
 
34
- await model.update({
35
- [name]: {
36
- collectionName,
37
- data,
34
+ await model.update(
35
+ {
36
+ [name]: {
37
+ collectionName,
38
+ data,
39
+ },
38
40
  },
39
- }, { transaction });
41
+ { transaction },
42
+ );
40
43
  };
41
44
 
42
45
  bind() {