@icure/form 3.0.2 → 3.0.4
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/.yarn/cache/@icure-cardinal-sdk-npm-1.3.0-ts-2-d77151b3e6-86e1497829.zip +0 -0
- package/.yarn/cache/{@icure-motss-app-datepicker-npm-6.0.0-rc.36-66219db2d1-5f34375d97.zip → @icure-motss-app-datepicker-npm-6.0.0-rc.39-d00d21c35a-eefaed31a8.zip} +0 -0
- package/.yarn/cache/@js-joda-core-npm-3.2.0-d2526290e9-64625c2f22.zip +0 -0
- package/.yarn/cache/@types-linkify-it-npm-5.0.0-576a16b976-ec98e03aa8.zip +0 -0
- package/.yarn/cache/@types-markdown-it-npm-14.1.2-d0c4e12c49-ad66e0b377.zip +0 -0
- package/.yarn/cache/@types-mdurl-npm-2.0.0-2f4116c0b0-78746e96c6.zip +0 -0
- package/.yarn/cache/format-util-npm-1.0.5-a524ca953a-0c8622e54a.zip +0 -0
- package/.yarn/cache/prosemirror-commands-npm-1.7.0-212f35173c-a39225d534.zip +0 -0
- package/.yarn/cache/prosemirror-history-npm-1.4.1-ad68c86bb7-90f9bf59bc.zip +0 -0
- package/.yarn/cache/prosemirror-markdown-npm-1.13.1-4de28fccea-fb5487760e.zip +0 -0
- package/.yarn/cache/prosemirror-schema-basic-npm-1.2.3-a144a1b06d-49711ec1ee.zip +0 -0
- package/.yarn/cache/prosemirror-schema-list-npm-1.5.1-7b138c5fed-6c7041e5b8.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.10.3-fb23bef7a8-8cbe29501e.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.38.1-8cfb4ec84f-12f7f4d27f.zip +0 -0
- package/.yarn/cache/ws-npm-8.18.0-56f68bc4d6-91d4d35bc9.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/components/common/field-with-options.js +4 -9
- package/components/common/field-with-options.js.map +1 -1
- package/components/common/field.js +21 -25
- package/components/common/field.js.map +1 -1
- package/components/common/index.js +1 -17
- package/components/common/index.js.map +1 -1
- package/components/common/metadata-buttons-bar.js +58 -62
- package/components/common/metadata-buttons-bar.js.map +1 -1
- package/components/common/styles/paths.js +10 -13
- package/components/common/styles/paths.js.map +1 -1
- package/components/common/utils.js +10 -20
- package/components/common/utils.js.map +1 -1
- package/components/icure-button/index.js +20 -24
- package/components/icure-button/index.js.map +1 -1
- package/components/icure-button-group/index.js +27 -31
- package/components/icure-button-group/index.js.map +1 -1
- package/components/icure-date-picker/index.js +32 -36
- package/components/icure-date-picker/index.js.map +1 -1
- package/components/icure-dropdown-field/index.js +26 -30
- package/components/icure-dropdown-field/index.js.map +1 -1
- package/components/icure-form/fields/button/button.js +13 -17
- package/components/icure-form/fields/button/button.js.map +1 -1
- package/components/icure-form/fields/button/index.js +1 -17
- package/components/icure-form/fields/button/index.js.map +1 -1
- package/components/icure-form/fields/button-group/checkbox.js +10 -14
- package/components/icure-form/fields/button-group/checkbox.js.map +1 -1
- package/components/icure-form/fields/button-group/index.js +2 -18
- package/components/icure-form/fields/button-group/index.js.map +1 -1
- package/components/icure-form/fields/button-group/radio-button.js +10 -14
- package/components/icure-form/fields/button-group/radio-button.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-picker.js +8 -12
- package/components/icure-form/fields/date-picker/date-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-time-picker.js +8 -12
- package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/index.js +3 -19
- package/components/icure-form/fields/date-picker/index.js.map +1 -1
- package/components/icure-form/fields/date-picker/time-picker.js +8 -12
- package/components/icure-form/fields/date-picker/time-picker.js.map +1 -1
- package/components/icure-form/fields/dropdown/dropdown-field.js +10 -14
- package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -1
- package/components/icure-form/fields/dropdown/index.js +1 -17
- package/components/icure-form/fields/dropdown/index.js.map +1 -1
- package/components/icure-form/fields/index.js +10 -26
- package/components/icure-form/fields/index.js.map +1 -1
- package/components/icure-form/fields/items-list-field/index.js +1 -17
- package/components/icure-form/fields/items-list-field/index.js.map +1 -1
- package/components/icure-form/fields/items-list-field/items-list-field.js +7 -11
- package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -1
- package/components/icure-form/fields/label/index.js +1 -17
- package/components/icure-form/fields/label/index.js.map +1 -1
- package/components/icure-form/fields/label/label.js +11 -15
- package/components/icure-form/fields/label/label.js.map +1 -1
- package/components/icure-form/fields/measure-field/index.js +1 -17
- package/components/icure-form/fields/measure-field/index.js.map +1 -1
- package/components/icure-form/fields/measure-field/measure-field.js +8 -12
- package/components/icure-form/fields/measure-field/measure-field.js.map +1 -1
- package/components/icure-form/fields/number-field/index.js +1 -17
- package/components/icure-form/fields/number-field/index.js.map +1 -1
- package/components/icure-form/fields/number-field/number-field.js +8 -12
- package/components/icure-form/fields/number-field/number-field.js.map +1 -1
- package/components/icure-form/fields/text-field/index.js +1 -17
- package/components/icure-form/fields/text-field/index.js.map +1 -1
- package/components/icure-form/fields/text-field/text-field.js +20 -24
- package/components/icure-form/fields/text-field/text-field.js.map +1 -1
- package/components/icure-form/fields/token-field/index.js +1 -17
- package/components/icure-form/fields/token-field/index.js.map +1 -1
- package/components/icure-form/fields/token-field/token-field.js +8 -12
- package/components/icure-form/fields/token-field/token-field.js.map +1 -1
- package/components/icure-form/fields/utils/index.js +5 -13
- package/components/icure-form/fields/utils/index.js.map +1 -1
- package/components/icure-form/index.js +33 -37
- package/components/icure-form/index.js.map +1 -1
- package/components/icure-form/renderer/form/form-selection-button.js +20 -24
- package/components/icure-form/renderer/form/form-selection-button.js.map +1 -1
- package/components/icure-form/renderer/form/form.js +123 -127
- package/components/icure-form/renderer/form/form.js.map +1 -1
- package/components/icure-form/renderer/index.js +1 -2
- package/components/icure-label/index.js +18 -22
- package/components/icure-label/index.js.map +1 -1
- package/components/icure-text-field/index.js +103 -111
- package/components/icure-text-field/index.js.map +1 -1
- package/components/icure-text-field/plugin/caret-fix-plugin.js +3 -7
- package/components/icure-text-field/plugin/caret-fix-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/has-content-class-plugin.js +3 -7
- package/components/icure-text-field/plugin/has-content-class-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/mask-plugin.js +7 -11
- package/components/icure-text-field/plugin/mask-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/regexp-plugin.js +5 -9
- package/components/icure-text-field/plugin/regexp-plugin.js.map +1 -1
- package/components/icure-text-field/prosemirror-commands.js +10 -15
- package/components/icure-text-field/prosemirror-commands.js.map +1 -1
- package/components/icure-text-field/prosemirror-utils.js +1 -5
- package/components/icure-text-field/prosemirror-utils.js.map +1 -1
- package/components/icure-text-field/schema/common-marks.js +3 -7
- package/components/icure-text-field/schema/common-marks.js.map +1 -1
- package/components/icure-text-field/schema/date-time-schema.js +3 -9
- package/components/icure-text-field/schema/date-time-schema.js.map +1 -1
- package/components/icure-text-field/schema/decimal-schema.js +1 -5
- package/components/icure-text-field/schema/decimal-schema.js.map +1 -1
- package/components/icure-text-field/schema/index.js +17 -21
- package/components/icure-text-field/schema/index.js.map +1 -1
- package/components/icure-text-field/schema/items-list-schema.js +3 -7
- package/components/icure-text-field/schema/items-list-schema.js.map +1 -1
- package/components/icure-text-field/schema/markdown-schema.js +5 -9
- package/components/icure-text-field/schema/markdown-schema.js.map +1 -1
- package/components/icure-text-field/schema/measure-schema.js +6 -12
- package/components/icure-text-field/schema/measure-schema.js.map +1 -1
- package/components/icure-text-field/schema/token-schema.js +5 -9
- package/components/icure-text-field/schema/token-schema.js.map +1 -1
- package/components/icure-text-field/schema/utils.js +2 -7
- package/components/icure-text-field/schema/utils.js.map +1 -1
- package/components/icure-text-field/selection-companion.js +1 -5
- package/components/icure-text-field/selection-companion.js.map +1 -1
- package/components/icure-text-field/suggestion-palette.js +3 -10
- package/components/icure-text-field/suggestion-palette.js.map +1 -1
- package/components/index.js +5 -21
- package/components/index.js.map +1 -1
- package/components/model/index.js +22 -46
- package/components/model/index.js.map +1 -1
- package/components/themes/default/index.js +30 -32
- package/components/themes/default/index.js.map +1 -1
- package/components/themes/icure-blue/index.js +47 -49
- package/components/themes/icure-blue/index.js.map +1 -1
- package/components/themes/kendo/index.js +49 -51
- package/components/themes/kendo/index.js.map +1 -1
- package/conversion/ckmeans-grouping.js +3 -10
- package/conversion/ckmeans-grouping.js.map +1 -1
- package/conversion/ckmeans.js +1 -3
- package/conversion/ckmeans.js.map +1 -1
- package/generic/index.js +1 -17
- package/generic/index.js.map +1 -1
- package/generic/model.js +1 -2
- package/icure/form-values-container.d.ts +1 -2
- package/icure/form-values-container.js +33 -38
- package/icure/form-values-container.js.map +1 -1
- package/icure/icure-utils.js +14 -25
- package/icure/icure-utils.js.map +1 -1
- package/icure/index.js +2 -18
- package/icure/index.js.map +1 -1
- package/icure/model.js +1 -2
- package/index.js +1 -17
- package/index.js.map +1 -1
- package/package.json +14 -13
- package/utils/code-utils.js +13 -22
- package/utils/code-utils.js.map +1 -1
- package/utils/dates.js +9 -21
- package/utils/dates.js.map +1 -1
- package/utils/fields-values-provider.js +8 -17
- package/utils/fields-values-provider.js.map +1 -1
- package/utils/form-value-container.js +3 -7
- package/utils/form-value-container.js.map +1 -1
- package/utils/interpreter.d.ts +1 -2
- package/utils/interpreter.js +1 -5
- package/utils/interpreter.js.map +1 -1
- package/utils/languages.js +3 -8
- package/utils/languages.js.map +1 -1
- package/utils/markdown.js +6 -11
- package/utils/markdown.js.map +1 -1
- package/utils/no-lodash.js +3 -9
- package/utils/no-lodash.js.map +1 -1
- package/utils/primitive.js +7 -12
- package/utils/primitive.js.map +1 -1
- package/.yarn/cache/prosemirror-commands-npm-1.5.2-27f8f3fee9-ff65063a8c.zip +0 -0
- package/.yarn/cache/prosemirror-history-npm-1.3.2-cc128c8ee6-b85fe6378a.zip +0 -0
- package/.yarn/cache/prosemirror-markdown-npm-1.12.0-28e990f443-d7607ee1a6.zip +0 -0
- package/.yarn/cache/prosemirror-model-npm-1.19.4-4fd32211c8-12c277ed30.zip +0 -0
- package/.yarn/cache/prosemirror-schema-basic-npm-1.2.2-def7bf2ec7-1f93f8678c.zip +0 -0
- package/.yarn/cache/prosemirror-schema-list-npm-1.3.0-23c1830a7e-03654e37c8.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.10.2-1c2da9123e-93b0c03aff.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.8.0-ea3ca0411f-6d16ca4f95.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.32.7-63c3e4b182-40c9038a52.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.38.0-9061dc9cf4-0d0f17c1b2.zip +0 -0
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const icure_label_1 = require("../../icure-label");
|
|
9
|
-
const icure_text_field_1 = require("../../icure-text-field");
|
|
1
|
+
import { CheckBox, DatePicker, DateTimePicker, DropdownField, ItemsListField, Label, Button, MeasureField, NumberField, RadioButton, TextField, TimePicker, TokenField, } from '../../icure-form/fields';
|
|
2
|
+
import { IcureButtonGroup } from '../../icure-button-group';
|
|
3
|
+
import { IcureDatePickerField } from '../../icure-date-picker';
|
|
4
|
+
import { IcureDropdownField } from '../../icure-dropdown-field';
|
|
5
|
+
import { IcureForm } from '../../icure-form';
|
|
6
|
+
import { IcureLabel } from '../../icure-label';
|
|
7
|
+
import { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field';
|
|
10
8
|
// @ts-ignore
|
|
11
|
-
|
|
12
|
-
const kendoCss =
|
|
9
|
+
import { css } from 'lit';
|
|
10
|
+
const kendoCss = css `.icure-text-field,
|
|
13
11
|
.icure-button-group {
|
|
14
12
|
padding-top: 16px;
|
|
15
13
|
width: 100%;
|
|
@@ -181,8 +179,8 @@ app-date-picker {
|
|
|
181
179
|
line-height: 1.4em;
|
|
182
180
|
cursor: text;
|
|
183
181
|
font-size: 14px;
|
|
184
|
-
top:
|
|
185
|
-
left:
|
|
182
|
+
top: add-three(1.4em, 1px, 0);
|
|
183
|
+
left: add-two(8px, 1px);
|
|
186
184
|
color: #656565;
|
|
187
185
|
align-items: center;
|
|
188
186
|
height: 28px;
|
|
@@ -208,8 +206,8 @@ app-date-picker {
|
|
|
208
206
|
line-height: 1.4em;
|
|
209
207
|
cursor: text;
|
|
210
208
|
font-size: 14px;
|
|
211
|
-
top:
|
|
212
|
-
left:
|
|
209
|
+
top: add-three(1.4em, 1px, 0);
|
|
210
|
+
left: add-two(8px, 1px);
|
|
213
211
|
transition: transform 0.2s ease-out, color 0.2s ease-out;
|
|
214
212
|
color: #656565;
|
|
215
213
|
display: flex;
|
|
@@ -229,65 +227,65 @@ app-date-picker {
|
|
|
229
227
|
flex: 1 1 auto;
|
|
230
228
|
width: auto;
|
|
231
229
|
}`;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
class KendoIcureButtonGroup extends
|
|
230
|
+
import { MetadataButtonBar } from '../../common/metadata-buttons-bar';
|
|
231
|
+
import { IcureButton } from '../../icure-button';
|
|
232
|
+
import { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button';
|
|
233
|
+
class KendoIcureButtonGroup extends IcureButtonGroup {
|
|
236
234
|
static get styles() {
|
|
237
|
-
return [...
|
|
235
|
+
return [...IcureButtonGroup.styles, kendoCss];
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
|
-
class KendoIcureDatePickerField extends
|
|
238
|
+
class KendoIcureDatePickerField extends IcureDatePickerField {
|
|
241
239
|
static get styles() {
|
|
242
|
-
return [...
|
|
240
|
+
return [...IcureDatePickerField.styles, kendoCss];
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
|
-
class KendoIcureDropdownField extends
|
|
243
|
+
class KendoIcureDropdownField extends IcureDropdownField {
|
|
246
244
|
static get styles() {
|
|
247
|
-
return [...
|
|
245
|
+
return [...IcureDropdownField.styles, kendoCss];
|
|
248
246
|
}
|
|
249
247
|
}
|
|
250
|
-
class KendoIcureForm extends
|
|
248
|
+
class KendoIcureForm extends IcureForm {
|
|
251
249
|
static get styles() {
|
|
252
|
-
return [...
|
|
250
|
+
return [...IcureForm.styles, kendoCss];
|
|
253
251
|
}
|
|
254
252
|
}
|
|
255
|
-
class KendoIcureLabel extends
|
|
253
|
+
class KendoIcureLabel extends IcureLabel {
|
|
256
254
|
static get styles() {
|
|
257
|
-
return [...
|
|
255
|
+
return [...IcureLabel.styles, kendoCss];
|
|
258
256
|
}
|
|
259
257
|
}
|
|
260
|
-
class KendoIcureButton extends
|
|
258
|
+
class KendoIcureButton extends IcureButton {
|
|
261
259
|
static get styles() {
|
|
262
|
-
return [...
|
|
260
|
+
return [...IcureButton.styles, kendoCss];
|
|
263
261
|
}
|
|
264
262
|
}
|
|
265
|
-
class KendoIcureTextField extends
|
|
263
|
+
class KendoIcureTextField extends IcureTextField {
|
|
266
264
|
static get styles() {
|
|
267
|
-
return [...
|
|
265
|
+
return [...IcureTextField.styles, kendoCss];
|
|
268
266
|
}
|
|
269
267
|
}
|
|
270
|
-
class KendoLabel extends
|
|
268
|
+
class KendoLabel extends Label {
|
|
271
269
|
static get styles() {
|
|
272
|
-
return [...
|
|
270
|
+
return [...Label.styles, kendoCss];
|
|
273
271
|
}
|
|
274
272
|
}
|
|
275
|
-
class KendoMetadataButtonBar extends
|
|
273
|
+
class KendoMetadataButtonBar extends MetadataButtonBar {
|
|
276
274
|
static get styles() {
|
|
277
|
-
return [...
|
|
275
|
+
return [...MetadataButtonBar.styles, kendoCss];
|
|
278
276
|
}
|
|
279
277
|
}
|
|
280
|
-
class KendoButton extends
|
|
278
|
+
class KendoButton extends Button {
|
|
281
279
|
static get styles() {
|
|
282
|
-
return [...
|
|
280
|
+
return [...Button.styles, kendoCss];
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
283
|
customElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar);
|
|
286
|
-
customElements.define('icure-metadata-buttons-bar-wrapper',
|
|
287
|
-
customElements.define('icure-form-checkbox',
|
|
288
|
-
customElements.define('icure-form-date-picker',
|
|
289
|
-
customElements.define('icure-form-date-time-picker',
|
|
290
|
-
customElements.define('icure-form-dropdown-field',
|
|
284
|
+
customElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper);
|
|
285
|
+
customElements.define('icure-form-checkbox', CheckBox);
|
|
286
|
+
customElements.define('icure-form-date-picker', DatePicker);
|
|
287
|
+
customElements.define('icure-form-date-time-picker', DateTimePicker);
|
|
288
|
+
customElements.define('icure-form-dropdown-field', DropdownField);
|
|
291
289
|
customElements.define('icure-button-group', KendoIcureButtonGroup);
|
|
292
290
|
customElements.define('icure-date-picker-field', KendoIcureDatePickerField);
|
|
293
291
|
customElements.define('icure-dropdown-field', KendoIcureDropdownField);
|
|
@@ -295,14 +293,14 @@ customElements.define('icure-form', KendoIcureForm);
|
|
|
295
293
|
customElements.define('icure-label', KendoIcureLabel);
|
|
296
294
|
customElements.define('icure-button', KendoIcureButton);
|
|
297
295
|
customElements.define('icure-text-field', KendoIcureTextField);
|
|
298
|
-
customElements.define('icure-form-items-list-field',
|
|
296
|
+
customElements.define('icure-form-items-list-field', ItemsListField);
|
|
299
297
|
customElements.define('icure-form-label', KendoLabel);
|
|
300
298
|
customElements.define('icure-form-button', KendoButton);
|
|
301
|
-
customElements.define('icure-form-measure-field',
|
|
302
|
-
customElements.define('icure-form-number-field',
|
|
303
|
-
customElements.define('icure-form-radio-button',
|
|
304
|
-
customElements.define('icure-form-text-field',
|
|
305
|
-
customElements.define('icure-form-time-picker',
|
|
306
|
-
customElements.define('icure-form-token-field',
|
|
307
|
-
customElements.define('form-selection-button',
|
|
299
|
+
customElements.define('icure-form-measure-field', MeasureField);
|
|
300
|
+
customElements.define('icure-form-number-field', NumberField);
|
|
301
|
+
customElements.define('icure-form-radio-button', RadioButton);
|
|
302
|
+
customElements.define('icure-form-text-field', TextField);
|
|
303
|
+
customElements.define('icure-form-time-picker', TimePicker);
|
|
304
|
+
customElements.define('icure-form-token-field', TokenField);
|
|
305
|
+
customElements.define('form-selection-button', FormSelectionButton);
|
|
308
306
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tmp/components/themes/kendo/index.ts"],"names":[],"mappings":";;AAAA,oDAcgC;AAChC,iEAA2D;AAC3D,+DAA8D;AAC9D,qEAA+D;AAC/D,iDAA4C;AAC5C,mDAA8C;AAC9C,6DAAiF;AAEjF,aAAa;AACb,6BAA0B;AAC1B,MAAM,QAAQ,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2NlB,CAAA;AACF,4EAAqE;AACrE,qDAAgD;AAChD,gGAA0F;AAE1F,MAAM,qBAAsB,SAAQ,qCAAgB;IACnD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,qCAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC9C,CAAC;CACD;AACD,MAAM,yBAA0B,SAAQ,wCAAoB;IAC3D,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,wCAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAClD,CAAC;CACD;AACD,MAAM,uBAAwB,SAAQ,yCAAkB;IACvD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,yCAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACD;AACD,MAAM,cAAe,SAAQ,sBAAS;IACrC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tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tItemsListField,\n\tLabel,\n\tButton,\n\tMeasureField,\n\tNumberField,\n\tRadioButton,\n\tTextField,\n\tTimePicker,\n\tTokenField,\n} from '../../icure-form/fields'\nimport { IcureButtonGroup } from '../../icure-button-group'\nimport { IcureDatePickerField } from '../../icure-date-picker'\nimport { IcureDropdownField } from '../../icure-dropdown-field'\nimport { IcureForm } from '../../icure-form'\nimport { IcureLabel } from '../../icure-label'\nimport { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field'\n\n// @ts-ignore\nimport { css } from 'lit';\nconst kendoCss = css`.icure-text-field,\n.icure-button-group {\n padding-top: 16px;\n width: 100%;\n}\n.icure-text-field .icure-label,\n.icure-button-group .icure-label {\n color: #656565;\n font-size: 14px;\n font-weight: 500;\n display: inline !important;\n white-space: initial !important;\n overflow: initial !important;\n word-wrap: normal !important;\n word-break: break-word;\n}\n.icure-text-field > .icure-input,\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}\n.icure-text-field > .icure-label,\n.icure-button-group > .icure-label {\n transform: translate(0, 0) scale(1);\n}\n.icure-text-field .icure-input,\n.icure-text-field .input-container,\n.icure-button-group .icure-input,\n.icure-button-group .input-container {\n border-radius: 2px;\n padding: 0 8px;\n width: 100%;\n box-sizing: border-box;\n border-width: 1px;\n border-style: solid;\n outline: 0;\n font: inherit;\n font-size: 14px;\n line-height: 1.4em;\n display: flex;\n align-items: center;\n vertical-align: middle;\n position: relative;\n -webkit-appearance: none;\n background-color: #ffffff;\n border-color: rgba(0, 0, 0, 0.08);\n color: #656565;\n box-sizing: border-box;\n}\n.icure-text-field .icure-input:focus, .icure-text-field .icure-input:focus-within,\n.icure-text-field .input-container:focus,\n.icure-text-field .input-container:focus-within,\n.icure-button-group .icure-input:focus,\n.icure-button-group .icure-input:focus-within,\n.icure-button-group .input-container:focus,\n.icure-button-group .input-container:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input:hover,\n.icure-text-field .input-container:hover,\n.icure-button-group .icure-input:hover,\n.icure-button-group .input-container:hover {\n border-color: rgba(0, 0, 0, 0.15);\n box-shadow: none;\n}\n.icure-text-field .icure-input:hover:focus, .icure-text-field .icure-input:hover:focus-within,\n.icure-text-field .input-container:hover:focus,\n.icure-text-field .input-container:hover:focus-within,\n.icure-button-group .icure-input:hover:focus,\n.icure-button-group .icure-input:hover:focus-within,\n.icure-button-group .input-container:hover:focus,\n.icure-button-group .input-container:hover:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input .ProseMirror,\n.icure-text-field .input-container .ProseMirror,\n.icure-button-group .icure-input .ProseMirror,\n.icure-button-group .input-container .ProseMirror {\n padding: 0;\n font-size: 14px;\n line-height: 1.4em;\n color: #656565;\n}\n.icure-text-field .icure-input .ProseMirror .date,\n.icure-text-field .input-container .ProseMirror .date,\n.icure-button-group .icure-input .ProseMirror .date,\n.icure-button-group .input-container .ProseMirror .date {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror .time,\n.icure-text-field .input-container .ProseMirror .time,\n.icure-button-group .icure-input .ProseMirror .time,\n.icure-button-group .input-container .ProseMirror .time {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror:focus .focused,\n.icure-text-field .input-container .ProseMirror:focus .focused,\n.icure-button-group .icure-input .ProseMirror:focus .focused,\n.icure-button-group .input-container .ProseMirror:focus .focused {\n background-color: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n border-color: rgba(0, 0, 0, 0.1);\n}\n.icure-text-field .icure-input > svg,\n.icure-text-field .input-container > svg,\n.icure-button-group .icure-input > svg,\n.icure-button-group .input-container > svg {\n opacity: 0.5;\n}\n.icure-text-field .icure-input > svg path,\n.icure-text-field .input-container > svg path,\n.icure-button-group .icure-input > svg path,\n.icure-button-group .input-container > svg path {\n fill: #656565;\n}\n.icure-text-field .icure-input .extra,\n.icure-text-field .input-container .extra,\n.icure-button-group .icure-input .extra,\n.icure-button-group .input-container .extra {\n height: 20px;\n}\n.icure-text-field .icure-input .extra > .info,\n.icure-text-field .input-container .extra > .info,\n.icure-button-group .icure-input .extra > .info,\n.icure-button-group .input-container .extra > .info {\n color: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path,\n.icure-text-field .input-container .extra .buttons-container .btn svg path,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path,\n.icure-button-group .input-container .extra .buttons-container .btn svg path {\n fill: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-text-field .input-container .extra .buttons-container .btn svg path:hover,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-button-group .input-container .extra .buttons-container .btn svg path:hover {\n fill: #656565;\n opacity: 1;\n}\n.icure-text-field .icure-input .extra > .options > .selected,\n.icure-text-field .input-container .extra > .options > .selected,\n.icure-button-group .icure-input .extra > .options > .selected,\n.icure-button-group .input-container .extra > .options > .selected {\n color: white;\n background-color: #06a070;\n border-radius: 0 !important;\n}\n\ninput[type=radio] {\n margin-top: -1px;\n vertical-align: middle;\n}\n\n.icure-checkbox:checked {\n accent-color: #06a070;\n}\n\napp-date-picker {\n --app-primary: #06a070;\n --app-hover: #06a070;\n --app-selected-hover: #06a070;\n}\n\n.icure-button-group > .icure-label {\n z-index: 1;\n pointer-events: none;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n color: #656565;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > .icure-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > div {\n display: grid;\n}\n.icure-button-group > div > div {\n display: flex;\n align-items: center;\n}\n.icure-button-group > div > div > .icure-button-group-label {\n z-index: 1;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n transition: transform 0.2s ease-out, color 0.2s ease-out;\n color: #656565;\n display: flex;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > div > div > .icure-button-group-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}` \nimport { MetadataButtonBar } from '../../common/metadata-buttons-bar'\nimport { IcureButton } from '../../icure-button'\nimport { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button'\n\nclass KendoIcureButtonGroup extends IcureButtonGroup {\n\tstatic get styles() {\n\t\treturn [...IcureButtonGroup.styles, kendoCss]\n\t}\n}\nclass KendoIcureDatePickerField extends IcureDatePickerField {\n\tstatic get styles() {\n\t\treturn [...IcureDatePickerField.styles, kendoCss]\n\t}\n}\nclass KendoIcureDropdownField extends IcureDropdownField {\n\tstatic get styles() {\n\t\treturn [...IcureDropdownField.styles, kendoCss]\n\t}\n}\nclass KendoIcureForm extends IcureForm {\n\tstatic get styles() {\n\t\treturn [...IcureForm.styles, kendoCss]\n\t}\n}\nclass KendoIcureLabel extends IcureLabel {\n\tstatic get styles() {\n\t\treturn [...IcureLabel.styles, kendoCss]\n\t}\n}\nclass KendoIcureButton extends IcureButton {\n\tstatic get styles() {\n\t\treturn [...IcureButton.styles, kendoCss]\n\t}\n}\nclass KendoIcureTextField extends IcureTextField {\n\tstatic get styles() {\n\t\treturn [...IcureTextField.styles, kendoCss]\n\t}\n}\nclass KendoLabel extends Label {\n\tstatic get styles() {\n\t\treturn [...Label.styles, kendoCss]\n\t}\n}\nclass KendoMetadataButtonBar extends MetadataButtonBar {\n\tstatic get styles() {\n\t\treturn [...MetadataButtonBar.styles, kendoCss]\n\t}\n}\nclass KendoButton extends Button {\n\tstatic get styles() {\n\t\treturn [...Button.styles, kendoCss]\n\t}\n}\n\ncustomElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar)\ncustomElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper)\n\ncustomElements.define('icure-form-checkbox', CheckBox)\ncustomElements.define('icure-form-date-picker', DatePicker)\ncustomElements.define('icure-form-date-time-picker', DateTimePicker)\ncustomElements.define('icure-form-dropdown-field', DropdownField)\ncustomElements.define('icure-button-group', KendoIcureButtonGroup)\ncustomElements.define('icure-date-picker-field', KendoIcureDatePickerField)\ncustomElements.define('icure-dropdown-field', KendoIcureDropdownField)\ncustomElements.define('icure-form', KendoIcureForm)\ncustomElements.define('icure-label', KendoIcureLabel)\ncustomElements.define('icure-button', KendoIcureButton)\ncustomElements.define('icure-text-field', KendoIcureTextField)\ncustomElements.define('icure-form-items-list-field', ItemsListField)\ncustomElements.define('icure-form-label', KendoLabel)\ncustomElements.define('icure-form-button', KendoButton)\ncustomElements.define('icure-form-measure-field', MeasureField)\ncustomElements.define('icure-form-number-field', NumberField)\ncustomElements.define('icure-form-radio-button', RadioButton)\ncustomElements.define('icure-form-text-field', TextField)\ncustomElements.define('icure-form-time-picker', TimePicker)\ncustomElements.define('icure-form-token-field', TokenField)\ncustomElements.define('form-selection-button', FormSelectionButton)\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tmp/components/themes/kendo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,KAAK,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,GACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAk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,\n\tTokenField,\n} from '../../icure-form/fields'\nimport { IcureButtonGroup } from '../../icure-button-group'\nimport { IcureDatePickerField } from '../../icure-date-picker'\nimport { IcureDropdownField } from '../../icure-dropdown-field'\nimport { IcureForm } from '../../icure-form'\nimport { IcureLabel } from '../../icure-label'\nimport { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field'\n\n// @ts-ignore\nimport { css } from 'lit';\nconst kendoCss = css`.icure-text-field,\n.icure-button-group {\n padding-top: 16px;\n width: 100%;\n}\n.icure-text-field .icure-label,\n.icure-button-group .icure-label {\n color: #656565;\n font-size: 14px;\n font-weight: 500;\n display: inline !important;\n white-space: initial !important;\n overflow: initial !important;\n word-wrap: normal !important;\n word-break: break-word;\n}\n.icure-text-field > .icure-input,\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}\n.icure-text-field > .icure-label,\n.icure-button-group > .icure-label {\n transform: translate(0, 0) scale(1);\n}\n.icure-text-field .icure-input,\n.icure-text-field .input-container,\n.icure-button-group .icure-input,\n.icure-button-group .input-container {\n border-radius: 2px;\n padding: 0 8px;\n width: 100%;\n box-sizing: border-box;\n border-width: 1px;\n border-style: solid;\n outline: 0;\n font: inherit;\n font-size: 14px;\n line-height: 1.4em;\n display: flex;\n align-items: center;\n vertical-align: middle;\n position: relative;\n -webkit-appearance: none;\n background-color: #ffffff;\n border-color: rgba(0, 0, 0, 0.08);\n color: #656565;\n box-sizing: border-box;\n}\n.icure-text-field .icure-input:focus, .icure-text-field .icure-input:focus-within,\n.icure-text-field .input-container:focus,\n.icure-text-field .input-container:focus-within,\n.icure-button-group .icure-input:focus,\n.icure-button-group .icure-input:focus-within,\n.icure-button-group .input-container:focus,\n.icure-button-group .input-container:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input:hover,\n.icure-text-field .input-container:hover,\n.icure-button-group .icure-input:hover,\n.icure-button-group .input-container:hover {\n border-color: rgba(0, 0, 0, 0.15);\n box-shadow: none;\n}\n.icure-text-field .icure-input:hover:focus, .icure-text-field .icure-input:hover:focus-within,\n.icure-text-field .input-container:hover:focus,\n.icure-text-field .input-container:hover:focus-within,\n.icure-button-group .icure-input:hover:focus,\n.icure-button-group .icure-input:hover:focus-within,\n.icure-button-group .input-container:hover:focus,\n.icure-button-group .input-container:hover:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input .ProseMirror,\n.icure-text-field .input-container .ProseMirror,\n.icure-button-group .icure-input .ProseMirror,\n.icure-button-group .input-container .ProseMirror {\n padding: 0;\n font-size: 14px;\n line-height: 1.4em;\n color: #656565;\n}\n.icure-text-field .icure-input .ProseMirror .date,\n.icure-text-field .input-container .ProseMirror .date,\n.icure-button-group .icure-input .ProseMirror .date,\n.icure-button-group .input-container .ProseMirror .date {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror .time,\n.icure-text-field .input-container .ProseMirror .time,\n.icure-button-group .icure-input .ProseMirror .time,\n.icure-button-group .input-container .ProseMirror .time {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror:focus .focused,\n.icure-text-field .input-container .ProseMirror:focus .focused,\n.icure-button-group .icure-input .ProseMirror:focus .focused,\n.icure-button-group .input-container .ProseMirror:focus .focused {\n background-color: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n border-color: rgba(0, 0, 0, 0.1);\n}\n.icure-text-field .icure-input > svg,\n.icure-text-field .input-container > svg,\n.icure-button-group .icure-input > svg,\n.icure-button-group .input-container > svg {\n opacity: 0.5;\n}\n.icure-text-field .icure-input > svg path,\n.icure-text-field .input-container > svg path,\n.icure-button-group .icure-input > svg path,\n.icure-button-group .input-container > svg path {\n fill: #656565;\n}\n.icure-text-field .icure-input .extra,\n.icure-text-field .input-container .extra,\n.icure-button-group .icure-input .extra,\n.icure-button-group .input-container .extra {\n height: 20px;\n}\n.icure-text-field .icure-input .extra > .info,\n.icure-text-field .input-container .extra > .info,\n.icure-button-group .icure-input .extra > .info,\n.icure-button-group .input-container .extra > .info {\n color: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path,\n.icure-text-field .input-container .extra .buttons-container .btn svg path,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path,\n.icure-button-group .input-container .extra .buttons-container .btn svg path {\n fill: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-text-field .input-container .extra .buttons-container .btn svg path:hover,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-button-group .input-container .extra .buttons-container .btn svg path:hover {\n fill: #656565;\n opacity: 1;\n}\n.icure-text-field .icure-input .extra > .options > .selected,\n.icure-text-field .input-container .extra > .options > .selected,\n.icure-button-group .icure-input .extra > .options > .selected,\n.icure-button-group .input-container .extra > .options > .selected {\n color: white;\n background-color: #06a070;\n border-radius: 0 !important;\n}\n\ninput[type=radio] {\n margin-top: -1px;\n vertical-align: middle;\n}\n\n.icure-checkbox:checked {\n accent-color: #06a070;\n}\n\napp-date-picker {\n --app-primary: #06a070;\n --app-hover: #06a070;\n --app-selected-hover: #06a070;\n}\n\n.icure-button-group > .icure-label {\n z-index: 1;\n pointer-events: none;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: add-three(1.4em, 1px, 0);\n left: add-two(8px, 1px);\n color: #656565;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > .icure-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > div {\n display: grid;\n}\n.icure-button-group > div > div {\n display: flex;\n align-items: center;\n}\n.icure-button-group > div > div > .icure-button-group-label {\n z-index: 1;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: add-three(1.4em, 1px, 0);\n left: add-two(8px, 1px);\n transition: transform 0.2s ease-out, color 0.2s ease-out;\n color: #656565;\n display: flex;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > div > div > .icure-button-group-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}` \nimport { MetadataButtonBar } from '../../common/metadata-buttons-bar'\nimport { IcureButton } from '../../icure-button'\nimport { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button'\n\nclass KendoIcureButtonGroup extends IcureButtonGroup {\n\tstatic get styles() {\n\t\treturn [...IcureButtonGroup.styles, kendoCss]\n\t}\n}\nclass KendoIcureDatePickerField extends IcureDatePickerField {\n\tstatic get styles() {\n\t\treturn [...IcureDatePickerField.styles, kendoCss]\n\t}\n}\nclass KendoIcureDropdownField extends IcureDropdownField {\n\tstatic get styles() {\n\t\treturn [...IcureDropdownField.styles, kendoCss]\n\t}\n}\nclass KendoIcureForm extends IcureForm {\n\tstatic get styles() {\n\t\treturn [...IcureForm.styles, kendoCss]\n\t}\n}\nclass KendoIcureLabel extends IcureLabel {\n\tstatic get styles() {\n\t\treturn [...IcureLabel.styles, kendoCss]\n\t}\n}\nclass KendoIcureButton extends IcureButton {\n\tstatic get styles() {\n\t\treturn [...IcureButton.styles, kendoCss]\n\t}\n}\nclass KendoIcureTextField extends IcureTextField {\n\tstatic get styles() {\n\t\treturn [...IcureTextField.styles, kendoCss]\n\t}\n}\nclass KendoLabel extends Label {\n\tstatic get styles() {\n\t\treturn [...Label.styles, kendoCss]\n\t}\n}\nclass KendoMetadataButtonBar extends MetadataButtonBar {\n\tstatic get styles() {\n\t\treturn [...MetadataButtonBar.styles, kendoCss]\n\t}\n}\nclass KendoButton extends Button {\n\tstatic get styles() {\n\t\treturn [...Button.styles, kendoCss]\n\t}\n}\n\ncustomElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar)\ncustomElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper)\n\ncustomElements.define('icure-form-checkbox', CheckBox)\ncustomElements.define('icure-form-date-picker', DatePicker)\ncustomElements.define('icure-form-date-time-picker', DateTimePicker)\ncustomElements.define('icure-form-dropdown-field', DropdownField)\ncustomElements.define('icure-button-group', KendoIcureButtonGroup)\ncustomElements.define('icure-date-picker-field', KendoIcureDatePickerField)\ncustomElements.define('icure-dropdown-field', KendoIcureDropdownField)\ncustomElements.define('icure-form', KendoIcureForm)\ncustomElements.define('icure-label', KendoIcureLabel)\ncustomElements.define('icure-button', KendoIcureButton)\ncustomElements.define('icure-text-field', KendoIcureTextField)\ncustomElements.define('icure-form-items-list-field', ItemsListField)\ncustomElements.define('icure-form-label', KendoLabel)\ncustomElements.define('icure-form-button', KendoButton)\ncustomElements.define('icure-form-measure-field', MeasureField)\ncustomElements.define('icure-form-number-field', NumberField)\ncustomElements.define('icure-form-radio-button', RadioButton)\ncustomElements.define('icure-form-text-field', TextField)\ncustomElements.define('icure-form-time-picker', TimePicker)\ncustomElements.define('icure-form-token-field', TokenField)\ncustomElements.define('form-selection-button', FormSelectionButton)\n"]}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cluster = void 0;
|
|
7
|
-
const ckmeans_1 = __importDefault(require("./ckmeans"));
|
|
8
|
-
const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots) => {
|
|
1
|
+
import ckmeans from './ckmeans';
|
|
2
|
+
export const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots) => {
|
|
9
3
|
if (!data.length) {
|
|
10
4
|
return { centroids: [], clusters: [] };
|
|
11
5
|
}
|
|
@@ -17,7 +11,7 @@ const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots)
|
|
|
17
11
|
while (isNotStable) {
|
|
18
12
|
history.push(k);
|
|
19
13
|
isNotStable = false;
|
|
20
|
-
clusters = (
|
|
14
|
+
clusters = ckmeans(data, k);
|
|
21
15
|
if (clusters.find((c) => !c.length)) {
|
|
22
16
|
isNotStable = true;
|
|
23
17
|
k--;
|
|
@@ -49,5 +43,4 @@ const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots)
|
|
|
49
43
|
}
|
|
50
44
|
return { centroids: centroids, clusters: clusters };
|
|
51
45
|
};
|
|
52
|
-
exports.cluster = cluster;
|
|
53
46
|
//# sourceMappingURL=ckmeans-grouping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAE/B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAc,EAAE,oBAA4B,EAAE,0BAAkC,EAAE,KAAc,EAAE,EAAE;IAC3H,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IACvC,CAAC;IAED,IAAI,CAAC,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,iFAAiF;IAE3I,MAAM,OAAO,GAAG,EAAE,CAAA;IAClB,IAAI,WAAW,GAAG,IAAI,CAAA;IACtB,IAAI,SAAS,GAAa,EAAE,CAAA;IAC5B,IAAI,QAAQ,GAAe,EAAE,CAAA;IAC7B,OAAO,WAAW,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;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AAC;YAC1C,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC5F,IAAI,WAAW,GAAG,oBAAoB,EAAE,CAAC;gBACxC,WAAW,GAAG,IAAI,CAAA;gBAClB,CAAC,EAAE,CAAA;gBACH,MAAK;YACN,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACpD,CAAC,CAAA","sourcesContent":["import ckmeans from './ckmeans'\n\nexport const cluster = (data: number[], maxDistanceInCluster: number, minDistanceBetweenClusters: number, slots?: number) => {\n\tif (!data.length) {\n\t\treturn { centroids: [], clusters: [] }\n\t}\n\n\tlet k = slots ?? Math.max(Math.round(data.length / 5), 1) //Initialise k to a number of clusters equals to 1/5 of the number of data points\n\n\tconst history = []\n\tlet isNotStable = true\n\tlet centroids: number[] = []\n\tlet clusters: number[][] = []\n\twhile (isNotStable) {\n\t\thistory.push(k)\n\t\tisNotStable = false\n\t\tclusters = ckmeans(data, k)\n\t\tif (clusters.find((c) => !c.length)) {\n\t\t\tisNotStable = true\n\t\t\tk--\n\t\t\tcontinue\n\t\t}\n\t\tcentroids = clusters.map((a) => a.reduce((v, s) => s + v, 0) / a.length)\n\t\tconst positions = centroids.sort((a, b) => a - b)\n\n\t\tfor (let i = 0; i < positions.length - 1; i++) {\n\t\t\tconst dist = Math.abs(positions[i] - positions[i + 1])\n\t\t\tif (dist < minDistanceBetweenClusters) {\n\t\t\t\tif (!history.includes(k - 1)) {\n\t\t\t\t\tisNotStable = true\n\t\t\t\t\tk--\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (isNotStable) {\n\t\t\tcontinue\n\t\t}\n\t\tfor (let i = 0; i < clusters.length; i++) {\n\t\t\tconst maxDistance = clusters[i].reduce((s, v) => Math.max(s, Math.abs(v - centroids[i])), 0)\n\t\t\tif (maxDistance > maxDistanceInCluster) {\n\t\t\t\tisNotStable = true\n\t\t\t\tk++\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn { centroids: centroids, clusters: clusters }\n}\n"]}
|
package/conversion/ckmeans.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* For a sorted input, counting the number of unique values
|
|
5
3
|
* is possible in constant time and constant memory. This is
|
|
@@ -283,5 +281,5 @@ const ckmeans = (x, nClusters) => {
|
|
|
283
281
|
}
|
|
284
282
|
return clusters;
|
|
285
283
|
};
|
|
286
|
-
|
|
284
|
+
export default ckmeans;
|
|
287
285
|
//# sourceMappingURL=ckmeans.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckmeans.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;GAaG;AACH,SAAS,iBAAiB,CAAC,CAAQ;IAClC,IAAI,gBAAgB,GAAG,CAAC,EACvB,aAAa,GAAG,SAAS,CAAA;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC;YACvC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YACpB,gBAAgB,EAAE,CAAA;QACnB,CAAC;IACF,CAAC;IACD,OAAO,gBAAgB,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AAC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AAC,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,CAAC,CAAA;IAChB,CAAC;IAED,uBAAuB;IACvB,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IACnD,uBAAuB;IACvB,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IAE5D,uEAAuE;IACvE,mEAAmE;IACnE,+DAA+D;IAC/D,sCAAsC;IACtC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAA;IAE7C,wEAAwE;IACxE,0EAA0E;IAC1E,qEAAqE;IACrE,gBAAgB;IAChB,MAAM,QAAQ,GAAG,EAAE,CAAA;IACnB,IAAI,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IAEhD,mEAAmE;IACnE,6EAA6E;IAC7E,8CAA8C;IAC9C,KAAK,IAAI,OAAO,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;QACxE,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;QAE1D,kEAAkE;QAClE,8DAA8D;QAC9D,kDAAkD;QAClD,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,CAAC,CAAC,CAAA;QAE/D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YACjB,YAAY,GAAG,WAAW,GAAG,CAAC,CAAA;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA;AAED,kBAAe,OAAO,CAAA","sourcesContent":["/**\n * For a sorted input, counting the number of unique values\n * is possible in constant time and constant memory. This is\n * a simple implementation of the algorithm.\n *\n * Values are compared with `===`, so objects and non-primitive objects\n * are not handled in any special way.\n *\n * @param {Array<*>} x an array of any kind of value\n * @returns {number} count of unique values\n * @example\n * uniqueCountSorted([1, 2, 3]); // => 3\n * uniqueCountSorted([1, 1, 1]); // => 1\n */\nfunction uniqueCountSorted(x: any[]) {\n\tlet uniqueValueCount = 0,\n\t\tlastSeenValue = undefined\n\tfor (let i = 0; i < x.length; i++) {\n\t\tif (i === 0 || x[i] !== lastSeenValue) {\n\t\t\tlastSeenValue = x[i]\n\t\t\tuniqueValueCount++\n\t\t}\n\t}\n\treturn uniqueValueCount\n}\n\n/**\n * Sort an array of numbers by their numeric value, ensuring that the\n * array is not changed in place.\n *\n * This is necessary because the default behavior of .sort\n * in JavaScript is to sort arrays as string values\n *\n * [1, 10, 12, 102, 20].sort()\n * // output\n * [1, 10, 102, 12, 20]\n *\n * @param {Array<number>} x input array\n * @return {Array<number>} sorted array\n * @private\n * @example\n * numericSort([3, 2, 1]) // => [1, 2, 3]\n */\nfunction numericSort(x: number[]): number[] {\n\treturn (\n\t\tx\n\t\t\t// ensure the array is not changed in-place\n\t\t\t.slice()\n\t\t\t// comparator function that treats input as numeric\n\t\t\t.sort(function (a, b) {\n\t\t\t\treturn a - b\n\t\t\t})\n\t)\n}\n\n/**\n * Create a new column x row matrix.\n *\n * @private\n * @param {number} span\n * @param {number} rows\n * @return {Array<Array<number>>} matrix\n * @example\n * makeMatrix(10, 10);\n */\nfunction makeMatrix(span: number, rows: number) {\n\tconst matrix = []\n\tfor (let i = 0; i < span; i++) {\n\t\tconst column = []\n\t\tfor (let j = 0; j < rows; j++) {\n\t\t\tcolumn.push(0)\n\t\t}\n\t\tmatrix.push(column)\n\t}\n\treturn matrix\n}\n\n/**\n * Generates incrementally computed values based on the sums and sums of\n * squares for the data array\n *\n * @private\n * @param {number} j\n * @param {number} i\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n * @return {number}\n * @example\n * ssq(0, 1, [-1, 0, 2], [1, 1, 5]);\n */\nfunction ssq(j: number, i: number, sums: number[], sumsOfSquares: number[]) {\n\tlet sji // s(j, i)\n\tif (j > 0) {\n\t\tconst muji = (sums[i] - sums[j - 1]) / (i - j + 1) // mu(j, i)\n\t\tsji = sumsOfSquares[i] - sumsOfSquares[j - 1] - (i - j + 1) * muji * muji\n\t} else {\n\t\tsji = sumsOfSquares[i] - (sums[i] * sums[i]) / (i + 1)\n\t}\n\tif (sji < 0) {\n\t\treturn 0\n\t}\n\treturn sji\n}\n\n/**\n * Function that recursively divides and conquers computations\n * for cluster j\n *\n * @private\n * @param {number} iMin Minimum index in cluster to be computed\n * @param {number} iMax Maximum index in cluster to be computed\n * @param {number} cluster Index of the cluster currently being computed\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n */\nfunction fillMatrixColumn(iMin: number, iMax: number, cluster: number, matrix: number[][], backtrackMatrix: number[][], sums: number[], sumsOfSquares: number[]) {\n\tif (iMin > iMax) {\n\t\treturn\n\t}\n\n\t// Start at midpoint between iMin and iMax\n\tconst i = Math.floor((iMin + iMax) / 2)\n\n\tmatrix[cluster][i] = matrix[cluster - 1][i - 1]\n\tbacktrackMatrix[cluster][i] = i\n\n\tlet jlow = cluster // the lower end for j\n\n\tif (iMin > cluster) {\n\t\tjlow = Math.max(jlow, backtrackMatrix[cluster][iMin - 1] || 0)\n\t}\n\tjlow = Math.max(jlow, backtrackMatrix[cluster - 1][i] || 0)\n\n\tlet jhigh = i - 1 // the upper end for j\n\tif (iMax < matrix[0].length - 1) {\n\t\tjhigh = Math.min(jhigh, backtrackMatrix[cluster][iMax + 1] || 0)\n\t}\n\n\tlet sji\n\tlet sjlowi\n\tlet ssqjlow\n\tlet ssqj\n\tfor (let j = jhigh; j >= jlow; --j) {\n\t\tsji = ssq(j, i, sums, sumsOfSquares)\n\n\t\tif (sji + matrix[cluster - 1][jlow - 1] >= matrix[cluster][i]) {\n\t\t\tbreak\n\t\t}\n\n\t\t// Examine the lower bound of the cluster border\n\t\tsjlowi = ssq(jlow, i, sums, sumsOfSquares)\n\n\t\tssqjlow = sjlowi + matrix[cluster - 1][jlow - 1]\n\n\t\tif (ssqjlow < matrix[cluster][i]) {\n\t\t\t// Shrink the lower bound\n\t\t\tmatrix[cluster][i] = ssqjlow\n\t\t\tbacktrackMatrix[cluster][i] = jlow\n\t\t}\n\t\tjlow++\n\n\t\tssqj = sji + matrix[cluster - 1][j - 1]\n\t\tif (ssqj < matrix[cluster][i]) {\n\t\t\tmatrix[cluster][i] = ssqj\n\t\t\tbacktrackMatrix[cluster][i] = j\n\t\t}\n\t}\n\n\tfillMatrixColumn(iMin, i - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\tfillMatrixColumn(i + 1, iMax, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n}\n\n/**\n * Initializes the main matrices used in Ckmeans and kicks\n * off the divide and conquer cluster computation strategy\n *\n * @private\n * @param {Array<number>} data sorted array of values\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n */\nfunction fillMatrices(data: number[], matrix: number[][], backtrackMatrix: number[][]) {\n\tconst nValues = matrix[0].length\n\n\t// Shift values by the median to improve numeric stability\n\tconst shift = data[Math.floor(nValues / 2)]\n\n\t// Cumulative sum and cumulative sum of squares for all values in data array\n\tconst sums = [] as number[]\n\tconst sumsOfSquares = [] as number[]\n\n\t// Initialize first column in matrix & backtrackMatrix\n\tfor (let i = 0, shiftedValue; i < nValues; ++i) {\n\t\tshiftedValue = data[i] - shift\n\t\tif (i === 0) {\n\t\t\tsums.push(shiftedValue)\n\t\t\tsumsOfSquares.push(shiftedValue * shiftedValue)\n\t\t} else {\n\t\t\tsums.push(sums[i - 1] + shiftedValue)\n\t\t\tsumsOfSquares.push(sumsOfSquares[i - 1] + shiftedValue * shiftedValue)\n\t\t}\n\n\t\t// Initialize for cluster = 0\n\t\tmatrix[0][i] = ssq(0, i, sums, sumsOfSquares)\n\t\tbacktrackMatrix[0][i] = 0\n\t}\n\n\t// Initialize the rest of the span\n\tlet iMin\n\tfor (let cluster = 1; cluster < matrix.length; ++cluster) {\n\t\tif (cluster < matrix.length - 1) {\n\t\t\tiMin = cluster\n\t\t} else {\n\t\t\t// No need to compute matrix[K-1][0] ... matrix[K-1][N-2]\n\t\t\tiMin = nValues - 1\n\t\t}\n\n\t\tfillMatrixColumn(iMin, nValues - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\t}\n}\n\n/**\n * Ckmeans clustering is an improvement on heuristic-based clustering\n * approaches like Jenks. The algorithm was developed in\n * [Haizhou Wang and Mingzhou Song](http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Wang+Song.pdf)\n * as a [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) approach\n * to the problem of clustering numeric data into groups with the least\n * within-group sum-of-squared-deviations.\n *\n * Minimizing the difference within groups - what Wang & Song refer to as\n * `withinss`, or within sum-of-squares, means that groups are optimally\n * homogenous within and the data is split into representative groups.\n * This is very useful for visualization, where you may want to represent\n * a continuous variable in discrete color or style groups. This function\n * can provide groups that emphasize differences between data.\n *\n * Being a dynamic approach, this algorithm is based on two matrices that\n * store incrementally-computed values for squared deviations and backtracking\n * indexes.\n *\n * This implementation is based on Ckmeans 3.4.6, which introduced a new divide\n * and conquer approach that improved runtime from O(kn^2) to O(kn log(n)).\n *\n * Unlike the [original implementation](https://cran.r-project.org/web/packages/Ckmeans.1d.dp/index.html),\n * this implementation does not include any code to automatically determine\n * the optimal number of clusters: this information needs to be explicitly\n * provided.\n *\n * ### References\n * _Ckmeans.1d.dp: Optimal k-means Clustering in One Dimension by Dynamic\n * Programming_ Haizhou Wang and Mingzhou Song ISSN 2073-4859\n *\n * from The R Journal Vol. 3/2, December 2011\n * @param {Array<number>} x input data, as an array of number values\n * @param {number} nClusters number of desired classes. This cannot be\n * greater than the number of values in the data array.\n * @returns {Array<Array<number>>} clustered input\n * @throws {Error} if the number of requested clusters is higher than the size of the data\n * @example\n * ckmeans([-1, 2, -1, 2, 4, 5, 6, -1, 2, -1], 3);\n * // The input, clustered into groups of similar numbers.\n * //= [[-1, -1, -1, -1], [2, 2, 2], [4, 5, 6]]);\n */\nconst ckmeans = (x: number[], nClusters: number): number[][] => {\n\tif (nClusters > x.length) {\n\t\tthrow new Error('cannot generate more classes than there are data values')\n\t}\n\n\tconst sorted = numericSort(x)\n\t// we'll use this as the maximum number of clusters\n\tconst uniqueCount = uniqueCountSorted(sorted)\n\n\t// if all of the input values are identical, there's one cluster\n\t// with all of the input in it.\n\tif (uniqueCount === 1) {\n\t\treturn [sorted]\n\t}\n\n\t// named 'S' originally\n\tconst matrix = makeMatrix(nClusters, sorted.length)\n\t// named 'J' originally\n\tconst backtrackMatrix = makeMatrix(nClusters, sorted.length)\n\n\t// This is a dynamic programming way to solve the problem of minimizing\n\t// within-cluster sum of squares. It's similar to linear regression\n\t// in this way, and this calculation incrementally computes the\n\t// sum of squares that are later read.\n\tfillMatrices(sorted, matrix, backtrackMatrix)\n\n\t// The real work of Ckmeans clustering happens in the matrix generation:\n\t// the generated matrices encode all possible clustering combinations, and\n\t// once they're generated we can solve for the best clustering groups\n\t// very quickly.\n\tconst clusters = []\n\tlet clusterRight = backtrackMatrix[0].length - 1\n\n\t// Backtrack the clusters from the dynamic programming matrix. This\n\t// starts at the bottom-right corner of the matrix (if the top-left is 0, 0),\n\t// and moves the cluster target with the loop.\n\tfor (let cluster = backtrackMatrix.length - 1; cluster >= 0; cluster--) {\n\t\tconst clusterLeft = backtrackMatrix[cluster][clusterRight]\n\n\t\t// fill the cluster from the sorted input by taking a slice of the\n\t\t// array. the backtrack matrix makes this easy - it stores the\n\t\t// indexes where the cluster should start and end.\n\t\tclusters[cluster] = sorted.slice(clusterLeft, clusterRight + 1)\n\n\t\tif (cluster > 0) {\n\t\t\tclusterRight = clusterLeft - 1\n\t\t}\n\t}\n\n\treturn clusters\n}\n\nexport default ckmeans\n"]}
|
|
1
|
+
{"version":3,"file":"ckmeans.js","sourceRoot":"","sources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M,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;QAE1D,kEAAkE;QAClE,8DAA8D;QAC9D,kDAAkD;QAClD,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,CAAC,CAAC,CAAA;QAE/D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YACjB,YAAY,GAAG,WAAW,GAAG,CAAC,CAAA;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA","sourcesContent":["/**\n * For a sorted input, counting the number of unique values\n * is possible in constant time and constant memory. This is\n * a simple implementation of the algorithm.\n *\n * Values are compared with `===`, so objects and non-primitive objects\n * are not handled in any special way.\n *\n * @param {Array<*>} x an array of any kind of value\n * @returns {number} count of unique values\n * @example\n * uniqueCountSorted([1, 2, 3]); // => 3\n * uniqueCountSorted([1, 1, 1]); // => 1\n */\nfunction uniqueCountSorted(x: any[]) {\n\tlet uniqueValueCount = 0,\n\t\tlastSeenValue = undefined\n\tfor (let i = 0; i < x.length; i++) {\n\t\tif (i === 0 || x[i] !== lastSeenValue) {\n\t\t\tlastSeenValue = x[i]\n\t\t\tuniqueValueCount++\n\t\t}\n\t}\n\treturn uniqueValueCount\n}\n\n/**\n * Sort an array of numbers by their numeric value, ensuring that the\n * array is not changed in place.\n *\n * This is necessary because the default behavior of .sort\n * in JavaScript is to sort arrays as string values\n *\n * [1, 10, 12, 102, 20].sort()\n * // output\n * [1, 10, 102, 12, 20]\n *\n * @param {Array<number>} x input array\n * @return {Array<number>} sorted array\n * @private\n * @example\n * numericSort([3, 2, 1]) // => [1, 2, 3]\n */\nfunction numericSort(x: number[]): number[] {\n\treturn (\n\t\tx\n\t\t\t// ensure the array is not changed in-place\n\t\t\t.slice()\n\t\t\t// comparator function that treats input as numeric\n\t\t\t.sort(function (a, b) {\n\t\t\t\treturn a - b\n\t\t\t})\n\t)\n}\n\n/**\n * Create a new column x row matrix.\n *\n * @private\n * @param {number} span\n * @param {number} rows\n * @return {Array<Array<number>>} matrix\n * @example\n * makeMatrix(10, 10);\n */\nfunction makeMatrix(span: number, rows: number) {\n\tconst matrix = []\n\tfor (let i = 0; i < span; i++) {\n\t\tconst column = []\n\t\tfor (let j = 0; j < rows; j++) {\n\t\t\tcolumn.push(0)\n\t\t}\n\t\tmatrix.push(column)\n\t}\n\treturn matrix\n}\n\n/**\n * Generates incrementally computed values based on the sums and sums of\n * squares for the data array\n *\n * @private\n * @param {number} j\n * @param {number} i\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n * @return {number}\n * @example\n * ssq(0, 1, [-1, 0, 2], [1, 1, 5]);\n */\nfunction ssq(j: number, i: number, sums: number[], sumsOfSquares: number[]) {\n\tlet sji // s(j, i)\n\tif (j > 0) {\n\t\tconst muji = (sums[i] - sums[j - 1]) / (i - j + 1) // mu(j, i)\n\t\tsji = sumsOfSquares[i] - sumsOfSquares[j - 1] - (i - j + 1) * muji * muji\n\t} else {\n\t\tsji = sumsOfSquares[i] - (sums[i] * sums[i]) / (i + 1)\n\t}\n\tif (sji < 0) {\n\t\treturn 0\n\t}\n\treturn sji\n}\n\n/**\n * Function that recursively divides and conquers computations\n * for cluster j\n *\n * @private\n * @param {number} iMin Minimum index in cluster to be computed\n * @param {number} iMax Maximum index in cluster to be computed\n * @param {number} cluster Index of the cluster currently being computed\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n */\nfunction fillMatrixColumn(iMin: number, iMax: number, cluster: number, matrix: number[][], backtrackMatrix: number[][], sums: number[], sumsOfSquares: number[]) {\n\tif (iMin > iMax) {\n\t\treturn\n\t}\n\n\t// Start at midpoint between iMin and iMax\n\tconst i = Math.floor((iMin + iMax) / 2)\n\n\tmatrix[cluster][i] = matrix[cluster - 1][i - 1]\n\tbacktrackMatrix[cluster][i] = i\n\n\tlet jlow = cluster // the lower end for j\n\n\tif (iMin > cluster) {\n\t\tjlow = Math.max(jlow, backtrackMatrix[cluster][iMin - 1] || 0)\n\t}\n\tjlow = Math.max(jlow, backtrackMatrix[cluster - 1][i] || 0)\n\n\tlet jhigh = i - 1 // the upper end for j\n\tif (iMax < matrix[0].length - 1) {\n\t\tjhigh = Math.min(jhigh, backtrackMatrix[cluster][iMax + 1] || 0)\n\t}\n\n\tlet sji\n\tlet sjlowi\n\tlet ssqjlow\n\tlet ssqj\n\tfor (let j = jhigh; j >= jlow; --j) {\n\t\tsji = ssq(j, i, sums, sumsOfSquares)\n\n\t\tif (sji + matrix[cluster - 1][jlow - 1] >= matrix[cluster][i]) {\n\t\t\tbreak\n\t\t}\n\n\t\t// Examine the lower bound of the cluster border\n\t\tsjlowi = ssq(jlow, i, sums, sumsOfSquares)\n\n\t\tssqjlow = sjlowi + matrix[cluster - 1][jlow - 1]\n\n\t\tif (ssqjlow < matrix[cluster][i]) {\n\t\t\t// Shrink the lower bound\n\t\t\tmatrix[cluster][i] = ssqjlow\n\t\t\tbacktrackMatrix[cluster][i] = jlow\n\t\t}\n\t\tjlow++\n\n\t\tssqj = sji + matrix[cluster - 1][j - 1]\n\t\tif (ssqj < matrix[cluster][i]) {\n\t\t\tmatrix[cluster][i] = ssqj\n\t\t\tbacktrackMatrix[cluster][i] = j\n\t\t}\n\t}\n\n\tfillMatrixColumn(iMin, i - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\tfillMatrixColumn(i + 1, iMax, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n}\n\n/**\n * Initializes the main matrices used in Ckmeans and kicks\n * off the divide and conquer cluster computation strategy\n *\n * @private\n * @param {Array<number>} data sorted array of values\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n */\nfunction fillMatrices(data: number[], matrix: number[][], backtrackMatrix: number[][]) {\n\tconst nValues = matrix[0].length\n\n\t// Shift values by the median to improve numeric stability\n\tconst shift = data[Math.floor(nValues / 2)]\n\n\t// Cumulative sum and cumulative sum of squares for all values in data array\n\tconst sums = [] as number[]\n\tconst sumsOfSquares = [] as number[]\n\n\t// Initialize first column in matrix & backtrackMatrix\n\tfor (let i = 0, shiftedValue; i < nValues; ++i) {\n\t\tshiftedValue = data[i] - shift\n\t\tif (i === 0) {\n\t\t\tsums.push(shiftedValue)\n\t\t\tsumsOfSquares.push(shiftedValue * shiftedValue)\n\t\t} else {\n\t\t\tsums.push(sums[i - 1] + shiftedValue)\n\t\t\tsumsOfSquares.push(sumsOfSquares[i - 1] + shiftedValue * shiftedValue)\n\t\t}\n\n\t\t// Initialize for cluster = 0\n\t\tmatrix[0][i] = ssq(0, i, sums, sumsOfSquares)\n\t\tbacktrackMatrix[0][i] = 0\n\t}\n\n\t// Initialize the rest of the span\n\tlet iMin\n\tfor (let cluster = 1; cluster < matrix.length; ++cluster) {\n\t\tif (cluster < matrix.length - 1) {\n\t\t\tiMin = cluster\n\t\t} else {\n\t\t\t// No need to compute matrix[K-1][0] ... matrix[K-1][N-2]\n\t\t\tiMin = nValues - 1\n\t\t}\n\n\t\tfillMatrixColumn(iMin, nValues - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\t}\n}\n\n/**\n * Ckmeans clustering is an improvement on heuristic-based clustering\n * approaches like Jenks. The algorithm was developed in\n * [Haizhou Wang and Mingzhou Song](http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Wang+Song.pdf)\n * as a [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) approach\n * to the problem of clustering numeric data into groups with the least\n * within-group sum-of-squared-deviations.\n *\n * Minimizing the difference within groups - what Wang & Song refer to as\n * `withinss`, or within sum-of-squares, means that groups are optimally\n * homogenous within and the data is split into representative groups.\n * This is very useful for visualization, where you may want to represent\n * a continuous variable in discrete color or style groups. This function\n * can provide groups that emphasize differences between data.\n *\n * Being a dynamic approach, this algorithm is based on two matrices that\n * store incrementally-computed values for squared deviations and backtracking\n * indexes.\n *\n * This implementation is based on Ckmeans 3.4.6, which introduced a new divide\n * and conquer approach that improved runtime from O(kn^2) to O(kn log(n)).\n *\n * Unlike the [original implementation](https://cran.r-project.org/web/packages/Ckmeans.1d.dp/index.html),\n * this implementation does not include any code to automatically determine\n * the optimal number of clusters: this information needs to be explicitly\n * provided.\n *\n * ### References\n * _Ckmeans.1d.dp: Optimal k-means Clustering in One Dimension by Dynamic\n * Programming_ Haizhou Wang and Mingzhou Song ISSN 2073-4859\n *\n * from The R Journal Vol. 3/2, December 2011\n * @param {Array<number>} x input data, as an array of number values\n * @param {number} nClusters number of desired classes. This cannot be\n * greater than the number of values in the data array.\n * @returns {Array<Array<number>>} clustered input\n * @throws {Error} if the number of requested clusters is higher than the size of the data\n * @example\n * ckmeans([-1, 2, -1, 2, 4, 5, 6, -1, 2, -1], 3);\n * // The input, clustered into groups of similar numbers.\n * //= [[-1, -1, -1, -1], [2, 2, 2], [4, 5, 6]]);\n */\nconst ckmeans = (x: number[], nClusters: number): number[][] => {\n\tif (nClusters > x.length) {\n\t\tthrow new Error('cannot generate more classes than there are data values')\n\t}\n\n\tconst sorted = numericSort(x)\n\t// we'll use this as the maximum number of clusters\n\tconst uniqueCount = uniqueCountSorted(sorted)\n\n\t// if all of the input values are identical, there's one cluster\n\t// with all of the input in it.\n\tif (uniqueCount === 1) {\n\t\treturn [sorted]\n\t}\n\n\t// named 'S' originally\n\tconst matrix = makeMatrix(nClusters, sorted.length)\n\t// named 'J' originally\n\tconst backtrackMatrix = makeMatrix(nClusters, sorted.length)\n\n\t// This is a dynamic programming way to solve the problem of minimizing\n\t// within-cluster sum of squares. It's similar to linear regression\n\t// in this way, and this calculation incrementally computes the\n\t// sum of squares that are later read.\n\tfillMatrices(sorted, matrix, backtrackMatrix)\n\n\t// The real work of Ckmeans clustering happens in the matrix generation:\n\t// the generated matrices encode all possible clustering combinations, and\n\t// once they're generated we can solve for the best clustering groups\n\t// very quickly.\n\tconst clusters = []\n\tlet clusterRight = backtrackMatrix[0].length - 1\n\n\t// Backtrack the clusters from the dynamic programming matrix. This\n\t// starts at the bottom-right corner of the matrix (if the top-left is 0, 0),\n\t// and moves the cluster target with the loop.\n\tfor (let cluster = backtrackMatrix.length - 1; cluster >= 0; cluster--) {\n\t\tconst clusterLeft = backtrackMatrix[cluster][clusterRight]\n\n\t\t// fill the cluster from the sorted input by taking a slice of the\n\t\t// array. the backtrack matrix makes this easy - it stores the\n\t\t// indexes where the cluster should start and end.\n\t\tclusters[cluster] = sorted.slice(clusterLeft, clusterRight + 1)\n\n\t\tif (cluster > 0) {\n\t\t\tclusterRight = clusterLeft - 1\n\t\t}\n\t}\n\n\treturn clusters\n}\n\nexport default ckmeans\n"]}
|
package/generic/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./model"), exports);
|
|
1
|
+
export * from './model';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/generic/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tmp/generic/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tmp/generic/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA","sourcesContent":["export * from './model'\n"]}
|
package/generic/model.js
CHANGED
|
@@ -47,8 +47,7 @@ export declare class BridgedFormValuesContainer implements FormValuesContainer<F
|
|
|
47
47
|
* @param initialValuesProvider A lambda that provides the initial values of the form
|
|
48
48
|
*/
|
|
49
49
|
constructor(responsible: string, contactFormValuesContainer: ContactFormValuesContainer, interpreter?: (<T, S extends {
|
|
50
|
-
[key: string]: unknown;
|
|
51
|
-
[key: symbol]: unknown;
|
|
50
|
+
[key: string | symbol]: unknown;
|
|
52
51
|
}>(formula: string, sandbox: S) => T | undefined) | undefined, contact?: DecryptedContact, initialValuesProvider?: (anchorId?: string, templateId?: string) => {
|
|
53
52
|
metadata: FieldMetadata;
|
|
54
53
|
revisionsFilter: (id: string, history: Version<FieldMetadata>[]) => (string | null)[];
|